File manager - Edit - /home/rootabc/vanlog.squareroot.co.za/wp-includes/Text/js.tar
Back
shortcode.js 0000644 00000025006 15125140777 0007110 0 ustar 00 /** * Utility functions for parsing and handling shortcodes in JavaScript. * * @output wp-includes/js/shortcode.js */ /** * Ensure the global `wp` object exists. * * @namespace wp */ window.wp = window.wp || {}; (function(){ wp.shortcode = { /* * ### Find the next matching shortcode. * * Given a shortcode `tag`, a block of `text`, and an optional starting * `index`, returns the next matching shortcode or `undefined`. * * Shortcodes are formatted as an object that contains the match * `content`, the matching `index`, and the parsed `shortcode` object. */ next: function( tag, text, index ) { var re = wp.shortcode.regexp( tag ), match, result; re.lastIndex = index || 0; match = re.exec( text ); if ( ! match ) { return; } // If we matched an escaped shortcode, try again. if ( '[' === match[1] && ']' === match[7] ) { return wp.shortcode.next( tag, text, re.lastIndex ); } result = { index: match.index, content: match[0], shortcode: wp.shortcode.fromMatch( match ) }; // If we matched a leading `[`, strip it from the match // and increment the index accordingly. if ( match[1] ) { result.content = result.content.slice( 1 ); result.index++; } // If we matched a trailing `]`, strip it from the match. if ( match[7] ) { result.content = result.content.slice( 0, -1 ); } return result; }, /* * ### Replace matching shortcodes in a block of text. * * Accepts a shortcode `tag`, content `text` to scan, and a `callback` * to process the shortcode matches and return a replacement string. * Returns the `text` with all shortcodes replaced. * * Shortcode matches are objects that contain the shortcode `tag`, * a shortcode `attrs` object, the `content` between shortcode tags, * and a boolean flag to indicate if the match was a `single` tag. */ replace: function( tag, text, callback ) { return text.replace( wp.shortcode.regexp( tag ), function( match, left, tag, attrs, slash, content, closing, right ) { // If both extra brackets exist, the shortcode has been // properly escaped. if ( left === '[' && right === ']' ) { return match; } // Create the match object and pass it through the callback. var result = callback( wp.shortcode.fromMatch( arguments ) ); // Make sure to return any of the extra brackets if they // weren't used to escape the shortcode. return result ? left + result + right : match; }); }, /* * ### Generate a string from shortcode parameters. * * Creates a `wp.shortcode` instance and returns a string. * * Accepts the same `options` as the `wp.shortcode()` constructor, * containing a `tag` string, a string or object of `attrs`, a boolean * indicating whether to format the shortcode using a `single` tag, and a * `content` string. */ string: function( options ) { return new wp.shortcode( options ).string(); }, /* * ### Generate a RegExp to identify a shortcode. * * The base regex is functionally equivalent to the one found in * `get_shortcode_regex()` in `wp-includes/shortcodes.php`. * * Capture groups: * * 1. An extra `[` to allow for escaping shortcodes with double `[[]]`. * 2. The shortcode name. * 3. The shortcode argument list. * 4. The self closing `/`. * 5. The content of a shortcode when it wraps some content. * 6. The closing tag. * 7. An extra `]` to allow for escaping shortcodes with double `[[]]`. */ regexp: _.memoize( function( tag ) { return new RegExp( '\\[(\\[?)(' + tag + ')(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)', 'g' ); }), /* * ### Parse shortcode attributes. * * Shortcodes accept many types of attributes. These can chiefly be * divided into named and numeric attributes: * * Named attributes are assigned on a key/value basis, while numeric * attributes are treated as an array. * * Named attributes can be formatted as either `name="value"`, * `name='value'`, or `name=value`. Numeric attributes can be formatted * as `"value"` or just `value`. */ attrs: _.memoize( function( text ) { var named = {}, numeric = [], pattern, match; /* * This regular expression is reused from `shortcode_parse_atts()` * in `wp-includes/shortcodes.php`. * * Capture groups: * * 1. An attribute name, that corresponds to... * 2. a value in double quotes. * 3. An attribute name, that corresponds to... * 4. a value in single quotes. * 5. An attribute name, that corresponds to... * 6. an unquoted value. * 7. A numeric attribute in double quotes. * 8. A numeric attribute in single quotes. * 9. An unquoted numeric attribute. */ pattern = /([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g; // Map zero-width spaces to actual spaces. text = text.replace( /[\u00a0\u200b]/g, ' ' ); // Match and normalize attributes. while ( (match = pattern.exec( text )) ) { if ( match[1] ) { named[ match[1].toLowerCase() ] = match[2]; } else if ( match[3] ) { named[ match[3].toLowerCase() ] = match[4]; } else if ( match[5] ) { named[ match[5].toLowerCase() ] = match[6]; } else if ( match[7] ) { numeric.push( match[7] ); } else if ( match[8] ) { numeric.push( match[8] ); } else if ( match[9] ) { numeric.push( match[9] ); } } return { named: named, numeric: numeric }; }), /* * ### Generate a Shortcode Object from a RegExp match. * * Accepts a `match` object from calling `regexp.exec()` on a `RegExp` * generated by `wp.shortcode.regexp()`. `match` can also be set * to the `arguments` from a callback passed to `regexp.replace()`. */ fromMatch: function( match ) { var type; if ( match[4] ) { type = 'self-closing'; } else if ( match[6] ) { type = 'closed'; } else { type = 'single'; } return new wp.shortcode({ tag: match[2], attrs: match[3], type: type, content: match[5] }); } }; /* * Shortcode Objects * ----------------- * * Shortcode objects are generated automatically when using the main * `wp.shortcode` methods: `next()`, `replace()`, and `string()`. * * To access a raw representation of a shortcode, pass an `options` object, * containing a `tag` string, a string or object of `attrs`, a string * indicating the `type` of the shortcode ('single', 'self-closing', * or 'closed'), and a `content` string. */ wp.shortcode = _.extend( function( options ) { _.extend( this, _.pick( options || {}, 'tag', 'attrs', 'type', 'content' ) ); var attrs = this.attrs; // Ensure we have a correctly formatted `attrs` object. this.attrs = { named: {}, numeric: [] }; if ( ! attrs ) { return; } // Parse a string of attributes. if ( _.isString( attrs ) ) { this.attrs = wp.shortcode.attrs( attrs ); // Identify a correctly formatted `attrs` object. } else if ( _.difference( _.keys( attrs ), [ 'named', 'numeric' ] ).length === 0 ) { this.attrs = _.defaults( attrs, this.attrs ); // Handle a flat object of attributes. } else { _.each( options.attrs, function( value, key ) { this.set( key, value ); }, this ); } }, wp.shortcode ); _.extend( wp.shortcode.prototype, { /* * ### Get a shortcode attribute. * * Automatically detects whether `attr` is named or numeric and routes * it accordingly. */ get: function( attr ) { return this.attrs[ _.isNumber( attr ) ? 'numeric' : 'named' ][ attr ]; }, /* * ### Set a shortcode attribute. * * Automatically detects whether `attr` is named or numeric and routes * it accordingly. */ set: function( attr, value ) { this.attrs[ _.isNumber( attr ) ? 'numeric' : 'named' ][ attr ] = value; return this; }, // ### Transform the shortcode match into a string. string: function() { var text = '[' + this.tag; _.each( this.attrs.numeric, function( value ) { if ( /\s/.test( value ) ) { text += ' "' + value + '"'; } else { text += ' ' + value; } }); _.each( this.attrs.named, function( value, name ) { text += ' ' + name + '="' + value + '"'; }); // If the tag is marked as `single` or `self-closing`, close the // tag and ignore any additional content. if ( 'single' === this.type ) { return text + ']'; } else if ( 'self-closing' === this.type ) { return text + ' /]'; } // Complete the opening tag. text += ']'; if ( this.content ) { text += this.content; } // Add the closing tag. return text + '[/' + this.tag + ']'; } }); }()); /* * HTML utility functions * ---------------------- * * Experimental. These functions may change or be removed in the future. */ (function(){ wp.html = _.extend( wp.html || {}, { /* * ### Parse HTML attributes. * * Converts `content` to a set of parsed HTML attributes. * Utilizes `wp.shortcode.attrs( content )`, which is a valid superset of * the HTML attribute specification. Reformats the attributes into an * object that contains the `attrs` with `key:value` mapping, and a record * of the attributes that were entered using `empty` attribute syntax (i.e. * with no value). */ attrs: function( content ) { var result, attrs; // If `content` ends in a slash, strip it. if ( '/' === content[ content.length - 1 ] ) { content = content.slice( 0, -1 ); } result = wp.shortcode.attrs( content ); attrs = result.named; _.each( result.numeric, function( key ) { if ( /\s/.test( key ) ) { return; } attrs[ key ] = ''; }); return attrs; }, // ### Convert an HTML-representation of an object to a string. string: function( options ) { var text = '<' + options.tag, content = options.content || ''; _.each( options.attrs, function( value, attr ) { text += ' ' + attr; // Convert boolean values to strings. if ( _.isBoolean( value ) ) { value = value ? 'true' : 'false'; } text += '="' + value + '"'; }); // Return the result if it is a self-closing tag. if ( options.single ) { return text + ' />'; } // Complete the opening tag. text += '>'; // If `content` is an object, recursively call this function. text += _.isObject( content ) ? wp.html.string( content ) : content; return text + '</' + options.tag + '>'; } }); }()); underscore.min.js 0000644 00000044731 15125140777 0010057 0 ustar 00 /*! This file is auto-generated */ !function(n,t){var r,e;"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("underscore",t):(n="undefined"!=typeof globalThis?globalThis:n||self,r=n._,(e=n._=t()).noConflict=function(){return n._=r,e})}(this,function(){var n="1.13.7",t="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},e=Array.prototype,V=Object.prototype,F="undefined"!=typeof Symbol?Symbol.prototype:null,P=e.push,f=e.slice,s=V.toString,q=V.hasOwnProperty,r="undefined"!=typeof ArrayBuffer,u="undefined"!=typeof DataView,U=Array.isArray,W=Object.keys,z=Object.create,L=r&&ArrayBuffer.isView,$=isNaN,C=isFinite,K=!{toString:null}.propertyIsEnumerable("toString"),J=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],G=Math.pow(2,53)-1;function l(u,o){return o=null==o?u.length-1:+o,function(){for(var n=Math.max(arguments.length-o,0),t=Array(n),r=0;r<n;r++)t[r]=arguments[r+o];switch(o){case 0:return u.call(this,t);case 1:return u.call(this,arguments[0],t);case 2:return u.call(this,arguments[0],arguments[1],t)}for(var e=Array(o+1),r=0;r<o;r++)e[r]=arguments[r];return e[o]=t,u.apply(this,e)}}function o(n){var t=typeof n;return"function"==t||"object"==t&&!!n}function H(n){return void 0===n}function Q(n){return!0===n||!1===n||"[object Boolean]"===s.call(n)}function i(n){var t="[object "+n+"]";return function(n){return s.call(n)===t}}var X=i("String"),Y=i("Number"),Z=i("Date"),nn=i("RegExp"),tn=i("Error"),rn=i("Symbol"),en=i("ArrayBuffer"),a=i("Function"),t=t.document&&t.document.childNodes,p=a="function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof t?function(n){return"function"==typeof n||!1}:a,t=i("Object"),un=u&&(!/\[native code\]/.test(String(DataView))||t(new DataView(new ArrayBuffer(8)))),a="undefined"!=typeof Map&&t(new Map),u=i("DataView");var h=un?function(n){return null!=n&&p(n.getInt8)&&en(n.buffer)}:u,v=U||i("Array");function y(n,t){return null!=n&&q.call(n,t)}var on=i("Arguments"),an=(!function(){on(arguments)||(on=function(n){return y(n,"callee")})}(),on);function fn(n){return Y(n)&&$(n)}function cn(n){return function(){return n}}function ln(t){return function(n){n=t(n);return"number"==typeof n&&0<=n&&n<=G}}function sn(t){return function(n){return null==n?void 0:n[t]}}var d=sn("byteLength"),pn=ln(d),hn=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var vn=r?function(n){return L?L(n)&&!h(n):pn(n)&&hn.test(s.call(n))}:cn(!1),g=sn("length");function yn(n,t){t=function(t){for(var r={},n=t.length,e=0;e<n;++e)r[t[e]]=!0;return{contains:function(n){return!0===r[n]},push:function(n){return r[n]=!0,t.push(n)}}}(t);var r=J.length,e=n.constructor,u=p(e)&&e.prototype||V,o="constructor";for(y(n,o)&&!t.contains(o)&&t.push(o);r--;)(o=J[r])in n&&n[o]!==u[o]&&!t.contains(o)&&t.push(o)}function b(n){if(!o(n))return[];if(W)return W(n);var t,r=[];for(t in n)y(n,t)&&r.push(t);return K&&yn(n,r),r}function dn(n,t){var r=b(t),e=r.length;if(null==n)return!e;for(var u=Object(n),o=0;o<e;o++){var i=r[o];if(t[i]!==u[i]||!(i in u))return!1}return!0}function m(n){return n instanceof m?n:this instanceof m?void(this._wrapped=n):new m(n)}function gn(n){return new Uint8Array(n.buffer||n,n.byteOffset||0,d(n))}m.VERSION=n,m.prototype.valueOf=m.prototype.toJSON=m.prototype.value=function(){return this._wrapped},m.prototype.toString=function(){return String(this._wrapped)};var bn="[object DataView]";function mn(n,t,r,e){var u;return n===t?0!==n||1/n==1/t:null!=n&&null!=t&&(n!=n?t!=t:("function"==(u=typeof n)||"object"==u||"object"==typeof t)&&function n(t,r,e,u){t instanceof m&&(t=t._wrapped);r instanceof m&&(r=r._wrapped);var o=s.call(t);if(o!==s.call(r))return!1;if(un&&"[object Object]"==o&&h(t)){if(!h(r))return!1;o=bn}switch(o){case"[object RegExp]":case"[object String]":return""+t==""+r;case"[object Number]":return+t!=+t?+r!=+r:0==+t?1/+t==1/r:+t==+r;case"[object Date]":case"[object Boolean]":return+t==+r;case"[object Symbol]":return F.valueOf.call(t)===F.valueOf.call(r);case"[object ArrayBuffer]":case bn:return n(gn(t),gn(r),e,u)}o="[object Array]"===o;if(!o&&vn(t)){var i=d(t);if(i!==d(r))return!1;if(t.buffer===r.buffer&&t.byteOffset===r.byteOffset)return!0;o=!0}if(!o){if("object"!=typeof t||"object"!=typeof r)return!1;var i=t.constructor,a=r.constructor;if(i!==a&&!(p(i)&&i instanceof i&&p(a)&&a instanceof a)&&"constructor"in t&&"constructor"in r)return!1}e=e||[];u=u||[];var f=e.length;for(;f--;)if(e[f]===t)return u[f]===r;e.push(t);u.push(r);if(o){if((f=t.length)!==r.length)return!1;for(;f--;)if(!mn(t[f],r[f],e,u))return!1}else{var c,l=b(t);if(f=l.length,b(r).length!==f)return!1;for(;f--;)if(c=l[f],!y(r,c)||!mn(t[c],r[c],e,u))return!1}e.pop();u.pop();return!0}(n,t,r,e))}function c(n){if(!o(n))return[];var t,r=[];for(t in n)r.push(t);return K&&yn(n,r),r}function jn(e){var u=g(e);return function(n){if(null==n)return!1;var t=c(n);if(g(t))return!1;for(var r=0;r<u;r++)if(!p(n[e[r]]))return!1;return e!==_n||!p(n[wn])}}var wn="forEach",t=["clear","delete"],u=["get","has","set"],U=t.concat(wn,u),_n=t.concat(u),r=["add"].concat(t,wn,"has"),u=a?jn(U):i("Map"),t=a?jn(_n):i("WeakMap"),U=a?jn(r):i("Set"),a=i("WeakSet");function j(n){for(var t=b(n),r=t.length,e=Array(r),u=0;u<r;u++)e[u]=n[t[u]];return e}function An(n){for(var t={},r=b(n),e=0,u=r.length;e<u;e++)t[n[r[e]]]=r[e];return t}function xn(n){var t,r=[];for(t in n)p(n[t])&&r.push(t);return r.sort()}function Sn(f,c){return function(n){var t=arguments.length;if(c&&(n=Object(n)),!(t<2||null==n))for(var r=1;r<t;r++)for(var e=arguments[r],u=f(e),o=u.length,i=0;i<o;i++){var a=u[i];c&&void 0!==n[a]||(n[a]=e[a])}return n}}var On=Sn(c),w=Sn(b),Mn=Sn(c,!0);function En(n){var t;return o(n)?z?z(n):((t=function(){}).prototype=n,n=new t,t.prototype=null,n):{}}function Bn(n){return v(n)?n:[n]}function _(n){return m.toPath(n)}function Nn(n,t){for(var r=t.length,e=0;e<r;e++){if(null==n)return;n=n[t[e]]}return r?n:void 0}function In(n,t,r){n=Nn(n,_(t));return H(n)?r:n}function Tn(n){return n}function A(t){return t=w({},t),function(n){return dn(n,t)}}function kn(t){return t=_(t),function(n){return Nn(n,t)}}function x(u,o,n){if(void 0===o)return u;switch(null==n?3:n){case 1:return function(n){return u.call(o,n)};case 3:return function(n,t,r){return u.call(o,n,t,r)};case 4:return function(n,t,r,e){return u.call(o,n,t,r,e)}}return function(){return u.apply(o,arguments)}}function Dn(n,t,r){return null==n?Tn:p(n)?x(n,t,r):(o(n)&&!v(n)?A:kn)(n)}function Rn(n,t){return Dn(n,t,1/0)}function S(n,t,r){return m.iteratee!==Rn?m.iteratee(n,t):Dn(n,t,r)}function Vn(){}function Fn(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))}m.toPath=Bn,m.iteratee=Rn;var O=Date.now||function(){return(new Date).getTime()};function Pn(t){function r(n){return t[n]}var n="(?:"+b(t).join("|")+")",e=RegExp(n),u=RegExp(n,"g");return function(n){return e.test(n=null==n?"":""+n)?n.replace(u,r):n}}var r={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qn=Pn(r),r=Pn(An(r)),Un=m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Wn=/(.)^/,zn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Ln=/\\|'|\r|\n|\u2028|\u2029/g;function $n(n){return"\\"+zn[n]}var Cn=/^\s*(\w|\$)+\s*$/;var Kn=0;function Jn(n,t,r,e,u){return e instanceof t?(e=En(n.prototype),o(t=n.apply(e,u))?t:e):n.apply(r,u)}var M=l(function(u,o){function i(){for(var n=0,t=o.length,r=Array(t),e=0;e<t;e++)r[e]=o[e]===a?arguments[n++]:o[e];for(;n<arguments.length;)r.push(arguments[n++]);return Jn(u,i,this,this,r)}var a=M.placeholder;return i}),Gn=(M.placeholder=m,l(function(t,r,e){var u;if(p(t))return u=l(function(n){return Jn(t,u,r,this,e.concat(n))});throw new TypeError("Bind must be called on a function")})),E=ln(g);function B(n,t,r,e){if(e=e||[],t||0===t){if(t<=0)return e.concat(n)}else t=1/0;for(var u=e.length,o=0,i=g(n);o<i;o++){var a=n[o];if(E(a)&&(v(a)||an(a)))if(1<t)B(a,t-1,r,e),u=e.length;else for(var f=0,c=a.length;f<c;)e[u++]=a[f++];else r||(e[u++]=a)}return e}var Hn=l(function(n,t){var r=(t=B(t,!1,!1)).length;if(r<1)throw new Error("bindAll must be passed function names");for(;r--;){var e=t[r];n[e]=Gn(n[e],n)}return n});var Qn=l(function(n,t,r){return setTimeout(function(){return n.apply(null,r)},t)}),Xn=M(Qn,m,1);function Yn(n){return function(){return!n.apply(this,arguments)}}function Zn(n,t){var r;return function(){return 0<--n&&(r=t.apply(this,arguments)),n<=1&&(t=null),r}}var nt=M(Zn,2);function tt(n,t,r){t=S(t,r);for(var e,u=b(n),o=0,i=u.length;o<i;o++)if(t(n[e=u[o]],e,n))return e}function rt(o){return function(n,t,r){t=S(t,r);for(var e=g(n),u=0<o?0:e-1;0<=u&&u<e;u+=o)if(t(n[u],u,n))return u;return-1}}var et=rt(1),ut=rt(-1);function ot(n,t,r,e){for(var u=(r=S(r,e,1))(t),o=0,i=g(n);o<i;){var a=Math.floor((o+i)/2);r(n[a])<u?o=a+1:i=a}return o}function it(o,i,a){return function(n,t,r){var e=0,u=g(n);if("number"==typeof r)0<o?e=0<=r?r:Math.max(r+u,e):u=0<=r?Math.min(r+1,u):r+u+1;else if(a&&r&&u)return n[r=a(n,t)]===t?r:-1;if(t!=t)return 0<=(r=i(f.call(n,e,u),fn))?r+e:-1;for(r=0<o?e:u-1;0<=r&&r<u;r+=o)if(n[r]===t)return r;return-1}}var at=it(1,et,ot),ft=it(-1,ut);function ct(n,t,r){t=(E(n)?et:tt)(n,t,r);if(void 0!==t&&-1!==t)return n[t]}function N(n,t,r){if(t=x(t,r),E(n))for(u=0,o=n.length;u<o;u++)t(n[u],u,n);else for(var e=b(n),u=0,o=e.length;u<o;u++)t(n[e[u]],e[u],n);return n}function I(n,t,r){t=S(t,r);for(var e=!E(n)&&b(n),u=(e||n).length,o=Array(u),i=0;i<u;i++){var a=e?e[i]:i;o[i]=t(n[a],a,n)}return o}function lt(f){return function(n,t,r,e){var u=3<=arguments.length;return function(n,t,r,e){var u=!E(n)&&b(n),o=(u||n).length,i=0<f?0:o-1;for(e||(r=n[u?u[i]:i],i+=f);0<=i&&i<o;i+=f){var a=u?u[i]:i;r=t(r,n[a],a,n)}return r}(n,x(t,e,4),r,u)}}var st=lt(1),pt=lt(-1);function T(n,e,t){var u=[];return e=S(e,t),N(n,function(n,t,r){e(n,t,r)&&u.push(n)}),u}function ht(n,t,r){t=S(t,r);for(var e=!E(n)&&b(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(!t(n[i],i,n))return!1}return!0}function vt(n,t,r){t=S(t,r);for(var e=!E(n)&&b(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(t(n[i],i,n))return!0}return!1}function k(n,t,r,e){return E(n)||(n=j(n)),0<=at(n,t,r="number"==typeof r&&!e?r:0)}var yt=l(function(n,r,e){var u,o;return p(r)?o=r:(r=_(r),u=r.slice(0,-1),r=r[r.length-1]),I(n,function(n){var t=o;if(!t){if(null==(n=u&&u.length?Nn(n,u):n))return;t=n[r]}return null==t?t:t.apply(n,e)})});function dt(n,t){return I(n,kn(t))}function gt(n,e,t){var r,u,o=-1/0,i=-1/0;if(null==e||"number"==typeof e&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=E(n)?n:j(n)).length;a<f;a++)null!=(r=n[a])&&o<r&&(o=r);else e=S(e,t),N(n,function(n,t,r){u=e(n,t,r),(i<u||u===-1/0&&o===-1/0)&&(o=n,i=u)});return o}var bt=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function mt(n){return n?v(n)?f.call(n):X(n)?n.match(bt):E(n)?I(n,Tn):j(n):[]}function jt(n,t,r){if(null==t||r)return(n=E(n)?n:j(n))[Fn(n.length-1)];for(var e=mt(n),r=g(e),u=(t=Math.max(Math.min(t,r),0),r-1),o=0;o<t;o++){var i=Fn(o,u),a=e[o];e[o]=e[i],e[i]=a}return e.slice(0,t)}function D(o,t){return function(r,e,n){var u=t?[[],[]]:{};return e=S(e,n),N(r,function(n,t){t=e(n,t,r);o(u,n,t)}),u}}var wt=D(function(n,t,r){y(n,r)?n[r].push(t):n[r]=[t]}),_t=D(function(n,t,r){n[r]=t}),At=D(function(n,t,r){y(n,r)?n[r]++:n[r]=1}),xt=D(function(n,t,r){n[r?0:1].push(t)},!0);function St(n,t,r){return t in r}var Ot=l(function(n,t){var r={},e=t[0];if(null!=n){p(e)?(1<t.length&&(e=x(e,t[1])),t=c(n)):(e=St,t=B(t,!1,!1),n=Object(n));for(var u=0,o=t.length;u<o;u++){var i=t[u],a=n[i];e(a,i,n)&&(r[i]=a)}}return r}),Mt=l(function(n,r){var t,e=r[0];return p(e)?(e=Yn(e),1<r.length&&(t=r[1])):(r=I(B(r,!1,!1),String),e=function(n,t){return!k(r,t)}),Ot(n,e,t)});function Et(n,t,r){return f.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))}function Bt(n,t,r){return null==n||n.length<1?null==t||r?void 0:[]:null==t||r?n[0]:Et(n,n.length-t)}function R(n,t,r){return f.call(n,null==t||r?1:t)}var Nt=l(function(n,t){return t=B(t,!0,!0),T(n,function(n){return!k(t,n)})}),It=l(function(n,t){return Nt(n,t)});function Tt(n,t,r,e){Q(t)||(e=r,r=t,t=!1),null!=r&&(r=S(r,e));for(var u=[],o=[],i=0,a=g(n);i<a;i++){var f=n[i],c=r?r(f,i,n):f;t&&!r?(i&&o===c||u.push(f),o=c):r?k(o,c)||(o.push(c),u.push(f)):k(u,f)||u.push(f)}return u}var kt=l(function(n){return Tt(B(n,!0,!0))});function Dt(n){for(var t=n&>(n,g).length||0,r=Array(t),e=0;e<t;e++)r[e]=dt(n,e);return r}var Rt=l(Dt);function Vt(n,t){return n._chain?m(t).chain():t}function Ft(r){return N(xn(r),function(n){var t=m[n]=r[n];m.prototype[n]=function(){var n=[this._wrapped];return P.apply(n,arguments),Vt(this,t.apply(m,n))}}),m}N(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=e[t];m.prototype[t]=function(){var n=this._wrapped;return null!=n&&(r.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0]),Vt(this,n)}}),N(["concat","join","slice"],function(n){var t=e[n];m.prototype[n]=function(){var n=this._wrapped;return Vt(this,n=null!=n?t.apply(n,arguments):n)}});n=Ft({__proto__:null,VERSION:n,restArguments:l,isObject:o,isNull:function(n){return null===n},isUndefined:H,isBoolean:Q,isElement:function(n){return!(!n||1!==n.nodeType)},isString:X,isNumber:Y,isDate:Z,isRegExp:nn,isError:tn,isSymbol:rn,isArrayBuffer:en,isDataView:h,isArray:v,isFunction:p,isArguments:an,isFinite:function(n){return!rn(n)&&C(n)&&!isNaN(parseFloat(n))},isNaN:fn,isTypedArray:vn,isEmpty:function(n){var t;return null==n||("number"==typeof(t=g(n))&&(v(n)||X(n)||an(n))?0===t:0===g(b(n)))},isMatch:dn,isEqual:function(n,t){return mn(n,t)},isMap:u,isWeakMap:t,isSet:U,isWeakSet:a,keys:b,allKeys:c,values:j,pairs:function(n){for(var t=b(n),r=t.length,e=Array(r),u=0;u<r;u++)e[u]=[t[u],n[t[u]]];return e},invert:An,functions:xn,methods:xn,extend:On,extendOwn:w,assign:w,defaults:Mn,create:function(n,t){return n=En(n),t&&w(n,t),n},clone:function(n){return o(n)?v(n)?n.slice():On({},n):n},tap:function(n,t){return t(n),n},get:In,has:function(n,t){for(var r=(t=_(t)).length,e=0;e<r;e++){var u=t[e];if(!y(n,u))return!1;n=n[u]}return!!r},mapObject:function(n,t,r){t=S(t,r);for(var e=b(n),u=e.length,o={},i=0;i<u;i++){var a=e[i];o[a]=t(n[a],a,n)}return o},identity:Tn,constant:cn,noop:Vn,toPath:Bn,property:kn,propertyOf:function(t){return null==t?Vn:function(n){return In(t,n)}},matcher:A,matches:A,times:function(n,t,r){var e=Array(Math.max(0,n));t=x(t,r,1);for(var u=0;u<n;u++)e[u]=t(u);return e},random:Fn,now:O,escape:qn,unescape:r,templateSettings:Un,template:function(o,n,t){n=Mn({},n=!n&&t?t:n,m.templateSettings);var r,t=RegExp([(n.escape||Wn).source,(n.interpolate||Wn).source,(n.evaluate||Wn).source].join("|")+"|$","g"),i=0,a="__p+='";if(o.replace(t,function(n,t,r,e,u){return a+=o.slice(i,u).replace(Ln,$n),i=u+n.length,t?a+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?a+="'+\n((__t=("+r+"))==null?'':__t)+\n'":e&&(a+="';\n"+e+"\n__p+='"),n}),a+="';\n",t=n.variable){if(!Cn.test(t))throw new Error("variable is not a bare identifier: "+t)}else a="with(obj||{}){\n"+a+"}\n",t="obj";a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{r=new Function(t,"_",a)}catch(n){throw n.source=a,n}function e(n){return r.call(this,n,m)}return e.source="function("+t+"){\n"+a+"}",e},result:function(n,t,r){var e=(t=_(t)).length;if(!e)return p(r)?r.call(n):r;for(var u=0;u<e;u++){var o=null==n?void 0:n[t[u]];void 0===o&&(o=r,u=e),n=p(o)?o.call(n):o}return n},uniqueId:function(n){var t=++Kn+"";return n?n+t:t},chain:function(n){return(n=m(n))._chain=!0,n},iteratee:Rn,partial:M,bind:Gn,bindAll:Hn,memoize:function(e,u){function o(n){var t=o.cache,r=""+(u?u.apply(this,arguments):n);return y(t,r)||(t[r]=e.apply(this,arguments)),t[r]}return o.cache={},o},delay:Qn,defer:Xn,throttle:function(r,e,u){function o(){l=!1===u.leading?0:O(),i=null,c=r.apply(a,f),i||(a=f=null)}function n(){var n=O(),t=(l||!1!==u.leading||(l=n),e-(n-l));return a=this,f=arguments,t<=0||e<t?(i&&(clearTimeout(i),i=null),l=n,c=r.apply(a,f),i||(a=f=null)):i||!1===u.trailing||(i=setTimeout(o,t)),c}var i,a,f,c,l=0;return u=u||{},n.cancel=function(){clearTimeout(i),l=0,i=a=f=null},n},debounce:function(t,r,e){function u(){var n=O()-i;n<r?o=setTimeout(u,r-n):(o=null,e||(f=t.apply(c,a)),o||(a=c=null))}var o,i,a,f,c,n=l(function(n){return c=this,a=n,i=O(),o||(o=setTimeout(u,r),e&&(f=t.apply(c,a))),f});return n.cancel=function(){clearTimeout(o),o=a=c=null},n},wrap:function(n,t){return M(t,n)},negate:Yn,compose:function(){var r=arguments,e=r.length-1;return function(){for(var n=e,t=r[e].apply(this,arguments);n--;)t=r[n].call(this,t);return t}},after:function(n,t){return function(){if(--n<1)return t.apply(this,arguments)}},before:Zn,once:nt,findKey:tt,findIndex:et,findLastIndex:ut,sortedIndex:ot,indexOf:at,lastIndexOf:ft,find:ct,detect:ct,findWhere:function(n,t){return ct(n,A(t))},each:N,forEach:N,map:I,collect:I,reduce:st,foldl:st,inject:st,reduceRight:pt,foldr:pt,filter:T,select:T,reject:function(n,t,r){return T(n,Yn(S(t)),r)},every:ht,all:ht,some:vt,any:vt,contains:k,includes:k,include:k,invoke:yt,pluck:dt,where:function(n,t){return T(n,A(t))},max:gt,min:function(n,e,t){var r,u,o=1/0,i=1/0;if(null==e||"number"==typeof e&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=E(n)?n:j(n)).length;a<f;a++)null!=(r=n[a])&&r<o&&(o=r);else e=S(e,t),N(n,function(n,t,r){((u=e(n,t,r))<i||u===1/0&&o===1/0)&&(o=n,i=u)});return o},shuffle:function(n){return jt(n,1/0)},sample:jt,sortBy:function(n,e,t){var u=0;return e=S(e,t),dt(I(n,function(n,t,r){return{value:n,index:u++,criteria:e(n,t,r)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(e<r||void 0===r)return 1;if(r<e||void 0===e)return-1}return n.index-t.index}),"value")},groupBy:wt,indexBy:_t,countBy:At,partition:xt,toArray:mt,size:function(n){return null==n?0:(E(n)?n:b(n)).length},pick:Ot,omit:Mt,first:Bt,head:Bt,take:Bt,initial:Et,last:function(n,t,r){return null==n||n.length<1?null==t||r?void 0:[]:null==t||r?n[n.length-1]:R(n,Math.max(0,n.length-t))},rest:R,tail:R,drop:R,compact:function(n){return T(n,Boolean)},flatten:function(n,t){return B(n,t,!1)},without:It,uniq:Tt,unique:Tt,union:kt,intersection:function(n){for(var t=[],r=arguments.length,e=0,u=g(n);e<u;e++){var o=n[e];if(!k(t,o)){for(var i=1;i<r&&k(arguments[i],o);i++);i===r&&t.push(o)}}return t},difference:Nt,unzip:Dt,transpose:Dt,zip:Rt,object:function(n,t){for(var r={},e=0,u=g(n);e<u;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},range:function(n,t,r){null==t&&(t=n||0,n=0),r=r||(t<n?-1:1);for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),o=0;o<e;o++,n+=r)u[o]=n;return u},chunk:function(n,t){if(null==t||t<1)return[];for(var r=[],e=0,u=n.length;e<u;)r.push(f.call(n,e,e+=t));return r},mixin:Ft,default:m});return n._=n}); media-editor.js 0000644 00000070677 15125140777 0007477 0 ustar 00 /** * @output wp-includes/js/media-editor.js */ /* global getUserSetting, tinymce, QTags */ // WordPress, TinyMCE, and Media // ----------------------------- (function($, _){ /** * Stores the editors' `wp.media.controller.Frame` instances. * * @static */ var workflows = {}; /** * A helper mixin function to avoid truthy and falsey values being * passed as an input that expects booleans. If key is undefined in the map, * but has a default value, set it. * * @param {Object} attrs Map of props from a shortcode or settings. * @param {string} key The key within the passed map to check for a value. * @return {mixed|undefined} The original or coerced value of key within attrs. */ wp.media.coerce = function ( attrs, key ) { if ( _.isUndefined( attrs[ key ] ) && ! _.isUndefined( this.defaults[ key ] ) ) { attrs[ key ] = this.defaults[ key ]; } else if ( 'true' === attrs[ key ] ) { attrs[ key ] = true; } else if ( 'false' === attrs[ key ] ) { attrs[ key ] = false; } return attrs[ key ]; }; /** @namespace wp.media.string */ wp.media.string = { /** * Joins the `props` and `attachment` objects, * outputting the proper object format based on the * attachment's type. * * @param {Object} [props={}] Attachment details (align, link, size, etc). * @param {Object} attachment The attachment object, media version of Post. * @return {Object} Joined props */ props: function( props, attachment ) { var link, linkUrl, size, sizes, defaultProps = wp.media.view.settings.defaultProps; props = props ? _.clone( props ) : {}; if ( attachment && attachment.type ) { props.type = attachment.type; } if ( 'image' === props.type ) { props = _.defaults( props || {}, { align: defaultProps.align || getUserSetting( 'align', 'none' ), size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ), url: '', classes: [] }); } // All attachment-specific settings follow. if ( ! attachment ) { return props; } props.title = props.title || attachment.title; link = props.link || defaultProps.link || getUserSetting( 'urlbutton', 'file' ); if ( 'file' === link || 'embed' === link ) { linkUrl = attachment.url; } else if ( 'post' === link ) { linkUrl = attachment.link; } else if ( 'custom' === link ) { linkUrl = props.linkUrl; } props.linkUrl = linkUrl || ''; // Format properties for images. if ( 'image' === attachment.type ) { props.classes.push( 'wp-image-' + attachment.id ); sizes = attachment.sizes; size = sizes && sizes[ props.size ] ? sizes[ props.size ] : attachment; _.extend( props, _.pick( attachment, 'align', 'caption', 'alt' ), { width: size.width, height: size.height, src: size.url, captionId: 'attachment_' + attachment.id }); } else if ( 'video' === attachment.type || 'audio' === attachment.type ) { _.extend( props, _.pick( attachment, 'title', 'type', 'icon', 'mime' ) ); // Format properties for non-images. } else { props.title = props.title || attachment.filename; props.rel = props.rel || 'attachment wp-att-' + attachment.id; } return props; }, /** * Create link markup that is suitable for passing to the editor * * @param {Object} props Attachment details (align, link, size, etc). * @param {Object} attachment The attachment object, media version of Post. * @return {string} The link markup */ link: function( props, attachment ) { var options; props = wp.media.string.props( props, attachment ); options = { tag: 'a', content: props.title, attrs: { href: props.linkUrl } }; if ( props.rel ) { options.attrs.rel = props.rel; } return wp.html.string( options ); }, /** * Create an Audio shortcode string that is suitable for passing to the editor * * @param {Object} props Attachment details (align, link, size, etc). * @param {Object} attachment The attachment object, media version of Post. * @return {string} The audio shortcode */ audio: function( props, attachment ) { return wp.media.string._audioVideo( 'audio', props, attachment ); }, /** * Create a Video shortcode string that is suitable for passing to the editor * * @param {Object} props Attachment details (align, link, size, etc). * @param {Object} attachment The attachment object, media version of Post. * @return {string} The video shortcode */ video: function( props, attachment ) { return wp.media.string._audioVideo( 'video', props, attachment ); }, /** * Helper function to create a media shortcode string * * @access private * * @param {string} type The shortcode tag name: 'audio' or 'video'. * @param {Object} props Attachment details (align, link, size, etc). * @param {Object} attachment The attachment object, media version of Post. * @return {string} The media shortcode */ _audioVideo: function( type, props, attachment ) { var shortcode, html, extension; props = wp.media.string.props( props, attachment ); if ( props.link !== 'embed' ) { return wp.media.string.link( props ); } shortcode = {}; if ( 'video' === type ) { if ( attachment.image && -1 === attachment.image.src.indexOf( attachment.icon ) ) { shortcode.poster = attachment.image.src; } if ( attachment.width ) { shortcode.width = attachment.width; } if ( attachment.height ) { shortcode.height = attachment.height; } } extension = attachment.filename.split('.').pop(); if ( _.contains( wp.media.view.settings.embedExts, extension ) ) { shortcode[extension] = attachment.url; } else { // Render unsupported audio and video files as links. return wp.media.string.link( props ); } html = wp.shortcode.string({ tag: type, attrs: shortcode }); return html; }, /** * Create image markup, optionally with a link and/or wrapped in a caption shortcode, * that is suitable for passing to the editor * * @param {Object} props Attachment details (align, link, size, etc). * @param {Object} attachment The attachment object, media version of Post. * @return {string} */ image: function( props, attachment ) { var img = {}, options, classes, shortcode, html; props.type = 'image'; props = wp.media.string.props( props, attachment ); classes = props.classes || []; img.src = ! _.isUndefined( attachment ) ? attachment.url : props.url; _.extend( img, _.pick( props, 'width', 'height', 'alt' ) ); // Only assign the align class to the image if we're not printing // a caption, since the alignment is sent to the shortcode. if ( props.align && ! props.caption ) { classes.push( 'align' + props.align ); } if ( props.size ) { classes.push( 'size-' + props.size ); } img['class'] = _.compact( classes ).join(' '); // Generate `img` tag options. options = { tag: 'img', attrs: img, single: true }; // Generate the `a` element options, if they exist. if ( props.linkUrl ) { options = { tag: 'a', attrs: { href: props.linkUrl }, content: options }; } html = wp.html.string( options ); // Generate the caption shortcode. if ( props.caption ) { shortcode = {}; if ( img.width ) { shortcode.width = img.width; } if ( props.captionId ) { shortcode.id = props.captionId; } if ( props.align ) { shortcode.align = 'align' + props.align; } html = wp.shortcode.string({ tag: 'caption', attrs: shortcode, content: html + ' ' + props.caption }); } return html; } }; wp.media.embed = { coerce : wp.media.coerce, defaults : { url : '', width: '', height: '' }, edit : function( data, isURL ) { var frame, props = {}, shortcode; if ( isURL ) { props.url = data.replace(/<[^>]+>/g, ''); } else { shortcode = wp.shortcode.next( 'embed', data ).shortcode; props = _.defaults( shortcode.attrs.named, this.defaults ); if ( shortcode.content ) { props.url = shortcode.content; } } frame = wp.media({ frame: 'post', state: 'embed', metadata: props }); return frame; }, shortcode : function( model ) { var self = this, content; _.each( this.defaults, function( value, key ) { model[ key ] = self.coerce( model, key ); if ( value === model[ key ] ) { delete model[ key ]; } }); content = model.url; delete model.url; return new wp.shortcode({ tag: 'embed', attrs: model, content: content }); } }; /** * @class wp.media.collection * * @param {Object} attributes */ wp.media.collection = function(attributes) { var collections = {}; return _.extend(/** @lends wp.media.collection.prototype */{ coerce : wp.media.coerce, /** * Retrieve attachments based on the properties of the passed shortcode * * @param {wp.shortcode} shortcode An instance of wp.shortcode(). * @return {wp.media.model.Attachments} A Backbone.Collection containing * the media items belonging to a collection. * The query[ this.tag ] property is a Backbone.Model * containing the 'props' for the collection. */ attachments: function( shortcode ) { var shortcodeString = shortcode.string(), result = collections[ shortcodeString ], attrs, args, query, others, self = this; delete collections[ shortcodeString ]; if ( result ) { return result; } // Fill the default shortcode attributes. attrs = _.defaults( shortcode.attrs.named, this.defaults ); args = _.pick( attrs, 'orderby', 'order' ); args.type = this.type; args.perPage = -1; // Mark the `orderby` override attribute. if ( undefined !== attrs.orderby ) { attrs._orderByField = attrs.orderby; } if ( 'rand' === attrs.orderby ) { attrs._orderbyRandom = true; } // Map the `orderby` attribute to the corresponding model property. if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) ) { args.orderby = 'menuOrder'; } // Map the `ids` param to the correct query args. if ( attrs.ids ) { args.post__in = attrs.ids.split(','); args.orderby = 'post__in'; } else if ( attrs.include ) { args.post__in = attrs.include.split(','); } if ( attrs.exclude ) { args.post__not_in = attrs.exclude.split(','); } if ( ! args.post__in ) { args.uploadedTo = attrs.id; } // Collect the attributes that were not included in `args`. others = _.omit( attrs, 'id', 'ids', 'include', 'exclude', 'orderby', 'order' ); _.each( this.defaults, function( value, key ) { others[ key ] = self.coerce( others, key ); }); query = wp.media.query( args ); query[ this.tag ] = new Backbone.Model( others ); return query; }, /** * Triggered when clicking 'Insert {label}' or 'Update {label}' * * @param {wp.media.model.Attachments} attachments A Backbone.Collection containing * the media items belonging to a collection. * The query[ this.tag ] property is a Backbone.Model * containing the 'props' for the collection. * @return {wp.shortcode} */ shortcode: function( attachments ) { var props = attachments.props.toJSON(), attrs = _.pick( props, 'orderby', 'order' ), shortcode, clone; if ( attachments.type ) { attrs.type = attachments.type; delete attachments.type; } if ( attachments[this.tag] ) { _.extend( attrs, attachments[this.tag].toJSON() ); } /* * Convert all gallery shortcodes to use the `ids` property. * Ignore `post__in` and `post__not_in`; the attachments in * the collection will already reflect those properties. */ attrs.ids = attachments.pluck('id'); // Copy the `uploadedTo` post ID. if ( props.uploadedTo ) { attrs.id = props.uploadedTo; } // Check if the gallery is randomly ordered. delete attrs.orderby; if ( attrs._orderbyRandom ) { attrs.orderby = 'rand'; } else if ( attrs._orderByField && 'rand' !== attrs._orderByField ) { attrs.orderby = attrs._orderByField; } delete attrs._orderbyRandom; delete attrs._orderByField; // If the `ids` attribute is set and `orderby` attribute // is the default value, clear it for cleaner output. if ( attrs.ids && 'post__in' === attrs.orderby ) { delete attrs.orderby; } attrs = this.setDefaults( attrs ); shortcode = new wp.shortcode({ tag: this.tag, attrs: attrs, type: 'single' }); // Use a cloned version of the gallery. clone = new wp.media.model.Attachments( attachments.models, { props: props }); clone[ this.tag ] = attachments[ this.tag ]; collections[ shortcode.string() ] = clone; return shortcode; }, /** * Triggered when double-clicking a collection shortcode placeholder * in the editor * * @param {string} content Content that is searched for possible * shortcode markup matching the passed tag name, * * @this wp.media.{prop} * * @return {wp.media.view.MediaFrame.Select} A media workflow. */ edit: function( content ) { var shortcode = wp.shortcode.next( this.tag, content ), defaultPostId = this.defaults.id, attachments, selection, state; // Bail if we didn't match the shortcode or all of the content. if ( ! shortcode || shortcode.content !== content ) { return; } // Ignore the rest of the match object. shortcode = shortcode.shortcode; if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) ) { shortcode.set( 'id', defaultPostId ); } attachments = this.attachments( shortcode ); selection = new wp.media.model.Selection( attachments.models, { props: attachments.props.toJSON(), multiple: true }); selection[ this.tag ] = attachments[ this.tag ]; // Fetch the query's attachments, and then break ties from the // query to allow for sorting. selection.more().done( function() { // Break ties with the query. selection.props.set({ query: false }); selection.unmirror(); selection.props.unset('orderby'); }); // Destroy the previous gallery frame. if ( this.frame ) { this.frame.dispose(); } if ( shortcode.attrs.named.type && 'video' === shortcode.attrs.named.type ) { state = 'video-' + this.tag + '-edit'; } else { state = this.tag + '-edit'; } // Store the current frame. this.frame = wp.media({ frame: 'post', state: state, title: this.editTitle, editing: true, multiple: true, selection: selection }).open(); return this.frame; }, setDefaults: function( attrs ) { var self = this; // Remove default attributes from the shortcode. _.each( this.defaults, function( value, key ) { attrs[ key ] = self.coerce( attrs, key ); if ( value === attrs[ key ] ) { delete attrs[ key ]; } }); return attrs; } }, attributes ); }; wp.media._galleryDefaults = { itemtag: 'dl', icontag: 'dt', captiontag: 'dd', columns: '3', link: 'post', size: 'thumbnail', order: 'ASC', id: wp.media.view.settings.post && wp.media.view.settings.post.id, orderby : 'menu_order ID' }; if ( wp.media.view.settings.galleryDefaults ) { wp.media.galleryDefaults = _.extend( {}, wp.media._galleryDefaults, wp.media.view.settings.galleryDefaults ); } else { wp.media.galleryDefaults = wp.media._galleryDefaults; } wp.media.gallery = new wp.media.collection({ tag: 'gallery', type : 'image', editTitle : wp.media.view.l10n.editGalleryTitle, defaults : wp.media.galleryDefaults, setDefaults: function( attrs ) { var self = this, changed = ! _.isEqual( wp.media.galleryDefaults, wp.media._galleryDefaults ); _.each( this.defaults, function( value, key ) { attrs[ key ] = self.coerce( attrs, key ); if ( value === attrs[ key ] && ( ! changed || value === wp.media._galleryDefaults[ key ] ) ) { delete attrs[ key ]; } } ); return attrs; } }); /** * @namespace wp.media.featuredImage * @memberOf wp.media */ wp.media.featuredImage = { /** * Get the featured image post ID * * @return {wp.media.view.settings.post.featuredImageId|number} */ get: function() { return wp.media.view.settings.post.featuredImageId; }, /** * Sets the featured image ID property and sets the HTML in the post meta box to the new featured image. * * @param {number} id The post ID of the featured image, or -1 to unset it. */ set: function( id ) { var settings = wp.media.view.settings; settings.post.featuredImageId = id; wp.media.post( 'get-post-thumbnail-html', { post_id: settings.post.id, thumbnail_id: settings.post.featuredImageId, _wpnonce: settings.post.nonce }).done( function( html ) { if ( '0' === html ) { window.alert( wp.i18n.__( 'Could not set that as the thumbnail image. Try a different attachment.' ) ); return; } $( '.inside', '#postimagediv' ).html( html ); }); }, /** * Remove the featured image id, save the post thumbnail data and * set the HTML in the post meta box to no featured image. */ remove: function() { wp.media.featuredImage.set( -1 ); }, /** * The Featured Image workflow * * @this wp.media.featuredImage * * @return {wp.media.view.MediaFrame.Select} A media workflow. */ frame: function() { if ( this._frame ) { wp.media.frame = this._frame; return this._frame; } this._frame = wp.media({ state: 'featured-image', states: [ new wp.media.controller.FeaturedImage() , new wp.media.controller.EditImage() ] }); this._frame.on( 'toolbar:create:featured-image', function( toolbar ) { /** * @this wp.media.view.MediaFrame.Select */ this.createSelectToolbar( toolbar, { text: wp.media.view.l10n.setFeaturedImage }); }, this._frame ); this._frame.on( 'content:render:edit-image', function() { var selection = this.state('featured-image').get('selection'), view = new wp.media.view.EditImage( { model: selection.single(), controller: this } ).render(); this.content.set( view ); // After bringing in the frame, load the actual editor via an Ajax call. view.loadEditor(); }, this._frame ); this._frame.state('featured-image').on( 'select', this.select ); return this._frame; }, /** * 'select' callback for Featured Image workflow, triggered when * the 'Set Featured Image' button is clicked in the media modal. * * @this wp.media.controller.FeaturedImage */ select: function() { var selection = this.get('selection').single(); if ( ! wp.media.view.settings.post.featuredImageId ) { return; } wp.media.featuredImage.set( selection ? selection.id : -1 ); }, /** * Open the content media manager to the 'featured image' tab when * the post thumbnail is clicked. * * Update the featured image id when the 'remove' link is clicked. */ init: function() { $('#postimagediv').on( 'click', '#set-post-thumbnail', function( event ) { event.preventDefault(); // Stop propagation to prevent thickbox from activating. event.stopPropagation(); wp.media.featuredImage.frame().open(); }).on( 'click', '#remove-post-thumbnail', function() { wp.media.featuredImage.remove(); return false; }); } }; $( wp.media.featuredImage.init ); /** @namespace wp.media.editor */ wp.media.editor = { /** * Send content to the editor * * @param {string} html Content to send to the editor */ insert: function( html ) { var editor, wpActiveEditor, hasTinymce = ! _.isUndefined( window.tinymce ), hasQuicktags = ! _.isUndefined( window.QTags ); if ( this.activeEditor ) { wpActiveEditor = window.wpActiveEditor = this.activeEditor; } else { wpActiveEditor = window.wpActiveEditor; } /* * Delegate to the global `send_to_editor` if it exists. * This attempts to play nice with any themes/plugins * that have overridden the insert functionality. */ if ( window.send_to_editor ) { return window.send_to_editor.apply( this, arguments ); } if ( ! wpActiveEditor ) { if ( hasTinymce && tinymce.activeEditor ) { editor = tinymce.activeEditor; wpActiveEditor = window.wpActiveEditor = editor.id; } else if ( ! hasQuicktags ) { return false; } } else if ( hasTinymce ) { editor = tinymce.get( wpActiveEditor ); } if ( editor && ! editor.isHidden() ) { editor.execCommand( 'mceInsertContent', false, html ); } else if ( hasQuicktags ) { QTags.insertContent( html ); } else { document.getElementById( wpActiveEditor ).value += html; } // If the old thickbox remove function exists, call it in case // a theme/plugin overloaded it. if ( window.tb_remove ) { try { window.tb_remove(); } catch( e ) {} } }, /** * Setup 'workflow' and add to the 'workflows' cache. 'open' can * subsequently be called upon it. * * @param {string} id A slug used to identify the workflow. * @param {Object} [options={}] * * @this wp.media.editor * * @return {wp.media.view.MediaFrame.Select} A media workflow. */ add: function( id, options ) { var workflow = this.get( id ); // Only add once: if exists return existing. if ( workflow ) { return workflow; } workflow = workflows[ id ] = wp.media( _.defaults( options || {}, { frame: 'post', state: 'insert', title: wp.media.view.l10n.addMedia, multiple: true } ) ); workflow.on( 'insert', function( selection ) { var state = workflow.state(); selection = selection || state.get('selection'); if ( ! selection ) { return; } $.when.apply( $, selection.map( function( attachment ) { var display = state.display( attachment ).toJSON(); /** * @this wp.media.editor */ return this.send.attachment( display, attachment.toJSON() ); }, this ) ).done( function() { wp.media.editor.insert( _.toArray( arguments ).join('\n\n') ); }); }, this ); workflow.state('gallery-edit').on( 'update', function( selection ) { /** * @this wp.media.editor */ this.insert( wp.media.gallery.shortcode( selection ).string() ); }, this ); workflow.state('playlist-edit').on( 'update', function( selection ) { /** * @this wp.media.editor */ this.insert( wp.media.playlist.shortcode( selection ).string() ); }, this ); workflow.state('video-playlist-edit').on( 'update', function( selection ) { /** * @this wp.media.editor */ this.insert( wp.media.playlist.shortcode( selection ).string() ); }, this ); workflow.state('embed').on( 'select', function() { /** * @this wp.media.editor */ var state = workflow.state(), type = state.get('type'), embed = state.props.toJSON(); embed.url = embed.url || ''; if ( 'link' === type ) { _.defaults( embed, { linkText: embed.url, linkUrl: embed.url }); this.send.link( embed ).done( function( resp ) { wp.media.editor.insert( resp ); }); } else if ( 'image' === type ) { _.defaults( embed, { title: embed.url, linkUrl: '', align: 'none', link: 'none' }); if ( 'none' === embed.link ) { embed.linkUrl = ''; } else if ( 'file' === embed.link ) { embed.linkUrl = embed.url; } this.insert( wp.media.string.image( embed ) ); } }, this ); workflow.state('featured-image').on( 'select', wp.media.featuredImage.select ); workflow.setState( workflow.options.state ); return workflow; }, /** * Determines the proper current workflow id * * @param {string} [id=''] A slug used to identify the workflow. * * @return {wpActiveEditor|string|tinymce.activeEditor.id} */ id: function( id ) { if ( id ) { return id; } // If an empty `id` is provided, default to `wpActiveEditor`. id = window.wpActiveEditor; // If that doesn't work, fall back to `tinymce.activeEditor.id`. if ( ! id && ! _.isUndefined( window.tinymce ) && tinymce.activeEditor ) { id = tinymce.activeEditor.id; } // Last but not least, fall back to the empty string. id = id || ''; return id; }, /** * Return the workflow specified by id * * @param {string} id A slug used to identify the workflow. * * @this wp.media.editor * * @return {wp.media.view.MediaFrame} A media workflow. */ get: function( id ) { id = this.id( id ); return workflows[ id ]; }, /** * Remove the workflow represented by id from the workflow cache * * @param {string} id A slug used to identify the workflow. * * @this wp.media.editor */ remove: function( id ) { id = this.id( id ); delete workflows[ id ]; }, /** @namespace wp.media.editor.send */ send: { /** * Called when sending an attachment to the editor * from the medial modal. * * @param {Object} props Attachment details (align, link, size, etc). * @param {Object} attachment The attachment object, media version of Post. * @return {Promise} */ attachment: function( props, attachment ) { var caption = attachment.caption, options, html; // If captions are disabled, clear the caption. if ( ! wp.media.view.settings.captions ) { delete attachment.caption; } props = wp.media.string.props( props, attachment ); options = { id: attachment.id, post_content: attachment.description, post_excerpt: caption }; if ( props.linkUrl ) { options.url = props.linkUrl; } if ( 'image' === attachment.type ) { html = wp.media.string.image( props ); _.each({ align: 'align', size: 'image-size', alt: 'image_alt' }, function( option, prop ) { if ( props[ prop ] ) { options[ option ] = props[ prop ]; } }); } else if ( 'video' === attachment.type ) { html = wp.media.string.video( props, attachment ); } else if ( 'audio' === attachment.type ) { html = wp.media.string.audio( props, attachment ); } else { html = wp.media.string.link( props ); options.post_title = props.title; } return wp.media.post( 'send-attachment-to-editor', { nonce: wp.media.view.settings.nonce.sendToEditor, attachment: options, html: html, post_id: wp.media.view.settings.post.id }); }, /** * Called when 'Insert From URL' source is not an image. Example: YouTube url. * * @param {Object} embed * @return {Promise} */ link: function( embed ) { return wp.media.post( 'send-link-to-editor', { nonce: wp.media.view.settings.nonce.sendToEditor, src: embed.linkUrl, link_text: embed.linkText, html: wp.media.string.link( embed ), post_id: wp.media.view.settings.post.id }); } }, /** * Open a workflow * * @param {string} [id=undefined] Optional. A slug used to identify the workflow. * @param {Object} [options={}] * * @this wp.media.editor * * @return {wp.media.view.MediaFrame} */ open: function( id, options ) { var workflow; options = options || {}; id = this.id( id ); this.activeEditor = id; workflow = this.get( id ); // Redo workflow if state has changed. if ( ! workflow || ( workflow.options && options.state !== workflow.options.state ) ) { workflow = this.add( id, options ); } wp.media.frame = workflow; return workflow.open(); }, /** * Bind click event for .insert-media using event delegation */ init: function() { $(document.body) .on( 'click.add-media-button', '.insert-media', function( event ) { var elem = $( event.currentTarget ), editor = elem.data('editor'), options = { frame: 'post', state: 'insert', title: wp.media.view.l10n.addMedia, multiple: true }; event.preventDefault(); if ( elem.hasClass( 'gallery' ) ) { options.state = 'gallery'; options.title = wp.media.view.l10n.createGalleryTitle; } wp.media.editor.open( editor, options ); }); // Initialize and render the Editor drag-and-drop uploader. new wp.media.view.EditorUploader().render(); } }; _.bindAll( wp.media.editor, 'open' ); $( wp.media.editor.init ); }(jQuery, _)); colorpicker.min.js 0000644 00000040162 15125140777 0010214 0 ustar 00 /*! This file is auto-generated */ function getAnchorPosition(F){var e=new Object,t=0,i=0,o=!1,n=!1,s=!1;if(document.getElementById?o=!0:document.all?n=!0:document.layers&&(s=!0),o&&document.all)t=AnchorPosition_getPageOffsetLeft(document.all[F]),i=AnchorPosition_getPageOffsetTop(document.all[F]);else if(o)o=document.getElementById(F),t=AnchorPosition_getPageOffsetLeft(o),i=AnchorPosition_getPageOffsetTop(o);else if(n)t=AnchorPosition_getPageOffsetLeft(document.all[F]),i=AnchorPosition_getPageOffsetTop(document.all[F]);else{if(!s)return e.x=0,e.y=0,e;for(var d=0,C=0;C<document.anchors.length;C++)if(document.anchors[C].name==F){d=1;break}if(0==d)return e.x=0,e.y=0,e;t=document.anchors[C].x,i=document.anchors[C].y}return e.x=t,e.y=i,e}function getAnchorWindowPosition(F){var F=getAnchorPosition(F),e=0,t=0;return document.getElementById?t=isNaN(window.screenX)?(e=F.x-document.body.scrollLeft+window.screenLeft,F.y-document.body.scrollTop+window.screenTop):(e=F.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset,F.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset):document.all?(e=F.x-document.body.scrollLeft+window.screenLeft,t=F.y-document.body.scrollTop+window.screenTop):document.layers&&(e=F.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset,t=F.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset),F.x=e,F.y=t,F}function AnchorPosition_getPageOffsetLeft(F){for(var e=F.offsetLeft;null!=(F=F.offsetParent);)e+=F.offsetLeft;return e}function AnchorPosition_getWindowOffsetLeft(F){return AnchorPosition_getPageOffsetLeft(F)-document.body.scrollLeft}function AnchorPosition_getPageOffsetTop(F){for(var e=F.offsetTop;null!=(F=F.offsetParent);)e+=F.offsetTop;return e}function AnchorPosition_getWindowOffsetTop(F){return AnchorPosition_getPageOffsetTop(F)-document.body.scrollTop}function PopupWindow_getXYPosition(F){F=("WINDOW"==this.type?getAnchorWindowPosition:getAnchorPosition)(F);this.x=F.x,this.y=F.y}function PopupWindow_setSize(F,e){this.width=F,this.height=e}function PopupWindow_populate(F){this.contents=F,this.populated=!1}function PopupWindow_setUrl(F){this.url=F}function PopupWindow_setWindowProperties(F){this.windowProperties=F}function PopupWindow_refresh(){var F;null!=this.divName?this.use_gebi?document.getElementById(this.divName).innerHTML=this.contents:this.use_css?document.all[this.divName].innerHTML=this.contents:this.use_layers&&((F=document.layers[this.divName]).document.open(),F.document.writeln(this.contents),F.document.close()):null==this.popupWindow||this.popupWindow.closed||(""!=this.url?this.popupWindow.location.href=this.url:(this.popupWindow.document.open(),this.popupWindow.document.writeln(this.contents),this.popupWindow.document.close()),this.popupWindow.focus())}function PopupWindow_showPopup(F){var e;this.getXYPosition(F),this.x+=this.offsetX,this.y+=this.offsetY,this.populated||""==this.contents||(this.populated=!0,this.refresh()),null!=this.divName?this.use_gebi?(document.getElementById(this.divName).style.left=this.x+"px",document.getElementById(this.divName).style.top=this.y,document.getElementById(this.divName).style.visibility="visible"):this.use_css?(document.all[this.divName].style.left=this.x,document.all[this.divName].style.top=this.y,document.all[this.divName].style.visibility="visible"):this.use_layers&&(document.layers[this.divName].left=this.x,document.layers[this.divName].top=this.y,document.layers[this.divName].visibility="visible"):(null!=this.popupWindow&&!this.popupWindow.closed||(this.x<0&&(this.x=0),this.y<0&&(this.y=0),screen&&screen.availHeight&&this.y+this.height>screen.availHeight&&(this.y=screen.availHeight-this.height),screen&&screen.availWidth&&this.x+this.width>screen.availWidth&&(this.x=screen.availWidth-this.width),e=window.opera||document.layers&&!navigator.mimeTypes["*"]||"KDE"==navigator.vendor||document.childNodes&&!document.all&&!navigator.taintEnabled,this.popupWindow=window.open(e?"":"about:blank","window_"+F,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y)),this.refresh())}function PopupWindow_hidePopup(){null!=this.divName?this.use_gebi?document.getElementById(this.divName).style.visibility="hidden":this.use_css?document.all[this.divName].style.visibility="hidden":this.use_layers&&(document.layers[this.divName].visibility="hidden"):this.popupWindow&&!this.popupWindow.closed&&(this.popupWindow.close(),this.popupWindow=null)}function PopupWindow_isClicked(F){if(null!=this.divName){var e,t;if(this.use_layers)return e=F.pageX,t=F.pageY,e>(i=document.layers[this.divName]).left&&e<i.left+i.clip.width&&t>i.top&&t<i.top+i.clip.height;if(document.all)for(var i=window.event.srcElement;null!=i.parentElement;){if(i.id==this.divName)return!0;i=i.parentElement}else if(this.use_gebi&&F)for(i=F.originalTarget;null!=i.parentNode;){if(i.id==this.divName)return!0;i=i.parentNode}}return!1}function PopupWindow_hideIfNotClicked(F){this.autoHideEnabled&&!this.isClicked(F)&&this.hidePopup()}function PopupWindow_autoHide(){this.autoHideEnabled=!0}function PopupWindow_hidePopupWindows(F){for(var e=0;e<popupWindowObjects.length;e++)null!=popupWindowObjects[e]&&popupWindowObjects[e].hideIfNotClicked(F)}function PopupWindow_attachListener(){document.layers&&document.captureEvents(Event.MOUSEUP),window.popupWindowOldEventListener=document.onmouseup,document.onmouseup=null!=window.popupWindowOldEventListener?new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();"):PopupWindow_hidePopupWindows}function PopupWindow(){window.popupWindowIndex||(window.popupWindowIndex=0),window.popupWindowObjects||(window.popupWindowObjects=new Array),window.listenerAttached||(window.listenerAttached=!0,PopupWindow_attachListener()),this.index=popupWindowIndex++,(popupWindowObjects[this.index]=this).divName=null,this.popupWindow=null,this.width=0,this.height=0,this.populated=!1,this.visible=!1,this.autoHideEnabled=!1,this.contents="",this.url="",this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no",0<arguments.length?(this.type="DIV",this.divName=arguments[0]):this.type="WINDOW",this.use_gebi=!1,this.use_css=!1,this.use_layers=!1,document.getElementById?this.use_gebi=!0:document.all?this.use_css=!0:document.layers?this.use_layers=!0:this.type="WINDOW",this.offsetX=0,this.offsetY=0,this.getXYPosition=PopupWindow_getXYPosition,this.populate=PopupWindow_populate,this.setUrl=PopupWindow_setUrl,this.setWindowProperties=PopupWindow_setWindowProperties,this.refresh=PopupWindow_refresh,this.showPopup=PopupWindow_showPopup,this.hidePopup=PopupWindow_hidePopup,this.setSize=PopupWindow_setSize,this.isClicked=PopupWindow_isClicked,this.autoHide=PopupWindow_autoHide,this.hideIfNotClicked=PopupWindow_hideIfNotClicked}function ColorPicker_writeDiv(){document.writeln('<DIV ID="colorPickerDiv" STYLE="position:absolute;visibility:hidden;"> </DIV>')}function ColorPicker_show(F){this.showPopup(F)}function ColorPicker_pickColor(F,e){e.hidePopup(),pickColor(F)}function pickColor(F){null==ColorPicker_targetInput?alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!"):ColorPicker_targetInput.value=F}function ColorPicker_select(F,e){"text"!=F.type&&"hidden"!=F.type&&"textarea"!=F.type?(alert("colorpicker.select: Input object passed is not a valid form input object"),window.ColorPicker_targetInput=null):(window.ColorPicker_targetInput=F,this.show(e))}function ColorPicker_highlightColor(F){var e=1<arguments.length?arguments[1]:window.document,t=e.getElementById("colorPickerSelectedColor");t.style.backgroundColor=F,(t=e.getElementById("colorPickerSelectedColorValue")).innerHTML=F}function ColorPicker(){for(var F,e,t,i=!1,o=(0==arguments.length?F="colorPickerDiv":"window"==arguments[0]?i=!(F=""):F=arguments[0],""!=F?e=new PopupWindow(F):(e=new PopupWindow).setSize(225,250),e.currentValue="#FFFFFF",e.writeDiv=ColorPicker_writeDiv,e.highlightColor=ColorPicker_highlightColor,e.show=ColorPicker_show,e.select=ColorPicker_select,new Array("#4180B6","#69AEE7","#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099","#3300CC","#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099","#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#7FFFFF","#7FFFFF","#7FF7F7","#7FEFEF","#7FE7E7","#7FDFDF","#7FD7D7","#7FCFCF","#7FC7C7","#7FBFBF","#7FB7B7","#7FAFAF","#7FA7A7","#7F9F9F","#7F9797","#7F8F8F","#7F8787","#7F7F7F","#7F7777","#7F6F6F","#7F6767","#7F5F5F","#7F5757","#7F4F4F","#7F4747","#7F3F3F","#7F3737","#7F2F2F","#7F2727","#7F1F1F","#7F1717","#7F0F0F","#7F0707","#7F0000","#4180B6","#69AEE7","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333","#333366","#333399","#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300","#993333","#993366","#993399","#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF7FFF","#FF7FFF","#F77FF7","#EF7FEF","#E77FE7","#DF7FDF","#D77FD7","#CF7FCF","#C77FC7","#BF7FBF","#B77FB7","#AF7FAF","#A77FA7","#9F7F9F","#977F97","#8F7F8F","#877F87","#7F7F7F","#777F77","#6F7F6F","#677F67","#5F7F5F","#577F57","#4F7F4F","#477F47","#3F7F3F","#377F37","#2F7F2F","#277F27","#1F7F1F","#177F17","#0F7F0F","#077F07","#007F00","#4180B6","#69AEE7","#006600","#006633","#006666","#006699","#0066CC","#0066FF","#336600","#336633","#336666","#336699","#3366CC","#3366FF","#666600","#666633","#666666","#666699","#6666CC","#6666FF","#996600","#996633","#996666","#996699","#9966CC","#9966FF","#CC6600","#CC6633","#CC6666","#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699","#FF66CC","#FF66FF","#FFFF7F","#FFFF7F","#F7F77F","#EFEF7F","#E7E77F","#DFDF7F","#D7D77F","#CFCF7F","#C7C77F","#BFBF7F","#B7B77F","#AFAF7F","#A7A77F","#9F9F7F","#97977F","#8F8F7F","#87877F","#7F7F7F","#77777F","#6F6F7F","#67677F","#5F5F7F","#57577F","#4F4F7F","#47477F","#3F3F7F","#37377F","#2F2F7F","#27277F","#1F1F7F","#17177F","#0F0F7F","#07077F","#00007F","#4180B6","#69AEE7","#009900","#009933","#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999","#3399CC","#3399FF","#669900","#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999","#9999CC","#9999FF","#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999","#FF99CC","#FF99FF","#3FFFFF","#3FFFFF","#3FF7F7","#3FEFEF","#3FE7E7","#3FDFDF","#3FD7D7","#3FCFCF","#3FC7C7","#3FBFBF","#3FB7B7","#3FAFAF","#3FA7A7","#3F9F9F","#3F9797","#3F8F8F","#3F8787","#3F7F7F","#3F7777","#3F6F6F","#3F6767","#3F5F5F","#3F5757","#3F4F4F","#3F4747","#3F3F3F","#3F3737","#3F2F2F","#3F2727","#3F1F1F","#3F1717","#3F0F0F","#3F0707","#3F0000","#4180B6","#69AEE7","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66","#99CC99","#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33","#FFCC66","#FFCC99","#FFCCCC","#FFCCFF","#FF3FFF","#FF3FFF","#F73FF7","#EF3FEF","#E73FE7","#DF3FDF","#D73FD7","#CF3FCF","#C73FC7","#BF3FBF","#B73FB7","#AF3FAF","#A73FA7","#9F3F9F","#973F97","#8F3F8F","#873F87","#7F3F7F","#773F77","#6F3F6F","#673F67","#5F3F5F","#573F57","#4F3F4F","#473F47","#3F3F3F","#373F37","#2F3F2F","#273F27","#1F3F1F","#173F17","#0F3F0F","#073F07","#003F00","#4180B6","#69AEE7","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00","#33FF33","#33FF66","#33FF99","#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF","#99FF00","#99FF33","#99FF66","#99FF99","#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC","#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99","#FFFFCC","#FFFFFF","#FFFF3F","#FFFF3F","#F7F73F","#EFEF3F","#E7E73F","#DFDF3F","#D7D73F","#CFCF3F","#C7C73F","#BFBF3F","#B7B73F","#AFAF3F","#A7A73F","#9F9F3F","#97973F","#8F8F3F","#87873F","#7F7F3F","#77773F","#6F6F3F","#67673F","#5F5F3F","#57573F","#4F4F3F","#47473F","#3F3F3F","#37373F","#2F2F3F","#27273F","#1F1F3F","#17173F","#0F0F3F","#07073F","#00003F","#4180B6","#69AEE7","#FFFFFF","#FFEEEE","#FFDDDD","#FFCCCC","#FFBBBB","#FFAAAA","#FF9999","#FF8888","#FF7777","#FF6666","#FF5555","#FF4444","#FF3333","#FF2222","#FF1111","#FF0000","#FF0000","#FF0000","#FF0000","#EE0000","#DD0000","#CC0000","#BB0000","#AA0000","#990000","#880000","#770000","#660000","#550000","#440000","#330000","#220000","#110000","#000000","#000000","#000000","#000000","#001111","#002222","#003333","#004444","#005555","#006666","#007777","#008888","#009999","#00AAAA","#00BBBB","#00CCCC","#00DDDD","#00EEEE","#00FFFF","#00FFFF","#00FFFF","#00FFFF","#11FFFF","#22FFFF","#33FFFF","#44FFFF","#55FFFF","#66FFFF","#77FFFF","#88FFFF","#99FFFF","#AAFFFF","#BBFFFF","#CCFFFF","#DDFFFF","#EEFFFF","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#EEFFEE","#DDFFDD","#CCFFCC","#BBFFBB","#AAFFAA","#99FF99","#88FF88","#77FF77","#66FF66","#55FF55","#44FF44","#33FF33","#22FF22","#11FF11","#00FF00","#00FF00","#00FF00","#00FF00","#00EE00","#00DD00","#00CC00","#00BB00","#00AA00","#009900","#008800","#007700","#006600","#005500","#004400","#003300","#002200","#001100","#000000","#000000","#000000","#000000","#110011","#220022","#330033","#440044","#550055","#660066","#770077","#880088","#990099","#AA00AA","#BB00BB","#CC00CC","#DD00DD","#EE00EE","#FF00FF","#FF00FF","#FF00FF","#FF00FF","#FF11FF","#FF22FF","#FF33FF","#FF44FF","#FF55FF","#FF66FF","#FF77FF","#FF88FF","#FF99FF","#FFAAFF","#FFBBFF","#FFCCFF","#FFDDFF","#FFEEFF","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#EEEEFF","#DDDDFF","#CCCCFF","#BBBBFF","#AAAAFF","#9999FF","#8888FF","#7777FF","#6666FF","#5555FF","#4444FF","#3333FF","#2222FF","#1111FF","#0000FF","#0000FF","#0000FF","#0000FF","#0000EE","#0000DD","#0000CC","#0000BB","#0000AA","#000099","#000088","#000077","#000066","#000055","#000044","#000033","#000022","#000011","#000000","#000000","#000000","#000000","#111100","#222200","#333300","#444400","#555500","#666600","#777700","#888800","#999900","#AAAA00","#BBBB00","#CCCC00","#DDDD00","#EEEE00","#FFFF00","#FFFF00","#FFFF00","#FFFF00","#FFFF11","#FFFF22","#FFFF33","#FFFF44","#FFFF55","#FFFF66","#FFFF77","#FFFF88","#FFFF99","#FFFFAA","#FFFFBB","#FFFFCC","#FFFFDD","#FFFFEE","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#FFFFFF","#FBFBFB","#F7F7F7","#F3F3F3","#EFEFEF","#EBEBEB","#E7E7E7","#E3E3E3","#DFDFDF","#DBDBDB","#D7D7D7","#D3D3D3","#CFCFCF","#CBCBCB","#C7C7C7","#C3C3C3","#BFBFBF","#BBBBBB","#B7B7B7","#B3B3B3","#AFAFAF","#ABABAB","#A7A7A7","#A3A3A3","#9F9F9F","#9B9B9B","#979797","#939393","#8F8F8F","#8B8B8B","#878787","#838383","#7F7F7F","#7B7B7B","#777777","#737373","#6F6F6F","#6B6B6B","#676767","#636363","#5F5F5F","#5B5B5B","#575757","#535353","#4F4F4F","#4B4B4B","#474747","#434343","#3F3F3F","#3B3B3B","#373737","#333333","#2F2F2F","#2B2B2B","#272727","#232323","#1F1F1F","#1B1B1B","#171717","#131313","#0F0F0F","#0B0B0B","#070707","#030303","#000000","#000000","#000000","#000000","#000000")),n=o.length,s=72,d="",C=i?"window.opener.":"",l=(i&&(d+="<html><head><title>Select Color</title></head><body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><span style='text-align: center;'>"),d+="<table style='border: none;' cellspacing=0 cellpadding=0>",!(!document.getElementById&&!document.all)),r=0;r<n;r++)r%s==0&&(d+="<tr>"),t=l?'onMouseOver="'+C+"ColorPicker_highlightColor('"+o[r]+"',window.document)\"":"",d+='<td style="background-color: '+o[r]+';"><a href="javascript:void()" onclick="'+C+"ColorPicker_pickColor('"+o[r]+"',"+C+"window.popupWindowObjects["+e.index+']);return false;" '+t+"> </a></td>",(n<=r+1||(r+1)%s==0)&&(d+="</tr>");return document.getElementById&&(d+="<tr><td colspan='"+(s=Math.floor(s/2))+"' style='background-color: #FFF;' ID='colorPickerSelectedColor'> </td><td colspan='"+s+"' style='text-align: center;' id='colorPickerSelectedColorValue'>#FFFFFF</td></tr>"),d+="</table>",i&&(d+="</span></body></html>"),e.populate(d+"\n"),e.offsetY=25,e.autoHide(),e}ColorPicker_targetInput=null; wp-emoji-loader.min.js 0000644 00000006020 15125140777 0010666 0 ustar 00 /*! This file is auto-generated */ !function(s,n){var o,i,e;function c(e){try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(o,JSON.stringify(t))}catch(e){}}function p(e,t,n){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);var t=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data),a=(e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(n,0,0),new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data));return t.every(function(e,t){return e===a[t]})}function u(e,t){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);for(var n=e.getImageData(16,16,1,1),a=0;a<n.data.length;a++)if(0!==n.data[a])return!1;return!0}function f(e,t,n,a){switch(t){case"flag":return n(e,"\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f","\ud83c\udff3\ufe0f\u200b\u26a7\ufe0f")?!1:!n(e,"\ud83c\udde8\ud83c\uddf6","\ud83c\udde8\u200b\ud83c\uddf6")&&!n(e,"\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f","\ud83c\udff4\u200b\udb40\udc67\u200b\udb40\udc62\u200b\udb40\udc65\u200b\udb40\udc6e\u200b\udb40\udc67\u200b\udb40\udc7f");case"emoji":return!a(e,"\ud83e\udedf")}return!1}function g(e,t,n,a){var r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?new OffscreenCanvas(300,150):s.createElement("canvas"),o=r.getContext("2d",{willReadFrequently:!0}),i=(o.textBaseline="top",o.font="600 32px Arial",{});return e.forEach(function(e){i[e]=t(o,e,n,a)}),i}function t(e){var t=s.createElement("script");t.src=e,t.defer=!0,s.head.appendChild(t)}"undefined"!=typeof Promise&&(o="wpEmojiSettingsSupports",i=["flag","emoji"],n.supports={everything:!0,everythingExceptFlag:!0},e=new Promise(function(e){s.addEventListener("DOMContentLoaded",e,{once:!0})}),new Promise(function(t){var n=function(){try{var e=JSON.parse(sessionStorage.getItem(o));if("object"==typeof e&&"number"==typeof e.timestamp&&(new Date).valueOf()<e.timestamp+604800&&"object"==typeof e.supportTests)return e.supportTests}catch(e){}return null}();if(!n){if("undefined"!=typeof Worker&&"undefined"!=typeof OffscreenCanvas&&"undefined"!=typeof URL&&URL.createObjectURL&&"undefined"!=typeof Blob)try{var e="postMessage("+g.toString()+"("+[JSON.stringify(i),f.toString(),p.toString(),u.toString()].join(",")+"));",a=new Blob([e],{type:"text/javascript"}),r=new Worker(URL.createObjectURL(a),{name:"wpTestEmojiSupports"});return void(r.onmessage=function(e){c(n=e.data),r.terminate(),t(n)})}catch(e){}c(n=g(i,f,p,u))}t(n)}).then(function(e){for(var t in e)n.supports[t]=e[t],n.supports.everything=n.supports.everything&&n.supports[t],"flag"!==t&&(n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&n.supports[t]);n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&!n.supports.flag,n.DOMReady=!1,n.readyCallback=function(){n.DOMReady=!0}}).then(function(){return e}).then(function(){var e;n.supports.everything||(n.readyCallback(),(e=n.source||{}).concatemoji?t(e.concatemoji):e.wpemoji&&e.twemoji&&(t(e.twemoji),t(e.wpemoji)))}))}((window,document),window._wpemojiSettings); plupload/plupload.js 0000644 00000165632 15125140777 0010570 0 ustar 00 /** * Plupload - multi-runtime File Uploader * v2.1.9 * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing * * Date: 2016-05-15 */ /** * Plupload.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** * Modified for WordPress, Silverlight and Flash runtimes support was removed. * See https://core.trac.wordpress.org/ticket/41755. */ /*global mOxie:true */ ;(function(window, o, undef) { var delay = window.setTimeout , fileFilters = {} ; // convert plupload features to caps acceptable by mOxie function normalizeCaps(settings) { var features = settings.required_features, caps = {}; function resolve(feature, value, strict) { // Feature notation is deprecated, use caps (this thing here is required for backward compatibility) var map = { chunks: 'slice_blob', jpgresize: 'send_binary_string', pngresize: 'send_binary_string', progress: 'report_upload_progress', multi_selection: 'select_multiple', dragdrop: 'drag_and_drop', drop_element: 'drag_and_drop', headers: 'send_custom_headers', urlstream_upload: 'send_binary_string', canSendBinary: 'send_binary', triggerDialog: 'summon_file_dialog' }; if (map[feature]) { caps[map[feature]] = value; } else if (!strict) { caps[feature] = value; } } if (typeof(features) === 'string') { plupload.each(features.split(/\s*,\s*/), function(feature) { resolve(feature, true); }); } else if (typeof(features) === 'object') { plupload.each(features, function(value, feature) { resolve(feature, value); }); } else if (features === true) { // check settings for required features if (settings.chunk_size > 0) { caps.slice_blob = true; } if (settings.resize.enabled || !settings.multipart) { caps.send_binary_string = true; } plupload.each(settings, function(value, feature) { resolve(feature, !!value, true); // strict check }); } // WP: only html runtimes. settings.runtimes = 'html5,html4'; return caps; } /** * @module plupload * @static */ var plupload = { /** * Plupload version will be replaced on build. * * @property VERSION * @for Plupload * @static * @final */ VERSION : '2.1.9', /** * The state of the queue before it has started and after it has finished * * @property STOPPED * @static * @final */ STOPPED : 1, /** * Upload process is running * * @property STARTED * @static * @final */ STARTED : 2, /** * File is queued for upload * * @property QUEUED * @static * @final */ QUEUED : 1, /** * File is being uploaded * * @property UPLOADING * @static * @final */ UPLOADING : 2, /** * File has failed to be uploaded * * @property FAILED * @static * @final */ FAILED : 4, /** * File has been uploaded successfully * * @property DONE * @static * @final */ DONE : 5, // Error constants used by the Error event /** * Generic error for example if an exception is thrown inside Silverlight. * * @property GENERIC_ERROR * @static * @final */ GENERIC_ERROR : -100, /** * HTTP transport error. For example if the server produces a HTTP status other than 200. * * @property HTTP_ERROR * @static * @final */ HTTP_ERROR : -200, /** * Generic I/O error. For example if it wasn't possible to open the file stream on local machine. * * @property IO_ERROR * @static * @final */ IO_ERROR : -300, /** * @property SECURITY_ERROR * @static * @final */ SECURITY_ERROR : -400, /** * Initialization error. Will be triggered if no runtime was initialized. * * @property INIT_ERROR * @static * @final */ INIT_ERROR : -500, /** * File size error. If the user selects a file that is too large it will be blocked and an error of this type will be triggered. * * @property FILE_SIZE_ERROR * @static * @final */ FILE_SIZE_ERROR : -600, /** * File extension error. If the user selects a file that isn't valid according to the filters setting. * * @property FILE_EXTENSION_ERROR * @static * @final */ FILE_EXTENSION_ERROR : -601, /** * Duplicate file error. If prevent_duplicates is set to true and user selects the same file again. * * @property FILE_DUPLICATE_ERROR * @static * @final */ FILE_DUPLICATE_ERROR : -602, /** * Runtime will try to detect if image is proper one. Otherwise will throw this error. * * @property IMAGE_FORMAT_ERROR * @static * @final */ IMAGE_FORMAT_ERROR : -700, /** * While working on files runtime may run out of memory and will throw this error. * * @since 2.1.2 * @property MEMORY_ERROR * @static * @final */ MEMORY_ERROR : -701, /** * Each runtime has an upper limit on a dimension of the image it can handle. If bigger, will throw this error. * * @property IMAGE_DIMENSIONS_ERROR * @static * @final */ IMAGE_DIMENSIONS_ERROR : -702, /** * Mime type lookup table. * * @property mimeTypes * @type Object * @final */ mimeTypes : o.mimes, /** * In some cases sniffing is the only way around :( */ ua: o.ua, /** * Gets the true type of the built-in object (better version of typeof). * @credits Angus Croll (http://javascriptweblog.wordpress.com/) * * @method typeOf * @static * @param {Object} o Object to check. * @return {String} Object [[Class]] */ typeOf: o.typeOf, /** * Extends the specified object with another object. * * @method extend * @static * @param {Object} target Object to extend. * @param {Object..} obj Multiple objects to extend with. * @return {Object} Same as target, the extended object. */ extend : o.extend, /** * Generates an unique ID. This is 99.99% unique since it takes the current time and 5 random numbers. * The only way a user would be able to get the same ID is if the two persons at the same exact millisecond manages * to get 5 the same random numbers between 0-65535 it also uses a counter so each call will be guaranteed to be page unique. * It's more probable for the earth to be hit with an asteriod. You can also if you want to be 100% sure set the plupload.guidPrefix property * to an user unique key. * * @method guid * @static * @return {String} Virtually unique id. */ guid : o.guid, /** * Get array of DOM Elements by their ids. * * @method get * @param {String} id Identifier of the DOM Element * @return {Array} */ getAll : function get(ids) { var els = [], el; if (plupload.typeOf(ids) !== 'array') { ids = [ids]; } var i = ids.length; while (i--) { el = plupload.get(ids[i]); if (el) { els.push(el); } } return els.length ? els : null; }, /** Get DOM element by id @method get @param {String} id Identifier of the DOM Element @return {Node} */ get: o.get, /** * Executes the callback function for each item in array/object. If you return false in the * callback it will break the loop. * * @method each * @static * @param {Object} obj Object to iterate. * @param {function} callback Callback function to execute for each item. */ each : o.each, /** * Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields. * * @method getPos * @static * @param {Element} node HTML element or element id to get x, y position from. * @param {Element} root Optional root element to stop calculations at. * @return {object} Absolute position of the specified element object with x, y fields. */ getPos : o.getPos, /** * Returns the size of the specified node in pixels. * * @method getSize * @static * @param {Node} node Node to get the size of. * @return {Object} Object with a w and h property. */ getSize : o.getSize, /** * Encodes the specified string. * * @method xmlEncode * @static * @param {String} s String to encode. * @return {String} Encoded string. */ xmlEncode : function(str) { var xmlEncodeChars = {'<' : 'lt', '>' : 'gt', '&' : 'amp', '"' : 'quot', '\'' : '#39'}, xmlEncodeRegExp = /[<>&\"\']/g; return str ? ('' + str).replace(xmlEncodeRegExp, function(chr) { return xmlEncodeChars[chr] ? '&' + xmlEncodeChars[chr] + ';' : chr; }) : str; }, /** * Forces anything into an array. * * @method toArray * @static * @param {Object} obj Object with length field. * @return {Array} Array object containing all items. */ toArray : o.toArray, /** * Find an element in array and return its index if present, otherwise return -1. * * @method inArray * @static * @param {mixed} needle Element to find * @param {Array} array * @return {Int} Index of the element, or -1 if not found */ inArray : o.inArray, /** * Extends the language pack object with new items. * * @method addI18n * @static * @param {Object} pack Language pack items to add. * @return {Object} Extended language pack object. */ addI18n : o.addI18n, /** * Translates the specified string by checking for the english string in the language pack lookup. * * @method translate * @static * @param {String} str String to look for. * @return {String} Translated string or the input string if it wasn't found. */ translate : o.translate, /** * Checks if object is empty. * * @method isEmptyObj * @static * @param {Object} obj Object to check. * @return {Boolean} */ isEmptyObj : o.isEmptyObj, /** * Checks if specified DOM element has specified class. * * @method hasClass * @static * @param {Object} obj DOM element like object to add handler to. * @param {String} name Class name */ hasClass : o.hasClass, /** * Adds specified className to specified DOM element. * * @method addClass * @static * @param {Object} obj DOM element like object to add handler to. * @param {String} name Class name */ addClass : o.addClass, /** * Removes specified className from specified DOM element. * * @method removeClass * @static * @param {Object} obj DOM element like object to add handler to. * @param {String} name Class name */ removeClass : o.removeClass, /** * Returns a given computed style of a DOM element. * * @method getStyle * @static * @param {Object} obj DOM element like object. * @param {String} name Style you want to get from the DOM element */ getStyle : o.getStyle, /** * Adds an event handler to the specified object and store reference to the handler * in objects internal Plupload registry (@see removeEvent). * * @method addEvent * @static * @param {Object} obj DOM element like object to add handler to. * @param {String} name Name to add event listener to. * @param {Function} callback Function to call when event occurs. * @param {String} (optional) key that might be used to add specifity to the event record. */ addEvent : o.addEvent, /** * Remove event handler from the specified object. If third argument (callback) * is not specified remove all events with the specified name. * * @method removeEvent * @static * @param {Object} obj DOM element to remove event listener(s) from. * @param {String} name Name of event listener to remove. * @param {Function|String} (optional) might be a callback or unique key to match. */ removeEvent: o.removeEvent, /** * Remove all kind of events from the specified object * * @method removeAllEvents * @static * @param {Object} obj DOM element to remove event listeners from. * @param {String} (optional) unique key to match, when removing events. */ removeAllEvents: o.removeAllEvents, /** * Cleans the specified name from national characters (diacritics). The result will be a name with only a-z, 0-9 and _. * * @method cleanName * @static * @param {String} s String to clean up. * @return {String} Cleaned string. */ cleanName : function(name) { var i, lookup; // Replace diacritics lookup = [ /[\300-\306]/g, 'A', /[\340-\346]/g, 'a', /\307/g, 'C', /\347/g, 'c', /[\310-\313]/g, 'E', /[\350-\353]/g, 'e', /[\314-\317]/g, 'I', /[\354-\357]/g, 'i', /\321/g, 'N', /\361/g, 'n', /[\322-\330]/g, 'O', /[\362-\370]/g, 'o', /[\331-\334]/g, 'U', /[\371-\374]/g, 'u' ]; for (i = 0; i < lookup.length; i += 2) { name = name.replace(lookup[i], lookup[i + 1]); } // Replace whitespace name = name.replace(/\s+/g, '_'); // Remove anything else name = name.replace(/[^a-z0-9_\-\.]+/gi, ''); return name; }, /** * Builds a full url out of a base URL and an object with items to append as query string items. * * @method buildUrl * @static * @param {String} url Base URL to append query string items to. * @param {Object} items Name/value object to serialize as a querystring. * @return {String} String with url + serialized query string items. */ buildUrl : function(url, items) { var query = ''; plupload.each(items, function(value, name) { query += (query ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value); }); if (query) { url += (url.indexOf('?') > 0 ? '&' : '?') + query; } return url; }, /** * Formats the specified number as a size string for example 1024 becomes 1 KB. * * @method formatSize * @static * @param {Number} size Size to format as string. * @return {String} Formatted size string. */ formatSize : function(size) { if (size === undef || /\D/.test(size)) { return plupload.translate('N/A'); } function round(num, precision) { return Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision); } var boundary = Math.pow(1024, 4); // TB if (size > boundary) { return round(size / boundary, 1) + " " + plupload.translate('tb'); } // GB if (size > (boundary/=1024)) { return round(size / boundary, 1) + " " + plupload.translate('gb'); } // MB if (size > (boundary/=1024)) { return round(size / boundary, 1) + " " + plupload.translate('mb'); } // KB if (size > 1024) { return Math.round(size / 1024) + " " + plupload.translate('kb'); } return size + " " + plupload.translate('b'); }, /** * Parses the specified size string into a byte value. For example 10kb becomes 10240. * * @method parseSize * @static * @param {String|Number} size String to parse or number to just pass through. * @return {Number} Size in bytes. */ parseSize : o.parseSizeStr, /** * A way to predict what runtime will be choosen in the current environment with the * specified settings. * * @method predictRuntime * @static * @param {Object|String} config Plupload settings to check * @param {String} [runtimes] Comma-separated list of runtimes to check against * @return {String} Type of compatible runtime */ predictRuntime : function(config, runtimes) { var up, runtime; up = new plupload.Uploader(config); runtime = o.Runtime.thatCan(up.getOption().required_features, runtimes || config.runtimes); up.destroy(); return runtime; }, /** * Registers a filter that will be executed for each file added to the queue. * If callback returns false, file will not be added. * * Callback receives two arguments: a value for the filter as it was specified in settings.filters * and a file to be filtered. Callback is executed in the context of uploader instance. * * @method addFileFilter * @static * @param {String} name Name of the filter by which it can be referenced in settings.filters * @param {String} cb Callback - the actual routine that every added file must pass */ addFileFilter: function(name, cb) { fileFilters[name] = cb; } }; plupload.addFileFilter('mime_types', function(filters, file, cb) { if (filters.length && !filters.regexp.test(file.name)) { this.trigger('Error', { code : plupload.FILE_EXTENSION_ERROR, message : plupload.translate('File extension error.'), file : file }); cb(false); } else { cb(true); } }); plupload.addFileFilter('max_file_size', function(maxSize, file, cb) { var undef; maxSize = plupload.parseSize(maxSize); // Invalid file size if (file.size !== undef && maxSize && file.size > maxSize) { this.trigger('Error', { code : plupload.FILE_SIZE_ERROR, message : plupload.translate('File size error.'), file : file }); cb(false); } else { cb(true); } }); plupload.addFileFilter('prevent_duplicates', function(value, file, cb) { if (value) { var ii = this.files.length; while (ii--) { // Compare by name and size (size might be 0 or undefined, but still equivalent for both) if (file.name === this.files[ii].name && file.size === this.files[ii].size) { this.trigger('Error', { code : plupload.FILE_DUPLICATE_ERROR, message : plupload.translate('Duplicate file error.'), file : file }); cb(false); return; } } } cb(true); }); /** @class Uploader @constructor @param {Object} settings For detailed information about each option check documentation. @param {String|DOMElement} settings.browse_button id of the DOM element or DOM element itself to use as file dialog trigger. @param {String} settings.url URL of the server-side upload handler. @param {Number|String} [settings.chunk_size=0] Chunk size in bytes to slice the file into. Shorcuts with b, kb, mb, gb, tb suffixes also supported. `e.g. 204800 or "204800b" or "200kb"`. By default - disabled. @param {Boolean} [settings.send_chunk_number=true] Whether to send chunks and chunk numbers, or total and offset bytes. @param {String|DOMElement} [settings.container] id of the DOM element or DOM element itself that will be used to wrap uploader structures. Defaults to immediate parent of the `browse_button` element. @param {String|DOMElement} [settings.drop_element] id of the DOM element or DOM element itself to use as a drop zone for Drag-n-Drop. @param {String} [settings.file_data_name="file"] Name for the file field in Multipart formated message. @param {Object} [settings.filters={}] Set of file type filters. @param {Array} [settings.filters.mime_types=[]] List of file types to accept, each one defined by title and list of extensions. `e.g. {title : "Image files", extensions : "jpg,jpeg,gif,png"}`. Dispatches `plupload.FILE_EXTENSION_ERROR` @param {String|Number} [settings.filters.max_file_size=0] Maximum file size that the user can pick, in bytes. Optionally supports b, kb, mb, gb, tb suffixes. `e.g. "10mb" or "1gb"`. By default - not set. Dispatches `plupload.FILE_SIZE_ERROR`. @param {Boolean} [settings.filters.prevent_duplicates=false] Do not let duplicates into the queue. Dispatches `plupload.FILE_DUPLICATE_ERROR`. @param {String} [settings.flash_swf_url] URL of the Flash swf. (Not used in WordPress) @param {Object} [settings.headers] Custom headers to send with the upload. Hash of name/value pairs. @param {Number} [settings.max_retries=0] How many times to retry the chunk or file, before triggering Error event. @param {Boolean} [settings.multipart=true] Whether to send file and additional parameters as Multipart formated message. @param {Object} [settings.multipart_params] Hash of key/value pairs to send with every file upload. @param {Boolean} [settings.multi_selection=true] Enable ability to select multiple files at once in file dialog. @param {String|Object} [settings.required_features] Either comma-separated list or hash of required features that chosen runtime should absolutely possess. @param {Object} [settings.resize] Enable resizng of images on client-side. Applies to `image/jpeg` and `image/png` only. `e.g. {width : 200, height : 200, quality : 90, crop: true}` @param {Number} [settings.resize.width] If image is bigger, it will be resized. @param {Number} [settings.resize.height] If image is bigger, it will be resized. @param {Number} [settings.resize.quality=90] Compression quality for jpegs (1-100). @param {Boolean} [settings.resize.crop=false] Whether to crop images to exact dimensions. By default they will be resized proportionally. @param {String} [settings.runtimes="html5,html4"] Comma separated list of runtimes, that Plupload will try in turn, moving to the next if previous fails. @param {String} [settings.silverlight_xap_url] URL of the Silverlight xap. (Not used in WordPress) @param {Boolean} [settings.unique_names=false] If true will generate unique filenames for uploaded files. @param {Boolean} [settings.send_file_name=true] Whether to send file name as additional argument - 'name' (required for chunked uploads and some other cases where file name cannot be sent via normal ways). */ plupload.Uploader = function(options) { /** Fires when the current RunTime has been initialized. @event Init @param {plupload.Uploader} uploader Uploader instance sending the event. */ /** Fires after the init event incase you need to perform actions there. @event PostInit @param {plupload.Uploader} uploader Uploader instance sending the event. */ /** Fires when the option is changed in via uploader.setOption(). @event OptionChanged @since 2.1 @param {plupload.Uploader} uploader Uploader instance sending the event. @param {String} name Name of the option that was changed @param {Mixed} value New value for the specified option @param {Mixed} oldValue Previous value of the option */ /** Fires when the silverlight/flash or other shim needs to move. @event Refresh @param {plupload.Uploader} uploader Uploader instance sending the event. */ /** Fires when the overall state is being changed for the upload queue. @event StateChanged @param {plupload.Uploader} uploader Uploader instance sending the event. */ /** Fires when browse_button is clicked and browse dialog shows. @event Browse @since 2.1.2 @param {plupload.Uploader} uploader Uploader instance sending the event. */ /** Fires for every filtered file before it is added to the queue. @event FileFiltered @since 2.1 @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.File} file Another file that has to be added to the queue. */ /** Fires when the file queue is changed. In other words when files are added/removed to the files array of the uploader instance. @event QueueChanged @param {plupload.Uploader} uploader Uploader instance sending the event. */ /** Fires after files were filtered and added to the queue. @event FilesAdded @param {plupload.Uploader} uploader Uploader instance sending the event. @param {Array} files Array of file objects that were added to queue by the user. */ /** Fires when file is removed from the queue. @event FilesRemoved @param {plupload.Uploader} uploader Uploader instance sending the event. @param {Array} files Array of files that got removed. */ /** Fires just before a file is uploaded. Can be used to cancel the upload for the specified file by returning false from the handler. @event BeforeUpload @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.File} file File to be uploaded. */ /** Fires when a file is to be uploaded by the runtime. @event UploadFile @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.File} file File to be uploaded. */ /** Fires while a file is being uploaded. Use this event to update the current file upload progress. @event UploadProgress @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.File} file File that is currently being uploaded. */ /** Fires when file chunk is uploaded. @event ChunkUploaded @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.File} file File that the chunk was uploaded for. @param {Object} result Object with response properties. @param {Number} result.offset The amount of bytes the server has received so far, including this chunk. @param {Number} result.total The size of the file. @param {String} result.response The response body sent by the server. @param {Number} result.status The HTTP status code sent by the server. @param {String} result.responseHeaders All the response headers as a single string. */ /** Fires when a file is successfully uploaded. @event FileUploaded @param {plupload.Uploader} uploader Uploader instance sending the event. @param {plupload.File} file File that was uploaded. @param {Object} result Object with response properties. @param {String} result.response The response body sent by the server. @param {Number} result.status The HTTP status code sent by the server. @param {String} result.responseHeaders All the response headers as a single string. */ /** Fires when all files in a queue are uploaded. @event UploadComplete @param {plupload.Uploader} uploader Uploader instance sending the event. @param {Array} files Array of file objects that was added to queue/selected by the user. */ /** Fires when a error occurs. @event Error @param {plupload.Uploader} uploader Uploader instance sending the event. @param {Object} error Contains code, message and sometimes file and other details. @param {Number} error.code The plupload error code. @param {String} error.message Description of the error (uses i18n). */ /** Fires when destroy method is called. @event Destroy @param {plupload.Uploader} uploader Uploader instance sending the event. */ var uid = plupload.guid() , settings , files = [] , preferred_caps = {} , fileInputs = [] , fileDrops = [] , startTime , total , disabled = false , xhr ; // Private methods function uploadNext() { var file, count = 0, i; if (this.state == plupload.STARTED) { // Find first QUEUED file for (i = 0; i < files.length; i++) { if (!file && files[i].status == plupload.QUEUED) { file = files[i]; if (this.trigger("BeforeUpload", file)) { file.status = plupload.UPLOADING; this.trigger("UploadFile", file); } } else { count++; } } // All files are DONE or FAILED if (count == files.length) { if (this.state !== plupload.STOPPED) { this.state = plupload.STOPPED; this.trigger("StateChanged"); } this.trigger("UploadComplete", files); } } } function calcFile(file) { file.percent = file.size > 0 ? Math.ceil(file.loaded / file.size * 100) : 100; calc(); } function calc() { var i, file; // Reset stats total.reset(); // Check status, size, loaded etc on all files for (i = 0; i < files.length; i++) { file = files[i]; if (file.size !== undef) { // We calculate totals based on original file size total.size += file.origSize; // Since we cannot predict file size after resize, we do opposite and // interpolate loaded amount to match magnitude of total total.loaded += file.loaded * file.origSize / file.size; } else { total.size = undef; } if (file.status == plupload.DONE) { total.uploaded++; } else if (file.status == plupload.FAILED) { total.failed++; } else { total.queued++; } } // If we couldn't calculate a total file size then use the number of files to calc percent if (total.size === undef) { total.percent = files.length > 0 ? Math.ceil(total.uploaded / files.length * 100) : 0; } else { total.bytesPerSec = Math.ceil(total.loaded / ((+new Date() - startTime || 1) / 1000.0)); total.percent = total.size > 0 ? Math.ceil(total.loaded / total.size * 100) : 0; } } function getRUID() { var ctrl = fileInputs[0] || fileDrops[0]; if (ctrl) { return ctrl.getRuntime().uid; } return false; } function runtimeCan(file, cap) { if (file.ruid) { var info = o.Runtime.getInfo(file.ruid); if (info) { return info.can(cap); } } return false; } function bindEventListeners() { this.bind('FilesAdded FilesRemoved', function(up) { up.trigger('QueueChanged'); up.refresh(); }); this.bind('CancelUpload', onCancelUpload); this.bind('BeforeUpload', onBeforeUpload); this.bind('UploadFile', onUploadFile); this.bind('UploadProgress', onUploadProgress); this.bind('StateChanged', onStateChanged); this.bind('QueueChanged', calc); this.bind('Error', onError); this.bind('FileUploaded', onFileUploaded); this.bind('Destroy', onDestroy); } function initControls(settings, cb) { var self = this, inited = 0, queue = []; // common settings var options = { runtime_order: settings.runtimes, required_caps: settings.required_features, preferred_caps: preferred_caps }; // add runtime specific options if any plupload.each(settings.runtimes.split(/\s*,\s*/), function(runtime) { if (settings[runtime]) { options[runtime] = settings[runtime]; } }); // initialize file pickers - there can be many if (settings.browse_button) { plupload.each(settings.browse_button, function(el) { queue.push(function(cb) { var fileInput = new o.FileInput(plupload.extend({}, options, { accept: settings.filters.mime_types, name: settings.file_data_name, multiple: settings.multi_selection, container: settings.container, browse_button: el })); fileInput.onready = function() { var info = o.Runtime.getInfo(this.ruid); // for backward compatibility o.extend(self.features, { chunks: info.can('slice_blob'), multipart: info.can('send_multipart'), multi_selection: info.can('select_multiple') }); inited++; fileInputs.push(this); cb(); }; fileInput.onchange = function() { self.addFile(this.files); }; fileInput.bind('mouseenter mouseleave mousedown mouseup', function(e) { if (!disabled) { if (settings.browse_button_hover) { if ('mouseenter' === e.type) { o.addClass(el, settings.browse_button_hover); } else if ('mouseleave' === e.type) { o.removeClass(el, settings.browse_button_hover); } } if (settings.browse_button_active) { if ('mousedown' === e.type) { o.addClass(el, settings.browse_button_active); } else if ('mouseup' === e.type) { o.removeClass(el, settings.browse_button_active); } } } }); fileInput.bind('mousedown', function() { self.trigger('Browse'); }); fileInput.bind('error runtimeerror', function() { fileInput = null; cb(); }); fileInput.init(); }); }); } // initialize drop zones if (settings.drop_element) { plupload.each(settings.drop_element, function(el) { queue.push(function(cb) { var fileDrop = new o.FileDrop(plupload.extend({}, options, { drop_zone: el })); fileDrop.onready = function() { var info = o.Runtime.getInfo(this.ruid); // for backward compatibility o.extend(self.features, { chunks: info.can('slice_blob'), multipart: info.can('send_multipart'), dragdrop: info.can('drag_and_drop') }); inited++; fileDrops.push(this); cb(); }; fileDrop.ondrop = function() { self.addFile(this.files); }; fileDrop.bind('error runtimeerror', function() { fileDrop = null; cb(); }); fileDrop.init(); }); }); } o.inSeries(queue, function() { if (typeof(cb) === 'function') { cb(inited); } }); } function resizeImage(blob, params, cb) { var img = new o.Image(); try { img.onload = function() { // no manipulation required if... if (params.width > this.width && params.height > this.height && params.quality === undef && params.preserve_headers && !params.crop ) { this.destroy(); return cb(blob); } // otherwise downsize img.downsize(params.width, params.height, params.crop, params.preserve_headers); }; img.onresize = function() { cb(this.getAsBlob(blob.type, params.quality)); this.destroy(); }; img.onerror = function() { cb(blob); }; img.load(blob); } catch(ex) { cb(blob); } } function setOption(option, value, init) { var self = this, reinitRequired = false; function _setOption(option, value, init) { var oldValue = settings[option]; switch (option) { case 'max_file_size': if (option === 'max_file_size') { settings.max_file_size = settings.filters.max_file_size = value; } break; case 'chunk_size': if (value = plupload.parseSize(value)) { settings[option] = value; settings.send_file_name = true; } break; case 'multipart': settings[option] = value; if (!value) { settings.send_file_name = true; } break; case 'unique_names': settings[option] = value; if (value) { settings.send_file_name = true; } break; case 'filters': // for sake of backward compatibility if (plupload.typeOf(value) === 'array') { value = { mime_types: value }; } if (init) { plupload.extend(settings.filters, value); } else { settings.filters = value; } // if file format filters are being updated, regenerate the matching expressions if (value.mime_types) { settings.filters.mime_types.regexp = (function(filters) { var extensionsRegExp = []; plupload.each(filters, function(filter) { plupload.each(filter.extensions.split(/,/), function(ext) { if (/^\s*\*\s*$/.test(ext)) { extensionsRegExp.push('\\.*'); } else { extensionsRegExp.push('\\.' + ext.replace(new RegExp('[' + ('/^$.*+?|()[]{}\\'.replace(/./g, '\\$&')) + ']', 'g'), '\\$&')); } }); }); return new RegExp('(' + extensionsRegExp.join('|') + ')$', 'i'); }(settings.filters.mime_types)); } break; case 'resize': if (init) { plupload.extend(settings.resize, value, { enabled: true }); } else { settings.resize = value; } break; case 'prevent_duplicates': settings.prevent_duplicates = settings.filters.prevent_duplicates = !!value; break; // options that require reinitialisation case 'container': case 'browse_button': case 'drop_element': value = 'container' === option ? plupload.get(value) : plupload.getAll(value) ; case 'runtimes': case 'multi_selection': settings[option] = value; if (!init) { reinitRequired = true; } break; default: settings[option] = value; } if (!init) { self.trigger('OptionChanged', option, value, oldValue); } } if (typeof(option) === 'object') { plupload.each(option, function(value, option) { _setOption(option, value, init); }); } else { _setOption(option, value, init); } if (init) { // Normalize the list of required capabilities settings.required_features = normalizeCaps(plupload.extend({}, settings)); // Come up with the list of capabilities that can affect default mode in a multi-mode runtimes preferred_caps = normalizeCaps(plupload.extend({}, settings, { required_features: true })); } else if (reinitRequired) { self.trigger('Destroy'); initControls.call(self, settings, function(inited) { if (inited) { self.runtime = o.Runtime.getInfo(getRUID()).type; self.trigger('Init', { runtime: self.runtime }); self.trigger('PostInit'); } else { self.trigger('Error', { code : plupload.INIT_ERROR, message : plupload.translate('Init error.') }); } }); } } // Internal event handlers function onBeforeUpload(up, file) { // Generate unique target filenames if (up.settings.unique_names) { var matches = file.name.match(/\.([^.]+)$/), ext = "part"; if (matches) { ext = matches[1]; } file.target_name = file.id + '.' + ext; } } function onUploadFile(up, file) { var url = up.settings.url , chunkSize = up.settings.chunk_size , retries = up.settings.max_retries , features = up.features , offset = 0 , blob ; // make sure we start at a predictable offset if (file.loaded) { offset = file.loaded = chunkSize ? chunkSize * Math.floor(file.loaded / chunkSize) : 0; } function handleError() { if (retries-- > 0) { delay(uploadNextChunk, 1000); } else { file.loaded = offset; // reset all progress up.trigger('Error', { code : plupload.HTTP_ERROR, message : plupload.translate('HTTP Error.'), file : file, response : xhr.responseText, status : xhr.status, responseHeaders: xhr.getAllResponseHeaders() }); } } function uploadNextChunk() { var chunkBlob, formData, args = {}, curChunkSize; // make sure that file wasn't cancelled and upload is not stopped in general if (file.status !== plupload.UPLOADING || up.state === plupload.STOPPED) { return; } // send additional 'name' parameter only if required if (up.settings.send_file_name) { args.name = file.target_name || file.name; } if (chunkSize && features.chunks && blob.size > chunkSize) { // blob will be of type string if it was loaded in memory curChunkSize = Math.min(chunkSize, blob.size - offset); chunkBlob = blob.slice(offset, offset + curChunkSize); } else { curChunkSize = blob.size; chunkBlob = blob; } // If chunking is enabled add corresponding args, no matter if file is bigger than chunk or smaller if (chunkSize && features.chunks) { // Setup query string arguments if (up.settings.send_chunk_number) { args.chunk = Math.ceil(offset / chunkSize); args.chunks = Math.ceil(blob.size / chunkSize); } else { // keep support for experimental chunk format, just in case args.offset = offset; args.total = blob.size; } } xhr = new o.XMLHttpRequest(); // Do we have upload progress support if (xhr.upload) { xhr.upload.onprogress = function(e) { file.loaded = Math.min(file.size, offset + e.loaded); up.trigger('UploadProgress', file); }; } xhr.onload = function() { // check if upload made itself through if (xhr.status >= 400) { handleError(); return; } retries = up.settings.max_retries; // reset the counter // Handle chunk response if (curChunkSize < blob.size) { chunkBlob.destroy(); offset += curChunkSize; file.loaded = Math.min(offset, blob.size); up.trigger('ChunkUploaded', file, { offset : file.loaded, total : blob.size, response : xhr.responseText, status : xhr.status, responseHeaders: xhr.getAllResponseHeaders() }); // stock Android browser doesn't fire upload progress events, but in chunking mode we can fake them if (o.Env.browser === 'Android Browser') { // doesn't harm in general, but is not required anywhere else up.trigger('UploadProgress', file); } } else { file.loaded = file.size; } chunkBlob = formData = null; // Free memory // Check if file is uploaded if (!offset || offset >= blob.size) { // If file was modified, destory the copy if (file.size != file.origSize) { blob.destroy(); blob = null; } up.trigger('UploadProgress', file); file.status = plupload.DONE; up.trigger('FileUploaded', file, { response : xhr.responseText, status : xhr.status, responseHeaders: xhr.getAllResponseHeaders() }); } else { // Still chunks left delay(uploadNextChunk, 1); // run detached, otherwise event handlers interfere } }; xhr.onerror = function() { handleError(); }; xhr.onloadend = function() { this.destroy(); xhr = null; }; // Build multipart request if (up.settings.multipart && features.multipart) { xhr.open("post", url, true); // Set custom headers plupload.each(up.settings.headers, function(value, name) { xhr.setRequestHeader(name, value); }); formData = new o.FormData(); // Add multipart params plupload.each(plupload.extend(args, up.settings.multipart_params), function(value, name) { formData.append(name, value); }); // Add file and send it formData.append(up.settings.file_data_name, chunkBlob); xhr.send(formData, { runtime_order: up.settings.runtimes, required_caps: up.settings.required_features, preferred_caps: preferred_caps }); } else { // if no multipart, send as binary stream url = plupload.buildUrl(up.settings.url, plupload.extend(args, up.settings.multipart_params)); xhr.open("post", url, true); xhr.setRequestHeader('Content-Type', 'application/octet-stream'); // Binary stream header // Set custom headers plupload.each(up.settings.headers, function(value, name) { xhr.setRequestHeader(name, value); }); xhr.send(chunkBlob, { runtime_order: up.settings.runtimes, required_caps: up.settings.required_features, preferred_caps: preferred_caps }); } } blob = file.getSource(); // Start uploading chunks if (up.settings.resize.enabled && runtimeCan(blob, 'send_binary_string') && !!~o.inArray(blob.type, ['image/jpeg', 'image/png'])) { // Resize if required resizeImage.call(this, blob, up.settings.resize, function(resizedBlob) { blob = resizedBlob; file.size = resizedBlob.size; uploadNextChunk(); }); } else { uploadNextChunk(); } } function onUploadProgress(up, file) { calcFile(file); } function onStateChanged(up) { if (up.state == plupload.STARTED) { // Get start time to calculate bps startTime = (+new Date()); } else if (up.state == plupload.STOPPED) { // Reset currently uploading files for (var i = up.files.length - 1; i >= 0; i--) { if (up.files[i].status == plupload.UPLOADING) { up.files[i].status = plupload.QUEUED; calc(); } } } } function onCancelUpload() { if (xhr) { xhr.abort(); } } function onFileUploaded(up) { calc(); // Upload next file but detach it from the error event // since other custom listeners might want to stop the queue delay(function() { uploadNext.call(up); }, 1); } function onError(up, err) { if (err.code === plupload.INIT_ERROR) { up.destroy(); } // Set failed status if an error occured on a file else if (err.code === plupload.HTTP_ERROR) { err.file.status = plupload.FAILED; calcFile(err.file); // Upload next file but detach it from the error event // since other custom listeners might want to stop the queue if (up.state == plupload.STARTED) { // upload in progress up.trigger('CancelUpload'); delay(function() { uploadNext.call(up); }, 1); } } } function onDestroy(up) { up.stop(); // Purge the queue plupload.each(files, function(file) { file.destroy(); }); files = []; if (fileInputs.length) { plupload.each(fileInputs, function(fileInput) { fileInput.destroy(); }); fileInputs = []; } if (fileDrops.length) { plupload.each(fileDrops, function(fileDrop) { fileDrop.destroy(); }); fileDrops = []; } preferred_caps = {}; disabled = false; startTime = xhr = null; total.reset(); } // Default settings settings = { runtimes: o.Runtime.order, max_retries: 0, chunk_size: 0, multipart: true, multi_selection: true, file_data_name: 'file', filters: { mime_types: [], prevent_duplicates: false, max_file_size: 0 }, resize: { enabled: false, preserve_headers: true, crop: false }, send_file_name: true, send_chunk_number: true }; setOption.call(this, options, null, true); // Inital total state total = new plupload.QueueProgress(); // Add public methods plupload.extend(this, { /** * Unique id for the Uploader instance. * * @property id * @type String */ id : uid, uid : uid, // mOxie uses this to differentiate between event targets /** * Current state of the total uploading progress. This one can either be plupload.STARTED or plupload.STOPPED. * These states are controlled by the stop/start methods. The default value is STOPPED. * * @property state * @type Number */ state : plupload.STOPPED, /** * Map of features that are available for the uploader runtime. Features will be filled * before the init event is called, these features can then be used to alter the UI for the end user. * Some of the current features that might be in this map is: dragdrop, chunks, jpgresize, pngresize. * * @property features * @type Object */ features : {}, /** * Current runtime name. * * @property runtime * @type String */ runtime : null, /** * Current upload queue, an array of File instances. * * @property files * @type Array * @see plupload.File */ files : files, /** * Object with name/value settings. * * @property settings * @type Object */ settings : settings, /** * Total progess information. How many files has been uploaded, total percent etc. * * @property total * @type plupload.QueueProgress */ total : total, /** * Initializes the Uploader instance and adds internal event listeners. * * @method init */ init : function() { var self = this, opt, preinitOpt, err; preinitOpt = self.getOption('preinit'); if (typeof(preinitOpt) == "function") { preinitOpt(self); } else { plupload.each(preinitOpt, function(func, name) { self.bind(name, func); }); } bindEventListeners.call(self); // Check for required options plupload.each(['container', 'browse_button', 'drop_element'], function(el) { if (self.getOption(el) === null) { err = { code : plupload.INIT_ERROR, message : plupload.translate("'%' specified, but cannot be found.") } return false; } }); if (err) { return self.trigger('Error', err); } if (!settings.browse_button && !settings.drop_element) { return self.trigger('Error', { code : plupload.INIT_ERROR, message : plupload.translate("You must specify either 'browse_button' or 'drop_element'.") }); } initControls.call(self, settings, function(inited) { var initOpt = self.getOption('init'); if (typeof(initOpt) == "function") { initOpt(self); } else { plupload.each(initOpt, function(func, name) { self.bind(name, func); }); } if (inited) { self.runtime = o.Runtime.getInfo(getRUID()).type; self.trigger('Init', { runtime: self.runtime }); self.trigger('PostInit'); } else { self.trigger('Error', { code : plupload.INIT_ERROR, message : plupload.translate('Init error.') }); } }); }, /** * Set the value for the specified option(s). * * @method setOption * @since 2.1 * @param {String|Object} option Name of the option to change or the set of key/value pairs * @param {Mixed} [value] Value for the option (is ignored, if first argument is object) */ setOption: function(option, value) { setOption.call(this, option, value, !this.runtime); // until runtime not set we do not need to reinitialize }, /** * Get the value for the specified option or the whole configuration, if not specified. * * @method getOption * @since 2.1 * @param {String} [option] Name of the option to get * @return {Mixed} Value for the option or the whole set */ getOption: function(option) { if (!option) { return settings; } return settings[option]; }, /** * Refreshes the upload instance by dispatching out a refresh event to all runtimes. * This would for example reposition flash/silverlight shims on the page. * * @method refresh */ refresh : function() { if (fileInputs.length) { plupload.each(fileInputs, function(fileInput) { fileInput.trigger('Refresh'); }); } this.trigger('Refresh'); }, /** * Starts uploading the queued files. * * @method start */ start : function() { if (this.state != plupload.STARTED) { this.state = plupload.STARTED; this.trigger('StateChanged'); uploadNext.call(this); } }, /** * Stops the upload of the queued files. * * @method stop */ stop : function() { if (this.state != plupload.STOPPED) { this.state = plupload.STOPPED; this.trigger('StateChanged'); this.trigger('CancelUpload'); } }, /** * Disables/enables browse button on request. * * @method disableBrowse * @param {Boolean} disable Whether to disable or enable (default: true) */ disableBrowse : function() { disabled = arguments[0] !== undef ? arguments[0] : true; if (fileInputs.length) { plupload.each(fileInputs, function(fileInput) { fileInput.disable(disabled); }); } this.trigger('DisableBrowse', disabled); }, /** * Returns the specified file object by id. * * @method getFile * @param {String} id File id to look for. * @return {plupload.File} File object or undefined if it wasn't found; */ getFile : function(id) { var i; for (i = files.length - 1; i >= 0; i--) { if (files[i].id === id) { return files[i]; } } }, /** * Adds file to the queue programmatically. Can be native file, instance of Plupload.File, * instance of mOxie.File, input[type="file"] element, or array of these. Fires FilesAdded, * if any files were added to the queue. Otherwise nothing happens. * * @method addFile * @since 2.0 * @param {plupload.File|mOxie.File|File|Node|Array} file File or files to add to the queue. * @param {String} [fileName] If specified, will be used as a name for the file */ addFile : function(file, fileName) { var self = this , queue = [] , filesAdded = [] , ruid ; function filterFile(file, cb) { var queue = []; o.each(self.settings.filters, function(rule, name) { if (fileFilters[name]) { queue.push(function(cb) { fileFilters[name].call(self, rule, file, function(res) { cb(!res); }); }); } }); o.inSeries(queue, cb); } /** * @method resolveFile * @private * @param {o.File|o.Blob|plupload.File|File|Blob|input[type="file"]} file */ function resolveFile(file) { var type = o.typeOf(file); // o.File if (file instanceof o.File) { if (!file.ruid && !file.isDetached()) { if (!ruid) { // weird case return false; } file.ruid = ruid; file.connectRuntime(ruid); } resolveFile(new plupload.File(file)); } // o.Blob else if (file instanceof o.Blob) { resolveFile(file.getSource()); file.destroy(); } // plupload.File - final step for other branches else if (file instanceof plupload.File) { if (fileName) { file.name = fileName; } queue.push(function(cb) { // run through the internal and user-defined filters, if any filterFile(file, function(err) { if (!err) { // make files available for the filters by updating the main queue directly files.push(file); // collect the files that will be passed to FilesAdded event filesAdded.push(file); self.trigger("FileFiltered", file); } delay(cb, 1); // do not build up recursions or eventually we might hit the limits }); }); } // native File or blob else if (o.inArray(type, ['file', 'blob']) !== -1) { resolveFile(new o.File(null, file)); } // input[type="file"] else if (type === 'node' && o.typeOf(file.files) === 'filelist') { // if we are dealing with input[type="file"] o.each(file.files, resolveFile); } // mixed array of any supported types (see above) else if (type === 'array') { fileName = null; // should never happen, but unset anyway to avoid funny situations o.each(file, resolveFile); } } ruid = getRUID(); resolveFile(file); if (queue.length) { o.inSeries(queue, function() { // if any files left after filtration, trigger FilesAdded if (filesAdded.length) { self.trigger("FilesAdded", filesAdded); } }); } }, /** * Removes a specific file. * * @method removeFile * @param {plupload.File|String} file File to remove from queue. */ removeFile : function(file) { var id = typeof(file) === 'string' ? file : file.id; for (var i = files.length - 1; i >= 0; i--) { if (files[i].id === id) { return this.splice(i, 1)[0]; } } }, /** * Removes part of the queue and returns the files removed. This will also trigger the FilesRemoved and QueueChanged events. * * @method splice * @param {Number} start (Optional) Start index to remove from. * @param {Number} length (Optional) Lengh of items to remove. * @return {Array} Array of files that was removed. */ splice : function(start, length) { // Splice and trigger events var removed = files.splice(start === undef ? 0 : start, length === undef ? files.length : length); // if upload is in progress we need to stop it and restart after files are removed var restartRequired = false; if (this.state == plupload.STARTED) { // upload in progress plupload.each(removed, function(file) { if (file.status === plupload.UPLOADING) { restartRequired = true; // do not restart, unless file that is being removed is uploading return false; } }); if (restartRequired) { this.stop(); } } this.trigger("FilesRemoved", removed); // Dispose any resources allocated by those files plupload.each(removed, function(file) { file.destroy(); }); if (restartRequired) { this.start(); } return removed; }, /** Dispatches the specified event name and its arguments to all listeners. @method trigger @param {String} name Event name to fire. @param {Object..} Multiple arguments to pass along to the listener functions. */ // override the parent method to match Plupload-like event logic dispatchEvent: function(type) { var list, args, result; type = type.toLowerCase(); list = this.hasEventListener(type); if (list) { // sort event list by priority list.sort(function(a, b) { return b.priority - a.priority; }); // first argument should be current plupload.Uploader instance args = [].slice.call(arguments); args.shift(); args.unshift(this); for (var i = 0; i < list.length; i++) { // Fire event, break chain if false is returned if (list[i].fn.apply(list[i].scope, args) === false) { return false; } } } return true; }, /** Check whether uploader has any listeners to the specified event. @method hasEventListener @param {String} name Event name to check for. */ /** Adds an event listener by name. @method bind @param {String} name Event name to listen for. @param {function} fn Function to call ones the event gets fired. @param {Object} [scope] Optional scope to execute the specified function in. @param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first */ bind: function(name, fn, scope, priority) { // adapt moxie EventTarget style to Plupload-like plupload.Uploader.prototype.bind.call(this, name, fn, priority, scope); }, /** Removes the specified event listener. @method unbind @param {String} name Name of event to remove. @param {function} fn Function to remove from listener. */ /** Removes all event listeners. @method unbindAll */ /** * Destroys Plupload instance and cleans after itself. * * @method destroy */ destroy : function() { this.trigger('Destroy'); settings = total = null; // purge these exclusively this.unbindAll(); } }); }; plupload.Uploader.prototype = o.EventTarget.instance; /** * Constructs a new file instance. * * @class File * @constructor * * @param {Object} file Object containing file properties * @param {String} file.name Name of the file. * @param {Number} file.size File size. */ plupload.File = (function() { var filepool = {}; function PluploadFile(file) { plupload.extend(this, { /** * File id this is a globally unique id for the specific file. * * @property id * @type String */ id: plupload.guid(), /** * File name for example "myfile.gif". * * @property name * @type String */ name: file.name || file.fileName, /** * File type, `e.g image/jpeg` * * @property type * @type String */ type: file.type || '', /** * File size in bytes (may change after client-side manupilation). * * @property size * @type Number */ size: file.size || file.fileSize, /** * Original file size in bytes. * * @property origSize * @type Number */ origSize: file.size || file.fileSize, /** * Number of bytes uploaded of the files total size. * * @property loaded * @type Number */ loaded: 0, /** * Number of percentage uploaded of the file. * * @property percent * @type Number */ percent: 0, /** * Status constant matching the plupload states QUEUED, UPLOADING, FAILED, DONE. * * @property status * @type Number * @see plupload */ status: plupload.QUEUED, /** * Date of last modification. * * @property lastModifiedDate * @type {String} */ lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString(), // Thu Aug 23 2012 19:40:00 GMT+0400 (GET) /** * Returns native window.File object, when it's available. * * @method getNative * @return {window.File} or null, if plupload.File is of different origin */ getNative: function() { var file = this.getSource().getSource(); return o.inArray(o.typeOf(file), ['blob', 'file']) !== -1 ? file : null; }, /** * Returns mOxie.File - unified wrapper object that can be used across runtimes. * * @method getSource * @return {mOxie.File} or null */ getSource: function() { if (!filepool[this.id]) { return null; } return filepool[this.id]; }, /** * Destroys plupload.File object. * * @method destroy */ destroy: function() { var src = this.getSource(); if (src) { src.destroy(); delete filepool[this.id]; } } }); filepool[this.id] = file; } return PluploadFile; }()); /** * Constructs a queue progress. * * @class QueueProgress * @constructor */ plupload.QueueProgress = function() { var self = this; // Setup alias for self to reduce code size when it's compressed /** * Total queue file size. * * @property size * @type Number */ self.size = 0; /** * Total bytes uploaded. * * @property loaded * @type Number */ self.loaded = 0; /** * Number of files uploaded. * * @property uploaded * @type Number */ self.uploaded = 0; /** * Number of files failed to upload. * * @property failed * @type Number */ self.failed = 0; /** * Number of files yet to be uploaded. * * @property queued * @type Number */ self.queued = 0; /** * Total percent of the uploaded bytes. * * @property percent * @type Number */ self.percent = 0; /** * Bytes uploaded per second. * * @property bytesPerSec * @type Number */ self.bytesPerSec = 0; /** * Resets the progress to its initial values. * * @method reset */ self.reset = function() { self.size = self.loaded = self.uploaded = self.failed = self.queued = self.percent = self.bytesPerSec = 0; }; }; window.plupload = plupload; }(window, mOxie)); plupload/wp-plupload.js 0000644 00000040501 15125140777 0011177 0 ustar 00 /* global pluploadL10n, plupload, _wpPluploadSettings */ /** * @namespace wp */ window.wp = window.wp || {}; ( function( exports, $ ) { var Uploader; if ( typeof _wpPluploadSettings === 'undefined' ) { return; } /** * A WordPress uploader. * * The Plupload library provides cross-browser uploader UI integration. * This object bridges the Plupload API to integrate uploads into the * WordPress back end and the WordPress media experience. * * @class * @memberOf wp * @alias wp.Uploader * * @param {object} options The options passed to the new plupload instance. * @param {object} options.container The id of uploader container. * @param {object} options.browser The id of button to trigger the file select. * @param {object} options.dropzone The id of file drop target. * @param {object} options.plupload An object of parameters to pass to the plupload instance. * @param {object} options.params An object of parameters to pass to $_POST when uploading the file. * Extends this.plupload.multipart_params under the hood. */ Uploader = function( options ) { var self = this, isIE, // Not used, back-compat. elements = { container: 'container', browser: 'browse_button', dropzone: 'drop_element' }, tryAgainCount = {}, tryAgain, key, error, fileUploaded; this.supports = { upload: Uploader.browser.supported }; this.supported = this.supports.upload; if ( ! this.supported ) { return; } // Arguments to send to pluplad.Uploader(). // Use deep extend to ensure that multipart_params and other objects are cloned. this.plupload = $.extend( true, { multipart_params: {} }, Uploader.defaults ); this.container = document.body; // Set default container. /* * Extend the instance with options. * * Use deep extend to allow options.plupload to override individual * default plupload keys. */ $.extend( true, this, options ); // Proxy all methods so this always refers to the current instance. for ( key in this ) { if ( typeof this[ key ] === 'function' ) { this[ key ] = $.proxy( this[ key ], this ); } } // Ensure all elements are jQuery elements and have id attributes, // then set the proper plupload arguments to the ids. for ( key in elements ) { if ( ! this[ key ] ) { continue; } this[ key ] = $( this[ key ] ).first(); if ( ! this[ key ].length ) { delete this[ key ]; continue; } if ( ! this[ key ].prop('id') ) { this[ key ].prop( 'id', '__wp-uploader-id-' + Uploader.uuid++ ); } this.plupload[ elements[ key ] ] = this[ key ].prop('id'); } // If the uploader has neither a browse button nor a dropzone, bail. if ( ! ( this.browser && this.browser.length ) && ! ( this.dropzone && this.dropzone.length ) ) { return; } // Initialize the plupload instance. this.uploader = new plupload.Uploader( this.plupload ); delete this.plupload; // Set default params and remove this.params alias. this.param( this.params || {} ); delete this.params; /** * Attempt to create image sub-sizes when an image was uploaded successfully * but the server responded with HTTP 5xx error. * * @since 5.3.0 * * @param {string} message Error message. * @param {object} data Error data from Plupload. * @param {plupload.File} file File that was uploaded. */ tryAgain = function( message, data, file ) { var times, id; if ( ! data || ! data.responseHeaders ) { error( pluploadL10n.http_error_image, data, file, 'no-retry' ); return; } id = data.responseHeaders.match( /x-wp-upload-attachment-id:\s*(\d+)/i ); if ( id && id[1] ) { id = id[1]; } else { error( pluploadL10n.http_error_image, data, file, 'no-retry' ); return; } times = tryAgainCount[ file.id ]; if ( times && times > 4 ) { /* * The file may have been uploaded and attachment post created, * but post-processing and resizing failed... * Do a cleanup then tell the user to scale down the image and upload it again. */ $.ajax({ type: 'post', url: ajaxurl, dataType: 'json', data: { action: 'media-create-image-subsizes', _wpnonce: _wpPluploadSettings.defaults.multipart_params._wpnonce, attachment_id: id, _wp_upload_failed_cleanup: true, } }); error( message, data, file, 'no-retry' ); return; } if ( ! times ) { tryAgainCount[ file.id ] = 1; } else { tryAgainCount[ file.id ] = ++times; } // Another request to try to create the missing image sub-sizes. $.ajax({ type: 'post', url: ajaxurl, dataType: 'json', data: { action: 'media-create-image-subsizes', _wpnonce: _wpPluploadSettings.defaults.multipart_params._wpnonce, attachment_id: id, } }).done( function( response ) { if ( response.success ) { fileUploaded( self.uploader, file, response ); } else { if ( response.data && response.data.message ) { message = response.data.message; } error( message, data, file, 'no-retry' ); } }).fail( function( jqXHR ) { // If another HTTP 5xx error, try try again... if ( jqXHR.status >= 500 && jqXHR.status < 600 ) { tryAgain( message, data, file ); return; } error( message, data, file, 'no-retry' ); }); } /** * Custom error callback. * * Add a new error to the errors collection, so other modules can track * and display errors. @see wp.Uploader.errors. * * @param {string} message Error message. * @param {object} data Error data from Plupload. * @param {plupload.File} file File that was uploaded. * @param {string} retry Whether to try again to create image sub-sizes. Passing 'no-retry' will prevent it. */ error = function( message, data, file, retry ) { var isImage = file.type && file.type.indexOf( 'image/' ) === 0, status = data && data.status; // If the file is an image and the error is HTTP 5xx try to create sub-sizes again. if ( retry !== 'no-retry' && isImage && status >= 500 && status < 600 ) { tryAgain( message, data, file ); return; } if ( file.attachment ) { file.attachment.destroy(); } Uploader.errors.unshift({ message: message || pluploadL10n.default_error, data: data, file: file }); self.error( message, data, file ); }; /** * After a file is successfully uploaded, update its model. * * @param {plupload.Uploader} up Uploader instance. * @param {plupload.File} file File that was uploaded. * @param {Object} response Object with response properties. */ fileUploaded = function( up, file, response ) { var complete; // Remove the "uploading" UI elements. _.each( ['file','loaded','size','percent'], function( key ) { file.attachment.unset( key ); } ); file.attachment.set( _.extend( response.data, { uploading: false } ) ); wp.media.model.Attachment.get( response.data.id, file.attachment ); complete = Uploader.queue.all( function( attachment ) { return ! attachment.get( 'uploading' ); }); if ( complete ) { Uploader.queue.reset(); } self.success( file.attachment ); } /** * After the Uploader has been initialized, initialize some behaviors for the dropzone. * * @param {plupload.Uploader} uploader Uploader instance. */ this.uploader.bind( 'init', function( uploader ) { var timer, active, dragdrop, dropzone = self.dropzone; dragdrop = self.supports.dragdrop = uploader.features.dragdrop && ! Uploader.browser.mobile; // Generate drag/drop helper classes. if ( ! dropzone ) { return; } dropzone.toggleClass( 'supports-drag-drop', !! dragdrop ); if ( ! dragdrop ) { return dropzone.unbind('.wp-uploader'); } // 'dragenter' doesn't fire correctly, simulate it with a limited 'dragover'. dropzone.on( 'dragover.wp-uploader', function() { if ( timer ) { clearTimeout( timer ); } if ( active ) { return; } dropzone.trigger('dropzone:enter').addClass('drag-over'); active = true; }); dropzone.on('dragleave.wp-uploader, drop.wp-uploader', function() { /* * Using an instant timer prevents the drag-over class * from being quickly removed and re-added when elements * inside the dropzone are repositioned. * * @see https://core.trac.wordpress.org/ticket/21705 */ timer = setTimeout( function() { active = false; dropzone.trigger('dropzone:leave').removeClass('drag-over'); }, 0 ); }); self.ready = true; $(self).trigger( 'uploader:ready' ); }); this.uploader.bind( 'postinit', function( up ) { up.refresh(); self.init(); }); this.uploader.init(); if ( this.browser ) { this.browser.on( 'mouseenter', this.refresh ); } else { this.uploader.disableBrowse( true ); } $( self ).on( 'uploader:ready', function() { $( '.moxie-shim-html5 input[type="file"]' ) .attr( { tabIndex: '-1', 'aria-hidden': 'true' } ); } ); /** * After files were filtered and added to the queue, create a model for each. * * @param {plupload.Uploader} up Uploader instance. * @param {Array} files Array of file objects that were added to queue by the user. */ this.uploader.bind( 'FilesAdded', function( up, files ) { _.each( files, function( file ) { var attributes, image; // Ignore failed uploads. if ( plupload.FAILED === file.status ) { return; } if ( file.type === 'image/heic' && up.settings.heic_upload_error ) { // Show error but do not block uploading. Uploader.errors.unshift({ message: pluploadL10n.unsupported_image, data: {}, file: file }); } else if ( file.type === 'image/webp' && up.settings.webp_upload_error ) { // Disallow uploading of WebP images if the server cannot edit them. error( pluploadL10n.noneditable_image, {}, file, 'no-retry' ); up.removeFile( file ); return; } else if ( file.type === 'image/avif' && up.settings.avif_upload_error ) { // Disallow uploading of AVIF images if the server cannot edit them. error( pluploadL10n.noneditable_image, {}, file, 'no-retry' ); up.removeFile( file ); return; } // Generate attributes for a new `Attachment` model. attributes = _.extend({ file: file, uploading: true, date: new Date(), filename: file.name, menuOrder: 0, uploadedTo: wp.media.model.settings.post.id }, _.pick( file, 'loaded', 'size', 'percent' ) ); // Handle early mime type scanning for images. image = /(?:jpe?g|png|gif)$/i.exec( file.name ); // For images set the model's type and subtype attributes. if ( image ) { attributes.type = 'image'; // `jpeg`, `png` and `gif` are valid subtypes. // `jpg` is not, so map it to `jpeg`. attributes.subtype = ( 'jpg' === image[0] ) ? 'jpeg' : image[0]; } // Create a model for the attachment, and add it to the Upload queue collection // so listeners to the upload queue can track and display upload progress. file.attachment = wp.media.model.Attachment.create( attributes ); Uploader.queue.add( file.attachment ); self.added( file.attachment ); }); up.refresh(); up.start(); }); this.uploader.bind( 'UploadProgress', function( up, file ) { file.attachment.set( _.pick( file, 'loaded', 'percent' ) ); self.progress( file.attachment ); }); /** * After a file is successfully uploaded, update its model. * * @param {plupload.Uploader} up Uploader instance. * @param {plupload.File} file File that was uploaded. * @param {Object} response Object with response properties. * @return {mixed} */ this.uploader.bind( 'FileUploaded', function( up, file, response ) { try { response = JSON.parse( response.response ); } catch ( e ) { return error( pluploadL10n.default_error, e, file ); } if ( ! _.isObject( response ) || _.isUndefined( response.success ) ) { return error( pluploadL10n.default_error, null, file ); } else if ( ! response.success ) { return error( response.data && response.data.message, response.data, file ); } // Success. Update the UI with the new attachment. fileUploaded( up, file, response ); }); /** * When plupload surfaces an error, send it to the error handler. * * @param {plupload.Uploader} up Uploader instance. * @param {Object} pluploadError Contains code, message and sometimes file and other details. */ this.uploader.bind( 'Error', function( up, pluploadError ) { var message = pluploadL10n.default_error, key; // Check for plupload errors. for ( key in Uploader.errorMap ) { if ( pluploadError.code === plupload[ key ] ) { message = Uploader.errorMap[ key ]; if ( typeof message === 'function' ) { message = message( pluploadError.file, pluploadError ); } break; } } error( message, pluploadError, pluploadError.file ); up.refresh(); }); }; // Adds the 'defaults' and 'browser' properties. $.extend( Uploader, _wpPluploadSettings ); Uploader.uuid = 0; // Map Plupload error codes to user friendly error messages. Uploader.errorMap = { 'FAILED': pluploadL10n.upload_failed, 'FILE_EXTENSION_ERROR': pluploadL10n.invalid_filetype, 'IMAGE_FORMAT_ERROR': pluploadL10n.not_an_image, 'IMAGE_MEMORY_ERROR': pluploadL10n.image_memory_exceeded, 'IMAGE_DIMENSIONS_ERROR': pluploadL10n.image_dimensions_exceeded, 'GENERIC_ERROR': pluploadL10n.upload_failed, 'IO_ERROR': pluploadL10n.io_error, 'SECURITY_ERROR': pluploadL10n.security_error, 'FILE_SIZE_ERROR': function( file ) { return pluploadL10n.file_exceeds_size_limit.replace( '%s', file.name ); }, 'HTTP_ERROR': function( file ) { if ( file.type && file.type.indexOf( 'image/' ) === 0 ) { return pluploadL10n.http_error_image; } return pluploadL10n.http_error; }, }; $.extend( Uploader.prototype, /** @lends wp.Uploader.prototype */{ /** * Acts as a shortcut to extending the uploader's multipart_params object. * * param( key ) * Returns the value of the key. * * param( key, value ) * Sets the value of a key. * * param( map ) * Sets values for a map of data. */ param: function( key, value ) { if ( arguments.length === 1 && typeof key === 'string' ) { return this.uploader.settings.multipart_params[ key ]; } if ( arguments.length > 1 ) { this.uploader.settings.multipart_params[ key ] = value; } else { $.extend( this.uploader.settings.multipart_params, key ); } }, /** * Make a few internal event callbacks available on the wp.Uploader object * to change the Uploader internals if absolutely necessary. */ init: function() {}, error: function() {}, success: function() {}, added: function() {}, progress: function() {}, complete: function() {}, refresh: function() { var node, attached, container, id; if ( this.browser ) { node = this.browser[0]; // Check if the browser node is in the DOM. while ( node ) { if ( node === document.body ) { attached = true; break; } node = node.parentNode; } /* * If the browser node is not attached to the DOM, * use a temporary container to house it, as the browser button shims * require the button to exist in the DOM at all times. */ if ( ! attached ) { id = 'wp-uploader-browser-' + this.uploader.id; container = $( '#' + id ); if ( ! container.length ) { container = $('<div class="wp-uploader-browser" />').css({ position: 'fixed', top: '-1000px', left: '-1000px', height: 0, width: 0 }).attr( 'id', 'wp-uploader-browser-' + this.uploader.id ).appendTo('body'); } container.append( this.browser ); } } this.uploader.refresh(); } }); // Create a collection of attachments in the upload queue, // so that other modules can track and display upload progress. Uploader.queue = new wp.media.model.Attachments( [], { query: false }); // Create a collection to collect errors incurred while attempting upload. Uploader.errors = new Backbone.Collection(); exports.Uploader = Uploader; })( wp, jQuery ); plupload/moxie.min.js 0000644 00000252542 15125140777 0010650 0 ustar 00 var MXI_DEBUG=!1;!function(o,x){"use strict";var s={};function n(e,t){for(var i,n=[],r=0;r<e.length;++r){if(!(i=s[e[r]]||function(e){for(var t=o,i=e.split(/[.\/]/),n=0;n<i.length;++n){if(!t[i[n]])return;t=t[i[n]]}return t}(e[r])))throw"module definition dependecy not found: "+e[r];n.push(i)}t.apply(null,n)}function e(e,t,i){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(t===x)throw"invalid module definition, dependencies must be specified";if(i===x)throw"invalid module definition, definition function must be specified";n(t,function(){s[e]=i.apply(null,arguments)})}e("moxie/core/utils/Basic",[],function(){function n(i){return s(arguments,function(e,t){0<t&&s(e,function(e,t){void 0!==e&&(o(i[t])===o(e)&&~r(o(e),["array","object"])?n(i[t],e):i[t]=e)})}),i}function s(e,t){var i,n,r;if(e)if("number"===o(e.length)){for(r=0,i=e.length;r<i;r++)if(!1===t(e[r],r))return}else if("object"===o(e))for(n in e)if(e.hasOwnProperty(n)&&!1===t(e[n],n))return}function r(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var i=0,n=t.length;i<n;i++)if(t[i]===e)return i}return-1}var o=function(e){return void 0===e?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};a=0;var a;return{guid:function(e){for(var t=(new Date).getTime().toString(32),i=0;i<5;i++)t+=Math.floor(65535*Math.random()).toString(32);return(e||"o_")+t+(a++).toString(32)},typeOf:o,extend:n,each:s,isEmptyObj:function(e){if(e&&"object"===o(e))for(var t in e)return!1;return!0},inSeries:function(e,n){var r=e.length;"function"!==o(n)&&(n=function(){}),e&&e.length||n(),function t(i){"function"===o(e[i])&&e[i](function(e){++i<r&&!e?t(i):n(e)})}(0)},inParallel:function(e,i){var n=0,r=e.length,o=new Array(r);s(e,function(e,t){e(function(e){if(e)return i(e);e=[].slice.call(arguments);e.shift(),o[t]=e,++n===r&&(o.unshift(null),i.apply(this,o))})})},inArray:r,arrayDiff:function(e,t){var i,n=[];for(i in"array"!==o(e)&&(e=[e]),"array"!==o(t)&&(t=[t]),e)-1===r(e[i],t)&&n.push(e[i]);return!!n.length&&n},arrayIntersect:function(e,t){var i=[];return s(e,function(e){-1!==r(e,t)&&i.push(e)}),i.length?i:null},toArray:function(e){for(var t=[],i=0;i<e.length;i++)t[i]=e[i];return t},trim:function(e){return e&&(String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""))},sprintf:function(e){var t=[].slice.call(arguments,1);return e.replace(/%[a-z]/g,function(){var e=t.shift();return"undefined"!==o(e)?e:""})},parseSizeStr:function(e){var t,i;return"string"!=typeof e?e:(t={t:1099511627776,g:1073741824,m:1048576,k:1024},i=(e=/^([0-9\.]+)([tmgk]?)$/.exec(e.toLowerCase().replace(/[^0-9\.tmkg]/g,"")))[2],e=+e[1],t.hasOwnProperty(i)&&(e*=t[i]),Math.floor(e))}}}),e("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(n){m="function",h="object",r=function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},o={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[a="name",c="version"],[/\s(opr)\/([\w\.]+)/i],[[a,"Opera"],c],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[a,c],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[a,"IE"],c],[/(edge)\/((\d+)?[\w\.]+)/i],[a,c],[/(yabrowser)\/([\w\.]+)/i],[[a,"Yandex"],c],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],c],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[a,c],[/(dolfin)\/([\w\.]+)/i],[[a,"Dolphin"],c],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[a,"Chrome"],c],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[c,[a,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[c,[a,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[c,[a,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[c,[a,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[c,a],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[a,[c,(i={rgx:function(){for(var e,t,i,n,r,o,s,a=0,u=arguments;a<u.length;a+=2){var c=u[a],l=u[a+1];if(void 0===e)for(n in e={},l)typeof(r=l[n])==h?e[r[0]]=d:e[r]=d;for(t=i=0;t<c.length;t++)if(o=c[t].exec(this.getUA())){for(n=0;n<l.length;n++)s=o[++i],typeof(r=l[n])==h&&0<r.length?2==r.length?typeof r[1]==m?e[r[0]]=r[1].call(this,s):e[r[0]]=r[1]:3==r.length?typeof r[1]!=m||r[1].exec&&r[1].test?e[r[0]]=s?s.replace(r[1],r[2]):d:e[r[0]]=s?r[1].call(this,s,r[2]):d:4==r.length&&(e[r[0]]=s?r[3].call(this,s.replace(r[1],r[2])):d):e[r]=s||d;break}if(o)break}return e},str:function(e,t){for(var i in t)if(typeof t[i]==h&&0<t[i].length){for(var n=0;n<t[i].length;n++)if(r(t[i][n],e))return"?"===i?d:i}else if(r(t[i],e))return"?"===i?d:i;return e}}).str,(e={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}}).browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[a,c],[/(navigator|netscape)\/([\w\.-]+)/i],[[a,"Netscape"],c],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[a,c]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[c,[a,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,c],[/rv\:([\w\.]+).*(gecko)/i],[c,a]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[a,c],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[c,i.str,e.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[c,i.str,e.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],c],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[a,c],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],c],[/\((series40);/i],[a],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],c],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,c],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],c],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],c],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,c],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[a,"iOS"],[c,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[a,"Mac OS"],[c,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[a,c]]};var d,m,h,r,i,o,e=function(e){var t=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:"");this.getBrowser=function(){return i.rgx.apply(this,o.browser)},this.getEngine=function(){return i.rgx.apply(this,o.engine)},this.getOS=function(){return i.rgx.apply(this,o.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return t},this.setUA=function(e){return t=e,this},this.setUA(t)};function t(e){var t=[].slice.call(arguments);return t.shift(),"function"===n.typeOf(u[e])?u[e].apply(this,t):!!u[e]}u={define_property:!1,create_canvas:!(!(a=document.createElement("canvas")).getContext||!a.getContext("2d")),return_response_type:function(e){try{if(-1!==n.inArray(e,["","text","document"]))return!0;if(window.XMLHttpRequest){var t=new XMLHttpRequest;if(t.open("get","/"),"responseType"in t)return t.responseType=e,t.responseType===e}}catch(e){}return!1},use_data_uri:((s=new Image).onload=function(){u.use_data_uri=1===s.width&&1===s.height},setTimeout(function(){s.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1),use_data_uri_over32kb:function(){return u.use_data_uri&&("IE"!==l.browser||9<=l.version)},use_data_uri_of:function(e){return u.use_data_uri&&e<33e3||u.use_data_uri_over32kb()},use_fileinput:function(){var e;return!navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/)&&((e=document.createElement("input")).setAttribute("type","file"),!e.disabled)}};var s,a,u,c=(new e).getResult(),l={can:t,uaParser:e,browser:c.browser.name,version:c.browser.version,os:c.os.name,osVersion:c.os.version,verComp:function(e,t,i){function n(e){return(e=(e=(""+e).replace(/[_\-+]/g,".")).replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,".")).length?e.split("."):[-8]}function r(e){return e?isNaN(e)?u[e]||-7:parseInt(e,10):0}var o,s=0,a=0,u={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1};for(e=n(e),t=n(t),o=Math.max(e.length,t.length),s=0;s<o;s++)if(e[s]!=t[s]){if(e[s]=r(e[s]),t[s]=r(t[s]),e[s]<t[s]){a=-1;break}if(e[s]>t[s]){a=1;break}}if(!i)return a;switch(i){case">":case"gt":return 0<a;case">=":case"ge":return 0<=a;case"<=":case"le":return a<=0;case"==":case"=":case"eq":return 0===a;case"<>":case"!=":case"ne":return 0!==a;case"":case"<":case"lt":return a<0;default:return null}},global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return l.OS=l.os,MXI_DEBUG&&(l.debug={runtime:!0,events:!1},l.log=function(){var e,t,i=arguments[0];"string"===n.typeOf(i)&&(i=n.sprintf.apply(this,arguments)),window&&window.console&&window.console.log?window.console.log(i):document&&((e=document.getElementById("moxie-console"))||((e=document.createElement("pre")).id="moxie-console",document.body.appendChild(e)),-1!==n.inArray(n.typeOf(i),["object","array"])?(t=i,e.appendChild(document.createTextNode(t+"\n"))):e.appendChild(document.createTextNode(i+"\n")))}),l}),e("moxie/core/I18n",["moxie/core/utils/Basic"],function(i){var t={};return{addI18n:function(e){return i.extend(t,e)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(e){var t=[].slice.call(arguments,1);return e.replace(/%[a-z]/g,function(){var e=t.shift();return"undefined"!==i.typeOf(e)?e:""})}}}),e("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(a,n){var e={mimes:{},extensions:{},addMimeType:function(e){for(var t,i,n=e.split(/,/),r=0;r<n.length;r+=2){for(i=n[r+1].split(/ /),t=0;t<i.length;t++)this.mimes[i[t]]=n[r];this.extensions[n[r]]=i}},extList2mimes:function(e,t){for(var i,n,r,o=[],s=0;s<e.length;s++)for(i=e[s].extensions.split(/\s*,\s*/),n=0;n<i.length;n++){if("*"===i[n])return[];if((r=this.mimes[i[n]])&&-1===a.inArray(r,o)&&o.push(r),t&&/^\w+$/.test(i[n]))o.push("."+i[n]);else if(!r)return[]}return o},mimes2exts:function(e){var n=this,r=[];return a.each(e,function(e){if("*"===e)return!(r=[]);var i=e.match(/^(\w+)\/(\*|\w+)$/);i&&("*"===i[2]?a.each(n.extensions,function(e,t){new RegExp("^"+i[1]+"/").test(t)&&[].push.apply(r,n.extensions[t])}):n.extensions[e]&&[].push.apply(r,n.extensions[e]))}),r},mimes2extList:function(e){var t=[],i=[];return"string"===a.typeOf(e)&&(e=a.trim(e).split(/\s*,\s*/)),i=this.mimes2exts(e),t.push({title:n.translate("Files"),extensions:i.length?i.join(","):"*"}),t.mimes=e,t},getFileExtension:function(e){e=e&&e.match(/\.([^.]+)$/);return e?e[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return e.addMimeType("application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe"),e}),e("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(c){function i(e,t){return!!e.className&&new RegExp("(^|\\s+)"+t+"(\\s+|$)").test(e.className)}return{get:function(e){return"string"!=typeof e?e:document.getElementById(e)},hasClass:i,addClass:function(e,t){i(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},removeClass:function(e,t){e.className&&(t=new RegExp("(^|\\s+)"+t+"(\\s+|$)"),e.className=e.className.replace(t,function(e,t,i){return" "===t&&" "===i?" ":""}))},getStyle:function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},getPos:function(e,t){var i,n,r,o=0,s=0,a=document;function u(e){var t,i=0,n=0;return e&&(e=e.getBoundingClientRect(),t="CSS1Compat"===a.compatMode?a.documentElement:a.body,i=e.left+t.scrollLeft,n=e.top+t.scrollTop),{x:i,y:n}}if(t=t||a.body,e&&e.getBoundingClientRect&&"IE"===c.browser&&(!a.documentMode||a.documentMode<8))return n=u(e),r=u(t),{x:n.x-r.x,y:n.y-r.y};for(i=e;i&&i!=t&&i.nodeType;)o+=i.offsetLeft||0,s+=i.offsetTop||0,i=i.offsetParent;for(i=e.parentNode;i&&i!=t&&i.nodeType;)o-=i.scrollLeft||0,s-=i.scrollTop||0,i=i.parentNode;return{x:o,y:s}},getSize:function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}}}}),e("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(e){function t(e,t){for(var i in e)if(e[i]===t)return i;return null}return{RuntimeError:(a={NOT_INIT_ERR:1,NOT_SUPPORTED_ERR:9,JS_ERR:4},e.extend(d,a),d.prototype=Error.prototype,d),OperationNotAllowedException:(e.extend(l,{NOT_ALLOWED_ERR:1}),l.prototype=Error.prototype,l),ImageError:(s={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3},e.extend(c,s),c.prototype=Error.prototype,c),FileException:(o={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8},e.extend(u,o),u.prototype=Error.prototype,u),DOMException:(r={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},e.extend(n,r),n.prototype=Error.prototype,n),EventException:(e.extend(i,{UNSPECIFIED_EVENT_TYPE_ERR:0}),i.prototype=Error.prototype,i)};function i(e){this.code=e,this.name="EventException"}function n(e){this.code=e,this.name=t(r,e),this.message=this.name+": DOMException "+this.code}var r,o,s,a;function u(e){this.code=e,this.name=t(o,e),this.message=this.name+": FileException "+this.code}function c(e){this.code=e,this.name=t(s,e),this.message=this.name+": ImageError "+this.code}function l(e){this.code=e,this.name="OperationNotAllowedException"}function d(e){this.code=e,this.name=t(a,e),this.message=this.name+": RuntimeError "+this.code}}),e("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(c,l,d){function e(){var u={};d.extend(this,{uid:null,init:function(){this.uid||(this.uid=d.guid("uid_"))},addEventListener:function(e,t,i,n){var r,o=this;this.hasOwnProperty("uid")||(this.uid=d.guid("uid_")),e=d.trim(e),/\s/.test(e)?d.each(e.split(/\s+/),function(e){o.addEventListener(e,t,i,n)}):(e=e.toLowerCase(),i=parseInt(i,10)||0,(r=u[this.uid]&&u[this.uid][e]||[]).push({fn:t,priority:i,scope:n||this}),u[this.uid]||(u[this.uid]={}),u[this.uid][e]=r)},hasEventListener:function(e){e=e?u[this.uid]&&u[this.uid][e]:u[this.uid];return e||!1},removeEventListener:function(e,t){e=e.toLowerCase();var i,n=u[this.uid]&&u[this.uid][e];if(n){if(t){for(i=n.length-1;0<=i;i--)if(n[i].fn===t){n.splice(i,1);break}}else n=[];n.length||(delete u[this.uid][e],d.isEmptyObj(u[this.uid])&&delete u[this.uid])}},removeAllEventListeners:function(){u[this.uid]&&delete u[this.uid]},dispatchEvent:function(e){var t,i,n,r,o,s={},a=!0;if("string"!==d.typeOf(e)){if(r=e,"string"!==d.typeOf(r.type))throw new l.EventException(l.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=r.type,void 0!==r.total&&void 0!==r.loaded&&(s.total=r.total,s.loaded=r.loaded),s.async=r.async||!1}return-1!==e.indexOf("::")?(r=e.split("::"),t=r[0],e=r[1]):t=this.uid,e=e.toLowerCase(),(i=u[t]&&u[t][e])&&(i.sort(function(e,t){return t.priority-e.priority}),(n=[].slice.call(arguments)).shift(),s.type=e,n.unshift(s),MXI_DEBUG&&c.debug.events&&c.log("Event '%s' fired on %u",s.type,t),o=[],d.each(i,function(t){n[0].target=t.scope,o.push(s.async?function(e){setTimeout(function(){e(!1===t.fn.apply(t.scope,n))},1)}:function(e){e(!1===t.fn.apply(t.scope,n))})}),o.length)&&d.inSeries(o,function(e){a=!e}),a},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){e="on"+e.type.toLowerCase();"function"===d.typeOf(this[e])&&this[e].apply(this,arguments)}),d.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===d.typeOf(t[e])&&(t[e]=null)})}})}return e.instance=new e,e}),e("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(c,l,d,i){var n={},m={};function h(e,t,r,i,n){var o,s,a=this,u=l.guid(t+"_"),n=n||"browser";e=e||{},m[u]=this,r=l.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},r),e.preferred_caps&&(n=h.getMode(i,e.preferred_caps,n)),MXI_DEBUG&&c.debug.runtime&&c.log("\tdefault mode: %s",n),s={},o={exec:function(e,t,i,n){if(o[t]&&(s[e]||(s[e]={context:this,instance:new o[t]}),s[e].instance[i]))return s[e].instance[i].apply(this,n)},removeInstance:function(e){delete s[e]},removeAllInstances:function(){var i=this;l.each(s,function(e,t){"function"===l.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeInstance(t)})}},l.extend(this,{initialized:!1,uid:u,type:t,mode:h.getMode(i,e.required_caps,n),shimid:u+"_container",clients:0,options:e,can:function(e,t){var i,n=arguments[2]||r;if("string"===l.typeOf(e)&&"undefined"===l.typeOf(t)&&(e=h.parseCaps(e)),"object"!==l.typeOf(e))return"function"===l.typeOf(n[e])?n[e].call(this,t):t===n[e];for(i in e)if(!this.can(i,e[i],n))return!1;return!0},getShimContainer:function(){var e,t=d.get(this.shimid);return t||(e=this.options.container?d.get(this.options.container):document.body,(t=document.createElement("div")).id=this.shimid,t.className="moxie-shim moxie-shim-"+this.type,l.extend(t.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(t),e=null),t},getShim:function(){return o},shimExec:function(e,t){var i=[].slice.call(arguments,2);return a.getShim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return a[e]&&a[e][t]?a[e][t].apply(this,i):a.shimExec.apply(this,arguments)},destroy:function(){var e;a&&((e=d.get(this.shimid))&&e.parentNode.removeChild(e),o&&o.removeAllInstances(),this.unbindAll(),delete m[this.uid],this.uid=null,a=o=null)}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}return h.order="html5,html4",h.getRuntime=function(e){return m[e]||!1},h.addConstructor=function(e,t){t.prototype=i.instance,n[e]=t},h.getConstructor=function(e){return n[e]||null},h.getInfo=function(e){var t=h.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},h.parseCaps=function(e){var t={};return"string"!==l.typeOf(e)?e||{}:(l.each(e.split(","),function(e){t[e]=!0}),t)},h.can=function(e,t){var e=h.getConstructor(e);return!!e&&(t=(e=new e({required_caps:t})).mode,e.destroy(),!!t)},h.thatCan=function(e,t){var i,n=(t||h.order).split(/\s*,\s*/);for(i in n)if(h.can(n[i],e))return n[i];return null},h.getMode=function(n,e,t){var r=null;if("undefined"===l.typeOf(t)&&(t="browser"),e&&!l.isEmptyObj(n)){if(l.each(e,function(e,t){if(n.hasOwnProperty(t)){var i=n[t](e);if("string"==typeof i&&(i=[i]),r){if(!(r=l.arrayIntersect(r,i)))return MXI_DEBUG&&c.debug.runtime&&c.log("\t\t%c: %v (conflicting mode requested: %s)",t,e,i),r=!1}else r=i}MXI_DEBUG&&c.debug.runtime&&c.log("\t\t%c: %v (compatible modes: %s)",t,e,r)}),r)return-1!==l.inArray(t,r)?t:r[0];if(!1===r)return!1}return t},h.capTrue=function(){return!0},h.capFalse=function(){return!1},h.capTest=function(e){return function(){return!!e}},h}),e("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(a,u,t,c){return function(){var s;t.extend(this,{connectRuntime:function(r){var e,o=this;if("string"===t.typeOf(r)?e=r:"string"===t.typeOf(r.ruid)&&(e=r.ruid),e){if(s=c.getRuntime(e))return s.clients++,s;throw new u.RuntimeError(u.RuntimeError.NOT_INIT_ERR)}!function e(t){var i,n;t.length?(i=t.shift().toLowerCase(),(n=c.getConstructor(i))?(MXI_DEBUG&&a.debug.runtime&&(a.log("Trying runtime: %s",i),a.log(r)),(s=new n(r)).bind("Init",function(){s.initialized=!0,MXI_DEBUG&&a.debug.runtime&&a.log("Runtime '%s' initialized",s.type),setTimeout(function(){s.clients++,o.trigger("RuntimeInit",s)},1)}),s.bind("Error",function(){MXI_DEBUG&&a.debug.runtime&&a.log("Runtime '%s' failed to initialize",s.type),s.destroy(),e(t)}),MXI_DEBUG&&a.debug.runtime&&a.log("\tselected mode: %s",s.mode),s.mode?s.init():s.trigger("Error")):e(t)):(o.trigger("RuntimeError",new u.RuntimeError(u.RuntimeError.NOT_INIT_ERR)),s=null)}((r.runtime_order||c.order).split(/\s*,\s*/))},disconnectRuntime:function(){s&&--s.clients<=0&&s.destroy(),s=null},getRuntime:function(){return s&&s.uid?s:s=null},exec:function(){return s?s.exec.apply(this,arguments):null}})}}),e("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(o,i,n,s,a,e,u,c,l){var d=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];function t(r){MXI_DEBUG&&i.log("Instantiating FileInput...");var e,t=this;if(-1!==o.inArray(o.typeOf(r),["string","node"])&&(r={browse_button:r}),!(e=s.get(r.browse_button)))throw new a.DOMException(a.DOMException.NOT_FOUND_ERR);e={accept:[{title:u.translate("All Files"),extensions:"*"}],name:"file",multiple:!1,required_caps:!1,container:e.parentNode||document.body},"string"==typeof(r=o.extend({},e,r)).required_caps&&(r.required_caps=c.parseCaps(r.required_caps)),"string"==typeof r.accept&&(r.accept=n.mimes2extList(r.accept)),e=(e=s.get(r.container))||document.body,"static"===s.getStyle(e,"position")&&(e.style.position="relative"),e=null,l.call(t),o.extend(t,{uid:o.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){t.bind("RuntimeInit",function(e,n){t.ruid=n.uid,t.shimid=n.shimid,t.bind("Ready",function(){t.trigger("Refresh")},999),t.bind("Refresh",function(){var e,t=s.get(r.browse_button),i=s.get(n.shimid);t&&(e=s.getPos(t,s.get(r.container)),t=s.getSize(t),i)&&o.extend(i.style,{top:e.y+"px",left:e.x+"px",width:t.w+"px",height:t.h+"px"})}),n.exec.call(t,"FileInput","init",r)}),t.connectRuntime(o.extend({},r,{required_caps:{select_file:!0}}))},disable:function(e){var t=this.getRuntime();t&&t.exec.call(this,"FileInput","disable","undefined"===o.typeOf(e)||e)},refresh:function(){t.trigger("Refresh")},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===o.typeOf(this.files)&&o.each(this.files,function(e){e.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(d)}return t.prototype=e.instance,t}),e("moxie/core/utils/Encode",[],function(){function d(e){return unescape(encodeURIComponent(e))}function m(e){return decodeURIComponent(escape(e))}return{utf8_encode:d,utf8_decode:m,atob:function(e,t){if("function"==typeof window.atob)return t?m(window.atob(e)):window.atob(e);var i,n,r,o,s,a,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=0,l=0,d=[];if(!e)return e;for(e+="";i=(s=u.indexOf(e.charAt(c++))<<18|u.indexOf(e.charAt(c++))<<12|(r=u.indexOf(e.charAt(c++)))<<6|(o=u.indexOf(e.charAt(c++))))>>16&255,n=s>>8&255,s=255&s,d[l++]=64==r?String.fromCharCode(i):64==o?String.fromCharCode(i,n):String.fromCharCode(i,n,s),c<e.length;);return a=d.join(""),t?m(a):a},btoa:function(e,t){if(t&&(e=d(e)),"function"==typeof window.btoa)return window.btoa(e);var i,n,r,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,u=0,t="",c=[];if(!e)return e;for(;i=(o=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>12&63,n=o>>6&63,r=63&o,c[u++]=s.charAt(o>>18&63)+s.charAt(i)+s.charAt(n)+s.charAt(r),a<e.length;);var t=c.join(""),l=e.length%3;return(l?t.slice(0,l-3):t)+"===".slice(l||3)}}}),e("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(o,i,n){var s={};return function r(e,t){n.call(this),e&&this.connectRuntime(e),t?"string"===o.typeOf(t)&&(t={data:t}):t={},o.extend(this,{uid:t.uid||o.guid("uid_"),ruid:e,size:t.size||0,type:t.type||"",slice:function(e,t,i){return this.isDetached()?function(e,t,i){var n=s[this.uid];return"string"===o.typeOf(n)&&n.length?((i=new r(null,{type:i,size:t-e})).detach(n.substr(e,i.size)),i):null}.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,i)},getSource:function(){return s[this.uid]||null},detach:function(e){var t;this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),"data:"==(e=e||"").substr(0,5)&&(t=e.indexOf(";base64,"),this.type=e.substring(5,t),e=i.atob(e.substring(t+8))),this.size=e.length,s[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===o.typeOf(s[this.uid])},destroy:function(){this.detach(),delete s[this.uid]}}),t.data?this.detach(t.data):s[this.uid]=t}}),e("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(r,o,s){function e(e,t){var i,n;t=t||{},s.apply(this,arguments),this.type||(this.type=o.getFileMime(t.name)),t.name?n=(n=t.name.replace(/\\/g,"/")).substr(n.lastIndexOf("/")+1):this.type&&(i=this.type.split("/")[0],n=r.guid((""!==i?i:"file")+"_"),o.extensions[this.type])&&(n+="."+o.extensions[this.type][0]),r.extend(this,{name:n||r.guid("file_"),relativePath:"",lastModifiedDate:t.lastModifiedDate||(new Date).toLocaleString()})}return e.prototype=s.prototype,e}),e("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(t,r,e,o,s,i,a,n,u){var c=["ready","dragenter","dragleave","drop","error"];function l(i){MXI_DEBUG&&s.log("Instantiating FileDrop...");var e,n=this;"string"==typeof i&&(i={drop_zone:i}),e={accept:[{title:t.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},(i="object"==typeof i?o.extend({},e,i):e).container=r.get(i.drop_zone)||document.body,"static"===r.getStyle(i.container,"position")&&(i.container.style.position="relative"),"string"==typeof i.accept&&(i.accept=u.mimes2extList(i.accept)),a.call(n),o.extend(n,{uid:o.guid("uid_"),ruid:null,files:null,init:function(){n.bind("RuntimeInit",function(e,t){n.ruid=t.uid,t.exec.call(n,"FileDrop","init",i),n.dispatchEvent("ready")}),n.connectRuntime(i)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(c)}return l.prototype=n.instance,l}),e("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/runtime/RuntimeClient"],function(e,n,r,t,o,i){var s=["loadstart","progress","load","abort","error","loadend"];function a(){function t(e,t){if(this.trigger("loadstart"),this.readyState===a.LOADING)this.trigger("error",new r.DOMException(r.DOMException.INVALID_STATE_ERR)),this.trigger("loadend");else if(t instanceof o)if(this.result=null,this.readyState=a.LOADING,t.isDetached()){var i=t.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=i;break;case"readAsDataURL":this.result="data:"+t.type+";base64,"+n.btoa(i)}this.readyState=a.DONE,this.trigger("load"),this.trigger("loadend")}else this.connectRuntime(t.ruid),this.exec("FileReader","read",e,t);else this.trigger("error",new r.DOMException(r.DOMException.NOT_FOUND_ERR)),this.trigger("loadend")}i.call(this),e.extend(this,{uid:e.guid("uid_"),readyState:a.EMPTY,result:null,error:null,readAsBinaryString:function(e){t.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){t.call(this,"readAsDataURL",e)},readAsText:function(e){t.call(this,"readAsText",e)},abort:function(){this.result=null,-1===e.inArray(this.readyState,[a.EMPTY,a.DONE])&&(this.readyState===a.LOADING&&(this.readyState=a.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(s),this.bind("Error",function(e,t){this.readyState=a.DONE,this.error=t},999),this.bind("Load",function(e){this.readyState=a.DONE},999)}return a.EMPTY=0,a.LOADING=1,a.DONE=2,a.prototype=t.instance,a}),e("moxie/core/utils/Url",[],function(){function s(e,t){for(var i=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],n=i.length,r={},o=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/.exec(e||"");n--;)o[n]&&(r[i[n]]=o[n]);return r.scheme||(t&&"string"!=typeof t||(t=s(t||document.location.href)),r.scheme=t.scheme,r.host=t.host,r.port=t.port,e="",/^[^\/]/.test(r.path)&&(e=t.path,e=/\/[^\/]*\.[^\/]*$/.test(e)?e.replace(/\/[^\/]+$/,"/"):e.replace(/\/?$/,"/")),r.path=e+(r.path||"")),r.port||(r.port={http:80,https:443}[r.scheme]||80),r.port=parseInt(r.port,10),r.path||(r.path="/"),delete r.source,r}return{parseUrl:s,resolveUrl:function(e){e="object"==typeof e?e:s(e);return e.scheme+"://"+e.host+(e.port!=={http:80,https:443}[e.scheme]?":"+e.port:"")+e.path+(e.query||"")},hasSameOrigin:function(e){function t(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof e&&(e=s(e)),t(s())===t(e)}}}),e("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i){function n(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return n.prototype=i.instance,n}),e("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(e,i,a){return function(){function t(e,t){var i;if(!t.isDetached())return i=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t),this.disconnectRuntime(),i;var n=t.getSource();switch(e){case"readAsBinaryString":return n;case"readAsDataURL":return"data:"+t.type+";base64,"+a.btoa(n);case"readAsText":for(var r="",o=0,s=n.length;o<s;o++)r+=String.fromCharCode(n[o]);return r}}i.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return t.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return t.call(this,"readAsDataURL",e)},readAsText:function(e){return t.call(this,"readAsText",e)}})}}),e("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(e,s,a){return function(){var r,o=[];s.extend(this,{append:function(i,e){var n=this,t=s.typeOf(e);e instanceof a?r={name:i,value:e}:"array"===t?(i+="[]",s.each(e,function(e){n.append(i,e)})):"object"===t?s.each(e,function(e,t){n.append(i+"["+t+"]",e)}):"null"===t||"undefined"===t||"number"===t&&isNaN(e)?n.append(i,"false"):o.push({name:i,value:e.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return r&&r.value||null},getBlobName:function(){return r&&r.name||null},each:function(t){s.each(o,function(e){t(e.value,e.name)}),r&&t(r.value,r.name)},destroy:function(){r=null,o=[]}})}}),e("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(_,b,e,A,I,T,S,r,t,O,D,N){var C={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};function M(){this.uid=_.guid("uid_")}M.prototype=e.instance;var L=["loadstart","progress","abort","error","load","timeout","loadend"];function F(){var o,s,a,u,c,t,i=this,n={timeout:0,readyState:F.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},l=!0,d={},m=null,h=null,f=!1,p=!1,g=!1,x=!1,E=!1,y=!1,w={},v="";function R(e,t){if(n.hasOwnProperty(e))return 1===arguments.length?(D.can("define_property")?n:i)[e]:void(D.can("define_property")?n[e]=t:i[e]=t)}_.extend(this,n,{uid:_.guid("uid_"),upload:new M,open:function(e,t,i,n,r){if(!e||!t)throw new b.DOMException(b.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(e)||A.utf8_encode(e)!==e)throw new b.DOMException(b.DOMException.SYNTAX_ERR);if(~_.inArray(e.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(s=e.toUpperCase()),~_.inArray(s,["CONNECT","TRACE","TRACK"]))throw new b.DOMException(b.DOMException.SECURITY_ERR);if(t=A.utf8_encode(t),e=I.parseUrl(t),y=I.hasSameOrigin(e),o=I.resolveUrl(t),(n||r)&&!y)throw new b.DOMException(b.DOMException.INVALID_ACCESS_ERR);if(a=n||e.user,u=r||e.pass,!1===(l=i||!0)&&(R("timeout")||R("withCredentials")||""!==R("responseType")))throw new b.DOMException(b.DOMException.INVALID_ACCESS_ERR);f=!l,p=!1,d={},function(){R("responseText",""),R("responseXML",null),R("response",null),R("status",0),R("statusText",""),0}.call(this),R("readyState",F.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(e,t){if(R("readyState")!==F.OPENED||p)throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(e)||A.utf8_encode(e)!==e)throw new b.DOMException(b.DOMException.SYNTAX_ERR);return e=_.trim(e).toLowerCase(),!~_.inArray(e,["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"])&&!/^(proxy\-|sec\-)/.test(e)&&(d[e]?d[e]+=", "+t:d[e]=t,!0)},getAllResponseHeaders:function(){return v||""},getResponseHeader:function(e){return e=e.toLowerCase(),!E&&!~_.inArray(e,["set-cookie","set-cookie2"])&&v&&""!==v&&(t||(t={},_.each(v.split(/\r\n/),function(e){e=e.split(/:\s+/);2===e.length&&(e[0]=_.trim(e[0]),t[e[0].toLowerCase()]={header:e[0],value:_.trim(e[1])})})),t.hasOwnProperty(e))?t[e].header+": "+t[e].value:null},overrideMimeType:function(e){var t,i;if(~_.inArray(R("readyState"),[F.LOADING,F.DONE]))throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);if(e=_.trim(e.toLowerCase()),/;/.test(e)&&(t=e.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(e=t[1],t[2])&&(i=t[2]),!N.mimes[e])throw new b.DOMException(b.DOMException.SYNTAX_ERR);0},send:function(e,t){if(w="string"===_.typeOf(t)?{ruid:t}:t||{},this.readyState!==F.OPENED||p)throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);e instanceof r?(w.ruid=e.ruid,h=e.type||"application/octet-stream"):e instanceof O?e.hasBlob()&&(t=e.getBlob(),w.ruid=t.ruid,h=t.type||"application/octet-stream"):"string"==typeof e&&(m="UTF-8",h="text/plain;charset=UTF-8",e=A.utf8_encode(e)),this.withCredentials||(this.withCredentials=w.required_caps&&w.required_caps.send_browser_cookies&&!y),g=!f&&this.upload.hasEventListener(),E=!1,x=!e,f||(p=!0),function(e){var i=this;function n(){c&&(c.destroy(),c=null),i.dispatchEvent("loadend"),i=null}function r(t){c.bind("LoadStart",function(e){R("readyState",F.LOADING),i.dispatchEvent("readystatechange"),i.dispatchEvent(e),g&&i.upload.dispatchEvent(e)}),c.bind("Progress",function(e){R("readyState")!==F.LOADING&&(R("readyState",F.LOADING),i.dispatchEvent("readystatechange")),i.dispatchEvent(e)}),c.bind("UploadProgress",function(e){g&&i.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),c.bind("Load",function(e){R("readyState",F.DONE),R("status",Number(t.exec.call(c,"XMLHttpRequest","getStatus")||0)),R("statusText",C[R("status")]||""),R("response",t.exec.call(c,"XMLHttpRequest","getResponse",R("responseType"))),~_.inArray(R("responseType"),["text",""])?R("responseText",R("response")):"document"===R("responseType")&&R("responseXML",R("response")),v=t.exec.call(c,"XMLHttpRequest","getAllResponseHeaders"),i.dispatchEvent("readystatechange"),0<R("status")?(g&&i.upload.dispatchEvent(e),i.dispatchEvent(e)):(E=!0,i.dispatchEvent("error")),n()}),c.bind("Abort",function(e){i.dispatchEvent(e),n()}),c.bind("Error",function(e){E=!0,R("readyState",F.DONE),i.dispatchEvent("readystatechange"),x=!0,i.dispatchEvent(e),n()}),t.exec.call(c,"XMLHttpRequest","send",{url:o,method:s,async:l,user:a,password:u,headers:d,mimeType:h,encoding:m,responseType:i.responseType,withCredentials:i.withCredentials,options:w},e)}(new Date).getTime(),c=new S,"string"==typeof w.required_caps&&(w.required_caps=T.parseCaps(w.required_caps));w.required_caps=_.extend({},w.required_caps,{return_response_type:i.responseType}),e instanceof O&&(w.required_caps.send_multipart=!0);_.isEmptyObj(d)||(w.required_caps.send_custom_headers=!0);y||(w.required_caps.do_cors=!0);w.ruid?r(c.connectRuntime(w)):(c.bind("RuntimeInit",function(e,t){r(t)}),c.bind("RuntimeError",function(e,t){i.dispatchEvent("RuntimeError",t)}),c.connectRuntime(w))}.call(this,e)},abort:function(){if(f=!(E=!0),~_.inArray(R("readyState"),[F.UNSENT,F.OPENED,F.DONE]))R("readyState",F.UNSENT);else{if(R("readyState",F.DONE),p=!1,!c)throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);c.getRuntime().exec.call(c,"XMLHttpRequest","abort",x),x=!0}},destroy:function(){c&&("function"===_.typeOf(c.destroy)&&c.destroy(),c=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(L.concat(["readystatechange"])),this.upload.handleEventProps(L)}return F.UNSENT=0,F.OPENED=1,F.HEADERS_RECEIVED=2,F.LOADING=3,F.DONE=4,F.prototype=e.instance,F}),e("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(m,t,e,i){function h(){var o,n,s,a,r,u;function c(){a=r=0,s=this.result=null}function l(e,t){var i=this;n=t,i.bind("TransportingProgress",function(e){(r=e.loaded)<a&&-1===m.inArray(i.state,[h.IDLE,h.DONE])&&d.call(i)},999),i.bind("TransportingComplete",function(){r=a,i.state=h.DONE,s=null,i.result=n.exec.call(i,"Transporter","getAsBlob",e||"")},999),i.state=h.BUSY,i.trigger("TransportingStarted"),d.call(i)}function d(){var e=a-r;e<u&&(u=e),e=t.btoa(s.substr(r,u)),n.exec.call(this,"Transporter","receive",e,a)}e.call(this),m.extend(this,{uid:m.guid("uid_"),state:h.IDLE,result:null,transport:function(e,i,t){var n,r=this;t=m.extend({chunk_size:204798},t),(o=t.chunk_size%3)&&(t.chunk_size+=3-o),u=t.chunk_size,c.call(this),a=(s=e).length,"string"===m.typeOf(t)||t.ruid?l.call(r,i,this.connectRuntime(t)):(n=function(e,t){r.unbind("RuntimeInit",n),l.call(r,i,t)},this.bind("RuntimeInit",n),this.connectRuntime(t))},abort:function(){this.state=h.IDLE,n&&(n.exec.call(this,"Transporter","clear"),this.trigger("TransportingAborted")),c.call(this)},destroy:function(){this.unbindAll(),n=null,this.disconnectRuntime(),c.call(this)}})}return h.IDLE=0,h.BUSY=1,h.DONE=2,h.prototype=i.instance,h}),e("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(a,n,u,e,o,s,t,c,l,i,d,m,h){var f=["progress","load","error","resize","embedded"];function p(){function i(e){var t=a.typeOf(e);try{if(e instanceof p){if(!e.size)throw new u.DOMException(u.DOMException.INVALID_STATE_ERR);!function(e,t){var i=this.connectRuntime(e.ruid);this.ruid=i.uid,i.exec.call(this,"Image","loadFromImage",e,"undefined"===a.typeOf(t)||t)}.apply(this,arguments)}else if(e instanceof d){if(!~a.inArray(e.type,["image/jpeg","image/png"]))throw new u.ImageError(u.ImageError.WRONG_FORMAT);r.apply(this,arguments)}else if(-1!==a.inArray(t,["blob","file"]))i.call(this,new m(null,e),arguments[1]);else if("string"===t)"data:"===e.substr(0,5)?i.call(this,new d(null,{data:e}),arguments[1]):function(e,t){var i,n=this;(i=new o).open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){r.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}.apply(this,arguments);else{if("node"!==t||"img"!==e.nodeName.toLowerCase())throw new u.DOMException(u.DOMException.TYPE_MISMATCH_ERR);i.call(this,e.src,arguments[1])}}catch(e){this.trigger("error",e.code)}}function r(t,e){var i=this;function n(e){i.ruid=e.uid,e.exec.call(i,"Image","loadFromBlob",t)}i.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){n(t)}),e&&"string"==typeof e.required_caps&&(e.required_caps=s.parseCaps(e.required_caps)),this.connectRuntime(a.extend({required_caps:{access_image_binary:!0,resize_image:!0}},e))):n(this.connectRuntime(t.ruid))}t.call(this),a.extend(this,{uid:a.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){i.apply(this,arguments)},downsize:function(e){var t={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,preserveHeaders:!0,resample:!1};e="object"==typeof e?a.extend(t,e):a.extend(t,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]});try{if(!this.size)throw new u.DOMException(u.DOMException.INVALID_STATE_ERR);if(this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT)throw new u.ImageError(u.ImageError.MAX_RESOLUTION_ERR);this.exec("Image","downsize",e.width,e.height,e.crop,e.preserveHeaders)}catch(e){this.trigger("error",e.code)}},crop:function(e,t,i){this.downsize(e,t,!0,i)},getAsCanvas:function(){if(l.can("create_canvas"))return this.connectRuntime(this.ruid).exec.call(this,"Image","getAsCanvas");throw new u.RuntimeError(u.RuntimeError.NOT_SUPPORTED_ERR)},getAsBlob:function(e,t){if(this.size)return this.exec("Image","getAsBlob",e||"image/jpeg",t||90);throw new u.DOMException(u.DOMException.INVALID_STATE_ERR)},getAsDataURL:function(e,t){if(this.size)return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90);throw new u.DOMException(u.DOMException.INVALID_STATE_ERR)},getAsBinaryString:function(e,t){e=this.getAsDataURL(e,t);return h.atob(e.substring(e.indexOf("base64,")+7))},embed:function(r,e){var o,s=this;e=a.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90},e||{});try{if(!(r=n.get(r)))throw new u.DOMException(u.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new u.DOMException(u.DOMException.INVALID_STATE_ERR);this.width>p.MAX_RESIZE_WIDTH||this.height;var t=new p;return t.bind("Resize",function(){!function(e,t){var i=this;if(l.can("create_canvas")){var n=i.getAsCanvas();if(n)return r.appendChild(n),i.destroy(),void s.trigger("embedded")}if(!(n=i.getAsDataURL(e,t)))throw new u.ImageError(u.ImageError.WRONG_FORMAT);l.can("use_data_uri_of",n.length)?(r.innerHTML='<img src="'+n+'" width="'+i.width+'" height="'+i.height+'" />',i.destroy(),s.trigger("embedded")):((t=new c).bind("TransportingComplete",function(){o=s.connectRuntime(this.result.ruid),s.bind("Embedded",function(){a.extend(o.getShimContainer().style,{top:"0px",left:"0px",width:i.width+"px",height:i.height+"px"}),o=null},999),o.exec.call(s,"ImageView","display",this.result.uid,width,height),i.destroy()}),t.transport(h.atob(n.substring(n.indexOf("base64,")+7)),e,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:r}))}.call(this,e.type,e.quality)}),t.bind("Load",function(){t.downsize(e)}),this.meta.thumb&&this.meta.thumb.width>=e.width&&this.meta.thumb.height>=e.height?t.load(this.meta.thumb.data):t.clone(this,!1),t}catch(e){this.trigger("error",e.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}}),this.handleEventProps(f),this.bind("Load Resize",function(){!function(e){e=e||this.exec("Image","getInfo");this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name)}.call(this)},999)}return p.MAX_RESIZE_WIDTH=8192,p.MAX_RESIZE_HEIGHT=8192,p.prototype=i.instance,p}),e("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(s,e,a,u){var c={};return a.addConstructor("html5",function(e){var t,i=this,n=a.capTest,r=a.capTrue,o=s.extend({access_binary:n(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return i.can("access_binary")&&!!c.Image},display_media:n(u.can("create_canvas")||u.can("use_data_uri_over32kb")),do_cors:n(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:n(("draggable"in(o=document.createElement("div"))||"ondragstart"in o&&"ondrop"in o)&&("IE"!==u.browser||u.verComp(u.version,9,">"))),filter_by_extension:n("Chrome"===u.browser&&u.verComp(u.version,28,">=")||"IE"===u.browser&&u.verComp(u.version,10,">=")||"Safari"===u.browser&&u.verComp(u.version,7,">=")),return_response_headers:r,return_response_type:function(e){return!("json"!==e||!window.JSON)||u.can("return_response_type",e)},return_status_code:r,report_upload_progress:n(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return i.can("access_binary")&&u.can("create_canvas")},select_file:function(){return u.can("use_fileinput")&&window.File},select_folder:function(){return i.can("select_file")&&"Chrome"===u.browser&&u.verComp(u.version,21,">=")},select_multiple:function(){return i.can("select_file")&&!("Safari"===u.browser&&"Windows"===u.os)&&!("iOS"===u.os&&u.verComp(u.osVersion,"7.0.0",">")&&u.verComp(u.osVersion,"8.0.0","<"))},send_binary_string:n(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:n(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||i.can("send_binary_string")},slice_blob:n(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return i.can("slice_blob")&&i.can("send_multipart")},summon_file_dialog:function(){return i.can("select_file")&&("Firefox"===u.browser&&u.verComp(u.version,4,">=")||"Opera"===u.browser&&u.verComp(u.version,12,">=")||"IE"===u.browser&&u.verComp(u.version,10,">=")||!!~s.inArray(u.browser,["Chrome","Safari"]))},upload_filesize:r},arguments[2]);a.call(this,e,arguments[1]||"html5",o),s.extend(this,{init:function(){this.trigger("Init")},destroy:(t=this.destroy,function(){t.call(i),t=i=null})}),s.extend(this.getShim(),c)}),c}),e("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(o){var s={},a="moxie_"+o.guid();function u(){this.returnValue=!1}function c(){this.cancelBubble=!0}function r(t,e,i){if(e=e.toLowerCase(),t[a]&&s[t[a]]&&s[t[a]][e]){for(var n,r=(n=s[t[a]][e]).length-1;0<=r&&(n[r].orig!==i&&n[r].key!==i||(t.removeEventListener?t.removeEventListener(e,n[r].func,!1):t.detachEvent&&t.detachEvent("on"+e,n[r].func),n[r].orig=null,n[r].func=null,n.splice(r,1),void 0===i));r--);if(n.length||delete s[t[a]][e],o.isEmptyObj(s[t[a]])){delete s[t[a]];try{delete t[a]}catch(e){t[a]=void 0}}}}return{addEvent:function(e,t,i,n){var r;t=t.toLowerCase(),e.addEventListener?e.addEventListener(t,r=i,!1):e.attachEvent&&e.attachEvent("on"+t,r=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=u,e.stopPropagation=c,i(e)}),e[a]||(e[a]=o.guid()),s.hasOwnProperty(e[a])||(s[e[a]]={}),(e=s[e[a]]).hasOwnProperty(t)||(e[t]=[]),e[t].push({func:r,orig:i,key:n})},removeEvent:r,removeAllEvents:function(i,n){i&&i[a]&&o.each(s[i[a]],function(e,t){r(i,t,n)})}}}),e("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,a,u,c,l,d,m){return e.FileInput=function(){var s;u.extend(this,{init:function(e){var t,i,n,r=this,o=r.getRuntime(),e=(s=e).accept.mimes||d.extList2mimes(s.accept,o.can("filter_by_extension"));(t=o.getShimContainer()).innerHTML='<input id="'+o.uid+'" type="file" style="font-size:999px;opacity:0;"'+(s.multiple&&o.can("select_multiple")?"multiple":"")+(s.directory&&o.can("select_folder")?"webkitdirectory directory":"")+(e?' accept="'+e.join(",")+'"':"")+" />",e=c.get(o.uid),u.extend(e.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),i=c.get(s.browse_button),o.can("summon_file_dialog")&&("static"===c.getStyle(i,"position")&&(i.style.position="relative"),n=parseInt(c.getStyle(i,"z-index"),10)||1,i.style.zIndex=n,t.style.zIndex=n-1,l.addEvent(i,"click",function(e){var t=c.get(o.uid);t&&!t.disabled&&t.click(),e.preventDefault()},r.uid)),n=o.can("summon_file_dialog")?i:t,l.addEvent(n,"mouseover",function(){r.trigger("mouseenter")},r.uid),l.addEvent(n,"mouseout",function(){r.trigger("mouseleave")},r.uid),l.addEvent(n,"mousedown",function(){r.trigger("mousedown")},r.uid),l.addEvent(c.get(s.container),"mouseup",function(){r.trigger("mouseup")},r.uid),e.onchange=function e(t){var i;r.files=[],u.each(this.files,function(e){var t="";if(s.directory&&"."==e.name)return!0;e.webkitRelativePath&&(t="/"+e.webkitRelativePath.replace(/^\//,"")),(e=new a(o.uid,e)).relativePath=t,r.files.push(e)}),"IE"!==m.browser&&"IEMobile"!==m.browser?this.value="":(i=this.cloneNode(!0),this.parentNode.replaceChild(i,this),i.onchange=e),r.files.length&&r.trigger("change")},r.trigger({type:"ready",async:!0})},disable:function(e){var t=this.getRuntime();(t=c.get(t.uid))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),e=e.getShimContainer();l.removeAllEvents(e,this.uid),l.removeAllEvents(s&&c.get(s.container),this.uid),l.removeAllEvents(s&&c.get(s.browse_button),this.uid),e&&(e.innerHTML=""),t.removeInstance(this.uid),s=null}})}}),e("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(e,t){return e.Blob=function(){this.slice=function(){return new t(this.getRuntime().uid,function(t,i,n){var e;if(!window.File.prototype.slice)return(e=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?e.call(t,i,n):null;try{return t.slice(),t.slice(i,n)}catch(e){return t.slice(i,n-i)}}.apply(this,arguments))}}}),e("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(e,r,l,i,d,m){return e.FileDrop=function(){var t,n,o=[],s=[];function a(e){if(e.dataTransfer&&e.dataTransfer.types)return e=l.toArray(e.dataTransfer.types||[]),-1!==l.inArray("Files",e)||-1!==l.inArray("public.file-url",e)||-1!==l.inArray("application/x-moz-file",e)}function u(e,t){var i;i=e,s.length&&(i=m.getFileExtension(i.name))&&-1===l.inArray(i,s)||((i=new r(n,e)).relativePath=t||"",o.push(i))}function c(e,t){var i=[];l.each(e,function(s){i.push(function(e){{var t,n,r;(o=e,(i=s).isFile)?i.file(function(e){u(e,i.fullPath),o()},function(){o()}):i.isDirectory?(t=o,n=[],r=(e=i).createReader(),function t(i){r.readEntries(function(e){e.length?([].push.apply(n,e),t(i)):i()},i)}(function(){c(n,t)})):o()}var i,o})}),l.inSeries(i,function(){t()})}l.extend(this,{init:function(e){var r=this;t=e,n=r.ruid,s=function(e){for(var t=[],i=0;i<e.length;i++)[].push.apply(t,e[i].extensions.split(/\s*,\s*/));return-1===l.inArray("*",t)?t:[]}(t.accept),e=t.container,d.addEvent(e,"dragover",function(e){a(e)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},r.uid),d.addEvent(e,"drop",function(e){var t,i,n;a(e)&&(e.preventDefault(),o=[],e.dataTransfer.items&&e.dataTransfer.items[0].webkitGetAsEntry?(t=e.dataTransfer.items,i=function(){r.files=o,r.trigger("drop")},n=[],l.each(t,function(e){var t=e.webkitGetAsEntry();t&&(t.isFile?u(e.getAsFile(),t.fullPath):n.push(t))}),n.length?c(n,i):i()):(l.each(e.dataTransfer.files,function(e){u(e)}),r.files=o,r.trigger("drop")))},r.uid),d.addEvent(e,"dragenter",function(e){r.trigger("dragenter")},r.uid),d.addEvent(e,"dragleave",function(e){r.trigger("dragleave")},r.uid)},destroy:function(){d.removeAllEvents(t&&i.get(t.container),this.uid),n=o=s=t=null}})}}),e("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(e,o,s){return e.FileReader=function(){var n,r=!1;s.extend(this,{read:function(e,t){var i=this;i.result="",(n=new window.FileReader).addEventListener("progress",function(e){i.trigger(e)}),n.addEventListener("load",function(e){var t;i.result=r?(t=n.result,o.atob(t.substring(t.indexOf("base64,")+7))):n.result,i.trigger(e)}),n.addEventListener("error",function(e){i.trigger(e,n.error)}),n.addEventListener("loadend",function(e){n=null,i.trigger(e)}),"function"===s.typeOf(n[e])?(r=!1,n[e](t.getSource())):"readAsBinaryString"===e&&(r=!0,n.readAsDataURL(t.getSource()))},abort:function(){n&&n.abort()},destroy:function(){n=null}})}}),e("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(e,m,u,h,f,p,g,x,E){return e.XMLHttpRequest=function(){var c,l,d=this;m.extend(this,{send:function(e,t){var i,n=this,r="Mozilla"===E.browser&&E.verComp(E.version,4,">=")&&E.verComp(E.version,7,"<"),o="Android Browser"===E.browser,s=!1;if(l=e.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),(c=!window.XMLHttpRequest||"IE"===E.browser&&E.verComp(E.version,8,"<")?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(e){}}():new window.XMLHttpRequest).open(e.method,e.url,e.async,e.user,e.password),t instanceof p)t.isDetached()&&(s=!0),t=t.getSource();else if(t instanceof g){if(t.hasBlob())if(t.getBlob().isDetached())t=function(e){var i="----moxieboundary"+(new Date).getTime(),n="\r\n",r="";if(this.getRuntime().can("send_binary_string"))return c.setRequestHeader("Content-Type","multipart/form-data; boundary="+i),e.each(function(e,t){e instanceof p?r+="--"+i+n+'Content-Disposition: form-data; name="'+t+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+n+"Content-Type: "+(e.type||"application/octet-stream")+n+n+e.getSource()+n:r+="--"+i+n+'Content-Disposition: form-data; name="'+t+'"'+n+n+unescape(encodeURIComponent(e))+n}),r+="--"+i+"--"+n;throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR)}.call(n,t),s=!0;else if((r||o)&&"blob"===m.typeOf(t.getBlob().getSource())&&window.FileReader)return void function(e,t){var i,n,r=this;i=t.getBlob().getSource(),(n=new window.FileReader).onload=function(){t.append(t.getBlobName(),new p(null,{type:i.type,data:n.result})),d.send.call(r,e,t)},n.readAsBinaryString(i)}.call(n,e,t);t instanceof g&&(i=new window.FormData,t.each(function(e,t){e instanceof p?i.append(t,e.getSource()):i.append(t,e)}),t=i)}if(c.upload?(e.withCredentials&&(c.withCredentials=!0),c.addEventListener("load",function(e){n.trigger(e)}),c.addEventListener("error",function(e){n.trigger(e)}),c.addEventListener("progress",function(e){n.trigger(e)}),c.upload.addEventListener("progress",function(e){n.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):c.onreadystatechange=function(){switch(c.readyState){case 1:case 2:break;case 3:var t,i;try{h.hasSameOrigin(e.url)&&(t=c.getResponseHeader("Content-Length")||0),c.responseText&&(i=c.responseText.length)}catch(e){t=i=0}n.trigger({type:"progress",lengthComputable:!!t,total:parseInt(t,10),loaded:i});break;case 4:c.onreadystatechange=function(){},0===c.status?n.trigger("error"):n.trigger("load")}},m.isEmptyObj(e.headers)||m.each(e.headers,function(e,t){c.setRequestHeader(t,e)}),""!==e.responseType&&"responseType"in c&&("json"!==e.responseType||E.can("return_response_type","json")?c.responseType=e.responseType:c.responseType="text"),s)if(c.sendAsBinary)c.sendAsBinary(t);else{for(var a=new Uint8Array(t.length),u=0;u<t.length;u++)a[u]=255&t.charCodeAt(u);c.send(a.buffer)}else c.send(t);n.trigger("loadstart")},getStatus:function(){try{if(c)return c.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var i,n=new f(t.uid,c.response),r=c.getResponseHeader("Content-Disposition");return r&&(i=r.match(/filename=([\'\"'])([^\1]+)\1/))&&(l=i[2]),n.name=l,n.type||(n.type=u.getFileMime(l)),n;case"json":return E.can("return_response_type","json")?c.response:200===c.status&&window.JSON?JSON.parse(c.responseText):null;case"document":var o=c,s=o.responseXML,a=o.responseText;return"IE"===E.browser&&a&&s&&!s.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(o.getResponseHeader("Content-Type"))&&((s=new window.ActiveXObject("Microsoft.XMLDOM")).async=!1,s.validateOnParse=!1,s.loadXML(a)),s&&("IE"===E.browser&&0!==s.parseError||!s.documentElement||"parsererror"===s.documentElement.tagName)?null:s;default:return""!==c.responseText?c.responseText:null}}catch(e){return null}},getAllResponseHeaders:function(){try{return c.getAllResponseHeaders()}catch(e){}return""},abort:function(){c&&c.abort()},destroy:function(){d=l=null}})}}),e("moxie/runtime/html5/utils/BinaryReader",["moxie/core/utils/Basic"],function(t){function e(e){(e instanceof ArrayBuffer?function(r){var o=new DataView(r);t.extend(this,{readByteAt:function(e){return o.getUint8(e)},writeByteAt:function(e,t){o.setUint8(e,t)},SEGMENT:function(e,t,i){switch(arguments.length){case 2:return r.slice(e,e+t);case 1:return r.slice(e);case 3:if((i=null===i?new ArrayBuffer:i)instanceof ArrayBuffer){var n=new Uint8Array(this.length()-t+i.byteLength);0<e&&n.set(new Uint8Array(r.slice(0,e)),0),n.set(new Uint8Array(i),e),n.set(new Uint8Array(r.slice(e+t)),e+i.byteLength),this.clear(),r=n.buffer,o=new DataView(r);break}default:return r}},length:function(){return r?r.byteLength:0},clear:function(){o=r=null}})}:function(n){function r(e,t,i){i=3===arguments.length?i:n.length-t-1,n=n.substr(0,t)+e+n.substr(i+t)}t.extend(this,{readByteAt:function(e){return n.charCodeAt(e)},writeByteAt:function(e,t){r(String.fromCharCode(t),e,1)},SEGMENT:function(e,t,i){switch(arguments.length){case 1:return n.substr(e);case 2:return n.substr(e,t);case 3:r(null!==i?i:"",e,t);break;default:return n}},length:function(){return n?n.length:0},clear:function(){n=null}})}).apply(this,arguments)}return t.extend(e.prototype,{littleEndian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(n=this.littleEndian?0:-8*(t-1),i=r=0;r<t;r++)i|=this.readByteAt(e+r)<<Math.abs(n+8*r);return i},write:function(e,t,i){var n,r;if(e>this.length())throw new Error("You are trying to write outside the source boundaries.");for(n=this.littleEndian?0:-8*(i-1),r=0;r<i;r++)this.writeByteAt(e+r,t>>Math.abs(n+8*r)&255)},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){e=this.read(e,4);return 2147483647<e?e-4294967296:e},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,i){for(var n=[],r=0;r<i;r++)n[r]=this[e](t+r);return n}}),e}),e("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(a,u){return function o(e){var r,t,i,s=[],n=new a(e);if(65496!==n.SHORT(0))throw n.clear(),new u.ImageError(u.ImageError.WRONG_FORMAT);for(r=2;r<=n.length();)if(65488<=(t=n.SHORT(r))&&t<=65495)r+=2;else{if(65498===t||65497===t)break;i=n.SHORT(r+2)+2,65505<=t&&t<=65519&&s.push({hex:t,name:"APP"+(15&t),start:r,length:i,segment:n.SEGMENT(r,i)}),r+=i}return n.clear(),{headers:s,restore:function(e){var t,i,n=new a(e);for(r=65504==n.SHORT(2)?4+n.SHORT(4):2,i=0,t=s.length;i<t;i++)n.SEGMENT(r,0,s[i].segment),r+=s[i].length;return e=n.SEGMENT(),n.clear(),e},strip:function(e){var t,i,n=new o(e),r=n.headers;for(n.purge(),t=new a(e),i=r.length;i--;)t.SEGMENT(r[i].start,r[i].length,"");return e=t.SEGMENT(),t.clear(),e},get:function(e){for(var t=[],i=0,n=s.length;i<n;i++)s[i].name===e.toUpperCase()&&t.push(s[i].segment);return t},set:function(e,t){var i,n,r,o=[];for("string"==typeof t?o.push(t):o=t,i=n=0,r=s.length;i<r&&(s[i].name===e.toUpperCase()&&(s[i].segment=o[n],s[i].length=o[n].length,n++),!(n>=o.length));i++);},purge:function(){this.headers=s=[]}}}}),e("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(p,o,g){function s(e){var t,l,h,f,i;if(o.call(this,e),l={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},h={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},n=(f={tiffHeader:10}).tiffHeader,t={clear:this.clear},p.extend(this,{read:function(){try{return s.prototype.read.apply(this,arguments)}catch(e){throw new g.ImageError(g.ImageError.INVALID_META_ERR)}},write:function(){try{return s.prototype.write.apply(this,arguments)}catch(e){throw new g.ImageError(g.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(e){return this.LONG(e)/this.LONG(e+4)},SRATIONAL:function(e){return this.SLONG(e)/this.SLONG(e+4)},ASCII:function(e){return this.CHAR(e)},TIFF:function(){return i||null},EXIF:function(){var e=null;if(f.exifIFD){try{e=r.call(this,f.exifIFD,l.exif)}catch(e){return null}if(e.ExifVersion&&"array"===p.typeOf(e.ExifVersion)){for(var t=0,i="";t<e.ExifVersion.length;t++)i+=String.fromCharCode(e.ExifVersion[t]);e.ExifVersion=i}}return e},GPS:function(){var e=null;if(f.gpsIFD){try{e=r.call(this,f.gpsIFD,l.gps)}catch(e){return null}e.GPSVersionID&&"array"===p.typeOf(e.GPSVersionID)&&(e.GPSVersionID=e.GPSVersionID.join("."))}return e},thumb:function(){if(f.IFD1)try{var e=r.call(this,f.IFD1,l.thumb);if("JPEGInterchangeFormat"in e)return this.SEGMENT(f.tiffHeader+e.JPEGInterchangeFormat,e.JPEGInterchangeFormatLength)}catch(e){}return null},setExif:function(e,t){return("PixelXDimension"===e||"PixelYDimension"===e)&&function(e,t,i){var n,r,o,s=0;if("string"==typeof t){var a,u=l[e.toLowerCase()];for(a in u)if(u[a]===t){t=a;break}}n=f[e.toLowerCase()+"IFD"],r=this.SHORT(n);for(var c=0;c<r;c++)if(o=n+12*c+2,this.SHORT(o)==t){s=o+8;break}if(!s)return!1;try{this.write(s,i,4)}catch(e){return!1}return!0}.call(this,"exif",e,t)},clear:function(){t.clear(),e=l=h=i=f=t=null}}),65505!==this.SHORT(0)||"EXIF\0"!==this.STRING(4,5).toUpperCase())throw new g.ImageError(g.ImageError.INVALID_META_ERR);if(this.littleEndian=18761==this.SHORT(n),42!==this.SHORT(n+=2))throw new g.ImageError(g.ImageError.INVALID_META_ERR);f.IFD0=f.tiffHeader+this.LONG(n+=2),"ExifIFDPointer"in(i=r.call(this,f.IFD0,l.tiff))&&(f.exifIFD=f.tiffHeader+i.ExifIFDPointer,delete i.ExifIFDPointer),"GPSInfoIFDPointer"in i&&(f.gpsIFD=f.tiffHeader+i.GPSInfoIFDPointer,delete i.GPSInfoIFDPointer),p.isEmptyObj(i)&&(i=null);var n=this.LONG(f.IFD0+12*this.SHORT(f.IFD0)+2);function r(e,t){for(var i,n,r,o,s,a=this,u={},c={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},l={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8},d=a.SHORT(e),m=0;m<d;m++)if((i=t[a.SHORT(r=e+2+12*m)])!==x){if(o=c[a.SHORT(r+=2)],n=a.LONG(r+=2),!(s=l[o]))throw new g.ImageError(g.ImageError.INVALID_META_ERR);if(r+=4,(r=4<s*n?a.LONG(r)+f.tiffHeader:r)+s*n>=this.length())throw new g.ImageError(g.ImageError.INVALID_META_ERR);"ASCII"===o?u[i]=p.trim(a.STRING(r,n).replace(/\0$/,"")):(s=a.asArray(o,r,n),o=1==n?s[0]:s,h.hasOwnProperty(i)&&"object"!=typeof o?u[i]=h[i][o]:u[i]=o)}return u}n&&(f.IFD1=f.tiffHeader+n)}return s.prototype=o.prototype,s}),e("moxie/runtime/html5/image/JPEG",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEGHeaders","moxie/runtime/html5/utils/BinaryReader","moxie/runtime/html5/image/ExifParser"],function(s,a,u,c,l){return function(e){var i,n,t,r=new c(e);if(65496!==r.SHORT(0))throw new a.ImageError(a.ImageError.WRONG_FORMAT);i=new u(e);try{n=new l(i.get("app1")[0])}catch(e){}function o(e){var t,i=0;for(e=e||r;i<=e.length();){if(65472<=(t=e.SHORT(i+=2))&&t<=65475)return i+=5,{height:e.SHORT(i),width:e.SHORT(i+=2)};t=e.SHORT(i+=2),i+=t-2}return null}t=o.call(this),s.extend(this,{type:"image/jpeg",size:r.length(),width:t&&t.width||0,height:t&&t.height||0,setExif:function(e,t){if(!n)return!1;"object"===s.typeOf(e)?s.each(e,function(e,t){n.setExif(t,e)}):n.setExif(e,t),i.set("app1",n.SEGMENT())},writeHeaders:function(){return arguments.length?i.restore(arguments[0]):i.restore(e)},stripHeaders:function(e){return i.strip(e)},purge:function(){!function(){n&&i&&r&&(n.clear(),i.purge(),r.clear(),t=i=n=r=null)}.call(this)}}),n&&(this.meta={tiff:n.TIFF(),exif:n.EXIF(),gps:n.GPS(),thumb:function(){var e,t,i=n.thumb();if(i&&(e=new c(i),t=o(e),e.clear(),t))return t.data=i,t;return null}()})}}),e("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(a,u,c){return function(e){for(var t,r=new c(e),i=0,n=0,o=[35152,20039,3338,6666],n=0;n<o.length;n++,i+=2)if(o[n]!=r.SHORT(i))throw new a.ImageError(a.ImageError.WRONG_FORMAT);function s(){r&&(r.clear(),e=t=r=null)}t=function(){var e=function(e){var t,i,n;return t=r.LONG(e),i=r.STRING(e+=4,4),n=e+=4,e=r.LONG(e+t),{length:t,type:i,start:n,CRC:e}}.call(this,8);return"IHDR"==e.type?(e=e.start,{width:r.LONG(e),height:r.LONG(e+=4)}):null}.call(this),u.extend(this,{type:"image/png",size:r.length(),width:t.width,height:t.height,purge:function(){s.call(this)}}),s.call(this)}}),e("moxie/runtime/html5/image/ImageInfo",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEG","moxie/runtime/html5/image/PNG"],function(n,r,o,s){return function(t){var i=[o,s],e=function(){for(var e=0;e<i.length;e++)try{return new i[e](t)}catch(e){}throw new r.ImageError(r.ImageError.WRONG_FORMAT)}();n.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){t=null}}),n.extend(this,e),this.purge=function(){e.purge(),e=null}}}),e("moxie/runtime/html5/image/MegaPixel",[],function(){function R(e){var t,i=e.naturalWidth;return 1048576<i*e.naturalHeight&&((t=document.createElement("canvas")).width=t.height=1,(t=t.getContext("2d")).drawImage(e,1-i,0),0===t.getImageData(0,0,1,1).data[3])}return{isSubsampled:R,renderTo:function(e,t,i){for(var n=e.naturalWidth,r=e.naturalHeight,o=i.width,s=i.height,a=i.x||0,u=i.y||0,c=t.getContext("2d"),l=(R(e)&&(n/=2,r/=2),1024),d=document.createElement("canvas"),m=(d.width=d.height=l,d.getContext("2d")),h=function(e,t){var i=document.createElement("canvas"),n=(i.width=1,i.height=t,i.getContext("2d")),r=(n.drawImage(e,0,0),n.getImageData(0,0,1,t).data),o=0,s=t,a=t;for(;o<a;)0===r[4*(a-1)+3]?s=a:o=a,a=s+o>>1;i=null;e=a/t;return 0==e?1:e}(e,r),f=0;f<r;){for(var p=r<f+l?r-f:l,g=0;g<n;){var x=n<g+l?n-g:l,E=(m.clearRect(0,0,l,l),m.drawImage(e,-g,-f),g*o/n+a<<0),y=Math.ceil(x*o/n),w=f*s/r/h+u<<0,v=Math.ceil(p*s/r/h);c.drawImage(d,0,0,x,p,E,w,y,v),g+=l}f+=l}}}}),e("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/MegaPixel","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,g,d,x,t,E,y,w,v,R){return e.Image=function(){var i,n,m,r,o,s=this,h=!1,f=!0;function p(){if(m||i)return m||i;throw new d.ImageError(d.DOMException.INVALID_STATE_ERR)}function a(e){return x.atob(e.substring(e.indexOf("base64,")+7))}function u(e){var t=this;(i=new Image).onerror=function(){l.call(this),t.trigger("error",d.ImageError.WRONG_FORMAT)},i.onload=function(){t.trigger("load")},i.src="data:"==e.substr(0,5)?e:"data:"+(o.type||"")+";base64,"+x.btoa(e)}function c(e,t,i,n){var r,o,s,a=0,u=0;if(f=n,o=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1,-1!==g.inArray(o,[5,6,7,8])&&(s=e,e=t,t=s),s=p(),!(1<(r=i?(e=Math.min(e,s.width),t=Math.min(t,s.height),Math.max(e/s.width,t/s.height)):Math.min(e/s.width,t/s.height))&&!i&&n)){if(m=m||document.createElement("canvas"),n=Math.round(s.width*r),r=Math.round(s.height*r),i?(m.width=e,m.height=t,e<n&&(a=Math.round((n-e)/2)),t<r&&(u=Math.round((r-t)/2))):(m.width=n,m.height=r),!f){var c=m.width,l=m.height,i=o;switch(i){case 5:case 6:case 7:case 8:m.width=l,m.height=c;break;default:m.width=c,m.height=l}var d=m.getContext("2d");switch(i){case 2:d.translate(c,0),d.scale(-1,1);break;case 3:d.translate(c,l),d.rotate(Math.PI);break;case 4:d.translate(0,l),d.scale(1,-1);break;case 5:d.rotate(.5*Math.PI),d.scale(1,-1);break;case 6:d.rotate(.5*Math.PI),d.translate(0,-l);break;case 7:d.rotate(.5*Math.PI),d.translate(c,-l),d.scale(-1,1);break;case 8:d.rotate(-.5*Math.PI),d.translate(-c,0)}}!function(e,t,i,n,r,o){"iOS"===R.OS?w.renderTo(e,t,{width:r,height:o,x:i,y:n}):t.getContext("2d").drawImage(e,i,n,r,o)}.call(this,s,m,-a,-u,n,r),this.width=m.width,this.height=m.height,h=!0}this.trigger("Resize")}function l(){n&&(n.purge(),n=null),r=i=m=o=null,h=!1}g.extend(this,{loadFromBlob:function(e){var t=this,i=t.getRuntime(),n=!(1<arguments.length)||arguments[1];if(!i.can("access_binary"))throw new d.RuntimeError(d.RuntimeError.NOT_SUPPORTED_ERR);(o=e).isDetached()?(r=e.getSource(),u.call(this,r)):function(e,t){var i,n=this;{if(!window.FileReader)return t(e.getAsDataURL());(i=new FileReader).onload=function(){t(this.result)},i.onerror=function(){n.trigger("error",d.ImageError.WRONG_FORMAT)},i.readAsDataURL(e)}}.call(this,e.getSource(),function(e){n&&(r=a(e)),u.call(t,e)})},loadFromImage:function(e,t){this.meta=e.meta,o=new E(null,{name:e.name,size:e.size,type:e.type}),u.call(this,t?r=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var e=this.getRuntime();return!n&&r&&e.can("access_image_binary")&&(n=new y(r)),!(e={width:p().width||0,height:p().height||0,type:o.type||v.getFileMime(o.name),size:r&&r.length||o.size||0,name:o.name||"",meta:n&&n.meta||this.meta||{}}).meta||!e.meta.thumb||e.meta.thumb.data instanceof t||(e.meta.thumb.data=new t(null,{type:"image/jpeg",data:e.meta.thumb.data})),e},downsize:function(){c.apply(this,arguments)},getAsCanvas:function(){return m&&(m.id=this.uid+"_canvas"),m},getAsBlob:function(e,t){return e!==this.type&&c.call(this,this.width,this.height,!1),new E(null,{name:o.name||"",type:e,data:s.getAsBinaryString.call(this,e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!h)return i.src;if("image/jpeg"!==e)return m.toDataURL("image/png");try{return m.toDataURL("image/jpeg",t/100)}catch(e){return m.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!h)return r=r||a(s.getAsDataURL(e,t));if("image/jpeg"!==e)r=a(s.getAsDataURL(e,t));else{var i;t=t||90;try{i=m.toDataURL("image/jpeg",t/100)}catch(e){i=m.toDataURL("image/jpeg")}r=a(i),n&&(r=n.stripHeaders(r),f&&(n.meta&&n.meta.exif&&n.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),r=n.writeHeaders(r)),n.purge(),n=null)}return h=!1,r},destroy:function(){s=null,l.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}}),e("moxie/runtime/flash/Runtime",[],function(){return{}}),e("moxie/runtime/silverlight/Runtime",[],function(){return{}}),e("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(o,e,s,a){var u={};return s.addConstructor("html4",function(e){var t,i=this,n=s.capTest,r=s.capTrue;s.call(this,e,"html4",{access_binary:n(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:n(u.Image&&(a.can("create_canvas")||a.can("use_data_uri_over32kb"))),do_cors:!1,drag_and_drop:!1,filter_by_extension:n("Chrome"===a.browser&&a.verComp(a.version,28,">=")||"IE"===a.browser&&a.verComp(a.version,10,">=")||"Safari"===a.browser&&a.verComp(a.version,7,">=")),resize_image:function(){return u.Image&&i.can("access_binary")&&a.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(e){return!("json"!==e||!window.JSON)||!!~o.inArray(e,["text","document",""])},return_status_code:function(e){return!o.arrayDiff(e,[200,404])},select_file:function(){return a.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return i.can("select_file")},summon_file_dialog:function(){return i.can("select_file")&&("Firefox"===a.browser&&a.verComp(a.version,4,">=")||"Opera"===a.browser&&a.verComp(a.version,12,">=")||"IE"===a.browser&&a.verComp(a.version,10,">=")||!!~o.inArray(a.browser,["Chrome","Safari"]))},upload_filesize:r,use_http_method:function(e){return!o.arrayDiff(e,["GET","POST"])}}),o.extend(this,{init:function(){this.trigger("Init")},destroy:(t=this.destroy,function(){t.call(i),t=i=null})}),o.extend(this.getShim(),u)}),u}),e("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,d,m,h,f,s,p){return e.FileInput=function(){var a,u,c=[];function l(){var e,t,i,n=this,r=n.getRuntime(),o=m.guid("uid_"),s=r.getShimContainer();a&&(e=h.get(a+"_form"))&&m.extend(e.style,{top:"100%"}),(t=document.createElement("form")).setAttribute("id",o+"_form"),t.setAttribute("method","post"),t.setAttribute("enctype","multipart/form-data"),t.setAttribute("encoding","multipart/form-data"),m.extend(t.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),(i=document.createElement("input")).setAttribute("id",o),i.setAttribute("type","file"),i.setAttribute("name",u.name||"Filedata"),i.setAttribute("accept",c.join(",")),m.extend(i.style,{fontSize:"999px",opacity:0}),t.appendChild(i),s.appendChild(t),m.extend(i.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===p.browser&&p.verComp(p.version,10,"<")&&m.extend(i.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),i.onchange=function(){var e;if(this.value){if(this.files){if(0===(e=this.files[0]).size)return void t.parentNode.removeChild(t)}else e={name:this.value};e=new d(r.uid,e),this.onchange=function(){},l.call(n),n.files=[e],i.setAttribute("id",e.uid),t.setAttribute("id",e.uid+"_form"),n.trigger("change"),i=t=null}},r.can("summon_file_dialog")&&(e=h.get(u.browse_button),f.removeEvent(e,"click",n.uid),f.addEvent(e,"click",function(e){i&&!i.disabled&&i.click(),e.preventDefault()},n.uid)),a=o}m.extend(this,{init:function(e){var t,i,n,r=this,o=r.getRuntime();c=(u=e).accept.mimes||s.extList2mimes(e.accept,o.can("filter_by_extension")),t=o.getShimContainer(),n=h.get(e.browse_button),o.can("summon_file_dialog")&&("static"===h.getStyle(n,"position")&&(n.style.position="relative"),i=parseInt(h.getStyle(n,"z-index"),10)||1,n.style.zIndex=i,t.style.zIndex=i-1),i=o.can("summon_file_dialog")?n:t,f.addEvent(i,"mouseover",function(){r.trigger("mouseenter")},r.uid),f.addEvent(i,"mouseout",function(){r.trigger("mouseleave")},r.uid),f.addEvent(i,"mousedown",function(){r.trigger("mousedown")},r.uid),f.addEvent(h.get(e.container),"mouseup",function(){r.trigger("mouseup")},r.uid),l.call(this),t=null,r.trigger({type:"ready",async:!0})},disable:function(e){var t;(t=h.get(a))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),e=e.getShimContainer();f.removeAllEvents(e,this.uid),f.removeAllEvents(u&&h.get(u.container),this.uid),f.removeAllEvents(u&&h.get(u.browse_button),this.uid),e&&(e.innerHTML=""),t.removeInstance(this.uid),a=c=u=null}})}}),e("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(e,t){return e.FileReader=t}),e("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(e,m,h,f,p,g,x,E){return e.XMLHttpRequest=function(){var u,c,l;function d(t){var e,i,n,r=this,o=!1;if(l){if(e=l.id.replace(/_iframe$/,""),e=h.get(e+"_form")){for(n=(i=e.getElementsByTagName("input")).length;n--;)switch(i[n].getAttribute("type")){case"hidden":i[n].parentNode.removeChild(i[n]);break;case"file":o=!0}i=[],o||e.parentNode.removeChild(e),e=null}setTimeout(function(){g.removeEvent(l,"load",r.uid),l.parentNode&&l.parentNode.removeChild(l);var e=r.getRuntime().getShimContainer();e.children.length||e.parentNode.removeChild(e),e=l=null,t()},1)}}m.extend(this,{send:function(t,e){var i,n,r,o,s=this,a=s.getRuntime();if(u=c=null,e instanceof E&&e.hasBlob()){if(o=e.getBlob(),i=o.uid,r=h.get(i),!(n=h.get(i+"_form")))throw new p.DOMException(p.DOMException.NOT_FOUND_ERR)}else i=m.guid("uid_"),(n=document.createElement("form")).setAttribute("id",i+"_form"),n.setAttribute("method",t.method),n.setAttribute("enctype","multipart/form-data"),n.setAttribute("encoding","multipart/form-data"),a.getShimContainer().appendChild(n);n.setAttribute("target",i+"_iframe"),e instanceof E&&e.each(function(e,t){var i;e instanceof x?r&&r.setAttribute("name",t):(i=document.createElement("input"),m.extend(i,{type:"hidden",name:t,value:e}),r?n.insertBefore(i,r):n.appendChild(i))}),n.setAttribute("action",t.url),e=a.getShimContainer()||document.body,(a=document.createElement("div")).innerHTML='<iframe id="'+i+'_iframe" name="'+i+'_iframe" src="javascript:""" style="display:none"></iframe>',l=a.firstChild,e.appendChild(l),g.addEvent(l,"load",function(){var e;try{e=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(e.title)?u=e.title.replace(/^(\d+).*$/,"$1"):(u=200,c=m.trim(e.body.innerHTML),s.trigger({type:"progress",loaded:c.length,total:c.length}),o&&s.trigger({type:"uploadprogress",loaded:o.size||1025,total:o.size||1025}))}catch(e){if(!f.hasSameOrigin(t.url))return void d.call(s,function(){s.trigger("error")});u=404}d.call(s,function(){s.trigger("load")})},s.uid),n.submit(),s.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===m.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(e){return null}return c},abort:function(){var e=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),d.call(this,function(){e.dispatchEvent("abort")})}})}}),e("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(e,t){return e.Image=t});for(var t=["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/FileInput","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events"],i=0;i<t.length;i++){for(var r=o,a=t[i],u=a.split(/[.\/]/),c=0;c<u.length-1;++c)r[u[c]]===x&&(r[u[c]]={}),r=r[u[c]];r[u[u.length-1]]=s[a]}}(this),function(e){"use strict";var r={},o=e.moxie.core.utils.Basic.inArray;!function e(t){var i,n;for(i in t)"object"!=(n=typeof t[i])||~o(i,["Exceptions","Env","Mime"])?"function"==n&&(r[i]=t[i]):e(t[i])}(e.moxie),r.Env=e.moxie.core.utils.Env,r.Mime=e.moxie.core.utils.Mime,r.Exceptions=e.moxie.core.Exceptions,e.mOxie=r,e.o||(e.o=r)}(this); plupload/plupload.min.js 0000644 00000036365 15125140777 0011352 0 ustar 00 !function(e,I,S){var T=e.setTimeout,D={};function w(e){var t=e.required_features,r={};function i(e,t,i){var n={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};n[e]?r[n[e]]=t:i||(r[e]=t)}return"string"==typeof t?F.each(t.split(/\s*,\s*/),function(e){i(e,!0)}):"object"==typeof t?F.each(t,function(e,t){i(t,e)}):!0===t&&(0<e.chunk_size&&(r.slice_blob=!0),!e.resize.enabled&&e.multipart||(r.send_binary_string=!0),F.each(e,function(e,t){i(t,!!e,!0)})),e.runtimes="html5,html4",r}var t,F={VERSION:"2.1.9",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:I.mimes,ua:I.ua,typeOf:I.typeOf,extend:I.extend,guid:I.guid,getAll:function(e){for(var t,i=[],n=(e="array"!==F.typeOf(e)?[e]:e).length;n--;)(t=F.get(e[n]))&&i.push(t);return i.length?i:null},get:I.get,each:I.each,getPos:I.getPos,getSize:I.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"};return e&&(""+e).replace(/[<>&\"\']/g,function(e){return t[e]?"&"+t[e]+";":e})},toArray:I.toArray,inArray:I.inArray,addI18n:I.addI18n,translate:I.translate,isEmptyObj:I.isEmptyObj,hasClass:I.hasClass,addClass:I.addClass,removeClass:I.removeClass,getStyle:I.getStyle,addEvent:I.addEvent,removeEvent:I.removeEvent,removeAllEvents:I.removeAllEvents,cleanName:function(e){for(var t=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],i=0;i<t.length;i+=2)e=e.replace(t[i],t[i+1]);return e=(e=e.replace(/\s+/g,"_")).replace(/[^a-z0-9_\-\.]+/gi,"")},buildUrl:function(e,t){var i="";return F.each(t,function(e,t){i+=(i?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),i&&(e+=(0<e.indexOf("?")?"&":"?")+i),e},formatSize:function(e){var t;return e===S||/\D/.test(e)?F.translate("N/A"):(t=Math.pow(1024,4))<e?i(e/t,1)+" "+F.translate("tb"):e>(t/=1024)?i(e/t,1)+" "+F.translate("gb"):e>(t/=1024)?i(e/t,1)+" "+F.translate("mb"):1024<e?Math.round(e/1024)+" "+F.translate("kb"):e+" "+F.translate("b");function i(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}},parseSize:I.parseSizeStr,predictRuntime:function(e,t){var i=new F.Uploader(e),t=I.Runtime.thatCan(i.getOption().required_features,t||e.runtimes);return i.destroy(),t},addFileFilter:function(e,t){D[e]=t}};F.addFileFilter("mime_types",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:F.FILE_EXTENSION_ERROR,message:F.translate("File extension error."),file:t}),i(!1)):i(!0)}),F.addFileFilter("max_file_size",function(e,t,i){e=F.parseSize(e),void 0!==t.size&&e&&t.size>e?(this.trigger("Error",{code:F.FILE_SIZE_ERROR,message:F.translate("File size error."),file:t}),i(!1)):i(!0)}),F.addFileFilter("prevent_duplicates",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger("Error",{code:F.FILE_DUPLICATE_ERROR,message:F.translate("Duplicate file error."),file:t}),void i(!1);i(!0)}),F.Uploader=function(e){var u,i,n,p,t=F.guid(),l=[],h={},o=[],d=[],c=!1;function r(){var e,t,i=0;if(this.state==F.STARTED){for(t=0;t<l.length;t++)e||l[t].status!=F.QUEUED?i++:(e=l[t],this.trigger("BeforeUpload",e)&&(e.status=F.UPLOADING,this.trigger("UploadFile",e)));i==l.length&&(this.state!==F.STOPPED&&(this.state=F.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",l))}}function s(e){e.percent=0<e.size?Math.ceil(e.loaded/e.size*100):100,a()}function a(){var e,t;for(n.reset(),e=0;e<l.length;e++)(t=l[e]).size!==S?(n.size+=t.origSize,n.loaded+=t.loaded*t.origSize/t.size):n.size=S,t.status==F.DONE?n.uploaded++:t.status==F.FAILED?n.failed++:n.queued++;n.size===S?n.percent=0<l.length?Math.ceil(n.uploaded/l.length*100):0:(n.bytesPerSec=Math.ceil(n.loaded/((+new Date-i||1)/1e3)),n.percent=0<n.size?Math.ceil(n.loaded/n.size*100):0)}function f(){var e=o[0]||d[0];return!!e&&e.getRuntime().uid}function g(n,e){var r=this,s=0,t=[],a={runtime_order:n.runtimes,required_caps:n.required_features,preferred_caps:h};F.each(n.runtimes.split(/\s*,\s*/),function(e){n[e]&&(a[e]=n[e])}),n.browse_button&&F.each(n.browse_button,function(i){t.push(function(t){var e=new I.FileInput(F.extend({},a,{accept:n.filters.mime_types,name:n.file_data_name,multiple:n.multi_selection,container:n.container,browse_button:i}));e.onready=function(){var e=I.Runtime.getInfo(this.ruid);I.extend(r.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),s++,o.push(this),t()},e.onchange=function(){r.addFile(this.files)},e.bind("mouseenter mouseleave mousedown mouseup",function(e){c||(n.browse_button_hover&&("mouseenter"===e.type?I.addClass(i,n.browse_button_hover):"mouseleave"===e.type&&I.removeClass(i,n.browse_button_hover)),n.browse_button_active&&("mousedown"===e.type?I.addClass(i,n.browse_button_active):"mouseup"===e.type&&I.removeClass(i,n.browse_button_active)))}),e.bind("mousedown",function(){r.trigger("Browse")}),e.bind("error runtimeerror",function(){e=null,t()}),e.init()})}),n.drop_element&&F.each(n.drop_element,function(i){t.push(function(t){var e=new I.FileDrop(F.extend({},a,{drop_zone:i}));e.onready=function(){var e=I.Runtime.getInfo(this.ruid);I.extend(r.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),dragdrop:e.can("drag_and_drop")}),s++,d.push(this),t()},e.ondrop=function(){r.addFile(this.files)},e.bind("error runtimeerror",function(){e=null,t()}),e.init()})}),I.inSeries(t,function(){"function"==typeof e&&e(s)})}function _(e,t,i){var a=this,o=!1;function n(e,t,i){var n,r,s=u[e];switch(e){case"max_file_size":"max_file_size"===e&&(u.max_file_size=u.filters.max_file_size=t);break;case"chunk_size":(t=F.parseSize(t))&&(u[e]=t,u.send_file_name=!0);break;case"multipart":(u[e]=t)||(u.send_file_name=!0);break;case"unique_names":(u[e]=t)&&(u.send_file_name=!0);break;case"filters":"array"===F.typeOf(t)&&(t={mime_types:t}),i?F.extend(u.filters,t):u.filters=t,t.mime_types&&(u.filters.mime_types.regexp=(n=u.filters.mime_types,r=[],F.each(n,function(e){F.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?r.push("\\.*"):r.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+r.join("|")+")$","i")));break;case"resize":i?F.extend(u.resize,t,{enabled:!0}):u.resize=t;break;case"prevent_duplicates":u.prevent_duplicates=u.filters.prevent_duplicates=!!t;break;case"container":case"browse_button":case"drop_element":t="container"===e?F.get(t):F.getAll(t);case"runtimes":case"multi_selection":u[e]=t,i||(o=!0);break;default:u[e]=t}i||a.trigger("OptionChanged",e,t,s)}"object"==typeof e?F.each(e,function(e,t){n(t,e,i)}):n(e,t,i),i?(u.required_features=w(F.extend({},u)),h=w(F.extend({},u,{required_features:!0}))):o&&(a.trigger("Destroy"),g.call(a,u,function(e){e?(a.runtime=I.Runtime.getInfo(f()).type,a.trigger("Init",{runtime:a.runtime}),a.trigger("PostInit")):a.trigger("Error",{code:F.INIT_ERROR,message:F.translate("Init error.")})}))}function m(e,t){var i;e.settings.unique_names&&(e="part",(i=t.name.match(/\.([^.]+)$/))&&(e=i[1]),t.target_name=t.id+"."+e)}function b(r,s){var a,o=r.settings.url,u=r.settings.chunk_size,l=r.settings.max_retries,d=r.features,c=0;function f(){0<l--?T(g,1e3):(s.loaded=c,r.trigger("Error",{code:F.HTTP_ERROR,message:F.translate("HTTP Error."),file:s,response:p.responseText,status:p.status,responseHeaders:p.getAllResponseHeaders()}))}function g(){var e,i,t,n={};s.status===F.UPLOADING&&r.state!==F.STOPPED&&(r.settings.send_file_name&&(n.name=s.target_name||s.name),e=u&&d.chunks&&a.size>u?(t=Math.min(u,a.size-c),a.slice(c,c+t)):(t=a.size,a),u&&d.chunks&&(r.settings.send_chunk_number?(n.chunk=Math.ceil(c/u),n.chunks=Math.ceil(a.size/u)):(n.offset=c,n.total=a.size)),(p=new I.XMLHttpRequest).upload&&(p.upload.onprogress=function(e){s.loaded=Math.min(s.size,c+e.loaded),r.trigger("UploadProgress",s)}),p.onload=function(){400<=p.status?f():(l=r.settings.max_retries,t<a.size?(e.destroy(),c+=t,s.loaded=Math.min(c,a.size),r.trigger("ChunkUploaded",s,{offset:s.loaded,total:a.size,response:p.responseText,status:p.status,responseHeaders:p.getAllResponseHeaders()}),"Android Browser"===I.Env.browser&&r.trigger("UploadProgress",s)):s.loaded=s.size,e=i=null,!c||c>=a.size?(s.size!=s.origSize&&(a.destroy(),a=null),r.trigger("UploadProgress",s),s.status=F.DONE,r.trigger("FileUploaded",s,{response:p.responseText,status:p.status,responseHeaders:p.getAllResponseHeaders()})):T(g,1))},p.onerror=function(){f()},p.onloadend=function(){this.destroy(),p=null},r.settings.multipart&&d.multipart?(p.open("post",o,!0),F.each(r.settings.headers,function(e,t){p.setRequestHeader(t,e)}),i=new I.FormData,F.each(F.extend(n,r.settings.multipart_params),function(e,t){i.append(t,e)}),i.append(r.settings.file_data_name,e),p.send(i,{runtime_order:r.settings.runtimes,required_caps:r.settings.required_features,preferred_caps:h})):(o=F.buildUrl(r.settings.url,F.extend(n,r.settings.multipart_params)),p.open("post",o,!0),p.setRequestHeader("Content-Type","application/octet-stream"),F.each(r.settings.headers,function(e,t){p.setRequestHeader(t,e)}),p.send(e,{runtime_order:r.settings.runtimes,required_caps:r.settings.required_features,preferred_caps:h})))}s.loaded&&(c=s.loaded=u?u*Math.floor(s.loaded/u):0),a=s.getSource(),r.settings.resize.enabled&&function(e,t){if(e.ruid){e=I.Runtime.getInfo(e.ruid);if(e)return e.can(t)}}(a,"send_binary_string")&&~I.inArray(a.type,["image/jpeg","image/png"])?function(t,e,i){var n=new I.Image;try{n.onload=function(){if(e.width>this.width&&e.height>this.height&&e.quality===S&&e.preserve_headers&&!e.crop)return this.destroy(),i(t);n.downsize(e.width,e.height,e.crop,e.preserve_headers)},n.onresize=function(){i(this.getAsBlob(t.type,e.quality)),this.destroy()},n.onerror=function(){i(t)},n.load(t)}catch(e){i(t)}}.call(this,a,r.settings.resize,function(e){a=e,s.size=e.size,g()}):g()}function R(e,t){s(t)}function E(e){if(e.state==F.STARTED)i=+new Date;else if(e.state==F.STOPPED)for(var t=e.files.length-1;0<=t;t--)e.files[t].status==F.UPLOADING&&(e.files[t].status=F.QUEUED,a())}function y(){p&&p.abort()}function v(e){a(),T(function(){r.call(e)},1)}function z(e,t){t.code===F.INIT_ERROR?e.destroy():t.code===F.HTTP_ERROR&&(t.file.status=F.FAILED,s(t.file),e.state==F.STARTED)&&(e.trigger("CancelUpload"),T(function(){r.call(e)},1))}function O(e){e.stop(),F.each(l,function(e){e.destroy()}),l=[],o.length&&(F.each(o,function(e){e.destroy()}),o=[]),d.length&&(F.each(d,function(e){e.destroy()}),d=[]),c=!(h={}),i=p=null,n.reset()}u={runtimes:I.Runtime.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:{enabled:!1,preserve_headers:!0,crop:!1},send_file_name:!0,send_chunk_number:!0},_.call(this,e,null,!0),n=new F.QueueProgress,F.extend(this,{id:t,uid:t,state:F.STOPPED,features:{},runtime:null,files:l,settings:u,total:n,init:function(){var t,i=this,e=i.getOption("preinit");return"function"==typeof e?e(i):F.each(e,function(e,t){i.bind(t,e)}),function(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()}),this.bind("CancelUpload",y),this.bind("BeforeUpload",m),this.bind("UploadFile",b),this.bind("UploadProgress",R),this.bind("StateChanged",E),this.bind("QueueChanged",a),this.bind("Error",z),this.bind("FileUploaded",v),this.bind("Destroy",O)}.call(i),F.each(["container","browse_button","drop_element"],function(e){if(null===i.getOption(e))return!(t={code:F.INIT_ERROR,message:F.translate("'%' specified, but cannot be found.")})}),t?i.trigger("Error",t):u.browse_button||u.drop_element?void g.call(i,u,function(e){var t=i.getOption("init");"function"==typeof t?t(i):F.each(t,function(e,t){i.bind(t,e)}),e?(i.runtime=I.Runtime.getInfo(f()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:F.INIT_ERROR,message:F.translate("Init error.")})}):i.trigger("Error",{code:F.INIT_ERROR,message:F.translate("You must specify either 'browse_button' or 'drop_element'.")})},setOption:function(e,t){_.call(this,e,t,!this.runtime)},getOption:function(e){return e?u[e]:u},refresh:function(){o.length&&F.each(o,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=F.STARTED&&(this.state=F.STARTED,this.trigger("StateChanged"),r.call(this))},stop:function(){this.state!=F.STOPPED&&(this.state=F.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){c=arguments[0]===S||arguments[0],o.length&&F.each(o,function(e){e.disable(c)}),this.trigger("DisableBrowse",c)},getFile:function(e){for(var t=l.length-1;0<=t;t--)if(l[t].id===e)return l[t]},addFile:function(e,n){var r,s=this,a=[],o=[];r=f(),function e(i){var t=I.typeOf(i);if(i instanceof I.File){if(!i.ruid&&!i.isDetached()){if(!r)return!1;i.ruid=r,i.connectRuntime(r)}e(new F.File(i))}else i instanceof I.Blob?(e(i.getSource()),i.destroy()):i instanceof F.File?(n&&(i.name=n),a.push(function(t){var n,e,r;n=i,e=function(e){e||(l.push(i),o.push(i),s.trigger("FileFiltered",i)),T(t,1)},r=[],I.each(s.settings.filters,function(e,i){D[i]&&r.push(function(t){D[i].call(s,e,n,function(e){t(!e)})})}),I.inSeries(r,e)})):-1!==I.inArray(t,["file","blob"])?e(new I.File(null,i)):"node"===t&&"filelist"===I.typeOf(i.files)?I.each(i.files,e):"array"===t&&(n=null,I.each(i,e))}(e),a.length&&I.inSeries(a,function(){o.length&&s.trigger("FilesAdded",o)})},removeFile:function(e){for(var t="string"==typeof e?e:e.id,i=l.length-1;0<=i;i--)if(l[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var e=l.splice(e===S?0:e,t===S?l.length:t),i=!1;return this.state==F.STARTED&&(F.each(e,function(e){if(e.status===F.UPLOADING)return!(i=!0)}),i)&&this.stop(),this.trigger("FilesRemoved",e),F.each(e,function(e){e.destroy()}),i&&this.start(),e},dispatchEvent:function(e){var t,i;if(e=e.toLowerCase(),t=this.hasEventListener(e)){t.sort(function(e,t){return t.priority-e.priority}),(i=[].slice.call(arguments)).shift(),i.unshift(this);for(var n=0;n<t.length;n++)if(!1===t[n].fn.apply(t[n].scope,i))return!1}return!0},bind:function(e,t,i,n){F.Uploader.prototype.bind.call(this,e,t,n,i)},destroy:function(){this.trigger("Destroy"),u=n=null,this.unbindAll()}})},F.Uploader.prototype=I.EventTarget.instance,F.File=(t={},function(e){F.extend(this,{id:F.guid(),name:e.name||e.fileName,type:e.type||"",size:e.size||e.fileSize,origSize:e.size||e.fileSize,loaded:0,percent:0,status:F.QUEUED,lastModifiedDate:e.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return-1!==I.inArray(I.typeOf(e),["blob","file"])?e:null},getSource:function(){return t[this.id]||null},destroy:function(){var e=this.getSource();e&&(e.destroy(),delete t[this.id])}}),t[this.id]=e}),F.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=F}(window,mOxie); plupload/wp-plupload.min.js 0000644 00000013624 15125140777 0011767 0 ustar 00 window.wp=window.wp||{},function(e,l){var u;"undefined"!=typeof _wpPluploadSettings&&(l.extend(u=function(e){var n,t,i,p,d=this,a={container:"container",browser:"browse_button",dropzone:"drop_element"},s={};if(this.supports={upload:u.browser.supported},this.supported=this.supports.upload,this.supported){for(t in this.plupload=l.extend(!0,{multipart_params:{}},u.defaults),this.container=document.body,l.extend(!0,this,e),this)"function"==typeof this[t]&&(this[t]=l.proxy(this[t],this));for(t in a)this[t]&&(this[t]=l(this[t]).first(),this[t].length?(this[t].prop("id")||this[t].prop("id","__wp-uploader-id-"+u.uuid++),this.plupload[a[t]]=this[t].prop("id")):delete this[t]);(this.browser&&this.browser.length||this.dropzone&&this.dropzone.length)&&(this.uploader=new plupload.Uploader(this.plupload),delete this.plupload,this.param(this.params||{}),delete this.params,n=function(t,a,r){var e,o;a&&a.responseHeaders&&(o=a.responseHeaders.match(/x-wp-upload-attachment-id:\s*(\d+)/i))&&o[1]?(o=o[1],(e=s[r.id])&&4<e?(l.ajax({type:"post",url:ajaxurl,dataType:"json",data:{action:"media-create-image-subsizes",_wpnonce:_wpPluploadSettings.defaults.multipart_params._wpnonce,attachment_id:o,_wp_upload_failed_cleanup:!0}}),i(t,a,r,"no-retry")):(s[r.id]=e?++e:1,l.ajax({type:"post",url:ajaxurl,dataType:"json",data:{action:"media-create-image-subsizes",_wpnonce:_wpPluploadSettings.defaults.multipart_params._wpnonce,attachment_id:o}}).done(function(e){e.success?p(d.uploader,r,e):(e.data&&e.data.message&&(t=e.data.message),i(t,a,r,"no-retry"))}).fail(function(e){500<=e.status&&e.status<600?n(t,a,r):i(t,a,r,"no-retry")}))):i(pluploadL10n.http_error_image,a,r,"no-retry")},i=function(e,t,a,r){var o=a.type&&0===a.type.indexOf("image/"),i=t&&t.status;"no-retry"!==r&&o&&500<=i&&i<600?n(e,t,a):(a.attachment&&a.attachment.destroy(),u.errors.unshift({message:e||pluploadL10n.default_error,data:t,file:a}),d.error(e,t,a))},p=function(e,t,a){_.each(["file","loaded","size","percent"],function(e){t.attachment.unset(e)}),t.attachment.set(_.extend(a.data,{uploading:!1})),wp.media.model.Attachment.get(a.data.id,t.attachment),u.queue.all(function(e){return!e.get("uploading")})&&u.queue.reset(),d.success(t.attachment)},this.uploader.bind("init",function(e){var t,a,r=d.dropzone,e=d.supports.dragdrop=e.features.dragdrop&&!u.browser.mobile;if(r){if(r.toggleClass("supports-drag-drop",!!e),!e)return r.unbind(".wp-uploader");r.on("dragover.wp-uploader",function(){t&&clearTimeout(t),a||(r.trigger("dropzone:enter").addClass("drag-over"),a=!0)}),r.on("dragleave.wp-uploader, drop.wp-uploader",function(){t=setTimeout(function(){a=!1,r.trigger("dropzone:leave").removeClass("drag-over")},0)}),d.ready=!0,l(d).trigger("uploader:ready")}}),this.uploader.bind("postinit",function(e){e.refresh(),d.init()}),this.uploader.init(),this.browser?this.browser.on("mouseenter",this.refresh):this.uploader.disableBrowse(!0),l(d).on("uploader:ready",function(){l('.moxie-shim-html5 input[type="file"]').attr({tabIndex:"-1","aria-hidden":"true"})}),this.uploader.bind("FilesAdded",function(r,e){_.each(e,function(e){var t,a;if(plupload.FAILED!==e.status){if("image/heic"===e.type&&r.settings.heic_upload_error)u.errors.unshift({message:pluploadL10n.unsupported_image,data:{},file:e});else{if("image/webp"===e.type&&r.settings.webp_upload_error)return i(pluploadL10n.noneditable_image,{},e,"no-retry"),void r.removeFile(e);if("image/avif"===e.type&&r.settings.avif_upload_error)return i(pluploadL10n.noneditable_image,{},e,"no-retry"),void r.removeFile(e)}t=_.extend({file:e,uploading:!0,date:new Date,filename:e.name,menuOrder:0,uploadedTo:wp.media.model.settings.post.id},_.pick(e,"loaded","size","percent")),(a=/(?:jpe?g|png|gif)$/i.exec(e.name))&&(t.type="image",t.subtype="jpg"===a[0]?"jpeg":a[0]),e.attachment=wp.media.model.Attachment.create(t),u.queue.add(e.attachment),d.added(e.attachment)}}),r.refresh(),r.start()}),this.uploader.bind("UploadProgress",function(e,t){t.attachment.set(_.pick(t,"loaded","percent")),d.progress(t.attachment)}),this.uploader.bind("FileUploaded",function(e,t,a){try{a=JSON.parse(a.response)}catch(e){return i(pluploadL10n.default_error,e,t)}return!_.isObject(a)||_.isUndefined(a.success)?i(pluploadL10n.default_error,null,t):a.success?void p(e,t,a):i(a.data&&a.data.message,a.data,t)}),this.uploader.bind("Error",function(e,t){var a,r=pluploadL10n.default_error;for(a in u.errorMap)if(t.code===plupload[a]){"function"==typeof(r=u.errorMap[a])&&(r=r(t.file,t));break}i(r,t,t.file),e.refresh()}))}},_wpPluploadSettings),u.uuid=0,u.errorMap={FAILED:pluploadL10n.upload_failed,FILE_EXTENSION_ERROR:pluploadL10n.invalid_filetype,IMAGE_FORMAT_ERROR:pluploadL10n.not_an_image,IMAGE_MEMORY_ERROR:pluploadL10n.image_memory_exceeded,IMAGE_DIMENSIONS_ERROR:pluploadL10n.image_dimensions_exceeded,GENERIC_ERROR:pluploadL10n.upload_failed,IO_ERROR:pluploadL10n.io_error,SECURITY_ERROR:pluploadL10n.security_error,FILE_SIZE_ERROR:function(e){return pluploadL10n.file_exceeds_size_limit.replace("%s",e.name)},HTTP_ERROR:function(e){return e.type&&0===e.type.indexOf("image/")?pluploadL10n.http_error_image:pluploadL10n.http_error}},l.extend(u.prototype,{param:function(e,t){if(1===arguments.length&&"string"==typeof e)return this.uploader.settings.multipart_params[e];1<arguments.length?this.uploader.settings.multipart_params[e]=t:l.extend(this.uploader.settings.multipart_params,e)},init:function(){},error:function(){},success:function(){},added:function(){},progress:function(){},complete:function(){},refresh:function(){var e,t,a;if(this.browser){for(e=this.browser[0];e;){if(e===document.body){t=!0;break}e=e.parentNode}t||(a="wp-uploader-browser-"+this.uploader.id,(a=(a=l("#"+a)).length?a:l('<div class="wp-uploader-browser" />').css({position:"fixed",top:"-1000px",left:"-1000px",height:0,width:0}).attr("id","wp-uploader-browser-"+this.uploader.id).appendTo("body")).append(this.browser))}this.uploader.refresh()}}),u.queue=new wp.media.model.Attachments([],{query:!1}),u.errors=new Backbone.Collection,e.Uploader=u)}(wp,jQuery); plupload/moxie.js 0000644 00000760606 15125140777 0010073 0 ustar 00 ;var MXI_DEBUG = false; /** * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill * v1.3.5.1 * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing * * Date: 2016-05-15 */ /** * Compiled inline version. (Library mode) */ /** * Modified for WordPress. * - Silverlight and Flash runtimes support was removed. See https://core.trac.wordpress.org/ticket/41755. * - A stray Unicode character has been removed. See https://core.trac.wordpress.org/ticket/59329. * * This is a de-facto fork of the mOxie library that will be maintained by WordPress due to upstream license changes * that are incompatible with the GPL. */ /*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */ /*globals $code */ (function(exports, undefined) { "use strict"; var modules = {}; function require(ids, callback) { var module, defs = []; for (var i = 0; i < ids.length; ++i) { module = modules[ids[i]] || resolve(ids[i]); if (!module) { throw 'module definition dependecy not found: ' + ids[i]; } defs.push(module); } callback.apply(null, defs); } function define(id, dependencies, definition) { if (typeof id !== 'string') { throw 'invalid module definition, module id must be defined and be a string'; } if (dependencies === undefined) { throw 'invalid module definition, dependencies must be specified'; } if (definition === undefined) { throw 'invalid module definition, definition function must be specified'; } require(dependencies, function() { modules[id] = definition.apply(null, arguments); }); } function defined(id) { return !!modules[id]; } function resolve(id) { var target = exports; var fragments = id.split(/[.\/]/); for (var fi = 0; fi < fragments.length; ++fi) { if (!target[fragments[fi]]) { return; } target = target[fragments[fi]]; } return target; } function expose(ids) { for (var i = 0; i < ids.length; i++) { var target = exports; var id = ids[i]; var fragments = id.split(/[.\/]/); for (var fi = 0; fi < fragments.length - 1; ++fi) { if (target[fragments[fi]] === undefined) { target[fragments[fi]] = {}; } target = target[fragments[fi]]; } target[fragments[fragments.length - 1]] = modules[id]; } } // Included from: src/javascript/core/utils/Basic.js /** * Basic.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Basic', [], function() { /** Gets the true type of the built-in object (better version of typeof). @author Angus Croll (http://javascriptweblog.wordpress.com/) @method typeOf @for Utils @static @param {Object} o Object to check. @return {String} Object [[Class]] */ var typeOf = function(o) { var undef; if (o === undef) { return 'undefined'; } else if (o === null) { return 'null'; } else if (o.nodeType) { return 'node'; } // the snippet below is awesome, however it fails to detect null, undefined and arguments types in IE lte 8 return ({}).toString.call(o).match(/\s([a-z|A-Z]+)/)[1].toLowerCase(); }; /** Extends the specified object with another object. @method extend @static @param {Object} target Object to extend. @param {Object} [obj]* Multiple objects to extend with. @return {Object} Same as target, the extended object. */ var extend = function(target) { var undef; each(arguments, function(arg, i) { if (i > 0) { each(arg, function(value, key) { if (value !== undef) { if (typeOf(target[key]) === typeOf(value) && !!~inArray(typeOf(value), ['array', 'object'])) { extend(target[key], value); } else { target[key] = value; } } }); } }); return target; }; /** Executes the callback function for each item in array/object. If you return false in the callback it will break the loop. @method each @static @param {Object} obj Object to iterate. @param {function} callback Callback function to execute for each item. */ var each = function(obj, callback) { var length, key, i, undef; if (obj) { if (typeOf(obj.length) === 'number') { // it might be Array, FileList or even arguments object // Loop array items for (i = 0, length = obj.length; i < length; i++) { if (callback(obj[i], i) === false) { return; } } } else if (typeOf(obj) === 'object') { // Loop object items for (key in obj) { if (obj.hasOwnProperty(key)) { if (callback(obj[key], key) === false) { return; } } } } } }; /** Checks if object is empty. @method isEmptyObj @static @param {Object} o Object to check. @return {Boolean} */ var isEmptyObj = function(obj) { var prop; if (!obj || typeOf(obj) !== 'object') { return true; } for (prop in obj) { return false; } return true; }; /** Recieve an array of functions (usually async) to call in sequence, each function receives a callback as first argument that it should call, when it completes. Finally, after everything is complete, main callback is called. Passing truthy value to the callback as a first argument will interrupt the sequence and invoke main callback immediately. @method inSeries @static @param {Array} queue Array of functions to call in sequence @param {Function} cb Main callback that is called in the end, or in case of error */ var inSeries = function(queue, cb) { var i = 0, length = queue.length; if (typeOf(cb) !== 'function') { cb = function() {}; } if (!queue || !queue.length) { cb(); } function callNext(i) { if (typeOf(queue[i]) === 'function') { queue[i](function(error) { /*jshint expr:true */ ++i < length && !error ? callNext(i) : cb(error); }); } } callNext(i); }; /** Recieve an array of functions (usually async) to call in parallel, each function receives a callback as first argument that it should call, when it completes. After everything is complete, main callback is called. Passing truthy value to the callback as a first argument will interrupt the process and invoke main callback immediately. @method inParallel @static @param {Array} queue Array of functions to call in sequence @param {Function} cb Main callback that is called in the end, or in case of error */ var inParallel = function(queue, cb) { var count = 0, num = queue.length, cbArgs = new Array(num); each(queue, function(fn, i) { fn(function(error) { if (error) { return cb(error); } var args = [].slice.call(arguments); args.shift(); // strip error - undefined or not cbArgs[i] = args; count++; if (count === num) { cbArgs.unshift(null); cb.apply(this, cbArgs); } }); }); }; /** Find an element in array and return it's index if present, otherwise return -1. @method inArray @static @param {Mixed} needle Element to find @param {Array} array @return {Int} Index of the element, or -1 if not found */ var inArray = function(needle, array) { if (array) { if (Array.prototype.indexOf) { return Array.prototype.indexOf.call(array, needle); } for (var i = 0, length = array.length; i < length; i++) { if (array[i] === needle) { return i; } } } return -1; }; /** Returns elements of first array if they are not present in second. And false - otherwise. @private @method arrayDiff @param {Array} needles @param {Array} array @return {Array|Boolean} */ var arrayDiff = function(needles, array) { var diff = []; if (typeOf(needles) !== 'array') { needles = [needles]; } if (typeOf(array) !== 'array') { array = [array]; } for (var i in needles) { if (inArray(needles[i], array) === -1) { diff.push(needles[i]); } } return diff.length ? diff : false; }; /** Find intersection of two arrays. @private @method arrayIntersect @param {Array} array1 @param {Array} array2 @return {Array} Intersection of two arrays or null if there is none */ var arrayIntersect = function(array1, array2) { var result = []; each(array1, function(item) { if (inArray(item, array2) !== -1) { result.push(item); } }); return result.length ? result : null; }; /** Forces anything into an array. @method toArray @static @param {Object} obj Object with length field. @return {Array} Array object containing all items. */ var toArray = function(obj) { var i, arr = []; for (i = 0; i < obj.length; i++) { arr[i] = obj[i]; } return arr; }; /** Generates an unique ID. The only way a user would be able to get the same ID is if the two persons at the same exact millisecond manage to get the same 5 random numbers between 0-65535; it also uses a counter so each ID is guaranteed to be unique for the given page. It is more probable for the earth to be hit with an asteroid. @method guid @static @param {String} prefix to prepend (by default 'o' will be prepended). @method guid @return {String} Virtually unique id. */ var guid = (function() { var counter = 0; return function(prefix) { var guid = new Date().getTime().toString(32), i; for (i = 0; i < 5; i++) { guid += Math.floor(Math.random() * 65535).toString(32); } return (prefix || 'o_') + guid + (counter++).toString(32); }; }()); /** Trims white spaces around the string @method trim @static @param {String} str @return {String} */ var trim = function(str) { if (!str) { return str; } return String.prototype.trim ? String.prototype.trim.call(str) : str.toString().replace(/^\s*/, '').replace(/\s*$/, ''); }; /** Parses the specified size string into a byte value. For example 10kb becomes 10240. @method parseSizeStr @static @param {String/Number} size String to parse or number to just pass through. @return {Number} Size in bytes. */ var parseSizeStr = function(size) { if (typeof(size) !== 'string') { return size; } var muls = { t: 1099511627776, g: 1073741824, m: 1048576, k: 1024 }, mul; size = /^([0-9\.]+)([tmgk]?)$/.exec(size.toLowerCase().replace(/[^0-9\.tmkg]/g, '')); mul = size[2]; size = +size[1]; if (muls.hasOwnProperty(mul)) { size *= muls[mul]; } return Math.floor(size); }; /** * Pseudo sprintf implementation - simple way to replace tokens with specified values. * * @param {String} str String with tokens * @return {String} String with replaced tokens */ var sprintf = function(str) { var args = [].slice.call(arguments, 1); return str.replace(/%[a-z]/g, function() { var value = args.shift(); return typeOf(value) !== 'undefined' ? value : ''; }); }; return { guid: guid, typeOf: typeOf, extend: extend, each: each, isEmptyObj: isEmptyObj, inSeries: inSeries, inParallel: inParallel, inArray: inArray, arrayDiff: arrayDiff, arrayIntersect: arrayIntersect, toArray: toArray, trim: trim, sprintf: sprintf, parseSizeStr: parseSizeStr }; }); // Included from: src/javascript/core/utils/Env.js /** * Env.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/core/utils/Env", [ "moxie/core/utils/Basic" ], function(Basic) { /** * UAParser.js v0.7.7 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2015 Faisal Salman <fyzlman@gmail.com> * Dual licensed under GPLv2 & MIT */ var UAParser = (function (undefined) { ////////////// // Constants ///////////// var EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', UNDEF_TYPE = 'undefined', OBJ_TYPE = 'object', MAJOR = 'major', MODEL = 'model', NAME = 'name', TYPE = 'type', VENDOR = 'vendor', VERSION = 'version', ARCHITECTURE= 'architecture', CONSOLE = 'console', MOBILE = 'mobile', TABLET = 'tablet'; /////////// // Helper ////////// var util = { has : function (str1, str2) { return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1; }, lowerize : function (str) { return str.toLowerCase(); } }; /////////////// // Map helper ////////////// var mapper = { rgx : function () { // loop through all regexes maps for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) { var regex = args[i], // even sequence (0,2,4,..) props = args[i + 1]; // odd sequence (1,3,5,..) // construct object barebones if (typeof(result) === UNDEF_TYPE) { result = {}; for (p in props) { q = props[p]; if (typeof(q) === OBJ_TYPE) { result[q[0]] = undefined; } else { result[q] = undefined; } } } // try matching uastring with regexes for (j = k = 0; j < regex.length; j++) { matches = regex[j].exec(this.getUA()); if (!!matches) { for (p = 0; p < props.length; p++) { match = matches[++k]; q = props[p]; // check if given property is actually array if (typeof(q) === OBJ_TYPE && q.length > 0) { if (q.length == 2) { if (typeof(q[1]) == FUNC_TYPE) { // assign modified match result[q[0]] = q[1].call(this, match); } else { // assign given value, ignore regex match result[q[0]] = q[1]; } } else if (q.length == 3) { // check whether function or regex if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) { // call function (usually string mapper) result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined; } else { // sanitize match using given regex result[q[0]] = match ? match.replace(q[1], q[2]) : undefined; } } else if (q.length == 4) { result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined; } } else { result[q] = match ? match : undefined; } } break; } } if(!!matches) break; // break the loop immediately if match found } return result; }, str : function (str, map) { for (var i in map) { // check if array if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) { for (var j = 0; j < map[i].length; j++) { if (util.has(map[i][j], str)) { return (i === UNKNOWN) ? undefined : i; } } } else if (util.has(map[i], str)) { return (i === UNKNOWN) ? undefined : i; } } return str; } }; /////////////// // String map ////////////// var maps = { browser : { oldsafari : { major : { '1' : ['/8', '/1', '/3'], '2' : '/4', '?' : '/' }, version : { '1.0' : '/8', '1.2' : '/1', '1.3' : '/3', '2.0' : '/412', '2.0.2' : '/416', '2.0.3' : '/417', '2.0.4' : '/419', '?' : '/' } } }, device : { sprint : { model : { 'Evo Shift 4G' : '7373KT' }, vendor : { 'HTC' : 'APA', 'Sprint' : 'Sprint' } } }, os : { windows : { version : { 'ME' : '4.90', 'NT 3.11' : 'NT3.51', 'NT 4.0' : 'NT4.0', '2000' : 'NT 5.0', 'XP' : ['NT 5.1', 'NT 5.2'], 'Vista' : 'NT 6.0', '7' : 'NT 6.1', '8' : 'NT 6.2', '8.1' : 'NT 6.3', 'RT' : 'ARM' } } } }; ////////////// // Regex map ///////////// var regexes = { browser : [[ // Presto based /(opera\smini)\/([\w\.-]+)/i, // Opera Mini /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, // Opera Mobi/Tablet /(opera).+version\/([\w\.]+)/i, // Opera > 9.80 /(opera)[\/\s]+([\w\.]+)/i // Opera < 9.80 ], [NAME, VERSION], [ /\s(opr)\/([\w\.]+)/i // Opera Webkit ], [[NAME, 'Opera'], VERSION], [ // Mixed /(kindle)\/([\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer // Trident based /(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser/Baidu /(?:ms|\()(ie)\s([\w\.]+)/i, // Internet Explorer // Webkit/KHTML based /(rekonq)\/([\w\.]+)*/i, // Rekonq /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron ], [NAME, VERSION], [ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ /(edge)\/((\d+)?[\w\.]+)/i // Microsoft Edge ], [NAME, VERSION], [ /(yabrowser)\/([\w\.]+)/i // Yandex ], [[NAME, 'Yandex'], VERSION], [ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, ' '], VERSION], [ /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i, // Chrome/OmniWeb/Arora/Tizen/Nokia /(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i // UCBrowser/QQBrowser ], [NAME, VERSION], [ /(dolfin)\/([\w\.]+)/i // Dolphin ], [[NAME, 'Dolphin'], VERSION], [ /((?:android.+)crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [[NAME, 'Chrome'], VERSION], [ /XiaoMi\/MiuiBrowser\/([\w\.]+)/i // MIUI Browser ], [VERSION, [NAME, 'MIUI Browser']], [ /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i // Android Browser ], [VERSION, [NAME, 'Android Browser']], [ /FBAV\/([\w\.]+);/i // Facebook App for iOS ], [VERSION, [NAME, 'Facebook']], [ /version\/([\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari ], [VERSION, [NAME, 'Mobile Safari']], [ /version\/([\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile ], [VERSION, NAME], [ /webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [NAME, [VERSION, mapper.str, maps.browser.oldsafari.version]], [ /(konqueror)\/([\w\.]+)/i, // Konqueror /(webkit|khtml)\/([\w\.]+)/i ], [NAME, VERSION], [ // Gecko based /(navigator|netscape)\/([\w\.-]+)/i // Netscape ], [[NAME, 'Netscape'], VERSION], [ /(swiftfox)/i, // Swiftfox /(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i, // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i, // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix /(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla // Other /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i, // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf /(links)\s\(([\w\.]+)/i, // Links /(gobrowser)\/?([\w\.]+)*/i, // GoBrowser /(ice\s?browser)\/v?([\w\._]+)/i, // ICE Browser /(mosaic)[\/\s]([\w\.]+)/i // Mosaic ], [NAME, VERSION] ], engine : [[ /windows.+\sedge\/([\w\.]+)/i // EdgeHTML ], [VERSION, [NAME, 'EdgeHTML']], [ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links /(icab)[\/\s]([23]\.[\d\.]+)/i // iCab ], [NAME, VERSION], [ /rv\:([\w\.]+).*(gecko)/i // Gecko ], [VERSION, NAME] ], os : [[ // Windows based /microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes) ], [NAME, VERSION], [ /(windows)\snt\s6\.2;\s(arm)/i, // Windows RT /(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i ], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [ /(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i ], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [ // Mobile/Embedded OS /\((bb)(10);/i // BlackBerry 10 ], [[NAME, 'BlackBerry'], VERSION], [ /(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry /(tizen)[\/\s]([\w\.]+)/i, // Tizen /(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i, // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki /linux;.+(sailfish);/i // Sailfish OS ], [NAME, VERSION], [ /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian ], [[NAME, 'Symbian'], VERSION], [ /\((series40);/i // Series 40 ], [NAME], [ /mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS ], [[NAME, 'Firefox OS'], VERSION], [ // Console /(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation // GNU/Linux based /(mint)[\/\s\(]?(\w+)*/i, // Mint /(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i, // Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware // Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus /(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux /(gnu)\s?([\w\.]+)*/i // GNU ], [NAME, VERSION], [ /(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS ], [[NAME, 'Chromium OS'], VERSION],[ // Solaris /(sunos)\s?([\w\.]+\d)*/i // Solaris ], [[NAME, 'Solaris'], VERSION], [ // BSD based /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly ], [NAME, VERSION],[ /(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS ], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [ /(mac\sos\sx)\s?([\w\s\.]+\w)*/i, /(macintosh|mac(?=_powerpc)\s)/i // Mac OS ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [ // Other /((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, // Solaris /(haiku)\s(\w+)/i, // Haiku /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS /(unix)\s?([\w\.]+)*/i // UNIX ], [NAME, VERSION] ] }; ///////////////// // Constructor //////////////// var UAParser = function (uastring) { var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY); this.getBrowser = function () { return mapper.rgx.apply(this, regexes.browser); }; this.getEngine = function () { return mapper.rgx.apply(this, regexes.engine); }; this.getOS = function () { return mapper.rgx.apply(this, regexes.os); }; this.getResult = function() { return { ua : this.getUA(), browser : this.getBrowser(), engine : this.getEngine(), os : this.getOS() }; }; this.getUA = function () { return ua; }; this.setUA = function (uastring) { ua = uastring; return this; }; this.setUA(ua); }; return UAParser; })(); function version_compare(v1, v2, operator) { // From: http://phpjs.org/functions // + original by: Philippe Jausions (http://pear.php.net/user/jausions) // + original by: Aidan Lister (http://aidanlister.com/) // + reimplemented by: Kankrelune (http://www.webfaktory.info/) // + improved by: Brett Zamir (http://brett-zamir.me) // + improved by: Scott Baker // + improved by: Theriault // * example 1: version_compare('8.2.5rc', '8.2.5a'); // * returns 1: 1 // * example 2: version_compare('8.2.50', '8.2.52', '<'); // * returns 2: true // * example 3: version_compare('5.3.0-dev', '5.3.0'); // * returns 3: -1 // * example 4: version_compare('4.1.0.52','4.01.0.51'); // * returns 4: 1 // Important: compare must be initialized at 0. var i = 0, x = 0, compare = 0, // vm maps textual PHP versions to negatives so they're less than 0. // PHP currently defines these as CASE-SENSITIVE. It is important to // leave these as negatives so that they can come before numerical versions // and as if no letters were there to begin with. // (1alpha is < 1 and < 1.1 but > 1dev1) // If a non-numerical value can't be mapped to this table, it receives // -7 as its value. vm = { 'dev': -6, 'alpha': -5, 'a': -5, 'beta': -4, 'b': -4, 'RC': -3, 'rc': -3, '#': -2, 'p': 1, 'pl': 1 }, // This function will be called to prepare each version argument. // It replaces every _, -, and + with a dot. // It surrounds any nonsequence of numbers/dots with dots. // It replaces sequences of dots with a single dot. // version_compare('4..0', '4.0') == 0 // Important: A string of 0 length needs to be converted into a value // even less than an unexisting value in vm (-7), hence [-8]. // It's also important to not strip spaces because of this. // version_compare('', ' ') == 1 prepVersion = function (v) { v = ('' + v).replace(/[_\-+]/g, '.'); v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.'); return (!v.length ? [-8] : v.split('.')); }, // This converts a version component to a number. // Empty component becomes 0. // Non-numerical component becomes a negative number. // Numerical component becomes itself as an integer. numVersion = function (v) { return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10)); }; v1 = prepVersion(v1); v2 = prepVersion(v2); x = Math.max(v1.length, v2.length); for (i = 0; i < x; i++) { if (v1[i] == v2[i]) { continue; } v1[i] = numVersion(v1[i]); v2[i] = numVersion(v2[i]); if (v1[i] < v2[i]) { compare = -1; break; } else if (v1[i] > v2[i]) { compare = 1; break; } } if (!operator) { return compare; } // Important: operator is CASE-SENSITIVE. // "No operator" seems to be treated as "<." // Any other values seem to make the function return null. switch (operator) { case '>': case 'gt': return (compare > 0); case '>=': case 'ge': return (compare >= 0); case '<=': case 'le': return (compare <= 0); case '==': case '=': case 'eq': return (compare === 0); case '<>': case '!=': case 'ne': return (compare !== 0); case '': case '<': case 'lt': return (compare < 0); default: return null; } } var can = (function() { var caps = { define_property: (function() { /* // currently too much extra code required, not exactly worth it try { // as of IE8, getters/setters are supported only on DOM elements var obj = {}; if (Object.defineProperty) { Object.defineProperty(obj, 'prop', { enumerable: true, configurable: true }); return true; } } catch(ex) {} if (Object.prototype.__defineGetter__ && Object.prototype.__defineSetter__) { return true; }*/ return false; }()), create_canvas: (function() { // On the S60 and BB Storm, getContext exists, but always returns undefined // so we actually have to call getContext() to verify // github.com/Modernizr/Modernizr/issues/issue/97/ var el = document.createElement('canvas'); return !!(el.getContext && el.getContext('2d')); }()), return_response_type: function(responseType) { try { if (Basic.inArray(responseType, ['', 'text', 'document']) !== -1) { return true; } else if (window.XMLHttpRequest) { var xhr = new XMLHttpRequest(); xhr.open('get', '/'); // otherwise Gecko throws an exception if ('responseType' in xhr) { xhr.responseType = responseType; // as of 23.0.1271.64, Chrome switched from throwing exception to merely logging it to the console (why? o why?) if (xhr.responseType !== responseType) { return false; } return true; } } } catch (ex) {} return false; }, // ideas for this heavily come from Modernizr (http://modernizr.com/) use_data_uri: (function() { var du = new Image(); du.onload = function() { caps.use_data_uri = (du.width === 1 && du.height === 1); }; setTimeout(function() { du.src = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="; }, 1); return false; }()), use_data_uri_over32kb: function() { // IE8 return caps.use_data_uri && (Env.browser !== 'IE' || Env.version >= 9); }, use_data_uri_of: function(bytes) { return (caps.use_data_uri && bytes < 33000 || caps.use_data_uri_over32kb()); }, use_fileinput: function() { if (navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/)) { return false; } var el = document.createElement('input'); el.setAttribute('type', 'file'); return !el.disabled; } }; return function(cap) { var args = [].slice.call(arguments); args.shift(); // shift of cap return Basic.typeOf(caps[cap]) === 'function' ? caps[cap].apply(this, args) : !!caps[cap]; }; }()); var uaResult = new UAParser().getResult(); var Env = { can: can, uaParser: UAParser, browser: uaResult.browser.name, version: uaResult.browser.version, os: uaResult.os.name, // everybody intuitively types it in a lowercase for some reason osVersion: uaResult.os.version, verComp: version_compare, global_event_dispatcher: "moxie.core.EventTarget.instance.dispatchEvent" }; // for backward compatibility // @deprecated Use `Env.os` instead Env.OS = Env.os; if (MXI_DEBUG) { Env.debug = { runtime: true, events: false }; Env.log = function() { function logObj(data) { // TODO: this should recursively print out the object in a pretty way console.appendChild(document.createTextNode(data + "\n")); } var data = arguments[0]; if (Basic.typeOf(data) === 'string') { data = Basic.sprintf.apply(this, arguments); } if (window && window.console && window.console.log) { window.console.log(data); } else if (document) { var console = document.getElementById('moxie-console'); if (!console) { console = document.createElement('pre'); console.id = 'moxie-console'; //console.style.display = 'none'; document.body.appendChild(console); } if (Basic.inArray(Basic.typeOf(data), ['object', 'array']) !== -1) { logObj(data); } else { console.appendChild(document.createTextNode(data + "\n")); } } }; } return Env; }); // Included from: src/javascript/core/I18n.js /** * I18n.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/core/I18n", [ "moxie/core/utils/Basic" ], function(Basic) { var i18n = {}; return { /** * Extends the language pack object with new items. * * @param {Object} pack Language pack items to add. * @return {Object} Extended language pack object. */ addI18n: function(pack) { return Basic.extend(i18n, pack); }, /** * Translates the specified string by checking for the english string in the language pack lookup. * * @param {String} str String to look for. * @return {String} Translated string or the input string if it wasn't found. */ translate: function(str) { return i18n[str] || str; }, /** * Shortcut for translate function * * @param {String} str String to look for. * @return {String} Translated string or the input string if it wasn't found. */ _: function(str) { return this.translate(str); }, /** * Pseudo sprintf implementation - simple way to replace tokens with specified values. * * @param {String} str String with tokens * @return {String} String with replaced tokens */ sprintf: function(str) { var args = [].slice.call(arguments, 1); return str.replace(/%[a-z]/g, function() { var value = args.shift(); return Basic.typeOf(value) !== 'undefined' ? value : ''; }); } }; }); // Included from: src/javascript/core/utils/Mime.js /** * Mime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/core/utils/Mime", [ "moxie/core/utils/Basic", "moxie/core/I18n" ], function(Basic, I18n) { var mimeData = "" + "application/msword,doc dot," + "application/pdf,pdf," + "application/pgp-signature,pgp," + "application/postscript,ps ai eps," + "application/rtf,rtf," + "application/vnd.ms-excel,xls xlb," + "application/vnd.ms-powerpoint,ppt pps pot," + "application/zip,zip," + "application/x-shockwave-flash,swf swfl," + "application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx," + "application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx," + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx," + "application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx," + "application/vnd.openxmlformats-officedocument.presentationml.template,potx," + "application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx," + "application/x-javascript,js," + "application/json,json," + "audio/mpeg,mp3 mpga mpega mp2," + "audio/x-wav,wav," + "audio/x-m4a,m4a," + "audio/ogg,oga ogg," + "audio/aiff,aiff aif," + "audio/flac,flac," + "audio/aac,aac," + "audio/ac3,ac3," + "audio/x-ms-wma,wma," + "image/bmp,bmp," + "image/gif,gif," + "image/jpeg,jpg jpeg jpe," + "image/photoshop,psd," + "image/png,png," + "image/svg+xml,svg svgz," + "image/tiff,tiff tif," + "text/plain,asc txt text diff log," + "text/html,htm html xhtml," + "text/css,css," + "text/csv,csv," + "text/rtf,rtf," + "video/mpeg,mpeg mpg mpe m2v," + "video/quicktime,qt mov," + "video/mp4,mp4," + "video/x-m4v,m4v," + "video/x-flv,flv," + "video/x-ms-wmv,wmv," + "video/avi,avi," + "video/webm,webm," + "video/3gpp,3gpp 3gp," + "video/3gpp2,3g2," + "video/vnd.rn-realvideo,rv," + "video/ogg,ogv," + "video/x-matroska,mkv," + "application/vnd.oasis.opendocument.formula-template,otf," + "application/octet-stream,exe"; var Mime = { mimes: {}, extensions: {}, // Parses the default mime types string into a mimes and extensions lookup maps addMimeType: function (mimeData) { var items = mimeData.split(/,/), i, ii, ext; for (i = 0; i < items.length; i += 2) { ext = items[i + 1].split(/ /); // extension to mime lookup for (ii = 0; ii < ext.length; ii++) { this.mimes[ext[ii]] = items[i]; } // mime to extension lookup this.extensions[items[i]] = ext; } }, extList2mimes: function (filters, addMissingExtensions) { var self = this, ext, i, ii, type, mimes = []; // convert extensions to mime types list for (i = 0; i < filters.length; i++) { ext = filters[i].extensions.split(/\s*,\s*/); for (ii = 0; ii < ext.length; ii++) { // if there's an asterisk in the list, then accept attribute is not required if (ext[ii] === '*') { return []; } type = self.mimes[ext[ii]]; if (type && Basic.inArray(type, mimes) === -1) { mimes.push(type); } // future browsers should filter by extension, finally if (addMissingExtensions && /^\w+$/.test(ext[ii])) { mimes.push('.' + ext[ii]); } else if (!type) { // if we have no type in our map, then accept all return []; } } } return mimes; }, mimes2exts: function(mimes) { var self = this, exts = []; Basic.each(mimes, function(mime) { if (mime === '*') { exts = []; return false; } // check if this thing looks like mime type var m = mime.match(/^(\w+)\/(\*|\w+)$/); if (m) { if (m[2] === '*') { // wildcard mime type detected Basic.each(self.extensions, function(arr, mime) { if ((new RegExp('^' + m[1] + '/')).test(mime)) { [].push.apply(exts, self.extensions[mime]); } }); } else if (self.extensions[mime]) { [].push.apply(exts, self.extensions[mime]); } } }); return exts; }, mimes2extList: function(mimes) { var accept = [], exts = []; if (Basic.typeOf(mimes) === 'string') { mimes = Basic.trim(mimes).split(/\s*,\s*/); } exts = this.mimes2exts(mimes); accept.push({ title: I18n.translate('Files'), extensions: exts.length ? exts.join(',') : '*' }); // save original mimes string accept.mimes = mimes; return accept; }, getFileExtension: function(fileName) { var matches = fileName && fileName.match(/\.([^.]+)$/); if (matches) { return matches[1].toLowerCase(); } return ''; }, getFileMime: function(fileName) { return this.mimes[this.getFileExtension(fileName)] || ''; } }; Mime.addMimeType(mimeData); return Mime; }); // Included from: src/javascript/core/utils/Dom.js /** * Dom.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Dom', ['moxie/core/utils/Env'], function(Env) { /** Get DOM Element by it's id. @method get @for Utils @param {String} id Identifier of the DOM Element @return {DOMElement} */ var get = function(id) { if (typeof id !== 'string') { return id; } return document.getElementById(id); }; /** Checks if specified DOM element has specified class. @method hasClass @static @param {Object} obj DOM element like object to add handler to. @param {String} name Class name */ var hasClass = function(obj, name) { if (!obj.className) { return false; } var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)"); return regExp.test(obj.className); }; /** Adds specified className to specified DOM element. @method addClass @static @param {Object} obj DOM element like object to add handler to. @param {String} name Class name */ var addClass = function(obj, name) { if (!hasClass(obj, name)) { obj.className = !obj.className ? name : obj.className.replace(/\s+$/, '') + ' ' + name; } }; /** Removes specified className from specified DOM element. @method removeClass @static @param {Object} obj DOM element like object to add handler to. @param {String} name Class name */ var removeClass = function(obj, name) { if (obj.className) { var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)"); obj.className = obj.className.replace(regExp, function($0, $1, $2) { return $1 === ' ' && $2 === ' ' ? ' ' : ''; }); } }; /** Returns a given computed style of a DOM element. @method getStyle @static @param {Object} obj DOM element like object. @param {String} name Style you want to get from the DOM element */ var getStyle = function(obj, name) { if (obj.currentStyle) { return obj.currentStyle[name]; } else if (window.getComputedStyle) { return window.getComputedStyle(obj, null)[name]; } }; /** Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields. @method getPos @static @param {Element} node HTML element or element id to get x, y position from. @param {Element} root Optional root element to stop calculations at. @return {object} Absolute position of the specified element object with x, y fields. */ var getPos = function(node, root) { var x = 0, y = 0, parent, doc = document, nodeRect, rootRect; node = node; root = root || doc.body; // Returns the x, y cordinate for an element on IE 6 and IE 7 function getIEPos(node) { var bodyElm, rect, x = 0, y = 0; if (node) { rect = node.getBoundingClientRect(); bodyElm = doc.compatMode === "CSS1Compat" ? doc.documentElement : doc.body; x = rect.left + bodyElm.scrollLeft; y = rect.top + bodyElm.scrollTop; } return { x : x, y : y }; } // Use getBoundingClientRect on IE 6 and IE 7 but not on IE 8 in standards mode if (node && node.getBoundingClientRect && Env.browser === 'IE' && (!doc.documentMode || doc.documentMode < 8)) { nodeRect = getIEPos(node); rootRect = getIEPos(root); return { x : nodeRect.x - rootRect.x, y : nodeRect.y - rootRect.y }; } parent = node; while (parent && parent != root && parent.nodeType) { x += parent.offsetLeft || 0; y += parent.offsetTop || 0; parent = parent.offsetParent; } parent = node.parentNode; while (parent && parent != root && parent.nodeType) { x -= parent.scrollLeft || 0; y -= parent.scrollTop || 0; parent = parent.parentNode; } return { x : x, y : y }; }; /** Returns the size of the specified node in pixels. @method getSize @static @param {Node} node Node to get the size of. @return {Object} Object with a w and h property. */ var getSize = function(node) { return { w : node.offsetWidth || node.clientWidth, h : node.offsetHeight || node.clientHeight }; }; return { get: get, hasClass: hasClass, addClass: addClass, removeClass: removeClass, getStyle: getStyle, getPos: getPos, getSize: getSize }; }); // Included from: src/javascript/core/Exceptions.js /** * Exceptions.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/Exceptions', [ 'moxie/core/utils/Basic' ], function(Basic) { function _findKey(obj, value) { var key; for (key in obj) { if (obj[key] === value) { return key; } } return null; } return { RuntimeError: (function() { var namecodes = { NOT_INIT_ERR: 1, NOT_SUPPORTED_ERR: 9, JS_ERR: 4 }; function RuntimeError(code) { this.code = code; this.name = _findKey(namecodes, code); this.message = this.name + ": RuntimeError " + this.code; } Basic.extend(RuntimeError, namecodes); RuntimeError.prototype = Error.prototype; return RuntimeError; }()), OperationNotAllowedException: (function() { function OperationNotAllowedException(code) { this.code = code; this.name = 'OperationNotAllowedException'; } Basic.extend(OperationNotAllowedException, { NOT_ALLOWED_ERR: 1 }); OperationNotAllowedException.prototype = Error.prototype; return OperationNotAllowedException; }()), ImageError: (function() { var namecodes = { WRONG_FORMAT: 1, MAX_RESOLUTION_ERR: 2, INVALID_META_ERR: 3 }; function ImageError(code) { this.code = code; this.name = _findKey(namecodes, code); this.message = this.name + ": ImageError " + this.code; } Basic.extend(ImageError, namecodes); ImageError.prototype = Error.prototype; return ImageError; }()), FileException: (function() { var namecodes = { NOT_FOUND_ERR: 1, SECURITY_ERR: 2, ABORT_ERR: 3, NOT_READABLE_ERR: 4, ENCODING_ERR: 5, NO_MODIFICATION_ALLOWED_ERR: 6, INVALID_STATE_ERR: 7, SYNTAX_ERR: 8 }; function FileException(code) { this.code = code; this.name = _findKey(namecodes, code); this.message = this.name + ": FileException " + this.code; } Basic.extend(FileException, namecodes); FileException.prototype = Error.prototype; return FileException; }()), DOMException: (function() { var namecodes = { INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 }; function DOMException(code) { this.code = code; this.name = _findKey(namecodes, code); this.message = this.name + ": DOMException " + this.code; } Basic.extend(DOMException, namecodes); DOMException.prototype = Error.prototype; return DOMException; }()), EventException: (function() { function EventException(code) { this.code = code; this.name = 'EventException'; } Basic.extend(EventException, { UNSPECIFIED_EVENT_TYPE_ERR: 0 }); EventException.prototype = Error.prototype; return EventException; }()) }; }); // Included from: src/javascript/core/EventTarget.js /** * EventTarget.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/EventTarget', [ 'moxie/core/utils/Env', 'moxie/core/Exceptions', 'moxie/core/utils/Basic' ], function(Env, x, Basic) { /** Parent object for all event dispatching components and objects @class EventTarget @constructor EventTarget */ function EventTarget() { // hash of event listeners by object uid var eventpool = {}; Basic.extend(this, { /** Unique id of the event dispatcher, usually overriden by children @property uid @type String */ uid: null, /** Can be called from within a child in order to acquire uniqie id in automated manner @method init */ init: function() { if (!this.uid) { this.uid = Basic.guid('uid_'); } }, /** Register a handler to a specific event dispatched by the object @method addEventListener @param {String} type Type or basically a name of the event to subscribe to @param {Function} fn Callback function that will be called when event happens @param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first @param {Object} [scope=this] A scope to invoke event handler in */ addEventListener: function(type, fn, priority, scope) { var self = this, list; // without uid no event handlers can be added, so make sure we got one if (!this.hasOwnProperty('uid')) { this.uid = Basic.guid('uid_'); } type = Basic.trim(type); if (/\s/.test(type)) { // multiple event types were passed for one handler Basic.each(type.split(/\s+/), function(type) { self.addEventListener(type, fn, priority, scope); }); return; } type = type.toLowerCase(); priority = parseInt(priority, 10) || 0; list = eventpool[this.uid] && eventpool[this.uid][type] || []; list.push({fn : fn, priority : priority, scope : scope || this}); if (!eventpool[this.uid]) { eventpool[this.uid] = {}; } eventpool[this.uid][type] = list; }, /** Check if any handlers were registered to the specified event @method hasEventListener @param {String} type Type or basically a name of the event to check @return {Mixed} Returns a handler if it was found and false, if - not */ hasEventListener: function(type) { var list = type ? eventpool[this.uid] && eventpool[this.uid][type] : eventpool[this.uid]; return list ? list : false; }, /** Unregister the handler from the event, or if former was not specified - unregister all handlers @method removeEventListener @param {String} type Type or basically a name of the event @param {Function} [fn] Handler to unregister */ removeEventListener: function(type, fn) { type = type.toLowerCase(); var list = eventpool[this.uid] && eventpool[this.uid][type], i; if (list) { if (fn) { for (i = list.length - 1; i >= 0; i--) { if (list[i].fn === fn) { list.splice(i, 1); break; } } } else { list = []; } // delete event list if it has become empty if (!list.length) { delete eventpool[this.uid][type]; // and object specific entry in a hash if it has no more listeners attached if (Basic.isEmptyObj(eventpool[this.uid])) { delete eventpool[this.uid]; } } } }, /** Remove all event handlers from the object @method removeAllEventListeners */ removeAllEventListeners: function() { if (eventpool[this.uid]) { delete eventpool[this.uid]; } }, /** Dispatch the event @method dispatchEvent @param {String/Object} Type of event or event object to dispatch @param {Mixed} [...] Variable number of arguments to be passed to a handlers @return {Boolean} true by default and false if any handler returned false */ dispatchEvent: function(type) { var uid, list, args, tmpEvt, evt = {}, result = true, undef; if (Basic.typeOf(type) !== 'string') { // we can't use original object directly (because of Silverlight) tmpEvt = type; if (Basic.typeOf(tmpEvt.type) === 'string') { type = tmpEvt.type; if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event evt.total = tmpEvt.total; evt.loaded = tmpEvt.loaded; } evt.async = tmpEvt.async || false; } else { throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR); } } // check if event is meant to be dispatched on an object having specific uid if (type.indexOf('::') !== -1) { (function(arr) { uid = arr[0]; type = arr[1]; }(type.split('::'))); } else { uid = this.uid; } type = type.toLowerCase(); list = eventpool[uid] && eventpool[uid][type]; if (list) { // sort event list by prority list.sort(function(a, b) { return b.priority - a.priority; }); args = [].slice.call(arguments); // first argument will be pseudo-event object args.shift(); evt.type = type; args.unshift(evt); if (MXI_DEBUG && Env.debug.events) { Env.log("Event '%s' fired on %u", evt.type, uid); } // Dispatch event to all listeners var queue = []; Basic.each(list, function(handler) { // explicitly set the target, otherwise events fired from shims do not get it args[0].target = handler.scope; // if event is marked as async, detach the handler if (evt.async) { queue.push(function(cb) { setTimeout(function() { cb(handler.fn.apply(handler.scope, args) === false); }, 1); }); } else { queue.push(function(cb) { cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation }); } }); if (queue.length) { Basic.inSeries(queue, function(err) { result = !err; }); } } return result; }, /** Alias for addEventListener @method bind @protected */ bind: function() { this.addEventListener.apply(this, arguments); }, /** Alias for removeEventListener @method unbind @protected */ unbind: function() { this.removeEventListener.apply(this, arguments); }, /** Alias for removeAllEventListeners @method unbindAll @protected */ unbindAll: function() { this.removeAllEventListeners.apply(this, arguments); }, /** Alias for dispatchEvent @method trigger @protected */ trigger: function() { return this.dispatchEvent.apply(this, arguments); }, /** Handle properties of on[event] type. @method handleEventProps @private */ handleEventProps: function(dispatches) { var self = this; this.bind(dispatches.join(' '), function(e) { var prop = 'on' + e.type.toLowerCase(); if (Basic.typeOf(this[prop]) === 'function') { this[prop].apply(this, arguments); } }); // object must have defined event properties, even if it doesn't make use of them Basic.each(dispatches, function(prop) { prop = 'on' + prop.toLowerCase(prop); if (Basic.typeOf(self[prop]) === 'undefined') { self[prop] = null; } }); } }); } EventTarget.instance = new EventTarget(); return EventTarget; }); // Included from: src/javascript/runtime/Runtime.js /** * Runtime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/runtime/Runtime', [ "moxie/core/utils/Env", "moxie/core/utils/Basic", "moxie/core/utils/Dom", "moxie/core/EventTarget" ], function(Env, Basic, Dom, EventTarget) { var runtimeConstructors = {}, runtimes = {}; /** Common set of methods and properties for every runtime instance @class Runtime @param {Object} options @param {String} type Sanitized name of the runtime @param {Object} [caps] Set of capabilities that differentiate specified runtime @param {Object} [modeCaps] Set of capabilities that do require specific operational mode @param {String} [preferredMode='browser'] Preferred operational mode to choose if no required capabilities were requested */ function Runtime(options, type, caps, modeCaps, preferredMode) { /** Dispatched when runtime is initialized and ready. Results in RuntimeInit on a connected component. @event Init */ /** Dispatched when runtime fails to initialize. Results in RuntimeError on a connected component. @event Error */ var self = this , _shim , _uid = Basic.guid(type + '_') , defaultMode = preferredMode || 'browser' ; options = options || {}; // register runtime in private hash runtimes[_uid] = this; /** Default set of capabilities, which can be redifined later by specific runtime @private @property caps @type Object */ caps = Basic.extend({ // Runtime can: // provide access to raw binary data of the file access_binary: false, // provide access to raw binary data of the image (image extension is optional) access_image_binary: false, // display binary data as thumbs for example display_media: false, // make cross-domain requests do_cors: false, // accept files dragged and dropped from the desktop drag_and_drop: false, // filter files in selection dialog by their extensions filter_by_extension: true, // resize image (and manipulate it raw data of any file in general) resize_image: false, // periodically report how many bytes of total in the file were uploaded (loaded) report_upload_progress: false, // provide access to the headers of http response return_response_headers: false, // support response of specific type, which should be passed as an argument // e.g. runtime.can('return_response_type', 'blob') return_response_type: false, // return http status code of the response return_status_code: true, // send custom http header with the request send_custom_headers: false, // pick up the files from a dialog select_file: false, // select whole folder in file browse dialog select_folder: false, // select multiple files at once in file browse dialog select_multiple: true, // send raw binary data, that is generated after image resizing or manipulation of other kind send_binary_string: false, // send cookies with http request and therefore retain session send_browser_cookies: true, // send data formatted as multipart/form-data send_multipart: true, // slice the file or blob to smaller parts slice_blob: false, // upload file without preloading it to memory, stream it out directly from disk stream_upload: false, // programmatically trigger file browse dialog summon_file_dialog: false, // upload file of specific size, size should be passed as argument // e.g. runtime.can('upload_filesize', '500mb') upload_filesize: true, // initiate http request with specific http method, method should be passed as argument // e.g. runtime.can('use_http_method', 'put') use_http_method: true }, caps); // default to the mode that is compatible with preferred caps if (options.preferred_caps) { defaultMode = Runtime.getMode(modeCaps, options.preferred_caps, defaultMode); } if (MXI_DEBUG && Env.debug.runtime) { Env.log("\tdefault mode: %s", defaultMode); } // small extension factory here (is meant to be extended with actual extensions constructors) _shim = (function() { var objpool = {}; return { exec: function(uid, comp, fn, args) { if (_shim[comp]) { if (!objpool[uid]) { objpool[uid] = { context: this, instance: new _shim[comp]() }; } if (objpool[uid].instance[fn]) { return objpool[uid].instance[fn].apply(this, args); } } }, removeInstance: function(uid) { delete objpool[uid]; }, removeAllInstances: function() { var self = this; Basic.each(objpool, function(obj, uid) { if (Basic.typeOf(obj.instance.destroy) === 'function') { obj.instance.destroy.call(obj.context); } self.removeInstance(uid); }); } }; }()); // public methods Basic.extend(this, { /** Specifies whether runtime instance was initialized or not @property initialized @type {Boolean} @default false */ initialized: false, // shims require this flag to stop initialization retries /** Unique ID of the runtime @property uid @type {String} */ uid: _uid, /** Runtime type (e.g. flash, html5, etc) @property type @type {String} */ type: type, /** Runtime (not native one) may operate in browser or client mode. @property mode @private @type {String|Boolean} current mode or false, if none possible */ mode: Runtime.getMode(modeCaps, (options.required_caps), defaultMode), /** id of the DOM container for the runtime (if available) @property shimid @type {String} */ shimid: _uid + '_container', /** Number of connected clients. If equal to zero, runtime can be destroyed @property clients @type {Number} */ clients: 0, /** Runtime initialization options @property options @type {Object} */ options: options, /** Checks if the runtime has specific capability @method can @param {String} cap Name of capability to check @param {Mixed} [value] If passed, capability should somehow correlate to the value @param {Object} [refCaps] Set of capabilities to check the specified cap against (defaults to internal set) @return {Boolean} true if runtime has such capability and false, if - not */ can: function(cap, value) { var refCaps = arguments[2] || caps; // if cap var is a comma-separated list of caps, convert it to object (key/value) if (Basic.typeOf(cap) === 'string' && Basic.typeOf(value) === 'undefined') { cap = Runtime.parseCaps(cap); } if (Basic.typeOf(cap) === 'object') { for (var key in cap) { if (!this.can(key, cap[key], refCaps)) { return false; } } return true; } // check the individual cap if (Basic.typeOf(refCaps[cap]) === 'function') { return refCaps[cap].call(this, value); } else { return (value === refCaps[cap]); } }, /** Returns container for the runtime as DOM element @method getShimContainer @return {DOMElement} */ getShimContainer: function() { var container, shimContainer = Dom.get(this.shimid); // if no container for shim, create one if (!shimContainer) { container = this.options.container ? Dom.get(this.options.container) : document.body; // create shim container and insert it at an absolute position into the outer container shimContainer = document.createElement('div'); shimContainer.id = this.shimid; shimContainer.className = 'moxie-shim moxie-shim-' + this.type; Basic.extend(shimContainer.style, { position: 'absolute', top: '0px', left: '0px', width: '1px', height: '1px', overflow: 'hidden' }); container.appendChild(shimContainer); container = null; } return shimContainer; }, /** Returns runtime as DOM element (if appropriate) @method getShim @return {DOMElement} */ getShim: function() { return _shim; }, /** Invokes a method within the runtime itself (might differ across the runtimes) @method shimExec @param {Mixed} [] @protected @return {Mixed} Depends on the action and component */ shimExec: function(component, action) { var args = [].slice.call(arguments, 2); return self.getShim().exec.call(this, this.uid, component, action, args); }, /** Operaional interface that is used by components to invoke specific actions on the runtime (is invoked in the scope of component) @method exec @param {Mixed} []* @protected @return {Mixed} Depends on the action and component */ exec: function(component, action) { // this is called in the context of component, not runtime var args = [].slice.call(arguments, 2); if (self[component] && self[component][action]) { return self[component][action].apply(this, args); } return self.shimExec.apply(this, arguments); }, /** Destroys the runtime (removes all events and deletes DOM structures) @method destroy */ destroy: function() { if (!self) { return; // obviously already destroyed } var shimContainer = Dom.get(this.shimid); if (shimContainer) { shimContainer.parentNode.removeChild(shimContainer); } if (_shim) { _shim.removeAllInstances(); } this.unbindAll(); delete runtimes[this.uid]; this.uid = null; // mark this runtime as destroyed _uid = self = _shim = shimContainer = null; } }); // once we got the mode, test against all caps if (this.mode && options.required_caps && !this.can(options.required_caps)) { this.mode = false; } } /** Default order to try different runtime types @property order @type String @static */ Runtime.order = 'html5,html4'; /** Retrieves runtime from private hash by it's uid @method getRuntime @private @static @param {String} uid Unique identifier of the runtime @return {Runtime|Boolean} Returns runtime, if it exists and false, if - not */ Runtime.getRuntime = function(uid) { return runtimes[uid] ? runtimes[uid] : false; }; /** Register constructor for the Runtime of new (or perhaps modified) type @method addConstructor @static @param {String} type Runtime type (e.g. flash, html5, etc) @param {Function} construct Constructor for the Runtime type */ Runtime.addConstructor = function(type, constructor) { constructor.prototype = EventTarget.instance; runtimeConstructors[type] = constructor; }; /** Get the constructor for the specified type. method getConstructor @static @param {String} type Runtime type (e.g. flash, html5, etc) @return {Function} Constructor for the Runtime type */ Runtime.getConstructor = function(type) { return runtimeConstructors[type] || null; }; /** Get info about the runtime (uid, type, capabilities) @method getInfo @static @param {String} uid Unique identifier of the runtime @return {Mixed} Info object or null if runtime doesn't exist */ Runtime.getInfo = function(uid) { var runtime = Runtime.getRuntime(uid); if (runtime) { return { uid: runtime.uid, type: runtime.type, mode: runtime.mode, can: function() { return runtime.can.apply(runtime, arguments); } }; } return null; }; /** Convert caps represented by a comma-separated string to the object representation. @method parseCaps @static @param {String} capStr Comma-separated list of capabilities @return {Object} */ Runtime.parseCaps = function(capStr) { var capObj = {}; if (Basic.typeOf(capStr) !== 'string') { return capStr || {}; } Basic.each(capStr.split(','), function(key) { capObj[key] = true; // we assume it to be - true }); return capObj; }; /** Test the specified runtime for specific capabilities. @method can @static @param {String} type Runtime type (e.g. flash, html5, etc) @param {String|Object} caps Set of capabilities to check @return {Boolean} Result of the test */ Runtime.can = function(type, caps) { var runtime , constructor = Runtime.getConstructor(type) , mode ; if (constructor) { runtime = new constructor({ required_caps: caps }); mode = runtime.mode; runtime.destroy(); return !!mode; } return false; }; /** Figure out a runtime that supports specified capabilities. @method thatCan @static @param {String|Object} caps Set of capabilities to check @param {String} [runtimeOrder] Comma-separated list of runtimes to check against @return {String} Usable runtime identifier or null */ Runtime.thatCan = function(caps, runtimeOrder) { var types = (runtimeOrder || Runtime.order).split(/\s*,\s*/); for (var i in types) { if (Runtime.can(types[i], caps)) { return types[i]; } } return null; }; /** Figure out an operational mode for the specified set of capabilities. @method getMode @static @param {Object} modeCaps Set of capabilities that depend on particular runtime mode @param {Object} [requiredCaps] Supplied set of capabilities to find operational mode for @param {String|Boolean} [defaultMode='browser'] Default mode to use @return {String|Boolean} Compatible operational mode */ Runtime.getMode = function(modeCaps, requiredCaps, defaultMode) { var mode = null; if (Basic.typeOf(defaultMode) === 'undefined') { // only if not specified defaultMode = 'browser'; } if (requiredCaps && !Basic.isEmptyObj(modeCaps)) { // loop over required caps and check if they do require the same mode Basic.each(requiredCaps, function(value, cap) { if (modeCaps.hasOwnProperty(cap)) { var capMode = modeCaps[cap](value); // make sure we always have an array if (typeof(capMode) === 'string') { capMode = [capMode]; } if (!mode) { mode = capMode; } else if (!(mode = Basic.arrayIntersect(mode, capMode))) { // if cap requires conflicting mode - runtime cannot fulfill required caps if (MXI_DEBUG && Env.debug.runtime) { Env.log("\t\t%c: %v (conflicting mode requested: %s)", cap, value, capMode); } return (mode = false); } } if (MXI_DEBUG && Env.debug.runtime) { Env.log("\t\t%c: %v (compatible modes: %s)", cap, value, mode); } }); if (mode) { return Basic.inArray(defaultMode, mode) !== -1 ? defaultMode : mode[0]; } else if (mode === false) { return false; } } return defaultMode; }; /** Capability check that always returns true @private @static @return {True} */ Runtime.capTrue = function() { return true; }; /** Capability check that always returns false @private @static @return {False} */ Runtime.capFalse = function() { return false; }; /** Evaluate the expression to boolean value and create a function that always returns it. @private @static @param {Mixed} expr Expression to evaluate @return {Function} Function returning the result of evaluation */ Runtime.capTest = function(expr) { return function() { return !!expr; }; }; return Runtime; }); // Included from: src/javascript/runtime/RuntimeClient.js /** * RuntimeClient.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/runtime/RuntimeClient', [ 'moxie/core/utils/Env', 'moxie/core/Exceptions', 'moxie/core/utils/Basic', 'moxie/runtime/Runtime' ], function(Env, x, Basic, Runtime) { /** Set of methods and properties, required by a component to acquire ability to connect to a runtime @class RuntimeClient */ return function RuntimeClient() { var runtime; Basic.extend(this, { /** Connects to the runtime specified by the options. Will either connect to existing runtime or create a new one. Increments number of clients connected to the specified runtime. @private @method connectRuntime @param {Mixed} options Can be a runtme uid or a set of key-value pairs defining requirements and pre-requisites */ connectRuntime: function(options) { var comp = this, ruid; function initialize(items) { var type, constructor; // if we ran out of runtimes if (!items.length) { comp.trigger('RuntimeError', new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR)); runtime = null; return; } type = items.shift().toLowerCase(); constructor = Runtime.getConstructor(type); if (!constructor) { initialize(items); return; } if (MXI_DEBUG && Env.debug.runtime) { Env.log("Trying runtime: %s", type); Env.log(options); } // try initializing the runtime runtime = new constructor(options); runtime.bind('Init', function() { // mark runtime as initialized runtime.initialized = true; if (MXI_DEBUG && Env.debug.runtime) { Env.log("Runtime '%s' initialized", runtime.type); } // jailbreak ... setTimeout(function() { runtime.clients++; // this will be triggered on component comp.trigger('RuntimeInit', runtime); }, 1); }); runtime.bind('Error', function() { if (MXI_DEBUG && Env.debug.runtime) { Env.log("Runtime '%s' failed to initialize", runtime.type); } runtime.destroy(); // runtime cannot destroy itself from inside at a right moment, thus we do it here initialize(items); }); /*runtime.bind('Exception', function() { });*/ if (MXI_DEBUG && Env.debug.runtime) { Env.log("\tselected mode: %s", runtime.mode); } // check if runtime managed to pick-up operational mode if (!runtime.mode) { runtime.trigger('Error'); return; } runtime.init(); } // check if a particular runtime was requested if (Basic.typeOf(options) === 'string') { ruid = options; } else if (Basic.typeOf(options.ruid) === 'string') { ruid = options.ruid; } if (ruid) { runtime = Runtime.getRuntime(ruid); if (runtime) { runtime.clients++; return runtime; } else { // there should be a runtime and there's none - weird case throw new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR); } } // initialize a fresh one, that fits runtime list and required features best initialize((options.runtime_order || Runtime.order).split(/\s*,\s*/)); }, /** Disconnects from the runtime. Decrements number of clients connected to the specified runtime. @private @method disconnectRuntime */ disconnectRuntime: function() { if (runtime && --runtime.clients <= 0) { runtime.destroy(); } // once the component is disconnected, it shouldn't have access to the runtime runtime = null; }, /** Returns the runtime to which the client is currently connected. @method getRuntime @return {Runtime} Runtime or null if client is not connected */ getRuntime: function() { if (runtime && runtime.uid) { return runtime; } return runtime = null; // make sure we do not leave zombies rambling around }, /** Handy shortcut to safely invoke runtime extension methods. @private @method exec @return {Mixed} Whatever runtime extension method returns */ exec: function() { if (runtime) { return runtime.exec.apply(this, arguments); } return null; } }); }; }); // Included from: src/javascript/file/FileInput.js /** * FileInput.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/FileInput', [ 'moxie/core/utils/Basic', 'moxie/core/utils/Env', 'moxie/core/utils/Mime', 'moxie/core/utils/Dom', 'moxie/core/Exceptions', 'moxie/core/EventTarget', 'moxie/core/I18n', 'moxie/runtime/Runtime', 'moxie/runtime/RuntimeClient' ], function(Basic, Env, Mime, Dom, x, EventTarget, I18n, Runtime, RuntimeClient) { /** Provides a convenient way to create cross-browser file-picker. Generates file selection dialog on click, converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory with _FileReader_ or uploaded to a server through _XMLHttpRequest_. @class FileInput @constructor @extends EventTarget @uses RuntimeClient @param {Object|String|DOMElement} options If options is string or node, argument is considered as _browse\_button_. @param {String|DOMElement} options.browse_button DOM Element to turn into file picker. @param {Array} [options.accept] Array of mime types to accept. By default accepts all. @param {String} [options.file='file'] Name of the file field (not the filename). @param {Boolean} [options.multiple=false] Enable selection of multiple files. @param {Boolean} [options.directory=false] Turn file input into the folder input (cannot be both at the same time). @param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode for _browse\_button_. @param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support. @example <div id="container"> <a id="file-picker" href="javascript:;">Browse...</a> </div> <script> var fileInput = new mOxie.FileInput({ browse_button: 'file-picker', // or document.getElementById('file-picker') container: 'container', accept: [ {title: "Image files", extensions: "jpg,gif,png"} // accept only images ], multiple: true // allow multiple file selection }); fileInput.onchange = function(e) { // do something to files array console.info(e.target.files); // or this.files or fileInput.files }; fileInput.init(); // initialize </script> */ var dispatches = [ /** Dispatched when runtime is connected and file-picker is ready to be used. @event ready @param {Object} event */ 'ready', /** Dispatched right after [ready](#event_ready) event, and whenever [refresh()](#method_refresh) is invoked. Check [corresponding documentation entry](#method_refresh) for more info. @event refresh @param {Object} event */ /** Dispatched when selection of files in the dialog is complete. @event change @param {Object} event */ 'change', 'cancel', // TODO: might be useful /** Dispatched when mouse cursor enters file-picker area. Can be used to style element accordingly. @event mouseenter @param {Object} event */ 'mouseenter', /** Dispatched when mouse cursor leaves file-picker area. Can be used to style element accordingly. @event mouseleave @param {Object} event */ 'mouseleave', /** Dispatched when functional mouse button is pressed on top of file-picker area. @event mousedown @param {Object} event */ 'mousedown', /** Dispatched when functional mouse button is released on top of file-picker area. @event mouseup @param {Object} event */ 'mouseup' ]; function FileInput(options) { if (MXI_DEBUG) { Env.log("Instantiating FileInput..."); } var self = this, container, browseButton, defaults; // if flat argument passed it should be browse_button id if (Basic.inArray(Basic.typeOf(options), ['string', 'node']) !== -1) { options = { browse_button : options }; } // this will help us to find proper default container browseButton = Dom.get(options.browse_button); if (!browseButton) { // browse button is required throw new x.DOMException(x.DOMException.NOT_FOUND_ERR); } // figure out the options defaults = { accept: [{ title: I18n.translate('All Files'), extensions: '*' }], name: 'file', multiple: false, required_caps: false, container: browseButton.parentNode || document.body }; options = Basic.extend({}, defaults, options); // convert to object representation if (typeof(options.required_caps) === 'string') { options.required_caps = Runtime.parseCaps(options.required_caps); } // normalize accept option (could be list of mime types or array of title/extensions pairs) if (typeof(options.accept) === 'string') { options.accept = Mime.mimes2extList(options.accept); } container = Dom.get(options.container); // make sure we have container if (!container) { container = document.body; } // make container relative, if it's not if (Dom.getStyle(container, 'position') === 'static') { container.style.position = 'relative'; } container = browseButton = null; // IE RuntimeClient.call(self); Basic.extend(self, { /** Unique id of the component @property uid @protected @readOnly @type {String} @default UID */ uid: Basic.guid('uid_'), /** Unique id of the connected runtime, if any. @property ruid @protected @type {String} */ ruid: null, /** Unique id of the runtime container. Useful to get hold of it for various manipulations. @property shimid @protected @type {String} */ shimid: null, /** Array of selected mOxie.File objects @property files @type {Array} @default null */ files: null, /** Initializes the file-picker, connects it to runtime and dispatches event ready when done. @method init */ init: function() { self.bind('RuntimeInit', function(e, runtime) { self.ruid = runtime.uid; self.shimid = runtime.shimid; self.bind("Ready", function() { self.trigger("Refresh"); }, 999); // re-position and resize shim container self.bind('Refresh', function() { var pos, size, browseButton, shimContainer; browseButton = Dom.get(options.browse_button); shimContainer = Dom.get(runtime.shimid); // do not use runtime.getShimContainer(), since it will create container if it doesn't exist if (browseButton) { pos = Dom.getPos(browseButton, Dom.get(options.container)); size = Dom.getSize(browseButton); if (shimContainer) { Basic.extend(shimContainer.style, { top : pos.y + 'px', left : pos.x + 'px', width : size.w + 'px', height : size.h + 'px' }); } } shimContainer = browseButton = null; }); runtime.exec.call(self, 'FileInput', 'init', options); }); // runtime needs: options.required_features, options.runtime_order and options.container self.connectRuntime(Basic.extend({}, options, { required_caps: { select_file: true } })); }, /** Disables file-picker element, so that it doesn't react to mouse clicks. @method disable @param {Boolean} [state=true] Disable component if - true, enable if - false */ disable: function(state) { var runtime = this.getRuntime(); if (runtime) { runtime.exec.call(this, 'FileInput', 'disable', Basic.typeOf(state) === 'undefined' ? true : state); } }, /** Reposition and resize dialog trigger to match the position and size of browse_button element. @method refresh */ refresh: function() { self.trigger("Refresh"); }, /** Destroy component. @method destroy */ destroy: function() { var runtime = this.getRuntime(); if (runtime) { runtime.exec.call(this, 'FileInput', 'destroy'); this.disconnectRuntime(); } if (Basic.typeOf(this.files) === 'array') { // no sense in leaving associated files behind Basic.each(this.files, function(file) { file.destroy(); }); } this.files = null; this.unbindAll(); } }); this.handleEventProps(dispatches); } FileInput.prototype = EventTarget.instance; return FileInput; }); // Included from: src/javascript/core/utils/Encode.js /** * Encode.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Encode', [], function() { /** Encode string with UTF-8 @method utf8_encode @for Utils @static @param {String} str String to encode @return {String} UTF-8 encoded string */ var utf8_encode = function(str) { return unescape(encodeURIComponent(str)); }; /** Decode UTF-8 encoded string @method utf8_decode @static @param {String} str String to decode @return {String} Decoded string */ var utf8_decode = function(str_data) { return decodeURIComponent(escape(str_data)); }; /** Decode Base64 encoded string (uses browser's default method if available), from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_decode.js @method atob @static @param {String} data String to decode @return {String} Decoded string */ var atob = function(data, utf8) { if (typeof(window.atob) === 'function') { return utf8 ? utf8_decode(window.atob(data)) : window.atob(data); } // http://kevin.vanzonneveld.net // + original by: Tyler Akins (http://rumkin.com) // + improved by: Thunder.m // + input by: Aman Gupta // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Onno Marsman // + bugfixed by: Pellentesque Malesuada // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + input by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA=='); // * returns 1: 'Kevin van Zonneveld' // mozilla has this native // - but breaks in 2.0.0.12! //if (typeof this.window.atob == 'function') { // return atob(data); //} var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, dec = "", tmp_arr = []; if (!data) { return data; } data += ''; do { // unpack four hexets into three octets using index points in b64 h1 = b64.indexOf(data.charAt(i++)); h2 = b64.indexOf(data.charAt(i++)); h3 = b64.indexOf(data.charAt(i++)); h4 = b64.indexOf(data.charAt(i++)); bits = h1 << 18 | h2 << 12 | h3 << 6 | h4; o1 = bits >> 16 & 0xff; o2 = bits >> 8 & 0xff; o3 = bits & 0xff; if (h3 == 64) { tmp_arr[ac++] = String.fromCharCode(o1); } else if (h4 == 64) { tmp_arr[ac++] = String.fromCharCode(o1, o2); } else { tmp_arr[ac++] = String.fromCharCode(o1, o2, o3); } } while (i < data.length); dec = tmp_arr.join(''); return utf8 ? utf8_decode(dec) : dec; }; /** Base64 encode string (uses browser's default method if available), from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_encode.js @method btoa @static @param {String} data String to encode @return {String} Base64 encoded string */ var btoa = function(data, utf8) { if (utf8) { data = utf8_encode(data); } if (typeof(window.btoa) === 'function') { return window.btoa(data); } // http://kevin.vanzonneveld.net // + original by: Tyler Akins (http://rumkin.com) // + improved by: Bayron Guevara // + improved by: Thunder.m // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Pellentesque Malesuada // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: Rafał Kukawski (http://kukawski.pl) // * example 1: base64_encode('Kevin van Zonneveld'); // * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA==' // mozilla has this native // - but breaks in 2.0.0.12! var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc = "", tmp_arr = []; if (!data) { return data; } do { // pack three octets into four hexets o1 = data.charCodeAt(i++); o2 = data.charCodeAt(i++); o3 = data.charCodeAt(i++); bits = o1 << 16 | o2 << 8 | o3; h1 = bits >> 18 & 0x3f; h2 = bits >> 12 & 0x3f; h3 = bits >> 6 & 0x3f; h4 = bits & 0x3f; // use hexets to index into b64, and append result to encoded string tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); } while (i < data.length); enc = tmp_arr.join(''); var r = data.length % 3; return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3); }; return { utf8_encode: utf8_encode, utf8_decode: utf8_decode, atob: atob, btoa: btoa }; }); // Included from: src/javascript/file/Blob.js /** * Blob.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/Blob', [ 'moxie/core/utils/Basic', 'moxie/core/utils/Encode', 'moxie/runtime/RuntimeClient' ], function(Basic, Encode, RuntimeClient) { var blobpool = {}; /** @class Blob @constructor @param {String} ruid Unique id of the runtime, to which this blob belongs to @param {Object} blob Object "Native" blob object, as it is represented in the runtime */ function Blob(ruid, blob) { function _sliceDetached(start, end, type) { var blob, data = blobpool[this.uid]; if (Basic.typeOf(data) !== 'string' || !data.length) { return null; // or throw exception } blob = new Blob(null, { type: type, size: end - start }); blob.detach(data.substr(start, blob.size)); return blob; } RuntimeClient.call(this); if (ruid) { this.connectRuntime(ruid); } if (!blob) { blob = {}; } else if (Basic.typeOf(blob) === 'string') { // dataUrl or binary string blob = { data: blob }; } Basic.extend(this, { /** Unique id of the component @property uid @type {String} */ uid: blob.uid || Basic.guid('uid_'), /** Unique id of the connected runtime, if falsy, then runtime will have to be initialized before this Blob can be used, modified or sent @property ruid @type {String} */ ruid: ruid, /** Size of blob @property size @type {Number} @default 0 */ size: blob.size || 0, /** Mime type of blob @property type @type {String} @default '' */ type: blob.type || '', /** @method slice @param {Number} [start=0] */ slice: function(start, end, type) { if (this.isDetached()) { return _sliceDetached.apply(this, arguments); } return this.getRuntime().exec.call(this, 'Blob', 'slice', this.getSource(), start, end, type); }, /** Returns "native" blob object (as it is represented in connected runtime) or null if not found @method getSource @return {Blob} Returns "native" blob object or null if not found */ getSource: function() { if (!blobpool[this.uid]) { return null; } return blobpool[this.uid]; }, /** Detaches blob from any runtime that it depends on and initialize with standalone value @method detach @protected @param {DOMString} [data=''] Standalone value */ detach: function(data) { if (this.ruid) { this.getRuntime().exec.call(this, 'Blob', 'destroy'); this.disconnectRuntime(); this.ruid = null; } data = data || ''; // if dataUrl, convert to binary string if (data.substr(0, 5) == 'data:') { var base64Offset = data.indexOf(';base64,'); this.type = data.substring(5, base64Offset); data = Encode.atob(data.substring(base64Offset + 8)); } this.size = data.length; blobpool[this.uid] = data; }, /** Checks if blob is standalone (detached of any runtime) @method isDetached @protected @return {Boolean} */ isDetached: function() { return !this.ruid && Basic.typeOf(blobpool[this.uid]) === 'string'; }, /** Destroy Blob and free any resources it was using @method destroy */ destroy: function() { this.detach(); delete blobpool[this.uid]; } }); if (blob.data) { this.detach(blob.data); // auto-detach if payload has been passed } else { blobpool[this.uid] = blob; } } return Blob; }); // Included from: src/javascript/file/File.js /** * File.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/File', [ 'moxie/core/utils/Basic', 'moxie/core/utils/Mime', 'moxie/file/Blob' ], function(Basic, Mime, Blob) { /** @class File @extends Blob @constructor @param {String} ruid Unique id of the runtime, to which this blob belongs to @param {Object} file Object "Native" file object, as it is represented in the runtime */ function File(ruid, file) { if (!file) { // avoid extra errors in case we overlooked something file = {}; } Blob.apply(this, arguments); if (!this.type) { this.type = Mime.getFileMime(file.name); } // sanitize file name or generate new one var name; if (file.name) { name = file.name.replace(/\\/g, '/'); name = name.substr(name.lastIndexOf('/') + 1); } else if (this.type) { var prefix = this.type.split('/')[0]; name = Basic.guid((prefix !== '' ? prefix : 'file') + '_'); if (Mime.extensions[this.type]) { name += '.' + Mime.extensions[this.type][0]; // append proper extension if possible } } Basic.extend(this, { /** File name @property name @type {String} @default UID */ name: name || Basic.guid('file_'), /** Relative path to the file inside a directory @property relativePath @type {String} @default '' */ relativePath: '', /** Date of last modification @property lastModifiedDate @type {String} @default now */ lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString() // Thu Aug 23 2012 19:40:00 GMT+0400 (GET) }); } File.prototype = Blob.prototype; return File; }); // Included from: src/javascript/file/FileDrop.js /** * FileDrop.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/FileDrop', [ 'moxie/core/I18n', 'moxie/core/utils/Dom', 'moxie/core/Exceptions', 'moxie/core/utils/Basic', 'moxie/core/utils/Env', 'moxie/file/File', 'moxie/runtime/RuntimeClient', 'moxie/core/EventTarget', 'moxie/core/utils/Mime' ], function(I18n, Dom, x, Basic, Env, File, RuntimeClient, EventTarget, Mime) { /** Turn arbitrary DOM element to a drop zone accepting files. Converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory with _FileReader_ or uploaded to a server through _XMLHttpRequest_. @example <div id="drop_zone"> Drop files here </div> <br /> <div id="filelist"></div> <script type="text/javascript"> var fileDrop = new mOxie.FileDrop('drop_zone'), fileList = mOxie.get('filelist'); fileDrop.ondrop = function() { mOxie.each(this.files, function(file) { fileList.innerHTML += '<div>' + file.name + '</div>'; }); }; fileDrop.init(); </script> @class FileDrop @constructor @extends EventTarget @uses RuntimeClient @param {Object|String} options If options has typeof string, argument is considered as options.drop_zone @param {String|DOMElement} options.drop_zone DOM Element to turn into a drop zone @param {Array} [options.accept] Array of mime types to accept. By default accepts all @param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support */ var dispatches = [ /** Dispatched when runtime is connected and drop zone is ready to accept files. @event ready @param {Object} event */ 'ready', /** Dispatched when dragging cursor enters the drop zone. @event dragenter @param {Object} event */ 'dragenter', /** Dispatched when dragging cursor leaves the drop zone. @event dragleave @param {Object} event */ 'dragleave', /** Dispatched when file is dropped onto the drop zone. @event drop @param {Object} event */ 'drop', /** Dispatched if error occurs. @event error @param {Object} event */ 'error' ]; function FileDrop(options) { if (MXI_DEBUG) { Env.log("Instantiating FileDrop..."); } var self = this, defaults; // if flat argument passed it should be drop_zone id if (typeof(options) === 'string') { options = { drop_zone : options }; } // figure out the options defaults = { accept: [{ title: I18n.translate('All Files'), extensions: '*' }], required_caps: { drag_and_drop: true } }; options = typeof(options) === 'object' ? Basic.extend({}, defaults, options) : defaults; // this will help us to find proper default container options.container = Dom.get(options.drop_zone) || document.body; // make container relative, if it is not if (Dom.getStyle(options.container, 'position') === 'static') { options.container.style.position = 'relative'; } // normalize accept option (could be list of mime types or array of title/extensions pairs) if (typeof(options.accept) === 'string') { options.accept = Mime.mimes2extList(options.accept); } RuntimeClient.call(self); Basic.extend(self, { uid: Basic.guid('uid_'), ruid: null, files: null, init: function() { self.bind('RuntimeInit', function(e, runtime) { self.ruid = runtime.uid; runtime.exec.call(self, 'FileDrop', 'init', options); self.dispatchEvent('ready'); }); // runtime needs: options.required_features, options.runtime_order and options.container self.connectRuntime(options); // throws RuntimeError }, destroy: function() { var runtime = this.getRuntime(); if (runtime) { runtime.exec.call(this, 'FileDrop', 'destroy'); this.disconnectRuntime(); } this.files = null; this.unbindAll(); } }); this.handleEventProps(dispatches); } FileDrop.prototype = EventTarget.instance; return FileDrop; }); // Included from: src/javascript/file/FileReader.js /** * FileReader.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/FileReader', [ 'moxie/core/utils/Basic', 'moxie/core/utils/Encode', 'moxie/core/Exceptions', 'moxie/core/EventTarget', 'moxie/file/Blob', 'moxie/runtime/RuntimeClient' ], function(Basic, Encode, x, EventTarget, Blob, RuntimeClient) { /** Utility for preloading o.Blob/o.File objects in memory. By design closely follows [W3C FileReader](http://www.w3.org/TR/FileAPI/#dfn-filereader) interface. Where possible uses native FileReader, where - not falls back to shims. @class FileReader @constructor FileReader @extends EventTarget @uses RuntimeClient */ var dispatches = [ /** Dispatched when the read starts. @event loadstart @param {Object} event */ 'loadstart', /** Dispatched while reading (and decoding) blob, and reporting partial Blob data (progess.loaded/progress.total). @event progress @param {Object} event */ 'progress', /** Dispatched when the read has successfully completed. @event load @param {Object} event */ 'load', /** Dispatched when the read has been aborted. For instance, by invoking the abort() method. @event abort @param {Object} event */ 'abort', /** Dispatched when the read has failed. @event error @param {Object} event */ 'error', /** Dispatched when the request has completed (either in success or failure). @event loadend @param {Object} event */ 'loadend' ]; function FileReader() { RuntimeClient.call(this); Basic.extend(this, { /** UID of the component instance. @property uid @type {String} */ uid: Basic.guid('uid_'), /** Contains current state of FileReader object. Can take values of FileReader.EMPTY, FileReader.LOADING and FileReader.DONE. @property readyState @type {Number} @default FileReader.EMPTY */ readyState: FileReader.EMPTY, /** Result of the successful read operation. @property result @type {String} */ result: null, /** Stores the error of failed asynchronous read operation. @property error @type {DOMError} */ error: null, /** Initiates reading of File/Blob object contents to binary string. @method readAsBinaryString @param {Blob|File} blob Object to preload */ readAsBinaryString: function(blob) { _read.call(this, 'readAsBinaryString', blob); }, /** Initiates reading of File/Blob object contents to dataURL string. @method readAsDataURL @param {Blob|File} blob Object to preload */ readAsDataURL: function(blob) { _read.call(this, 'readAsDataURL', blob); }, /** Initiates reading of File/Blob object contents to string. @method readAsText @param {Blob|File} blob Object to preload */ readAsText: function(blob) { _read.call(this, 'readAsText', blob); }, /** Aborts preloading process. @method abort */ abort: function() { this.result = null; if (Basic.inArray(this.readyState, [FileReader.EMPTY, FileReader.DONE]) !== -1) { return; } else if (this.readyState === FileReader.LOADING) { this.readyState = FileReader.DONE; } this.exec('FileReader', 'abort'); this.trigger('abort'); this.trigger('loadend'); }, /** Destroy component and release resources. @method destroy */ destroy: function() { this.abort(); this.exec('FileReader', 'destroy'); this.disconnectRuntime(); this.unbindAll(); } }); // uid must already be assigned this.handleEventProps(dispatches); this.bind('Error', function(e, err) { this.readyState = FileReader.DONE; this.error = err; }, 999); this.bind('Load', function(e) { this.readyState = FileReader.DONE; }, 999); function _read(op, blob) { var self = this; this.trigger('loadstart'); if (this.readyState === FileReader.LOADING) { this.trigger('error', new x.DOMException(x.DOMException.INVALID_STATE_ERR)); this.trigger('loadend'); return; } // if source is not o.Blob/o.File if (!(blob instanceof Blob)) { this.trigger('error', new x.DOMException(x.DOMException.NOT_FOUND_ERR)); this.trigger('loadend'); return; } this.result = null; this.readyState = FileReader.LOADING; if (blob.isDetached()) { var src = blob.getSource(); switch (op) { case 'readAsText': case 'readAsBinaryString': this.result = src; break; case 'readAsDataURL': this.result = 'data:' + blob.type + ';base64,' + Encode.btoa(src); break; } this.readyState = FileReader.DONE; this.trigger('load'); this.trigger('loadend'); } else { this.connectRuntime(blob.ruid); this.exec('FileReader', 'read', op, blob); } } } /** Initial FileReader state @property EMPTY @type {Number} @final @static @default 0 */ FileReader.EMPTY = 0; /** FileReader switches to this state when it is preloading the source @property LOADING @type {Number} @final @static @default 1 */ FileReader.LOADING = 1; /** Preloading is complete, this is a final state @property DONE @type {Number} @final @static @default 2 */ FileReader.DONE = 2; FileReader.prototype = EventTarget.instance; return FileReader; }); // Included from: src/javascript/core/utils/Url.js /** * Url.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Url', [], function() { /** Parse url into separate components and fill in absent parts with parts from current url, based on https://raw.github.com/kvz/phpjs/master/functions/url/parse_url.js @method parseUrl @for Utils @static @param {String} url Url to parse (defaults to empty string if undefined) @return {Object} Hash containing extracted uri components */ var parseUrl = function(url, currentUrl) { var key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment'] , i = key.length , ports = { http: 80, https: 443 } , uri = {} , regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/ , m = regex.exec(url || '') ; while (i--) { if (m[i]) { uri[key[i]] = m[i]; } } // when url is relative, we set the origin and the path ourselves if (!uri.scheme) { // come up with defaults if (!currentUrl || typeof(currentUrl) === 'string') { currentUrl = parseUrl(currentUrl || document.location.href); } uri.scheme = currentUrl.scheme; uri.host = currentUrl.host; uri.port = currentUrl.port; var path = ''; // for urls without trailing slash we need to figure out the path if (/^[^\/]/.test(uri.path)) { path = currentUrl.path; // if path ends with a filename, strip it if (/\/[^\/]*\.[^\/]*$/.test(path)) { path = path.replace(/\/[^\/]+$/, '/'); } else { // avoid double slash at the end (see #127) path = path.replace(/\/?$/, '/'); } } uri.path = path + (uri.path || ''); // site may reside at domain.com or domain.com/subdir } if (!uri.port) { uri.port = ports[uri.scheme] || 80; } uri.port = parseInt(uri.port, 10); if (!uri.path) { uri.path = "/"; } delete uri.source; return uri; }; /** Resolve url - among other things will turn relative url to absolute @method resolveUrl @static @param {String|Object} url Either absolute or relative, or a result of parseUrl call @return {String} Resolved, absolute url */ var resolveUrl = function(url) { var ports = { // we ignore default ports http: 80, https: 443 } , urlp = typeof(url) === 'object' ? url : parseUrl(url); ; return urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : ''); }; /** Check if specified url has the same origin as the current document @method hasSameOrigin @param {String|Object} url @return {Boolean} */ var hasSameOrigin = function(url) { function origin(url) { return [url.scheme, url.host, url.port].join('/'); } if (typeof url === 'string') { url = parseUrl(url); } return origin(parseUrl()) === origin(url); }; return { parseUrl: parseUrl, resolveUrl: resolveUrl, hasSameOrigin: hasSameOrigin }; }); // Included from: src/javascript/runtime/RuntimeTarget.js /** * RuntimeTarget.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/runtime/RuntimeTarget', [ 'moxie/core/utils/Basic', 'moxie/runtime/RuntimeClient', "moxie/core/EventTarget" ], function(Basic, RuntimeClient, EventTarget) { /** Instance of this class can be used as a target for the events dispatched by shims, when allowing them onto components is for either reason inappropriate @class RuntimeTarget @constructor @protected @extends EventTarget */ function RuntimeTarget() { this.uid = Basic.guid('uid_'); RuntimeClient.call(this); this.destroy = function() { this.disconnectRuntime(); this.unbindAll(); }; } RuntimeTarget.prototype = EventTarget.instance; return RuntimeTarget; }); // Included from: src/javascript/file/FileReaderSync.js /** * FileReaderSync.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/FileReaderSync', [ 'moxie/core/utils/Basic', 'moxie/runtime/RuntimeClient', 'moxie/core/utils/Encode' ], function(Basic, RuntimeClient, Encode) { /** Synchronous FileReader implementation. Something like this is available in WebWorkers environment, here it can be used to read only preloaded blobs/files and only below certain size (not yet sure what that'd be, but probably < 1mb). Not meant to be used directly by user. @class FileReaderSync @private @constructor */ return function() { RuntimeClient.call(this); Basic.extend(this, { uid: Basic.guid('uid_'), readAsBinaryString: function(blob) { return _read.call(this, 'readAsBinaryString', blob); }, readAsDataURL: function(blob) { return _read.call(this, 'readAsDataURL', blob); }, /*readAsArrayBuffer: function(blob) { return _read.call(this, 'readAsArrayBuffer', blob); },*/ readAsText: function(blob) { return _read.call(this, 'readAsText', blob); } }); function _read(op, blob) { if (blob.isDetached()) { var src = blob.getSource(); switch (op) { case 'readAsBinaryString': return src; case 'readAsDataURL': return 'data:' + blob.type + ';base64,' + Encode.btoa(src); case 'readAsText': var txt = ''; for (var i = 0, length = src.length; i < length; i++) { txt += String.fromCharCode(src[i]); } return txt; } } else { var result = this.connectRuntime(blob.ruid).exec.call(this, 'FileReaderSync', 'read', op, blob); this.disconnectRuntime(); return result; } } }; }); // Included from: src/javascript/xhr/FormData.js /** * FormData.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/xhr/FormData", [ "moxie/core/Exceptions", "moxie/core/utils/Basic", "moxie/file/Blob" ], function(x, Basic, Blob) { /** FormData @class FormData @constructor */ function FormData() { var _blob, _fields = []; Basic.extend(this, { /** Append another key-value pair to the FormData object @method append @param {String} name Name for the new field @param {String|Blob|Array|Object} value Value for the field */ append: function(name, value) { var self = this, valueType = Basic.typeOf(value); // according to specs value might be either Blob or String if (value instanceof Blob) { _blob = { name: name, value: value // unfortunately we can only send single Blob in one FormData }; } else if ('array' === valueType) { name += '[]'; Basic.each(value, function(value) { self.append(name, value); }); } else if ('object' === valueType) { Basic.each(value, function(value, key) { self.append(name + '[' + key + ']', value); }); } else if ('null' === valueType || 'undefined' === valueType || 'number' === valueType && isNaN(value)) { self.append(name, "false"); } else { _fields.push({ name: name, value: value.toString() }); } }, /** Checks if FormData contains Blob. @method hasBlob @return {Boolean} */ hasBlob: function() { return !!this.getBlob(); }, /** Retrieves blob. @method getBlob @return {Object} Either Blob if found or null */ getBlob: function() { return _blob && _blob.value || null; }, /** Retrieves blob field name. @method getBlobName @return {String} Either Blob field name or null */ getBlobName: function() { return _blob && _blob.name || null; }, /** Loop over the fields in FormData and invoke the callback for each of them. @method each @param {Function} cb Callback to call for each field */ each: function(cb) { Basic.each(_fields, function(field) { cb(field.value, field.name); }); if (_blob) { cb(_blob.value, _blob.name); } }, destroy: function() { _blob = null; _fields = []; } }); } return FormData; }); // Included from: src/javascript/xhr/XMLHttpRequest.js /** * XMLHttpRequest.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/xhr/XMLHttpRequest", [ "moxie/core/utils/Basic", "moxie/core/Exceptions", "moxie/core/EventTarget", "moxie/core/utils/Encode", "moxie/core/utils/Url", "moxie/runtime/Runtime", "moxie/runtime/RuntimeTarget", "moxie/file/Blob", "moxie/file/FileReaderSync", "moxie/xhr/FormData", "moxie/core/utils/Env", "moxie/core/utils/Mime" ], function(Basic, x, EventTarget, Encode, Url, Runtime, RuntimeTarget, Blob, FileReaderSync, FormData, Env, Mime) { var httpCode = { 100: 'Continue', 101: 'Switching Protocols', 102: 'Processing', 200: 'OK', 201: 'Created', 202: 'Accepted', 203: 'Non-Authoritative Information', 204: 'No Content', 205: 'Reset Content', 206: 'Partial Content', 207: 'Multi-Status', 226: 'IM Used', 300: 'Multiple Choices', 301: 'Moved Permanently', 302: 'Found', 303: 'See Other', 304: 'Not Modified', 305: 'Use Proxy', 306: 'Reserved', 307: 'Temporary Redirect', 400: 'Bad Request', 401: 'Unauthorized', 402: 'Payment Required', 403: 'Forbidden', 404: 'Not Found', 405: 'Method Not Allowed', 406: 'Not Acceptable', 407: 'Proxy Authentication Required', 408: 'Request Timeout', 409: 'Conflict', 410: 'Gone', 411: 'Length Required', 412: 'Precondition Failed', 413: 'Request Entity Too Large', 414: 'Request-URI Too Long', 415: 'Unsupported Media Type', 416: 'Requested Range Not Satisfiable', 417: 'Expectation Failed', 422: 'Unprocessable Entity', 423: 'Locked', 424: 'Failed Dependency', 426: 'Upgrade Required', 500: 'Internal Server Error', 501: 'Not Implemented', 502: 'Bad Gateway', 503: 'Service Unavailable', 504: 'Gateway Timeout', 505: 'HTTP Version Not Supported', 506: 'Variant Also Negotiates', 507: 'Insufficient Storage', 510: 'Not Extended' }; function XMLHttpRequestUpload() { this.uid = Basic.guid('uid_'); } XMLHttpRequestUpload.prototype = EventTarget.instance; /** Implementation of XMLHttpRequest @class XMLHttpRequest @constructor @uses RuntimeClient @extends EventTarget */ var dispatches = [ 'loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend' // readystatechange (for historical reasons) ]; var NATIVE = 1, RUNTIME = 2; function XMLHttpRequest() { var self = this, // this (together with _p() @see below) is here to gracefully upgrade to setter/getter syntax where possible props = { /** The amount of milliseconds a request can take before being terminated. Initially zero. Zero means there is no timeout. @property timeout @type Number @default 0 */ timeout: 0, /** Current state, can take following values: UNSENT (numeric value 0) The object has been constructed. OPENED (numeric value 1) The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method. HEADERS_RECEIVED (numeric value 2) All redirects (if any) have been followed and all HTTP headers of the final response have been received. Several response members of the object are now available. LOADING (numeric value 3) The response entity body is being received. DONE (numeric value 4) @property readyState @type Number @default 0 (UNSENT) */ readyState: XMLHttpRequest.UNSENT, /** True when user credentials are to be included in a cross-origin request. False when they are to be excluded in a cross-origin request and when cookies are to be ignored in its response. Initially false. @property withCredentials @type Boolean @default false */ withCredentials: false, /** Returns the HTTP status code. @property status @type Number @default 0 */ status: 0, /** Returns the HTTP status text. @property statusText @type String */ statusText: "", /** Returns the response type. Can be set to change the response type. Values are: the empty string (default), "arraybuffer", "blob", "document", "json", and "text". @property responseType @type String */ responseType: "", /** Returns the document response entity body. Throws an "InvalidStateError" exception if responseType is not the empty string or "document". @property responseXML @type Document */ responseXML: null, /** Returns the text response entity body. Throws an "InvalidStateError" exception if responseType is not the empty string or "text". @property responseText @type String */ responseText: null, /** Returns the response entity body (http://www.w3.org/TR/XMLHttpRequest/#response-entity-body). Can become: ArrayBuffer, Blob, Document, JSON, Text @property response @type Mixed */ response: null }, _async = true, _url, _method, _headers = {}, _user, _password, _encoding = null, _mimeType = null, // flags _sync_flag = false, _send_flag = false, _upload_events_flag = false, _upload_complete_flag = false, _error_flag = false, _same_origin_flag = false, // times _start_time, _timeoutset_time, _finalMime = null, _finalCharset = null, _options = {}, _xhr, _responseHeaders = '', _responseHeadersBag ; Basic.extend(this, props, { /** Unique id of the component @property uid @type String */ uid: Basic.guid('uid_'), /** Target for Upload events @property upload @type XMLHttpRequestUpload */ upload: new XMLHttpRequestUpload(), /** Sets the request method, request URL, synchronous flag, request username, and request password. Throws a "SyntaxError" exception if one of the following is true: method is not a valid HTTP method. url cannot be resolved. url contains the "user:password" format in the userinfo production. Throws a "SecurityError" exception if method is a case-insensitive match for CONNECT, TRACE or TRACK. Throws an "InvalidAccessError" exception if one of the following is true: Either user or password is passed as argument and the origin of url does not match the XMLHttpRequest origin. There is an associated XMLHttpRequest document and either the timeout attribute is not zero, the withCredentials attribute is true, or the responseType attribute is not the empty string. @method open @param {String} method HTTP method to use on request @param {String} url URL to request @param {Boolean} [async=true] If false request will be done in synchronous manner. Asynchronous by default. @param {String} [user] Username to use in HTTP authentication process on server-side @param {String} [password] Password to use in HTTP authentication process on server-side */ open: function(method, url, async, user, password) { var urlp; // first two arguments are required if (!method || !url) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); } // 2 - check if any code point in method is higher than U+00FF or after deflating method it does not match the method if (/[\u0100-\uffff]/.test(method) || Encode.utf8_encode(method) !== method) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); } // 3 if (!!~Basic.inArray(method.toUpperCase(), ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE', 'TRACK'])) { _method = method.toUpperCase(); } // 4 - allowing these methods poses a security risk if (!!~Basic.inArray(_method, ['CONNECT', 'TRACE', 'TRACK'])) { throw new x.DOMException(x.DOMException.SECURITY_ERR); } // 5 url = Encode.utf8_encode(url); // 6 - Resolve url relative to the XMLHttpRequest base URL. If the algorithm returns an error, throw a "SyntaxError". urlp = Url.parseUrl(url); _same_origin_flag = Url.hasSameOrigin(urlp); // 7 - manually build up absolute url _url = Url.resolveUrl(url); // 9-10, 12-13 if ((user || password) && !_same_origin_flag) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } _user = user || urlp.user; _password = password || urlp.pass; // 11 _async = async || true; if (_async === false && (_p('timeout') || _p('withCredentials') || _p('responseType') !== "")) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } // 14 - terminate abort() // 15 - terminate send() // 18 _sync_flag = !_async; _send_flag = false; _headers = {}; _reset.call(this); // 19 _p('readyState', XMLHttpRequest.OPENED); // 20 this.dispatchEvent('readystatechange'); }, /** Appends an header to the list of author request headers, or if header is already in the list of author request headers, combines its value with value. Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set. Throws a "SyntaxError" exception if header is not a valid HTTP header field name or if value is not a valid HTTP header field value. @method setRequestHeader @param {String} header @param {String|Number} value */ setRequestHeader: function(header, value) { var uaHeaders = [ // these headers are controlled by the user agent "accept-charset", "accept-encoding", "access-control-request-headers", "access-control-request-method", "connection", "content-length", "cookie", "cookie2", "content-transfer-encoding", "date", "expect", "host", "keep-alive", "origin", "referer", "te", "trailer", "transfer-encoding", "upgrade", "user-agent", "via" ]; // 1-2 if (_p('readyState') !== XMLHttpRequest.OPENED || _send_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 3 if (/[\u0100-\uffff]/.test(header) || Encode.utf8_encode(header) !== header) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); } // 4 /* this step is seemingly bypassed in browsers, probably to allow various unicode characters in header values if (/[\u0100-\uffff]/.test(value) || Encode.utf8_encode(value) !== value) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); }*/ header = Basic.trim(header).toLowerCase(); // setting of proxy-* and sec-* headers is prohibited by spec if (!!~Basic.inArray(header, uaHeaders) || /^(proxy\-|sec\-)/.test(header)) { return false; } // camelize // browsers lowercase header names (at least for custom ones) // header = header.replace(/\b\w/g, function($1) { return $1.toUpperCase(); }); if (!_headers[header]) { _headers[header] = value; } else { // http://tools.ietf.org/html/rfc2616#section-4.2 (last paragraph) _headers[header] += ', ' + value; } return true; }, /** Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2. @method getAllResponseHeaders @return {String} reponse headers or empty string */ getAllResponseHeaders: function() { return _responseHeaders || ''; }, /** Returns the header field value from the response of which the field name matches header, unless the field name is Set-Cookie or Set-Cookie2. @method getResponseHeader @param {String} header @return {String} value(s) for the specified header or null */ getResponseHeader: function(header) { header = header.toLowerCase(); if (_error_flag || !!~Basic.inArray(header, ['set-cookie', 'set-cookie2'])) { return null; } if (_responseHeaders && _responseHeaders !== '') { // if we didn't parse response headers until now, do it and keep for later if (!_responseHeadersBag) { _responseHeadersBag = {}; Basic.each(_responseHeaders.split(/\r\n/), function(line) { var pair = line.split(/:\s+/); if (pair.length === 2) { // last line might be empty, omit pair[0] = Basic.trim(pair[0]); // just in case _responseHeadersBag[pair[0].toLowerCase()] = { // simply to retain header name in original form header: pair[0], value: Basic.trim(pair[1]) }; } }); } if (_responseHeadersBag.hasOwnProperty(header)) { return _responseHeadersBag[header].header + ': ' + _responseHeadersBag[header].value; } } return null; }, /** Sets the Content-Type header for the response to mime. Throws an "InvalidStateError" exception if the state is LOADING or DONE. Throws a "SyntaxError" exception if mime is not a valid media type. @method overrideMimeType @param String mime Mime type to set */ overrideMimeType: function(mime) { var matches, charset; // 1 if (!!~Basic.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 2 mime = Basic.trim(mime.toLowerCase()); if (/;/.test(mime) && (matches = mime.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))) { mime = matches[1]; if (matches[2]) { charset = matches[2]; } } if (!Mime.mimes[mime]) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); } // 3-4 _finalMime = mime; _finalCharset = charset; }, /** Initiates the request. The optional argument provides the request entity body. The argument is ignored if request method is GET or HEAD. Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set. @method send @param {Blob|Document|String|FormData} [data] Request entity body @param {Object} [options] Set of requirements and pre-requisities for runtime initialization */ send: function(data, options) { if (Basic.typeOf(options) === 'string') { _options = { ruid: options }; } else if (!options) { _options = {}; } else { _options = options; } // 1-2 if (this.readyState !== XMLHttpRequest.OPENED || _send_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 3 // sending Blob if (data instanceof Blob) { _options.ruid = data.ruid; _mimeType = data.type || 'application/octet-stream'; } // FormData else if (data instanceof FormData) { if (data.hasBlob()) { var blob = data.getBlob(); _options.ruid = blob.ruid; _mimeType = blob.type || 'application/octet-stream'; } } // DOMString else if (typeof data === 'string') { _encoding = 'UTF-8'; _mimeType = 'text/plain;charset=UTF-8'; // data should be converted to Unicode and encoded as UTF-8 data = Encode.utf8_encode(data); } // if withCredentials not set, but requested, set it automatically if (!this.withCredentials) { this.withCredentials = (_options.required_caps && _options.required_caps.send_browser_cookies) && !_same_origin_flag; } // 4 - storage mutex // 5 _upload_events_flag = (!_sync_flag && this.upload.hasEventListener()); // DSAP // 6 _error_flag = false; // 7 _upload_complete_flag = !data; // 8 - Asynchronous steps if (!_sync_flag) { // 8.1 _send_flag = true; // 8.2 // this.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr // 8.3 //if (!_upload_complete_flag) { // this.upload.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr //} } // 8.5 - Return the send() method call, but continue running the steps in this algorithm. _doXHR.call(this, data); }, /** Cancels any network activity. @method abort */ abort: function() { _error_flag = true; _sync_flag = false; if (!~Basic.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED, XMLHttpRequest.DONE])) { _p('readyState', XMLHttpRequest.DONE); _send_flag = false; if (_xhr) { _xhr.getRuntime().exec.call(_xhr, 'XMLHttpRequest', 'abort', _upload_complete_flag); } else { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } _upload_complete_flag = true; } else { _p('readyState', XMLHttpRequest.UNSENT); } }, destroy: function() { if (_xhr) { if (Basic.typeOf(_xhr.destroy) === 'function') { _xhr.destroy(); } _xhr = null; } this.unbindAll(); if (this.upload) { this.upload.unbindAll(); this.upload = null; } } }); this.handleEventProps(dispatches.concat(['readystatechange'])); // for historical reasons this.upload.handleEventProps(dispatches); /* this is nice, but maybe too lengthy // if supported by JS version, set getters/setters for specific properties o.defineProperty(this, 'readyState', { configurable: false, get: function() { return _p('readyState'); } }); o.defineProperty(this, 'timeout', { configurable: false, get: function() { return _p('timeout'); }, set: function(value) { if (_sync_flag) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } // timeout still should be measured relative to the start time of request _timeoutset_time = (new Date).getTime(); _p('timeout', value); } }); // the withCredentials attribute has no effect when fetching same-origin resources o.defineProperty(this, 'withCredentials', { configurable: false, get: function() { return _p('withCredentials'); }, set: function(value) { // 1-2 if (!~o.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED]) || _send_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 3-4 if (_anonymous_flag || _sync_flag) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } // 5 _p('withCredentials', value); } }); o.defineProperty(this, 'status', { configurable: false, get: function() { return _p('status'); } }); o.defineProperty(this, 'statusText', { configurable: false, get: function() { return _p('statusText'); } }); o.defineProperty(this, 'responseType', { configurable: false, get: function() { return _p('responseType'); }, set: function(value) { // 1 if (!!~o.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 2 if (_sync_flag) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } // 3 _p('responseType', value.toLowerCase()); } }); o.defineProperty(this, 'responseText', { configurable: false, get: function() { // 1 if (!~o.inArray(_p('responseType'), ['', 'text'])) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 2-3 if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } return _p('responseText'); } }); o.defineProperty(this, 'responseXML', { configurable: false, get: function() { // 1 if (!~o.inArray(_p('responseType'), ['', 'document'])) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 2-3 if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } return _p('responseXML'); } }); o.defineProperty(this, 'response', { configurable: false, get: function() { if (!!~o.inArray(_p('responseType'), ['', 'text'])) { if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) { return ''; } } if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) { return null; } return _p('response'); } }); */ function _p(prop, value) { if (!props.hasOwnProperty(prop)) { return; } if (arguments.length === 1) { // get return Env.can('define_property') ? props[prop] : self[prop]; } else { // set if (Env.can('define_property')) { props[prop] = value; } else { self[prop] = value; } } } /* function _toASCII(str, AllowUnassigned, UseSTD3ASCIIRules) { // TODO: http://tools.ietf.org/html/rfc3490#section-4.1 return str.toLowerCase(); } */ function _doXHR(data) { var self = this; _start_time = new Date().getTime(); _xhr = new RuntimeTarget(); function loadEnd() { if (_xhr) { // it could have been destroyed by now _xhr.destroy(); _xhr = null; } self.dispatchEvent('loadend'); self = null; } function exec(runtime) { _xhr.bind('LoadStart', function(e) { _p('readyState', XMLHttpRequest.LOADING); self.dispatchEvent('readystatechange'); self.dispatchEvent(e); if (_upload_events_flag) { self.upload.dispatchEvent(e); } }); _xhr.bind('Progress', function(e) { if (_p('readyState') !== XMLHttpRequest.LOADING) { _p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example) self.dispatchEvent('readystatechange'); } self.dispatchEvent(e); }); _xhr.bind('UploadProgress', function(e) { if (_upload_events_flag) { self.upload.dispatchEvent({ type: 'progress', lengthComputable: false, total: e.total, loaded: e.loaded }); } }); _xhr.bind('Load', function(e) { _p('readyState', XMLHttpRequest.DONE); _p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0)); _p('statusText', httpCode[_p('status')] || ""); _p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType'))); if (!!~Basic.inArray(_p('responseType'), ['text', ''])) { _p('responseText', _p('response')); } else if (_p('responseType') === 'document') { _p('responseXML', _p('response')); } _responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders'); self.dispatchEvent('readystatechange'); if (_p('status') > 0) { // status 0 usually means that server is unreachable if (_upload_events_flag) { self.upload.dispatchEvent(e); } self.dispatchEvent(e); } else { _error_flag = true; self.dispatchEvent('error'); } loadEnd(); }); _xhr.bind('Abort', function(e) { self.dispatchEvent(e); loadEnd(); }); _xhr.bind('Error', function(e) { _error_flag = true; _p('readyState', XMLHttpRequest.DONE); self.dispatchEvent('readystatechange'); _upload_complete_flag = true; self.dispatchEvent(e); loadEnd(); }); runtime.exec.call(_xhr, 'XMLHttpRequest', 'send', { url: _url, method: _method, async: _async, user: _user, password: _password, headers: _headers, mimeType: _mimeType, encoding: _encoding, responseType: self.responseType, withCredentials: self.withCredentials, options: _options }, data); } // clarify our requirements if (typeof(_options.required_caps) === 'string') { _options.required_caps = Runtime.parseCaps(_options.required_caps); } _options.required_caps = Basic.extend({}, _options.required_caps, { return_response_type: self.responseType }); if (data instanceof FormData) { _options.required_caps.send_multipart = true; } if (!Basic.isEmptyObj(_headers)) { _options.required_caps.send_custom_headers = true; } if (!_same_origin_flag) { _options.required_caps.do_cors = true; } if (_options.ruid) { // we do not need to wait if we can connect directly exec(_xhr.connectRuntime(_options)); } else { _xhr.bind('RuntimeInit', function(e, runtime) { exec(runtime); }); _xhr.bind('RuntimeError', function(e, err) { self.dispatchEvent('RuntimeError', err); }); _xhr.connectRuntime(_options); } } function _reset() { _p('responseText', ""); _p('responseXML', null); _p('response', null); _p('status', 0); _p('statusText', ""); _start_time = _timeoutset_time = null; } } XMLHttpRequest.UNSENT = 0; XMLHttpRequest.OPENED = 1; XMLHttpRequest.HEADERS_RECEIVED = 2; XMLHttpRequest.LOADING = 3; XMLHttpRequest.DONE = 4; XMLHttpRequest.prototype = EventTarget.instance; return XMLHttpRequest; }); // Included from: src/javascript/runtime/Transporter.js /** * Transporter.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/runtime/Transporter", [ "moxie/core/utils/Basic", "moxie/core/utils/Encode", "moxie/runtime/RuntimeClient", "moxie/core/EventTarget" ], function(Basic, Encode, RuntimeClient, EventTarget) { function Transporter() { var mod, _runtime, _data, _size, _pos, _chunk_size; RuntimeClient.call(this); Basic.extend(this, { uid: Basic.guid('uid_'), state: Transporter.IDLE, result: null, transport: function(data, type, options) { var self = this; options = Basic.extend({ chunk_size: 204798 }, options); // should divide by three, base64 requires this if ((mod = options.chunk_size % 3)) { options.chunk_size += 3 - mod; } _chunk_size = options.chunk_size; _reset.call(this); _data = data; _size = data.length; if (Basic.typeOf(options) === 'string' || options.ruid) { _run.call(self, type, this.connectRuntime(options)); } else { // we require this to run only once var cb = function(e, runtime) { self.unbind("RuntimeInit", cb); _run.call(self, type, runtime); }; this.bind("RuntimeInit", cb); this.connectRuntime(options); } }, abort: function() { var self = this; self.state = Transporter.IDLE; if (_runtime) { _runtime.exec.call(self, 'Transporter', 'clear'); self.trigger("TransportingAborted"); } _reset.call(self); }, destroy: function() { this.unbindAll(); _runtime = null; this.disconnectRuntime(); _reset.call(this); } }); function _reset() { _size = _pos = 0; _data = this.result = null; } function _run(type, runtime) { var self = this; _runtime = runtime; //self.unbind("RuntimeInit"); self.bind("TransportingProgress", function(e) { _pos = e.loaded; if (_pos < _size && Basic.inArray(self.state, [Transporter.IDLE, Transporter.DONE]) === -1) { _transport.call(self); } }, 999); self.bind("TransportingComplete", function() { _pos = _size; self.state = Transporter.DONE; _data = null; // clean a bit self.result = _runtime.exec.call(self, 'Transporter', 'getAsBlob', type || ''); }, 999); self.state = Transporter.BUSY; self.trigger("TransportingStarted"); _transport.call(self); } function _transport() { var self = this, chunk, bytesLeft = _size - _pos; if (_chunk_size > bytesLeft) { _chunk_size = bytesLeft; } chunk = Encode.btoa(_data.substr(_pos, _chunk_size)); _runtime.exec.call(self, 'Transporter', 'receive', chunk, _size); } } Transporter.IDLE = 0; Transporter.BUSY = 1; Transporter.DONE = 2; Transporter.prototype = EventTarget.instance; return Transporter; }); // Included from: src/javascript/image/Image.js /** * Image.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/image/Image", [ "moxie/core/utils/Basic", "moxie/core/utils/Dom", "moxie/core/Exceptions", "moxie/file/FileReaderSync", "moxie/xhr/XMLHttpRequest", "moxie/runtime/Runtime", "moxie/runtime/RuntimeClient", "moxie/runtime/Transporter", "moxie/core/utils/Env", "moxie/core/EventTarget", "moxie/file/Blob", "moxie/file/File", "moxie/core/utils/Encode" ], function(Basic, Dom, x, FileReaderSync, XMLHttpRequest, Runtime, RuntimeClient, Transporter, Env, EventTarget, Blob, File, Encode) { /** Image preloading and manipulation utility. Additionally it provides access to image meta info (Exif, GPS) and raw binary data. @class Image @constructor @extends EventTarget */ var dispatches = [ 'progress', /** Dispatched when loading is complete. @event load @param {Object} event */ 'load', 'error', /** Dispatched when resize operation is complete. @event resize @param {Object} event */ 'resize', /** Dispatched when visual representation of the image is successfully embedded into the corresponsing container. @event embedded @param {Object} event */ 'embedded' ]; function Image() { RuntimeClient.call(this); Basic.extend(this, { /** Unique id of the component @property uid @type {String} */ uid: Basic.guid('uid_'), /** Unique id of the connected runtime, if any. @property ruid @type {String} */ ruid: null, /** Name of the file, that was used to create an image, if available. If not equals to empty string. @property name @type {String} @default "" */ name: "", /** Size of the image in bytes. Actual value is set only after image is preloaded. @property size @type {Number} @default 0 */ size: 0, /** Width of the image. Actual value is set only after image is preloaded. @property width @type {Number} @default 0 */ width: 0, /** Height of the image. Actual value is set only after image is preloaded. @property height @type {Number} @default 0 */ height: 0, /** Mime type of the image. Currently only image/jpeg and image/png are supported. Actual value is set only after image is preloaded. @property type @type {String} @default "" */ type: "", /** Holds meta info (Exif, GPS). Is populated only for image/jpeg. Actual value is set only after image is preloaded. @property meta @type {Object} @default {} */ meta: {}, /** Alias for load method, that takes another mOxie.Image object as a source (see load). @method clone @param {Image} src Source for the image @param {Boolean} [exact=false] Whether to activate in-depth clone mode */ clone: function() { this.load.apply(this, arguments); }, /** Loads image from various sources. Currently the source for new image can be: mOxie.Image, mOxie.Blob/mOxie.File, native Blob/File, dataUrl or URL. Depending on the type of the source, arguments - differ. When source is URL, Image will be downloaded from remote destination and loaded in memory. @example var img = new mOxie.Image(); img.onload = function() { var blob = img.getAsBlob(); var formData = new mOxie.FormData(); formData.append('file', blob); var xhr = new mOxie.XMLHttpRequest(); xhr.onload = function() { // upload complete }; xhr.open('post', 'upload.php'); xhr.send(formData); }; img.load("http://www.moxiecode.com/images/mox-logo.jpg"); // notice file extension (.jpg) @method load @param {Image|Blob|File|String} src Source for the image @param {Boolean|Object} [mixed] */ load: function() { _load.apply(this, arguments); }, /** Downsizes the image to fit the specified width/height. If crop is supplied, image will be cropped to exact dimensions. @method downsize @param {Object} opts @param {Number} opts.width Resulting width @param {Number} [opts.height=width] Resulting height (optional, if not supplied will default to width) @param {Boolean} [opts.crop=false] Whether to crop the image to exact dimensions @param {Boolean} [opts.preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize) @param {String} [opts.resample=false] Resampling algorithm to use for resizing */ downsize: function(opts) { var defaults = { width: this.width, height: this.height, type: this.type || 'image/jpeg', quality: 90, crop: false, preserveHeaders: true, resample: false }; if (typeof(opts) === 'object') { opts = Basic.extend(defaults, opts); } else { // for backward compatibility opts = Basic.extend(defaults, { width: arguments[0], height: arguments[1], crop: arguments[2], preserveHeaders: arguments[3] }); } try { if (!this.size) { // only preloaded image objects can be used as source throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // no way to reliably intercept the crash due to high resolution, so we simply avoid it if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) { throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR); } this.exec('Image', 'downsize', opts.width, opts.height, opts.crop, opts.preserveHeaders); } catch(ex) { // for now simply trigger error event this.trigger('error', ex.code); } }, /** Alias for downsize(width, height, true). (see downsize) @method crop @param {Number} width Resulting width @param {Number} [height=width] Resulting height (optional, if not supplied will default to width) @param {Boolean} [preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize) */ crop: function(width, height, preserveHeaders) { this.downsize(width, height, true, preserveHeaders); }, getAsCanvas: function() { if (!Env.can('create_canvas')) { throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR); } var runtime = this.connectRuntime(this.ruid); return runtime.exec.call(this, 'Image', 'getAsCanvas'); }, /** Retrieves image in it's current state as mOxie.Blob object. Cannot be run on empty or image in progress (throws DOMException.INVALID_STATE_ERR). @method getAsBlob @param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png @param {Number} [quality=90] Applicable only together with mime type image/jpeg @return {Blob} Image as Blob */ getAsBlob: function(type, quality) { if (!this.size) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } return this.exec('Image', 'getAsBlob', type || 'image/jpeg', quality || 90); }, /** Retrieves image in it's current state as dataURL string. Cannot be run on empty or image in progress (throws DOMException.INVALID_STATE_ERR). @method getAsDataURL @param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png @param {Number} [quality=90] Applicable only together with mime type image/jpeg @return {String} Image as dataURL string */ getAsDataURL: function(type, quality) { if (!this.size) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } return this.exec('Image', 'getAsDataURL', type || 'image/jpeg', quality || 90); }, /** Retrieves image in it's current state as binary string. Cannot be run on empty or image in progress (throws DOMException.INVALID_STATE_ERR). @method getAsBinaryString @param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png @param {Number} [quality=90] Applicable only together with mime type image/jpeg @return {String} Image as binary string */ getAsBinaryString: function(type, quality) { var dataUrl = this.getAsDataURL(type, quality); return Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7)); }, /** Embeds a visual representation of the image into the specified node. Depending on the runtime, it might be a canvas, an img node or a thrid party shim object (Flash or SilverLight - very rare, can be used in legacy browsers that do not have canvas or proper dataURI support). @method embed @param {DOMElement} el DOM element to insert the image object into @param {Object} [opts] @param {Number} [opts.width] The width of an embed (defaults to the image width) @param {Number} [opts.height] The height of an embed (defaults to the image height) @param {String} [type="image/jpeg"] Mime type @param {Number} [quality=90] Quality of an embed, if mime type is image/jpeg @param {Boolean} [crop=false] Whether to crop an embed to the specified dimensions */ embed: function(el, opts) { var self = this , runtime // this has to be outside of all the closures to contain proper runtime ; opts = Basic.extend({ width: this.width, height: this.height, type: this.type || 'image/jpeg', quality: 90 }, opts || {}); function render(type, quality) { var img = this; // if possible, embed a canvas element directly if (Env.can('create_canvas')) { var canvas = img.getAsCanvas(); if (canvas) { el.appendChild(canvas); canvas = null; img.destroy(); self.trigger('embedded'); return; } } var dataUrl = img.getAsDataURL(type, quality); if (!dataUrl) { throw new x.ImageError(x.ImageError.WRONG_FORMAT); } if (Env.can('use_data_uri_of', dataUrl.length)) { el.innerHTML = '<img src="' + dataUrl + '" width="' + img.width + '" height="' + img.height + '" />'; img.destroy(); self.trigger('embedded'); } else { var tr = new Transporter(); tr.bind("TransportingComplete", function() { runtime = self.connectRuntime(this.result.ruid); self.bind("Embedded", function() { // position and size properly Basic.extend(runtime.getShimContainer().style, { //position: 'relative', top: '0px', left: '0px', width: img.width + 'px', height: img.height + 'px' }); // some shims (Flash/SilverLight) reinitialize, if parent element is hidden, reordered or it's // position type changes (in Gecko), but since we basically need this only in IEs 6/7 and // sometimes 8 and they do not have this problem, we can comment this for now /*tr.bind("RuntimeInit", function(e, runtime) { tr.destroy(); runtime.destroy(); onResize.call(self); // re-feed our image data });*/ runtime = null; // release }, 999); runtime.exec.call(self, "ImageView", "display", this.result.uid, width, height); img.destroy(); }); tr.transport(Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7)), type, { required_caps: { display_media: true }, runtime_order: 'flash,silverlight', container: el }); } } try { if (!(el = Dom.get(el))) { throw new x.DOMException(x.DOMException.INVALID_NODE_TYPE_ERR); } if (!this.size) { // only preloaded image objects can be used as source throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // high-resolution images cannot be consistently handled across the runtimes if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) { //throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR); } var imgCopy = new Image(); imgCopy.bind("Resize", function() { render.call(this, opts.type, opts.quality); }); imgCopy.bind("Load", function() { imgCopy.downsize(opts); }); // if embedded thumb data is available and dimensions are big enough, use it if (this.meta.thumb && this.meta.thumb.width >= opts.width && this.meta.thumb.height >= opts.height) { imgCopy.load(this.meta.thumb.data); } else { imgCopy.clone(this, false); } return imgCopy; } catch(ex) { // for now simply trigger error event this.trigger('error', ex.code); } }, /** Properly destroys the image and frees resources in use. If any. Recommended way to dispose mOxie.Image object. @method destroy */ destroy: function() { if (this.ruid) { this.getRuntime().exec.call(this, 'Image', 'destroy'); this.disconnectRuntime(); } this.unbindAll(); } }); // this is here, because in order to bind properly, we need uid, which is created above this.handleEventProps(dispatches); this.bind('Load Resize', function() { _updateInfo.call(this); }, 999); function _updateInfo(info) { if (!info) { info = this.exec('Image', 'getInfo'); } this.size = info.size; this.width = info.width; this.height = info.height; this.type = info.type; this.meta = info.meta; // update file name, only if empty if (this.name === '') { this.name = info.name; } } function _load(src) { var srcType = Basic.typeOf(src); try { // if source is Image if (src instanceof Image) { if (!src.size) { // only preloaded image objects can be used as source throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } _loadFromImage.apply(this, arguments); } // if source is o.Blob/o.File else if (src instanceof Blob) { if (!~Basic.inArray(src.type, ['image/jpeg', 'image/png'])) { throw new x.ImageError(x.ImageError.WRONG_FORMAT); } _loadFromBlob.apply(this, arguments); } // if native blob/file else if (Basic.inArray(srcType, ['blob', 'file']) !== -1) { _load.call(this, new File(null, src), arguments[1]); } // if String else if (srcType === 'string') { // if dataUrl String if (src.substr(0, 5) === 'data:') { _load.call(this, new Blob(null, { data: src }), arguments[1]); } // else assume Url, either relative or absolute else { _loadFromUrl.apply(this, arguments); } } // if source seems to be an img node else if (srcType === 'node' && src.nodeName.toLowerCase() === 'img') { _load.call(this, src.src, arguments[1]); } else { throw new x.DOMException(x.DOMException.TYPE_MISMATCH_ERR); } } catch(ex) { // for now simply trigger error event this.trigger('error', ex.code); } } function _loadFromImage(img, exact) { var runtime = this.connectRuntime(img.ruid); this.ruid = runtime.uid; runtime.exec.call(this, 'Image', 'loadFromImage', img, (Basic.typeOf(exact) === 'undefined' ? true : exact)); } function _loadFromBlob(blob, options) { var self = this; self.name = blob.name || ''; function exec(runtime) { self.ruid = runtime.uid; runtime.exec.call(self, 'Image', 'loadFromBlob', blob); } if (blob.isDetached()) { this.bind('RuntimeInit', function(e, runtime) { exec(runtime); }); // convert to object representation if (options && typeof(options.required_caps) === 'string') { options.required_caps = Runtime.parseCaps(options.required_caps); } this.connectRuntime(Basic.extend({ required_caps: { access_image_binary: true, resize_image: true } }, options)); } else { exec(this.connectRuntime(blob.ruid)); } } function _loadFromUrl(url, options) { var self = this, xhr; xhr = new XMLHttpRequest(); xhr.open('get', url); xhr.responseType = 'blob'; xhr.onprogress = function(e) { self.trigger(e); }; xhr.onload = function() { _loadFromBlob.call(self, xhr.response, true); }; xhr.onerror = function(e) { self.trigger(e); }; xhr.onloadend = function() { xhr.destroy(); }; xhr.bind('RuntimeError', function(e, err) { self.trigger('RuntimeError', err); }); xhr.send(null, options); } } // virtual world will crash on you if image has a resolution higher than this: Image.MAX_RESIZE_WIDTH = 8192; Image.MAX_RESIZE_HEIGHT = 8192; Image.prototype = EventTarget.instance; return Image; }); // Included from: src/javascript/runtime/html5/Runtime.js /** * Runtime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /*global File:true */ /** Defines constructor for HTML5 runtime. @class moxie/runtime/html5/Runtime @private */ define("moxie/runtime/html5/Runtime", [ "moxie/core/utils/Basic", "moxie/core/Exceptions", "moxie/runtime/Runtime", "moxie/core/utils/Env" ], function(Basic, x, Runtime, Env) { var type = "html5", extensions = {}; function Html5Runtime(options) { var I = this , Test = Runtime.capTest , True = Runtime.capTrue ; var caps = Basic.extend({ access_binary: Test(window.FileReader || window.File && window.File.getAsDataURL), access_image_binary: function() { return I.can('access_binary') && !!extensions.Image; }, display_media: Test(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')), do_cors: Test(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()), drag_and_drop: Test(function() { // this comes directly from Modernizr: http://www.modernizr.com/ var div = document.createElement('div'); // IE has support for drag and drop since version 5, but doesn't support dropping files from desktop return (('draggable' in div) || ('ondragstart' in div && 'ondrop' in div)) && (Env.browser !== 'IE' || Env.verComp(Env.version, 9, '>')); }()), filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest return (Env.browser === 'Chrome' && Env.verComp(Env.version, 28, '>=')) || (Env.browser === 'IE' && Env.verComp(Env.version, 10, '>=')) || (Env.browser === 'Safari' && Env.verComp(Env.version, 7, '>=')); }()), return_response_headers: True, return_response_type: function(responseType) { if (responseType === 'json' && !!window.JSON) { // we can fake this one even if it's not supported return true; } return Env.can('return_response_type', responseType); }, return_status_code: True, report_upload_progress: Test(window.XMLHttpRequest && new XMLHttpRequest().upload), resize_image: function() { return I.can('access_binary') && Env.can('create_canvas'); }, select_file: function() { return Env.can('use_fileinput') && window.File; }, select_folder: function() { return I.can('select_file') && Env.browser === 'Chrome' && Env.verComp(Env.version, 21, '>='); }, select_multiple: function() { // it is buggy on Safari Windows and iOS return I.can('select_file') && !(Env.browser === 'Safari' && Env.os === 'Windows') && !(Env.os === 'iOS' && Env.verComp(Env.osVersion, "7.0.0", '>') && Env.verComp(Env.osVersion, "8.0.0", '<')); }, send_binary_string: Test(window.XMLHttpRequest && (new XMLHttpRequest().sendAsBinary || (window.Uint8Array && window.ArrayBuffer))), send_custom_headers: Test(window.XMLHttpRequest), send_multipart: function() { return !!(window.XMLHttpRequest && new XMLHttpRequest().upload && window.FormData) || I.can('send_binary_string'); }, slice_blob: Test(window.File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice)), stream_upload: function(){ return I.can('slice_blob') && I.can('send_multipart'); }, summon_file_dialog: function() { // yeah... some dirty sniffing here... return I.can('select_file') && ( (Env.browser === 'Firefox' && Env.verComp(Env.version, 4, '>=')) || (Env.browser === 'Opera' && Env.verComp(Env.version, 12, '>=')) || (Env.browser === 'IE' && Env.verComp(Env.version, 10, '>=')) || !!~Basic.inArray(Env.browser, ['Chrome', 'Safari']) ); }, upload_filesize: True }, arguments[2] ); Runtime.call(this, options, (arguments[1] || type), caps); Basic.extend(this, { init : function() { this.trigger("Init"); }, destroy: (function(destroy) { // extend default destroy method return function() { destroy.call(I); destroy = I = null; }; }(this.destroy)) }); Basic.extend(this.getShim(), extensions); } Runtime.addConstructor(type, Html5Runtime); return extensions; }); // Included from: src/javascript/core/utils/Events.js /** * Events.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Events', [ 'moxie/core/utils/Basic' ], function(Basic) { var eventhash = {}, uid = 'moxie_' + Basic.guid(); // IE W3C like event funcs function preventDefault() { this.returnValue = false; } function stopPropagation() { this.cancelBubble = true; } /** Adds an event handler to the specified object and store reference to the handler in objects internal Plupload registry (@see removeEvent). @method addEvent @for Utils @static @param {Object} obj DOM element like object to add handler to. @param {String} name Name to add event listener to. @param {Function} callback Function to call when event occurs. @param {String} [key] that might be used to add specifity to the event record. */ var addEvent = function(obj, name, callback, key) { var func, events; name = name.toLowerCase(); // Add event listener if (obj.addEventListener) { func = callback; obj.addEventListener(name, func, false); } else if (obj.attachEvent) { func = function() { var evt = window.event; if (!evt.target) { evt.target = evt.srcElement; } evt.preventDefault = preventDefault; evt.stopPropagation = stopPropagation; callback(evt); }; obj.attachEvent('on' + name, func); } // Log event handler to objects internal mOxie registry if (!obj[uid]) { obj[uid] = Basic.guid(); } if (!eventhash.hasOwnProperty(obj[uid])) { eventhash[obj[uid]] = {}; } events = eventhash[obj[uid]]; if (!events.hasOwnProperty(name)) { events[name] = []; } events[name].push({ func: func, orig: callback, // store original callback for IE key: key }); }; /** Remove event handler from the specified object. If third argument (callback) is not specified remove all events with the specified name. @method removeEvent @static @param {Object} obj DOM element to remove event listener(s) from. @param {String} name Name of event listener to remove. @param {Function|String} [callback] might be a callback or unique key to match. */ var removeEvent = function(obj, name, callback) { var type, undef; name = name.toLowerCase(); if (obj[uid] && eventhash[obj[uid]] && eventhash[obj[uid]][name]) { type = eventhash[obj[uid]][name]; } else { return; } for (var i = type.length - 1; i >= 0; i--) { // undefined or not, key should match if (type[i].orig === callback || type[i].key === callback) { if (obj.removeEventListener) { obj.removeEventListener(name, type[i].func, false); } else if (obj.detachEvent) { obj.detachEvent('on'+name, type[i].func); } type[i].orig = null; type[i].func = null; type.splice(i, 1); // If callback was passed we are done here, otherwise proceed if (callback !== undef) { break; } } } // If event array got empty, remove it if (!type.length) { delete eventhash[obj[uid]][name]; } // If mOxie registry has become empty, remove it if (Basic.isEmptyObj(eventhash[obj[uid]])) { delete eventhash[obj[uid]]; // IE doesn't let you remove DOM object property with - delete try { delete obj[uid]; } catch(e) { obj[uid] = undef; } } }; /** Remove all kind of events from the specified object @method removeAllEvents @static @param {Object} obj DOM element to remove event listeners from. @param {String} [key] unique key to match, when removing events. */ var removeAllEvents = function(obj, key) { if (!obj || !obj[uid]) { return; } Basic.each(eventhash[obj[uid]], function(events, name) { removeEvent(obj, name, key); }); }; return { addEvent: addEvent, removeEvent: removeEvent, removeAllEvents: removeAllEvents }; }); // Included from: src/javascript/runtime/html5/file/FileInput.js /** * FileInput.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/file/FileInput @private */ define("moxie/runtime/html5/file/FileInput", [ "moxie/runtime/html5/Runtime", "moxie/file/File", "moxie/core/utils/Basic", "moxie/core/utils/Dom", "moxie/core/utils/Events", "moxie/core/utils/Mime", "moxie/core/utils/Env" ], function(extensions, File, Basic, Dom, Events, Mime, Env) { function FileInput() { var _options; Basic.extend(this, { init: function(options) { var comp = this, I = comp.getRuntime(), input, shimContainer, mimes, browseButton, zIndex, top; _options = options; // figure out accept string mimes = _options.accept.mimes || Mime.extList2mimes(_options.accept, I.can('filter_by_extension')); shimContainer = I.getShimContainer(); shimContainer.innerHTML = '<input id="' + I.uid +'" type="file" style="font-size:999px;opacity:0;"' + (_options.multiple && I.can('select_multiple') ? 'multiple' : '') + (_options.directory && I.can('select_folder') ? 'webkitdirectory directory' : '') + // Chrome 11+ (mimes ? ' accept="' + mimes.join(',') + '"' : '') + ' />'; input = Dom.get(I.uid); // prepare file input to be placed underneath the browse_button element Basic.extend(input.style, { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }); browseButton = Dom.get(_options.browse_button); // Route click event to the input[type=file] element for browsers that support such behavior if (I.can('summon_file_dialog')) { if (Dom.getStyle(browseButton, 'position') === 'static') { browseButton.style.position = 'relative'; } zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 1; browseButton.style.zIndex = zIndex; shimContainer.style.zIndex = zIndex - 1; Events.addEvent(browseButton, 'click', function(e) { var input = Dom.get(I.uid); if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file] input.click(); } e.preventDefault(); }, comp.uid); } /* Since we have to place input[type=file] on top of the browse_button for some browsers, browse_button loses interactivity, so we restore it here */ top = I.can('summon_file_dialog') ? browseButton : shimContainer; Events.addEvent(top, 'mouseover', function() { comp.trigger('mouseenter'); }, comp.uid); Events.addEvent(top, 'mouseout', function() { comp.trigger('mouseleave'); }, comp.uid); Events.addEvent(top, 'mousedown', function() { comp.trigger('mousedown'); }, comp.uid); Events.addEvent(Dom.get(_options.container), 'mouseup', function() { comp.trigger('mouseup'); }, comp.uid); input.onchange = function onChange(e) { // there should be only one handler for this comp.files = []; Basic.each(this.files, function(file) { var relativePath = ''; if (_options.directory) { // folders are represented by dots, filter them out (Chrome 11+) if (file.name == ".") { // if it looks like a folder... return true; } } if (file.webkitRelativePath) { relativePath = '/' + file.webkitRelativePath.replace(/^\//, ''); } file = new File(I.uid, file); file.relativePath = relativePath; comp.files.push(file); }); // clearing the value enables the user to select the same file again if they want to if (Env.browser !== 'IE' && Env.browser !== 'IEMobile') { this.value = ''; } else { // in IE input[type="file"] is read-only so the only way to reset it is to re-insert it var clone = this.cloneNode(true); this.parentNode.replaceChild(clone, this); clone.onchange = onChange; } if (comp.files.length) { comp.trigger('change'); } }; // ready event is perfectly asynchronous comp.trigger({ type: 'ready', async: true }); shimContainer = null; }, disable: function(state) { var I = this.getRuntime(), input; if ((input = Dom.get(I.uid))) { input.disabled = !!state; } }, destroy: function() { var I = this.getRuntime() , shim = I.getShim() , shimContainer = I.getShimContainer() ; Events.removeAllEvents(shimContainer, this.uid); Events.removeAllEvents(_options && Dom.get(_options.container), this.uid); Events.removeAllEvents(_options && Dom.get(_options.browse_button), this.uid); if (shimContainer) { shimContainer.innerHTML = ''; } shim.removeInstance(this.uid); _options = shimContainer = shim = null; } }); } return (extensions.FileInput = FileInput); }); // Included from: src/javascript/runtime/html5/file/Blob.js /** * Blob.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/file/Blob @private */ define("moxie/runtime/html5/file/Blob", [ "moxie/runtime/html5/Runtime", "moxie/file/Blob" ], function(extensions, Blob) { function HTML5Blob() { function w3cBlobSlice(blob, start, end) { var blobSlice; if (window.File.prototype.slice) { try { blob.slice(); // depricated version will throw WRONG_ARGUMENTS_ERR exception return blob.slice(start, end); } catch (e) { // depricated slice method return blob.slice(start, end - start); } // slice method got prefixed: https://bugzilla.mozilla.org/show_bug.cgi?id=649672 } else if ((blobSlice = window.File.prototype.webkitSlice || window.File.prototype.mozSlice)) { return blobSlice.call(blob, start, end); } else { return null; // or throw some exception } } this.slice = function() { return new Blob(this.getRuntime().uid, w3cBlobSlice.apply(this, arguments)); }; } return (extensions.Blob = HTML5Blob); }); // Included from: src/javascript/runtime/html5/file/FileDrop.js /** * FileDrop.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/file/FileDrop @private */ define("moxie/runtime/html5/file/FileDrop", [ "moxie/runtime/html5/Runtime", 'moxie/file/File', "moxie/core/utils/Basic", "moxie/core/utils/Dom", "moxie/core/utils/Events", "moxie/core/utils/Mime" ], function(extensions, File, Basic, Dom, Events, Mime) { function FileDrop() { var _files = [], _allowedExts = [], _options, _ruid; Basic.extend(this, { init: function(options) { var comp = this, dropZone; _options = options; _ruid = comp.ruid; // every dropped-in file should have a reference to the runtime _allowedExts = _extractExts(_options.accept); dropZone = _options.container; Events.addEvent(dropZone, 'dragover', function(e) { if (!_hasFiles(e)) { return; } e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; }, comp.uid); Events.addEvent(dropZone, 'drop', function(e) { if (!_hasFiles(e)) { return; } e.preventDefault(); _files = []; // Chrome 21+ accepts folders via Drag'n'Drop if (e.dataTransfer.items && e.dataTransfer.items[0].webkitGetAsEntry) { _readItems(e.dataTransfer.items, function() { comp.files = _files; comp.trigger("drop"); }); } else { Basic.each(e.dataTransfer.files, function(file) { _addFile(file); }); comp.files = _files; comp.trigger("drop"); } }, comp.uid); Events.addEvent(dropZone, 'dragenter', function(e) { comp.trigger("dragenter"); }, comp.uid); Events.addEvent(dropZone, 'dragleave', function(e) { comp.trigger("dragleave"); }, comp.uid); }, destroy: function() { Events.removeAllEvents(_options && Dom.get(_options.container), this.uid); _ruid = _files = _allowedExts = _options = null; } }); function _hasFiles(e) { if (!e.dataTransfer || !e.dataTransfer.types) { // e.dataTransfer.files is not available in Gecko during dragover return false; } var types = Basic.toArray(e.dataTransfer.types || []); return Basic.inArray("Files", types) !== -1 || Basic.inArray("public.file-url", types) !== -1 || // Safari < 5 Basic.inArray("application/x-moz-file", types) !== -1 // Gecko < 1.9.2 (< Firefox 3.6) ; } function _addFile(file, relativePath) { if (_isAcceptable(file)) { var fileObj = new File(_ruid, file); fileObj.relativePath = relativePath || ''; _files.push(fileObj); } } function _extractExts(accept) { var exts = []; for (var i = 0; i < accept.length; i++) { [].push.apply(exts, accept[i].extensions.split(/\s*,\s*/)); } return Basic.inArray('*', exts) === -1 ? exts : []; } function _isAcceptable(file) { if (!_allowedExts.length) { return true; } var ext = Mime.getFileExtension(file.name); return !ext || Basic.inArray(ext, _allowedExts) !== -1; } function _readItems(items, cb) { var entries = []; Basic.each(items, function(item) { var entry = item.webkitGetAsEntry(); // Address #998 (https://code.google.com/p/chromium/issues/detail?id=332579) if (entry) { // file() fails on OSX when the filename contains a special character (e.g. umlaut): see #61 if (entry.isFile) { _addFile(item.getAsFile(), entry.fullPath); } else { entries.push(entry); } } }); if (entries.length) { _readEntries(entries, cb); } else { cb(); } } function _readEntries(entries, cb) { var queue = []; Basic.each(entries, function(entry) { queue.push(function(cbcb) { _readEntry(entry, cbcb); }); }); Basic.inSeries(queue, function() { cb(); }); } function _readEntry(entry, cb) { if (entry.isFile) { entry.file(function(file) { _addFile(file, entry.fullPath); cb(); }, function() { // fire an error event maybe cb(); }); } else if (entry.isDirectory) { _readDirEntry(entry, cb); } else { cb(); // not file, not directory? what then?.. } } function _readDirEntry(dirEntry, cb) { var entries = [], dirReader = dirEntry.createReader(); // keep quering recursively till no more entries function getEntries(cbcb) { dirReader.readEntries(function(moreEntries) { if (moreEntries.length) { [].push.apply(entries, moreEntries); getEntries(cbcb); } else { cbcb(); } }, cbcb); } // ...and you thought FileReader was crazy... getEntries(function() { _readEntries(entries, cb); }); } } return (extensions.FileDrop = FileDrop); }); // Included from: src/javascript/runtime/html5/file/FileReader.js /** * FileReader.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/file/FileReader @private */ define("moxie/runtime/html5/file/FileReader", [ "moxie/runtime/html5/Runtime", "moxie/core/utils/Encode", "moxie/core/utils/Basic" ], function(extensions, Encode, Basic) { function FileReader() { var _fr, _convertToBinary = false; Basic.extend(this, { read: function(op, blob) { var comp = this; comp.result = ''; _fr = new window.FileReader(); _fr.addEventListener('progress', function(e) { comp.trigger(e); }); _fr.addEventListener('load', function(e) { comp.result = _convertToBinary ? _toBinary(_fr.result) : _fr.result; comp.trigger(e); }); _fr.addEventListener('error', function(e) { comp.trigger(e, _fr.error); }); _fr.addEventListener('loadend', function(e) { _fr = null; comp.trigger(e); }); if (Basic.typeOf(_fr[op]) === 'function') { _convertToBinary = false; _fr[op](blob.getSource()); } else if (op === 'readAsBinaryString') { // readAsBinaryString is depricated in general and never existed in IE10+ _convertToBinary = true; _fr.readAsDataURL(blob.getSource()); } }, abort: function() { if (_fr) { _fr.abort(); } }, destroy: function() { _fr = null; } }); function _toBinary(str) { return Encode.atob(str.substring(str.indexOf('base64,') + 7)); } } return (extensions.FileReader = FileReader); }); // Included from: src/javascript/runtime/html5/xhr/XMLHttpRequest.js /** * XMLHttpRequest.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /*global ActiveXObject:true */ /** @class moxie/runtime/html5/xhr/XMLHttpRequest @private */ define("moxie/runtime/html5/xhr/XMLHttpRequest", [ "moxie/runtime/html5/Runtime", "moxie/core/utils/Basic", "moxie/core/utils/Mime", "moxie/core/utils/Url", "moxie/file/File", "moxie/file/Blob", "moxie/xhr/FormData", "moxie/core/Exceptions", "moxie/core/utils/Env" ], function(extensions, Basic, Mime, Url, File, Blob, FormData, x, Env) { function XMLHttpRequest() { var self = this , _xhr , _filename ; Basic.extend(this, { send: function(meta, data) { var target = this , isGecko2_5_6 = (Env.browser === 'Mozilla' && Env.verComp(Env.version, 4, '>=') && Env.verComp(Env.version, 7, '<')) , isAndroidBrowser = Env.browser === 'Android Browser' , mustSendAsBinary = false ; // extract file name _filename = meta.url.replace(/^.+?\/([\w\-\.]+)$/, '$1').toLowerCase(); _xhr = _getNativeXHR(); _xhr.open(meta.method, meta.url, meta.async, meta.user, meta.password); // prepare data to be sent if (data instanceof Blob) { if (data.isDetached()) { mustSendAsBinary = true; } data = data.getSource(); } else if (data instanceof FormData) { if (data.hasBlob()) { if (data.getBlob().isDetached()) { data = _prepareMultipart.call(target, data); // _xhr must be instantiated and be in OPENED state mustSendAsBinary = true; } else if ((isGecko2_5_6 || isAndroidBrowser) && Basic.typeOf(data.getBlob().getSource()) === 'blob' && window.FileReader) { // Gecko 2/5/6 can't send blob in FormData: https://bugzilla.mozilla.org/show_bug.cgi?id=649150 // Android browsers (default one and Dolphin) seem to have the same issue, see: #613 _preloadAndSend.call(target, meta, data); return; // _preloadAndSend will reinvoke send() with transmutated FormData =%D } } // transfer fields to real FormData if (data instanceof FormData) { // if still a FormData, e.g. not mangled by _prepareMultipart() var fd = new window.FormData(); data.each(function(value, name) { if (value instanceof Blob) { fd.append(name, value.getSource()); } else { fd.append(name, value); } }); data = fd; } } // if XHR L2 if (_xhr.upload) { if (meta.withCredentials) { _xhr.withCredentials = true; } _xhr.addEventListener('load', function(e) { target.trigger(e); }); _xhr.addEventListener('error', function(e) { target.trigger(e); }); // additionally listen to progress events _xhr.addEventListener('progress', function(e) { target.trigger(e); }); _xhr.upload.addEventListener('progress', function(e) { target.trigger({ type: 'UploadProgress', loaded: e.loaded, total: e.total }); }); // ... otherwise simulate XHR L2 } else { _xhr.onreadystatechange = function onReadyStateChange() { // fake Level 2 events switch (_xhr.readyState) { case 1: // XMLHttpRequest.OPENED // readystatechanged is fired twice for OPENED state (in IE and Mozilla) - neu break; // looks like HEADERS_RECEIVED (state 2) is not reported in Opera (or it's old versions) - neu case 2: // XMLHttpRequest.HEADERS_RECEIVED break; case 3: // XMLHttpRequest.LOADING // try to fire progress event for not XHR L2 var total, loaded; try { if (Url.hasSameOrigin(meta.url)) { // Content-Length not accessible for cross-domain on some browsers total = _xhr.getResponseHeader('Content-Length') || 0; // old Safari throws an exception here } if (_xhr.responseText) { // responseText was introduced in IE7 loaded = _xhr.responseText.length; } } catch(ex) { total = loaded = 0; } target.trigger({ type: 'progress', lengthComputable: !!total, total: parseInt(total, 10), loaded: loaded }); break; case 4: // XMLHttpRequest.DONE // release readystatechange handler (mostly for IE) _xhr.onreadystatechange = function() {}; // usually status 0 is returned when server is unreachable, but FF also fails to status 0 for 408 timeout if (_xhr.status === 0) { target.trigger('error'); } else { target.trigger('load'); } break; } }; } // set request headers if (!Basic.isEmptyObj(meta.headers)) { Basic.each(meta.headers, function(value, header) { _xhr.setRequestHeader(header, value); }); } // request response type if ("" !== meta.responseType && 'responseType' in _xhr) { if ('json' === meta.responseType && !Env.can('return_response_type', 'json')) { // we can fake this one _xhr.responseType = 'text'; } else { _xhr.responseType = meta.responseType; } } // send ... if (!mustSendAsBinary) { _xhr.send(data); } else { if (_xhr.sendAsBinary) { // Gecko _xhr.sendAsBinary(data); } else { // other browsers having support for typed arrays (function() { // mimic Gecko's sendAsBinary var ui8a = new Uint8Array(data.length); for (var i = 0; i < data.length; i++) { ui8a[i] = (data.charCodeAt(i) & 0xff); } _xhr.send(ui8a.buffer); }()); } } target.trigger('loadstart'); }, getStatus: function() { // according to W3C spec it should return 0 for readyState < 3, but instead it throws an exception try { if (_xhr) { return _xhr.status; } } catch(ex) {} return 0; }, getResponse: function(responseType) { var I = this.getRuntime(); try { switch (responseType) { case 'blob': var file = new File(I.uid, _xhr.response); // try to extract file name from content-disposition if possible (might be - not, if CORS for example) var disposition = _xhr.getResponseHeader('Content-Disposition'); if (disposition) { // extract filename from response header if available var match = disposition.match(/filename=([\'\"'])([^\1]+)\1/); if (match) { _filename = match[2]; } } file.name = _filename; // pre-webkit Opera doesn't set type property on the blob response if (!file.type) { file.type = Mime.getFileMime(_filename); } return file; case 'json': if (!Env.can('return_response_type', 'json')) { return _xhr.status === 200 && !!window.JSON ? JSON.parse(_xhr.responseText) : null; } return _xhr.response; case 'document': return _getDocument(_xhr); default: return _xhr.responseText !== '' ? _xhr.responseText : null; // against the specs, but for consistency across the runtimes } } catch(ex) { return null; } }, getAllResponseHeaders: function() { try { return _xhr.getAllResponseHeaders(); } catch(ex) {} return ''; }, abort: function() { if (_xhr) { _xhr.abort(); } }, destroy: function() { self = _filename = null; } }); // here we go... ugly fix for ugly bug function _preloadAndSend(meta, data) { var target = this, blob, fr; // get original blob blob = data.getBlob().getSource(); // preload blob in memory to be sent as binary string fr = new window.FileReader(); fr.onload = function() { // overwrite original blob data.append(data.getBlobName(), new Blob(null, { type: blob.type, data: fr.result })); // invoke send operation again self.send.call(target, meta, data); }; fr.readAsBinaryString(blob); } function _getNativeXHR() { if (window.XMLHttpRequest && !(Env.browser === 'IE' && Env.verComp(Env.version, 8, '<'))) { // IE7 has native XHR but it's buggy return new window.XMLHttpRequest(); } else { return (function() { var progIDs = ['Msxml2.XMLHTTP.6.0', 'Microsoft.XMLHTTP']; // if 6.0 available, use it, otherwise failback to default 3.0 for (var i = 0; i < progIDs.length; i++) { try { return new ActiveXObject(progIDs[i]); } catch (ex) {} } })(); } } // @credits Sergey Ilinsky (http://www.ilinsky.com/) function _getDocument(xhr) { var rXML = xhr.responseXML; var rText = xhr.responseText; // Try parsing responseText (@see: http://www.ilinsky.com/articles/XMLHttpRequest/#bugs-ie-responseXML-content-type) if (Env.browser === 'IE' && rText && rXML && !rXML.documentElement && /[^\/]+\/[^\+]+\+xml/.test(xhr.getResponseHeader("Content-Type"))) { rXML = new window.ActiveXObject("Microsoft.XMLDOM"); rXML.async = false; rXML.validateOnParse = false; rXML.loadXML(rText); } // Check if there is no error in document if (rXML) { if ((Env.browser === 'IE' && rXML.parseError !== 0) || !rXML.documentElement || rXML.documentElement.tagName === "parsererror") { return null; } } return rXML; } function _prepareMultipart(fd) { var boundary = '----moxieboundary' + new Date().getTime() , dashdash = '--' , crlf = '\r\n' , multipart = '' , I = this.getRuntime() ; if (!I.can('send_binary_string')) { throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR); } _xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + boundary); // append multipart parameters fd.each(function(value, name) { // Firefox 3.6 failed to convert multibyte characters to UTF-8 in sendAsBinary(), // so we try it here ourselves with: unescape(encodeURIComponent(value)) if (value instanceof Blob) { // Build RFC2388 blob multipart += dashdash + boundary + crlf + 'Content-Disposition: form-data; name="' + name + '"; filename="' + unescape(encodeURIComponent(value.name || 'blob')) + '"' + crlf + 'Content-Type: ' + (value.type || 'application/octet-stream') + crlf + crlf + value.getSource() + crlf; } else { multipart += dashdash + boundary + crlf + 'Content-Disposition: form-data; name="' + name + '"' + crlf + crlf + unescape(encodeURIComponent(value)) + crlf; } }); multipart += dashdash + boundary + dashdash + crlf; return multipart; } } return (extensions.XMLHttpRequest = XMLHttpRequest); }); // Included from: src/javascript/runtime/html5/utils/BinaryReader.js /** * BinaryReader.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/utils/BinaryReader @private */ define("moxie/runtime/html5/utils/BinaryReader", [ "moxie/core/utils/Basic" ], function(Basic) { function BinaryReader(data) { if (data instanceof ArrayBuffer) { ArrayBufferReader.apply(this, arguments); } else { UTF16StringReader.apply(this, arguments); } } Basic.extend(BinaryReader.prototype, { littleEndian: false, read: function(idx, size) { var sum, mv, i; if (idx + size > this.length()) { throw new Error("You are trying to read outside the source boundaries."); } mv = this.littleEndian ? 0 : -8 * (size - 1) ; for (i = 0, sum = 0; i < size; i++) { sum |= (this.readByteAt(idx + i) << Math.abs(mv + i*8)); } return sum; }, write: function(idx, num, size) { var mv, i, str = ''; if (idx > this.length()) { throw new Error("You are trying to write outside the source boundaries."); } mv = this.littleEndian ? 0 : -8 * (size - 1) ; for (i = 0; i < size; i++) { this.writeByteAt(idx + i, (num >> Math.abs(mv + i*8)) & 255); } }, BYTE: function(idx) { return this.read(idx, 1); }, SHORT: function(idx) { return this.read(idx, 2); }, LONG: function(idx) { return this.read(idx, 4); }, SLONG: function(idx) { // 2's complement notation var num = this.read(idx, 4); return (num > 2147483647 ? num - 4294967296 : num); }, CHAR: function(idx) { return String.fromCharCode(this.read(idx, 1)); }, STRING: function(idx, count) { return this.asArray('CHAR', idx, count).join(''); }, asArray: function(type, idx, count) { var values = []; for (var i = 0; i < count; i++) { values[i] = this[type](idx + i); } return values; } }); function ArrayBufferReader(data) { var _dv = new DataView(data); Basic.extend(this, { readByteAt: function(idx) { return _dv.getUint8(idx); }, writeByteAt: function(idx, value) { _dv.setUint8(idx, value); }, SEGMENT: function(idx, size, value) { switch (arguments.length) { case 2: return data.slice(idx, idx + size); case 1: return data.slice(idx); case 3: if (value === null) { value = new ArrayBuffer(); } if (value instanceof ArrayBuffer) { var arr = new Uint8Array(this.length() - size + value.byteLength); if (idx > 0) { arr.set(new Uint8Array(data.slice(0, idx)), 0); } arr.set(new Uint8Array(value), idx); arr.set(new Uint8Array(data.slice(idx + size)), idx + value.byteLength); this.clear(); data = arr.buffer; _dv = new DataView(data); break; } default: return data; } }, length: function() { return data ? data.byteLength : 0; }, clear: function() { _dv = data = null; } }); } function UTF16StringReader(data) { Basic.extend(this, { readByteAt: function(idx) { return data.charCodeAt(idx); }, writeByteAt: function(idx, value) { putstr(String.fromCharCode(value), idx, 1); }, SEGMENT: function(idx, length, segment) { switch (arguments.length) { case 1: return data.substr(idx); case 2: return data.substr(idx, length); case 3: putstr(segment !== null ? segment : '', idx, length); break; default: return data; } }, length: function() { return data ? data.length : 0; }, clear: function() { data = null; } }); function putstr(segment, idx, length) { length = arguments.length === 3 ? length : data.length - idx - 1; data = data.substr(0, idx) + segment + data.substr(length + idx); } } return BinaryReader; }); // Included from: src/javascript/runtime/html5/image/JPEGHeaders.js /** * JPEGHeaders.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/image/JPEGHeaders @private */ define("moxie/runtime/html5/image/JPEGHeaders", [ "moxie/runtime/html5/utils/BinaryReader", "moxie/core/Exceptions" ], function(BinaryReader, x) { return function JPEGHeaders(data) { var headers = [], _br, idx, marker, length = 0; _br = new BinaryReader(data); // Check if data is jpeg if (_br.SHORT(0) !== 0xFFD8) { _br.clear(); throw new x.ImageError(x.ImageError.WRONG_FORMAT); } idx = 2; while (idx <= _br.length()) { marker = _br.SHORT(idx); // omit RST (restart) markers if (marker >= 0xFFD0 && marker <= 0xFFD7) { idx += 2; continue; } // no headers allowed after SOS marker if (marker === 0xFFDA || marker === 0xFFD9) { break; } length = _br.SHORT(idx + 2) + 2; // APPn marker detected if (marker >= 0xFFE1 && marker <= 0xFFEF) { headers.push({ hex: marker, name: 'APP' + (marker & 0x000F), start: idx, length: length, segment: _br.SEGMENT(idx, length) }); } idx += length; } _br.clear(); return { headers: headers, restore: function(data) { var max, i, br; br = new BinaryReader(data); idx = br.SHORT(2) == 0xFFE0 ? 4 + br.SHORT(4) : 2; for (i = 0, max = headers.length; i < max; i++) { br.SEGMENT(idx, 0, headers[i].segment); idx += headers[i].length; } data = br.SEGMENT(); br.clear(); return data; }, strip: function(data) { var br, headers, jpegHeaders, i; jpegHeaders = new JPEGHeaders(data); headers = jpegHeaders.headers; jpegHeaders.purge(); br = new BinaryReader(data); i = headers.length; while (i--) { br.SEGMENT(headers[i].start, headers[i].length, ''); } data = br.SEGMENT(); br.clear(); return data; }, get: function(name) { var array = []; for (var i = 0, max = headers.length; i < max; i++) { if (headers[i].name === name.toUpperCase()) { array.push(headers[i].segment); } } return array; }, set: function(name, segment) { var array = [], i, ii, max; if (typeof(segment) === 'string') { array.push(segment); } else { array = segment; } for (i = ii = 0, max = headers.length; i < max; i++) { if (headers[i].name === name.toUpperCase()) { headers[i].segment = array[ii]; headers[i].length = array[ii].length; ii++; } if (ii >= array.length) { break; } } }, purge: function() { this.headers = headers = []; } }; }; }); // Included from: src/javascript/runtime/html5/image/ExifParser.js /** * ExifParser.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/image/ExifParser @private */ define("moxie/runtime/html5/image/ExifParser", [ "moxie/core/utils/Basic", "moxie/runtime/html5/utils/BinaryReader", "moxie/core/Exceptions" ], function(Basic, BinaryReader, x) { function ExifParser(data) { var __super__, tags, tagDescs, offsets, idx, Tiff; BinaryReader.call(this, data); tags = { tiff: { /* The image orientation viewed in terms of rows and columns. 1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side. 2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side. 3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side. 4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side. 5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top. 6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top. 7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom. 8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom. */ 0x0112: 'Orientation', 0x010E: 'ImageDescription', 0x010F: 'Make', 0x0110: 'Model', 0x0131: 'Software', 0x8769: 'ExifIFDPointer', 0x8825: 'GPSInfoIFDPointer' }, exif: { 0x9000: 'ExifVersion', 0xA001: 'ColorSpace', 0xA002: 'PixelXDimension', 0xA003: 'PixelYDimension', 0x9003: 'DateTimeOriginal', 0x829A: 'ExposureTime', 0x829D: 'FNumber', 0x8827: 'ISOSpeedRatings', 0x9201: 'ShutterSpeedValue', 0x9202: 'ApertureValue' , 0x9207: 'MeteringMode', 0x9208: 'LightSource', 0x9209: 'Flash', 0x920A: 'FocalLength', 0xA402: 'ExposureMode', 0xA403: 'WhiteBalance', 0xA406: 'SceneCaptureType', 0xA404: 'DigitalZoomRatio', 0xA408: 'Contrast', 0xA409: 'Saturation', 0xA40A: 'Sharpness' }, gps: { 0x0000: 'GPSVersionID', 0x0001: 'GPSLatitudeRef', 0x0002: 'GPSLatitude', 0x0003: 'GPSLongitudeRef', 0x0004: 'GPSLongitude' }, thumb: { 0x0201: 'JPEGInterchangeFormat', 0x0202: 'JPEGInterchangeFormatLength' } }; tagDescs = { 'ColorSpace': { 1: 'sRGB', 0: 'Uncalibrated' }, 'MeteringMode': { 0: 'Unknown', 1: 'Average', 2: 'CenterWeightedAverage', 3: 'Spot', 4: 'MultiSpot', 5: 'Pattern', 6: 'Partial', 255: 'Other' }, 'LightSource': { 1: 'Daylight', 2: 'Fliorescent', 3: 'Tungsten', 4: 'Flash', 9: 'Fine weather', 10: 'Cloudy weather', 11: 'Shade', 12: 'Daylight fluorescent (D 5700 - 7100K)', 13: 'Day white fluorescent (N 4600 -5400K)', 14: 'Cool white fluorescent (W 3900 - 4500K)', 15: 'White fluorescent (WW 3200 - 3700K)', 17: 'Standard light A', 18: 'Standard light B', 19: 'Standard light C', 20: 'D55', 21: 'D65', 22: 'D75', 23: 'D50', 24: 'ISO studio tungsten', 255: 'Other' }, 'Flash': { 0x0000: 'Flash did not fire', 0x0001: 'Flash fired', 0x0005: 'Strobe return light not detected', 0x0007: 'Strobe return light detected', 0x0009: 'Flash fired, compulsory flash mode', 0x000D: 'Flash fired, compulsory flash mode, return light not detected', 0x000F: 'Flash fired, compulsory flash mode, return light detected', 0x0010: 'Flash did not fire, compulsory flash mode', 0x0018: 'Flash did not fire, auto mode', 0x0019: 'Flash fired, auto mode', 0x001D: 'Flash fired, auto mode, return light not detected', 0x001F: 'Flash fired, auto mode, return light detected', 0x0020: 'No flash function', 0x0041: 'Flash fired, red-eye reduction mode', 0x0045: 'Flash fired, red-eye reduction mode, return light not detected', 0x0047: 'Flash fired, red-eye reduction mode, return light detected', 0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode', 0x004D: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected', 0x004F: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected', 0x0059: 'Flash fired, auto mode, red-eye reduction mode', 0x005D: 'Flash fired, auto mode, return light not detected, red-eye reduction mode', 0x005F: 'Flash fired, auto mode, return light detected, red-eye reduction mode' }, 'ExposureMode': { 0: 'Auto exposure', 1: 'Manual exposure', 2: 'Auto bracket' }, 'WhiteBalance': { 0: 'Auto white balance', 1: 'Manual white balance' }, 'SceneCaptureType': { 0: 'Standard', 1: 'Landscape', 2: 'Portrait', 3: 'Night scene' }, 'Contrast': { 0: 'Normal', 1: 'Soft', 2: 'Hard' }, 'Saturation': { 0: 'Normal', 1: 'Low saturation', 2: 'High saturation' }, 'Sharpness': { 0: 'Normal', 1: 'Soft', 2: 'Hard' }, // GPS related 'GPSLatitudeRef': { N: 'North latitude', S: 'South latitude' }, 'GPSLongitudeRef': { E: 'East longitude', W: 'West longitude' } }; offsets = { tiffHeader: 10 }; idx = offsets.tiffHeader; __super__ = { clear: this.clear }; // Public functions Basic.extend(this, { read: function() { try { return ExifParser.prototype.read.apply(this, arguments); } catch (ex) { throw new x.ImageError(x.ImageError.INVALID_META_ERR); } }, write: function() { try { return ExifParser.prototype.write.apply(this, arguments); } catch (ex) { throw new x.ImageError(x.ImageError.INVALID_META_ERR); } }, UNDEFINED: function() { return this.BYTE.apply(this, arguments); }, RATIONAL: function(idx) { return this.LONG(idx) / this.LONG(idx + 4) }, SRATIONAL: function(idx) { return this.SLONG(idx) / this.SLONG(idx + 4) }, ASCII: function(idx) { return this.CHAR(idx); }, TIFF: function() { return Tiff || null; }, EXIF: function() { var Exif = null; if (offsets.exifIFD) { try { Exif = extractTags.call(this, offsets.exifIFD, tags.exif); } catch(ex) { return null; } // Fix formatting of some tags if (Exif.ExifVersion && Basic.typeOf(Exif.ExifVersion) === 'array') { for (var i = 0, exifVersion = ''; i < Exif.ExifVersion.length; i++) { exifVersion += String.fromCharCode(Exif.ExifVersion[i]); } Exif.ExifVersion = exifVersion; } } return Exif; }, GPS: function() { var GPS = null; if (offsets.gpsIFD) { try { GPS = extractTags.call(this, offsets.gpsIFD, tags.gps); } catch (ex) { return null; } // iOS devices (and probably some others) do not put in GPSVersionID tag (why?..) if (GPS.GPSVersionID && Basic.typeOf(GPS.GPSVersionID) === 'array') { GPS.GPSVersionID = GPS.GPSVersionID.join('.'); } } return GPS; }, thumb: function() { if (offsets.IFD1) { try { var IFD1Tags = extractTags.call(this, offsets.IFD1, tags.thumb); if ('JPEGInterchangeFormat' in IFD1Tags) { return this.SEGMENT(offsets.tiffHeader + IFD1Tags.JPEGInterchangeFormat, IFD1Tags.JPEGInterchangeFormatLength); } } catch (ex) {} } return null; }, setExif: function(tag, value) { // Right now only setting of width/height is possible if (tag !== 'PixelXDimension' && tag !== 'PixelYDimension') { return false; } return setTag.call(this, 'exif', tag, value); }, clear: function() { __super__.clear(); data = tags = tagDescs = Tiff = offsets = __super__ = null; } }); // Check if that's APP1 and that it has EXIF if (this.SHORT(0) !== 0xFFE1 || this.STRING(4, 5).toUpperCase() !== "EXIF\0") { throw new x.ImageError(x.ImageError.INVALID_META_ERR); } // Set read order of multi-byte data this.littleEndian = (this.SHORT(idx) == 0x4949); // Check if always present bytes are indeed present if (this.SHORT(idx+=2) !== 0x002A) { throw new x.ImageError(x.ImageError.INVALID_META_ERR); } offsets.IFD0 = offsets.tiffHeader + this.LONG(idx += 2); Tiff = extractTags.call(this, offsets.IFD0, tags.tiff); if ('ExifIFDPointer' in Tiff) { offsets.exifIFD = offsets.tiffHeader + Tiff.ExifIFDPointer; delete Tiff.ExifIFDPointer; } if ('GPSInfoIFDPointer' in Tiff) { offsets.gpsIFD = offsets.tiffHeader + Tiff.GPSInfoIFDPointer; delete Tiff.GPSInfoIFDPointer; } if (Basic.isEmptyObj(Tiff)) { Tiff = null; } // check if we have a thumb as well var IFD1Offset = this.LONG(offsets.IFD0 + this.SHORT(offsets.IFD0) * 12 + 2); if (IFD1Offset) { offsets.IFD1 = offsets.tiffHeader + IFD1Offset; } function extractTags(IFD_offset, tags2extract) { var data = this; var length, i, tag, type, count, size, offset, value, values = [], hash = {}; var types = { 1 : 'BYTE', 7 : 'UNDEFINED', 2 : 'ASCII', 3 : 'SHORT', 4 : 'LONG', 5 : 'RATIONAL', 9 : 'SLONG', 10: 'SRATIONAL' }; var sizes = { 'BYTE' : 1, 'UNDEFINED' : 1, 'ASCII' : 1, 'SHORT' : 2, 'LONG' : 4, 'RATIONAL' : 8, 'SLONG' : 4, 'SRATIONAL' : 8 }; length = data.SHORT(IFD_offset); // The size of APP1 including all these elements shall not exceed the 64 Kbytes specified in the JPEG standard. for (i = 0; i < length; i++) { values = []; // Set binary reader pointer to beginning of the next tag offset = IFD_offset + 2 + i*12; tag = tags2extract[data.SHORT(offset)]; if (tag === undefined) { continue; // Not the tag we requested } type = types[data.SHORT(offset+=2)]; count = data.LONG(offset+=2); size = sizes[type]; if (!size) { throw new x.ImageError(x.ImageError.INVALID_META_ERR); } offset += 4; // tag can only fit 4 bytes of data, if data is larger we should look outside if (size * count > 4) { // instead of data tag contains an offset of the data offset = data.LONG(offset) + offsets.tiffHeader; } // in case we left the boundaries of data throw an early exception if (offset + size * count >= this.length()) { throw new x.ImageError(x.ImageError.INVALID_META_ERR); } // special care for the string if (type === 'ASCII') { hash[tag] = Basic.trim(data.STRING(offset, count).replace(/\0$/, '')); // strip trailing NULL continue; } else { values = data.asArray(type, offset, count); value = (count == 1 ? values[0] : values); if (tagDescs.hasOwnProperty(tag) && typeof value != 'object') { hash[tag] = tagDescs[tag][value]; } else { hash[tag] = value; } } } return hash; } // At the moment only setting of simple (LONG) values, that do not require offset recalculation, is supported function setTag(ifd, tag, value) { var offset, length, tagOffset, valueOffset = 0; // If tag name passed translate into hex key if (typeof(tag) === 'string') { var tmpTags = tags[ifd.toLowerCase()]; for (var hex in tmpTags) { if (tmpTags[hex] === tag) { tag = hex; break; } } } offset = offsets[ifd.toLowerCase() + 'IFD']; length = this.SHORT(offset); for (var i = 0; i < length; i++) { tagOffset = offset + 12 * i + 2; if (this.SHORT(tagOffset) == tag) { valueOffset = tagOffset + 8; break; } } if (!valueOffset) { return false; } try { this.write(valueOffset, value, 4); } catch(ex) { return false; } return true; } } ExifParser.prototype = BinaryReader.prototype; return ExifParser; }); // Included from: src/javascript/runtime/html5/image/JPEG.js /** * JPEG.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/image/JPEG @private */ define("moxie/runtime/html5/image/JPEG", [ "moxie/core/utils/Basic", "moxie/core/Exceptions", "moxie/runtime/html5/image/JPEGHeaders", "moxie/runtime/html5/utils/BinaryReader", "moxie/runtime/html5/image/ExifParser" ], function(Basic, x, JPEGHeaders, BinaryReader, ExifParser) { function JPEG(data) { var _br, _hm, _ep, _info; _br = new BinaryReader(data); // check if it is jpeg if (_br.SHORT(0) !== 0xFFD8) { throw new x.ImageError(x.ImageError.WRONG_FORMAT); } // backup headers _hm = new JPEGHeaders(data); // extract exif info try { _ep = new ExifParser(_hm.get('app1')[0]); } catch(ex) {} // get dimensions _info = _getDimensions.call(this); Basic.extend(this, { type: 'image/jpeg', size: _br.length(), width: _info && _info.width || 0, height: _info && _info.height || 0, setExif: function(tag, value) { if (!_ep) { return false; // or throw an exception } if (Basic.typeOf(tag) === 'object') { Basic.each(tag, function(value, tag) { _ep.setExif(tag, value); }); } else { _ep.setExif(tag, value); } // update internal headers _hm.set('app1', _ep.SEGMENT()); }, writeHeaders: function() { if (!arguments.length) { // if no arguments passed, update headers internally return _hm.restore(data); } return _hm.restore(arguments[0]); }, stripHeaders: function(data) { return _hm.strip(data); }, purge: function() { _purge.call(this); } }); if (_ep) { this.meta = { tiff: _ep.TIFF(), exif: _ep.EXIF(), gps: _ep.GPS(), thumb: _getThumb() }; } function _getDimensions(br) { var idx = 0 , marker , length ; if (!br) { br = _br; } // examine all through the end, since some images might have very large APP segments while (idx <= br.length()) { marker = br.SHORT(idx += 2); if (marker >= 0xFFC0 && marker <= 0xFFC3) { // SOFn idx += 5; // marker (2 bytes) + length (2 bytes) + Sample precision (1 byte) return { height: br.SHORT(idx), width: br.SHORT(idx += 2) }; } length = br.SHORT(idx += 2); idx += length - 2; } return null; } function _getThumb() { var data = _ep.thumb() , br , info ; if (data) { br = new BinaryReader(data); info = _getDimensions(br); br.clear(); if (info) { info.data = data; return info; } } return null; } function _purge() { if (!_ep || !_hm || !_br) { return; // ignore any repeating purge requests } _ep.clear(); _hm.purge(); _br.clear(); _info = _hm = _ep = _br = null; } } return JPEG; }); // Included from: src/javascript/runtime/html5/image/PNG.js /** * PNG.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/image/PNG @private */ define("moxie/runtime/html5/image/PNG", [ "moxie/core/Exceptions", "moxie/core/utils/Basic", "moxie/runtime/html5/utils/BinaryReader" ], function(x, Basic, BinaryReader) { function PNG(data) { var _br, _hm, _ep, _info; _br = new BinaryReader(data); // check if it's png (function() { var idx = 0, i = 0 , signature = [0x8950, 0x4E47, 0x0D0A, 0x1A0A] ; for (i = 0; i < signature.length; i++, idx += 2) { if (signature[i] != _br.SHORT(idx)) { throw new x.ImageError(x.ImageError.WRONG_FORMAT); } } }()); function _getDimensions() { var chunk, idx; chunk = _getChunkAt.call(this, 8); if (chunk.type == 'IHDR') { idx = chunk.start; return { width: _br.LONG(idx), height: _br.LONG(idx += 4) }; } return null; } function _purge() { if (!_br) { return; // ignore any repeating purge requests } _br.clear(); data = _info = _hm = _ep = _br = null; } _info = _getDimensions.call(this); Basic.extend(this, { type: 'image/png', size: _br.length(), width: _info.width, height: _info.height, purge: function() { _purge.call(this); } }); // for PNG we can safely trigger purge automatically, as we do not keep any data for later _purge.call(this); function _getChunkAt(idx) { var length, type, start, CRC; length = _br.LONG(idx); type = _br.STRING(idx += 4, 4); start = idx += 4; CRC = _br.LONG(idx + length); return { length: length, type: type, start: start, CRC: CRC }; } } return PNG; }); // Included from: src/javascript/runtime/html5/image/ImageInfo.js /** * ImageInfo.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/image/ImageInfo @private */ define("moxie/runtime/html5/image/ImageInfo", [ "moxie/core/utils/Basic", "moxie/core/Exceptions", "moxie/runtime/html5/image/JPEG", "moxie/runtime/html5/image/PNG" ], function(Basic, x, JPEG, PNG) { /** Optional image investigation tool for HTML5 runtime. Provides the following features: - ability to distinguish image type (JPEG or PNG) by signature - ability to extract image width/height directly from it's internals, without preloading in memory (fast) - ability to extract APP headers from JPEGs (Exif, GPS, etc) - ability to replace width/height tags in extracted JPEG headers - ability to restore APP headers, that were for example stripped during image manipulation @class ImageInfo @constructor @param {String} data Image source as binary string */ return function(data) { var _cs = [JPEG, PNG], _img; // figure out the format, throw: ImageError.WRONG_FORMAT if not supported _img = (function() { for (var i = 0; i < _cs.length; i++) { try { return new _cs[i](data); } catch (ex) { // console.info(ex); } } throw new x.ImageError(x.ImageError.WRONG_FORMAT); }()); Basic.extend(this, { /** Image Mime Type extracted from it's depths @property type @type {String} @default '' */ type: '', /** Image size in bytes @property size @type {Number} @default 0 */ size: 0, /** Image width extracted from image source @property width @type {Number} @default 0 */ width: 0, /** Image height extracted from image source @property height @type {Number} @default 0 */ height: 0, /** Sets Exif tag. Currently applicable only for width and height tags. Obviously works only with JPEGs. @method setExif @param {String} tag Tag to set @param {Mixed} value Value to assign to the tag */ setExif: function() {}, /** Restores headers to the source. @method writeHeaders @param {String} data Image source as binary string @return {String} Updated binary string */ writeHeaders: function(data) { return data; }, /** Strip all headers from the source. @method stripHeaders @param {String} data Image source as binary string @return {String} Updated binary string */ stripHeaders: function(data) { return data; }, /** Dispose resources. @method purge */ purge: function() { data = null; } }); Basic.extend(this, _img); this.purge = function() { _img.purge(); _img = null; }; }; }); // Included from: src/javascript/runtime/html5/image/MegaPixel.js /** (The MIT License) Copyright (c) 2012 Shinichi Tomita <shinichi.tomita@gmail.com>; Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Mega pixel image rendering library for iOS6 Safari * * Fixes iOS6 Safari's image file rendering issue for large size image (over mega-pixel), * which causes unexpected subsampling when drawing it in canvas. * By using this library, you can safely render the image with proper stretching. * * Copyright (c) 2012 Shinichi Tomita <shinichi.tomita@gmail.com> * Released under the MIT license */ /** @class moxie/runtime/html5/image/MegaPixel @private */ define("moxie/runtime/html5/image/MegaPixel", [], function() { /** * Rendering image element (with resizing) into the canvas element */ function renderImageToCanvas(img, canvas, options) { var iw = img.naturalWidth, ih = img.naturalHeight; var width = options.width, height = options.height; var x = options.x || 0, y = options.y || 0; var ctx = canvas.getContext('2d'); if (detectSubsampling(img)) { iw /= 2; ih /= 2; } var d = 1024; // size of tiling canvas var tmpCanvas = document.createElement('canvas'); tmpCanvas.width = tmpCanvas.height = d; var tmpCtx = tmpCanvas.getContext('2d'); var vertSquashRatio = detectVerticalSquash(img, iw, ih); var sy = 0; while (sy < ih) { var sh = sy + d > ih ? ih - sy : d; var sx = 0; while (sx < iw) { var sw = sx + d > iw ? iw - sx : d; tmpCtx.clearRect(0, 0, d, d); tmpCtx.drawImage(img, -sx, -sy); var dx = (sx * width / iw + x) << 0; var dw = Math.ceil(sw * width / iw); var dy = (sy * height / ih / vertSquashRatio + y) << 0; var dh = Math.ceil(sh * height / ih / vertSquashRatio); ctx.drawImage(tmpCanvas, 0, 0, sw, sh, dx, dy, dw, dh); sx += d; } sy += d; } tmpCanvas = tmpCtx = null; } /** * Detect subsampling in loaded image. * In iOS, larger images than 2M pixels may be subsampled in rendering. */ function detectSubsampling(img) { var iw = img.naturalWidth, ih = img.naturalHeight; if (iw * ih > 1024 * 1024) { // subsampling may happen over megapixel image var canvas = document.createElement('canvas'); canvas.width = canvas.height = 1; var ctx = canvas.getContext('2d'); ctx.drawImage(img, -iw + 1, 0); // subsampled image becomes half smaller in rendering size. // check alpha channel value to confirm image is covering edge pixel or not. // if alpha value is 0 image is not covering, hence subsampled. return ctx.getImageData(0, 0, 1, 1).data[3] === 0; } else { return false; } } /** * Detecting vertical squash in loaded image. * Fixes a bug which squash image vertically while drawing into canvas for some images. */ function detectVerticalSquash(img, iw, ih) { var canvas = document.createElement('canvas'); canvas.width = 1; canvas.height = ih; var ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0); var data = ctx.getImageData(0, 0, 1, ih).data; // search image edge pixel position in case it is squashed vertically. var sy = 0; var ey = ih; var py = ih; while (py > sy) { var alpha = data[(py - 1) * 4 + 3]; if (alpha === 0) { ey = py; } else { sy = py; } py = (ey + sy) >> 1; } canvas = null; var ratio = (py / ih); return (ratio === 0) ? 1 : ratio; } return { isSubsampled: detectSubsampling, renderTo: renderImageToCanvas }; }); // Included from: src/javascript/runtime/html5/image/Image.js /** * Image.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/image/Image @private */ define("moxie/runtime/html5/image/Image", [ "moxie/runtime/html5/Runtime", "moxie/core/utils/Basic", "moxie/core/Exceptions", "moxie/core/utils/Encode", "moxie/file/Blob", "moxie/file/File", "moxie/runtime/html5/image/ImageInfo", "moxie/runtime/html5/image/MegaPixel", "moxie/core/utils/Mime", "moxie/core/utils/Env" ], function(extensions, Basic, x, Encode, Blob, File, ImageInfo, MegaPixel, Mime, Env) { function HTML5Image() { var me = this , _img, _imgInfo, _canvas, _binStr, _blob , _modified = false // is set true whenever image is modified , _preserveHeaders = true ; Basic.extend(this, { loadFromBlob: function(blob) { var comp = this, I = comp.getRuntime() , asBinary = arguments.length > 1 ? arguments[1] : true ; if (!I.can('access_binary')) { throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR); } _blob = blob; if (blob.isDetached()) { _binStr = blob.getSource(); _preload.call(this, _binStr); return; } else { _readAsDataUrl.call(this, blob.getSource(), function(dataUrl) { if (asBinary) { _binStr = _toBinary(dataUrl); } _preload.call(comp, dataUrl); }); } }, loadFromImage: function(img, exact) { this.meta = img.meta; _blob = new File(null, { name: img.name, size: img.size, type: img.type }); _preload.call(this, exact ? (_binStr = img.getAsBinaryString()) : img.getAsDataURL()); }, getInfo: function() { var I = this.getRuntime(), info; if (!_imgInfo && _binStr && I.can('access_image_binary')) { _imgInfo = new ImageInfo(_binStr); } info = { width: _getImg().width || 0, height: _getImg().height || 0, type: _blob.type || Mime.getFileMime(_blob.name), size: _binStr && _binStr.length || _blob.size || 0, name: _blob.name || '', meta: _imgInfo && _imgInfo.meta || this.meta || {} }; // store thumbnail data as blob if (info.meta && info.meta.thumb && !(info.meta.thumb.data instanceof Blob)) { info.meta.thumb.data = new Blob(null, { type: 'image/jpeg', data: info.meta.thumb.data }); } return info; }, downsize: function() { _downsize.apply(this, arguments); }, getAsCanvas: function() { if (_canvas) { _canvas.id = this.uid + '_canvas'; } return _canvas; }, getAsBlob: function(type, quality) { if (type !== this.type) { // if different mime type requested prepare image for conversion _downsize.call(this, this.width, this.height, false); } return new File(null, { name: _blob.name || '', type: type, data: me.getAsBinaryString.call(this, type, quality) }); }, getAsDataURL: function(type) { var quality = arguments[1] || 90; // if image has not been modified, return the source right away if (!_modified) { return _img.src; } if ('image/jpeg' !== type) { return _canvas.toDataURL('image/png'); } else { try { // older Geckos used to result in an exception on quality argument return _canvas.toDataURL('image/jpeg', quality/100); } catch (ex) { return _canvas.toDataURL('image/jpeg'); } } }, getAsBinaryString: function(type, quality) { // if image has not been modified, return the source right away if (!_modified) { // if image was not loaded from binary string if (!_binStr) { _binStr = _toBinary(me.getAsDataURL(type, quality)); } return _binStr; } if ('image/jpeg' !== type) { _binStr = _toBinary(me.getAsDataURL(type, quality)); } else { var dataUrl; // if jpeg if (!quality) { quality = 90; } try { // older Geckos used to result in an exception on quality argument dataUrl = _canvas.toDataURL('image/jpeg', quality/100); } catch (ex) { dataUrl = _canvas.toDataURL('image/jpeg'); } _binStr = _toBinary(dataUrl); if (_imgInfo) { _binStr = _imgInfo.stripHeaders(_binStr); if (_preserveHeaders) { // update dimensions info in exif if (_imgInfo.meta && _imgInfo.meta.exif) { _imgInfo.setExif({ PixelXDimension: this.width, PixelYDimension: this.height }); } // re-inject the headers _binStr = _imgInfo.writeHeaders(_binStr); } // will be re-created from fresh on next getInfo call _imgInfo.purge(); _imgInfo = null; } } _modified = false; return _binStr; }, destroy: function() { me = null; _purge.call(this); this.getRuntime().getShim().removeInstance(this.uid); } }); function _getImg() { if (!_canvas && !_img) { throw new x.ImageError(x.DOMException.INVALID_STATE_ERR); } return _canvas || _img; } function _toBinary(str) { return Encode.atob(str.substring(str.indexOf('base64,') + 7)); } function _toDataUrl(str, type) { return 'data:' + (type || '') + ';base64,' + Encode.btoa(str); } function _preload(str) { var comp = this; _img = new Image(); _img.onerror = function() { _purge.call(this); comp.trigger('error', x.ImageError.WRONG_FORMAT); }; _img.onload = function() { comp.trigger('load'); }; _img.src = str.substr(0, 5) == 'data:' ? str : _toDataUrl(str, _blob.type); } function _readAsDataUrl(file, callback) { var comp = this, fr; // use FileReader if it's available if (window.FileReader) { fr = new FileReader(); fr.onload = function() { callback(this.result); }; fr.onerror = function() { comp.trigger('error', x.ImageError.WRONG_FORMAT); }; fr.readAsDataURL(file); } else { return callback(file.getAsDataURL()); } } function _downsize(width, height, crop, preserveHeaders) { var self = this , scale , mathFn , x = 0 , y = 0 , img , destWidth , destHeight , orientation ; _preserveHeaders = preserveHeaders; // we will need to check this on export (see getAsBinaryString()) // take into account orientation tag orientation = (this.meta && this.meta.tiff && this.meta.tiff.Orientation) || 1; if (Basic.inArray(orientation, [5,6,7,8]) !== -1) { // values that require 90 degree rotation // swap dimensions var tmp = width; width = height; height = tmp; } img = _getImg(); // unify dimensions if (!crop) { scale = Math.min(width/img.width, height/img.height); } else { // one of the dimensions may exceed the actual image dimensions - we need to take the smallest value width = Math.min(width, img.width); height = Math.min(height, img.height); scale = Math.max(width/img.width, height/img.height); } // we only downsize here if (scale > 1 && !crop && preserveHeaders) { this.trigger('Resize'); return; } // prepare canvas if necessary if (!_canvas) { _canvas = document.createElement("canvas"); } // calculate dimensions of proportionally resized image destWidth = Math.round(img.width * scale); destHeight = Math.round(img.height * scale); // scale image and canvas if (crop) { _canvas.width = width; _canvas.height = height; // if dimensions of the resulting image still larger than canvas, center it if (destWidth > width) { x = Math.round((destWidth - width) / 2); } if (destHeight > height) { y = Math.round((destHeight - height) / 2); } } else { _canvas.width = destWidth; _canvas.height = destHeight; } // rotate if required, according to orientation tag if (!_preserveHeaders) { _rotateToOrientaion(_canvas.width, _canvas.height, orientation); } _drawToCanvas.call(this, img, _canvas, -x, -y, destWidth, destHeight); this.width = _canvas.width; this.height = _canvas.height; _modified = true; self.trigger('Resize'); } function _drawToCanvas(img, canvas, x, y, w, h) { if (Env.OS === 'iOS') { // avoid squish bug in iOS6 MegaPixel.renderTo(img, canvas, { width: w, height: h, x: x, y: y }); } else { var ctx = canvas.getContext('2d'); ctx.drawImage(img, x, y, w, h); } } /** * Transform canvas coordination according to specified frame size and orientation * Orientation value is from EXIF tag * @author Shinichi Tomita <shinichi.tomita@gmail.com> */ function _rotateToOrientaion(width, height, orientation) { switch (orientation) { case 5: case 6: case 7: case 8: _canvas.width = height; _canvas.height = width; break; default: _canvas.width = width; _canvas.height = height; } /** 1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side. 2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side. 3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side. 4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side. 5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top. 6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top. 7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom. 8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom. */ var ctx = _canvas.getContext('2d'); switch (orientation) { case 2: // horizontal flip ctx.translate(width, 0); ctx.scale(-1, 1); break; case 3: // 180 rotate left ctx.translate(width, height); ctx.rotate(Math.PI); break; case 4: // vertical flip ctx.translate(0, height); ctx.scale(1, -1); break; case 5: // vertical flip + 90 rotate right ctx.rotate(0.5 * Math.PI); ctx.scale(1, -1); break; case 6: // 90 rotate right ctx.rotate(0.5 * Math.PI); ctx.translate(0, -height); break; case 7: // horizontal flip + 90 rotate right ctx.rotate(0.5 * Math.PI); ctx.translate(width, -height); ctx.scale(-1, 1); break; case 8: // 90 rotate left ctx.rotate(-0.5 * Math.PI); ctx.translate(-width, 0); break; } } function _purge() { if (_imgInfo) { _imgInfo.purge(); _imgInfo = null; } _binStr = _img = _canvas = _blob = null; _modified = false; } } return (extensions.Image = HTML5Image); }); /** * Stub for moxie/runtime/flash/Runtime * @private */ define("moxie/runtime/flash/Runtime", [ ], function() { return {}; }); /** * Stub for moxie/runtime/silverlight/Runtime * @private */ define("moxie/runtime/silverlight/Runtime", [ ], function() { return {}; }); // Included from: src/javascript/runtime/html4/Runtime.js /** * Runtime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /*global File:true */ /** Defines constructor for HTML4 runtime. @class moxie/runtime/html4/Runtime @private */ define("moxie/runtime/html4/Runtime", [ "moxie/core/utils/Basic", "moxie/core/Exceptions", "moxie/runtime/Runtime", "moxie/core/utils/Env" ], function(Basic, x, Runtime, Env) { var type = 'html4', extensions = {}; function Html4Runtime(options) { var I = this , Test = Runtime.capTest , True = Runtime.capTrue ; Runtime.call(this, options, type, { access_binary: Test(window.FileReader || window.File && File.getAsDataURL), access_image_binary: false, display_media: Test(extensions.Image && (Env.can('create_canvas') || Env.can('use_data_uri_over32kb'))), do_cors: false, drag_and_drop: false, filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest return (Env.browser === 'Chrome' && Env.verComp(Env.version, 28, '>=')) || (Env.browser === 'IE' && Env.verComp(Env.version, 10, '>=')) || (Env.browser === 'Safari' && Env.verComp(Env.version, 7, '>=')); }()), resize_image: function() { return extensions.Image && I.can('access_binary') && Env.can('create_canvas'); }, report_upload_progress: false, return_response_headers: false, return_response_type: function(responseType) { if (responseType === 'json' && !!window.JSON) { return true; } return !!~Basic.inArray(responseType, ['text', 'document', '']); }, return_status_code: function(code) { return !Basic.arrayDiff(code, [200, 404]); }, select_file: function() { return Env.can('use_fileinput'); }, select_multiple: false, send_binary_string: false, send_custom_headers: false, send_multipart: true, slice_blob: false, stream_upload: function() { return I.can('select_file'); }, summon_file_dialog: function() { // yeah... some dirty sniffing here... return I.can('select_file') && ( (Env.browser === 'Firefox' && Env.verComp(Env.version, 4, '>=')) || (Env.browser === 'Opera' && Env.verComp(Env.version, 12, '>=')) || (Env.browser === 'IE' && Env.verComp(Env.version, 10, '>=')) || !!~Basic.inArray(Env.browser, ['Chrome', 'Safari']) ); }, upload_filesize: True, use_http_method: function(methods) { return !Basic.arrayDiff(methods, ['GET', 'POST']); } }); Basic.extend(this, { init : function() { this.trigger("Init"); }, destroy: (function(destroy) { // extend default destroy method return function() { destroy.call(I); destroy = I = null; }; }(this.destroy)) }); Basic.extend(this.getShim(), extensions); } Runtime.addConstructor(type, Html4Runtime); return extensions; }); // Included from: src/javascript/runtime/html4/file/FileInput.js /** * FileInput.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html4/file/FileInput @private */ define("moxie/runtime/html4/file/FileInput", [ "moxie/runtime/html4/Runtime", "moxie/file/File", "moxie/core/utils/Basic", "moxie/core/utils/Dom", "moxie/core/utils/Events", "moxie/core/utils/Mime", "moxie/core/utils/Env" ], function(extensions, File, Basic, Dom, Events, Mime, Env) { function FileInput() { var _uid, _mimes = [], _options; function addInput() { var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid; uid = Basic.guid('uid_'); shimContainer = I.getShimContainer(); // we get new ref everytime to avoid memory leaks in IE if (_uid) { // move previous form out of the view currForm = Dom.get(_uid + '_form'); if (currForm) { Basic.extend(currForm.style, { top: '100%' }); } } // build form in DOM, since innerHTML version not able to submit file for some reason form = document.createElement('form'); form.setAttribute('id', uid + '_form'); form.setAttribute('method', 'post'); form.setAttribute('enctype', 'multipart/form-data'); form.setAttribute('encoding', 'multipart/form-data'); Basic.extend(form.style, { overflow: 'hidden', position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }); input = document.createElement('input'); input.setAttribute('id', uid); input.setAttribute('type', 'file'); input.setAttribute('name', _options.name || 'Filedata'); input.setAttribute('accept', _mimes.join(',')); Basic.extend(input.style, { fontSize: '999px', opacity: 0 }); form.appendChild(input); shimContainer.appendChild(form); // prepare file input to be placed underneath the browse_button element Basic.extend(input.style, { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }); if (Env.browser === 'IE' && Env.verComp(Env.version, 10, '<')) { Basic.extend(input.style, { filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)" }); } input.onchange = function() { // there should be only one handler for this var file; if (!this.value) { return; } if (this.files) { // check if browser is fresh enough file = this.files[0]; // ignore empty files (IE10 for example hangs if you try to send them via XHR) if (file.size === 0) { form.parentNode.removeChild(form); return; } } else { file = { name: this.value }; } file = new File(I.uid, file); // clear event handler this.onchange = function() {}; addInput.call(comp); comp.files = [file]; // substitute all ids with file uids (consider file.uid read-only - we cannot do it the other way around) input.setAttribute('id', file.uid); form.setAttribute('id', file.uid + '_form'); comp.trigger('change'); input = form = null; }; // route click event to the input if (I.can('summon_file_dialog')) { browseButton = Dom.get(_options.browse_button); Events.removeEvent(browseButton, 'click', comp.uid); Events.addEvent(browseButton, 'click', function(e) { if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file] input.click(); } e.preventDefault(); }, comp.uid); } _uid = uid; shimContainer = currForm = browseButton = null; } Basic.extend(this, { init: function(options) { var comp = this, I = comp.getRuntime(), shimContainer; // figure out accept string _options = options; _mimes = options.accept.mimes || Mime.extList2mimes(options.accept, I.can('filter_by_extension')); shimContainer = I.getShimContainer(); (function() { var browseButton, zIndex, top; browseButton = Dom.get(options.browse_button); // Route click event to the input[type=file] element for browsers that support such behavior if (I.can('summon_file_dialog')) { if (Dom.getStyle(browseButton, 'position') === 'static') { browseButton.style.position = 'relative'; } zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 1; browseButton.style.zIndex = zIndex; shimContainer.style.zIndex = zIndex - 1; } /* Since we have to place input[type=file] on top of the browse_button for some browsers, browse_button loses interactivity, so we restore it here */ top = I.can('summon_file_dialog') ? browseButton : shimContainer; Events.addEvent(top, 'mouseover', function() { comp.trigger('mouseenter'); }, comp.uid); Events.addEvent(top, 'mouseout', function() { comp.trigger('mouseleave'); }, comp.uid); Events.addEvent(top, 'mousedown', function() { comp.trigger('mousedown'); }, comp.uid); Events.addEvent(Dom.get(options.container), 'mouseup', function() { comp.trigger('mouseup'); }, comp.uid); browseButton = null; }()); addInput.call(this); shimContainer = null; // trigger ready event asynchronously comp.trigger({ type: 'ready', async: true }); }, disable: function(state) { var input; if ((input = Dom.get(_uid))) { input.disabled = !!state; } }, destroy: function() { var I = this.getRuntime() , shim = I.getShim() , shimContainer = I.getShimContainer() ; Events.removeAllEvents(shimContainer, this.uid); Events.removeAllEvents(_options && Dom.get(_options.container), this.uid); Events.removeAllEvents(_options && Dom.get(_options.browse_button), this.uid); if (shimContainer) { shimContainer.innerHTML = ''; } shim.removeInstance(this.uid); _uid = _mimes = _options = shimContainer = shim = null; } }); } return (extensions.FileInput = FileInput); }); // Included from: src/javascript/runtime/html4/file/FileReader.js /** * FileReader.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html4/file/FileReader @private */ define("moxie/runtime/html4/file/FileReader", [ "moxie/runtime/html4/Runtime", "moxie/runtime/html5/file/FileReader" ], function(extensions, FileReader) { return (extensions.FileReader = FileReader); }); // Included from: src/javascript/runtime/html4/xhr/XMLHttpRequest.js /** * XMLHttpRequest.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html4/xhr/XMLHttpRequest @private */ define("moxie/runtime/html4/xhr/XMLHttpRequest", [ "moxie/runtime/html4/Runtime", "moxie/core/utils/Basic", "moxie/core/utils/Dom", "moxie/core/utils/Url", "moxie/core/Exceptions", "moxie/core/utils/Events", "moxie/file/Blob", "moxie/xhr/FormData" ], function(extensions, Basic, Dom, Url, x, Events, Blob, FormData) { function XMLHttpRequest() { var _status, _response, _iframe; function cleanup(cb) { var target = this, uid, form, inputs, i, hasFile = false; if (!_iframe) { return; } uid = _iframe.id.replace(/_iframe$/, ''); form = Dom.get(uid + '_form'); if (form) { inputs = form.getElementsByTagName('input'); i = inputs.length; while (i--) { switch (inputs[i].getAttribute('type')) { case 'hidden': inputs[i].parentNode.removeChild(inputs[i]); break; case 'file': hasFile = true; // flag the case for later break; } } inputs = []; if (!hasFile) { // we need to keep the form for sake of possible retries form.parentNode.removeChild(form); } form = null; } // without timeout, request is marked as canceled (in console) setTimeout(function() { Events.removeEvent(_iframe, 'load', target.uid); if (_iframe.parentNode) { // #382 _iframe.parentNode.removeChild(_iframe); } // check if shim container has any other children, if - not, remove it as well var shimContainer = target.getRuntime().getShimContainer(); if (!shimContainer.children.length) { shimContainer.parentNode.removeChild(shimContainer); } shimContainer = _iframe = null; cb(); }, 1); } Basic.extend(this, { send: function(meta, data) { var target = this, I = target.getRuntime(), uid, form, input, blob; _status = _response = null; function createIframe() { var container = I.getShimContainer() || document.body , temp = document.createElement('div') ; // IE 6 won't be able to set the name using setAttribute or iframe.name temp.innerHTML = '<iframe id="' + uid + '_iframe" name="' + uid + '_iframe" src="javascript:""" style="display:none"></iframe>'; _iframe = temp.firstChild; container.appendChild(_iframe); /* _iframe.onreadystatechange = function() { console.info(_iframe.readyState); };*/ Events.addEvent(_iframe, 'load', function() { // _iframe.onload doesn't work in IE lte 8 var el; try { el = _iframe.contentWindow.document || _iframe.contentDocument || window.frames[_iframe.id].document; // try to detect some standard error pages if (/^4(0[0-9]|1[0-7]|2[2346])\s/.test(el.title)) { // test if title starts with 4xx HTTP error _status = el.title.replace(/^(\d+).*$/, '$1'); } else { _status = 200; // get result _response = Basic.trim(el.body.innerHTML); // we need to fire these at least once target.trigger({ type: 'progress', loaded: _response.length, total: _response.length }); if (blob) { // if we were uploading a file target.trigger({ type: 'uploadprogress', loaded: blob.size || 1025, total: blob.size || 1025 }); } } } catch (ex) { if (Url.hasSameOrigin(meta.url)) { // if response is sent with error code, iframe in IE gets redirected to res://ieframe.dll/http_x.htm // which obviously results to cross domain error (wtf?) _status = 404; } else { cleanup.call(target, function() { target.trigger('error'); }); return; } } cleanup.call(target, function() { target.trigger('load'); }); }, target.uid); } // end createIframe // prepare data to be sent and convert if required if (data instanceof FormData && data.hasBlob()) { blob = data.getBlob(); uid = blob.uid; input = Dom.get(uid); form = Dom.get(uid + '_form'); if (!form) { throw new x.DOMException(x.DOMException.NOT_FOUND_ERR); } } else { uid = Basic.guid('uid_'); form = document.createElement('form'); form.setAttribute('id', uid + '_form'); form.setAttribute('method', meta.method); form.setAttribute('enctype', 'multipart/form-data'); form.setAttribute('encoding', 'multipart/form-data'); I.getShimContainer().appendChild(form); } // set upload target form.setAttribute('target', uid + '_iframe'); if (data instanceof FormData) { data.each(function(value, name) { if (value instanceof Blob) { if (input) { input.setAttribute('name', name); } } else { var hidden = document.createElement('input'); Basic.extend(hidden, { type : 'hidden', name : name, value : value }); // make sure that input[type="file"], if it's there, comes last if (input) { form.insertBefore(hidden, input); } else { form.appendChild(hidden); } } }); } // set destination url form.setAttribute("action", meta.url); createIframe(); form.submit(); target.trigger('loadstart'); }, getStatus: function() { return _status; }, getResponse: function(responseType) { if ('json' === responseType) { // strip off <pre>..</pre> tags that might be enclosing the response if (Basic.typeOf(_response) === 'string' && !!window.JSON) { try { return JSON.parse(_response.replace(/^\s*<pre[^>]*>/, '').replace(/<\/pre>\s*$/, '')); } catch (ex) { return null; } } } else if ('document' === responseType) { } return _response; }, abort: function() { var target = this; if (_iframe && _iframe.contentWindow) { if (_iframe.contentWindow.stop) { // FireFox/Safari/Chrome _iframe.contentWindow.stop(); } else if (_iframe.contentWindow.document.execCommand) { // IE _iframe.contentWindow.document.execCommand('Stop'); } else { _iframe.src = "about:blank"; } } cleanup.call(this, function() { // target.dispatchEvent('readystatechange'); target.dispatchEvent('abort'); }); } }); } return (extensions.XMLHttpRequest = XMLHttpRequest); }); // Included from: src/javascript/runtime/html4/image/Image.js /** * Image.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html4/image/Image @private */ define("moxie/runtime/html4/image/Image", [ "moxie/runtime/html4/Runtime", "moxie/runtime/html5/image/Image" ], function(extensions, Image) { return (extensions.Image = Image); }); expose(["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/FileInput","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events"]); })(this); /** * o.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /*global moxie:true */ /** Globally exposed namespace with the most frequently used public classes and handy methods. @class o @static @private */ (function(exports) { "use strict"; var o = {}, inArray = exports.moxie.core.utils.Basic.inArray; // directly add some public classes // (we do it dynamically here, since for custom builds we cannot know beforehand what modules were included) (function addAlias(ns) { var name, itemType; for (name in ns) { itemType = typeof(ns[name]); if (itemType === 'object' && !~inArray(name, ['Exceptions', 'Env', 'Mime'])) { addAlias(ns[name]); } else if (itemType === 'function') { o[name] = ns[name]; } } })(exports.moxie); // add some manually o.Env = exports.moxie.core.utils.Env; o.Mime = exports.moxie.core.utils.Mime; o.Exceptions = exports.moxie.core.Exceptions; // expose globally exports.mOxie = o; if (!exports.o) { exports.o = o; } return o; })(this); plupload/handlers.js 0000644 00000047707 15125140777 0010552 0 ustar 00 /* global plupload, pluploadL10n, ajaxurl, post_id, wpUploaderInit, deleteUserSetting, setUserSetting, getUserSetting, shortform */ var topWin = window.dialogArguments || opener || parent || top, uploader, uploader_init; // Progress and success handlers for media multi uploads. function fileQueued( fileObj ) { // Get rid of unused form. jQuery( '.media-blank' ).remove(); var items = jQuery( '#media-items' ).children(), postid = post_id || 0; // Collapse a single item. if ( items.length == 1 ) { items.removeClass( 'open' ).find( '.slidetoggle' ).slideUp( 200 ); } // Create a progress bar containing the filename. jQuery( '<div class="media-item">' ) .attr( 'id', 'media-item-' + fileObj.id ) .addClass( 'child-of-' + postid ) .append( jQuery( '<div class="filename original">' ).text( ' ' + fileObj.name ), '<div class="progress"><div class="percent">0%</div><div class="bar"></div></div>' ) .appendTo( jQuery( '#media-items' ) ); // Disable submit. jQuery( '#insert-gallery' ).prop( 'disabled', true ); } function uploadStart() { try { if ( typeof topWin.tb_remove != 'undefined' ) topWin.jQuery( '#TB_overlay' ).unbind( 'click', topWin.tb_remove ); } catch( e ){} return true; } function uploadProgress( up, file ) { var item = jQuery( '#media-item-' + file.id ); jQuery( '.bar', item ).width( ( 200 * file.loaded ) / file.size ); jQuery( '.percent', item ).html( file.percent + '%' ); } // Check to see if a large file failed to upload. function fileUploading( up, file ) { var hundredmb = 100 * 1024 * 1024, max = parseInt( up.settings.max_file_size, 10 ); if ( max > hundredmb && file.size > hundredmb ) { setTimeout( function() { if ( file.status < 3 && file.loaded === 0 ) { // Not uploading. wpFileError( file, pluploadL10n.big_upload_failed.replace( '%1$s', '<a class="uploader-html" href="#">' ).replace( '%2$s', '</a>' ) ); up.stop(); // Stop the whole queue. up.removeFile( file ); up.start(); // Restart the queue. } }, 10000 ); // Wait for 10 seconds for the file to start uploading. } } function updateMediaForm() { var items = jQuery( '#media-items' ).children(); // Just one file, no need for collapsible part. if ( items.length == 1 ) { items.addClass( 'open' ).find( '.slidetoggle' ).show(); jQuery( '.insert-gallery' ).hide(); } else if ( items.length > 1 ) { items.removeClass( 'open' ); // Only show Gallery/Playlist buttons when there are at least two files. jQuery( '.insert-gallery' ).show(); } // Only show Save buttons when there is at least one file. if ( items.not( '.media-blank' ).length > 0 ) jQuery( '.savebutton' ).show(); else jQuery( '.savebutton' ).hide(); } function uploadSuccess( fileObj, serverData ) { var item = jQuery( '#media-item-' + fileObj.id ); // On success serverData should be numeric, // fix bug in html4 runtime returning the serverData wrapped in a <pre> tag. if ( typeof serverData === 'string' ) { serverData = serverData.replace( /^<pre>(\d+)<\/pre>$/, '$1' ); // If async-upload returned an error message, place it in the media item div and return. if ( /media-upload-error|error-div/.test( serverData ) ) { item.html( serverData ); return; } } item.find( '.percent' ).html( pluploadL10n.crunching ); prepareMediaItem( fileObj, serverData ); updateMediaForm(); // Increment the counter. if ( post_id && item.hasClass( 'child-of-' + post_id ) ) { jQuery( '#attachments-count' ).text( 1 * jQuery( '#attachments-count' ).text() + 1 ); } } function setResize( arg ) { if ( arg ) { if ( window.resize_width && window.resize_height ) { uploader.settings.resize = { enabled: true, width: window.resize_width, height: window.resize_height, quality: 100 }; } else { uploader.settings.multipart_params.image_resize = true; } } else { delete( uploader.settings.multipart_params.image_resize ); } } function prepareMediaItem( fileObj, serverData ) { var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery( '#media-item-' + fileObj.id ); if ( f == 2 && shortform > 2 ) f = shortform; try { if ( typeof topWin.tb_remove != 'undefined' ) topWin.jQuery( '#TB_overlay' ).click( topWin.tb_remove ); } catch( e ){} if ( isNaN( serverData ) || !serverData ) { // Old style: Append the HTML returned by the server -- thumbnail and form inputs. item.append( serverData ); prepareMediaItemInit( fileObj ); } else { // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server. item.load( 'async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit( fileObj );updateMediaForm();}); } } function prepareMediaItemInit( fileObj ) { var item = jQuery( '#media-item-' + fileObj.id ); // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename. jQuery( '.thumbnail', item ).clone().attr( 'class', 'pinkynail toggle' ).prependTo( item ); // Replace the original filename with the new (unique) one assigned during upload. jQuery( '.filename.original', item ).replaceWith( jQuery( '.filename.new', item ) ); // Bind Ajax to the new Delete button. jQuery( 'a.delete', item ).on( 'click', function(){ // Tell the server to delete it. TODO: Handle exceptions. jQuery.ajax({ url: ajaxurl, type: 'post', success: deleteSuccess, error: deleteError, id: fileObj.id, data: { id : this.id.replace(/[^0-9]/g, '' ), action : 'trash-post', _ajax_nonce : this.href.replace(/^.*wpnonce=/,'' ) } }); return false; }); // Bind Ajax to the new Undo button. jQuery( 'a.undo', item ).on( 'click', function(){ // Tell the server to untrash it. TODO: Handle exceptions. jQuery.ajax({ url: ajaxurl, type: 'post', id: fileObj.id, data: { id : this.id.replace(/[^0-9]/g,'' ), action: 'untrash-post', _ajax_nonce: this.href.replace(/^.*wpnonce=/,'' ) }, success: function( ){ var type, item = jQuery( '#media-item-' + fileObj.id ); if ( type = jQuery( '#type-of-' + fileObj.id ).val() ) jQuery( '#' + type + '-counter' ).text( jQuery( '#' + type + '-counter' ).text()-0+1 ); if ( post_id && item.hasClass( 'child-of-'+post_id ) ) jQuery( '#attachments-count' ).text( jQuery( '#attachments-count' ).text()-0+1 ); jQuery( '.filename .trashnotice', item ).remove(); jQuery( '.filename .title', item ).css( 'font-weight','normal' ); jQuery( 'a.undo', item ).addClass( 'hidden' ); jQuery( '.menu_order_input', item ).show(); item.css( {backgroundColor:'#ceb'} ).animate( {backgroundColor: '#fff'}, { queue: false, duration: 500, complete: function(){ jQuery( this ).css({backgroundColor:''}); } }).removeClass( 'undo' ); } }); return false; }); // Open this item if it says to start open (e.g. to display an error). jQuery( '#media-item-' + fileObj.id + '.startopen' ).removeClass( 'startopen' ).addClass( 'open' ).find( 'slidetoggle' ).fadeIn(); } // Generic error message. function wpQueueError( message ) { jQuery( '#media-upload-error' ).show().html( '<div class="notice notice-error"><p>' + message + '</p></div>' ); } // File-specific error messages. function wpFileError( fileObj, message ) { itemAjaxError( fileObj.id, message ); } function itemAjaxError( id, message ) { var item = jQuery( '#media-item-' + id ), filename = item.find( '.filename' ).text(), last_err = item.data( 'last-err' ); if ( last_err == id ) // Prevent firing an error for the same file twice. return; item.html( '<div class="error-div">' + '<a class="dismiss" href="#">' + pluploadL10n.dismiss + '</a>' + '<strong>' + pluploadL10n.error_uploading.replace( '%s', jQuery.trim( filename )) + '</strong> ' + message + '</div>' ).data( 'last-err', id ); } function deleteSuccess( data ) { var type, id, item; if ( data == '-1' ) return itemAjaxError( this.id, 'You do not have permission. Has your session expired?' ); if ( data == '0' ) return itemAjaxError( this.id, 'Could not be deleted. Has it been deleted already?' ); id = this.id; item = jQuery( '#media-item-' + id ); // Decrement the counters. if ( type = jQuery( '#type-of-' + id ).val() ) jQuery( '#' + type + '-counter' ).text( jQuery( '#' + type + '-counter' ).text() - 1 ); if ( post_id && item.hasClass( 'child-of-'+post_id ) ) jQuery( '#attachments-count' ).text( jQuery( '#attachments-count' ).text() - 1 ); if ( jQuery( 'form.type-form #media-items' ).children().length == 1 && jQuery( '.hidden', '#media-items' ).length > 0 ) { jQuery( '.toggle' ).toggle(); jQuery( '.slidetoggle' ).slideUp( 200 ).siblings().removeClass( 'hidden' ); } // Vanish it. jQuery( '.toggle', item ).toggle(); jQuery( '.slidetoggle', item ).slideUp( 200 ).siblings().removeClass( 'hidden' ); item.css( {backgroundColor:'#faa'} ).animate( {backgroundColor:'#f4f4f4'}, {queue:false, duration:500} ).addClass( 'undo' ); jQuery( '.filename:empty', item ).remove(); jQuery( '.filename .title', item ).css( 'font-weight','bold' ); jQuery( '.filename', item ).append( '<span class="trashnotice"> ' + pluploadL10n.deleted + ' </span>' ).siblings( 'a.toggle' ).hide(); jQuery( '.filename', item ).append( jQuery( 'a.undo', item ).removeClass( 'hidden' ) ); jQuery( '.menu_order_input', item ).hide(); return; } function deleteError() { } function uploadComplete() { jQuery( '#insert-gallery' ).prop( 'disabled', false ); } function switchUploader( s ) { if ( s ) { deleteUserSetting( 'uploader' ); jQuery( '.media-upload-form' ).removeClass( 'html-uploader' ); if ( typeof( uploader ) == 'object' ) uploader.refresh(); } else { setUserSetting( 'uploader', '1' ); // 1 == html uploader. jQuery( '.media-upload-form' ).addClass( 'html-uploader' ); } } function uploadError( fileObj, errorCode, message, up ) { var hundredmb = 100 * 1024 * 1024, max; switch ( errorCode ) { case plupload.FAILED: wpFileError( fileObj, pluploadL10n.upload_failed ); break; case plupload.FILE_EXTENSION_ERROR: wpFileExtensionError( up, fileObj, pluploadL10n.invalid_filetype ); break; case plupload.FILE_SIZE_ERROR: uploadSizeError( up, fileObj ); break; case plupload.IMAGE_FORMAT_ERROR: wpFileError( fileObj, pluploadL10n.not_an_image ); break; case plupload.IMAGE_MEMORY_ERROR: wpFileError( fileObj, pluploadL10n.image_memory_exceeded ); break; case plupload.IMAGE_DIMENSIONS_ERROR: wpFileError( fileObj, pluploadL10n.image_dimensions_exceeded ); break; case plupload.GENERIC_ERROR: wpQueueError( pluploadL10n.upload_failed ); break; case plupload.IO_ERROR: max = parseInt( up.settings.filters.max_file_size, 10 ); if ( max > hundredmb && fileObj.size > hundredmb ) { wpFileError( fileObj, pluploadL10n.big_upload_failed.replace( '%1$s', '<a class="uploader-html" href="#">' ).replace( '%2$s', '</a>' ) ); } else { wpQueueError( pluploadL10n.io_error ); } break; case plupload.HTTP_ERROR: wpQueueError( pluploadL10n.http_error ); break; case plupload.INIT_ERROR: jQuery( '.media-upload-form' ).addClass( 'html-uploader' ); break; case plupload.SECURITY_ERROR: wpQueueError( pluploadL10n.security_error ); break; /* case plupload.UPLOAD_ERROR.UPLOAD_STOPPED: case plupload.UPLOAD_ERROR.FILE_CANCELLED: jQuery( '#media-item-' + fileObj.id ).remove(); break;*/ default: wpFileError( fileObj, pluploadL10n.default_error ); } } function uploadSizeError( up, file ) { var message, errorDiv; message = pluploadL10n.file_exceeds_size_limit.replace( '%s', file.name ); // Construct the error div. errorDiv = jQuery( '<div />' ) .attr( { 'id': 'media-item-' + file.id, 'class': 'media-item error' } ) .append( jQuery( '<p />' ) .text( message ) ); // Append the error. jQuery( '#media-items' ).append( errorDiv ); up.removeFile( file ); } function wpFileExtensionError( up, file, message ) { jQuery( '#media-items' ).append( '<div id="media-item-' + file.id + '" class="media-item error"><p>' + message + '</p></div>' ); up.removeFile( file ); } /** * Copies the attachment URL to the clipboard. * * @since 5.8.0 * * @param {MouseEvent} event A click event. * * @return {void} */ function copyAttachmentUploadURLClipboard() { var clipboard = new ClipboardJS( '.copy-attachment-url' ), successTimeout; clipboard.on( 'success', function( event ) { var triggerElement = jQuery( event.trigger ), successElement = jQuery( '.success', triggerElement.closest( '.copy-to-clipboard-container' ) ); // Clear the selection and move focus back to the trigger. event.clearSelection(); // Show success visual feedback. clearTimeout( successTimeout ); successElement.removeClass( 'hidden' ); // Hide success visual feedback after 3 seconds since last success. successTimeout = setTimeout( function() { successElement.addClass( 'hidden' ); }, 3000 ); // Handle success audible feedback. wp.a11y.speak( pluploadL10n.file_url_copied ); } ); } jQuery( document ).ready( function( $ ) { copyAttachmentUploadURLClipboard(); var tryAgainCount = {}; var tryAgain; $( '.media-upload-form' ).on( 'click.uploader', function( e ) { var target = $( e.target ), tr, c; if ( target.is( 'input[type="radio"]' ) ) { // Remember the last used image size and alignment. tr = target.closest( 'tr' ); if ( tr.hasClass( 'align' ) ) setUserSetting( 'align', target.val() ); else if ( tr.hasClass( 'image-size' ) ) setUserSetting( 'imgsize', target.val() ); } else if ( target.is( 'button.button' ) ) { // Remember the last used image link url. c = e.target.className || ''; c = c.match( /url([^ '"]+)/ ); if ( c && c[1] ) { setUserSetting( 'urlbutton', c[1] ); target.siblings( '.urlfield' ).val( target.data( 'link-url' ) ); } } else if ( target.is( 'a.dismiss' ) ) { target.parents( '.media-item' ).fadeOut( 200, function() { $( this ).remove(); } ); } else if ( target.is( '.upload-flash-bypass a' ) || target.is( 'a.uploader-html' ) ) { // Switch uploader to html4. $( '#media-items, p.submit, span.big-file-warning' ).css( 'display', 'none' ); switchUploader( 0 ); e.preventDefault(); } else if ( target.is( '.upload-html-bypass a' ) ) { // Switch uploader to multi-file. $( '#media-items, p.submit, span.big-file-warning' ).css( 'display', '' ); switchUploader( 1 ); e.preventDefault(); } else if ( target.is( 'a.describe-toggle-on' ) ) { // Show. target.parent().addClass( 'open' ); target.siblings( '.slidetoggle' ).fadeIn( 250, function() { var S = $( window ).scrollTop(), H = $( window ).height(), top = $( this ).offset().top, h = $( this ).height(), b, B; if ( H && top && h ) { b = top + h; B = S + H; if ( b > B ) { if ( b - B < top - S ) window.scrollBy( 0, ( b - B ) + 10 ); else window.scrollBy( 0, top - S - 40 ); } } } ); e.preventDefault(); } else if ( target.is( 'a.describe-toggle-off' ) ) { // Hide. target.siblings( '.slidetoggle' ).fadeOut( 250, function() { target.parent().removeClass( 'open' ); } ); e.preventDefault(); } }); // Attempt to create image sub-sizes when an image was uploaded successfully // but the server responded with an HTTP 5xx error. tryAgain = function( up, error ) { var file = error.file; var times; var id; if ( ! error || ! error.responseHeaders ) { wpQueueError( pluploadL10n.http_error_image ); return; } id = error.responseHeaders.match( /x-wp-upload-attachment-id:\s*(\d+)/i ); if ( id && id[1] ) { id = id[1]; } else { wpQueueError( pluploadL10n.http_error_image ); return; } times = tryAgainCount[ file.id ]; if ( times && times > 4 ) { /* * The file may have been uploaded and attachment post created, * but post-processing and resizing failed... * Do a cleanup then tell the user to scale down the image and upload it again. */ $.ajax({ type: 'post', url: ajaxurl, dataType: 'json', data: { action: 'media-create-image-subsizes', _wpnonce: wpUploaderInit.multipart_params._wpnonce, attachment_id: id, _wp_upload_failed_cleanup: true, } }); if ( error.message && ( error.status < 500 || error.status >= 600 ) ) { wpQueueError( error.message ); } else { wpQueueError( pluploadL10n.http_error_image ); } return; } if ( ! times ) { tryAgainCount[ file.id ] = 1; } else { tryAgainCount[ file.id ] = ++times; } // Try to create the missing image sizes. $.ajax({ type: 'post', url: ajaxurl, dataType: 'json', data: { action: 'media-create-image-subsizes', _wpnonce: wpUploaderInit.multipart_params._wpnonce, attachment_id: id, _legacy_support: 'true', } }).done( function( response ) { var message; if ( response.success ) { uploadSuccess( file, response.data.id ); } else { if ( response.data && response.data.message ) { message = response.data.message; } wpQueueError( message || pluploadL10n.http_error_image ); } }).fail( function( jqXHR ) { // If another HTTP 5xx error, try try again... if ( jqXHR.status >= 500 && jqXHR.status < 600 ) { tryAgain( up, error ); return; } wpQueueError( pluploadL10n.http_error_image ); }); } // Init and set the uploader. uploader_init = function() { uploader = new plupload.Uploader( wpUploaderInit ); $( '#image_resize' ).on( 'change', function() { var arg = $( this ).prop( 'checked' ); setResize( arg ); if ( arg ) setUserSetting( 'upload_resize', '1' ); else deleteUserSetting( 'upload_resize' ); }); uploader.bind( 'Init', function( up ) { var uploaddiv = $( '#plupload-upload-ui' ); setResize( getUserSetting( 'upload_resize', false ) ); if ( up.features.dragdrop && ! $( document.body ).hasClass( 'mobile' ) ) { uploaddiv.addClass( 'drag-drop' ); $( '#drag-drop-area' ).on( 'dragover.wp-uploader', function() { // dragenter doesn't fire right :( uploaddiv.addClass( 'drag-over' ); }).on( 'dragleave.wp-uploader, drop.wp-uploader', function() { uploaddiv.removeClass( 'drag-over' ); }); } else { uploaddiv.removeClass( 'drag-drop' ); $( '#drag-drop-area' ).off( '.wp-uploader' ); } if ( up.runtime === 'html4' ) { $( '.upload-flash-bypass' ).hide(); } }); uploader.bind( 'postinit', function( up ) { up.refresh(); }); uploader.init(); uploader.bind( 'FilesAdded', function( up, files ) { $( '#media-upload-error' ).empty(); uploadStart(); plupload.each( files, function( file ) { if ( file.type === 'image/heic' && up.settings.heic_upload_error ) { // Show error but do not block uploading. wpQueueError( pluploadL10n.unsupported_image ); } else if ( file.type === 'image/webp' && up.settings.webp_upload_error ) { // Disallow uploading of WebP images if the server cannot edit them. wpQueueError( pluploadL10n.noneditable_image ); up.removeFile( file ); return; } else if ( file.type === 'image/avif' && up.settings.avif_upload_error ) { // Disallow uploading of AVIF images if the server cannot edit them. wpQueueError( pluploadL10n.noneditable_image ); up.removeFile( file ); return; } fileQueued( file ); }); up.refresh(); up.start(); }); uploader.bind( 'UploadFile', function( up, file ) { fileUploading( up, file ); }); uploader.bind( 'UploadProgress', function( up, file ) { uploadProgress( up, file ); }); uploader.bind( 'Error', function( up, error ) { var isImage = error.file && error.file.type && error.file.type.indexOf( 'image/' ) === 0; var status = error && error.status; // If the file is an image and the error is HTTP 5xx try to create sub-sizes again. if ( isImage && status >= 500 && status < 600 ) { tryAgain( up, error ); return; } uploadError( error.file, error.code, error.message, up ); up.refresh(); }); uploader.bind( 'FileUploaded', function( up, file, response ) { uploadSuccess( file, response.response ); }); uploader.bind( 'UploadComplete', function() { uploadComplete(); }); }; if ( typeof( wpUploaderInit ) == 'object' ) { uploader_init(); } }); plupload/handlers.min.js 0000644 00000027254 15125140777 0011327 0 ustar 00 var uploader,uploader_init,topWin=window.dialogArguments||opener||parent||top;function fileQueued(e){jQuery(".media-blank").remove();var a=jQuery("#media-items").children(),r=post_id||0;1==a.length&&a.removeClass("open").find(".slidetoggle").slideUp(200),jQuery('<div class="media-item">').attr("id","media-item-"+e.id).addClass("child-of-"+r).append(jQuery('<div class="filename original">').text(" "+e.name),'<div class="progress"><div class="percent">0%</div><div class="bar"></div></div>').appendTo(jQuery("#media-items")),jQuery("#insert-gallery").prop("disabled",!0)}function uploadStart(){try{void 0!==topWin.tb_remove&&topWin.jQuery("#TB_overlay").unbind("click",topWin.tb_remove)}catch(e){}return!0}function uploadProgress(e,a){var r=jQuery("#media-item-"+a.id);jQuery(".bar",r).width(200*a.loaded/a.size),jQuery(".percent",r).html(a.percent+"%")}function fileUploading(e,a){var r=104857600;r<parseInt(e.settings.max_file_size,10)&&a.size>r&&setTimeout(function(){a.status<3&&0===a.loaded&&(wpFileError(a,pluploadL10n.big_upload_failed.replace("%1$s",'<a class="uploader-html" href="#">').replace("%2$s","</a>")),e.stop(),e.removeFile(a),e.start())},1e4)}function updateMediaForm(){var e=jQuery("#media-items").children();1==e.length?(e.addClass("open").find(".slidetoggle").show(),jQuery(".insert-gallery").hide()):1<e.length&&(e.removeClass("open"),jQuery(".insert-gallery").show()),0<e.not(".media-blank").length?jQuery(".savebutton").show():jQuery(".savebutton").hide()}function uploadSuccess(e,a){var r=jQuery("#media-item-"+e.id);"string"==typeof a&&(a=a.replace(/^<pre>(\d+)<\/pre>$/,"$1"),/media-upload-error|error-div/.test(a))?r.html(a):(r.find(".percent").html(pluploadL10n.crunching),prepareMediaItem(e,a),updateMediaForm(),post_id&&r.hasClass("child-of-"+post_id)&&jQuery("#attachments-count").text(+jQuery("#attachments-count").text()+1))}function setResize(e){e?window.resize_width&&window.resize_height?uploader.settings.resize={enabled:!0,width:window.resize_width,height:window.resize_height,quality:100}:uploader.settings.multipart_params.image_resize=!0:delete uploader.settings.multipart_params.image_resize}function prepareMediaItem(e,a){var r="undefined"==typeof shortform?1:2,i=jQuery("#media-item-"+e.id);2==r&&2<shortform&&(r=shortform);try{void 0!==topWin.tb_remove&&topWin.jQuery("#TB_overlay").click(topWin.tb_remove)}catch(e){}isNaN(a)||!a?(i.append(a),prepareMediaItemInit(e)):i.load("async-upload.php",{attachment_id:a,fetch:r},function(){prepareMediaItemInit(e),updateMediaForm()})}function prepareMediaItemInit(r){var e=jQuery("#media-item-"+r.id);jQuery(".thumbnail",e).clone().attr("class","pinkynail toggle").prependTo(e),jQuery(".filename.original",e).replaceWith(jQuery(".filename.new",e)),jQuery("a.delete",e).on("click",function(){return jQuery.ajax({url:ajaxurl,type:"post",success:deleteSuccess,error:deleteError,id:r.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"trash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}}),!1}),jQuery("a.undo",e).on("click",function(){return jQuery.ajax({url:ajaxurl,type:"post",id:r.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"untrash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")},success:function(){var e,a=jQuery("#media-item-"+r.id);(e=jQuery("#type-of-"+r.id).val())&&jQuery("#"+e+"-counter").text(+jQuery("#"+e+"-counter").text()+1),post_id&&a.hasClass("child-of-"+post_id)&&jQuery("#attachments-count").text(+jQuery("#attachments-count").text()+1),jQuery(".filename .trashnotice",a).remove(),jQuery(".filename .title",a).css("font-weight","normal"),jQuery("a.undo",a).addClass("hidden"),jQuery(".menu_order_input",a).show(),a.css({backgroundColor:"#ceb"}).animate({backgroundColor:"#fff"},{queue:!1,duration:500,complete:function(){jQuery(this).css({backgroundColor:""})}}).removeClass("undo")}}),!1}),jQuery("#media-item-"+r.id+".startopen").removeClass("startopen").addClass("open").find("slidetoggle").fadeIn()}function wpQueueError(e){jQuery("#media-upload-error").show().html('<div class="notice notice-error"><p>'+e+"</p></div>")}function wpFileError(e,a){itemAjaxError(e.id,a)}function itemAjaxError(e,a){var r=jQuery("#media-item-"+e),i=r.find(".filename").text();r.data("last-err")!=e&&r.html('<div class="error-div"><a class="dismiss" href="#">'+pluploadL10n.dismiss+"</a><strong>"+pluploadL10n.error_uploading.replace("%s",jQuery.trim(i))+"</strong> "+a+"</div>").data("last-err",e)}function deleteSuccess(e){var a;return"-1"==e?itemAjaxError(this.id,"You do not have permission. Has your session expired?"):"0"==e?itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?"):(e=this.id,a=jQuery("#media-item-"+e),(e=jQuery("#type-of-"+e).val())&&jQuery("#"+e+"-counter").text(jQuery("#"+e+"-counter").text()-1),post_id&&a.hasClass("child-of-"+post_id)&&jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1),1==jQuery("form.type-form #media-items").children().length&&0<jQuery(".hidden","#media-items").length&&(jQuery(".toggle").toggle(),jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")),jQuery(".toggle",a).toggle(),jQuery(".slidetoggle",a).slideUp(200).siblings().removeClass("hidden"),a.css({backgroundColor:"#faa"}).animate({backgroundColor:"#f4f4f4"},{queue:!1,duration:500}).addClass("undo"),jQuery(".filename:empty",a).remove(),jQuery(".filename .title",a).css("font-weight","bold"),jQuery(".filename",a).append('<span class="trashnotice"> '+pluploadL10n.deleted+" </span>").siblings("a.toggle").hide(),jQuery(".filename",a).append(jQuery("a.undo",a).removeClass("hidden")),void jQuery(".menu_order_input",a).hide())}function deleteError(){}function uploadComplete(){jQuery("#insert-gallery").prop("disabled",!1)}function switchUploader(e){e?(deleteUserSetting("uploader"),jQuery(".media-upload-form").removeClass("html-uploader"),"object"==typeof uploader&&uploader.refresh()):(setUserSetting("uploader","1"),jQuery(".media-upload-form").addClass("html-uploader"))}function uploadError(e,a,r,i){var t=104857600;switch(a){case plupload.FAILED:wpFileError(e,pluploadL10n.upload_failed);break;case plupload.FILE_EXTENSION_ERROR:wpFileExtensionError(i,e,pluploadL10n.invalid_filetype);break;case plupload.FILE_SIZE_ERROR:uploadSizeError(i,e);break;case plupload.IMAGE_FORMAT_ERROR:wpFileError(e,pluploadL10n.not_an_image);break;case plupload.IMAGE_MEMORY_ERROR:wpFileError(e,pluploadL10n.image_memory_exceeded);break;case plupload.IMAGE_DIMENSIONS_ERROR:wpFileError(e,pluploadL10n.image_dimensions_exceeded);break;case plupload.GENERIC_ERROR:wpQueueError(pluploadL10n.upload_failed);break;case plupload.IO_ERROR:t<parseInt(i.settings.filters.max_file_size,10)&&e.size>t?wpFileError(e,pluploadL10n.big_upload_failed.replace("%1$s",'<a class="uploader-html" href="#">').replace("%2$s","</a>")):wpQueueError(pluploadL10n.io_error);break;case plupload.HTTP_ERROR:wpQueueError(pluploadL10n.http_error);break;case plupload.INIT_ERROR:jQuery(".media-upload-form").addClass("html-uploader");break;case plupload.SECURITY_ERROR:wpQueueError(pluploadL10n.security_error);break;default:wpFileError(e,pluploadL10n.default_error)}}function uploadSizeError(e,a){var r=pluploadL10n.file_exceeds_size_limit.replace("%s",a.name),r=jQuery("<div />").attr({id:"media-item-"+a.id,class:"media-item error"}).append(jQuery("<p />").text(r));jQuery("#media-items").append(r),e.removeFile(a)}function wpFileExtensionError(e,a,r){jQuery("#media-items").append('<div id="media-item-'+a.id+'" class="media-item error"><p>'+r+"</p></div>"),e.removeFile(a)}function copyAttachmentUploadURLClipboard(){var i;new ClipboardJS(".copy-attachment-url").on("success",function(e){var a=jQuery(e.trigger),r=jQuery(".success",a.closest(".copy-to-clipboard-container"));e.clearSelection(),clearTimeout(i),r.removeClass("hidden"),i=setTimeout(function(){r.addClass("hidden")},3e3),wp.a11y.speak(pluploadL10n.file_url_copied)})}jQuery(document).ready(function(o){copyAttachmentUploadURLClipboard();var d,l={};o(".media-upload-form").on("click.uploader",function(e){var a,r=o(e.target);r.is('input[type="radio"]')?(a=r.closest("tr")).hasClass("align")?setUserSetting("align",r.val()):a.hasClass("image-size")&&setUserSetting("imgsize",r.val()):r.is("button.button")?(a=(a=e.target.className||"").match(/url([^ '"]+)/))&&a[1]&&(setUserSetting("urlbutton",a[1]),r.siblings(".urlfield").val(r.data("link-url"))):r.is("a.dismiss")?r.parents(".media-item").fadeOut(200,function(){o(this).remove()}):r.is(".upload-flash-bypass a")||r.is("a.uploader-html")?(o("#media-items, p.submit, span.big-file-warning").css("display","none"),switchUploader(0),e.preventDefault()):r.is(".upload-html-bypass a")?(o("#media-items, p.submit, span.big-file-warning").css("display",""),switchUploader(1),e.preventDefault()):r.is("a.describe-toggle-on")?(r.parent().addClass("open"),r.siblings(".slidetoggle").fadeIn(250,function(){var e=o(window).scrollTop(),a=o(window).height(),r=o(this).offset().top,i=o(this).height();a&&r&&i&&(a=e+a)<(i=r+i)&&(i-a<r-e?window.scrollBy(0,i-a+10):window.scrollBy(0,r-e-40))}),e.preventDefault()):r.is("a.describe-toggle-off")&&(r.siblings(".slidetoggle").fadeOut(250,function(){r.parent().removeClass("open")}),e.preventDefault())}),d=function(a,r){var e,i,t=r.file;r&&r.responseHeaders&&(i=r.responseHeaders.match(/x-wp-upload-attachment-id:\s*(\d+)/i))&&i[1]?(i=i[1],(e=l[t.id])&&4<e?(o.ajax({type:"post",url:ajaxurl,dataType:"json",data:{action:"media-create-image-subsizes",_wpnonce:wpUploaderInit.multipart_params._wpnonce,attachment_id:i,_wp_upload_failed_cleanup:!0}}),r.message&&(r.status<500||600<=r.status)?wpQueueError(r.message):wpQueueError(pluploadL10n.http_error_image)):(l[t.id]=e?++e:1,o.ajax({type:"post",url:ajaxurl,dataType:"json",data:{action:"media-create-image-subsizes",_wpnonce:wpUploaderInit.multipart_params._wpnonce,attachment_id:i,_legacy_support:"true"}}).done(function(e){var a;e.success?uploadSuccess(t,e.data.id):wpQueueError((a=e.data&&e.data.message?e.data.message:a)||pluploadL10n.http_error_image)}).fail(function(e){500<=e.status&&e.status<600?d(a,r):wpQueueError(pluploadL10n.http_error_image)}))):wpQueueError(pluploadL10n.http_error_image)},uploader_init=function(){uploader=new plupload.Uploader(wpUploaderInit),o("#image_resize").on("change",function(){var e=o(this).prop("checked");setResize(e),e?setUserSetting("upload_resize","1"):deleteUserSetting("upload_resize")}),uploader.bind("Init",function(e){var a=o("#plupload-upload-ui");setResize(getUserSetting("upload_resize",!1)),e.features.dragdrop&&!o(document.body).hasClass("mobile")?(a.addClass("drag-drop"),o("#drag-drop-area").on("dragover.wp-uploader",function(){a.addClass("drag-over")}).on("dragleave.wp-uploader, drop.wp-uploader",function(){a.removeClass("drag-over")})):(a.removeClass("drag-drop"),o("#drag-drop-area").off(".wp-uploader")),"html4"===e.runtime&&o(".upload-flash-bypass").hide()}),uploader.bind("postinit",function(e){e.refresh()}),uploader.init(),uploader.bind("FilesAdded",function(a,e){o("#media-upload-error").empty(),uploadStart(),plupload.each(e,function(e){if("image/heic"===e.type&&a.settings.heic_upload_error)wpQueueError(pluploadL10n.unsupported_image);else{if("image/webp"===e.type&&a.settings.webp_upload_error)return wpQueueError(pluploadL10n.noneditable_image),void a.removeFile(e);if("image/avif"===e.type&&a.settings.avif_upload_error)return wpQueueError(pluploadL10n.noneditable_image),void a.removeFile(e)}fileQueued(e)}),a.refresh(),a.start()}),uploader.bind("UploadFile",function(e,a){fileUploading(e,a)}),uploader.bind("UploadProgress",function(e,a){uploadProgress(e,a)}),uploader.bind("Error",function(e,a){var r=a.file&&a.file.type&&0===a.file.type.indexOf("image/"),i=a&&a.status;r&&500<=i&&i<600?d(e,a):(uploadError(a.file,a.code,a.message,e),e.refresh())}),uploader.bind("FileUploaded",function(e,a,r){uploadSuccess(a,r.response)}),uploader.bind("UploadComplete",function(){uploadComplete()})},"object"==typeof wpUploaderInit&&uploader_init()}); plupload/license.txt 0000644 00000043103 15125140777 0010561 0 ustar 00 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. wp-api.js 0000644 00000133607 15125140777 0006322 0 ustar 00 /** * @output wp-includes/js/wp-api.js */ (function( window, undefined ) { 'use strict'; /** * Initialize the WP_API. */ function WP_API() { /** @namespace wp.api.models */ this.models = {}; /** @namespace wp.api.collections */ this.collections = {}; /** @namespace wp.api.views */ this.views = {}; } /** @namespace wp */ window.wp = window.wp || {}; /** @namespace wp.api */ wp.api = wp.api || new WP_API(); wp.api.versionString = wp.api.versionString || 'wp/v2/'; // Alias _includes to _.contains, ensuring it is available if lodash is used. if ( ! _.isFunction( _.includes ) && _.isFunction( _.contains ) ) { _.includes = _.contains; } })( window ); (function( window, undefined ) { 'use strict'; var pad, r; /** @namespace wp */ window.wp = window.wp || {}; /** @namespace wp.api */ wp.api = wp.api || {}; /** @namespace wp.api.utils */ wp.api.utils = wp.api.utils || {}; /** * Determine model based on API route. * * @param {string} route The API route. * * @return {Backbone Model} The model found at given route. Undefined if not found. */ wp.api.getModelByRoute = function( route ) { return _.find( wp.api.models, function( model ) { return model.prototype.route && route === model.prototype.route.index; } ); }; /** * Determine collection based on API route. * * @param {string} route The API route. * * @return {Backbone Model} The collection found at given route. Undefined if not found. */ wp.api.getCollectionByRoute = function( route ) { return _.find( wp.api.collections, function( collection ) { return collection.prototype.route && route === collection.prototype.route.index; } ); }; /** * ECMAScript 5 shim, adapted from MDN. * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString */ if ( ! Date.prototype.toISOString ) { pad = function( number ) { r = String( number ); if ( 1 === r.length ) { r = '0' + r; } return r; }; Date.prototype.toISOString = function() { return this.getUTCFullYear() + '-' + pad( this.getUTCMonth() + 1 ) + '-' + pad( this.getUTCDate() ) + 'T' + pad( this.getUTCHours() ) + ':' + pad( this.getUTCMinutes() ) + ':' + pad( this.getUTCSeconds() ) + '.' + String( ( this.getUTCMilliseconds() / 1000 ).toFixed( 3 ) ).slice( 2, 5 ) + 'Z'; }; } /** * Parse date into ISO8601 format. * * @param {Date} date. */ wp.api.utils.parseISO8601 = function( date ) { var timestamp, struct, i, k, minutesOffset = 0, numericKeys = [ 1, 4, 5, 6, 7, 10, 11 ]; /* * ES5 §15.9.4.2 states that the string should attempt to be parsed as a Date Time String Format string * before falling back to any implementation-specific date parsing, so that’s what we do, even if native * implementations could be faster. */ // 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm if ( ( struct = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec( date ) ) ) { // Avoid NaN timestamps caused by “undefined” values being passed to Date.UTC. for ( i = 0; ( k = numericKeys[i] ); ++i ) { struct[k] = +struct[k] || 0; } // Allow undefined days and months. struct[2] = ( +struct[2] || 1 ) - 1; struct[3] = +struct[3] || 1; if ( 'Z' !== struct[8] && undefined !== struct[9] ) { minutesOffset = struct[10] * 60 + struct[11]; if ( '+' === struct[9] ) { minutesOffset = 0 - minutesOffset; } } timestamp = Date.UTC( struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7] ); } else { timestamp = Date.parse ? Date.parse( date ) : NaN; } return timestamp; }; /** * Helper function for getting the root URL. * @return {[type]} [description] */ wp.api.utils.getRootUrl = function() { return window.location.origin ? window.location.origin + '/' : window.location.protocol + '//' + window.location.host + '/'; }; /** * Helper for capitalizing strings. */ wp.api.utils.capitalize = function( str ) { if ( _.isUndefined( str ) ) { return str; } return str.charAt( 0 ).toUpperCase() + str.slice( 1 ); }; /** * Helper function that capitalizes the first word and camel cases any words starting * after dashes, removing the dashes. */ wp.api.utils.capitalizeAndCamelCaseDashes = function( str ) { if ( _.isUndefined( str ) ) { return str; } str = wp.api.utils.capitalize( str ); return wp.api.utils.camelCaseDashes( str ); }; /** * Helper function to camel case the letter after dashes, removing the dashes. */ wp.api.utils.camelCaseDashes = function( str ) { return str.replace( /-([a-z])/g, function( g ) { return g[ 1 ].toUpperCase(); } ); }; /** * Extract a route part based on negative index. * * @param {string} route The endpoint route. * @param {number} part The number of parts from the end of the route to retrieve. Default 1. * Example route `/a/b/c`: part 1 is `c`, part 2 is `b`, part 3 is `a`. * @param {string} [versionString] Version string, defaults to `wp.api.versionString`. * @param {boolean} [reverse] Whether to reverse the order when extracting the route part. Optional, default false. */ wp.api.utils.extractRoutePart = function( route, part, versionString, reverse ) { var routeParts; part = part || 1; versionString = versionString || wp.api.versionString; // Remove versions string from route to avoid returning it. if ( 0 === route.indexOf( '/' + versionString ) ) { route = route.substr( versionString.length + 1 ); } routeParts = route.split( '/' ); if ( reverse ) { routeParts = routeParts.reverse(); } if ( _.isUndefined( routeParts[ --part ] ) ) { return ''; } return routeParts[ part ]; }; /** * Extract a parent name from a passed route. * * @param {string} route The route to extract a name from. */ wp.api.utils.extractParentName = function( route ) { var name, lastSlash = route.lastIndexOf( '_id>[\\d]+)/' ); if ( lastSlash < 0 ) { return ''; } name = route.substr( 0, lastSlash - 1 ); name = name.split( '/' ); name.pop(); name = name.pop(); return name; }; /** * Add args and options to a model prototype from a route's endpoints. * * @param {Array} routeEndpoints Array of route endpoints. * @param {Object} modelInstance An instance of the model (or collection) * to add the args to. */ wp.api.utils.decorateFromRoute = function( routeEndpoints, modelInstance ) { /** * Build the args based on route endpoint data. */ _.each( routeEndpoints, function( routeEndpoint ) { // Add post and edit endpoints as model args. if ( _.includes( routeEndpoint.methods, 'POST' ) || _.includes( routeEndpoint.methods, 'PUT' ) ) { // Add any non-empty args, merging them into the args object. if ( ! _.isEmpty( routeEndpoint.args ) ) { // Set as default if no args yet. if ( _.isEmpty( modelInstance.prototype.args ) ) { modelInstance.prototype.args = routeEndpoint.args; } else { // We already have args, merge these new args in. modelInstance.prototype.args = _.extend( modelInstance.prototype.args, routeEndpoint.args ); } } } else { // Add GET method as model options. if ( _.includes( routeEndpoint.methods, 'GET' ) ) { // Add any non-empty args, merging them into the defaults object. if ( ! _.isEmpty( routeEndpoint.args ) ) { // Set as default if no defaults yet. if ( _.isEmpty( modelInstance.prototype.options ) ) { modelInstance.prototype.options = routeEndpoint.args; } else { // We already have options, merge these new args in. modelInstance.prototype.options = _.extend( modelInstance.prototype.options, routeEndpoint.args ); } } } } } ); }; /** * Add mixins and helpers to models depending on their defaults. * * @param {Backbone Model} model The model to attach helpers and mixins to. * @param {string} modelClassName The classname of the constructed model. * @param {Object} loadingObjects An object containing the models and collections we are building. */ wp.api.utils.addMixinsAndHelpers = function( model, modelClassName, loadingObjects ) { var hasDate = false, /** * Array of parseable dates. * * @type {string[]}. */ parseableDates = [ 'date', 'modified', 'date_gmt', 'modified_gmt' ], /** * Mixin for all content that is time stamped. * * This mixin converts between mysql timestamps and JavaScript Dates when syncing a model * to or from the server. For example, a date stored as `2015-12-27T21:22:24` on the server * gets expanded to `Sun Dec 27 2015 14:22:24 GMT-0700 (MST)` when the model is fetched. * * @type {{toJSON: toJSON, parse: parse}}. */ TimeStampedMixin = { /** * Prepare a JavaScript Date for transmitting to the server. * * This helper function accepts a field and Date object. It converts the passed Date * to an ISO string and sets that on the model field. * * @param {Date} date A JavaScript date object. WordPress expects dates in UTC. * @param {string} field The date field to set. One of 'date', 'date_gmt', 'date_modified' * or 'date_modified_gmt'. Optional, defaults to 'date'. */ setDate: function( date, field ) { var theField = field || 'date'; // Don't alter non-parsable date fields. if ( _.indexOf( parseableDates, theField ) < 0 ) { return false; } this.set( theField, date.toISOString() ); }, /** * Get a JavaScript Date from the passed field. * * WordPress returns 'date' and 'date_modified' in the timezone of the server as well as * UTC dates as 'date_gmt' and 'date_modified_gmt'. Draft posts do not include UTC dates. * * @param {string} field The date field to set. One of 'date', 'date_gmt', 'date_modified' * or 'date_modified_gmt'. Optional, defaults to 'date'. */ getDate: function( field ) { var theField = field || 'date', theISODate = this.get( theField ); // Only get date fields and non-null values. if ( _.indexOf( parseableDates, theField ) < 0 || _.isNull( theISODate ) ) { return false; } return new Date( wp.api.utils.parseISO8601( theISODate ) ); } }, /** * Build a helper function to retrieve related model. * * @param {string} parentModel The parent model. * @param {number} modelId The model ID if the object to request * @param {string} modelName The model name to use when constructing the model. * @param {string} embedSourcePoint Where to check the embedded object for _embed data. * @param {string} embedCheckField Which model field to check to see if the model has data. * * @return {Deferred.promise} A promise which resolves to the constructed model. */ buildModelGetter = function( parentModel, modelId, modelName, embedSourcePoint, embedCheckField ) { var getModel, embeddedObjects, attributes, deferred; deferred = jQuery.Deferred(); embeddedObjects = parentModel.get( '_embedded' ) || {}; // Verify that we have a valid object id. if ( ! _.isNumber( modelId ) || 0 === modelId ) { deferred.reject(); return deferred; } // If we have embedded object data, use that when constructing the getModel. if ( embeddedObjects[ embedSourcePoint ] ) { attributes = _.findWhere( embeddedObjects[ embedSourcePoint ], { id: modelId } ); } // Otherwise use the modelId. if ( ! attributes ) { attributes = { id: modelId }; } // Create the new getModel model. getModel = new wp.api.models[ modelName ]( attributes ); if ( ! getModel.get( embedCheckField ) ) { getModel.fetch( { success: function( getModel ) { deferred.resolve( getModel ); }, error: function( getModel, response ) { deferred.reject( response ); } } ); } else { // Resolve with the embedded model. deferred.resolve( getModel ); } // Return a promise. return deferred.promise(); }, /** * Build a helper to retrieve a collection. * * @param {string} parentModel The parent model. * @param {string} collectionName The name to use when constructing the collection. * @param {string} embedSourcePoint Where to check the embedded object for _embed data. * @param {string} embedIndex An additional optional index for the _embed data. * * @return {Deferred.promise} A promise which resolves to the constructed collection. */ buildCollectionGetter = function( parentModel, collectionName, embedSourcePoint, embedIndex ) { /** * Returns a promise that resolves to the requested collection * * Uses the embedded data if available, otherwise fetches the * data from the server. * * @return {Deferred.promise} promise Resolves to a wp.api.collections[ collectionName ] * collection. */ var postId, embeddedObjects, getObjects, classProperties = '', properties = '', deferred = jQuery.Deferred(); postId = parentModel.get( 'id' ); embeddedObjects = parentModel.get( '_embedded' ) || {}; // Verify that we have a valid post ID. if ( ! _.isNumber( postId ) || 0 === postId ) { deferred.reject(); return deferred; } // If we have embedded getObjects data, use that when constructing the getObjects. if ( ! _.isUndefined( embedSourcePoint ) && ! _.isUndefined( embeddedObjects[ embedSourcePoint ] ) ) { // Some embeds also include an index offset, check for that. if ( _.isUndefined( embedIndex ) ) { // Use the embed source point directly. properties = embeddedObjects[ embedSourcePoint ]; } else { // Add the index to the embed source point. properties = embeddedObjects[ embedSourcePoint ][ embedIndex ]; } } else { // Otherwise use the postId. classProperties = { parent: postId }; } // Create the new getObjects collection. getObjects = new wp.api.collections[ collectionName ]( properties, classProperties ); // If we didn’t have embedded getObjects, fetch the getObjects data. if ( _.isUndefined( getObjects.models[0] ) ) { getObjects.fetch( { success: function( getObjects ) { // Add a helper 'parent_post' attribute onto the model. setHelperParentPost( getObjects, postId ); deferred.resolve( getObjects ); }, error: function( getModel, response ) { deferred.reject( response ); } } ); } else { // Add a helper 'parent_post' attribute onto the model. setHelperParentPost( getObjects, postId ); deferred.resolve( getObjects ); } // Return a promise. return deferred.promise(); }, /** * Set the model post parent. */ setHelperParentPost = function( collection, postId ) { // Attach post_parent id to the collection. _.each( collection.models, function( model ) { model.set( 'parent_post', postId ); } ); }, /** * Add a helper function to handle post Meta. */ MetaMixin = { /** * Get meta by key for a post. * * @param {string} key The meta key. * * @return {Object} The post meta value. */ getMeta: function( key ) { var metas = this.get( 'meta' ); return metas[ key ]; }, /** * Get all meta key/values for a post. * * @return {Object} The post metas, as a key value pair object. */ getMetas: function() { return this.get( 'meta' ); }, /** * Set a group of meta key/values for a post. * * @param {Object} meta The post meta to set, as key/value pairs. */ setMetas: function( meta ) { var metas = this.get( 'meta' ); _.extend( metas, meta ); this.set( 'meta', metas ); }, /** * Set a single meta value for a post, by key. * * @param {string} key The meta key. * @param {Object} value The meta value. */ setMeta: function( key, value ) { var metas = this.get( 'meta' ); metas[ key ] = value; this.set( 'meta', metas ); } }, /** * Add a helper function to handle post Revisions. */ RevisionsMixin = { getRevisions: function() { return buildCollectionGetter( this, 'PostRevisions' ); } }, /** * Add a helper function to handle post Tags. */ TagsMixin = { /** * Get the tags for a post. * * @return {Deferred.promise} promise Resolves to an array of tags. */ getTags: function() { var tagIds = this.get( 'tags' ), tags = new wp.api.collections.Tags(); // Resolve with an empty array if no tags. if ( _.isEmpty( tagIds ) ) { return jQuery.Deferred().resolve( [] ); } return tags.fetch( { data: { include: tagIds } } ); }, /** * Set the tags for a post. * * Accepts an array of tag slugs, or a Tags collection. * * @param {Array|Backbone.Collection} tags The tags to set on the post. * */ setTags: function( tags ) { var allTags, newTag, self = this, newTags = []; if ( _.isString( tags ) ) { return false; } // If this is an array of slugs, build a collection. if ( _.isArray( tags ) ) { // Get all the tags. allTags = new wp.api.collections.Tags(); allTags.fetch( { data: { per_page: 100 }, success: function( alltags ) { // Find the passed tags and set them up. _.each( tags, function( tag ) { newTag = new wp.api.models.Tag( alltags.findWhere( { slug: tag } ) ); // Tie the new tag to the post. newTag.set( 'parent_post', self.get( 'id' ) ); // Add the new tag to the collection. newTags.push( newTag ); } ); tags = new wp.api.collections.Tags( newTags ); self.setTagsWithCollection( tags ); } } ); } else { this.setTagsWithCollection( tags ); } }, /** * Set the tags for a post. * * Accepts a Tags collection. * * @param {Array|Backbone.Collection} tags The tags to set on the post. * */ setTagsWithCollection: function( tags ) { // Pluck out the category IDs. this.set( 'tags', tags.pluck( 'id' ) ); return this.save(); } }, /** * Add a helper function to handle post Categories. */ CategoriesMixin = { /** * Get a the categories for a post. * * @return {Deferred.promise} promise Resolves to an array of categories. */ getCategories: function() { var categoryIds = this.get( 'categories' ), categories = new wp.api.collections.Categories(); // Resolve with an empty array if no categories. if ( _.isEmpty( categoryIds ) ) { return jQuery.Deferred().resolve( [] ); } return categories.fetch( { data: { include: categoryIds } } ); }, /** * Set the categories for a post. * * Accepts an array of category slugs, or a Categories collection. * * @param {Array|Backbone.Collection} categories The categories to set on the post. * */ setCategories: function( categories ) { var allCategories, newCategory, self = this, newCategories = []; if ( _.isString( categories ) ) { return false; } // If this is an array of slugs, build a collection. if ( _.isArray( categories ) ) { // Get all the categories. allCategories = new wp.api.collections.Categories(); allCategories.fetch( { data: { per_page: 100 }, success: function( allcats ) { // Find the passed categories and set them up. _.each( categories, function( category ) { newCategory = new wp.api.models.Category( allcats.findWhere( { slug: category } ) ); // Tie the new category to the post. newCategory.set( 'parent_post', self.get( 'id' ) ); // Add the new category to the collection. newCategories.push( newCategory ); } ); categories = new wp.api.collections.Categories( newCategories ); self.setCategoriesWithCollection( categories ); } } ); } else { this.setCategoriesWithCollection( categories ); } }, /** * Set the categories for a post. * * Accepts Categories collection. * * @param {Array|Backbone.Collection} categories The categories to set on the post. * */ setCategoriesWithCollection: function( categories ) { // Pluck out the category IDs. this.set( 'categories', categories.pluck( 'id' ) ); return this.save(); } }, /** * Add a helper function to retrieve the author user model. */ AuthorMixin = { getAuthorUser: function() { return buildModelGetter( this, this.get( 'author' ), 'User', 'author', 'name' ); } }, /** * Add a helper function to retrieve the featured media. */ FeaturedMediaMixin = { getFeaturedMedia: function() { return buildModelGetter( this, this.get( 'featured_media' ), 'Media', 'wp:featuredmedia', 'source_url' ); } }; // Exit if we don't have valid model defaults. if ( _.isUndefined( model.prototype.args ) ) { return model; } // Go thru the parsable date fields, if our model contains any of them it gets the TimeStampedMixin. _.each( parseableDates, function( theDateKey ) { if ( ! _.isUndefined( model.prototype.args[ theDateKey ] ) ) { hasDate = true; } } ); // Add the TimeStampedMixin for models that contain a date field. if ( hasDate ) { model = model.extend( TimeStampedMixin ); } // Add the AuthorMixin for models that contain an author. if ( ! _.isUndefined( model.prototype.args.author ) ) { model = model.extend( AuthorMixin ); } // Add the FeaturedMediaMixin for models that contain a featured_media. if ( ! _.isUndefined( model.prototype.args.featured_media ) ) { model = model.extend( FeaturedMediaMixin ); } // Add the CategoriesMixin for models that support categories collections. if ( ! _.isUndefined( model.prototype.args.categories ) ) { model = model.extend( CategoriesMixin ); } // Add the MetaMixin for models that support meta. if ( ! _.isUndefined( model.prototype.args.meta ) ) { model = model.extend( MetaMixin ); } // Add the TagsMixin for models that support tags collections. if ( ! _.isUndefined( model.prototype.args.tags ) ) { model = model.extend( TagsMixin ); } // Add the RevisionsMixin for models that support revisions collections. if ( ! _.isUndefined( loadingObjects.collections[ modelClassName + 'Revisions' ] ) ) { model = model.extend( RevisionsMixin ); } return model; }; })( window ); /* global wpApiSettings:false */ // Suppress warning about parse function's unused "options" argument: /* jshint unused:false */ (function() { 'use strict'; var wpApiSettings = window.wpApiSettings || {}, trashableTypes = [ 'Comment', 'Media', 'Comment', 'Post', 'Page', 'Status', 'Taxonomy', 'Type' ]; /** * Backbone base model for all models. */ wp.api.WPApiBaseModel = Backbone.Model.extend( /** @lends WPApiBaseModel.prototype */ { // Initialize the model. initialize: function() { /** * Types that don't support trashing require passing ?force=true to delete. * */ if ( -1 === _.indexOf( trashableTypes, this.name ) ) { this.requireForceForDelete = true; } }, /** * Set nonce header before every Backbone sync. * * @param {string} method. * @param {Backbone.Model} model. * @param {{beforeSend}, *} options. * @return {*}. */ sync: function( method, model, options ) { var beforeSend; options = options || {}; // Remove date_gmt if null. if ( _.isNull( model.get( 'date_gmt' ) ) ) { model.unset( 'date_gmt' ); } // Remove slug if empty. if ( _.isEmpty( model.get( 'slug' ) ) ) { model.unset( 'slug' ); } if ( _.isFunction( model.nonce ) && ! _.isEmpty( model.nonce() ) ) { beforeSend = options.beforeSend; // @todo Enable option for jsonp endpoints. // options.dataType = 'jsonp'; // Include the nonce with requests. options.beforeSend = function( xhr ) { xhr.setRequestHeader( 'X-WP-Nonce', model.nonce() ); if ( beforeSend ) { return beforeSend.apply( this, arguments ); } }; // Update the nonce when a new nonce is returned with the response. options.complete = function( xhr ) { var returnedNonce = xhr.getResponseHeader( 'X-WP-Nonce' ); if ( returnedNonce && _.isFunction( model.nonce ) && model.nonce() !== returnedNonce ) { model.endpointModel.set( 'nonce', returnedNonce ); } }; } // Add '?force=true' to use delete method when required. if ( this.requireForceForDelete && 'delete' === method ) { model.url = model.url() + '?force=true'; } return Backbone.sync( method, model, options ); }, /** * Save is only allowed when the PUT OR POST methods are available for the endpoint. */ save: function( attrs, options ) { // Do we have the put method, then execute the save. if ( _.includes( this.methods, 'PUT' ) || _.includes( this.methods, 'POST' ) ) { // Proxy the call to the original save function. return Backbone.Model.prototype.save.call( this, attrs, options ); } else { // Otherwise bail, disallowing action. return false; } }, /** * Delete is only allowed when the DELETE method is available for the endpoint. */ destroy: function( options ) { // Do we have the DELETE method, then execute the destroy. if ( _.includes( this.methods, 'DELETE' ) ) { // Proxy the call to the original save function. return Backbone.Model.prototype.destroy.call( this, options ); } else { // Otherwise bail, disallowing action. return false; } } } ); /** * API Schema model. Contains meta information about the API. */ wp.api.models.Schema = wp.api.WPApiBaseModel.extend( /** @lends Schema.prototype */ { defaults: { _links: {}, namespace: null, routes: {} }, initialize: function( attributes, options ) { var model = this; options = options || {}; wp.api.WPApiBaseModel.prototype.initialize.call( model, attributes, options ); model.apiRoot = options.apiRoot || wpApiSettings.root; model.versionString = options.versionString || wpApiSettings.versionString; }, url: function() { return this.apiRoot + this.versionString; } } ); })(); ( function() { 'use strict'; var wpApiSettings = window.wpApiSettings || {}; /** * Contains basic collection functionality such as pagination. */ wp.api.WPApiBaseCollection = Backbone.Collection.extend( /** @lends BaseCollection.prototype */ { /** * Setup default state. */ initialize: function( models, options ) { this.state = { data: {}, currentPage: null, totalPages: null, totalObjects: null }; if ( _.isUndefined( options ) ) { this.parent = ''; } else { this.parent = options.parent; } }, /** * Extend Backbone.Collection.sync to add nince and pagination support. * * Set nonce header before every Backbone sync. * * @param {string} method. * @param {Backbone.Model} model. * @param {{success}, *} options. * @return {*}. */ sync: function( method, model, options ) { var beforeSend, success, self = this; options = options || {}; if ( _.isFunction( model.nonce ) && ! _.isEmpty( model.nonce() ) ) { beforeSend = options.beforeSend; // Include the nonce with requests. options.beforeSend = function( xhr ) { xhr.setRequestHeader( 'X-WP-Nonce', model.nonce() ); if ( beforeSend ) { return beforeSend.apply( self, arguments ); } }; // Update the nonce when a new nonce is returned with the response. options.complete = function( xhr ) { var returnedNonce = xhr.getResponseHeader( 'X-WP-Nonce' ); if ( returnedNonce && _.isFunction( model.nonce ) && model.nonce() !== returnedNonce ) { model.endpointModel.set( 'nonce', returnedNonce ); } }; } // When reading, add pagination data. if ( 'read' === method ) { if ( options.data ) { self.state.data = _.clone( options.data ); delete self.state.data.page; } else { self.state.data = options.data = {}; } if ( 'undefined' === typeof options.data.page ) { self.state.currentPage = null; self.state.totalPages = null; self.state.totalObjects = null; } else { self.state.currentPage = options.data.page - 1; } success = options.success; options.success = function( data, textStatus, request ) { if ( ! _.isUndefined( request ) ) { self.state.totalPages = parseInt( request.getResponseHeader( 'x-wp-totalpages' ), 10 ); self.state.totalObjects = parseInt( request.getResponseHeader( 'x-wp-total' ), 10 ); } if ( null === self.state.currentPage ) { self.state.currentPage = 1; } else { self.state.currentPage++; } if ( success ) { return success.apply( this, arguments ); } }; } // Continue by calling Backbone's sync. return Backbone.sync( method, model, options ); }, /** * Fetches the next page of objects if a new page exists. * * @param {data: {page}} options. * @return {*}. */ more: function( options ) { options = options || {}; options.data = options.data || {}; _.extend( options.data, this.state.data ); if ( 'undefined' === typeof options.data.page ) { if ( ! this.hasMore() ) { return false; } if ( null === this.state.currentPage || this.state.currentPage <= 1 ) { options.data.page = 2; } else { options.data.page = this.state.currentPage + 1; } } return this.fetch( options ); }, /** * Returns true if there are more pages of objects available. * * @return {null|boolean} */ hasMore: function() { if ( null === this.state.totalPages || null === this.state.totalObjects || null === this.state.currentPage ) { return null; } else { return ( this.state.currentPage < this.state.totalPages ); } } } ); } )(); ( function() { 'use strict'; var Endpoint, initializedDeferreds = {}, wpApiSettings = window.wpApiSettings || {}; /** @namespace wp */ window.wp = window.wp || {}; /** @namespace wp.api */ wp.api = wp.api || {}; // If wpApiSettings is unavailable, try the default. if ( _.isEmpty( wpApiSettings ) ) { wpApiSettings.root = window.location.origin + '/wp-json/'; } Endpoint = Backbone.Model.extend(/** @lends Endpoint.prototype */{ defaults: { apiRoot: wpApiSettings.root, versionString: wp.api.versionString, nonce: null, schema: null, models: {}, collections: {} }, /** * Initialize the Endpoint model. */ initialize: function() { var model = this, deferred; Backbone.Model.prototype.initialize.apply( model, arguments ); deferred = jQuery.Deferred(); model.schemaConstructed = deferred.promise(); model.schemaModel = new wp.api.models.Schema( null, { apiRoot: model.get( 'apiRoot' ), versionString: model.get( 'versionString' ), nonce: model.get( 'nonce' ) } ); // When the model loads, resolve the promise. model.schemaModel.once( 'change', function() { model.constructFromSchema(); deferred.resolve( model ); } ); if ( model.get( 'schema' ) ) { // Use schema supplied as model attribute. model.schemaModel.set( model.schemaModel.parse( model.get( 'schema' ) ) ); } else if ( ! _.isUndefined( sessionStorage ) && ( _.isUndefined( wpApiSettings.cacheSchema ) || wpApiSettings.cacheSchema ) && sessionStorage.getItem( 'wp-api-schema-model' + model.get( 'apiRoot' ) + model.get( 'versionString' ) ) ) { // Used a cached copy of the schema model if available. model.schemaModel.set( model.schemaModel.parse( JSON.parse( sessionStorage.getItem( 'wp-api-schema-model' + model.get( 'apiRoot' ) + model.get( 'versionString' ) ) ) ) ); } else { model.schemaModel.fetch( { /** * When the server returns the schema model data, store the data in a sessionCache so we don't * have to retrieve it again for this session. Then, construct the models and collections based * on the schema model data. * * @ignore */ success: function( newSchemaModel ) { // Store a copy of the schema model in the session cache if available. if ( ! _.isUndefined( sessionStorage ) && ( _.isUndefined( wpApiSettings.cacheSchema ) || wpApiSettings.cacheSchema ) ) { try { sessionStorage.setItem( 'wp-api-schema-model' + model.get( 'apiRoot' ) + model.get( 'versionString' ), JSON.stringify( newSchemaModel ) ); } catch ( error ) { // Fail silently, fixes errors in safari private mode. } } }, // Log the error condition. error: function( err ) { window.console.log( err ); } } ); } }, constructFromSchema: function() { var routeModel = this, modelRoutes, collectionRoutes, schemaRoot, loadingObjects, /** * Set up the model and collection name mapping options. As the schema is built, the * model and collection names will be adjusted if they are found in the mapping object. * * Localizing a variable wpApiSettings.mapping will over-ride the default mapping options. * */ mapping = wpApiSettings.mapping || { models: { 'Categories': 'Category', 'Comments': 'Comment', 'Pages': 'Page', 'PagesMeta': 'PageMeta', 'PagesRevisions': 'PageRevision', 'Posts': 'Post', 'PostsCategories': 'PostCategory', 'PostsRevisions': 'PostRevision', 'PostsTags': 'PostTag', 'Schema': 'Schema', 'Statuses': 'Status', 'Tags': 'Tag', 'Taxonomies': 'Taxonomy', 'Types': 'Type', 'Users': 'User' }, collections: { 'PagesMeta': 'PageMeta', 'PagesRevisions': 'PageRevisions', 'PostsCategories': 'PostCategories', 'PostsMeta': 'PostMeta', 'PostsRevisions': 'PostRevisions', 'PostsTags': 'PostTags' } }, modelEndpoints = routeModel.get( 'modelEndpoints' ), modelRegex = new RegExp( '(?:.*[+)]|\/(' + modelEndpoints.join( '|' ) + '))$' ); /** * Iterate thru the routes, picking up models and collections to build. Builds two arrays, * one for models and one for collections. */ modelRoutes = []; collectionRoutes = []; schemaRoot = routeModel.get( 'apiRoot' ).replace( wp.api.utils.getRootUrl(), '' ); loadingObjects = {}; /** * Tracking objects for models and collections. */ loadingObjects.models = {}; loadingObjects.collections = {}; _.each( routeModel.schemaModel.get( 'routes' ), function( route, index ) { // Skip the schema root if included in the schema. if ( index !== routeModel.get( ' versionString' ) && index !== schemaRoot && index !== ( '/' + routeModel.get( 'versionString' ).slice( 0, -1 ) ) ) { // Single items end with a regex, or a special case word. if ( modelRegex.test( index ) ) { modelRoutes.push( { index: index, route: route } ); } else { // Collections end in a name. collectionRoutes.push( { index: index, route: route } ); } } } ); /** * Construct the models. * * Base the class name on the route endpoint. */ _.each( modelRoutes, function( modelRoute ) { // Extract the name and any parent from the route. var modelClassName, routeName = wp.api.utils.extractRoutePart( modelRoute.index, 2, routeModel.get( 'versionString' ), true ), parentName = wp.api.utils.extractRoutePart( modelRoute.index, 1, routeModel.get( 'versionString' ), false ), routeEnd = wp.api.utils.extractRoutePart( modelRoute.index, 1, routeModel.get( 'versionString' ), true ); // Clear the parent part of the rouite if its actually the version string. if ( parentName === routeModel.get( 'versionString' ) ) { parentName = ''; } // Handle the special case of the 'me' route. if ( 'me' === routeEnd ) { routeName = 'me'; } // If the model has a parent in its route, add that to its class name. if ( '' !== parentName && parentName !== routeName ) { modelClassName = wp.api.utils.capitalizeAndCamelCaseDashes( parentName ) + wp.api.utils.capitalizeAndCamelCaseDashes( routeName ); modelClassName = mapping.models[ modelClassName ] || modelClassName; loadingObjects.models[ modelClassName ] = wp.api.WPApiBaseModel.extend( { // Return a constructed url based on the parent and id. url: function() { var url = routeModel.get( 'apiRoot' ) + routeModel.get( 'versionString' ) + parentName + '/' + ( ( _.isUndefined( this.get( 'parent' ) ) || 0 === this.get( 'parent' ) ) ? ( _.isUndefined( this.get( 'parent_post' ) ) ? '' : this.get( 'parent_post' ) + '/' ) : this.get( 'parent' ) + '/' ) + routeName; if ( ! _.isUndefined( this.get( 'id' ) ) ) { url += '/' + this.get( 'id' ); } return url; }, // Track nonces on the Endpoint 'routeModel'. nonce: function() { return routeModel.get( 'nonce' ); }, endpointModel: routeModel, // Include a reference to the original route object. route: modelRoute, // Include a reference to the original class name. name: modelClassName, // Include the array of route methods for easy reference. methods: modelRoute.route.methods, // Include the array of route endpoints for easy reference. endpoints: modelRoute.route.endpoints } ); } else { // This is a model without a parent in its route. modelClassName = wp.api.utils.capitalizeAndCamelCaseDashes( routeName ); modelClassName = mapping.models[ modelClassName ] || modelClassName; loadingObjects.models[ modelClassName ] = wp.api.WPApiBaseModel.extend( { // Function that returns a constructed url based on the ID. url: function() { var url = routeModel.get( 'apiRoot' ) + routeModel.get( 'versionString' ) + ( ( 'me' === routeName ) ? 'users/me' : routeName ); if ( ! _.isUndefined( this.get( 'id' ) ) ) { url += '/' + this.get( 'id' ); } return url; }, // Track nonces at the Endpoint level. nonce: function() { return routeModel.get( 'nonce' ); }, endpointModel: routeModel, // Include a reference to the original route object. route: modelRoute, // Include a reference to the original class name. name: modelClassName, // Include the array of route methods for easy reference. methods: modelRoute.route.methods, // Include the array of route endpoints for easy reference. endpoints: modelRoute.route.endpoints } ); } // Add defaults to the new model, pulled form the endpoint. wp.api.utils.decorateFromRoute( modelRoute.route.endpoints, loadingObjects.models[ modelClassName ], routeModel.get( 'versionString' ) ); } ); /** * Construct the collections. * * Base the class name on the route endpoint. */ _.each( collectionRoutes, function( collectionRoute ) { // Extract the name and any parent from the route. var collectionClassName, modelClassName, routeName = collectionRoute.index.slice( collectionRoute.index.lastIndexOf( '/' ) + 1 ), parentName = wp.api.utils.extractRoutePart( collectionRoute.index, 1, routeModel.get( 'versionString' ), false ); // If the collection has a parent in its route, add that to its class name. if ( '' !== parentName && parentName !== routeName && routeModel.get( 'versionString' ) !== parentName ) { collectionClassName = wp.api.utils.capitalizeAndCamelCaseDashes( parentName ) + wp.api.utils.capitalizeAndCamelCaseDashes( routeName ); modelClassName = mapping.models[ collectionClassName ] || collectionClassName; collectionClassName = mapping.collections[ collectionClassName ] || collectionClassName; loadingObjects.collections[ collectionClassName ] = wp.api.WPApiBaseCollection.extend( { // Function that returns a constructed url passed on the parent. url: function() { return routeModel.get( 'apiRoot' ) + routeModel.get( 'versionString' ) + parentName + '/' + ( ( _.isUndefined( this.parent ) || '' === this.parent ) ? ( _.isUndefined( this.get( 'parent_post' ) ) ? '' : this.get( 'parent_post' ) + '/' ) : this.parent + '/' ) + routeName; }, // Specify the model that this collection contains. model: function( attrs, options ) { return new loadingObjects.models[ modelClassName ]( attrs, options ); }, // Track nonces at the Endpoint level. nonce: function() { return routeModel.get( 'nonce' ); }, endpointModel: routeModel, // Include a reference to the original class name. name: collectionClassName, // Include a reference to the original route object. route: collectionRoute, // Include the array of route methods for easy reference. methods: collectionRoute.route.methods } ); } else { // This is a collection without a parent in its route. collectionClassName = wp.api.utils.capitalizeAndCamelCaseDashes( routeName ); modelClassName = mapping.models[ collectionClassName ] || collectionClassName; collectionClassName = mapping.collections[ collectionClassName ] || collectionClassName; loadingObjects.collections[ collectionClassName ] = wp.api.WPApiBaseCollection.extend( { // For the url of a root level collection, use a string. url: function() { return routeModel.get( 'apiRoot' ) + routeModel.get( 'versionString' ) + routeName; }, // Specify the model that this collection contains. model: function( attrs, options ) { return new loadingObjects.models[ modelClassName ]( attrs, options ); }, // Track nonces at the Endpoint level. nonce: function() { return routeModel.get( 'nonce' ); }, endpointModel: routeModel, // Include a reference to the original class name. name: collectionClassName, // Include a reference to the original route object. route: collectionRoute, // Include the array of route methods for easy reference. methods: collectionRoute.route.methods } ); } // Add defaults to the new model, pulled form the endpoint. wp.api.utils.decorateFromRoute( collectionRoute.route.endpoints, loadingObjects.collections[ collectionClassName ] ); } ); // Add mixins and helpers for each of the models. _.each( loadingObjects.models, function( model, index ) { loadingObjects.models[ index ] = wp.api.utils.addMixinsAndHelpers( model, index, loadingObjects ); } ); // Set the routeModel models and collections. routeModel.set( 'models', loadingObjects.models ); routeModel.set( 'collections', loadingObjects.collections ); } } ); wp.api.endpoints = new Backbone.Collection(); /** * Initialize the wp-api, optionally passing the API root. * * @param {Object} [args] * @param {string} [args.nonce] The nonce. Optional, defaults to wpApiSettings.nonce. * @param {string} [args.apiRoot] The api root. Optional, defaults to wpApiSettings.root. * @param {string} [args.versionString] The version string. Optional, defaults to wpApiSettings.root. * @param {Object} [args.schema] The schema. Optional, will be fetched from API if not provided. */ wp.api.init = function( args ) { var endpoint, attributes = {}, deferred, promise; args = args || {}; attributes.nonce = _.isString( args.nonce ) ? args.nonce : ( wpApiSettings.nonce || '' ); attributes.apiRoot = args.apiRoot || wpApiSettings.root || '/wp-json'; attributes.versionString = args.versionString || wpApiSettings.versionString || 'wp/v2/'; attributes.schema = args.schema || null; attributes.modelEndpoints = args.modelEndpoints || [ 'me', 'settings' ]; if ( ! attributes.schema && attributes.apiRoot === wpApiSettings.root && attributes.versionString === wpApiSettings.versionString ) { attributes.schema = wpApiSettings.schema; } if ( ! initializedDeferreds[ attributes.apiRoot + attributes.versionString ] ) { // Look for an existing copy of this endpoint. endpoint = wp.api.endpoints.findWhere( { 'apiRoot': attributes.apiRoot, 'versionString': attributes.versionString } ); if ( ! endpoint ) { endpoint = new Endpoint( attributes ); } deferred = jQuery.Deferred(); promise = deferred.promise(); endpoint.schemaConstructed.done( function( resolvedEndpoint ) { wp.api.endpoints.add( resolvedEndpoint ); // Map the default endpoints, extending any already present items (including Schema model). wp.api.models = _.extend( wp.api.models, resolvedEndpoint.get( 'models' ) ); wp.api.collections = _.extend( wp.api.collections, resolvedEndpoint.get( 'collections' ) ); deferred.resolve( resolvedEndpoint ); } ); initializedDeferreds[ attributes.apiRoot + attributes.versionString ] = promise; } return initializedDeferreds[ attributes.apiRoot + attributes.versionString ]; }; /** * Construct the default endpoints and add to an endpoints collection. */ // The wp.api.init function returns a promise that will resolve with the endpoint once it is ready. wp.api.loadPromise = wp.api.init(); } )(); wp-sanitize.min.js 0000644 00000000712 15125140777 0010147 0 ustar 00 /*! This file is auto-generated */ window.wp=window.wp||{},wp.sanitize={stripTags:function(t){var e=(t=t||"").replace(/<!--[\s\S]*?(-->|$)/g,"").replace(/<(script|style)[^>]*>[\s\S]*?(<\/\1>|$)/gi,"").replace(/<\/?[a-z][\s\S]*?(>|$)/gi,"");return e!==t?wp.sanitize.stripTags(e):e},stripTagsAndEncodeText:function(t){var t=wp.sanitize.stripTags(t),e=document.createElement("textarea");try{e.textContent=t,t=wp.sanitize.stripTags(e.value)}catch(t){}return t}}; wp-backbone.js 0000644 00000035611 15125140777 0007311 0 ustar 00 /** * @output wp-includes/js/wp-backbone.js */ /** @namespace wp */ window.wp = window.wp || {}; (function ($) { /** * Create the WordPress Backbone namespace. * * @namespace wp.Backbone */ wp.Backbone = {}; /** * A backbone subview manager. * * @since 3.5.0 * @since 3.6.0 Moved wp.media.Views to wp.Backbone.Subviews. * * @memberOf wp.Backbone * * @class * * @param {wp.Backbone.View} view The main view. * @param {Array|Object} views The subviews for the main view. */ wp.Backbone.Subviews = function( view, views ) { this.view = view; this._views = _.isArray( views ) ? { '': views } : views || {}; }; wp.Backbone.Subviews.extend = Backbone.Model.extend; _.extend( wp.Backbone.Subviews.prototype, { /** * Fetches all of the subviews. * * @since 3.5.0 * * @return {Array} All the subviews. */ all: function() { return _.flatten( _.values( this._views ) ); }, /** * Fetches all subviews that match a given `selector`. * * If no `selector` is provided, it will grab all subviews attached * to the view's root. * * @since 3.5.0 * * @param {string} selector A jQuery selector. * * @return {Array} All the subviews that match the selector. */ get: function( selector ) { selector = selector || ''; return this._views[ selector ]; }, /** * Fetches the first subview that matches a given `selector`. * * If no `selector` is provided, it will grab the first subview attached to the * view's root. * * Useful when a selector only has one subview at a time. * * @since 3.5.0 * * @param {string} selector A jQuery selector. * * @return {Backbone.View} The view. */ first: function( selector ) { var views = this.get( selector ); return views && views.length ? views[0] : null; }, /** * Registers subview(s). * * Registers any number of `views` to a `selector`. * * When no `selector` is provided, the root selector (the empty string) * is used. `views` accepts a `Backbone.View` instance or an array of * `Backbone.View` instances. * * --- * * Accepts an `options` object, which has a significant effect on the * resulting behavior. * * `options.silent` - *boolean, `false`* * If `options.silent` is true, no DOM modifications will be made. * * `options.add` - *boolean, `false`* * Use `Views.add()` as a shortcut for setting `options.add` to true. * * By default, the provided `views` will replace any existing views * associated with the selector. If `options.add` is true, the provided * `views` will be added to the existing views. * * `options.at` - *integer, `undefined`* * When adding, to insert `views` at a specific index, use `options.at`. * By default, `views` are added to the end of the array. * * @since 3.5.0 * * @param {string} selector A jQuery selector. * @param {Array|Object} views The subviews for the main view. * @param {Object} options Options for call. If `options.silent` is true, * no DOM modifications will be made. Use * `Views.add()` as a shortcut for setting * `options.add` to true. If `options.add` is * true, the provided `views` will be added to * the existing views. When adding, to insert * `views` at a specific index, use `options.at`. * * @return {wp.Backbone.Subviews} The current Subviews instance. */ set: function( selector, views, options ) { var existing, next; if ( ! _.isString( selector ) ) { options = views; views = selector; selector = ''; } options = options || {}; views = _.isArray( views ) ? views : [ views ]; existing = this.get( selector ); next = views; if ( existing ) { if ( options.add ) { if ( _.isUndefined( options.at ) ) { next = existing.concat( views ); } else { next = existing; next.splice.apply( next, [ options.at, 0 ].concat( views ) ); } } else { _.each( next, function( view ) { view.__detach = true; }); _.each( existing, function( view ) { if ( view.__detach ) view.$el.detach(); else view.remove(); }); _.each( next, function( view ) { delete view.__detach; }); } } this._views[ selector ] = next; _.each( views, function( subview ) { var constructor = subview.Views || wp.Backbone.Subviews, subviews = subview.views = subview.views || new constructor( subview ); subviews.parent = this.view; subviews.selector = selector; }, this ); if ( ! options.silent ) this._attach( selector, views, _.extend({ ready: this._isReady() }, options ) ); return this; }, /** * Add subview(s) to existing subviews. * * An alias to `Views.set()`, which defaults `options.add` to true. * * Adds any number of `views` to a `selector`. * * When no `selector` is provided, the root selector (the empty string) * is used. `views` accepts a `Backbone.View` instance or an array of * `Backbone.View` instances. * * Uses `Views.set()` when setting `options.add` to `false`. * * Accepts an `options` object. By default, provided `views` will be * inserted at the end of the array of existing views. To insert * `views` at a specific index, use `options.at`. If `options.silent` * is true, no DOM modifications will be made. * * For more information on the `options` object, see `Views.set()`. * * @since 3.5.0 * * @param {string} selector A jQuery selector. * @param {Array|Object} views The subviews for the main view. * @param {Object} options Options for call. To insert `views` at a * specific index, use `options.at`. If * `options.silent` is true, no DOM modifications * will be made. * * @return {wp.Backbone.Subviews} The current subviews instance. */ add: function( selector, views, options ) { if ( ! _.isString( selector ) ) { options = views; views = selector; selector = ''; } return this.set( selector, views, _.extend({ add: true }, options ) ); }, /** * Removes an added subview. * * Stops tracking `views` registered to a `selector`. If no `views` are * set, then all of the `selector`'s subviews will be unregistered and * removed. * * Accepts an `options` object. If `options.silent` is set, `remove` * will *not* be triggered on the unregistered views. * * @since 3.5.0 * * @param {string} selector A jQuery selector. * @param {Array|Object} views The subviews for the main view. * @param {Object} options Options for call. If `options.silent` is set, * `remove` will *not* be triggered on the * unregistered views. * * @return {wp.Backbone.Subviews} The current Subviews instance. */ unset: function( selector, views, options ) { var existing; if ( ! _.isString( selector ) ) { options = views; views = selector; selector = ''; } views = views || []; if ( existing = this.get( selector ) ) { views = _.isArray( views ) ? views : [ views ]; this._views[ selector ] = views.length ? _.difference( existing, views ) : []; } if ( ! options || ! options.silent ) _.invoke( views, 'remove' ); return this; }, /** * Detaches all subviews. * * Helps to preserve all subview events when re-rendering the master * view. Used in conjunction with `Views.render()`. * * @since 3.5.0 * * @return {wp.Backbone.Subviews} The current Subviews instance. */ detach: function() { $( _.pluck( this.all(), 'el' ) ).detach(); return this; }, /** * Renders all subviews. * * Used in conjunction with `Views.detach()`. * * @since 3.5.0 * * @return {wp.Backbone.Subviews} The current Subviews instance. */ render: function() { var options = { ready: this._isReady() }; _.each( this._views, function( views, selector ) { this._attach( selector, views, options ); }, this ); this.rendered = true; return this; }, /** * Removes all subviews. * * Triggers the `remove()` method on all subviews. Detaches the master * view from its parent. Resets the internals of the views manager. * * Accepts an `options` object. If `options.silent` is set, `unset` * will *not* be triggered on the master view's parent. * * @since 3.6.0 * * @param {Object} options Options for call. * @param {boolean} options.silent If true, `unset` will *not* be triggered on * the master views' parent. * * @return {wp.Backbone.Subviews} The current Subviews instance. */ remove: function( options ) { if ( ! options || ! options.silent ) { if ( this.parent && this.parent.views ) this.parent.views.unset( this.selector, this.view, { silent: true }); delete this.parent; delete this.selector; } _.invoke( this.all(), 'remove' ); this._views = []; return this; }, /** * Replaces a selector's subviews * * By default, sets the `$target` selector's html to the subview `els`. * * Can be overridden in subclasses. * * @since 3.5.0 * * @param {string} $target Selector where to put the elements. * @param {*} els HTML or elements to put into the selector's HTML. * * @return {wp.Backbone.Subviews} The current Subviews instance. */ replace: function( $target, els ) { $target.html( els ); return this; }, /** * Insert subviews into a selector. * * By default, appends the subview `els` to the end of the `$target` * selector. If `options.at` is set, inserts the subview `els` at the * provided index. * * Can be overridden in subclasses. * * @since 3.5.0 * * @param {string} $target Selector where to put the elements. * @param {*} els HTML or elements to put at the end of the * $target. * @param {?Object} options Options for call. * @param {?number} options.at At which index to put the elements. * * @return {wp.Backbone.Subviews} The current Subviews instance. */ insert: function( $target, els, options ) { var at = options && options.at, $children; if ( _.isNumber( at ) && ($children = $target.children()).length > at ) $children.eq( at ).before( els ); else $target.append( els ); return this; }, /** * Triggers the ready event. * * Only use this method if you know what you're doing. For performance reasons, * this method does not check if the view is actually attached to the DOM. It's * taking your word for it. * * Fires the ready event on the current view and all attached subviews. * * @since 3.5.0 */ ready: function() { this.view.trigger('ready'); // Find all attached subviews, and call ready on them. _.chain( this.all() ).map( function( view ) { return view.views; }).flatten().where({ attached: true }).invoke('ready'); }, /** * Attaches a series of views to a selector. Internal. * * Checks to see if a matching selector exists, renders the views, * performs the proper DOM operation, and then checks if the view is * attached to the document. * * @since 3.5.0 * * @private * * @param {string} selector A jQuery selector. * @param {Array|Object} views The subviews for the main view. * @param {Object} options Options for call. * @param {boolean} options.add If true the provided views will be added. * * @return {wp.Backbone.Subviews} The current Subviews instance. */ _attach: function( selector, views, options ) { var $selector = selector ? this.view.$( selector ) : this.view.$el, managers; // Check if we found a location to attach the views. if ( ! $selector.length ) return this; managers = _.chain( views ).pluck('views').flatten().value(); // Render the views if necessary. _.each( managers, function( manager ) { if ( manager.rendered ) return; manager.view.render(); manager.rendered = true; }, this ); // Insert or replace the views. this[ options.add ? 'insert' : 'replace' ]( $selector, _.pluck( views, 'el' ), options ); /* * Set attached and trigger ready if the current view is already * attached to the DOM. */ _.each( managers, function( manager ) { manager.attached = true; if ( options.ready ) manager.ready(); }, this ); return this; }, /** * Determines whether or not the current view is in the DOM. * * @since 3.5.0 * * @private * * @return {boolean} Whether or not the current view is in the DOM. */ _isReady: function() { var node = this.view.el; while ( node ) { if ( node === document.body ) return true; node = node.parentNode; } return false; } }); wp.Backbone.View = Backbone.View.extend({ // The constructor for the `Views` manager. Subviews: wp.Backbone.Subviews, /** * The base view class. * * This extends the backbone view to have a build-in way to use subviews. This * makes it easier to have nested views. * * @since 3.5.0 * @since 3.6.0 Moved wp.media.View to wp.Backbone.View * * @constructs * @augments Backbone.View * * @memberOf wp.Backbone * * * @param {Object} options The options for this view. */ constructor: function( options ) { this.views = new this.Subviews( this, this.views ); this.on( 'ready', this.ready, this ); this.options = options || {}; Backbone.View.apply( this, arguments ); }, /** * Removes this view and all subviews. * * @since 3.5.0 * * @return {wp.Backbone.Subviews} The current Subviews instance. */ remove: function() { var result = Backbone.View.prototype.remove.apply( this, arguments ); // Recursively remove child views. if ( this.views ) this.views.remove(); return result; }, /** * Renders this view and all subviews. * * @since 3.5.0 * * @return {wp.Backbone.View} The current instance of the view. */ render: function() { var options; if ( this.prepare ) options = this.prepare(); this.views.detach(); if ( this.template ) { options = options || {}; this.trigger( 'prepare', options ); this.$el.html( this.template( options ) ); } this.views.render(); return this; }, /** * Returns the options for this view. * * @since 3.5.0 * * @return {Object} The options for this view. */ prepare: function() { return this.options; }, /** * Method that is called when the ready event is triggered. * * @since 3.5.0 */ ready: function() {} }); }(jQuery)); dist/notices.js 0000644 00000052745 15125140777 0007537 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { store: () => (/* reexport */ store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { createErrorNotice: () => (createErrorNotice), createInfoNotice: () => (createInfoNotice), createNotice: () => (createNotice), createSuccessNotice: () => (createSuccessNotice), createWarningNotice: () => (createWarningNotice), removeAllNotices: () => (removeAllNotices), removeNotice: () => (removeNotice), removeNotices: () => (removeNotices) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { getNotices: () => (getNotices) }); ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// ./node_modules/@wordpress/notices/build-module/store/utils/on-sub-key.js /** * Higher-order reducer creator which creates a combined reducer object, keyed * by a property on the action object. * * @param {string} actionProperty Action property by which to key object. * * @return {Function} Higher-order reducer. */ const onSubKey = actionProperty => reducer => (state = {}, action) => { // Retrieve subkey from action. Do not track if undefined; useful for cases // where reducer is scoped by action shape. const key = action[actionProperty]; if (key === undefined) { return state; } // Avoid updating state if unchanged. Note that this also accounts for a // reducer which returns undefined on a key which is not yet tracked. const nextKeyState = reducer(state[key], action); if (nextKeyState === state[key]) { return state; } return { ...state, [key]: nextKeyState }; }; /* harmony default export */ const on_sub_key = (onSubKey); ;// ./node_modules/@wordpress/notices/build-module/store/reducer.js /** * Internal dependencies */ /** * Reducer returning the next notices state. The notices state is an object * where each key is a context, its value an array of notice objects. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const notices = on_sub_key('context')((state = [], action) => { switch (action.type) { case 'CREATE_NOTICE': // Avoid duplicates on ID. return [...state.filter(({ id }) => id !== action.notice.id), action.notice]; case 'REMOVE_NOTICE': return state.filter(({ id }) => id !== action.id); case 'REMOVE_NOTICES': return state.filter(({ id }) => !action.ids.includes(id)); case 'REMOVE_ALL_NOTICES': return state.filter(({ type }) => type !== action.noticeType); } return state; }); /* harmony default export */ const reducer = (notices); ;// ./node_modules/@wordpress/notices/build-module/store/constants.js /** * Default context to use for notice grouping when not otherwise specified. Its * specific value doesn't hold much meaning, but it must be reasonably unique * and, more importantly, referenced consistently in the store implementation. * * @type {string} */ const DEFAULT_CONTEXT = 'global'; /** * Default notice status. * * @type {string} */ const DEFAULT_STATUS = 'info'; ;// ./node_modules/@wordpress/notices/build-module/store/actions.js /** * Internal dependencies */ /** * @typedef {Object} WPNoticeAction Object describing a user action option associated with a notice. * * @property {string} label Message to use as action label. * @property {?string} url Optional URL of resource if action incurs * browser navigation. * @property {?Function} onClick Optional function to invoke when action is * triggered by user. */ let uniqueId = 0; /** * Returns an action object used in signalling that a notice is to be created. * * @param {string|undefined} status Notice status ("info" if undefined is passed). * @param {string} content Notice message. * @param {Object} [options] Notice options. * @param {string} [options.context='global'] Context under which to * group notice. * @param {string} [options.id] Identifier for notice. * Automatically assigned * if not specified. * @param {boolean} [options.isDismissible=true] Whether the notice can * be dismissed by user. * @param {string} [options.type='default'] Type of notice, one of * `default`, or `snackbar`. * @param {boolean} [options.speak=true] Whether the notice * content should be * announced to screen * readers. * @param {Array<WPNoticeAction>} [options.actions] User actions to be * presented with notice. * @param {string} [options.icon] An icon displayed with the notice. * Only used when type is set to `snackbar`. * @param {boolean} [options.explicitDismiss] Whether the notice includes * an explicit dismiss button and * can't be dismissed by clicking * the body of the notice. Only applies * when type is set to `snackbar`. * @param {Function} [options.onDismiss] Called when the notice is dismissed. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { useDispatch } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * const { createNotice } = useDispatch( noticesStore ); * return ( * <Button * onClick={ () => createNotice( 'success', __( 'Notice message' ) ) } * > * { __( 'Generate a success notice!' ) } * </Button> * ); * }; * ``` * * @return {Object} Action object. */ function createNotice(status = DEFAULT_STATUS, content, options = {}) { const { speak = true, isDismissible = true, context = DEFAULT_CONTEXT, id = `${context}${++uniqueId}`, actions = [], type = 'default', __unstableHTML, icon = null, explicitDismiss = false, onDismiss } = options; // The supported value shape of content is currently limited to plain text // strings. To avoid setting expectation that e.g. a React Element could be // supported, cast to a string. content = String(content); return { type: 'CREATE_NOTICE', context, notice: { id, status, content, spokenMessage: speak ? content : null, __unstableHTML, isDismissible, actions, type, icon, explicitDismiss, onDismiss } }; } /** * Returns an action object used in signalling that a success notice is to be * created. Refer to `createNotice` for options documentation. * * @see createNotice * * @param {string} content Notice message. * @param {Object} [options] Optional notice options. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { useDispatch } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * const { createSuccessNotice } = useDispatch( noticesStore ); * return ( * <Button * onClick={ () => * createSuccessNotice( __( 'Success!' ), { * type: 'snackbar', * icon: '🔥', * } ) * } * > * { __( 'Generate a snackbar success notice!' ) } * </Button> * ); * }; * ``` * * @return {Object} Action object. */ function createSuccessNotice(content, options) { return createNotice('success', content, options); } /** * Returns an action object used in signalling that an info notice is to be * created. Refer to `createNotice` for options documentation. * * @see createNotice * * @param {string} content Notice message. * @param {Object} [options] Optional notice options. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { useDispatch } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * const { createInfoNotice } = useDispatch( noticesStore ); * return ( * <Button * onClick={ () => * createInfoNotice( __( 'Something happened!' ), { * isDismissible: false, * } ) * } * > * { __( 'Generate a notice that cannot be dismissed.' ) } * </Button> * ); * }; *``` * * @return {Object} Action object. */ function createInfoNotice(content, options) { return createNotice('info', content, options); } /** * Returns an action object used in signalling that an error notice is to be * created. Refer to `createNotice` for options documentation. * * @see createNotice * * @param {string} content Notice message. * @param {Object} [options] Optional notice options. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { useDispatch } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * const { createErrorNotice } = useDispatch( noticesStore ); * return ( * <Button * onClick={ () => * createErrorNotice( __( 'An error occurred!' ), { * type: 'snackbar', * explicitDismiss: true, * } ) * } * > * { __( * 'Generate an snackbar error notice with explicit dismiss button.' * ) } * </Button> * ); * }; * ``` * * @return {Object} Action object. */ function createErrorNotice(content, options) { return createNotice('error', content, options); } /** * Returns an action object used in signalling that a warning notice is to be * created. Refer to `createNotice` for options documentation. * * @see createNotice * * @param {string} content Notice message. * @param {Object} [options] Optional notice options. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { useDispatch } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * const { createWarningNotice, createInfoNotice } = useDispatch( noticesStore ); * return ( * <Button * onClick={ () => * createWarningNotice( __( 'Warning!' ), { * onDismiss: () => { * createInfoNotice( * __( 'The warning has been dismissed!' ) * ); * }, * } ) * } * > * { __( 'Generates a warning notice with onDismiss callback' ) } * </Button> * ); * }; * ``` * * @return {Object} Action object. */ function createWarningNotice(content, options) { return createNotice('warning', content, options); } /** * Returns an action object used in signalling that a notice is to be removed. * * @param {string} id Notice unique identifier. * @param {string} [context='global'] Optional context (grouping) in which the notice is * intended to appear. Defaults to default context. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { useDispatch } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * const notices = useSelect( ( select ) => select( noticesStore ).getNotices() ); * const { createWarningNotice, removeNotice } = useDispatch( noticesStore ); * * return ( * <> * <Button * onClick={ () => * createWarningNotice( __( 'Warning!' ), { * isDismissible: false, * } ) * } * > * { __( 'Generate a notice' ) } * </Button> * { notices.length > 0 && ( * <Button onClick={ () => removeNotice( notices[ 0 ].id ) }> * { __( 'Remove the notice' ) } * </Button> * ) } * </> * ); *}; * ``` * * @return {Object} Action object. */ function removeNotice(id, context = DEFAULT_CONTEXT) { return { type: 'REMOVE_NOTICE', id, context }; } /** * Removes all notices from a given context. Defaults to the default context. * * @param {string} noticeType The context to remove all notices from. * @param {string} context The context to remove all notices from. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { useDispatch, useSelect } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; * import { Button } from '@wordpress/components'; * * export const ExampleComponent = () => { * const notices = useSelect( ( select ) => * select( noticesStore ).getNotices() * ); * const { removeAllNotices } = useDispatch( noticesStore ); * return ( * <> * <ul> * { notices.map( ( notice ) => ( * <li key={ notice.id }>{ notice.content }</li> * ) ) } * </ul> * <Button * onClick={ () => * removeAllNotices() * } * > * { __( 'Clear all notices', 'woo-gutenberg-products-block' ) } * </Button> * <Button * onClick={ () => * removeAllNotices( 'snackbar' ) * } * > * { __( 'Clear all snackbar notices', 'woo-gutenberg-products-block' ) } * </Button> * </> * ); * }; * ``` * * @return {Object} Action object. */ function removeAllNotices(noticeType = 'default', context = DEFAULT_CONTEXT) { return { type: 'REMOVE_ALL_NOTICES', noticeType, context }; } /** * Returns an action object used in signalling that several notices are to be removed. * * @param {string[]} ids List of unique notice identifiers. * @param {string} [context='global'] Optional context (grouping) in which the notices are * intended to appear. Defaults to default context. * @example * ```js * import { __ } from '@wordpress/i18n'; * import { useDispatch, useSelect } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * const notices = useSelect( ( select ) => * select( noticesStore ).getNotices() * ); * const { removeNotices } = useDispatch( noticesStore ); * return ( * <> * <ul> * { notices.map( ( notice ) => ( * <li key={ notice.id }>{ notice.content }</li> * ) ) } * </ul> * <Button * onClick={ () => * removeNotices( notices.map( ( { id } ) => id ) ) * } * > * { __( 'Clear all notices' ) } * </Button> * </> * ); * }; * ``` * @return {Object} Action object. */ function removeNotices(ids, context = DEFAULT_CONTEXT) { return { type: 'REMOVE_NOTICES', ids, context }; } ;// ./node_modules/@wordpress/notices/build-module/store/selectors.js /** * Internal dependencies */ /** @typedef {import('./actions').WPNoticeAction} WPNoticeAction */ /** * The default empty set of notices to return when there are no notices * assigned for a given notices context. This can occur if the getNotices * selector is called without a notice ever having been created for the * context. A shared value is used to ensure referential equality between * sequential selector calls, since otherwise `[] !== []`. * * @type {Array} */ const DEFAULT_NOTICES = []; /** * @typedef {Object} WPNotice Notice object. * * @property {string} id Unique identifier of notice. * @property {string} status Status of notice, one of `success`, * `info`, `error`, or `warning`. Defaults * to `info`. * @property {string} content Notice message. * @property {string} spokenMessage Audibly announced message text used by * assistive technologies. * @property {string} __unstableHTML Notice message as raw HTML. Intended to * serve primarily for compatibility of * server-rendered notices, and SHOULD NOT * be used for notices. It is subject to * removal without notice. * @property {boolean} isDismissible Whether the notice can be dismissed by * user. Defaults to `true`. * @property {string} type Type of notice, one of `default`, * or `snackbar`. Defaults to `default`. * @property {boolean} speak Whether the notice content should be * announced to screen readers. Defaults to * `true`. * @property {WPNoticeAction[]} actions User actions to present with notice. */ /** * Returns all notices as an array, optionally for a given context. Defaults to * the global context. * * @param {Object} state Notices state. * @param {?string} context Optional grouping context. * * @example * *```js * import { useSelect } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; * * const ExampleComponent = () => { * const notices = useSelect( ( select ) => select( noticesStore ).getNotices() ); * return ( * <ul> * { notices.map( ( notice ) => ( * <li key={ notice.ID }>{ notice.content }</li> * ) ) } * </ul> * ) * }; *``` * * @return {WPNotice[]} Array of notices. */ function getNotices(state, context = DEFAULT_CONTEXT) { return state[context] || DEFAULT_NOTICES; } ;// ./node_modules/@wordpress/notices/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Store definition for the notices namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore */ const store = (0,external_wp_data_namespaceObject.createReduxStore)('core/notices', { reducer: reducer, actions: actions_namespaceObject, selectors: selectors_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/notices/build-module/index.js (window.wp = window.wp || {}).notices = __webpack_exports__; /******/ })() ; dist/deprecated.js 0000644 00000011126 15125140777 0010157 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": () => (/* binding */ deprecated) }); // UNUSED EXPORTS: logged ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// ./node_modules/@wordpress/deprecated/build-module/index.js /** * WordPress dependencies */ /** * Object map tracking messages which have been logged, for use in ensuring a * message is only logged once. * * @type {Record<string, true | undefined>} */ const logged = Object.create(null); /** * Logs a message to notify developers about a deprecated feature. * * @param {string} feature Name of the deprecated feature. * @param {Object} [options] Personalisation options * @param {string} [options.since] Version in which the feature was deprecated. * @param {string} [options.version] Version in which the feature will be removed. * @param {string} [options.alternative] Feature to use instead * @param {string} [options.plugin] Plugin name if it's a plugin feature * @param {string} [options.link] Link to documentation * @param {string} [options.hint] Additional message to help transition away from the deprecated feature. * * @example * ```js * import deprecated from '@wordpress/deprecated'; * * deprecated( 'Eating meat', { * since: '2019.01.01' * version: '2020.01.01', * alternative: 'vegetables', * plugin: 'the earth', * hint: 'You may find it beneficial to transition gradually.', * } ); * * // Logs: 'Eating meat is deprecated since version 2019.01.01 and will be removed from the earth in version 2020.01.01. Please use vegetables instead. Note: You may find it beneficial to transition gradually.' * ``` */ function deprecated(feature, options = {}) { const { since, version, alternative, plugin, link, hint } = options; const pluginMessage = plugin ? ` from ${plugin}` : ''; const sinceMessage = since ? ` since version ${since}` : ''; const versionMessage = version ? ` and will be removed${pluginMessage} in version ${version}` : ''; const useInsteadMessage = alternative ? ` Please use ${alternative} instead.` : ''; const linkMessage = link ? ` See: ${link}` : ''; const hintMessage = hint ? ` Note: ${hint}` : ''; const message = `${feature} is deprecated${sinceMessage}${versionMessage}.${useInsteadMessage}${linkMessage}${hintMessage}`; // Skip if already logged. if (message in logged) { return; } /** * Fires whenever a deprecated feature is encountered * * @param {string} feature Name of the deprecated feature. * @param {?Object} options Personalisation options * @param {string} options.since Version in which the feature was deprecated. * @param {?string} options.version Version in which the feature will be removed. * @param {?string} options.alternative Feature to use instead * @param {?string} options.plugin Plugin name if it's a plugin feature * @param {?string} options.link Link to documentation * @param {?string} options.hint Additional message to help transition away from the deprecated feature. * @param {?string} message Message sent to console.warn */ (0,external_wp_hooks_namespaceObject.doAction)('deprecated', feature, options, message); // eslint-disable-next-line no-console console.warn(message); logged[message] = true; } /** @typedef {import('utility-types').NonUndefined<Parameters<typeof deprecated>[1]>} DeprecatedOptions */ (window.wp = window.wp || {}).deprecated = __webpack_exports__["default"]; /******/ })() ; dist/element.min.js 0000644 00000027300 15125140777 0010273 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={4140:(e,t,n)=>{var r=n(5795);t.H=r.createRoot,t.c=r.hydrateRoot},5795:e=>{e.exports=window.ReactDOM}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};n.r(r),n.d(r,{Children:()=>o.Children,Component:()=>o.Component,Fragment:()=>o.Fragment,Platform:()=>w,PureComponent:()=>o.PureComponent,RawHTML:()=>I,StrictMode:()=>o.StrictMode,Suspense:()=>o.Suspense,cloneElement:()=>o.cloneElement,concatChildren:()=>g,createContext:()=>o.createContext,createElement:()=>o.createElement,createInterpolateElement:()=>m,createPortal:()=>v.createPortal,createRef:()=>o.createRef,createRoot:()=>b.H,findDOMNode:()=>v.findDOMNode,flushSync:()=>v.flushSync,forwardRef:()=>o.forwardRef,hydrate:()=>v.hydrate,hydrateRoot:()=>b.c,isEmptyElement:()=>k,isValidElement:()=>o.isValidElement,lazy:()=>o.lazy,memo:()=>o.memo,render:()=>v.render,renderToString:()=>K,startTransition:()=>o.startTransition,switchChildrenNodeName:()=>y,unmountComponentAtNode:()=>v.unmountComponentAtNode,useCallback:()=>o.useCallback,useContext:()=>o.useContext,useDebugValue:()=>o.useDebugValue,useDeferredValue:()=>o.useDeferredValue,useEffect:()=>o.useEffect,useId:()=>o.useId,useImperativeHandle:()=>o.useImperativeHandle,useInsertionEffect:()=>o.useInsertionEffect,useLayoutEffect:()=>o.useLayoutEffect,useMemo:()=>o.useMemo,useReducer:()=>o.useReducer,useRef:()=>o.useRef,useState:()=>o.useState,useSyncExternalStore:()=>o.useSyncExternalStore,useTransition:()=>o.useTransition});const o=window.React;let i,a,s,l;const c=/<(\/)?(\w+)\s*(\/)?>/g;function u(e,t,n,r,o){return{element:e,tokenStart:t,tokenLength:n,prevOffset:r,leadingTextStart:o,children:[]}}const d=e=>{const t="object"==typeof e,n=t&&Object.values(e);return t&&n.length&&n.every((e=>(0,o.isValidElement)(e)))};function p(e){const t=function(){const e=c.exec(i);if(null===e)return["no-more-tokens"];const t=e.index,[n,r,o,a]=e,s=n.length;if(a)return["self-closed",o,t,s];if(r)return["closer",o,t,s];return["opener",o,t,s]}(),[n,r,d,p]=t,m=l.length,g=d>a?a:null;if(!e[r])return f(),!1;switch(n){case"no-more-tokens":if(0!==m){const{leadingTextStart:e,tokenStart:t}=l.pop();s.push(i.substr(e,t))}return f(),!1;case"self-closed":return 0===m?(null!==g&&s.push(i.substr(g,d-g)),s.push(e[r]),a=d+p,!0):(h(u(e[r],d,p)),a=d+p,!0);case"opener":return l.push(u(e[r],d,p,d+p,g)),a=d+p,!0;case"closer":if(1===m)return function(e){const{element:t,leadingTextStart:n,prevOffset:r,tokenStart:a,children:c}=l.pop(),u=e?i.substr(r,e-r):i.substr(r);u&&c.push(u);null!==n&&s.push(i.substr(n,a-n));s.push((0,o.cloneElement)(t,null,...c))}(d),a=d+p,!0;const t=l.pop(),n=i.substr(t.prevOffset,d-t.prevOffset);t.children.push(n),t.prevOffset=d+p;const c=u(t.element,t.tokenStart,t.tokenLength,d+p);return c.children=t.children,h(c),a=d+p,!0;default:return f(),!1}}function f(){const e=i.length-a;0!==e&&s.push(i.substr(a,e))}function h(e){const{element:t,tokenStart:n,tokenLength:r,prevOffset:a,children:s}=e,c=l[l.length-1],u=i.substr(c.prevOffset,n-c.prevOffset);u&&c.children.push(u),c.children.push((0,o.cloneElement)(t,null,...s)),c.prevOffset=a||n+r}const m=(e,t)=>{if(i=e,a=0,s=[],l=[],c.lastIndex=0,!d(t))throw new TypeError("The conversionMap provided is not valid. It must be an object with values that are React Elements");do{}while(p(t));return(0,o.createElement)(o.Fragment,null,...s)};function g(...e){return e.reduce(((e,t,n)=>(o.Children.forEach(t,((t,r)=>{t&&"string"!=typeof t&&(t=(0,o.cloneElement)(t,{key:[n,r].join()})),e.push(t)})),e)),[])}function y(e,t){return e&&o.Children.map(e,((e,n)=>{if("string"==typeof e?.valueOf())return(0,o.createElement)(t,{key:n},e);const{children:r,...i}=e.props;return(0,o.createElement)(t,{key:n,...i},r)}))}var v=n(5795),b=n(4140);const k=e=>"number"!=typeof e&&("string"==typeof e?.valueOf()||Array.isArray(e)?!e.length:!e),w={OS:"web",select:e=>"web"in e?e.web:e.default,isWeb:!0}; /*! * is-plain-object <https://github.com/jonschlinkert/is-plain-object> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function S(e){return"[object Object]"===Object.prototype.toString.call(e)}var x=function(){return x=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},x.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function O(e){return e.toLowerCase()}var C=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],E=/[^A-Z0-9]+/gi;function R(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function T(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,r=void 0===n?C:n,o=t.stripRegexp,i=void 0===o?E:o,a=t.transform,s=void 0===a?O:a,l=t.delimiter,c=void 0===l?" ":l,u=R(R(e,r,"$1\0$2"),i,"\0"),d=0,p=u.length;"\0"===u.charAt(d);)d++;for(;"\0"===u.charAt(p-1);)p--;return u.slice(d,p).split("\0").map(s).join(c)}(e,x({delimiter:"."},t))}function A(e,t){return void 0===t&&(t={}),T(e,x({delimiter:"-"},t))}const M=window.wp.escapeHtml;function I({children:e,...t}){let n="";return o.Children.toArray(e).forEach((e=>{"string"==typeof e&&""!==e.trim()&&(n+=e)})),(0,o.createElement)("div",{dangerouslySetInnerHTML:{__html:n},...t})}const{Provider:L,Consumer:P}=(0,o.createContext)(void 0),j=(0,o.forwardRef)((()=>null)),H=new Set(["string","boolean","number"]),z=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),D=new Set(["allowfullscreen","allowpaymentrequest","allowusermedia","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","typemustmatch"]),V=new Set(["autocapitalize","autocomplete","charset","contenteditable","crossorigin","decoding","dir","draggable","enctype","formenctype","formmethod","http-equiv","inputmode","kind","method","preload","scope","shape","spellcheck","translate","type","wrap"]),W=new Set(["animation","animationIterationCount","baselineShift","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","cx","cy","fillOpacity","flexGrow","flexShrink","floodOpacity","fontWeight","gridColumnEnd","gridColumnStart","gridRowEnd","gridRowStart","lineHeight","opacity","order","orphans","r","rx","ry","shapeImageThreshold","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","x","y","zIndex","zoom"]);function _(e,t){return t.some((t=>0===e.indexOf(t)))}function F(e){return"key"===e||"children"===e}function N(e,t){return"style"===e?function(e){if(t=e,!1===S(t)||void 0!==(n=t.constructor)&&(!1===S(r=n.prototype)||!1===r.hasOwnProperty("isPrototypeOf")))return e;var t,n,r;let o;for(const t in e){const n=e[t];if(null==n)continue;o?o+=";":o="";o+=B(t)+":"+Y(t,n)}return o}(t):t}const U=["accentHeight","alignmentBaseline","arabicForm","baselineShift","capHeight","clipPath","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","dominantBaseline","enableBackground","fillOpacity","fillRule","floodColor","floodOpacity","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","horizAdvX","horizOriginX","imageRendering","letterSpacing","lightingColor","markerEnd","markerMid","markerStart","overlinePosition","overlineThickness","paintOrder","panose1","pointerEvents","renderingIntent","shapeRendering","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","textAnchor","textDecoration","textRendering","underlinePosition","underlineThickness","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","vHanging","vIdeographic","vMathematical","vectorEffect","vertAdvY","vertOriginX","vertOriginY","wordSpacing","writingMode","xmlnsXlink","xHeight"].reduce(((e,t)=>(e[t.toLowerCase()]=t,e)),{}),$=["allowReorder","attributeName","attributeType","autoReverse","baseFrequency","baseProfile","calcMode","clipPathUnits","contentScriptType","contentStyleType","diffuseConstant","edgeMode","externalResourcesRequired","filterRes","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","suppressContentEditableWarning","suppressHydrationWarning","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector"].reduce(((e,t)=>(e[t.toLowerCase()]=t,e)),{}),q=["xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:lang","xml:space","xmlns:xlink"].reduce(((e,t)=>(e[t.replace(":","").toLowerCase()]=t,e)),{});function X(e){switch(e){case"htmlFor":return"for";case"className":return"class"}const t=e.toLowerCase();return $[t]?$[t]:U[t]?A(U[t]):q[t]?q[t]:t}function B(e){return e.startsWith("--")?e:_(e,["ms","O","Moz","Webkit"])?"-"+A(e):A(e)}function Y(e,t){return"number"!=typeof t||0===t||W.has(e)?t:t+"px"}function Z(e,t,n={}){if(null==e||!1===e)return"";if(Array.isArray(e))return J(e,t,n);switch(typeof e){case"string":return(0,M.escapeHTML)(e);case"number":return e.toString()}const{type:r,props:i}=e;switch(r){case o.StrictMode:case o.Fragment:return J(i.children,t,n);case I:const{children:e,...r}=i;return G(Object.keys(r).length?"div":null,{...r,dangerouslySetInnerHTML:{__html:e}},t,n)}switch(typeof r){case"string":return G(r,i,t,n);case"function":return r.prototype&&"function"==typeof r.prototype.render?function(e,t,n,r={}){const o=new e(t,r);"function"==typeof o.getChildContext&&Object.assign(r,o.getChildContext());const i=Z(o.render(),n,r);return i}(r,i,t,n):Z(r(i,n),t,n)}switch(r&&r.$$typeof){case L.$$typeof:return J(i.children,i.value,n);case P.$$typeof:return Z(i.children(t||r._currentValue),t,n);case j.$$typeof:return Z(r.render(i),t,n)}return""}function G(e,t,n,r={}){let o="";if("textarea"===e&&t.hasOwnProperty("value")){o=J(t.value,n,r);const{value:e,...i}=t;t=i}else t.dangerouslySetInnerHTML&&"string"==typeof t.dangerouslySetInnerHTML.__html?o=t.dangerouslySetInnerHTML.__html:void 0!==t.children&&(o=J(t.children,n,r));if(!e)return o;const i=function(e){let t="";for(const n in e){const r=X(n);if(!(0,M.isValidAttributeName)(r))continue;let o=N(n,e[n]);if(!H.has(typeof o))continue;if(F(n))continue;const i=D.has(r);if(i&&!1===o)continue;const a=i||_(n,["data-","aria-"])||V.has(r);("boolean"!=typeof o||a)&&(t+=" "+r,i||("string"==typeof o&&(o=(0,M.escapeAttribute)(o)),t+='="'+o+'"'))}return t}(t);return z.has(e)?"<"+e+i+"/>":"<"+e+i+">"+o+"</"+e+">"}function J(e,t,n={}){let r="";e=Array.isArray(e)?e:[e];for(let o=0;o<e.length;o++){r+=Z(e[o],t,n)}return r}const K=Z;(window.wp=window.wp||{}).element=r})(); dist/shortcode.js 0000644 00000034362 15125140777 0010060 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": () => (/* binding */ build_module) }); // UNUSED EXPORTS: attrs, fromMatch, next, regexp, replace, string ;// ./node_modules/memize/dist/index.js /** * Memize options object. * * @typedef MemizeOptions * * @property {number} [maxSize] Maximum size of the cache. */ /** * Internal cache entry. * * @typedef MemizeCacheNode * * @property {?MemizeCacheNode|undefined} [prev] Previous node. * @property {?MemizeCacheNode|undefined} [next] Next node. * @property {Array<*>} args Function arguments for cache * entry. * @property {*} val Function result. */ /** * Properties of the enhanced function for controlling cache. * * @typedef MemizeMemoizedFunction * * @property {()=>void} clear Clear the cache. */ /** * Accepts a function to be memoized, and returns a new memoized function, with * optional options. * * @template {(...args: any[]) => any} F * * @param {F} fn Function to memoize. * @param {MemizeOptions} [options] Options object. * * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. */ function memize(fn, options) { var size = 0; /** @type {?MemizeCacheNode|undefined} */ var head; /** @type {?MemizeCacheNode|undefined} */ var tail; options = options || {}; function memoized(/* ...args */) { var node = head, len = arguments.length, args, i; searchCache: while (node) { // Perform a shallow equality test to confirm that whether the node // under test is a candidate for the arguments passed. Two arrays // are shallowly equal if their length matches and each entry is // strictly equal between the two sets. Avoid abstracting to a // function which could incur an arguments leaking deoptimization. // Check whether node arguments match arguments length if (node.args.length !== arguments.length) { node = node.next; continue; } // Check whether node arguments match arguments values for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } // At this point we can assume we've found a match // Surface matched node to head if not already if (node !== head) { // As tail, shift to previous. Must only shift if not also // head, since if both head and tail, there is no previous. if (node === tail) { tail = node.prev; } // Adjust siblings to point to each other. If node was tail, // this also handles new tail's empty `next` assignment. /** @type {MemizeCacheNode} */ (node.prev).next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; /** @type {MemizeCacheNode} */ (head).prev = node; head = node; } // Return immediately return node.val; } // No cached value found. Continue to insertion phase: // Create a copy of arguments (avoid leaking deoptimization) args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args: args, // Generate the result from original function val: fn.apply(null, args), }; // Don't need to check whether node is already head, since it would // have been returned above already if it was // Shift existing head down list if (head) { head.prev = node; node.next = head; } else { // If no head, follows that there's no tail (at initial or reset) tail = node; } // Trim tail if we're reached max size and are pending cache insertion if (size === /** @type {MemizeOptions} */ (options).maxSize) { tail = /** @type {MemizeCacheNode} */ (tail).prev; /** @type {MemizeCacheNode} */ (tail).next = null; } else { size++; } head = node; return node.val; } memoized.clear = function () { head = null; tail = null; size = 0; }; // Ignore reason: There's not a clear solution to create an intersection of // the function with additional properties, where the goal is to retain the // function signature of the incoming argument and add control properties // on the return value. // @ts-ignore return memoized; } ;// ./node_modules/@wordpress/shortcode/build-module/index.js /** * External dependencies */ /** * Find the next matching shortcode. * * @param {string} tag Shortcode tag. * @param {string} text Text to search. * @param {number} index Index to start search from. * * @return {import('./types').ShortcodeMatch | undefined} Matched information. */ function next(tag, text, index = 0) { const re = regexp(tag); re.lastIndex = index; const match = re.exec(text); if (!match) { return; } // If we matched an escaped shortcode, try again. if ('[' === match[1] && ']' === match[7]) { return next(tag, text, re.lastIndex); } const result = { index: match.index, content: match[0], shortcode: fromMatch(match) }; // If we matched a leading `[`, strip it from the match and increment the // index accordingly. if (match[1]) { result.content = result.content.slice(1); result.index++; } // If we matched a trailing `]`, strip it from the match. if (match[7]) { result.content = result.content.slice(0, -1); } return result; } /** * Replace matching shortcodes in a block of text. * * @param {string} tag Shortcode tag. * @param {string} text Text to search. * @param {import('./types').ReplaceCallback} callback Function to process the match and return * replacement string. * * @return {string} Text with shortcodes replaced. */ function replace(tag, text, callback) { return text.replace(regexp(tag), function (match, left, $3, attrs, slash, content, closing, right) { // If both extra brackets exist, the shortcode has been properly // escaped. if (left === '[' && right === ']') { return match; } // Create the match object and pass it through the callback. const result = callback(fromMatch(arguments)); // Make sure to return any of the extra brackets if they weren't used to // escape the shortcode. return result || result === '' ? left + result + right : match; }); } /** * Generate a string from shortcode parameters. * * Creates a shortcode instance and returns a string. * * Accepts the same `options` as the `shortcode()` constructor, containing a * `tag` string, a string or object of `attrs`, a boolean indicating whether to * format the shortcode using a `single` tag, and a `content` string. * * @param {Object} options * * @return {string} String representation of the shortcode. */ function string(options) { return new shortcode(options).string(); } /** * Generate a RegExp to identify a shortcode. * * The base regex is functionally equivalent to the one found in * `get_shortcode_regex()` in `wp-includes/shortcodes.php`. * * Capture groups: * * 1. An extra `[` to allow for escaping shortcodes with double `[[]]` * 2. The shortcode name * 3. The shortcode argument list * 4. The self closing `/` * 5. The content of a shortcode when it wraps some content. * 6. The closing tag. * 7. An extra `]` to allow for escaping shortcodes with double `[[]]` * * @param {string} tag Shortcode tag. * * @return {RegExp} Shortcode RegExp. */ function regexp(tag) { return new RegExp('\\[(\\[?)(' + tag + ')(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)', 'g'); } /** * Parse shortcode attributes. * * Shortcodes accept many types of attributes. These can chiefly be divided into * named and numeric attributes: * * Named attributes are assigned on a key/value basis, while numeric attributes * are treated as an array. * * Named attributes can be formatted as either `name="value"`, `name='value'`, * or `name=value`. Numeric attributes can be formatted as `"value"` or just * `value`. * * @param {string} text Serialised shortcode attributes. * * @return {import('./types').ShortcodeAttrs} Parsed shortcode attributes. */ const attrs = memize(text => { const named = {}; const numeric = []; // This regular expression is reused from `shortcode_parse_atts()` in // `wp-includes/shortcodes.php`. // // Capture groups: // // 1. An attribute name, that corresponds to... // 2. a value in double quotes. // 3. An attribute name, that corresponds to... // 4. a value in single quotes. // 5. An attribute name, that corresponds to... // 6. an unquoted value. // 7. A numeric attribute in double quotes. // 8. A numeric attribute in single quotes. // 9. An unquoted numeric attribute. const pattern = /([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g; // Map zero-width spaces to actual spaces. text = text.replace(/[\u00a0\u200b]/g, ' '); let match; // Match and normalize attributes. while (match = pattern.exec(text)) { if (match[1]) { named[match[1].toLowerCase()] = match[2]; } else if (match[3]) { named[match[3].toLowerCase()] = match[4]; } else if (match[5]) { named[match[5].toLowerCase()] = match[6]; } else if (match[7]) { numeric.push(match[7]); } else if (match[8]) { numeric.push(match[8]); } else if (match[9]) { numeric.push(match[9]); } } return { named, numeric }; }); /** * Generate a Shortcode Object from a RegExp match. * * Accepts a `match` object from calling `regexp.exec()` on a `RegExp` generated * by `regexp()`. `match` can also be set to the `arguments` from a callback * passed to `regexp.replace()`. * * @param {import('./types').Match} match Match array. * * @return {InstanceType<import('./types').shortcode>} Shortcode instance. */ function fromMatch(match) { let type; if (match[4]) { type = 'self-closing'; } else if (match[6]) { type = 'closed'; } else { type = 'single'; } return new shortcode({ tag: match[2], attrs: match[3], type, content: match[5] }); } /** * Creates a shortcode instance. * * To access a raw representation of a shortcode, pass an `options` object, * containing a `tag` string, a string or object of `attrs`, a string indicating * the `type` of the shortcode ('single', 'self-closing', or 'closed'), and a * `content` string. * * @type {import('./types').shortcode} Shortcode instance. */ const shortcode = Object.assign(function (options) { const { tag, attrs: attributes, type, content } = options || {}; Object.assign(this, { tag, type, content }); // Ensure we have a correctly formatted `attrs` object. this.attrs = { named: {}, numeric: [] }; if (!attributes) { return; } const attributeTypes = ['named', 'numeric']; // Parse a string of attributes. if (typeof attributes === 'string') { this.attrs = attrs(attributes); // Identify a correctly formatted `attrs` object. } else if (attributes.length === attributeTypes.length && attributeTypes.every((t, key) => t === attributes[key])) { this.attrs = attributes; // Handle a flat object of attributes. } else { Object.entries(attributes).forEach(([key, value]) => { this.set(key, value); }); } }, { next, replace, string, regexp, attrs, fromMatch }); Object.assign(shortcode.prototype, { /** * Get a shortcode attribute. * * Automatically detects whether `attr` is named or numeric and routes it * accordingly. * * @param {(number|string)} attr Attribute key. * * @return {string} Attribute value. */ get(attr) { return this.attrs[typeof attr === 'number' ? 'numeric' : 'named'][attr]; }, /** * Set a shortcode attribute. * * Automatically detects whether `attr` is named or numeric and routes it * accordingly. * * @param {(number|string)} attr Attribute key. * @param {string} value Attribute value. * * @return {InstanceType< import('./types').shortcode >} Shortcode instance. */ set(attr, value) { this.attrs[typeof attr === 'number' ? 'numeric' : 'named'][attr] = value; return this; }, /** * Transform the shortcode into a string. * * @return {string} String representation of the shortcode. */ string() { let text = '[' + this.tag; this.attrs.numeric.forEach(value => { if (/\s/.test(value)) { text += ' "' + value + '"'; } else { text += ' ' + value; } }); Object.entries(this.attrs.named).forEach(([name, value]) => { text += ' ' + name + '="' + value + '"'; }); // If the tag is marked as `single` or `self-closing`, close the tag and // ignore any additional content. if ('single' === this.type) { return text + ']'; } else if ('self-closing' === this.type) { return text + ' /]'; } // Complete the opening tag. text += ']'; if (this.content) { text += this.content; } // Add the closing tag. return text + '[/' + this.tag + ']'; } }); /* harmony default export */ const build_module = (shortcode); (window.wp = window.wp || {}).shortcode = __webpack_exports__["default"]; /******/ })() ; dist/editor.js 0000644 00004477647 15125140777 0007401 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 66: /***/ ((module) => { "use strict"; var isMergeableObject = function isMergeableObject(value) { return isNonNullObject(value) && !isSpecial(value) }; function isNonNullObject(value) { return !!value && typeof value === 'object' } function isSpecial(value) { var stringValue = Object.prototype.toString.call(value); return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value) } // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; function isReactElement(value) { return value.$$typeof === REACT_ELEMENT_TYPE } function emptyTarget(val) { return Array.isArray(val) ? [] : {} } function cloneUnlessOtherwiseSpecified(value, options) { return (options.clone !== false && options.isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, options) : value } function defaultArrayMerge(target, source, options) { return target.concat(source).map(function(element) { return cloneUnlessOtherwiseSpecified(element, options) }) } function getMergeFunction(key, options) { if (!options.customMerge) { return deepmerge } var customMerge = options.customMerge(key); return typeof customMerge === 'function' ? customMerge : deepmerge } function getEnumerableOwnPropertySymbols(target) { return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { return Object.propertyIsEnumerable.call(target, symbol) }) : [] } function getKeys(target) { return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) } function propertyIsOnObject(object, property) { try { return property in object } catch(_) { return false } } // Protects from prototype poisoning and unexpected merging up the prototype chain. function propertyIsUnsafe(target, key) { return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. } function mergeObject(target, source, options) { var destination = {}; if (options.isMergeableObject(target)) { getKeys(target).forEach(function(key) { destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); }); } getKeys(source).forEach(function(key) { if (propertyIsUnsafe(target, key)) { return } if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { destination[key] = getMergeFunction(key, options)(target[key], source[key], options); } else { destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); } }); return destination } function deepmerge(target, source, options) { options = options || {}; options.arrayMerge = options.arrayMerge || defaultArrayMerge; options.isMergeableObject = options.isMergeableObject || isMergeableObject; // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() // implementations can use it. The caller may not replace it. options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; var sourceIsArray = Array.isArray(source); var targetIsArray = Array.isArray(target); var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; if (!sourceAndTargetTypesMatch) { return cloneUnlessOtherwiseSpecified(source, options) } else if (sourceIsArray) { return options.arrayMerge(target, source, options) } else { return mergeObject(target, source, options) } } deepmerge.all = function deepmergeAll(array, options) { if (!Array.isArray(array)) { throw new Error('first argument should be an array') } return array.reduce(function(prev, next) { return deepmerge(prev, next, options) }, {}) }; var deepmerge_1 = deepmerge; module.exports = deepmerge_1; /***/ }), /***/ 461: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // Load in dependencies var computedStyle = __webpack_require__(6109); /** * Calculate the `line-height` of a given node * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. * @returns {Number} `line-height` of the element in pixels */ function lineHeight(node) { // Grab the line-height via style var lnHeightStr = computedStyle(node, 'line-height'); var lnHeight = parseFloat(lnHeightStr, 10); // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') if (lnHeightStr === lnHeight + '') { // Save the old lineHeight style and update the em unit to the element var _lnHeightStyle = node.style.lineHeight; node.style.lineHeight = lnHeightStr + 'em'; // Calculate the em based height lnHeightStr = computedStyle(node, 'line-height'); lnHeight = parseFloat(lnHeightStr, 10); // Revert the lineHeight style if (_lnHeightStyle) { node.style.lineHeight = _lnHeightStyle; } else { delete node.style.lineHeight; } } // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) // DEV: `em` units are converted to `pt` in IE6 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length if (lnHeightStr.indexOf('pt') !== -1) { lnHeight *= 4; lnHeight /= 3; // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) } else if (lnHeightStr.indexOf('mm') !== -1) { lnHeight *= 96; lnHeight /= 25.4; // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) } else if (lnHeightStr.indexOf('cm') !== -1) { lnHeight *= 96; lnHeight /= 2.54; // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) } else if (lnHeightStr.indexOf('in') !== -1) { lnHeight *= 96; // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) } else if (lnHeightStr.indexOf('pc') !== -1) { lnHeight *= 16; } // Continue our computation lnHeight = Math.round(lnHeight); // If the line-height is "normal", calculate by font-size if (lnHeightStr === 'normal') { // Create a temporary node var nodeName = node.nodeName; var _node = document.createElement(nodeName); _node.innerHTML = ' '; // If we have a text area, reset it to only 1 row // https://github.com/twolfson/line-height/issues/4 if (nodeName.toUpperCase() === 'TEXTAREA') { _node.setAttribute('rows', '1'); } // Set the font-size of the element var fontSizeStr = computedStyle(node, 'font-size'); _node.style.fontSize = fontSizeStr; // Remove default padding/border which can affect offset height // https://github.com/twolfson/line-height/issues/4 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight _node.style.padding = '0px'; _node.style.border = '0px'; // Append it to the body var body = document.body; body.appendChild(_node); // Assume the line height of the element is the height var height = _node.offsetHeight; lnHeight = height; // Remove our child from the DOM body.removeChild(_node); } // Return the calculated height return lnHeight; } // Export lineHeight module.exports = lineHeight; /***/ }), /***/ 628: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = __webpack_require__(4067); function emptyFunction() {} function emptyFunctionWithReset() {} emptyFunctionWithReset.resetWarningCache = emptyFunction; module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret) { // It is still safe when called from React. return; } var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); err.name = 'Invariant Violation'; throw err; }; shim.isRequired = shim; function getShim() { return shim; }; // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bigint: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, elementType: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, exact: getShim, checkPropTypes: emptyFunctionWithReset, resetWarningCache: emptyFunction }; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /***/ }), /***/ 1609: /***/ ((module) => { "use strict"; module.exports = window["React"]; /***/ }), /***/ 4067: /***/ ((module) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; /***/ }), /***/ 4132: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = true; var TextareaAutosize_1 = __webpack_require__(4462); exports.A = TextareaAutosize_1.TextareaAutosize; /***/ }), /***/ 4306: /***/ (function(module, exports) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize */ (function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { var mod; } })(this, function (module, exports) { 'use strict'; var map = typeof Map === "function" ? new Map() : function () { var keys = []; var values = []; return { has: function has(key) { return keys.indexOf(key) > -1; }, get: function get(key) { return values[keys.indexOf(key)]; }, set: function set(key, value) { if (keys.indexOf(key) === -1) { keys.push(key); values.push(value); } }, delete: function _delete(key) { var index = keys.indexOf(key); if (index > -1) { keys.splice(index, 1); values.splice(index, 1); } } }; }(); var createEvent = function createEvent(name) { return new Event(name, { bubbles: true }); }; try { new Event('test'); } catch (e) { // IE does not support `new Event()` createEvent = function createEvent(name) { var evt = document.createEvent('Event'); evt.initEvent(name, true, false); return evt; }; } function assign(ta) { if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; var heightOffset = null; var clientWidth = null; var cachedHeight = null; function init() { var style = window.getComputedStyle(ta, null); if (style.resize === 'vertical') { ta.style.resize = 'none'; } else if (style.resize === 'both') { ta.style.resize = 'horizontal'; } if (style.boxSizing === 'content-box') { heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); } else { heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); } // Fix when a textarea is not on document body and heightOffset is Not a Number if (isNaN(heightOffset)) { heightOffset = 0; } update(); } function changeOverflow(value) { { // Chrome/Safari-specific fix: // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space // made available by removing the scrollbar. The following forces the necessary text reflow. var width = ta.style.width; ta.style.width = '0px'; // Force reflow: /* jshint ignore:start */ ta.offsetWidth; /* jshint ignore:end */ ta.style.width = width; } ta.style.overflowY = value; } function getParentOverflows(el) { var arr = []; while (el && el.parentNode && el.parentNode instanceof Element) { if (el.parentNode.scrollTop) { arr.push({ node: el.parentNode, scrollTop: el.parentNode.scrollTop }); } el = el.parentNode; } return arr; } function resize() { if (ta.scrollHeight === 0) { // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. return; } var overflows = getParentOverflows(ta); var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) ta.style.height = ''; ta.style.height = ta.scrollHeight + heightOffset + 'px'; // used to check if an update is actually necessary on window.resize clientWidth = ta.clientWidth; // prevents scroll-position jumping overflows.forEach(function (el) { el.node.scrollTop = el.scrollTop; }); if (docTop) { document.documentElement.scrollTop = docTop; } } function update() { resize(); var styleHeight = Math.round(parseFloat(ta.style.height)); var computed = window.getComputedStyle(ta, null); // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; // The actual height not matching the style height (set via the resize method) indicates that // the max-height has been exceeded, in which case the overflow should be allowed. if (actualHeight < styleHeight) { if (computed.overflowY === 'hidden') { changeOverflow('scroll'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } else { // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. if (computed.overflowY !== 'hidden') { changeOverflow('hidden'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } if (cachedHeight !== actualHeight) { cachedHeight = actualHeight; var evt = createEvent('autosize:resized'); try { ta.dispatchEvent(evt); } catch (err) { // Firefox will throw an error on dispatchEvent for a detached element // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 } } } var pageResize = function pageResize() { if (ta.clientWidth !== clientWidth) { update(); } }; var destroy = function (style) { window.removeEventListener('resize', pageResize, false); ta.removeEventListener('input', update, false); ta.removeEventListener('keyup', update, false); ta.removeEventListener('autosize:destroy', destroy, false); ta.removeEventListener('autosize:update', update, false); Object.keys(style).forEach(function (key) { ta.style[key] = style[key]; }); map.delete(ta); }.bind(ta, { height: ta.style.height, resize: ta.style.resize, overflowY: ta.style.overflowY, overflowX: ta.style.overflowX, wordWrap: ta.style.wordWrap }); ta.addEventListener('autosize:destroy', destroy, false); // IE9 does not fire onpropertychange or oninput for deletions, // so binding to onkeyup to catch most of those events. // There is no way that I know of to detect something like 'cut' in IE9. if ('onpropertychange' in ta && 'oninput' in ta) { ta.addEventListener('keyup', update, false); } window.addEventListener('resize', pageResize, false); ta.addEventListener('input', update, false); ta.addEventListener('autosize:update', update, false); ta.style.overflowX = 'hidden'; ta.style.wordWrap = 'break-word'; map.set(ta, { destroy: destroy, update: update }); init(); } function destroy(ta) { var methods = map.get(ta); if (methods) { methods.destroy(); } } function update(ta) { var methods = map.get(ta); if (methods) { methods.update(); } } var autosize = null; // Do nothing in Node.js environment and IE8 (or lower) if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { autosize = function autosize(el) { return el; }; autosize.destroy = function (el) { return el; }; autosize.update = function (el) { return el; }; } else { autosize = function autosize(el, options) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], function (x) { return assign(x, options); }); } return el; }; autosize.destroy = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], destroy); } return el; }; autosize.update = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], update); } return el; }; } exports.default = autosize; module.exports = exports['default']; }); /***/ }), /***/ 4462: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; exports.__esModule = true; var React = __webpack_require__(1609); var PropTypes = __webpack_require__(5826); var autosize = __webpack_require__(4306); var _getLineHeight = __webpack_require__(461); var getLineHeight = _getLineHeight; var RESIZED = "autosize:resized"; /** * A light replacement for built-in textarea component * which automaticaly adjusts its height to match the content */ var TextareaAutosizeClass = /** @class */ (function (_super) { __extends(TextareaAutosizeClass, _super); function TextareaAutosizeClass() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.state = { lineHeight: null }; _this.textarea = null; _this.onResize = function (e) { if (_this.props.onResize) { _this.props.onResize(e); } }; _this.updateLineHeight = function () { if (_this.textarea) { _this.setState({ lineHeight: getLineHeight(_this.textarea) }); } }; _this.onChange = function (e) { var onChange = _this.props.onChange; _this.currentValue = e.currentTarget.value; onChange && onChange(e); }; return _this; } TextareaAutosizeClass.prototype.componentDidMount = function () { var _this = this; var _a = this.props, maxRows = _a.maxRows, async = _a.async; if (typeof maxRows === "number") { this.updateLineHeight(); } if (typeof maxRows === "number" || async) { /* the defer is needed to: - force "autosize" to activate the scrollbar when this.props.maxRows is passed - support StyledComponents (see #71) */ setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); } else { this.textarea && autosize(this.textarea); } if (this.textarea) { this.textarea.addEventListener(RESIZED, this.onResize); } }; TextareaAutosizeClass.prototype.componentWillUnmount = function () { if (this.textarea) { this.textarea.removeEventListener(RESIZED, this.onResize); autosize.destroy(this.textarea); } }; TextareaAutosizeClass.prototype.render = function () { var _this = this; var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { _this.textarea = element; if (typeof _this.props.innerRef === 'function') { _this.props.innerRef(element); } else if (_this.props.innerRef) { _this.props.innerRef.current = element; } } }), children)); }; TextareaAutosizeClass.prototype.componentDidUpdate = function () { this.textarea && autosize.update(this.textarea); }; TextareaAutosizeClass.defaultProps = { rows: 1, async: false }; TextareaAutosizeClass.propTypes = { rows: PropTypes.number, maxRows: PropTypes.number, onResize: PropTypes.func, innerRef: PropTypes.any, async: PropTypes.bool }; return TextareaAutosizeClass; }(React.Component)); exports.TextareaAutosize = React.forwardRef(function (props, ref) { return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); }); /***/ }), /***/ 5215: /***/ ((module) => { "use strict"; // do not edit .js files directly - edit src/index.jst module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }), /***/ 5826: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (false) { var throwOnDirectAccess, ReactIs; } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = __webpack_require__(628)(); } /***/ }), /***/ 6109: /***/ ((module) => { // This code has been refactored for 140 bytes // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js var computedStyle = function (el, prop, getComputedStyle) { getComputedStyle = window.getComputedStyle; // In one fell swoop return ( // If we have getComputedStyle getComputedStyle ? // Query it // TODO: From CSS-Query notes, we might need (node, null) for FF getComputedStyle(el) : // Otherwise, we are in IE and use currentStyle el.currentStyle )[ // Switch to camelCase for CSSOM // DEV: Grabbed from jQuery // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 prop.replace(/-(\w)/gi, function (word, letter) { return letter.toUpperCase(); }) ]; }; module.exports = computedStyle; /***/ }), /***/ 9681: /***/ ((module) => { var characterMap = { "À": "A", "Á": "A", "Â": "A", "Ã": "A", "Ä": "A", "Å": "A", "Ấ": "A", "Ắ": "A", "Ẳ": "A", "Ẵ": "A", "Ặ": "A", "Æ": "AE", "Ầ": "A", "Ằ": "A", "Ȃ": "A", "Ả": "A", "Ạ": "A", "Ẩ": "A", "Ẫ": "A", "Ậ": "A", "Ç": "C", "Ḉ": "C", "È": "E", "É": "E", "Ê": "E", "Ë": "E", "Ế": "E", "Ḗ": "E", "Ề": "E", "Ḕ": "E", "Ḝ": "E", "Ȇ": "E", "Ẻ": "E", "Ẽ": "E", "Ẹ": "E", "Ể": "E", "Ễ": "E", "Ệ": "E", "Ì": "I", "Í": "I", "Î": "I", "Ï": "I", "Ḯ": "I", "Ȋ": "I", "Ỉ": "I", "Ị": "I", "Ð": "D", "Ñ": "N", "Ò": "O", "Ó": "O", "Ô": "O", "Õ": "O", "Ö": "O", "Ø": "O", "Ố": "O", "Ṍ": "O", "Ṓ": "O", "Ȏ": "O", "Ỏ": "O", "Ọ": "O", "Ổ": "O", "Ỗ": "O", "Ộ": "O", "Ờ": "O", "Ở": "O", "Ỡ": "O", "Ớ": "O", "Ợ": "O", "Ù": "U", "Ú": "U", "Û": "U", "Ü": "U", "Ủ": "U", "Ụ": "U", "Ử": "U", "Ữ": "U", "Ự": "U", "Ý": "Y", "à": "a", "á": "a", "â": "a", "ã": "a", "ä": "a", "å": "a", "ấ": "a", "ắ": "a", "ẳ": "a", "ẵ": "a", "ặ": "a", "æ": "ae", "ầ": "a", "ằ": "a", "ȃ": "a", "ả": "a", "ạ": "a", "ẩ": "a", "ẫ": "a", "ậ": "a", "ç": "c", "ḉ": "c", "è": "e", "é": "e", "ê": "e", "ë": "e", "ế": "e", "ḗ": "e", "ề": "e", "ḕ": "e", "ḝ": "e", "ȇ": "e", "ẻ": "e", "ẽ": "e", "ẹ": "e", "ể": "e", "ễ": "e", "ệ": "e", "ì": "i", "í": "i", "î": "i", "ï": "i", "ḯ": "i", "ȋ": "i", "ỉ": "i", "ị": "i", "ð": "d", "ñ": "n", "ò": "o", "ó": "o", "ô": "o", "õ": "o", "ö": "o", "ø": "o", "ố": "o", "ṍ": "o", "ṓ": "o", "ȏ": "o", "ỏ": "o", "ọ": "o", "ổ": "o", "ỗ": "o", "ộ": "o", "ờ": "o", "ở": "o", "ỡ": "o", "ớ": "o", "ợ": "o", "ù": "u", "ú": "u", "û": "u", "ü": "u", "ủ": "u", "ụ": "u", "ử": "u", "ữ": "u", "ự": "u", "ý": "y", "ÿ": "y", "Ā": "A", "ā": "a", "Ă": "A", "ă": "a", "Ą": "A", "ą": "a", "Ć": "C", "ć": "c", "Ĉ": "C", "ĉ": "c", "Ċ": "C", "ċ": "c", "Č": "C", "č": "c", "C̆": "C", "c̆": "c", "Ď": "D", "ď": "d", "Đ": "D", "đ": "d", "Ē": "E", "ē": "e", "Ĕ": "E", "ĕ": "e", "Ė": "E", "ė": "e", "Ę": "E", "ę": "e", "Ě": "E", "ě": "e", "Ĝ": "G", "Ǵ": "G", "ĝ": "g", "ǵ": "g", "Ğ": "G", "ğ": "g", "Ġ": "G", "ġ": "g", "Ģ": "G", "ģ": "g", "Ĥ": "H", "ĥ": "h", "Ħ": "H", "ħ": "h", "Ḫ": "H", "ḫ": "h", "Ĩ": "I", "ĩ": "i", "Ī": "I", "ī": "i", "Ĭ": "I", "ĭ": "i", "Į": "I", "į": "i", "İ": "I", "ı": "i", "IJ": "IJ", "ij": "ij", "Ĵ": "J", "ĵ": "j", "Ķ": "K", "ķ": "k", "Ḱ": "K", "ḱ": "k", "K̆": "K", "k̆": "k", "Ĺ": "L", "ĺ": "l", "Ļ": "L", "ļ": "l", "Ľ": "L", "ľ": "l", "Ŀ": "L", "ŀ": "l", "Ł": "l", "ł": "l", "Ḿ": "M", "ḿ": "m", "M̆": "M", "m̆": "m", "Ń": "N", "ń": "n", "Ņ": "N", "ņ": "n", "Ň": "N", "ň": "n", "ʼn": "n", "N̆": "N", "n̆": "n", "Ō": "O", "ō": "o", "Ŏ": "O", "ŏ": "o", "Ő": "O", "ő": "o", "Œ": "OE", "œ": "oe", "P̆": "P", "p̆": "p", "Ŕ": "R", "ŕ": "r", "Ŗ": "R", "ŗ": "r", "Ř": "R", "ř": "r", "R̆": "R", "r̆": "r", "Ȓ": "R", "ȓ": "r", "Ś": "S", "ś": "s", "Ŝ": "S", "ŝ": "s", "Ş": "S", "Ș": "S", "ș": "s", "ş": "s", "Š": "S", "š": "s", "Ţ": "T", "ţ": "t", "ț": "t", "Ț": "T", "Ť": "T", "ť": "t", "Ŧ": "T", "ŧ": "t", "T̆": "T", "t̆": "t", "Ũ": "U", "ũ": "u", "Ū": "U", "ū": "u", "Ŭ": "U", "ŭ": "u", "Ů": "U", "ů": "u", "Ű": "U", "ű": "u", "Ų": "U", "ų": "u", "Ȗ": "U", "ȗ": "u", "V̆": "V", "v̆": "v", "Ŵ": "W", "ŵ": "w", "Ẃ": "W", "ẃ": "w", "X̆": "X", "x̆": "x", "Ŷ": "Y", "ŷ": "y", "Ÿ": "Y", "Y̆": "Y", "y̆": "y", "Ź": "Z", "ź": "z", "Ż": "Z", "ż": "z", "Ž": "Z", "ž": "z", "ſ": "s", "ƒ": "f", "Ơ": "O", "ơ": "o", "Ư": "U", "ư": "u", "Ǎ": "A", "ǎ": "a", "Ǐ": "I", "ǐ": "i", "Ǒ": "O", "ǒ": "o", "Ǔ": "U", "ǔ": "u", "Ǖ": "U", "ǖ": "u", "Ǘ": "U", "ǘ": "u", "Ǚ": "U", "ǚ": "u", "Ǜ": "U", "ǜ": "u", "Ứ": "U", "ứ": "u", "Ṹ": "U", "ṹ": "u", "Ǻ": "A", "ǻ": "a", "Ǽ": "AE", "ǽ": "ae", "Ǿ": "O", "ǿ": "o", "Þ": "TH", "þ": "th", "Ṕ": "P", "ṕ": "p", "Ṥ": "S", "ṥ": "s", "X́": "X", "x́": "x", "Ѓ": "Г", "ѓ": "г", "Ќ": "К", "ќ": "к", "A̋": "A", "a̋": "a", "E̋": "E", "e̋": "e", "I̋": "I", "i̋": "i", "Ǹ": "N", "ǹ": "n", "Ồ": "O", "ồ": "o", "Ṑ": "O", "ṑ": "o", "Ừ": "U", "ừ": "u", "Ẁ": "W", "ẁ": "w", "Ỳ": "Y", "ỳ": "y", "Ȁ": "A", "ȁ": "a", "Ȅ": "E", "ȅ": "e", "Ȉ": "I", "ȉ": "i", "Ȍ": "O", "ȍ": "o", "Ȑ": "R", "ȑ": "r", "Ȕ": "U", "ȕ": "u", "B̌": "B", "b̌": "b", "Č̣": "C", "č̣": "c", "Ê̌": "E", "ê̌": "e", "F̌": "F", "f̌": "f", "Ǧ": "G", "ǧ": "g", "Ȟ": "H", "ȟ": "h", "J̌": "J", "ǰ": "j", "Ǩ": "K", "ǩ": "k", "M̌": "M", "m̌": "m", "P̌": "P", "p̌": "p", "Q̌": "Q", "q̌": "q", "Ř̩": "R", "ř̩": "r", "Ṧ": "S", "ṧ": "s", "V̌": "V", "v̌": "v", "W̌": "W", "w̌": "w", "X̌": "X", "x̌": "x", "Y̌": "Y", "y̌": "y", "A̧": "A", "a̧": "a", "B̧": "B", "b̧": "b", "Ḑ": "D", "ḑ": "d", "Ȩ": "E", "ȩ": "e", "Ɛ̧": "E", "ɛ̧": "e", "Ḩ": "H", "ḩ": "h", "I̧": "I", "i̧": "i", "Ɨ̧": "I", "ɨ̧": "i", "M̧": "M", "m̧": "m", "O̧": "O", "o̧": "o", "Q̧": "Q", "q̧": "q", "U̧": "U", "u̧": "u", "X̧": "X", "x̧": "x", "Z̧": "Z", "z̧": "z", "й":"и", "Й":"И", "ё":"е", "Ё":"Е", }; var chars = Object.keys(characterMap).join('|'); var allAccents = new RegExp(chars, 'g'); var firstAccent = new RegExp(chars, ''); function matcher(match) { return characterMap[match]; } var removeAccents = function(string) { return string.replace(allAccents, matcher); }; var hasAccents = function(string) { return !!string.match(firstAccent); }; module.exports = removeAccents; module.exports.has = hasAccents; module.exports.remove = removeAccents; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { AlignmentToolbar: () => (/* reexport */ AlignmentToolbar), Autocomplete: () => (/* reexport */ Autocomplete), AutosaveMonitor: () => (/* reexport */ autosave_monitor), BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar), BlockControls: () => (/* reexport */ BlockControls), BlockEdit: () => (/* reexport */ BlockEdit), BlockEditorKeyboardShortcuts: () => (/* reexport */ BlockEditorKeyboardShortcuts), BlockFormatControls: () => (/* reexport */ BlockFormatControls), BlockIcon: () => (/* reexport */ BlockIcon), BlockInspector: () => (/* reexport */ BlockInspector), BlockList: () => (/* reexport */ BlockList), BlockMover: () => (/* reexport */ BlockMover), BlockNavigationDropdown: () => (/* reexport */ BlockNavigationDropdown), BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer), BlockSettingsMenu: () => (/* reexport */ BlockSettingsMenu), BlockTitle: () => (/* reexport */ BlockTitle), BlockToolbar: () => (/* reexport */ BlockToolbar), CharacterCount: () => (/* reexport */ CharacterCount), ColorPalette: () => (/* reexport */ ColorPalette), ContrastChecker: () => (/* reexport */ ContrastChecker), CopyHandler: () => (/* reexport */ CopyHandler), DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender), DocumentBar: () => (/* reexport */ DocumentBar), DocumentOutline: () => (/* reexport */ DocumentOutline), DocumentOutlineCheck: () => (/* reexport */ DocumentOutlineCheck), EditorHistoryRedo: () => (/* reexport */ editor_history_redo), EditorHistoryUndo: () => (/* reexport */ editor_history_undo), EditorKeyboardShortcuts: () => (/* reexport */ EditorKeyboardShortcuts), EditorKeyboardShortcutsRegister: () => (/* reexport */ register_shortcuts), EditorNotices: () => (/* reexport */ editor_notices), EditorProvider: () => (/* reexport */ provider), EditorSnackbars: () => (/* reexport */ EditorSnackbars), EntitiesSavedStates: () => (/* reexport */ EntitiesSavedStates), ErrorBoundary: () => (/* reexport */ error_boundary), FontSizePicker: () => (/* reexport */ FontSizePicker), InnerBlocks: () => (/* reexport */ InnerBlocks), Inserter: () => (/* reexport */ Inserter), InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls), InspectorControls: () => (/* reexport */ InspectorControls), LocalAutosaveMonitor: () => (/* reexport */ local_autosave_monitor), MediaPlaceholder: () => (/* reexport */ MediaPlaceholder), MediaUpload: () => (/* reexport */ MediaUpload), MediaUploadCheck: () => (/* reexport */ MediaUploadCheck), MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView), NavigableToolbar: () => (/* reexport */ NavigableToolbar), ObserveTyping: () => (/* reexport */ ObserveTyping), PageAttributesCheck: () => (/* reexport */ page_attributes_check), PageAttributesOrder: () => (/* reexport */ PageAttributesOrderWithChecks), PageAttributesPanel: () => (/* reexport */ PageAttributesPanel), PageAttributesParent: () => (/* reexport */ page_attributes_parent), PageTemplate: () => (/* reexport */ classic_theme), PanelColorSettings: () => (/* reexport */ PanelColorSettings), PlainText: () => (/* reexport */ PlainText), PluginBlockSettingsMenuItem: () => (/* reexport */ plugin_block_settings_menu_item), PluginDocumentSettingPanel: () => (/* reexport */ plugin_document_setting_panel), PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel), PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info), PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel), PluginPreviewMenuItem: () => (/* reexport */ PluginPreviewMenuItem), PluginSidebar: () => (/* reexport */ PluginSidebar), PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), PostAuthor: () => (/* reexport */ post_author), PostAuthorCheck: () => (/* reexport */ PostAuthorCheck), PostAuthorPanel: () => (/* reexport */ panel), PostComments: () => (/* reexport */ post_comments), PostDiscussionPanel: () => (/* reexport */ PostDiscussionPanel), PostExcerpt: () => (/* reexport */ PostExcerpt), PostExcerptCheck: () => (/* reexport */ post_excerpt_check), PostExcerptPanel: () => (/* reexport */ PostExcerptPanel), PostFeaturedImage: () => (/* reexport */ post_featured_image), PostFeaturedImageCheck: () => (/* reexport */ post_featured_image_check), PostFeaturedImagePanel: () => (/* reexport */ PostFeaturedImagePanel), PostFormat: () => (/* reexport */ PostFormat), PostFormatCheck: () => (/* reexport */ PostFormatCheck), PostLastRevision: () => (/* reexport */ post_last_revision), PostLastRevisionCheck: () => (/* reexport */ post_last_revision_check), PostLastRevisionPanel: () => (/* reexport */ post_last_revision_panel), PostLockedModal: () => (/* reexport */ PostLockedModal), PostPendingStatus: () => (/* reexport */ post_pending_status), PostPendingStatusCheck: () => (/* reexport */ post_pending_status_check), PostPingbacks: () => (/* reexport */ post_pingbacks), PostPreviewButton: () => (/* reexport */ PostPreviewButton), PostPublishButton: () => (/* reexport */ post_publish_button), PostPublishButtonLabel: () => (/* reexport */ PublishButtonLabel), PostPublishPanel: () => (/* reexport */ post_publish_panel), PostSavedState: () => (/* reexport */ PostSavedState), PostSchedule: () => (/* reexport */ PostSchedule), PostScheduleCheck: () => (/* reexport */ PostScheduleCheck), PostScheduleLabel: () => (/* reexport */ PostScheduleLabel), PostSchedulePanel: () => (/* reexport */ PostSchedulePanel), PostSticky: () => (/* reexport */ PostSticky), PostStickyCheck: () => (/* reexport */ PostStickyCheck), PostSwitchToDraftButton: () => (/* reexport */ PostSwitchToDraftButton), PostSyncStatus: () => (/* reexport */ PostSyncStatus), PostTaxonomies: () => (/* reexport */ post_taxonomies), PostTaxonomiesCheck: () => (/* reexport */ PostTaxonomiesCheck), PostTaxonomiesFlatTermSelector: () => (/* reexport */ FlatTermSelector), PostTaxonomiesHierarchicalTermSelector: () => (/* reexport */ HierarchicalTermSelector), PostTaxonomiesPanel: () => (/* reexport */ panel_PostTaxonomies), PostTemplatePanel: () => (/* reexport */ PostTemplatePanel), PostTextEditor: () => (/* reexport */ PostTextEditor), PostTitle: () => (/* reexport */ post_title), PostTitleRaw: () => (/* reexport */ post_title_raw), PostTrash: () => (/* reexport */ PostTrash), PostTrashCheck: () => (/* reexport */ PostTrashCheck), PostTypeSupportCheck: () => (/* reexport */ post_type_support_check), PostURL: () => (/* reexport */ PostURL), PostURLCheck: () => (/* reexport */ PostURLCheck), PostURLLabel: () => (/* reexport */ PostURLLabel), PostURLPanel: () => (/* reexport */ PostURLPanel), PostVisibility: () => (/* reexport */ PostVisibility), PostVisibilityCheck: () => (/* reexport */ PostVisibilityCheck), PostVisibilityLabel: () => (/* reexport */ PostVisibilityLabel), RichText: () => (/* reexport */ RichText), RichTextShortcut: () => (/* reexport */ RichTextShortcut), RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), ServerSideRender: () => (/* reexport */ (external_wp_serverSideRender_default())), SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), TableOfContents: () => (/* reexport */ table_of_contents), TextEditorGlobalKeyboardShortcuts: () => (/* reexport */ TextEditorGlobalKeyboardShortcuts), ThemeSupportCheck: () => (/* reexport */ ThemeSupportCheck), TimeToRead: () => (/* reexport */ TimeToRead), URLInput: () => (/* reexport */ URLInput), URLInputButton: () => (/* reexport */ URLInputButton), URLPopover: () => (/* reexport */ URLPopover), UnsavedChangesWarning: () => (/* reexport */ UnsavedChangesWarning), VisualEditorGlobalKeyboardShortcuts: () => (/* reexport */ VisualEditorGlobalKeyboardShortcuts), Warning: () => (/* reexport */ Warning), WordCount: () => (/* reexport */ WordCount), WritingFlow: () => (/* reexport */ WritingFlow), __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), cleanForSlug: () => (/* reexport */ cleanForSlug), createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC), getColorClassName: () => (/* reexport */ getColorClassName), getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues), getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue), getFontSize: () => (/* reexport */ getFontSize), getFontSizeClass: () => (/* reexport */ getFontSizeClass), getTemplatePartIcon: () => (/* reexport */ getTemplatePartIcon), mediaUpload: () => (/* reexport */ mediaUpload), privateApis: () => (/* reexport */ privateApis), registerEntityAction: () => (/* reexport */ api_registerEntityAction), registerEntityField: () => (/* reexport */ api_registerEntityField), store: () => (/* reexport */ store_store), storeConfig: () => (/* reexport */ storeConfig), transformStyles: () => (/* reexport */ external_wp_blockEditor_namespaceObject.transformStyles), unregisterEntityAction: () => (/* reexport */ api_unregisterEntityAction), unregisterEntityField: () => (/* reexport */ api_unregisterEntityField), useEntitiesSavedStatesIsDirty: () => (/* reexport */ useIsDirty), usePostScheduleLabel: () => (/* reexport */ usePostScheduleLabel), usePostURLLabel: () => (/* reexport */ usePostURLLabel), usePostVisibilityLabel: () => (/* reexport */ usePostVisibilityLabel), userAutocompleter: () => (/* reexport */ user), withColorContext: () => (/* reexport */ withColorContext), withColors: () => (/* reexport */ withColors), withFontSizes: () => (/* reexport */ withFontSizes) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { __experimentalGetDefaultTemplatePartAreas: () => (__experimentalGetDefaultTemplatePartAreas), __experimentalGetDefaultTemplateType: () => (__experimentalGetDefaultTemplateType), __experimentalGetDefaultTemplateTypes: () => (__experimentalGetDefaultTemplateTypes), __experimentalGetTemplateInfo: () => (__experimentalGetTemplateInfo), __unstableIsEditorReady: () => (__unstableIsEditorReady), canInsertBlockType: () => (canInsertBlockType), canUserUseUnfilteredHTML: () => (canUserUseUnfilteredHTML), didPostSaveRequestFail: () => (didPostSaveRequestFail), didPostSaveRequestSucceed: () => (didPostSaveRequestSucceed), getActivePostLock: () => (getActivePostLock), getAdjacentBlockClientId: () => (getAdjacentBlockClientId), getAutosaveAttribute: () => (getAutosaveAttribute), getBlock: () => (getBlock), getBlockAttributes: () => (getBlockAttributes), getBlockCount: () => (getBlockCount), getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId), getBlockIndex: () => (getBlockIndex), getBlockInsertionPoint: () => (getBlockInsertionPoint), getBlockListSettings: () => (getBlockListSettings), getBlockMode: () => (getBlockMode), getBlockName: () => (getBlockName), getBlockOrder: () => (getBlockOrder), getBlockRootClientId: () => (getBlockRootClientId), getBlockSelectionEnd: () => (getBlockSelectionEnd), getBlockSelectionStart: () => (getBlockSelectionStart), getBlocks: () => (getBlocks), getBlocksByClientId: () => (getBlocksByClientId), getClientIdsOfDescendants: () => (getClientIdsOfDescendants), getClientIdsWithDescendants: () => (getClientIdsWithDescendants), getCurrentPost: () => (getCurrentPost), getCurrentPostAttribute: () => (getCurrentPostAttribute), getCurrentPostId: () => (getCurrentPostId), getCurrentPostLastRevisionId: () => (getCurrentPostLastRevisionId), getCurrentPostRevisionsCount: () => (getCurrentPostRevisionsCount), getCurrentPostType: () => (getCurrentPostType), getCurrentTemplateId: () => (getCurrentTemplateId), getDeviceType: () => (getDeviceType), getEditedPostAttribute: () => (getEditedPostAttribute), getEditedPostContent: () => (getEditedPostContent), getEditedPostPreviewLink: () => (getEditedPostPreviewLink), getEditedPostSlug: () => (getEditedPostSlug), getEditedPostVisibility: () => (getEditedPostVisibility), getEditorBlocks: () => (getEditorBlocks), getEditorMode: () => (getEditorMode), getEditorSelection: () => (getEditorSelection), getEditorSelectionEnd: () => (getEditorSelectionEnd), getEditorSelectionStart: () => (getEditorSelectionStart), getEditorSettings: () => (getEditorSettings), getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId), getGlobalBlockCount: () => (getGlobalBlockCount), getInserterItems: () => (getInserterItems), getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId), getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds), getMultiSelectedBlocks: () => (getMultiSelectedBlocks), getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId), getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId), getNextBlockClientId: () => (getNextBlockClientId), getPermalink: () => (getPermalink), getPermalinkParts: () => (getPermalinkParts), getPostEdits: () => (getPostEdits), getPostLockUser: () => (getPostLockUser), getPostTypeLabel: () => (getPostTypeLabel), getPreviousBlockClientId: () => (getPreviousBlockClientId), getRenderingMode: () => (getRenderingMode), getSelectedBlock: () => (getSelectedBlock), getSelectedBlockClientId: () => (getSelectedBlockClientId), getSelectedBlockCount: () => (getSelectedBlockCount), getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition), getStateBeforeOptimisticTransaction: () => (getStateBeforeOptimisticTransaction), getSuggestedPostFormat: () => (getSuggestedPostFormat), getTemplate: () => (getTemplate), getTemplateLock: () => (getTemplateLock), hasChangedContent: () => (hasChangedContent), hasEditorRedo: () => (hasEditorRedo), hasEditorUndo: () => (hasEditorUndo), hasInserterItems: () => (hasInserterItems), hasMultiSelection: () => (hasMultiSelection), hasNonPostEntityChanges: () => (hasNonPostEntityChanges), hasSelectedBlock: () => (hasSelectedBlock), hasSelectedInnerBlock: () => (hasSelectedInnerBlock), inSomeHistory: () => (inSomeHistory), isAncestorMultiSelected: () => (isAncestorMultiSelected), isAutosavingPost: () => (isAutosavingPost), isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible), isBlockMultiSelected: () => (isBlockMultiSelected), isBlockSelected: () => (isBlockSelected), isBlockValid: () => (isBlockValid), isBlockWithinSelection: () => (isBlockWithinSelection), isCaretWithinFormattedText: () => (isCaretWithinFormattedText), isCleanNewPost: () => (isCleanNewPost), isCurrentPostPending: () => (isCurrentPostPending), isCurrentPostPublished: () => (isCurrentPostPublished), isCurrentPostScheduled: () => (isCurrentPostScheduled), isDeletingPost: () => (isDeletingPost), isEditedPostAutosaveable: () => (isEditedPostAutosaveable), isEditedPostBeingScheduled: () => (isEditedPostBeingScheduled), isEditedPostDateFloating: () => (isEditedPostDateFloating), isEditedPostDirty: () => (isEditedPostDirty), isEditedPostEmpty: () => (isEditedPostEmpty), isEditedPostNew: () => (isEditedPostNew), isEditedPostPublishable: () => (isEditedPostPublishable), isEditedPostSaveable: () => (isEditedPostSaveable), isEditorPanelEnabled: () => (isEditorPanelEnabled), isEditorPanelOpened: () => (isEditorPanelOpened), isEditorPanelRemoved: () => (isEditorPanelRemoved), isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock), isInserterOpened: () => (isInserterOpened), isListViewOpened: () => (isListViewOpened), isMultiSelecting: () => (isMultiSelecting), isPermalinkEditable: () => (isPermalinkEditable), isPostAutosavingLocked: () => (isPostAutosavingLocked), isPostLockTakeover: () => (isPostLockTakeover), isPostLocked: () => (isPostLocked), isPostSavingLocked: () => (isPostSavingLocked), isPreviewingPost: () => (isPreviewingPost), isPublishSidebarEnabled: () => (isPublishSidebarEnabled), isPublishSidebarOpened: () => (isPublishSidebarOpened), isPublishingPost: () => (isPublishingPost), isSavingNonPostEntityChanges: () => (isSavingNonPostEntityChanges), isSavingPost: () => (isSavingPost), isSelectionEnabled: () => (isSelectionEnabled), isTyping: () => (isTyping), isValidTemplate: () => (isValidTemplate) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { __experimentalTearDownEditor: () => (__experimentalTearDownEditor), __unstableSaveForPreview: () => (__unstableSaveForPreview), autosave: () => (autosave), clearSelectedBlock: () => (clearSelectedBlock), closePublishSidebar: () => (closePublishSidebar), createUndoLevel: () => (createUndoLevel), disablePublishSidebar: () => (disablePublishSidebar), editPost: () => (editPost), enablePublishSidebar: () => (enablePublishSidebar), enterFormattedText: () => (enterFormattedText), exitFormattedText: () => (exitFormattedText), hideInsertionPoint: () => (hideInsertionPoint), insertBlock: () => (insertBlock), insertBlocks: () => (insertBlocks), insertDefaultBlock: () => (insertDefaultBlock), lockPostAutosaving: () => (lockPostAutosaving), lockPostSaving: () => (lockPostSaving), mergeBlocks: () => (mergeBlocks), moveBlockToPosition: () => (moveBlockToPosition), moveBlocksDown: () => (moveBlocksDown), moveBlocksUp: () => (moveBlocksUp), multiSelect: () => (multiSelect), openPublishSidebar: () => (openPublishSidebar), receiveBlocks: () => (receiveBlocks), redo: () => (redo), refreshPost: () => (refreshPost), removeBlock: () => (removeBlock), removeBlocks: () => (removeBlocks), removeEditorPanel: () => (removeEditorPanel), replaceBlock: () => (replaceBlock), replaceBlocks: () => (replaceBlocks), resetBlocks: () => (resetBlocks), resetEditorBlocks: () => (resetEditorBlocks), resetPost: () => (resetPost), savePost: () => (savePost), selectBlock: () => (selectBlock), setDeviceType: () => (setDeviceType), setEditedPost: () => (setEditedPost), setIsInserterOpened: () => (setIsInserterOpened), setIsListViewOpened: () => (setIsListViewOpened), setRenderingMode: () => (setRenderingMode), setTemplateValidity: () => (setTemplateValidity), setupEditor: () => (setupEditor), setupEditorState: () => (setupEditorState), showInsertionPoint: () => (showInsertionPoint), startMultiSelect: () => (startMultiSelect), startTyping: () => (startTyping), stopMultiSelect: () => (stopMultiSelect), stopTyping: () => (stopTyping), switchEditorMode: () => (switchEditorMode), synchronizeTemplate: () => (synchronizeTemplate), toggleBlockMode: () => (toggleBlockMode), toggleDistractionFree: () => (toggleDistractionFree), toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled), toggleEditorPanelOpened: () => (toggleEditorPanelOpened), togglePublishSidebar: () => (togglePublishSidebar), toggleSelection: () => (toggleSelection), toggleSpotlightMode: () => (toggleSpotlightMode), toggleTopToolbar: () => (toggleTopToolbar), trashPost: () => (trashPost), undo: () => (undo), unlockPostAutosaving: () => (unlockPostAutosaving), unlockPostSaving: () => (unlockPostSaving), updateBlock: () => (updateBlock), updateBlockAttributes: () => (updateBlockAttributes), updateBlockListSettings: () => (updateBlockListSettings), updateEditorSettings: () => (updateEditorSettings), updatePost: () => (updatePost), updatePostLock: () => (updatePostLock) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js var store_actions_namespaceObject = {}; __webpack_require__.r(store_actions_namespaceObject); __webpack_require__.d(store_actions_namespaceObject, { closeModal: () => (closeModal), disableComplementaryArea: () => (disableComplementaryArea), enableComplementaryArea: () => (enableComplementaryArea), openModal: () => (openModal), pinItem: () => (pinItem), setDefaultComplementaryArea: () => (setDefaultComplementaryArea), setFeatureDefaults: () => (setFeatureDefaults), setFeatureValue: () => (setFeatureValue), toggleFeature: () => (toggleFeature), unpinItem: () => (unpinItem) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js var store_selectors_namespaceObject = {}; __webpack_require__.r(store_selectors_namespaceObject); __webpack_require__.d(store_selectors_namespaceObject, { getActiveComplementaryArea: () => (getActiveComplementaryArea), isComplementaryAreaLoading: () => (isComplementaryAreaLoading), isFeatureActive: () => (isFeatureActive), isItemPinned: () => (isItemPinned), isModalActive: () => (isModalActive) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/index.js var build_module_namespaceObject = {}; __webpack_require__.r(build_module_namespaceObject); __webpack_require__.d(build_module_namespaceObject, { ActionItem: () => (action_item), ComplementaryArea: () => (complementary_area), ComplementaryAreaMoreMenuItem: () => (ComplementaryAreaMoreMenuItem), FullscreenMode: () => (fullscreen_mode), InterfaceSkeleton: () => (interface_skeleton), NavigableRegion: () => (navigable_region), PinnedItems: () => (pinned_items), store: () => (store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-actions.js var store_private_actions_namespaceObject = {}; __webpack_require__.r(store_private_actions_namespaceObject); __webpack_require__.d(store_private_actions_namespaceObject, { createTemplate: () => (createTemplate), hideBlockTypes: () => (hideBlockTypes), registerEntityAction: () => (registerEntityAction), registerEntityField: () => (registerEntityField), registerPostTypeSchema: () => (registerPostTypeSchema), removeTemplates: () => (removeTemplates), revertTemplate: () => (private_actions_revertTemplate), saveDirtyEntities: () => (saveDirtyEntities), setCurrentTemplateId: () => (setCurrentTemplateId), setDefaultRenderingMode: () => (setDefaultRenderingMode), setIsReady: () => (setIsReady), showBlockTypes: () => (showBlockTypes), unregisterEntityAction: () => (unregisterEntityAction), unregisterEntityField: () => (unregisterEntityField) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js var store_private_selectors_namespaceObject = {}; __webpack_require__.r(store_private_selectors_namespaceObject); __webpack_require__.d(store_private_selectors_namespaceObject, { getDefaultRenderingMode: () => (getDefaultRenderingMode), getEntityActions: () => (private_selectors_getEntityActions), getEntityFields: () => (private_selectors_getEntityFields), getInserter: () => (getInserter), getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef), getListViewToggleRef: () => (getListViewToggleRef), getPostBlocksByName: () => (getPostBlocksByName), getPostIcon: () => (getPostIcon), hasPostMetaChanges: () => (hasPostMetaChanges), isEntityReady: () => (private_selectors_isEntityReady) }); ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// ./node_modules/@wordpress/editor/build-module/store/defaults.js /** * WordPress dependencies */ /** * The default post editor settings. * * @property {boolean|Array} allowedBlockTypes Allowed block types * @property {boolean} richEditingEnabled Whether rich editing is enabled or not * @property {boolean} codeEditingEnabled Whether code editing is enabled or not * @property {boolean} fontLibraryEnabled Whether the font library is enabled or not. * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not. * true = the user has opted to show the Custom Fields panel at the bottom of the editor. * false = the user has opted to hide the Custom Fields panel at the bottom of the editor. * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed. * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API. * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage. * @property {Array?} availableTemplates The available post templates * @property {boolean} disablePostFormats Whether or not the post formats are disabled * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions * @property {number} maxUploadFileSize Maximum upload file size * @property {boolean} supportsLayout Whether the editor supports layouts. */ const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS, richEditingEnabled: true, codeEditingEnabled: true, fontLibraryEnabled: true, enableCustomFields: undefined, defaultRenderingMode: 'post-only' }; ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/reducer.js /** * WordPress dependencies */ function isReady(state = {}, action) { switch (action.type) { case 'SET_IS_READY': return { ...state, [action.kind]: { ...state[action.kind], [action.name]: true } }; } return state; } function actions(state = {}, action) { var _state$action$kind$ac; switch (action.type) { case 'REGISTER_ENTITY_ACTION': return { ...state, [action.kind]: { ...state[action.kind], [action.name]: [...((_state$action$kind$ac = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac !== void 0 ? _state$action$kind$ac : []).filter(_action => _action.id !== action.config.id), action.config] } }; case 'UNREGISTER_ENTITY_ACTION': { var _state$action$kind$ac2; return { ...state, [action.kind]: { ...state[action.kind], [action.name]: ((_state$action$kind$ac2 = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac2 !== void 0 ? _state$action$kind$ac2 : []).filter(_action => _action.id !== action.actionId) } }; } } return state; } function fields(state = {}, action) { var _state$action$kind$ac3, _state$action$kind$ac4; switch (action.type) { case 'REGISTER_ENTITY_FIELD': return { ...state, [action.kind]: { ...state[action.kind], [action.name]: [...((_state$action$kind$ac3 = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac3 !== void 0 ? _state$action$kind$ac3 : []).filter(_field => _field.id !== action.config.id), action.config] } }; case 'UNREGISTER_ENTITY_FIELD': return { ...state, [action.kind]: { ...state[action.kind], [action.name]: ((_state$action$kind$ac4 = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac4 !== void 0 ? _state$action$kind$ac4 : []).filter(_field => _field.id !== action.fieldId) } }; } return state; } /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ actions, fields, isReady })); ;// ./node_modules/@wordpress/editor/build-module/store/reducer.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns a post attribute value, flattening nested rendered content using its * raw value in place of its original object form. * * @param {*} value Original value. * * @return {*} Raw value. */ function getPostRawValue(value) { if (value && 'object' === typeof value && 'raw' in value) { return value.raw; } return value; } /** * Returns true if the two object arguments have the same keys, or false * otherwise. * * @param {Object} a First object. * @param {Object} b Second object. * * @return {boolean} Whether the two objects have the same keys. */ function hasSameKeys(a, b) { const keysA = Object.keys(a).sort(); const keysB = Object.keys(b).sort(); return keysA.length === keysB.length && keysA.every((key, index) => keysB[index] === key); } /** * Returns true if, given the currently dispatching action and the previously * dispatched action, the two actions are editing the same post property, or * false otherwise. * * @param {Object} action Currently dispatching action. * @param {Object} previousAction Previously dispatched action. * * @return {boolean} Whether actions are updating the same post property. */ function isUpdatingSamePostProperty(action, previousAction) { return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits); } /** * Returns true if, given the currently dispatching action and the previously * dispatched action, the two actions are modifying the same property such that * undo history should be batched. * * @param {Object} action Currently dispatching action. * @param {Object} previousAction Previously dispatched action. * * @return {boolean} Whether to overwrite present state. */ function shouldOverwriteState(action, previousAction) { if (action.type === 'RESET_EDITOR_BLOCKS') { return !action.shouldCreateUndoLevel; } if (!previousAction || action.type !== previousAction.type) { return false; } return isUpdatingSamePostProperty(action, previousAction); } function postId(state = null, action) { switch (action.type) { case 'SET_EDITED_POST': return action.postId; } return state; } function templateId(state = null, action) { switch (action.type) { case 'SET_CURRENT_TEMPLATE_ID': return action.id; } return state; } function postType(state = null, action) { switch (action.type) { case 'SET_EDITED_POST': return action.postType; } return state; } /** * Reducer returning whether the post blocks match the defined template or not. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function template(state = { isValid: true }, action) { switch (action.type) { case 'SET_TEMPLATE_VALIDITY': return { ...state, isValid: action.isValid }; } return state; } /** * Reducer returning current network request state (whether a request to * the WP REST API is in progress, successful, or failed). * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function saving(state = {}, action) { switch (action.type) { case 'REQUEST_POST_UPDATE_START': case 'REQUEST_POST_UPDATE_FINISH': return { pending: action.type === 'REQUEST_POST_UPDATE_START', options: action.options || {} }; } return state; } /** * Reducer returning deleting post request state. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function deleting(state = {}, action) { switch (action.type) { case 'REQUEST_POST_DELETE_START': case 'REQUEST_POST_DELETE_FINISH': return { pending: action.type === 'REQUEST_POST_DELETE_START' }; } return state; } /** * Post Lock State. * * @typedef {Object} PostLockState * * @property {boolean} isLocked Whether the post is locked. * @property {?boolean} isTakeover Whether the post editing has been taken over. * @property {?boolean} activePostLock Active post lock value. * @property {?Object} user User that took over the post. */ /** * Reducer returning the post lock status. * * @param {PostLockState} state Current state. * @param {Object} action Dispatched action. * * @return {PostLockState} Updated state. */ function postLock(state = { isLocked: false }, action) { switch (action.type) { case 'UPDATE_POST_LOCK': return action.lock; } return state; } /** * Post saving lock. * * When post saving is locked, the post cannot be published or updated. * * @param {PostLockState} state Current state. * @param {Object} action Dispatched action. * * @return {PostLockState} Updated state. */ function postSavingLock(state = {}, action) { switch (action.type) { case 'LOCK_POST_SAVING': return { ...state, [action.lockName]: true }; case 'UNLOCK_POST_SAVING': { const { [action.lockName]: removedLockName, ...restState } = state; return restState; } } return state; } /** * Post autosaving lock. * * When post autosaving is locked, the post will not autosave. * * @param {PostLockState} state Current state. * @param {Object} action Dispatched action. * * @return {PostLockState} Updated state. */ function postAutosavingLock(state = {}, action) { switch (action.type) { case 'LOCK_POST_AUTOSAVING': return { ...state, [action.lockName]: true }; case 'UNLOCK_POST_AUTOSAVING': { const { [action.lockName]: removedLockName, ...restState } = state; return restState; } } return state; } /** * Reducer returning the post editor setting. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) { switch (action.type) { case 'UPDATE_EDITOR_SETTINGS': return { ...state, ...action.settings }; } return state; } function renderingMode(state = 'post-only', action) { switch (action.type) { case 'SET_RENDERING_MODE': return action.mode; } return state; } /** * Reducer returning the editing canvas device type. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function deviceType(state = 'Desktop', action) { switch (action.type) { case 'SET_DEVICE_TYPE': return action.deviceType; } return state; } /** * Reducer storing the list of all programmatically removed panels. * * @param {Array} state Current state. * @param {Object} action Action object. * * @return {Array} Updated state. */ function removedPanels(state = [], action) { switch (action.type) { case 'REMOVE_PANEL': if (!state.includes(action.panelName)) { return [...state, action.panelName]; } } return state; } /** * Reducer to set the block inserter panel open or closed. * * Note: this reducer interacts with the list view panel reducer * to make sure that only one of the two panels is open at the same time. * * @param {Object} state Current state. * @param {Object} action Dispatched action. */ function blockInserterPanel(state = false, action) { switch (action.type) { case 'SET_IS_LIST_VIEW_OPENED': return action.isOpen ? false : state; case 'SET_IS_INSERTER_OPENED': return action.value; } return state; } /** * Reducer to set the list view panel open or closed. * * Note: this reducer interacts with the inserter panel reducer * to make sure that only one of the two panels is open at the same time. * * @param {Object} state Current state. * @param {Object} action Dispatched action. */ function listViewPanel(state = false, action) { switch (action.type) { case 'SET_IS_INSERTER_OPENED': return action.value ? false : state; case 'SET_IS_LIST_VIEW_OPENED': return action.isOpen; } return state; } /** * This reducer does nothing aside initializing a ref to the list view toggle. * We will have a unique ref per "editor" instance. * * @param {Object} state * @return {Object} Reference to the list view toggle button. */ function listViewToggleRef(state = { current: null }) { return state; } /** * This reducer does nothing aside initializing a ref to the inserter sidebar toggle. * We will have a unique ref per "editor" instance. * * @param {Object} state * @return {Object} Reference to the inserter sidebar toggle button. */ function inserterSidebarToggleRef(state = { current: null }) { return state; } function publishSidebarActive(state = false, action) { switch (action.type) { case 'OPEN_PUBLISH_SIDEBAR': return true; case 'CLOSE_PUBLISH_SIDEBAR': return false; case 'TOGGLE_PUBLISH_SIDEBAR': return !state; } return state; } /* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ postId, postType, templateId, saving, deleting, postLock, template, postSavingLock, editorSettings, postAutosavingLock, renderingMode, deviceType, removedPanels, blockInserterPanel, inserterSidebarToggleRef, listViewPanel, listViewToggleRef, publishSidebarActive, dataviews: reducer })); ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","date"] const external_wp_date_namespaceObject = window["wp"]["date"]; ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// external ["wp","preferences"] const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// ./node_modules/@wordpress/editor/build-module/store/constants.js /** * Set of post properties for which edits should assume a merging behavior, * assuming an object value. * * @type {Set} */ const EDIT_MERGE_PROPERTIES = new Set(['meta']); /** * Constant for the store module (or reducer) key. */ const STORE_NAME = 'core/editor'; const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; const ONE_MINUTE_IN_MS = 60 * 1000; const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized'; const TEMPLATE_POST_TYPE = 'wp_template'; const TEMPLATE_PART_POST_TYPE = 'wp_template_part'; const PATTERN_POST_TYPE = 'wp_block'; const NAVIGATION_POST_TYPE = 'wp_navigation'; const TEMPLATE_ORIGINS = { custom: 'custom', theme: 'theme', plugin: 'plugin' }; const TEMPLATE_POST_TYPES = ['wp_template', 'wp_template_part']; const GLOBAL_POST_TYPES = [...TEMPLATE_POST_TYPES, 'wp_block', 'wp_navigation']; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/icons/build-module/library/header.js /** * WordPress dependencies */ const header = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); /* harmony default export */ const library_header = (header); ;// ./node_modules/@wordpress/icons/build-module/library/footer.js /** * WordPress dependencies */ const footer = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); /* harmony default export */ const library_footer = (footer); ;// ./node_modules/@wordpress/icons/build-module/library/sidebar.js /** * WordPress dependencies */ const sidebar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); /* harmony default export */ const library_sidebar = (sidebar); ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js /** * WordPress dependencies */ const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); /* harmony default export */ const symbol_filled = (symbolFilled); ;// ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js /** * WordPress dependencies */ /** * Helper function to retrieve the corresponding icon by name. * * @param {string} iconName The name of the icon. * * @return {Object} The corresponding icon. */ function getTemplatePartIcon(iconName) { if ('header' === iconName) { return library_header; } else if ('footer' === iconName) { return library_footer; } else if ('sidebar' === iconName) { return library_sidebar; } return symbol_filled; } ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/editor/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/editor'); ;// ./node_modules/@wordpress/icons/build-module/library/layout.js /** * WordPress dependencies */ const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); /* harmony default export */ const library_layout = (layout); ;// ./node_modules/@wordpress/editor/build-module/utils/get-template-info.js /** * WordPress dependencies */ /** * Internal dependencies */ const EMPTY_OBJECT = {}; /** * Helper function to retrieve the corresponding template info for a given template. * @param {Object} params * @param {Array} params.templateTypes * @param {Array} [params.templateAreas] * @param {Object} params.template */ const getTemplateInfo = params => { var _Object$values$find; if (!params) { return EMPTY_OBJECT; } const { templateTypes, templateAreas, template } = params; const { description, slug, title, area } = template; const { title: defaultTitle, description: defaultDescription } = (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT; const templateTitle = typeof title === 'string' ? title : title?.rendered; const templateDescription = typeof description === 'string' ? description : description?.raw; const templateAreasWithIcon = templateAreas?.map(item => ({ ...item, icon: getTemplatePartIcon(item.icon) })); const templateIcon = templateAreasWithIcon?.find(item => area === item.area)?.icon || library_layout; return { title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, description: templateDescription || defaultDescription, icon: templateIcon }; }; ;// ./node_modules/@wordpress/editor/build-module/store/selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Shared reference to an empty object for cases where it is important to avoid * returning a new object reference on every invocation, as in a connected or * other pure component which performs `shouldComponentUpdate` check on props. * This should be used as a last resort, since the normalized data should be * maintained by the reducer result in state. */ const selectors_EMPTY_OBJECT = {}; /** * Returns true if any past editor history snapshots exist, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether undo history exists. */ const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { return select(external_wp_coreData_namespaceObject.store).hasUndo(); }); /** * Returns true if any future editor history snapshots exist, or false * otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether redo history exists. */ const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { return select(external_wp_coreData_namespaceObject.store).hasRedo(); }); /** * Returns true if the currently edited post is yet to be saved, or false if * the post has been saved. * * @param {Object} state Global application state. * * @return {boolean} Whether the post is new. */ function isEditedPostNew(state) { return getCurrentPost(state).status === 'auto-draft'; } /** * Returns true if content includes unsaved changes, or false otherwise. * * @param {Object} state Editor state. * * @return {boolean} Whether content includes unsaved changes. */ function hasChangedContent(state) { const edits = getPostEdits(state); return 'content' in edits; } /** * Returns true if there are unsaved values for the current edit session, or * false if the editing state matches the saved or new post. * * @param {Object} state Global application state. * * @return {boolean} Whether unsaved values exist. */ const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { // Edits should contain only fields which differ from the saved post (reset // at initial load and save complete). Thus, a non-empty edits state can be // inferred to contain unsaved values. const postType = getCurrentPostType(state); const postId = getCurrentPostId(state); return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId); }); /** * Returns true if there are unsaved edits for entities other than * the editor's post, and false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether there are edits or not. */ const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); const { type, id } = getCurrentPost(state); return dirtyEntityRecords.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); }); /** * Returns true if there are no unsaved values for the current edit session and * if the currently edited post is new (has never been saved before). * * @param {Object} state Global application state. * * @return {boolean} Whether new post and unsaved values exist. */ function isCleanNewPost(state) { return !isEditedPostDirty(state) && isEditedPostNew(state); } /** * Returns the post currently being edited in its last known saved state, not * including unsaved edits. Returns an object containing relevant default post * values if the post has not yet been saved. * * @param {Object} state Global application state. * * @return {Object} Post object. */ const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { const postId = getCurrentPostId(state); const postType = getCurrentPostType(state); const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId); if (post) { return post; } // This exists for compatibility with the previous selector behavior // which would guarantee an object return based on the editor reducer's // default empty object state. return selectors_EMPTY_OBJECT; }); /** * Returns the post type of the post currently being edited. * * @param {Object} state Global application state. * * @example * *```js * const currentPostType = wp.data.select( 'core/editor' ).getCurrentPostType(); *``` * @return {string} Post type. */ function getCurrentPostType(state) { return state.postType; } /** * Returns the ID of the post currently being edited, or null if the post has * not yet been saved. * * @param {Object} state Global application state. * * @return {?number} ID of current post. */ function getCurrentPostId(state) { return state.postId; } /** * Returns the template ID currently being rendered/edited * * @param {Object} state Global application state. * * @return {?string} Template ID. */ function getCurrentTemplateId(state) { return state.templateId; } /** * Returns the number of revisions of the post currently being edited. * * @param {Object} state Global application state. * * @return {number} Number of revisions. */ function getCurrentPostRevisionsCount(state) { var _getCurrentPost$_link; return (_getCurrentPost$_link = getCurrentPost(state)._links?.['version-history']?.[0]?.count) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : 0; } /** * Returns the last revision ID of the post currently being edited, * or null if the post has no revisions. * * @param {Object} state Global application state. * * @return {?number} ID of the last revision. */ function getCurrentPostLastRevisionId(state) { var _getCurrentPost$_link2; return (_getCurrentPost$_link2 = getCurrentPost(state)._links?.['predecessor-version']?.[0]?.id) !== null && _getCurrentPost$_link2 !== void 0 ? _getCurrentPost$_link2 : null; } /** * Returns any post values which have been changed in the editor but not yet * been saved. * * @param {Object} state Global application state. * * @return {Object} Object of key value pairs comprising unsaved edits. */ const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { const postType = getCurrentPostType(state); const postId = getCurrentPostId(state); return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || selectors_EMPTY_OBJECT; }); /** * Returns an attribute value of the saved post. * * @param {Object} state Global application state. * @param {string} attributeName Post attribute name. * * @return {*} Post attribute value. */ function getCurrentPostAttribute(state, attributeName) { switch (attributeName) { case 'type': return getCurrentPostType(state); case 'id': return getCurrentPostId(state); default: const post = getCurrentPost(state); if (!post.hasOwnProperty(attributeName)) { break; } return getPostRawValue(post[attributeName]); } } /** * Returns a single attribute of the post being edited, preferring the unsaved * edit if one exists, but merging with the attribute value for the last known * saved state of the post (this is needed for some nested attributes like meta). * * @param {Object} state Global application state. * @param {string} attributeName Post attribute name. * * @return {*} Post attribute value. */ const getNestedEditedPostProperty = (0,external_wp_data_namespaceObject.createSelector)((state, attributeName) => { const edits = getPostEdits(state); if (!edits.hasOwnProperty(attributeName)) { return getCurrentPostAttribute(state, attributeName); } return { ...getCurrentPostAttribute(state, attributeName), ...edits[attributeName] }; }, (state, attributeName) => [getCurrentPostAttribute(state, attributeName), getPostEdits(state)[attributeName]]); /** * Returns a single attribute of the post being edited, preferring the unsaved * edit if one exists, but falling back to the attribute for the last known * saved state of the post. * * @param {Object} state Global application state. * @param {string} attributeName Post attribute name. * * @example * *```js * // Get specific media size based on the featured media ID * // Note: change sizes?.large for any registered size * const getFeaturedMediaUrl = useSelect( ( select ) => { * const getFeaturedMediaId = * select( 'core/editor' ).getEditedPostAttribute( 'featured_media' ); * const getMedia = select( 'core' ).getMedia( getFeaturedMediaId ); * * return ( * getMedia?.media_details?.sizes?.large?.source_url || getMedia?.source_url || '' * ); * }, [] ); *``` * * @return {*} Post attribute value. */ function getEditedPostAttribute(state, attributeName) { // Special cases. switch (attributeName) { case 'content': return getEditedPostContent(state); } // Fall back to saved post value if not edited. const edits = getPostEdits(state); if (!edits.hasOwnProperty(attributeName)) { return getCurrentPostAttribute(state, attributeName); } // Merge properties are objects which contain only the patch edit in state, // and thus must be merged with the current post attribute. if (EDIT_MERGE_PROPERTIES.has(attributeName)) { return getNestedEditedPostProperty(state, attributeName); } return edits[attributeName]; } /** * Returns an attribute value of the current autosave revision for a post, or * null if there is no autosave for the post. * * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector * from the '@wordpress/core-data' package and access properties on the returned * autosave object using getPostRawValue. * * @param {Object} state Global application state. * @param {string} attributeName Autosave attribute name. * * @return {*} Autosave attribute value. */ const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => { if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== 'preview_link') { return; } const postType = getCurrentPostType(state); // Currently template autosaving is not supported. if (postType === 'wp_template') { return false; } const postId = getCurrentPostId(state); const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); if (autosave) { return getPostRawValue(autosave[attributeName]); } }); /** * Returns the current visibility of the post being edited, preferring the * unsaved value if different than the saved post. The return value is one of * "private", "password", or "public". * * @param {Object} state Global application state. * * @return {string} Post visibility. */ function getEditedPostVisibility(state) { const status = getEditedPostAttribute(state, 'status'); if (status === 'private') { return 'private'; } const password = getEditedPostAttribute(state, 'password'); if (password) { return 'password'; } return 'public'; } /** * Returns true if post is pending review. * * @param {Object} state Global application state. * * @return {boolean} Whether current post is pending review. */ function isCurrentPostPending(state) { return getCurrentPost(state).status === 'pending'; } /** * Return true if the current post has already been published. * * @param {Object} state Global application state. * @param {Object} [currentPost] Explicit current post for bypassing registry selector. * * @return {boolean} Whether the post has been published. */ function isCurrentPostPublished(state, currentPost) { const post = currentPost || getCurrentPost(state); return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !(0,external_wp_date_namespaceObject.isInTheFuture)(new Date(Number((0,external_wp_date_namespaceObject.getDate)(post.date)) - ONE_MINUTE_IN_MS)); } /** * Returns true if post is already scheduled. * * @param {Object} state Global application state. * * @return {boolean} Whether current post is scheduled to be posted. */ function isCurrentPostScheduled(state) { return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state); } /** * Return true if the post being edited can be published. * * @param {Object} state Global application state. * * @return {boolean} Whether the post can been published. */ function isEditedPostPublishable(state) { const post = getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post // being saveable. Currently this restriction is imposed at UI. // // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`). return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1; } /** * Returns true if the post can be saved, or false otherwise. A post must * contain a title, an excerpt, or non-empty content to be valid for save. * * @param {Object} state Global application state. * * @return {boolean} Whether the post can be saved. */ function isEditedPostSaveable(state) { if (isSavingPost(state)) { return false; } // TODO: Post should not be saveable if not dirty. Cannot be added here at // this time since posts where meta boxes are present can be saved even if // the post is not dirty. Currently this restriction is imposed at UI, but // should be moved here. // // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition) // See: <PostSavedState /> (`forceIsDirty` prop) // See: <PostPublishButton /> (`forceIsDirty` prop) // See: https://github.com/WordPress/gutenberg/pull/4184. return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native'; } /** * Returns true if the edited post has content. A post has content if it has at * least one saveable block or otherwise has a non-empty content property * assigned. * * @param {Object} state Global application state. * * @return {boolean} Whether post has content. */ const isEditedPostEmpty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { // While the condition of truthy content string is sufficient to determine // emptiness, testing saveable blocks length is a trivial operation. Since // this function can be called frequently, optimize for the fast case as a // condition of the mere existence of blocks. Note that the value of edited // content takes precedent over block content, and must fall through to the // default logic. const postId = getCurrentPostId(state); const postType = getCurrentPostType(state); const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); if (typeof record.content !== 'function') { return !record.content; } const blocks = getEditedPostAttribute(state, 'blocks'); if (blocks.length === 0) { return true; } // Pierce the abstraction of the serializer in knowing that blocks are // joined with newlines such that even if every individual block // produces an empty save result, the serialized content is non-empty. if (blocks.length > 1) { return false; } // There are two conditions under which the optimization cannot be // assumed, and a fallthrough to getEditedPostContent must occur: // // 1. getBlocksForSerialization has special treatment in omitting a // single unmodified default block. // 2. Comment delimiters are omitted for a freeform or unregistered // block in its serialization. The freeform block specifically may // produce an empty string in its saved output. // // For all other content, the single block is assumed to make a post // non-empty, if only by virtue of its own comment delimiters. const blockName = blocks[0].name; if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) { return false; } return !getEditedPostContent(state); }); /** * Returns true if the post can be autosaved, or false otherwise. * * @param {Object} state Global application state. * @param {Object} autosave A raw autosave object from the REST API. * * @return {boolean} Whether the post can be autosaved. */ const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. if (!isEditedPostSaveable(state)) { return false; } // A post is not autosavable when there is a post autosave lock. if (isPostAutosavingLocked(state)) { return false; } const postType = getCurrentPostType(state); // Currently template autosaving is not supported. if (postType === 'wp_template') { return false; } const postId = getCurrentPostId(state); const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId); const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; // Disable reason - this line causes the side-effect of fetching the autosave // via a resolver, moving below the return would result in the autosave never // being fetched. // eslint-disable-next-line @wordpress/no-unused-vars-before-return const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is // unable to determine if the post is autosaveable, so return false. if (!hasFetchedAutosave) { return false; } // If we don't already have an autosave, the post is autosaveable. if (!autosave) { return true; } // To avoid an expensive content serialization, use the content dirtiness // flag in place of content field comparison against the known autosave. // This is not strictly accurate, and relies on a tolerance toward autosave // request failures for unnecessary saves. if (hasChangedContent(state)) { return true; } // If title, excerpt, or meta have changed, the post is autosaveable. return ['title', 'excerpt', 'meta'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field)); }); /** * Return true if the post being edited is being scheduled. Preferring the * unsaved status values. * * @param {Object} state Global application state. * * @return {boolean} Whether the post has been published. */ function isEditedPostBeingScheduled(state) { const date = getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency). const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS); return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate); } /** * Returns whether the current post should be considered to have a "floating" * date (i.e. that it would publish "Immediately" rather than at a set time). * * Unlike in the PHP backend, the REST API returns a full date string for posts * where the 0000-00-00T00:00:00 placeholder is present in the database. To * infer that a post is set to publish "Immediately" we check whether the date * and modified date are the same. * * @param {Object} state Editor state. * * @return {boolean} Whether the edited post has a floating date value. */ function isEditedPostDateFloating(state) { const date = getEditedPostAttribute(state, 'date'); const modified = getEditedPostAttribute(state, 'modified'); // This should be the status of the persisted post // It shouldn't use the "edited" status otherwise it breaks the // inferred post data floating status // See https://github.com/WordPress/gutenberg/issues/28083. const status = getCurrentPost(state).status; if (status === 'draft' || status === 'auto-draft' || status === 'pending') { return date === modified || date === null; } return false; } /** * Returns true if the post is currently being deleted, or false otherwise. * * @param {Object} state Editor state. * * @return {boolean} Whether post is being deleted. */ function isDeletingPost(state) { return !!state.deleting.pending; } /** * Returns true if the post is currently being saved, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether post is being saved. */ function isSavingPost(state) { return !!state.saving.pending; } /** * Returns true if non-post entities are currently being saved, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether non-post entities are being saved. */ const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved(); const { type, id } = getCurrentPost(state); return entitiesBeingSaved.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); }); /** * Returns true if a previous post save was attempted successfully, or false * otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the post was saved successfully. */ const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { const postType = getCurrentPostType(state); const postId = getCurrentPostId(state); return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); }); /** * Returns true if a previous post save was attempted but failed, or false * otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the post save failed. */ const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { const postType = getCurrentPostType(state); const postId = getCurrentPostId(state); return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); }); /** * Returns true if the post is autosaving, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the post is autosaving. */ function isAutosavingPost(state) { return isSavingPost(state) && Boolean(state.saving.options?.isAutosave); } /** * Returns true if the post is being previewed, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the post is being previewed. */ function isPreviewingPost(state) { return isSavingPost(state) && Boolean(state.saving.options?.isPreview); } /** * Returns the post preview link * * @param {Object} state Global application state. * * @return {string | undefined} Preview Link. */ function getEditedPostPreviewLink(state) { if (state.saving.pending || isSavingPost(state)) { return; } let previewLink = getAutosaveAttribute(state, 'preview_link'); // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616 // If the post is draft, ignore the preview link from the autosave record, // because the preview could be a stale autosave if the post was switched from // published to draft. // See: https://github.com/WordPress/gutenberg/pull/37952. if (!previewLink || 'draft' === getCurrentPost(state).status) { previewLink = getEditedPostAttribute(state, 'link'); if (previewLink) { previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { preview: true }); } } const featuredImageId = getEditedPostAttribute(state, 'featured_media'); if (previewLink && featuredImageId) { return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { _thumbnail_id: featuredImageId }); } return previewLink; } /** * Returns a suggested post format for the current post, inferred only if there * is a single block within the post and it is of a type known to match a * default post format. Returns null if the format cannot be determined. * * @return {?string} Suggested post format. */ const getSuggestedPostFormat = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); if (blocks.length > 2) { return null; } let name; // If there is only one block in the content of the post grab its name // so we can derive a suitable post format from it. if (blocks.length === 1) { name = blocks[0].name; // Check for core/embed `video` and `audio` eligible suggestions. if (name === 'core/embed') { const provider = blocks[0].attributes?.providerNameSlug; if (['youtube', 'vimeo'].includes(provider)) { name = 'core/video'; } else if (['spotify', 'soundcloud'].includes(provider)) { name = 'core/audio'; } } } // If there are two blocks in the content and the last one is a text blocks // grab the name of the first one to also suggest a post format from it. if (blocks.length === 2 && blocks[1].name === 'core/paragraph') { name = blocks[0].name; } // We only convert to default post formats in core. switch (name) { case 'core/image': return 'image'; case 'core/quote': case 'core/pullquote': return 'quote'; case 'core/gallery': return 'gallery'; case 'core/video': return 'video'; case 'core/audio': return 'audio'; default: return null; } }); /** * Returns the content of the post being edited. * * @param {Object} state Global application state. * * @return {string} Post content. */ const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { const postId = getCurrentPostId(state); const postType = getCurrentPostType(state); const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); if (record) { if (typeof record.content === 'function') { return record.content(record); } else if (record.blocks) { return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); } else if (record.content) { return record.content; } } return ''; }); /** * Returns true if the post is being published, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether post is being published. */ function isPublishingPost(state) { return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish'; } /** * Returns whether the permalink is editable or not. * * @param {Object} state Editor state. * * @return {boolean} Whether or not the permalink is editable. */ function isPermalinkEditable(state) { const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); } /** * Returns the permalink for the post. * * @param {Object} state Editor state. * * @return {?string} The permalink, or null if the post is not viewable. */ function getPermalink(state) { const permalinkParts = getPermalinkParts(state); if (!permalinkParts) { return null; } const { prefix, postName, suffix } = permalinkParts; if (isPermalinkEditable(state)) { return prefix + postName + suffix; } return prefix; } /** * Returns the slug for the post being edited, preferring a manually edited * value if one exists, then a sanitized version of the current post title, and * finally the post ID. * * @param {Object} state Editor state. * * @return {string} The current slug to be displayed in the editor */ function getEditedPostSlug(state) { return getEditedPostAttribute(state, 'slug') || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state); } /** * Returns the permalink for a post, split into its three parts: the prefix, * the postName, and the suffix. * * @param {Object} state Editor state. * * @return {Object} An object containing the prefix, postName, and suffix for * the permalink, or null if the post is not viewable. */ function getPermalinkParts(state) { const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); if (!permalinkTemplate) { return null; } const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug'); const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); return { prefix, postName, suffix }; } /** * Returns whether the post is locked. * * @param {Object} state Global application state. * * @return {boolean} Is locked. */ function isPostLocked(state) { return state.postLock.isLocked; } /** * Returns whether post saving is locked. * * @param {Object} state Global application state. * * @return {boolean} Is locked. */ function isPostSavingLocked(state) { return Object.keys(state.postSavingLock).length > 0; } /** * Returns whether post autosaving is locked. * * @param {Object} state Global application state. * * @return {boolean} Is locked. */ function isPostAutosavingLocked(state) { return Object.keys(state.postAutosavingLock).length > 0; } /** * Returns whether the edition of the post has been taken over. * * @param {Object} state Global application state. * * @return {boolean} Is post lock takeover. */ function isPostLockTakeover(state) { return state.postLock.isTakeover; } /** * Returns details about the post lock user. * * @param {Object} state Global application state. * * @return {Object} A user object. */ function getPostLockUser(state) { return state.postLock.user; } /** * Returns the active post lock. * * @param {Object} state Global application state. * * @return {Object} The lock object. */ function getActivePostLock(state) { return state.postLock.activePostLock; } /** * Returns whether or not the user has the unfiltered_html capability. * * @param {Object} state Editor state. * * @return {boolean} Whether the user can or can't post unfiltered HTML. */ function canUserUseUnfilteredHTML(state) { return Boolean(getCurrentPost(state)._links?.hasOwnProperty('wp:action-unfiltered-html')); } /** * Returns whether the pre-publish panel should be shown * or skipped when the user clicks the "publish" button. * * @return {boolean} Whether the pre-publish panel should be shown or not. */ const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core', 'isPublishSidebarEnabled')); /** * Return the current block list. * * @param {Object} state * @return {Array} Block list. */ const getEditorBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => { return getEditedPostAttribute(state, 'blocks') || (0,external_wp_blocks_namespaceObject.parse)(getEditedPostContent(state)); }, state => [getEditedPostAttribute(state, 'blocks'), getEditedPostContent(state)]); /** * Returns true if the given panel was programmatically removed, or false otherwise. * All panels are not removed by default. * * @param {Object} state Global application state. * @param {string} panelName A string that identifies the panel. * * @return {boolean} Whether or not the panel is removed. */ function isEditorPanelRemoved(state, panelName) { return state.removedPanels.includes(panelName); } /** * Returns true if the given panel is enabled, or false otherwise. Panels are * enabled by default. * * @param {Object} state Global application state. * @param {string} panelName A string that identifies the panel. * * @return {boolean} Whether or not the panel is enabled. */ const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { // For backward compatibility, we check edit-post // even though now this is in "editor" package. const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels'); return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName); }); /** * Returns true if the given panel is open, or false otherwise. Panels are * closed by default. * * @param {Object} state Global application state. * @param {string} panelName A string that identifies the panel. * * @return {boolean} Whether or not the panel is open. */ const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { // For backward compatibility, we check edit-post // even though now this is in "editor" package. const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels'); return !!openPanels?.includes(panelName); }); /** * A block selection object. * * @typedef {Object} WPBlockSelection * * @property {string} clientId A block client ID. * @property {string} attributeKey A block attribute key. * @property {number} offset An attribute value offset, based on the rich * text value. See `wp.richText.create`. */ /** * Returns the current selection start. * * @deprecated since Gutenberg 10.0.0. * * @param {Object} state * @return {WPBlockSelection} The selection start. */ function getEditorSelectionStart(state) { external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { since: '5.8', alternative: "select('core/editor').getEditorSelection" }); return getEditedPostAttribute(state, 'selection')?.selectionStart; } /** * Returns the current selection end. * * @deprecated since Gutenberg 10.0.0. * * @param {Object} state * @return {WPBlockSelection} The selection end. */ function getEditorSelectionEnd(state) { external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { since: '5.8', alternative: "select('core/editor').getEditorSelection" }); return getEditedPostAttribute(state, 'selection')?.selectionEnd; } /** * Returns the current selection. * * @param {Object} state * @return {WPBlockSelection} The selection end. */ function getEditorSelection(state) { return getEditedPostAttribute(state, 'selection'); } /** * Is the editor ready * * @param {Object} state * @return {boolean} is Ready. */ function __unstableIsEditorReady(state) { return !!state.postId; } /** * Returns the post editor settings. * * @param {Object} state Editor state. * * @return {Object} The editor settings object. */ function getEditorSettings(state) { return state.editorSettings; } /** * Returns the post editor's rendering mode. * * @param {Object} state Editor state. * * @return {string} Rendering mode. */ function getRenderingMode(state) { return state.renderingMode; } /** * Returns the current editing canvas device type. * * @param {Object} state Global application state. * * @return {string} Device type. */ const getDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { const isZoomOut = unlock(select(external_wp_blockEditor_namespaceObject.store)).isZoomOut(); if (isZoomOut) { return 'Desktop'; } return state.deviceType; }); /** * Returns true if the list view is opened. * * @param {Object} state Global application state. * * @return {boolean} Whether the list view is opened. */ function isListViewOpened(state) { return state.listViewPanel; } /** * Returns true if the inserter is opened. * * @param {Object} state Global application state. * * @return {boolean} Whether the inserter is opened. */ function isInserterOpened(state) { return !!state.blockInserterPanel; } /** * Returns the current editing mode. * * @param {Object} state Global application state. * * @return {string} Editing mode. */ const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { var _select$get; return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; }); /* * Backward compatibility */ /** * Returns state object prior to a specified optimist transaction ID, or `null` * if the transaction corresponding to the given ID cannot be found. * * @deprecated since Gutenberg 9.7.0. */ function getStateBeforeOptimisticTransaction() { external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", { since: '5.7', hint: 'No state history is kept on this store anymore' }); return null; } /** * Returns true if an optimistic transaction is pending commit, for which the * before state satisfies the given predicate function. * * @deprecated since Gutenberg 9.7.0. */ function inSomeHistory() { external_wp_deprecated_default()("select('core/editor').inSomeHistory", { since: '5.7', hint: 'No state history is kept on this store anymore' }); return false; } function getBlockEditorSelector(name) { return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ...args) => { external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { since: '5.3', alternative: "`wp.data.select( 'core/block-editor' )." + name + '`', version: '6.2' }); return select(external_wp_blockEditor_namespaceObject.store)[name](...args); }); } /** * @see getBlockName in core/block-editor store. */ const getBlockName = getBlockEditorSelector('getBlockName'); /** * @see isBlockValid in core/block-editor store. */ const isBlockValid = getBlockEditorSelector('isBlockValid'); /** * @see getBlockAttributes in core/block-editor store. */ const getBlockAttributes = getBlockEditorSelector('getBlockAttributes'); /** * @see getBlock in core/block-editor store. */ const getBlock = getBlockEditorSelector('getBlock'); /** * @see getBlocks in core/block-editor store. */ const getBlocks = getBlockEditorSelector('getBlocks'); /** * @see getClientIdsOfDescendants in core/block-editor store. */ const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); /** * @see getClientIdsWithDescendants in core/block-editor store. */ const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); /** * @see getGlobalBlockCount in core/block-editor store. */ const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); /** * @see getBlocksByClientId in core/block-editor store. */ const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); /** * @see getBlockCount in core/block-editor store. */ const getBlockCount = getBlockEditorSelector('getBlockCount'); /** * @see getBlockSelectionStart in core/block-editor store. */ const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart'); /** * @see getBlockSelectionEnd in core/block-editor store. */ const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd'); /** * @see getSelectedBlockCount in core/block-editor store. */ const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount'); /** * @see hasSelectedBlock in core/block-editor store. */ const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock'); /** * @see getSelectedBlockClientId in core/block-editor store. */ const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); /** * @see getSelectedBlock in core/block-editor store. */ const getSelectedBlock = getBlockEditorSelector('getSelectedBlock'); /** * @see getBlockRootClientId in core/block-editor store. */ const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId'); /** * @see getBlockHierarchyRootClientId in core/block-editor store. */ const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId'); /** * @see getAdjacentBlockClientId in core/block-editor store. */ const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId'); /** * @see getPreviousBlockClientId in core/block-editor store. */ const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId'); /** * @see getNextBlockClientId in core/block-editor store. */ const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId'); /** * @see getSelectedBlocksInitialCaretPosition in core/block-editor store. */ const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition'); /** * @see getMultiSelectedBlockClientIds in core/block-editor store. */ const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds'); /** * @see getMultiSelectedBlocks in core/block-editor store. */ const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks'); /** * @see getFirstMultiSelectedBlockClientId in core/block-editor store. */ const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId'); /** * @see getLastMultiSelectedBlockClientId in core/block-editor store. */ const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId'); /** * @see isFirstMultiSelectedBlock in core/block-editor store. */ const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock'); /** * @see isBlockMultiSelected in core/block-editor store. */ const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected'); /** * @see isAncestorMultiSelected in core/block-editor store. */ const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected'); /** * @see getMultiSelectedBlocksStartClientId in core/block-editor store. */ const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId'); /** * @see getMultiSelectedBlocksEndClientId in core/block-editor store. */ const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId'); /** * @see getBlockOrder in core/block-editor store. */ const getBlockOrder = getBlockEditorSelector('getBlockOrder'); /** * @see getBlockIndex in core/block-editor store. */ const getBlockIndex = getBlockEditorSelector('getBlockIndex'); /** * @see isBlockSelected in core/block-editor store. */ const isBlockSelected = getBlockEditorSelector('isBlockSelected'); /** * @see hasSelectedInnerBlock in core/block-editor store. */ const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock'); /** * @see isBlockWithinSelection in core/block-editor store. */ const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection'); /** * @see hasMultiSelection in core/block-editor store. */ const hasMultiSelection = getBlockEditorSelector('hasMultiSelection'); /** * @see isMultiSelecting in core/block-editor store. */ const isMultiSelecting = getBlockEditorSelector('isMultiSelecting'); /** * @see isSelectionEnabled in core/block-editor store. */ const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled'); /** * @see getBlockMode in core/block-editor store. */ const getBlockMode = getBlockEditorSelector('getBlockMode'); /** * @see isTyping in core/block-editor store. */ const isTyping = getBlockEditorSelector('isTyping'); /** * @see isCaretWithinFormattedText in core/block-editor store. */ const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); /** * @see getBlockInsertionPoint in core/block-editor store. */ const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint'); /** * @see isBlockInsertionPointVisible in core/block-editor store. */ const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible'); /** * @see isValidTemplate in core/block-editor store. */ const isValidTemplate = getBlockEditorSelector('isValidTemplate'); /** * @see getTemplate in core/block-editor store. */ const getTemplate = getBlockEditorSelector('getTemplate'); /** * @see getTemplateLock in core/block-editor store. */ const getTemplateLock = getBlockEditorSelector('getTemplateLock'); /** * @see canInsertBlockType in core/block-editor store. */ const canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); /** * @see getInserterItems in core/block-editor store. */ const getInserterItems = getBlockEditorSelector('getInserterItems'); /** * @see hasInserterItems in core/block-editor store. */ const hasInserterItems = getBlockEditorSelector('hasInserterItems'); /** * @see getBlockListSettings in core/block-editor store. */ const getBlockListSettings = getBlockEditorSelector('getBlockListSettings'); const __experimentalGetDefaultTemplateTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { external_wp_deprecated_default()("select('core/editor').__experimentalGetDefaultTemplateTypes", { since: '6.8', alternative: "select('core/core-data').getCurrentTheme()?.default_template_types" }); return select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types; }); /** * Returns the default template part areas. * * @param {Object} state Global application state. * * @return {Array} The template part areas. */ const __experimentalGetDefaultTemplatePartAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(() => { external_wp_deprecated_default()("select('core/editor').__experimentalGetDefaultTemplatePartAreas", { since: '6.8', alternative: "select('core/core-data').getCurrentTheme()?.default_template_part_areas" }); const areas = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || []; return areas.map(item => { return { ...item, icon: getTemplatePartIcon(item.icon) }; }); })); /** * Returns a default template type searched by slug. * * @param {Object} state Global application state. * @param {string} slug The template type slug. * * @return {Object} The template type. */ const __experimentalGetDefaultTemplateType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, slug) => { var _Object$values$find; external_wp_deprecated_default()("select('core/editor').__experimentalGetDefaultTemplateType", { since: '6.8' }); const templateTypes = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types; if (!templateTypes) { return selectors_EMPTY_OBJECT; } return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : selectors_EMPTY_OBJECT; })); /** * Given a template entity, return information about it which is ready to be * rendered, such as the title, description, and icon. * * @param {Object} state Global application state. * @param {Object} template The template for which we need information. * @return {Object} Information about the template, including title, description, and icon. */ const __experimentalGetTemplateInfo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, template) => { external_wp_deprecated_default()("select('core/editor').__experimentalGetTemplateInfo", { since: '6.8' }); if (!template) { return selectors_EMPTY_OBJECT; } const currentTheme = select(external_wp_coreData_namespaceObject.store).getCurrentTheme(); const templateTypes = currentTheme?.default_template_types || []; const templateAreas = currentTheme?.default_template_part_areas || []; return getTemplateInfo({ template, templateAreas, templateTypes }); })); /** * Returns a post type label depending on the current post. * * @param {Object} state Global application state. * * @return {string|undefined} The post type label if available, otherwise undefined. */ const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { const currentPostType = getCurrentPostType(state); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); // Disable reason: Post type labels object is shaped like this. // eslint-disable-next-line camelcase return postType?.labels?.singular_name; }); /** * Returns true if the publish sidebar is opened. * * @param {Object} state Global application state * * @return {boolean} Whether the publish sidebar is open. */ function isPublishSidebarOpened(state) { return state.publishSidebarActive; } ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/@wordpress/editor/build-module/store/local-autosave.js /** * Function returning a sessionStorage key to set or retrieve a given post's * automatic session backup. * * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's * `loggedout` handler can clear sessionStorage of any user-private content. * * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 * * @param {string} postId Post ID. * @param {boolean} isPostNew Whether post new. * * @return {string} sessionStorage key */ function postKey(postId, isPostNew) { return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`; } function localAutosaveGet(postId, isPostNew) { return window.sessionStorage.getItem(postKey(postId, isPostNew)); } function localAutosaveSet(postId, isPostNew, title, content, excerpt) { window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({ post_title: title, content, excerpt })); } function localAutosaveClear(postId, isPostNew) { window.sessionStorage.removeItem(postKey(postId, isPostNew)); } ;// ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js /** * WordPress dependencies */ /** * Builds the arguments for a success notification dispatch. * * @param {Object} data Incoming data to build the arguments from. * * @return {Array} Arguments for dispatch. An empty array signals no * notification should be sent. */ function getNotificationArgumentsForSaveSuccess(data) { var _postType$viewable; const { previousPost, post, postType } = data; // Autosaves are neither shown a notice nor redirected. if (data.options?.isAutosave) { return []; } const publishStatus = ['publish', 'private', 'future']; const isPublished = publishStatus.includes(previousPost.status); const willPublish = publishStatus.includes(post.status); const willTrash = post.status === 'trash' && previousPost.status !== 'trash'; let noticeMessage; let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false; let isDraft; // Always should a notice, which will be spoken for accessibility. if (willTrash) { noticeMessage = postType.labels.item_trashed; shouldShowLink = false; } else if (!isPublished && !willPublish) { // If saving a non-published post, don't show notice. noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.'); isDraft = true; } else if (isPublished && !willPublish) { // If undoing publish status, show specific notice. noticeMessage = postType.labels.item_reverted_to_draft; shouldShowLink = false; } else if (!isPublished && willPublish) { // If publishing or scheduling a post, show the corresponding // publish message. noticeMessage = { publish: postType.labels.item_published, private: postType.labels.item_published_privately, future: postType.labels.item_scheduled }[post.status]; } else { // Generic fallback notice. noticeMessage = postType.labels.item_updated; } const actions = []; if (shouldShowLink) { actions.push({ label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item, url: post.link }); } return [noticeMessage, { id: 'editor-save', type: 'snackbar', actions }]; } /** * Builds the fail notification arguments for dispatch. * * @param {Object} data Incoming data to build the arguments with. * * @return {Array} Arguments for dispatch. An empty array signals no * notification should be sent. */ function getNotificationArgumentsForSaveFail(data) { const { post, edits, error } = data; if (error && 'rest_autosave_no_changes' === error.code) { // Autosave requested a new autosave, but there were no changes. This shouldn't // result in an error notice for the user. return []; } const publishStatus = ['publish', 'private', 'future']; const isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message // Unless we publish an "updating failed" message. const messages = { publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.') }; let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.'); // Check if message string contains HTML. Notice text is currently only // supported as plaintext, and stripping the tags may muddle the meaning. if (error.message && !/<\/?[^>]*>/.test(error.message)) { noticeMessage = [noticeMessage, error.message].join(' '); } return [noticeMessage, { id: 'editor-save' }]; } /** * Builds the trash fail notification arguments for dispatch. * * @param {Object} data * * @return {Array} Arguments for dispatch. */ function getNotificationArgumentsForTrashFail(data) { return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), { id: 'editor-trash-fail' }]; } ;// ./node_modules/@wordpress/editor/build-module/store/actions.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns an action generator used in signalling that editor has initialized with * the specified post object and editor settings. * * @param {Object} post Post object. * @param {Object} edits Initial edited attributes object. * @param {Array} [template] Block Template. */ const setupEditor = (post, edits, template) => ({ dispatch }) => { dispatch.setEditedPost(post.type, post.id); // Apply a template for new posts only, if exists. const isNewPost = post.status === 'auto-draft'; if (isNewPost && template) { // In order to ensure maximum of a single parse during setup, edits are // included as part of editor setup action. Assume edited content as // canonical if provided, falling back to post. let content; if ('content' in edits) { content = edits.content; } else { content = post.content.raw; } let blocks = (0,external_wp_blocks_namespaceObject.parse)(content); blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); dispatch.resetEditorBlocks(blocks, { __unstableShouldCreateUndoLevel: false }); } if (edits && Object.values(edits).some(([key, edit]) => { var _post$key$raw; return edit !== ((_post$key$raw = post[key]?.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]); })) { dispatch.editPost(edits); } }; /** * Returns an action object signalling that the editor is being destroyed and * that any necessary state or side-effect cleanup should occur. * * @deprecated * * @return {Object} Action object. */ function __experimentalTearDownEditor() { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", { since: '6.5' }); return { type: 'DO_NOTHING' }; } /** * Returns an action object used in signalling that the latest version of the * post has been received, either by initialization or save. * * @deprecated Since WordPress 6.0. */ function resetPost() { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", { since: '6.0', version: '6.3', alternative: 'Initialize the editor with the setupEditorState action' }); return { type: 'DO_NOTHING' }; } /** * Returns an action object used in signalling that a patch of updates for the * latest version of the post have been received. * * @return {Object} Action object. * @deprecated since Gutenberg 9.7.0. */ function updatePost() { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { since: '5.7', alternative: 'Use the core entities store instead' }); return { type: 'DO_NOTHING' }; } /** * Setup the editor state. * * @deprecated * * @param {Object} post Post object. */ function setupEditorState(post) { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).setupEditorState", { since: '6.5', alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost" }); return setEditedPost(post.type, post.id); } /** * Returns an action that sets the current post Type and post ID. * * @param {string} postType Post Type. * @param {string} postId Post ID. * * @return {Object} Action object. */ function setEditedPost(postType, postId) { return { type: 'SET_EDITED_POST', postType, postId }; } /** * Returns an action object used in signalling that attributes of the post have * been edited. * * @param {Object} edits Post attributes to edit. * @param {Object} [options] Options for the edit. * * @example * ```js * // Update the post title * wp.data.dispatch( 'core/editor' ).editPost( { title: `${ newTitle }` } ); * ``` * * @example *```js * // Get specific media size based on the featured media ID * // Note: change sizes?.large for any registered size * const getFeaturedMediaUrl = useSelect( ( select ) => { * const getFeaturedMediaId = * select( 'core/editor' ).getEditedPostAttribute( 'featured_media' ); * const getMedia = select( 'core' ).getMedia( getFeaturedMediaId ); * * return ( * getMedia?.media_details?.sizes?.large?.source_url || getMedia?.source_url || '' * ); * }, [] ); * ``` * * @return {Object} Action object */ const editPost = (edits, options) => ({ select, registry }) => { const { id, type } = select.getCurrentPost(); registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options); }; /** * Action for saving the current post in the editor. * * @param {Object} [options] */ const savePost = (options = {}) => async ({ select, dispatch, registry }) => { if (!select.isEditedPostSaveable()) { return; } const content = select.getEditedPostContent(); if (!options.isAutosave) { dispatch.editPost({ content }, { undoIgnore: true }); } const previousRecord = select.getCurrentPost(); let edits = { id: previousRecord.id, ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id), content }; dispatch({ type: 'REQUEST_POST_UPDATE_START', options }); let error = false; try { edits = await (0,external_wp_hooks_namespaceObject.applyFiltersAsync)('editor.preSavePost', edits, options); } catch (err) { error = err; } if (!error) { try { await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options); } catch (err) { error = err.message && err.code !== 'unknown_error' ? err.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating.'); } } if (!error) { error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id); } // Run the hook with legacy unstable name for backward compatibility if (!error) { try { await (0,external_wp_hooks_namespaceObject.applyFilters)('editor.__unstableSavePost', Promise.resolve(), options); } catch (err) { error = err; } } if (!error) { try { await (0,external_wp_hooks_namespaceObject.doActionAsync)('editor.savePost', { id: previousRecord.id }, options); } catch (err) { error = err; } } dispatch({ type: 'REQUEST_POST_UPDATE_FINISH', options }); if (error) { const args = getNotificationArgumentsForSaveFail({ post: previousRecord, edits, error }); if (args.length) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args); } } else { const updatedRecord = select.getCurrentPost(); const args = getNotificationArgumentsForSaveSuccess({ previousPost: previousRecord, post: updatedRecord, postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type), options }); if (args.length) { registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args); } // Make sure that any edits after saving create an undo level and are // considered for change detection. if (!options.isAutosave) { registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); } } }; /** * Action for refreshing the current post. * * @deprecated Since WordPress 6.0. */ function refreshPost() { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", { since: '6.0', version: '6.3', alternative: 'Use the core entities store instead' }); return { type: 'DO_NOTHING' }; } /** * Action for trashing the current post in the editor. */ const trashPost = () => async ({ select, dispatch, registry }) => { const postTypeSlug = select.getCurrentPostType(); const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); const { rest_base: restBase, rest_namespace: restNamespace = 'wp/v2' } = postType; dispatch({ type: 'REQUEST_POST_DELETE_START' }); try { const post = select.getCurrentPost(); await external_wp_apiFetch_default()({ path: `/${restNamespace}/${restBase}/${post.id}`, method: 'DELETE' }); await dispatch.savePost(); } catch (error) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...getNotificationArgumentsForTrashFail({ error })); } dispatch({ type: 'REQUEST_POST_DELETE_FINISH' }); }; /** * Action that autosaves the current post. This * includes server-side autosaving (default) and client-side (a.k.a. local) * autosaving (e.g. on the Web, the post might be committed to Session * Storage). * * @param {Object} [options] Extra flags to identify the autosave. * @param {boolean} [options.local] Whether to perform a local autosave. */ const autosave = ({ local = false, ...options } = {}) => async ({ select, dispatch }) => { const post = select.getCurrentPost(); // Currently template autosaving is not supported. if (post.type === 'wp_template') { return; } if (local) { const isPostNew = select.isEditedPostNew(); const title = select.getEditedPostAttribute('title'); const content = select.getEditedPostAttribute('content'); const excerpt = select.getEditedPostAttribute('excerpt'); localAutosaveSet(post.id, isPostNew, title, content, excerpt); } else { await dispatch.savePost({ isAutosave: true, ...options }); } }; const __unstableSaveForPreview = ({ forceIsAutosaveable } = {}) => async ({ select, dispatch }) => { if ((forceIsAutosaveable || select.isEditedPostAutosaveable()) && !select.isPostLocked()) { const isDraft = ['draft', 'auto-draft'].includes(select.getEditedPostAttribute('status')); if (isDraft) { await dispatch.savePost({ isPreview: true }); } else { await dispatch.autosave({ isPreview: true }); } } return select.getEditedPostPreviewLink(); }; /** * Action that restores last popped state in undo history. */ const redo = () => ({ registry }) => { registry.dispatch(external_wp_coreData_namespaceObject.store).redo(); }; /** * Action that pops a record from undo history and undoes the edit. */ const undo = () => ({ registry }) => { registry.dispatch(external_wp_coreData_namespaceObject.store).undo(); }; /** * Action that creates an undo history record. * * @deprecated Since WordPress 6.0 */ function createUndoLevel() { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", { since: '6.0', version: '6.3', alternative: 'Use the core entities store instead' }); return { type: 'DO_NOTHING' }; } /** * Action that locks the editor. * * @param {Object} lock Details about the post lock status, user, and nonce. * @return {Object} Action object. */ function updatePostLock(lock) { return { type: 'UPDATE_POST_LOCK', lock }; } /** * Enable the publish sidebar. */ const enablePublishSidebar = () => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', true); }; /** * Disables the publish sidebar. */ const disablePublishSidebar = () => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', false); }; /** * Action that locks post saving. * * @param {string} lockName The lock name. * * @example * ``` * const { subscribe } = wp.data; * * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); * * // Only allow publishing posts that are set to a future date. * if ( 'publish' !== initialPostStatus ) { * * // Track locking. * let locked = false; * * // Watch for the publish event. * let unssubscribe = subscribe( () => { * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); * if ( 'publish' !== currentPostStatus ) { * * // Compare the post date to the current date, lock the post if the date isn't in the future. * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) ); * const currentDate = new Date(); * if ( postDate.getTime() <= currentDate.getTime() ) { * if ( ! locked ) { * locked = true; * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' ); * } * } else { * if ( locked ) { * locked = false; * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' ); * } * } * } * } ); * } * ``` * * @return {Object} Action object */ function lockPostSaving(lockName) { return { type: 'LOCK_POST_SAVING', lockName }; } /** * Action that unlocks post saving. * * @param {string} lockName The lock name. * * @example * ``` * // Unlock post saving with the lock key `mylock`: * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); * ``` * * @return {Object} Action object */ function unlockPostSaving(lockName) { return { type: 'UNLOCK_POST_SAVING', lockName }; } /** * Action that locks post autosaving. * * @param {string} lockName The lock name. * * @example * ``` * // Lock post autosaving with the lock key `mylock`: * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); * ``` * * @return {Object} Action object */ function lockPostAutosaving(lockName) { return { type: 'LOCK_POST_AUTOSAVING', lockName }; } /** * Action that unlocks post autosaving. * * @param {string} lockName The lock name. * * @example * ``` * // Unlock post saving with the lock key `mylock`: * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); * ``` * * @return {Object} Action object */ function unlockPostAutosaving(lockName) { return { type: 'UNLOCK_POST_AUTOSAVING', lockName }; } /** * Returns an action object used to signal that the blocks have been updated. * * @param {Array} blocks Block Array. * @param {Object} [options] Optional options. */ const resetEditorBlocks = (blocks, options = {}) => ({ select, dispatch, registry }) => { const { __unstableShouldCreateUndoLevel, selection } = options; const edits = { blocks, selection }; if (__unstableShouldCreateUndoLevel !== false) { const { id, type } = select.getCurrentPost(); const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks; if (noChange) { registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel('postType', type, id); return; } // We create a new function here on every persistent edit // to make sure the edit makes the post dirty and creates // a new undo level. edits.content = ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); } dispatch.editPost(edits); }; /* * Returns an action object used in signalling that the post editor settings have been updated. * * @param {Object} settings Updated settings * * @return {Object} Action object */ function updateEditorSettings(settings) { return { type: 'UPDATE_EDITOR_SETTINGS', settings }; } /** * Returns an action used to set the rendering mode of the post editor. We support multiple rendering modes: * * - `post-only`: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template. * - `template-locked`: This mode renders both the template and the post blocks but the template blocks are locked and can't be edited. The post blocks are editable. * * @param {string} mode Mode (one of 'post-only' or 'template-locked'). */ const setRenderingMode = mode => ({ dispatch, registry, select }) => { if (select.__unstableIsEditorReady()) { // We clear the block selection but we also need to clear the selection from the core store. registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); dispatch.editPost({ selection: undefined }, { undoIgnore: true }); } dispatch({ type: 'SET_RENDERING_MODE', mode }); }; /** * Action that changes the width of the editing canvas. * * @param {string} deviceType * * @return {Object} Action object. */ function setDeviceType(deviceType) { return { type: 'SET_DEVICE_TYPE', deviceType }; } /** * Returns an action object used to enable or disable a panel in the editor. * * @param {string} panelName A string that identifies the panel to enable or disable. * * @return {Object} Action object. */ const toggleEditorPanelEnabled = panelName => ({ registry }) => { var _registry$select$get; const inactivePanels = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; const isPanelInactive = !!inactivePanels?.includes(panelName); // If the panel is inactive, remove it to enable it, else add it to // make it inactive. let updatedInactivePanels; if (isPanelInactive) { updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName); } else { updatedInactivePanels = [...inactivePanels, panelName]; } registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'inactivePanels', updatedInactivePanels); }; /** * Opens a closed panel and closes an open panel. * * @param {string} panelName A string that identifies the panel to open or close. */ const toggleEditorPanelOpened = panelName => ({ registry }) => { var _registry$select$get2; const openPanels = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; const isPanelOpen = !!openPanels?.includes(panelName); // If the panel is open, remove it to close it, else add it to // make it open. let updatedOpenPanels; if (isPanelOpen) { updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName); } else { updatedOpenPanels = [...openPanels, panelName]; } registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'openPanels', updatedOpenPanels); }; /** * Returns an action object used to remove a panel from the editor. * * @param {string} panelName A string that identifies the panel to remove. * * @return {Object} Action object. */ function removeEditorPanel(panelName) { return { type: 'REMOVE_PANEL', panelName }; } /** * Returns an action object used to open/close the inserter. * * @param {boolean|Object} value Whether the inserter should be * opened (true) or closed (false). * To specify an insertion point, * use an object. * @param {string} value.rootClientId The root client ID to insert at. * @param {number} value.insertionIndex The index to insert at. * @param {string} value.filterValue A query to filter the inserter results. * @param {Function} value.onSelect A callback when an item is selected. * @param {string} value.tab The tab to open in the inserter. * @param {string} value.category The category to initialize in the inserter. * * @return {Object} Action object. */ const setIsInserterOpened = value => ({ dispatch, registry }) => { if (typeof value === 'object' && value.hasOwnProperty('rootClientId') && value.hasOwnProperty('insertionIndex')) { unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).setInsertionPoint({ rootClientId: value.rootClientId, index: value.insertionIndex }); } dispatch({ type: 'SET_IS_INSERTER_OPENED', value }); }; /** * Returns an action object used to open/close the list view. * * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. * @return {Object} Action object. */ function setIsListViewOpened(isOpen) { return { type: 'SET_IS_LIST_VIEW_OPENED', isOpen }; } /** * Action that toggles Distraction free mode. * Distraction free mode expects there are no sidebars, as due to the * z-index values set, you can't close sidebars. * * @param {Object} [options={}] Optional configuration object * @param {boolean} [options.createNotice=true] Whether to create a notice */ const toggleDistractionFree = ({ createNotice = true } = {}) => ({ dispatch, registry }) => { const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); if (isDistractionFree) { registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', false); } if (!isDistractionFree) { registry.batch(() => { registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', true); dispatch.setIsInserterOpened(false); dispatch.setIsListViewOpened(false); unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).resetZoomLevel(); }); } registry.batch(() => { registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'distractionFree', !isDistractionFree); if (createNotice) { registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated.') : (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated.'), { id: 'core/editor/distraction-free-mode/notice', type: 'snackbar', actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Undo'), onClick: () => { registry.batch(() => { registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', isDistractionFree); registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'distractionFree'); }); } }] }); } }); }; /** * Action that toggles the Spotlight Mode view option. */ const toggleSpotlightMode = () => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'focusMode'); const isFocusMode = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'focusMode'); registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isFocusMode ? (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated.') : (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated.'), { id: 'core/editor/toggle-spotlight-mode/notice', type: 'snackbar', actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Undo'), onClick: () => { registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'focusMode'); } }] }); }; /** * Action that toggles the Top Toolbar view option. */ const toggleTopToolbar = () => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'fixedToolbar'); const isTopToolbar = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'fixedToolbar'); registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isTopToolbar ? (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated.') : (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated.'), { id: 'core/editor/toggle-top-toolbar/notice', type: 'snackbar', actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Undo'), onClick: () => { registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'fixedToolbar'); } }] }); }; /** * Triggers an action used to switch editor mode. * * @param {string} mode The editor mode. */ const switchEditorMode = mode => ({ dispatch, registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'editorMode', mode); if (mode !== 'visual') { // Unselect blocks when we switch to a non visual mode. registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); // Exit zoom out state when switching to a non visual mode. unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).resetZoomLevel(); } if (mode === 'visual') { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive'); } else if (mode === 'text') { const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); if (isDistractionFree) { dispatch.toggleDistractionFree(); } (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Code editor selected'), 'assertive'); } }; /** * Returns an action object used in signalling that the user opened the publish * sidebar. * * @return {Object} Action object */ function openPublishSidebar() { return { type: 'OPEN_PUBLISH_SIDEBAR' }; } /** * Returns an action object used in signalling that the user closed the * publish sidebar. * * @return {Object} Action object. */ function closePublishSidebar() { return { type: 'CLOSE_PUBLISH_SIDEBAR' }; } /** * Returns an action object used in signalling that the user toggles the publish sidebar. * * @return {Object} Action object */ function togglePublishSidebar() { return { type: 'TOGGLE_PUBLISH_SIDEBAR' }; } /** * Backward compatibility */ const getBlockEditorAction = name => (...args) => ({ registry }) => { external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { since: '5.3', alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`', version: '6.2' }); registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args); }; /** * @see resetBlocks in core/block-editor store. */ const resetBlocks = getBlockEditorAction('resetBlocks'); /** * @see receiveBlocks in core/block-editor store. */ const receiveBlocks = getBlockEditorAction('receiveBlocks'); /** * @see updateBlock in core/block-editor store. */ const updateBlock = getBlockEditorAction('updateBlock'); /** * @see updateBlockAttributes in core/block-editor store. */ const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes'); /** * @see selectBlock in core/block-editor store. */ const selectBlock = getBlockEditorAction('selectBlock'); /** * @see startMultiSelect in core/block-editor store. */ const startMultiSelect = getBlockEditorAction('startMultiSelect'); /** * @see stopMultiSelect in core/block-editor store. */ const stopMultiSelect = getBlockEditorAction('stopMultiSelect'); /** * @see multiSelect in core/block-editor store. */ const multiSelect = getBlockEditorAction('multiSelect'); /** * @see clearSelectedBlock in core/block-editor store. */ const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock'); /** * @see toggleSelection in core/block-editor store. */ const toggleSelection = getBlockEditorAction('toggleSelection'); /** * @see replaceBlocks in core/block-editor store. */ const replaceBlocks = getBlockEditorAction('replaceBlocks'); /** * @see replaceBlock in core/block-editor store. */ const replaceBlock = getBlockEditorAction('replaceBlock'); /** * @see moveBlocksDown in core/block-editor store. */ const moveBlocksDown = getBlockEditorAction('moveBlocksDown'); /** * @see moveBlocksUp in core/block-editor store. */ const moveBlocksUp = getBlockEditorAction('moveBlocksUp'); /** * @see moveBlockToPosition in core/block-editor store. */ const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition'); /** * @see insertBlock in core/block-editor store. */ const insertBlock = getBlockEditorAction('insertBlock'); /** * @see insertBlocks in core/block-editor store. */ const insertBlocks = getBlockEditorAction('insertBlocks'); /** * @see showInsertionPoint in core/block-editor store. */ const showInsertionPoint = getBlockEditorAction('showInsertionPoint'); /** * @see hideInsertionPoint in core/block-editor store. */ const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint'); /** * @see setTemplateValidity in core/block-editor store. */ const setTemplateValidity = getBlockEditorAction('setTemplateValidity'); /** * @see synchronizeTemplate in core/block-editor store. */ const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate'); /** * @see mergeBlocks in core/block-editor store. */ const mergeBlocks = getBlockEditorAction('mergeBlocks'); /** * @see removeBlocks in core/block-editor store. */ const removeBlocks = getBlockEditorAction('removeBlocks'); /** * @see removeBlock in core/block-editor store. */ const removeBlock = getBlockEditorAction('removeBlock'); /** * @see toggleBlockMode in core/block-editor store. */ const toggleBlockMode = getBlockEditorAction('toggleBlockMode'); /** * @see startTyping in core/block-editor store. */ const startTyping = getBlockEditorAction('startTyping'); /** * @see stopTyping in core/block-editor store. */ const stopTyping = getBlockEditorAction('stopTyping'); /** * @see enterFormattedText in core/block-editor store. */ const enterFormattedText = getBlockEditorAction('enterFormattedText'); /** * @see exitFormattedText in core/block-editor store. */ const exitFormattedText = getBlockEditorAction('exitFormattedText'); /** * @see insertDefaultBlock in core/block-editor store. */ const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock'); /** * @see updateBlockListSettings in core/block-editor store. */ const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings'); ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/editor/build-module/store/utils/is-template-revertable.js /** * Internal dependencies */ // Copy of the function from packages/edit-site/src/utils/is-template-revertable.js /** * Check if a template or template part is revertable to its original theme-provided file. * * @param {Object} templateOrTemplatePart The entity to check. * @return {boolean} Whether the entity is revertable. */ function isTemplateRevertable(templateOrTemplatePart) { if (!templateOrTemplatePart) { return false; } return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); } ;// ./node_modules/@wordpress/icons/build-module/library/external.js /** * WordPress dependencies */ const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); /* harmony default export */ const library_external = (external); ;// ./node_modules/@wordpress/fields/build-module/actions/view-post.js /** * WordPress dependencies */ /** * Internal dependencies */ const viewPost = { id: 'view-post', label: (0,external_wp_i18n_namespaceObject._x)('View', 'verb'), isPrimary: true, icon: library_external, isEligible(post) { return post.status !== 'trash'; }, callback(posts, { onActionPerformed }) { const post = posts[0]; window.open(post?.link, '_blank'); if (onActionPerformed) { onActionPerformed(posts); } } }; /** * View post action for BasePost. */ /* harmony default export */ const view_post = (viewPost); ;// ./node_modules/@wordpress/fields/build-module/actions/view-post-revisions.js /** * WordPress dependencies */ /** * Internal dependencies */ const viewPostRevisions = { id: 'view-post-revisions', context: 'list', label(items) { var _items$0$_links$versi; const revisionsCount = (_items$0$_links$versi = items[0]._links?.['version-history']?.[0]?.count) !== null && _items$0$_links$versi !== void 0 ? _items$0$_links$versi : 0; return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: number of revisions. */ (0,external_wp_i18n_namespaceObject.__)('View revisions (%s)'), revisionsCount); }, isEligible(post) { var _post$_links$predeces, _post$_links$version; if (post.status === 'trash') { return false; } const lastRevisionId = (_post$_links$predeces = post?._links?.['predecessor-version']?.[0]?.id) !== null && _post$_links$predeces !== void 0 ? _post$_links$predeces : null; const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0; return !!lastRevisionId && revisionsCount > 1; }, callback(posts, { onActionPerformed }) { const post = posts[0]; const href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { revision: post?._links?.['predecessor-version']?.[0]?.id }); document.location.href = href; if (onActionPerformed) { onActionPerformed(posts); } } }; /** * View post revisions action for Post. */ /* harmony default export */ const view_post_revisions = (viewPostRevisions); ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// ./node_modules/@wordpress/icons/build-module/library/check.js /** * WordPress dependencies */ const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" }) }); /* harmony default export */ const library_check = (check); ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/dot-case/dist.es2015/index.js function dotCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "." }, options)); } ;// ./node_modules/param-case/dist.es2015/index.js function paramCase(input, options) { if (options === void 0) { options = {}; } return dotCase(input, __assign({ delimiter: "-" }, options)); } ;// ./node_modules/@wordpress/fields/build-module/components/create-template-part-modal/utils.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const useExistingTemplateParts = () => { var _useSelect; return (_useSelect = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template_part', { per_page: -1 }), [])) !== null && _useSelect !== void 0 ? _useSelect : []; }; /** * Return a unique template part title based on * the given title and existing template parts. * * @param {string} title The original template part title. * @param {Object} templateParts The array of template part entities. * @return {string} A unique template part title. */ const getUniqueTemplatePartTitle = (title, templateParts) => { const lowercaseTitle = title.toLowerCase(); const existingTitles = templateParts.map(templatePart => templatePart.title.rendered.toLowerCase()); if (!existingTitles.includes(lowercaseTitle)) { return title; } let suffix = 2; while (existingTitles.includes(`${lowercaseTitle} ${suffix}`)) { suffix++; } return `${title} ${suffix}`; }; /** * Get a valid slug for a template part. * Currently template parts only allow latin chars. * The fallback slug will receive suffix by default. * * @param {string} title The template part title. * @return {string} A valid template part slug. */ const getCleanTemplatePartSlug = title => { return paramCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part'; }; ;// ./node_modules/@wordpress/fields/build-module/components/create-template-part-modal/index.js /** * WordPress dependencies */ // @ts-expect-error serialize is not typed /** * Internal dependencies */ function getAreaRadioId(value, instanceId) { return `fields-create-template-part-modal__area-option-${value}-${instanceId}`; } function getAreaRadioDescriptionId(value, instanceId) { return `fields-create-template-part-modal__area-option-description-${value}-${instanceId}`; } /** * A React component that renders a modal for creating a template part. The modal displays a title and the contents for creating the template part. * This component should not live in this package, it should be moved to a dedicated package responsible for managing template. * @param {Object} props The component props. * @param props.modalTitle */ function CreateTemplatePartModal({ modalTitle, ...restProps }) { const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType('wp_template_part')?.labels?.add_new_item, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: modalTitle || defaultModalTitle, onRequestClose: restProps.closeModal, overlayClassName: "fields-create-template-part-modal", focusOnMount: "firstContentElement", size: "medium", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, { ...restProps }) }); } const create_template_part_modal_getTemplatePartIcon = iconName => { if ('header' === iconName) { return library_header; } else if ('footer' === iconName) { return library_footer; } else if ('sidebar' === iconName) { return library_sidebar; } return symbol_filled; }; /** * A React component that renders the content of a model for creating a template part. * This component should not live in this package; it should be moved to a dedicated package responsible for managing template. * * @param {Object} props - The component props. * @param {string} [props.defaultArea=uncategorized] - The default area for the template part. * @param {Array} [props.blocks=[]] - The blocks to be included in the template part. * @param {string} [props.confirmLabel='Add'] - The label for the confirm button. * @param {Function} props.closeModal - Function to close the modal. * @param {Function} props.onCreate - Function to call when the template part is successfully created. * @param {Function} [props.onError] - Function to call when there is an error creating the template part. * @param {string} [props.defaultTitle=''] - The default title for the template part. */ function CreateTemplatePartModalContents({ defaultArea = 'uncategorized', blocks = [], confirmLabel = (0,external_wp_i18n_namespaceObject.__)('Add'), closeModal, onCreate, onError, defaultTitle = '' }) { const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const existingTemplateParts = useExistingTemplateParts(); const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle); const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(defaultArea); const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal); const defaultTemplatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas, []); async function createTemplatePart() { if (!title || isSubmitting) { return; } try { setIsSubmitting(true); const uniqueTitle = getUniqueTemplatePartTitle(title, existingTemplateParts); const cleanSlug = getCleanTemplatePartSlug(uniqueTitle); const templatePart = await saveEntityRecord('postType', 'wp_template_part', { slug: cleanSlug, title: uniqueTitle, content: (0,external_wp_blocks_namespaceObject.serialize)(blocks), area }, { throwOnError: true }); await onCreate(templatePart); // TODO: Add a success notice? } catch (error) { const errorMessage = error instanceof Error && 'code' in error && error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.'); createErrorNotice(errorMessage, { type: 'snackbar' }); onError?.(); } finally { setIsSubmitting(false); } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: async event => { event.preventDefault(); await createTemplatePart(); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "4", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Name'), value: title, onChange: setTitle, required: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Area') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-create-template-part-modal__area-radio-group", children: (defaultTemplatePartAreas !== null && defaultTemplatePartAreas !== void 0 ? defaultTemplatePartAreas : []).map(item => { const icon = create_template_part_modal_getTemplatePartIcon(item.icon); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "fields-create-template-part-modal__area-radio-wrapper", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { type: "radio", id: getAreaRadioId(item.area, instanceId), name: `fields-create-template-part-modal__area-${instanceId}`, value: item.area, checked: area === item.area, onChange: () => { setArea(item.area); }, "aria-describedby": getAreaRadioDescriptionId(item.area, instanceId) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon, className: "fields-create-template-part-modal__area-radio-icon" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: getAreaRadioId(item.area, instanceId), className: "fields-create-template-part-modal__area-radio-label", children: item.label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: library_check, className: "fields-create-template-part-modal__area-radio-checkmark" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "fields-create-template-part-modal__area-radio-description", id: getAreaRadioDescriptionId(item.area, instanceId), children: item.description })] }, item.area); }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal(); }, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", "aria-disabled": !title || isSubmitting, isBusy: isSubmitting, children: confirmLabel })] })] }) }); } ;// ./node_modules/@wordpress/fields/build-module/actions/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ function isTemplate(post) { return post.type === 'wp_template'; } function isTemplatePart(post) { return post.type === 'wp_template_part'; } function isTemplateOrTemplatePart(p) { return p.type === 'wp_template' || p.type === 'wp_template_part'; } function getItemTitle(item) { if (typeof item.title === 'string') { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); } if (item.title && 'rendered' in item.title) { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); } if (item.title && 'raw' in item.title) { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); } return ''; } /** * Check if a template is removable. * * @param template The template entity to check. * @return Whether the template is removable. */ function isTemplateRemovable(template) { if (!template) { return false; } // In patterns list page we map the templates parts to a different object // than the one returned from the endpoint. This is why we need to check for // two props whether is custom or has a theme file. return [template.source, template.source].includes('custom') && !Boolean(template.type === 'wp_template' && template?.plugin) && !template.has_theme_file; } ;// ./node_modules/@wordpress/fields/build-module/actions/duplicate-template-part.js /** * WordPress dependencies */ // @ts-ignore /** * Internal dependencies */ /** * This action is used to duplicate a template part. */ const duplicateTemplatePart = { id: 'duplicate-template-part', label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), isEligible: item => item.type === 'wp_template_part', modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate template part', 'action label'), RenderModal: ({ items, closeModal }) => { const [item] = items; const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { var _item$blocks; return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : (0,external_wp_blocks_namespaceObject.parse)(typeof item.content === 'string' ? item.content : item.content.raw, { __unstableSkipMigrationLogs: true }); }, [item.content, item.blocks]); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); function onTemplatePartSuccess(templatePart) { createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The new template part's title e.g. 'Call to action (copy)'. (0,external_wp_i18n_namespaceObject._x)('"%s" duplicated.', 'template part'), getItemTitle(templatePart)), { type: 'snackbar', id: 'edit-site-patterns-success' }); closeModal?.(); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, { blocks: blocks, defaultArea: item.area, defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Existing template part title */ (0,external_wp_i18n_namespaceObject._x)('%s (Copy)', 'template part'), getItemTitle(item)), onCreate: onTemplatePartSuccess, onError: closeModal, confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), closeModal: closeModal !== null && closeModal !== void 0 ? closeModal : () => {} }); } }; /** * Duplicate action for TemplatePart. */ /* harmony default export */ const duplicate_template_part = (duplicateTemplatePart); ;// external ["wp","patterns"] const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; ;// ./node_modules/@wordpress/fields/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/fields'); ;// ./node_modules/@wordpress/fields/build-module/actions/duplicate-pattern.js /** * WordPress dependencies */ // @ts-ignore /** * Internal dependencies */ // Patterns. const { CreatePatternModalContents, useDuplicatePatternProps } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); const duplicatePattern = { id: 'duplicate-pattern', label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), isEligible: item => item.type !== 'wp_template_part', modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate pattern', 'action label'), RenderModal: ({ items, closeModal }) => { const [item] = items; const duplicatedProps = useDuplicatePatternProps({ pattern: item, onSuccess: () => closeModal?.() }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModalContents, { onClose: closeModal, confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), ...duplicatedProps }); } }; /** * Duplicate action for Pattern. */ /* harmony default export */ const duplicate_pattern = (duplicatePattern); ;// ./node_modules/@wordpress/fields/build-module/actions/rename-post.js /** * WordPress dependencies */ // @ts-ignore /** * Internal dependencies */ // Patterns. const { PATTERN_TYPES } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); const renamePost = { id: 'rename-post', label: (0,external_wp_i18n_namespaceObject.__)('Rename'), isEligible(post) { if (post.status === 'trash') { return false; } // Templates, template parts and patterns have special checks for renaming. if (!['wp_template', 'wp_template_part', ...Object.values(PATTERN_TYPES)].includes(post.type)) { return post.permissions?.update; } // In the case of templates, we can only rename custom templates. if (isTemplate(post)) { return isTemplateRemovable(post) && post.is_custom && post.permissions?.update; } if (isTemplatePart(post)) { return post.source === 'custom' && !post?.has_theme_file && post.permissions?.update; } return post.type === PATTERN_TYPES.user && post.permissions?.update; }, RenderModal: ({ items, closeModal, onActionPerformed }) => { const [item] = items; const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => getItemTitle(item)); const { editEntityRecord, saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); async function onRename(event) { event.preventDefault(); try { await editEntityRecord('postType', item.type, item.id, { title }); // Update state before saving rerenders the list. setTitle(''); closeModal?.(); // Persist edited entity. await saveEditedEntityRecord('postType', item.type, item.id, { throwOnError: true }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Name updated'), { type: 'snackbar' }); onActionPerformed?.(items); } catch (error) { const typedError = error; const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the name'); createErrorNotice(errorMessage, { type: 'snackbar' }); } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onRename, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Name'), value: title, onChange: setTitle, required: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal?.(); }, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)('Save') })] })] }) }); } }; /** * Rename action for PostWithPermissions. */ /* harmony default export */ const rename_post = (renamePost); ;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js /** * Internal dependencies */ function sort(a, b, direction) { return direction === 'asc' ? a - b : b - a; } function isValid(value, context) { // TODO: this implicitly means the value is required. if (value === '') { return false; } if (!Number.isInteger(Number(value))) { return false; } if (context?.elements) { const validValues = context?.elements.map(f => f.value); if (!validValues.includes(Number(value))) { return false; } } return true; } /* harmony default export */ const integer = ({ sort, isValid, Edit: 'integer' }); ;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js /** * Internal dependencies */ function text_sort(valueA, valueB, direction) { return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); } function text_isValid(value, context) { if (context?.elements) { const validValues = context?.elements?.map(f => f.value); if (!validValues.includes(value)) { return false; } } return true; } /* harmony default export */ const field_types_text = ({ sort: text_sort, isValid: text_isValid, Edit: 'text' }); ;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js /** * Internal dependencies */ function datetime_sort(a, b, direction) { const timeA = new Date(a).getTime(); const timeB = new Date(b).getTime(); return direction === 'asc' ? timeA - timeB : timeB - timeA; } function datetime_isValid(value, context) { if (context?.elements) { const validValues = context?.elements.map(f => f.value); if (!validValues.includes(value)) { return false; } } return true; } /* harmony default export */ const datetime = ({ sort: datetime_sort, isValid: datetime_isValid, Edit: 'datetime' }); ;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js /** * Internal dependencies */ /** * * @param {FieldType} type The field type definition to get. * * @return A field type definition. */ function getFieldTypeDefinition(type) { if ('integer' === type) { return integer; } if ('text' === type) { return field_types_text; } if ('datetime' === type) { return datetime; } return { sort: (a, b, direction) => { if (typeof a === 'number' && typeof b === 'number') { return direction === 'asc' ? a - b : b - a; } return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a); }, isValid: (value, context) => { if (context?.elements) { const validValues = context?.elements?.map(f => f.value); if (!validValues.includes(value)) { return false; } } return true; }, Edit: () => null }; } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js /** * WordPress dependencies */ /** * Internal dependencies */ function DateTime({ data, field, onChange, hideLabelFromVision }) { const { id, label } = field; const value = field.getValue({ item: data }); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "dataviews-controls__datetime", children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: label }), hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TimePicker, { currentTime: value, onChange: onChangeControl, hideLabelFromVision: true })] }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js /** * WordPress dependencies */ /** * Internal dependencies */ function Integer({ data, field, onChange, hideLabelFromVision }) { var _field$getValue; const { id, label, description } = field; const value = (_field$getValue = field.getValue({ item: data })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: Number(newValue) }), [id, onChange]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { label: label, help: description, value: value, onChange: onChangeControl, __next40pxDefaultSize: true, hideLabelFromVision: hideLabelFromVision }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js /** * WordPress dependencies */ /** * Internal dependencies */ function Radio({ data, field, onChange, hideLabelFromVision }) { const { id, label } = field; const value = field.getValue({ item: data }); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); if (field.elements) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { label: label, onChange: onChangeControl, options: field.elements, selected: value, hideLabelFromVision: hideLabelFromVision }); } return null; } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js /** * WordPress dependencies */ /** * Internal dependencies */ function Select({ data, field, onChange, hideLabelFromVision }) { var _field$getValue, _field$elements; const { id, label } = field; const value = (_field$getValue = field.getValue({ item: data })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); const elements = [ /* * Value can be undefined when: * * - the field is not required * - in bulk editing * */ { label: (0,external_wp_i18n_namespaceObject.__)('Select item'), value: '' }, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { label: label, value: value, options: elements, onChange: onChangeControl, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, hideLabelFromVision: hideLabelFromVision }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js /** * WordPress dependencies */ /** * Internal dependencies */ function Text({ data, field, onChange, hideLabelFromVision }) { const { id, label, placeholder } = field; const value = field.getValue({ item: data }); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { label: label, placeholder: placeholder, value: value !== null && value !== void 0 ? value : '', onChange: onChangeControl, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, hideLabelFromVision: hideLabelFromVision }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js /** * External dependencies */ /** * Internal dependencies */ const FORM_CONTROLS = { datetime: DateTime, integer: Integer, radio: Radio, select: Select, text: Text }; function getControl(field, fieldTypeDefinition) { if (typeof field.Edit === 'function') { return field.Edit; } if (typeof field.Edit === 'string') { return getControlByType(field.Edit); } if (field.elements) { return getControlByType('select'); } if (typeof fieldTypeDefinition.Edit === 'string') { return getControlByType(fieldTypeDefinition.Edit); } return fieldTypeDefinition.Edit; } function getControlByType(type) { if (Object.keys(FORM_CONTROLS).includes(type)) { return FORM_CONTROLS[type]; } throw 'Control ' + type + ' not found'; } ;// ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js /** * Internal dependencies */ const getValueFromId = id => ({ item }) => { const path = id.split('.'); let value = item; for (const segment of path) { if (value.hasOwnProperty(segment)) { value = value[segment]; } else { value = undefined; } } return value; }; /** * Apply default values and normalize the fields config. * * @param fields Fields config. * @return Normalized fields config. */ function normalizeFields(fields) { return fields.map(field => { var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting; const fieldTypeDefinition = getFieldTypeDefinition(field.type); const getValue = field.getValue || getValueFromId(field.id); const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) { return fieldTypeDefinition.sort(getValue({ item: a }), getValue({ item: b }), direction); }; const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) { return fieldTypeDefinition.isValid(getValue({ item }), context); }; const Edit = getControl(field, fieldTypeDefinition); const renderFromElements = ({ item }) => { const value = getValue({ item }); return field?.elements?.find(element => element.value === value)?.label || getValue({ item }); }; const render = field.render || (field.elements ? renderFromElements : getValue); return { ...field, label: field.label || field.id, header: field.header || field.label || field.id, getValue, render, sort, isValid, Edit, enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true, enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true }; }); } ;// ./node_modules/@wordpress/dataviews/build-module/validation.js /** * Internal dependencies */ /** * Whether or not the given item's value is valid according to the fields and form config. * * @param item The item to validate. * @param fields Fields config. * @param form Form config. * * @return A boolean indicating if the item is valid (true) or not (false). */ function isItemValid(item, fields, form) { const _fields = normalizeFields(fields.filter(({ id }) => !!form.fields?.includes(id))); return _fields.every(field => { return field.isValid(item, { elements: field.elements }); }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform-context/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const DataFormContext = (0,external_wp_element_namespaceObject.createContext)({ fields: [] }); function DataFormProvider({ fields, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormContext.Provider, { value: { fields }, children: children }); } /* harmony default export */ const dataform_context = (DataFormContext); ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/is-combined-field.js /** * Internal dependencies */ function isCombinedField(field) { return field.children !== undefined; } ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/regular/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function Header({ title }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-regular__header", spacing: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {})] }) }); } function FormRegularField({ data, field, onChange, hideLabelFromVision }) { var _field$labelPosition; const { fields } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); const form = (0,external_wp_element_namespaceObject.useMemo)(() => { if (isCombinedField(field)) { return { fields: field.children.map(child => { if (typeof child === 'string') { return { id: child }; } return child; }), type: 'regular' }; } return { type: 'regular', fields: [] }; }, [field]); if (isCombinedField(field)) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!hideLabelFromVision && field.label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Header, { title: field.label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { data: data, form: form, onChange: onChange })] }); } const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'top'; const fieldDefinition = fields.find(fieldDef => fieldDef.id === field.id); if (!fieldDefinition) { return null; } if (labelPosition === 'side') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataforms-layouts-regular__field", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field-label", children: fieldDefinition.label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { data: data, field: fieldDefinition, onChange: onChange, hideLabelFromVision: true }, fieldDefinition.id) })] }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { data: data, field: fieldDefinition, onChange: onChange, hideLabelFromVision: labelPosition === 'none' ? true : hideLabelFromVision }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js /** * WordPress dependencies */ const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); /* harmony default export */ const close_small = (closeSmall); ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function DropdownHeader({ title, onClose }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-panel__dropdown-header", spacing: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { label: (0,external_wp_i18n_namespaceObject.__)('Close'), icon: close_small, onClick: onClose, size: "small" })] }) }); } function PanelDropdown({ fieldDefinition, popoverAnchor, labelPosition = 'side', data, onChange, field }) { const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; const form = (0,external_wp_element_namespaceObject.useMemo)(() => { if (isCombinedField(field)) { return { type: 'regular', fields: field.children.map(child => { if (typeof child === 'string') { return { id: child }; } return child; }) }; } // If not explicit children return the field id itself. return { type: 'regular', fields: [{ id: field.id }] }; }, [field]); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { contentClassName: "dataforms-layouts-panel__field-dropdown", popoverProps: popoverProps, focusOnMount: true, toggleProps: { size: 'compact', variant: 'tertiary', tooltipPosition: 'middle left' }, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "dataforms-layouts-panel__field-control", size: "compact", variant: ['none', 'top'].includes(labelPosition) ? 'link' : 'tertiary', "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Field name. (0,external_wp_i18n_namespaceObject._x)('Edit %s', 'field'), fieldLabel), onClick: onToggle, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.render, { item: data }) }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { title: fieldLabel, onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { data: data, form: form, onChange: onChange, children: (FieldLayout, nestedField) => { var _form$fields; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { data: data, field: nestedField, onChange: onChange, hideLabelFromVision: ((_form$fields = form?.fields) !== null && _form$fields !== void 0 ? _form$fields : []).length < 2 }, nestedField.id); } })] }) }); } function FormPanelField({ data, field, onChange }) { var _field$labelPosition; const { fields } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); const fieldDefinition = fields.find(fieldDef => { // Default to the first child if it is a combined field. if (isCombinedField(field)) { const children = field.children.filter(child => typeof child === 'string' || !isCombinedField(child)); const firstChildFieldId = typeof children[0] === 'string' ? children[0] : children[0].id; return fieldDef.id === firstChildFieldId; } return fieldDef.id === field.id; }); const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'side'; // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); if (!fieldDefinition) { return null; } const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; if (labelPosition === 'top') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-panel__field", spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-label", style: { paddingBottom: 0 }, children: fieldLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { field: field, popoverAnchor: popoverAnchor, fieldDefinition: fieldDefinition, data: data, onChange: onChange, labelPosition: labelPosition }) })] }); } if (labelPosition === 'none') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { field: field, popoverAnchor: popoverAnchor, fieldDefinition: fieldDefinition, data: data, onChange: onChange, labelPosition: labelPosition }) }); } // Defaults to label position side. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { ref: setPopoverAnchor, className: "dataforms-layouts-panel__field", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-label", children: fieldLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { field: field, popoverAnchor: popoverAnchor, fieldDefinition: fieldDefinition, data: data, onChange: onChange, labelPosition: labelPosition }) })] }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/index.js /** * Internal dependencies */ const FORM_FIELD_LAYOUTS = [{ type: 'regular', component: FormRegularField }, { type: 'panel', component: FormPanelField }]; function getFormFieldLayout(type) { return FORM_FIELD_LAYOUTS.find(layout => layout.type === type); } ;// ./node_modules/@wordpress/dataviews/build-module/normalize-form-fields.js /** * Internal dependencies */ function normalizeFormFields(form) { var _form$type, _form$labelPosition, _form$fields; let layout = 'regular'; if (['regular', 'panel'].includes((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : '')) { layout = form.type; } const labelPosition = (_form$labelPosition = form.labelPosition) !== null && _form$labelPosition !== void 0 ? _form$labelPosition : layout === 'regular' ? 'top' : 'side'; return ((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(field => { var _field$layout, _field$labelPosition; if (typeof field === 'string') { return { id: field, layout, labelPosition }; } const fieldLayout = (_field$layout = field.layout) !== null && _field$layout !== void 0 ? _field$layout : layout; const fieldLabelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : fieldLayout === 'regular' ? 'top' : 'side'; return { ...field, layout: fieldLayout, labelPosition: fieldLabelPosition }; }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/data-form-layout.js /** * WordPress dependencies */ /** * Internal dependencies */ function DataFormLayout({ data, form, onChange, children }) { const { fields: fieldDefinitions } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); function getFieldDefinition(field) { const fieldId = typeof field === 'string' ? field : field.id; return fieldDefinitions.find(fieldDefinition => fieldDefinition.id === fieldId); } const normalizedFormFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFormFields(form), [form]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: normalizedFormFields.map(formField => { const FieldLayout = getFormFieldLayout(formField.layout)?.component; if (!FieldLayout) { return null; } const fieldDefinition = !isCombinedField(formField) ? getFieldDefinition(formField) : undefined; if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) { return null; } if (children) { return children(FieldLayout, formField); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { data: data, field: formField, onChange: onChange }, formField.id); }) }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function DataForm({ data, form, fields, onChange }) { const normalizedFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); if (!form.fields) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormProvider, { fields: normalizedFields, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { data: data, form: form, onChange: onChange }) }); } ;// ./node_modules/@wordpress/fields/build-module/fields/order/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const orderField = { id: 'menu_order', type: 'integer', label: (0,external_wp_i18n_namespaceObject.__)('Order'), description: (0,external_wp_i18n_namespaceObject.__)('Determines the order of pages.') }; /** * Order field for BasePost. */ /* harmony default export */ const order = (orderField); ;// ./node_modules/@wordpress/fields/build-module/actions/reorder-page.js /** * WordPress dependencies */ /** * Internal dependencies */ const reorder_page_fields = [order]; const formOrderAction = { fields: ['menu_order'] }; function ReorderModal({ items, closeModal, onActionPerformed }) { const [item, setItem] = (0,external_wp_element_namespaceObject.useState)(items[0]); const orderInput = item.menu_order; const { editEntityRecord, saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); async function onOrder(event) { event.preventDefault(); if (!isItemValid(item, reorder_page_fields, formOrderAction)) { return; } try { await editEntityRecord('postType', item.type, item.id, { menu_order: orderInput }); closeModal?.(); // Persist edited entity. await saveEditedEntityRecord('postType', item.type, item.id, { throwOnError: true }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Order updated.'), { type: 'snackbar' }); onActionPerformed?.(items); } catch (error) { const typedError = error; const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the order'); createErrorNotice(errorMessage, { type: 'snackbar' }); } } const isSaveDisabled = !isItemValid(item, reorder_page_fields, formOrderAction); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onOrder, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: (0,external_wp_i18n_namespaceObject.__)('Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataForm, { data: item, fields: reorder_page_fields, form: formOrderAction, onChange: changes => setItem({ ...item, ...changes }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal?.(); }, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", accessibleWhenDisabled: true, disabled: isSaveDisabled, children: (0,external_wp_i18n_namespaceObject.__)('Save') })] })] }) }); } const reorderPage = { id: 'order-pages', label: (0,external_wp_i18n_namespaceObject.__)('Order'), isEligible({ status }) { return status !== 'trash'; }, RenderModal: ReorderModal }; /** * Reorder action for BasePost. */ /* harmony default export */ const reorder_page = (reorderPage); ;// ./node_modules/client-zip/index.js "stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const i=Number(0xffffffffn&n),r=Number(n>>32n);this.setUint32(e+(t?0:4),i,t),this.setUint32(e+(t?4:0),r,t)}});var e=e=>new DataView(new ArrayBuffer(e)),n=e=>new Uint8Array(e.buffer||e),t=e=>(new TextEncoder).encode(String(e)),i=e=>Math.min(4294967295,Number(e)),r=e=>Math.min(65535,Number(e));function o(e,i,r){void 0===i||i instanceof Date||(i=new Date(i));const o=void 0!==e;if(r||(r=o?436:509),e instanceof File)return{isFile:o,t:i||new Date(e.lastModified),bytes:e.stream(),mode:r};if(e instanceof Response)return{isFile:o,t:i||new Date(e.headers.get("Last-Modified")||Date.now()),bytes:e.body,mode:r};if(void 0===i)i=new Date;else if(isNaN(i))throw new Error("Invalid modification date.");if(!o)return{isFile:o,t:i,mode:r};if("string"==typeof e)return{isFile:o,t:i,bytes:t(e),mode:r};if(e instanceof Blob)return{isFile:o,t:i,bytes:e.stream(),mode:r};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:o,t:i,bytes:e,mode:r};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:o,t:i,bytes:n(e),mode:r};if(Symbol.asyncIterator in e)return{isFile:o,t:i,bytes:f(e[Symbol.asyncIterator]()),mode:r};throw new TypeError("Unsupported input format.")}function f(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const i=await e.next();if(!i.value){n.close();break}{const e=a(i.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function a(e){return"string"==typeof e?t(e):e instanceof Uint8Array?e:n(e)}function s(e,i,r){let[o,f]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[n(e),1]:[t(e),0]:[void 0,0]}(i);if(e instanceof File)return{i:d(o||t(e.name)),o:BigInt(e.size),u:f};if(e instanceof Response){const n=e.headers.get("content-disposition"),i=n&&n.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),a=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=a&&decodeURIComponent(a),u=r||+e.headers.get("content-length");return{i:d(o||t(s)),o:BigInt(u),u:f}}return o=d(o,void 0!==e||void 0!==r),"string"==typeof e?{i:o,o:BigInt(t(e).length),u:f}:e instanceof Blob?{i:o,o:BigInt(e.size),u:f}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:o,o:BigInt(e.byteLength),u:f}:{i:o,o:u(e,r),u:f}}function u(e,n){return n>-1?BigInt(n):e?void 0:0n}function d(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var l=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);l[e]=n}function y(e,n=0){n=~n;for(var t=0,i=e.length;t<i;t++)n=n>>>8^l[255&n^e[t]];return~n>>>0}function w(e,n,t=0){const i=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,r=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,i,1),n.setUint16(t+2,r,1)}function B({i:e,u:n},t){return 8*(!n||(t??function(e){try{b.decode(e)}catch{return 0}return 1}(e)))}var b=new TextDecoder("utf8",{fatal:1});function p(t,i=0){const r=e(30);return r.setUint32(0,1347093252),r.setUint32(4,754976768|i),w(t.t,r,10),r.setUint16(26,t.i.length,1),n(r)}async function*g(e){let{bytes:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.l=y(n,0),e.o=BigInt(n.length);else{e.o=0n;const t=n.getReader();for(;;){const{value:n,done:i}=await t.read();if(i)break;e.l=y(n,e.l),e.o+=BigInt(n.length),yield n}}}function I(t,r){const o=e(16+(r?8:0));return o.setUint32(0,1347094280),o.setUint32(4,t.isFile?t.l:0,1),r?(o.setBigUint64(8,t.o,1),o.setBigUint64(16,t.o,1)):(o.setUint32(8,i(t.o),1),o.setUint32(12,i(t.o),1)),n(o)}function v(t,r,o=0,f=0){const a=e(46);return a.setUint32(0,1347092738),a.setUint32(4,755182848),a.setUint16(8,2048|o),w(t.t,a,12),a.setUint32(16,t.isFile?t.l:0,1),a.setUint32(20,i(t.o),1),a.setUint32(24,i(t.o),1),a.setUint16(28,t.i.length,1),a.setUint16(30,f,1),a.setUint16(40,t.mode|(t.isFile?32768:16384),1),a.setUint32(42,i(r),1),n(a)}function h(t,i,r){const o=e(r);return o.setUint16(0,1,1),o.setUint16(2,r-4,1),16&r&&(o.setBigUint64(4,t.o,1),o.setBigUint64(12,t.o,1)),o.setBigUint64(r-8,i,1),n(o)}function D(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified,e.mode]]}var S=e=>function(e){let n=BigInt(22),t=0n,i=0;for(const r of e){if(!r.i)throw new Error("Every file must have a non-empty name.");if(void 0===r.o)throw new Error(`Missing size for file "${(new TextDecoder).decode(r.i)}".`);const e=r.o>=0xffffffffn,o=t>=0xffffffffn;t+=BigInt(46+r.i.length+(e&&8))+r.o,n+=BigInt(r.i.length+46+(12*o|28*e)),i||(i=e)}return(i||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield s(...D(n)[0])}(e));function A(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(S(n.metadata))),new Response(N(e,n),{headers:t})}function N(t,a={}){const u=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,i]=D(e.value);return{done:0,value:Object.assign(o(...i),s(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(t);return f(async function*(t,o){const f=[];let a=0n,s=0n,u=0;for await(const e of t){const n=B(e,o.buffersAreUTF8);yield p(e,n),yield new Uint8Array(e.i),e.isFile&&(yield*g(e));const t=e.o>=0xffffffffn,i=12*(a>=0xffffffffn)|28*t;yield I(e,t),f.push(v(e,a,n,i)),f.push(e.i),i&&f.push(h(e,a,i)),t&&(a+=8n),s++,a+=BigInt(46+e.i.length)+e.o,u||(u=t)}let d=0n;for(const e of f)yield e,d+=BigInt(e.length);if(u||a>=0xffffffffn){const t=e(76);t.setUint32(0,1347094022),t.setBigUint64(4,BigInt(44),1),t.setUint32(12,755182848),t.setBigUint64(24,s,1),t.setBigUint64(32,s,1),t.setBigUint64(40,d,1),t.setBigUint64(48,a,1),t.setUint32(56,1347094023),t.setBigUint64(64,a+d,1),t.setUint32(72,1,1),yield n(t)}const l=e(22);l.setUint32(0,1347093766),l.setUint16(8,r(s),1),l.setUint16(10,r(s),1),l.setUint32(12,i(d),1),l.setUint32(16,i(a),1),yield n(l)}(u,a),u)} ;// external ["wp","blob"] const external_wp_blob_namespaceObject = window["wp"]["blob"]; ;// ./node_modules/@wordpress/icons/build-module/library/download.js /** * WordPress dependencies */ const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) }); /* harmony default export */ const library_download = (download); ;// ./node_modules/@wordpress/fields/build-module/actions/export-pattern.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function getJsonFromItem(item) { return JSON.stringify({ __file: item.type, title: getItemTitle(item), content: typeof item.content === 'string' ? item.content : item.content?.raw, syncStatus: item.wp_pattern_sync_status }, null, 2); } const exportPattern = { id: 'export-pattern', label: (0,external_wp_i18n_namespaceObject.__)('Export as JSON'), icon: library_download, supportsBulk: true, isEligible: item => item.type === 'wp_block', callback: async items => { if (items.length === 1) { return (0,external_wp_blob_namespaceObject.downloadBlob)(`${paramCase(getItemTitle(items[0]) || items[0].slug)}.json`, getJsonFromItem(items[0]), 'application/json'); } const nameCount = {}; const filesToZip = items.map(item => { const name = paramCase(getItemTitle(item) || item.slug); nameCount[name] = (nameCount[name] || 0) + 1; return { name: `${name + (nameCount[name] > 1 ? '-' + (nameCount[name] - 1) : '')}.json`, lastModified: new Date(), input: getJsonFromItem(item) }; }); return (0,external_wp_blob_namespaceObject.downloadBlob)((0,external_wp_i18n_namespaceObject.__)('patterns-export') + '.zip', await A(filesToZip).blob(), 'application/zip'); } }; /** * Export action as JSON for Pattern. */ /* harmony default export */ const export_pattern = (exportPattern); ;// ./node_modules/@wordpress/icons/build-module/library/backup.js /** * WordPress dependencies */ const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) }); /* harmony default export */ const library_backup = (backup); ;// ./node_modules/@wordpress/fields/build-module/actions/restore-post.js /** * WordPress dependencies */ /** * Internal dependencies */ const restorePost = { id: 'restore', label: (0,external_wp_i18n_namespaceObject.__)('Restore'), isPrimary: true, icon: library_backup, supportsBulk: true, isEligible(item) { return !isTemplateOrTemplatePart(item) && item.type !== 'wp_block' && item.status === 'trash' && item.permissions?.update; }, async callback(posts, { registry, onActionPerformed }) { const { createSuccessNotice, createErrorNotice } = registry.dispatch(external_wp_notices_namespaceObject.store); const { editEntityRecord, saveEditedEntityRecord } = registry.dispatch(external_wp_coreData_namespaceObject.store); await Promise.allSettled(posts.map(post => { return editEntityRecord('postType', post.type, post.id, { status: 'draft' }); })); const promiseResult = await Promise.allSettled(posts.map(post => { return saveEditedEntityRecord('postType', post.type, post.id, { throwOnError: true }); })); if (promiseResult.every(({ status }) => status === 'fulfilled')) { let successMessage; if (posts.length === 1) { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of posts. */ (0,external_wp_i18n_namespaceObject.__)('"%s" has been restored.'), getItemTitle(posts[0])); } else if (posts[0].type === 'page') { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of posts. */ (0,external_wp_i18n_namespaceObject.__)('%d pages have been restored.'), posts.length); } else { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of posts. */ (0,external_wp_i18n_namespaceObject.__)('%d posts have been restored.'), posts.length); } createSuccessNotice(successMessage, { type: 'snackbar', id: 'restore-post-action' }); if (onActionPerformed) { onActionPerformed(posts); } } else { // If there was at lease one failure. let errorMessage; // If we were trying to move a single post to the trash. if (promiseResult.length === 1) { const typedError = promiseResult[0]; if (typedError.reason?.message) { errorMessage = typedError.reason.message; } else { errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the post.'); } // If we were trying to move multiple posts to the trash } else { const errorMessages = new Set(); const failedPromises = promiseResult.filter(({ status }) => status === 'rejected'); for (const failedPromise of failedPromises) { const typedError = failedPromise; if (typedError.reason?.message) { errorMessages.add(typedError.reason.message); } } if (errorMessages.size === 0) { errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts.'); } else if (errorMessages.size === 1) { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts: %s'), [...errorMessages][0]); } else { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while restoring the posts: %s'), [...errorMessages].join(',')); } } createErrorNotice(errorMessage, { type: 'snackbar' }); } } }; /** * Restore action for PostWithPermissions. */ /* harmony default export */ const restore_post = (restorePost); ;// ./node_modules/@wordpress/fields/build-module/actions/reset-post.js /** * WordPress dependencies */ // @ts-ignore /** * Internal dependencies */ const reset_post_isTemplateRevertable = templateOrTemplatePart => { if (!templateOrTemplatePart) { return false; } return templateOrTemplatePart.source === 'custom' && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); }; /** * Copied - pasted from https://github.com/WordPress/gutenberg/blob/bf1462ad37d4637ebbf63270b9c244b23c69e2a8/packages/editor/src/store/private-actions.js#L233-L365 * * @param {Object} template The template to revert. * @param {Object} [options] * @param {boolean} [options.allowUndo] Whether to allow the user to undo * reverting the template. Default true. */ const revertTemplate = async (template, { allowUndo = true } = {}) => { const noticeId = 'edit-site-template-reverted'; (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).removeNotice(noticeId); if (!reset_post_isTemplateRevertable(template)) { (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), { type: 'snackbar' }); return; } try { const templateEntityConfig = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type); if (!templateEntityConfig) { (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { type: 'snackbar' }); return; } const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, { context: 'edit', source: template.origin }); const fileTemplate = await external_wp_apiFetch_default()({ path: fileTemplatePath }); if (!fileTemplate) { (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { type: 'snackbar' }); return; } const serializeBlocks = ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); const edited = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); // We are fixing up the undo level here to make sure we can undo // the revert in the header toolbar correctly. (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, { content: serializeBlocks, // Required to make the `undo` behave correctly. blocks: edited.blocks, // Required to revert the blocks in the editor. source: 'custom' // required to avoid turning the editor into a dirty state }, { undoIgnore: true // Required to merge this edit with the last undo level. }); const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, { content: serializeBlocks, blocks, source: 'theme' }); if (allowUndo) { const undoRevert = () => { (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, { content: serializeBlocks, blocks: edited.blocks, source: 'custom' }); }; (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reset.'), { type: 'snackbar', id: noticeId, actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Undo'), onClick: undoRevert }] }); } } catch (error) { const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.'); (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { type: 'snackbar' }); } }; const resetPostAction = { id: 'reset-post', label: (0,external_wp_i18n_namespaceObject.__)('Reset'), isEligible: item => { return isTemplateOrTemplatePart(item) && item?.source === 'custom' && (Boolean(item.type === 'wp_template' && item?.plugin) || item?.has_theme_file); }, icon: library_backup, supportsBulk: true, hideModalHeader: true, RenderModal: ({ items, closeModal, onActionPerformed }) => { const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const { saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const onConfirm = async () => { try { for (const template of items) { await revertTemplate(template, { allowUndo: false }); await saveEditedEntityRecord('postType', template.type, template.id); } createSuccessNotice(items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of items. */ (0,external_wp_i18n_namespaceObject.__)('%s items reset.'), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The template/part's name. */ (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), getItemTitle(items[0])), { type: 'snackbar', id: 'revert-template-action' }); } catch (error) { let fallbackErrorMessage; if (items[0].type === 'wp_template') { fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the templates.'); } else { fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template part.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template parts.'); } const typedError = error; const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : fallbackErrorMessage; createErrorNotice(errorMessage, { type: 'snackbar' }); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('Reset to default and clear all customizations?') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: closeModal, disabled: isBusy, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: async () => { setIsBusy(true); await onConfirm(); onActionPerformed?.(items); setIsBusy(false); closeModal?.(); }, isBusy: isBusy, disabled: isBusy, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Reset') })] })] }); } }; /** * Reset action for Template and TemplatePart. */ /* harmony default export */ const reset_post = (resetPostAction); ;// ./node_modules/@wordpress/icons/build-module/library/trash.js /** * WordPress dependencies */ const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" }) }); /* harmony default export */ const library_trash = (trash); ;// ./node_modules/@wordpress/fields/build-module/mutation/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function getErrorMessagesFromPromises(allSettledResults) { const errorMessages = new Set(); // If there was at lease one failure. if (allSettledResults.length === 1) { const typedError = allSettledResults[0]; if (typedError.reason?.message) { errorMessages.add(typedError.reason.message); } } else { const failedPromises = allSettledResults.filter(({ status }) => status === 'rejected'); for (const failedPromise of failedPromises) { const typedError = failedPromise; if (typedError.reason?.message) { errorMessages.add(typedError.reason.message); } } } return errorMessages; } const deletePostWithNotices = async (posts, notice, callbacks) => { const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store); const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store); const allSettledResults = await Promise.allSettled(posts.map(post => { return deleteEntityRecord('postType', post.type, post.id, { force: true }, { throwOnError: true }); })); // If all the promises were fulfilled with success. if (allSettledResults.every(({ status }) => status === 'fulfilled')) { var _notice$success$type; let successMessage; if (allSettledResults.length === 1) { successMessage = notice.success.messages.getMessage(posts[0]); } else { successMessage = notice.success.messages.getBatchMessage(posts); } createSuccessNotice(successMessage, { type: (_notice$success$type = notice.success.type) !== null && _notice$success$type !== void 0 ? _notice$success$type : 'snackbar', id: notice.success.id }); callbacks.onActionPerformed?.(posts); } else { var _notice$error$type; const errorMessages = getErrorMessagesFromPromises(allSettledResults); let errorMessage = ''; if (allSettledResults.length === 1) { errorMessage = notice.error.messages.getMessage(errorMessages); } else { errorMessage = notice.error.messages.getBatchMessage(errorMessages); } createErrorNotice(errorMessage, { type: (_notice$error$type = notice.error.type) !== null && _notice$error$type !== void 0 ? _notice$error$type : 'snackbar', id: notice.error.id }); callbacks.onActionError?.(); } }; const editPostWithNotices = async (postsWithUpdates, notice, callbacks) => { const { createSuccessNotice, createErrorNotice } = dispatch(noticesStore); const { editEntityRecord, saveEditedEntityRecord } = dispatch(coreStore); await Promise.allSettled(postsWithUpdates.map(post => { return editEntityRecord('postType', post.originalPost.type, post.originalPost.id, { ...post.changes }); })); const allSettledResults = await Promise.allSettled(postsWithUpdates.map(post => { return saveEditedEntityRecord('postType', post.originalPost.type, post.originalPost.id, { throwOnError: true }); })); // If all the promises were fulfilled with success. if (allSettledResults.every(({ status }) => status === 'fulfilled')) { var _notice$success$type2; let successMessage; if (allSettledResults.length === 1) { successMessage = notice.success.messages.getMessage(postsWithUpdates[0].originalPost); } else { successMessage = notice.success.messages.getBatchMessage(postsWithUpdates.map(post => post.originalPost)); } createSuccessNotice(successMessage, { type: (_notice$success$type2 = notice.success.type) !== null && _notice$success$type2 !== void 0 ? _notice$success$type2 : 'snackbar', id: notice.success.id }); callbacks.onActionPerformed?.(postsWithUpdates.map(post => post.originalPost)); } else { var _notice$error$type2; const errorMessages = getErrorMessagesFromPromises(allSettledResults); let errorMessage = ''; if (allSettledResults.length === 1) { errorMessage = notice.error.messages.getMessage(errorMessages); } else { errorMessage = notice.error.messages.getBatchMessage(errorMessages); } createErrorNotice(errorMessage, { type: (_notice$error$type2 = notice.error.type) !== null && _notice$error$type2 !== void 0 ? _notice$error$type2 : 'snackbar', id: notice.error.id }); callbacks.onActionError?.(); } }; ;// ./node_modules/@wordpress/fields/build-module/actions/delete-post.js /** * WordPress dependencies */ // @ts-ignore /** * Internal dependencies */ const { PATTERN_TYPES: delete_post_PATTERN_TYPES } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); // This action is used for templates, patterns and template parts. // Every other post type uses the similar `trashPostAction` which // moves the post to trash. const deletePostAction = { id: 'delete-post', label: (0,external_wp_i18n_namespaceObject.__)('Delete'), isPrimary: true, icon: library_trash, isEligible(post) { if (isTemplateOrTemplatePart(post)) { return isTemplateRemovable(post); } // We can only remove user patterns. return post.type === delete_post_PATTERN_TYPES.user; }, supportsBulk: true, hideModalHeader: true, RenderModal: ({ items, closeModal, onActionPerformed }) => { const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const isResetting = items.every(item => isTemplateOrTemplatePart(item) && item?.has_theme_file); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: number of items to delete. (0,external_wp_i18n_namespaceObject._n)('Delete %d item?', 'Delete %d items?', items.length), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The template or template part's title (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', 'template part'), getItemTitle(items[0])) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: closeModal, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", onClick: async () => { setIsBusy(true); const notice = { success: { messages: { getMessage: item => { return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The template/part's name. */ (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getItemTitle(item))) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The template/part's name. */ (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'template part'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getItemTitle(item))); }, getBatchMessage: () => { return isResetting ? (0,external_wp_i18n_namespaceObject.__)('Items reset.') : (0,external_wp_i18n_namespaceObject.__)('Items deleted.'); } } }, error: { messages: { getMessage: error => { if (error.size === 1) { return [...error][0]; } return isResetting ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the item.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the item.'); }, getBatchMessage: errors => { if (errors.size === 0) { return isResetting ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the items.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items.'); } if (errors.size === 1) { return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the items: %s'), [...errors][0]) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items: %s'), [...errors][0]); } return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while reverting the items: %s'), [...errors].join(',')) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the items: %s'), [...errors].join(',')); } } } }; await deletePostWithNotices(items, notice, { onActionPerformed }); setIsBusy(false); closeModal?.(); }, isBusy: isBusy, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Delete') })] })] }); } }; /** * Delete action for Templates, Patterns and Template Parts. */ /* harmony default export */ const delete_post = (deletePostAction); ;// ./node_modules/@wordpress/fields/build-module/actions/trash-post.js /** * WordPress dependencies */ /** * Internal dependencies */ const trash_post_trashPost = { id: 'move-to-trash', label: (0,external_wp_i18n_namespaceObject.__)('Move to trash'), isPrimary: true, icon: library_trash, isEligible(item) { if (isTemplateOrTemplatePart(item) || item.type === 'wp_block') { return false; } return !!item.status && !['auto-draft', 'trash'].includes(item.status) && item.permissions?.delete; }, supportsBulk: true, hideModalHeader: true, RenderModal: ({ items, closeModal, onActionPerformed }) => { const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: items.length === 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The item's title. (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move "%s" to the trash?'), getItemTitle(items[0])) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: The number of items (2 or more). (0,external_wp_i18n_namespaceObject._n)('Are you sure you want to move %d item to the trash ?', 'Are you sure you want to move %d items to the trash ?', items.length), items.length) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: closeModal, disabled: isBusy, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: async () => { setIsBusy(true); const promiseResult = await Promise.allSettled(items.map(item => deleteEntityRecord('postType', item.type, item.id.toString(), {}, { throwOnError: true }))); // If all the promises were fulfilled with success. if (promiseResult.every(({ status }) => status === 'fulfilled')) { let successMessage; if (promiseResult.length === 1) { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The item's title. */ (0,external_wp_i18n_namespaceObject.__)('"%s" moved to the trash.'), getItemTitle(items[0])); } else { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of items. */ (0,external_wp_i18n_namespaceObject._n)('%s item moved to the trash.', '%s items moved to the trash.', items.length), items.length); } createSuccessNotice(successMessage, { type: 'snackbar', id: 'move-to-trash-action' }); } else { // If there was at least one failure. let errorMessage; // If we were trying to delete a single item. if (promiseResult.length === 1) { const typedError = promiseResult[0]; if (typedError.reason?.message) { errorMessage = typedError.reason.message; } else { errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the item to the trash.'); } // If we were trying to delete multiple items. } else { const errorMessages = new Set(); const failedPromises = promiseResult.filter(({ status }) => status === 'rejected'); for (const failedPromise of failedPromises) { const typedError = failedPromise; if (typedError.reason?.message) { errorMessages.add(typedError.reason.message); } } if (errorMessages.size === 0) { errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the items to the trash.'); } else if (errorMessages.size === 1) { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the item to the trash: %s'), [...errorMessages][0]); } else { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while moving the items to the trash: %s'), [...errorMessages].join(',')); } } createErrorNotice(errorMessage, { type: 'snackbar' }); } if (onActionPerformed) { onActionPerformed(items); } setIsBusy(false); closeModal?.(); }, isBusy: isBusy, disabled: isBusy, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject._x)('Trash', 'verb') })] })] }); } }; /** * Trash action for PostWithPermissions. */ /* harmony default export */ const trash_post = (trash_post_trashPost); ;// ./node_modules/@wordpress/fields/build-module/actions/permanently-delete-post.js /** * WordPress dependencies */ /** * Internal dependencies */ const permanentlyDeletePost = { id: 'permanently-delete', label: (0,external_wp_i18n_namespaceObject.__)('Permanently delete'), supportsBulk: true, icon: library_trash, isEligible(item) { if (isTemplateOrTemplatePart(item) || item.type === 'wp_block') { return false; } const { status, permissions } = item; return status === 'trash' && permissions?.delete; }, hideModalHeader: true, RenderModal: ({ items, closeModal, onActionPerformed }) => { const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: number of items to delete. (0,external_wp_i18n_namespaceObject._n)('Are you sure you want to permanently delete %d item?', 'Are you sure you want to permanently delete %d items?', items.length), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The post's title (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to permanently delete "%s"?'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getItemTitle(items[0]))) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: closeModal, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", onClick: async () => { setIsBusy(true); const promiseResult = await Promise.allSettled(items.map(post => deleteEntityRecord('postType', post.type, post.id, { force: true }, { throwOnError: true }))); // If all the promises were fulfilled with success. if (promiseResult.every(({ status }) => status === 'fulfilled')) { let successMessage; if (promiseResult.length === 1) { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The posts's title. */ (0,external_wp_i18n_namespaceObject.__)('"%s" permanently deleted.'), getItemTitle(items[0])); } else { successMessage = (0,external_wp_i18n_namespaceObject.__)('The items were permanently deleted.'); } createSuccessNotice(successMessage, { type: 'snackbar', id: 'permanently-delete-post-action' }); onActionPerformed?.(items); } else { // If there was at lease one failure. let errorMessage; // If we were trying to permanently delete a single post. if (promiseResult.length === 1) { const typedError = promiseResult[0]; if (typedError.reason?.message) { errorMessage = typedError.reason.message; } else { errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the item.'); } // If we were trying to permanently delete multiple posts } else { const errorMessages = new Set(); const failedPromises = promiseResult.filter(({ status }) => status === 'rejected'); for (const failedPromise of failedPromises) { const typedError = failedPromise; if (typedError.reason?.message) { errorMessages.add(typedError.reason.message); } } if (errorMessages.size === 0) { errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the items.'); } else if (errorMessages.size === 1) { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the items: %s'), [...errorMessages][0]); } else { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while permanently deleting the items: %s'), [...errorMessages].join(',')); } } createErrorNotice(errorMessage, { type: 'snackbar' }); } setIsBusy(false); closeModal?.(); }, isBusy: isBusy, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Delete permanently') })] })] }); } }; /** * Delete action for PostWithPermissions. */ /* harmony default export */ const permanently_delete_post = (permanentlyDeletePost); ;// external ["wp","mediaUtils"] const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; ;// ./node_modules/@wordpress/icons/build-module/library/line-solid.js /** * WordPress dependencies */ const lineSolid = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 11.25h14v1.5H5z" }) }); /* harmony default export */ const line_solid = (lineSolid); ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/featured-image-edit.js /** * WordPress dependencies */ // @ts-ignore /** * Internal dependencies */ const FeaturedImageEdit = ({ data, field, onChange }) => { const { id } = field; const value = field.getValue({ item: data }); const media = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); return getEntityRecord('root', 'media', value); }, [value]); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); const url = media?.source_url; const title = media?.title?.rendered; const ref = (0,external_wp_element_namespaceObject.useRef)(null); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { className: "fields-controls__featured-image", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-controls__featured-image-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_mediaUtils_namespaceObject.MediaUpload, { onSelect: selectedMedia => { onChangeControl(selectedMedia.id); }, allowedTypes: ['image'], render: ({ open }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, role: "button", tabIndex: -1, onClick: () => { open(); }, onKeyDown: open, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { rowGap: 0, columnGap: 8, templateColumns: "24px 1fr 24px", children: [url && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { className: "fields-controls__featured-image-image", alt: "", width: 24, height: 24, src: url }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-title", children: title })] }), !url && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-placeholder", style: { width: '24px', height: '24px' } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-title", children: (0,external_wp_i18n_namespaceObject.__)('Choose an image…') })] }), url && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", className: "fields-controls__featured-image-remove-button", icon: line_solid, onClick: event => { event.stopPropagation(); onChangeControl(0); } }) })] }) }); } }) }) }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/featured-image-view.js /** * WordPress dependencies */ /** * Internal dependencies */ const FeaturedImageView = ({ item }) => { const mediaId = item.featured_media; const media = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); return mediaId ? getEntityRecord('root', 'media', mediaId) : null; }, [mediaId]); const url = media?.source_url; if (url) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { className: "fields-controls__featured-image-image", src: url, alt: "" }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-placeholder" }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const featuredImageField = { id: 'featured_media', type: 'media', label: (0,external_wp_i18n_namespaceObject.__)('Featured Image'), Edit: FeaturedImageEdit, render: FeaturedImageView, enableSorting: false }; /** * Featured Image field for BasePost. */ /* harmony default export */ const featured_image = (featuredImageField); ;// ./node_modules/clsx/dist/clsx.mjs function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js /** * WordPress dependencies */ const commentAuthorAvatar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z", clipRule: "evenodd" }) }); /* harmony default export */ const comment_author_avatar = (commentAuthorAvatar); ;// ./node_modules/@wordpress/fields/build-module/fields/author/author-view.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function AuthorView({ item }) { const { text, imageUrl } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); let user; if (!!item.author) { user = getEntityRecord('root', 'user', item.author); } return { imageUrl: user?.avatar_urls?.[48], text: user?.name }; }, [item]); const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [!!imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('page-templates-author-field__avatar', { 'is-loaded': isImageLoaded }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { onLoad: () => setIsImageLoaded(true), alt: (0,external_wp_i18n_namespaceObject.__)('Author avatar'), src: imageUrl }) }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: comment_author_avatar }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text })] }); } /* harmony default export */ const author_view = (AuthorView); ;// ./node_modules/@wordpress/fields/build-module/fields/author/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const authorField = { label: (0,external_wp_i18n_namespaceObject.__)('Author'), id: 'author', type: 'integer', elements: [], render: author_view, sort: (a, b, direction) => { const nameA = a._embedded?.author?.[0]?.name || ''; const nameB = b._embedded?.author?.[0]?.name || ''; return direction === 'asc' ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA); } }; /** * Author field for BasePost. */ /* harmony default export */ const author = (authorField); ;// ./node_modules/@wordpress/icons/build-module/library/drafts.js /** * WordPress dependencies */ const drafts = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z" }) }); /* harmony default export */ const library_drafts = (drafts); ;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js /** * WordPress dependencies */ const scheduled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" }) }); /* harmony default export */ const library_scheduled = (scheduled); ;// ./node_modules/@wordpress/icons/build-module/library/pending.js /** * WordPress dependencies */ const pending = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z" }) }); /* harmony default export */ const library_pending = (pending); ;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js /** * WordPress dependencies */ const notAllowed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z" }) }); /* harmony default export */ const not_allowed = (notAllowed); ;// ./node_modules/@wordpress/icons/build-module/library/published.js /** * WordPress dependencies */ const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" }) }); /* harmony default export */ const library_published = (published); ;// ./node_modules/@wordpress/fields/build-module/fields/status/status-elements.js /** * WordPress dependencies */ // See https://github.com/WordPress/gutenberg/issues/55886 // We do not support custom statutes at the moment. const STATUSES = [{ value: 'draft', label: (0,external_wp_i18n_namespaceObject.__)('Draft'), icon: library_drafts, description: (0,external_wp_i18n_namespaceObject.__)('Not ready to publish.') }, { value: 'future', label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), icon: library_scheduled, description: (0,external_wp_i18n_namespaceObject.__)('Publish automatically on a chosen date.') }, { value: 'pending', label: (0,external_wp_i18n_namespaceObject.__)('Pending Review'), icon: library_pending, description: (0,external_wp_i18n_namespaceObject.__)('Waiting for review before publishing.') }, { value: 'private', label: (0,external_wp_i18n_namespaceObject.__)('Private'), icon: not_allowed, description: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') }, { value: 'publish', label: (0,external_wp_i18n_namespaceObject.__)('Published'), icon: library_published, description: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') }, { value: 'trash', label: (0,external_wp_i18n_namespaceObject.__)('Trash'), icon: library_trash }]; /* harmony default export */ const status_elements = (STATUSES); ;// ./node_modules/@wordpress/fields/build-module/fields/status/status-view.js /** * WordPress dependencies */ /** * Internal dependencies */ function StatusView({ item }) { const status = status_elements.find(({ value }) => value === item.status); const label = status?.label || item.status; const icon = status?.icon; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-post-list__status-icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: label })] }); } /* harmony default export */ const status_view = (StatusView); ;// ./node_modules/@wordpress/fields/build-module/fields/status/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const OPERATOR_IS_ANY = 'isAny'; const statusField = { label: (0,external_wp_i18n_namespaceObject.__)('Status'), id: 'status', type: 'text', elements: status_elements, render: status_view, Edit: 'radio', enableSorting: false, filterBy: { operators: [OPERATOR_IS_ANY] } }; /** * Status field for BasePost. */ /* harmony default export */ const fields_status = (statusField); ;// ./node_modules/@wordpress/fields/build-module/fields/date/date-view.js /** * WordPress dependencies */ /** * Internal dependencies */ const getFormattedDate = dateToDisplay => (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.datetimeAbbreviated, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay)); const DateView = ({ item }) => { var _item$status, _item$modified, _item$date4, _item$date5; const isDraftOrPrivate = ['draft', 'private'].includes((_item$status = item.status) !== null && _item$status !== void 0 ? _item$status : ''); if (isDraftOrPrivate) { var _item$date; return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: page creation or modification date. */ (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate((_item$date = item.date) !== null && _item$date !== void 0 ? _item$date : null)), { span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) }); } const isScheduled = item.status === 'future'; if (isScheduled) { var _item$date2; return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: page creation date */ (0,external_wp_i18n_namespaceObject.__)('<span>Scheduled: <time>%s</time></span>'), getFormattedDate((_item$date2 = item.date) !== null && _item$date2 !== void 0 ? _item$date2 : null)), { span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) }); } const isPublished = item.status === 'publish'; if (isPublished) { var _item$date3; return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: page creation time */ (0,external_wp_i18n_namespaceObject.__)('<span>Published: <time>%s</time></span>'), getFormattedDate((_item$date3 = item.date) !== null && _item$date3 !== void 0 ? _item$date3 : null)), { span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) }); } // Pending posts show the modified date if it's newer. const dateToDisplay = (0,external_wp_date_namespaceObject.getDate)((_item$modified = item.modified) !== null && _item$modified !== void 0 ? _item$modified : null) > (0,external_wp_date_namespaceObject.getDate)((_item$date4 = item.date) !== null && _item$date4 !== void 0 ? _item$date4 : null) ? item.modified : item.date; const isPending = item.status === 'pending'; if (isPending) { return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: page creation or modification date. */ (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate(dateToDisplay !== null && dateToDisplay !== void 0 ? dateToDisplay : null)), { span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) }); } // Unknow status. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { children: getFormattedDate((_item$date5 = item.date) !== null && _item$date5 !== void 0 ? _item$date5 : null) }); }; /* harmony default export */ const date_view = (DateView); ;// ./node_modules/@wordpress/fields/build-module/fields/date/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const dateField = { id: 'date', type: 'datetime', label: (0,external_wp_i18n_namespaceObject.__)('Date'), render: date_view }; /** * Date field for BasePost. */ /* harmony default export */ const date = (dateField); ;// ./node_modules/@wordpress/icons/build-module/library/copy-small.js /** * WordPress dependencies */ const copySmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" }) }); /* harmony default export */ const copy_small = (copySmall); ;// ./node_modules/@wordpress/fields/build-module/fields/slug/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ const getSlug = item => { if (typeof item !== 'object') { return ''; } return item.slug || (0,external_wp_url_namespaceObject.cleanForSlug)(getItemTitle(item)) || item.id.toString(); }; ;// ./node_modules/@wordpress/fields/build-module/fields/slug/slug-edit.js /** * WordPress dependencies */ /** * Internal dependencies */ const SlugEdit = ({ field, onChange, data }) => { const { id } = field; const slug = field.getValue({ item: data }) || getSlug(data); const permalinkTemplate = data.permalink_template || ''; const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); const permalinkPrefix = prefix; const permalinkSuffix = suffix; const isEditable = PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); const originalSlugRef = (0,external_wp_element_namespaceObject.useRef)(slug); const slugToDisplay = slug || originalSlugRef.current; const permalink = isEditable ? `${permalinkPrefix}${slugToDisplay}${permalinkSuffix}` : (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(data.link || ''); (0,external_wp_element_namespaceObject.useEffect)(() => { if (slug && originalSlugRef.current === undefined) { originalSlugRef.current = slug; } }, [slug]); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => { createNotice('info', (0,external_wp_i18n_namespaceObject.__)('Copied Permalink to clipboard.'), { isDismissible: true, type: 'snackbar' }); }); const postUrlSlugDescriptionId = 'editor-post-url__slug-description-' + (0,external_wp_compose_namespaceObject.useInstanceId)(SlugEdit); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "fields-controls__slug", children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "0px", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: (0,external_wp_i18n_namespaceObject.__)('Customize the last part of the Permalink.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink", children: (0,external_wp_i18n_namespaceObject.__)('Learn more') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { children: "/" }), suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, icon: copy_small, ref: copyButtonRef, label: (0,external_wp_i18n_namespaceObject.__)('Copy') }), label: (0,external_wp_i18n_namespaceObject.__)('Link'), hideLabelFromVision: true, value: slug, autoComplete: "off", spellCheck: "false", type: "text", className: "fields-controls__slug-input", onChange: newValue => { onChangeControl(newValue); }, onBlur: () => { if (slug === '') { onChangeControl(originalSlugRef.current); } }, "aria-describedby": postUrlSlugDescriptionId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "fields-controls__slug-help", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-visual-label", children: (0,external_wp_i18n_namespaceObject.__)('Permalink:') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ExternalLink, { className: "fields-controls__slug-help-link", href: permalink, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-prefix", children: permalinkPrefix }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-slug", children: slugToDisplay }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-suffix", children: permalinkSuffix })] })] })] }), !isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { className: "fields-controls__slug-help", href: permalink, children: permalink })] }); }; /* harmony default export */ const slug_edit = (SlugEdit); ;// ./node_modules/@wordpress/fields/build-module/fields/slug/slug-view.js /** * WordPress dependencies */ /** * Internal dependencies */ const SlugView = ({ item }) => { const slug = getSlug(item); const originalSlugRef = (0,external_wp_element_namespaceObject.useRef)(slug); (0,external_wp_element_namespaceObject.useEffect)(() => { if (slug && originalSlugRef.current === undefined) { originalSlugRef.current = slug; } }, [slug]); const slugToDisplay = slug || originalSlugRef.current; return `${slugToDisplay}`; }; /* harmony default export */ const slug_view = (SlugView); ;// ./node_modules/@wordpress/fields/build-module/fields/slug/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const slugField = { id: 'slug', type: 'text', label: (0,external_wp_i18n_namespaceObject.__)('Slug'), Edit: slug_edit, render: slug_view }; /** * Slug field for BasePost. */ /* harmony default export */ const slug = (slugField); // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// ./node_modules/@wordpress/fields/build-module/fields/parent/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ function getTitleWithFallbackName(post) { return typeof post.title === 'object' && 'rendered' in post.title && post.title.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post?.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`; } ;// ./node_modules/@wordpress/fields/build-module/fields/parent/parent-edit.js /** * External dependencies */ /** * WordPress dependencies */ // @ts-ignore /** * Internal dependencies */ function buildTermsTree(flatTerms) { const flatTermsWithParentAndChildren = flatTerms.map(term => { return { children: [], ...term }; }); // All terms should have a `parent` because we're about to index them by it. if (flatTermsWithParentAndChildren.some(({ parent }) => parent === null || parent === undefined)) { return flatTermsWithParentAndChildren; } const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => { const { parent } = term; if (!acc[parent]) { acc[parent] = []; } acc[parent].push(term); return acc; }, {}); const fillWithChildren = terms => { return terms.map(term => { const children = termsByParent[term.id]; return { ...term, children: children && children.length ? fillWithChildren(children) : [] }; }); }; return fillWithChildren(termsByParent['0'] || []); } const getItemPriority = (name, searchValue) => { const normalizedName = remove_accents_default()(name || '').toLowerCase(); const normalizedSearch = remove_accents_default()(searchValue || '').toLowerCase(); if (normalizedName === normalizedSearch) { return 0; } if (normalizedName.startsWith(normalizedSearch)) { return normalizedName.length; } return Infinity; }; function PageAttributesParent({ data, onChangeControl }) { const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(null); const pageId = data.parent; const postId = data.id; const postTypeSlug = data.type; const { parentPostTitle, pageItems, isHierarchical } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, getEntityRecords, getPostType } = select(external_wp_coreData_namespaceObject.store); const postTypeInfo = getPostType(postTypeSlug); const postIsHierarchical = postTypeInfo?.hierarchical && postTypeInfo.viewable; const parentPost = pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null; const query = { per_page: 100, exclude: postId, parent_exclude: postId, orderby: 'menu_order', order: 'asc', _fields: 'id,title,parent', ...(fieldValue !== null && { search: fieldValue }) }; return { isHierarchical: postIsHierarchical, parentPostTitle: parentPost ? getTitleWithFallbackName(parentPost) : '', pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null }; }, [fieldValue, pageId, postId, postTypeSlug]); /** * This logic has been copied from https://github.com/WordPress/gutenberg/blob/0249771b519d5646171fb9fae422006c8ab773f2/packages/editor/src/components/page-attributes/parent.js#L106. */ const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { const getOptionsFromTree = (tree, level = 0) => { const mappedNodes = tree.map(treeNode => [{ value: treeNode.id, label: '— '.repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name), rawName: treeNode.name }, ...getOptionsFromTree(treeNode.children || [], level + 1)]); const sortedNodes = mappedNodes.sort(([a], [b]) => { const priorityA = getItemPriority(a.rawName, fieldValue !== null && fieldValue !== void 0 ? fieldValue : ''); const priorityB = getItemPriority(b.rawName, fieldValue !== null && fieldValue !== void 0 ? fieldValue : ''); return priorityA >= priorityB ? 1 : -1; }); return sortedNodes.flat(); }; if (!pageItems) { return []; } let tree = pageItems.map(item => { var _item$parent; return { id: item.id, parent: (_item$parent = item.parent) !== null && _item$parent !== void 0 ? _item$parent : null, name: getTitleWithFallbackName(item) }; }); // Only build a hierarchical tree when not searching. if (!fieldValue) { tree = buildTermsTree(tree); } const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list. const optsHasParent = opts.find(item => item.value === pageId); if (pageId && parentPostTitle && !optsHasParent) { opts.unshift({ value: pageId, label: parentPostTitle, rawName: '' }); } return opts.map(option => ({ ...option, value: option.value.toString() })); }, [pageItems, fieldValue, parentPostTitle, pageId]); if (!isHierarchical) { return null; } /** * Handle user input. * * @param {string} inputValue The current value of the input field. */ const handleKeydown = inputValue => { setFieldValue(inputValue); }; /** * Handle author selection. * * @param {Object} selectedPostId The selected Author. */ const handleChange = selectedPostId => { if (selectedPostId) { var _parseInt; return onChangeControl((_parseInt = parseInt(selectedPostId, 10)) !== null && _parseInt !== void 0 ? _parseInt : 0); } onChangeControl(0); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Parent'), help: (0,external_wp_i18n_namespaceObject.__)('Choose a parent page.'), value: pageId?.toString(), options: parentOptions, onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(value => handleKeydown(value), 300), onChange: handleChange, hideLabelFromVision: true }); } const ParentEdit = ({ data, field, onChange }) => { const { id } = field; const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; }, []); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { className: "fields-controls__parent", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %1$s The home URL of the WordPress installation without the scheme. */ (0,external_wp_i18n_namespaceObject.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %1$s<wbr />/services<wbr />/pricing.'), (0,external_wp_url_namespaceObject.filterURLForDisplay)(homeUrl).replace(/([/.])/g, '<wbr />$1')), { wbr: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'), { a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes'), children: undefined }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesParent, { data: data, onChangeControl: onChangeControl })] }) }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/parent/parent-view.js /** * WordPress dependencies */ /** * Internal dependencies */ const ParentView = ({ item }) => { const parent = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); return item?.parent ? getEntityRecord('postType', item.type, item.parent) : null; }, [item.parent, item.type]); if (parent) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: getTitleWithFallbackName(parent) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: (0,external_wp_i18n_namespaceObject.__)('None') }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/parent/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const parentField = { id: 'parent', type: 'text', label: (0,external_wp_i18n_namespaceObject.__)('Parent'), Edit: ParentEdit, render: ParentView, enableSorting: true }; /** * Parent field for BasePost. */ /* harmony default export */ const fields_parent = (parentField); ;// ./node_modules/@wordpress/fields/build-module/fields/comment-status/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const commentStatusField = { id: 'comment_status', label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), type: 'text', Edit: 'radio', enableSorting: false, filterBy: { operators: [] }, elements: [{ value: 'open', label: (0,external_wp_i18n_namespaceObject.__)('Open'), description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') }, { value: 'closed', label: (0,external_wp_i18n_namespaceObject.__)('Closed'), description: (0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies. Existing comments remain visible.') }] }; /** * Comment status field for BasePost. */ /* harmony default export */ const comment_status = (commentStatusField); ;// ./node_modules/@wordpress/fields/build-module/fields/template/template-edit.js /** * WordPress dependencies */ // @ts-ignore /** * Internal dependencies */ // @ts-expect-error block-editor is not typed correctly. const EMPTY_ARRAY = []; const TemplateEdit = ({ data, field, onChange }) => { const { id } = field; const postType = data.type; const postId = typeof data.id === 'number' ? data.id : parseInt(data.id, 10); const slug = data.slug; const { canSwitchTemplate, templates } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getEntityReco; const allTemplates = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { per_page: -1, post_type: postType })) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : EMPTY_ARRAY; const { getHomePage, getPostsPageId } = lock_unlock_unlock(select(external_wp_coreData_namespaceObject.store)); const isPostsPage = getPostsPageId() === +postId; const isFrontPage = postType === 'page' && getHomePage()?.postId === +postId; const allowSwitchingTemplate = !isPostsPage && !isFrontPage; return { templates: allTemplates, canSwitchTemplate: allowSwitchingTemplate }; }, [postId, postType]); const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!canSwitchTemplate) { return []; } return templates.filter(template => template.is_custom && template.slug !== data.template && // Skip empty templates. !!template.content.raw).map(template => ({ name: template.slug, blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw), title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered), id: template.id })); }, [canSwitchTemplate, data.template, templates]); const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(templatesAsPatterns); const value = field.getValue({ item: data }); const foundTemplate = templates.find(template => template.slug === value); const currentTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => { if (foundTemplate) { return foundTemplate; } let slugToCheck; // In `draft` status we might not have a slug available, so we use the `single` // post type templates slug(ex page, single-post, single-product etc..). // Pages do not need the `single` prefix in the slug to be prioritized // through template hierarchy. if (slug) { slugToCheck = postType === 'page' ? `${postType}-${slug}` : `single-${postType}-${slug}`; } else { slugToCheck = postType === 'page' ? 'page' : `single-${postType}`; } if (postType) { const templateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ slug: slugToCheck }); return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', templateId); } }, [foundTemplate, postType, slug]); const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "fields-controls__template", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: 'bottom-start' }, renderToggle: ({ onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", size: "compact", onClick: onToggle, children: currentTemplate ? getItemTitle(currentTemplate) : '' }), renderContent: ({ onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { setShowModal(true); onToggle(); }, children: (0,external_wp_i18n_namespaceObject.__)('Change template') }), // The default template in a post is indicated by an empty string value !== '' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { onChangeControl(''); onToggle(); }, children: (0,external_wp_i18n_namespaceObject.__)('Use default template') })] }) }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Choose a template'), onRequestClose: () => setShowModal(false), overlayClassName: "fields-controls__template-modal", isFullScreen: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-controls__template-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { label: (0,external_wp_i18n_namespaceObject.__)('Templates'), blockPatterns: templatesAsPatterns, shownPatterns: shownTemplates, onClickPattern: template => { onChangeControl(template.name); setShowModal(false); } }) }) })] }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/template/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const templateField = { id: 'template', type: 'text', label: (0,external_wp_i18n_namespaceObject.__)('Template'), Edit: TemplateEdit, enableSorting: false }; /** * Template field for BasePost. */ /* harmony default export */ const fields_template = (templateField); ;// ./node_modules/@wordpress/fields/build-module/fields/password/edit.js /** * WordPress dependencies */ /** * Internal dependencies */ function PasswordEdit({ data, onChange, field }) { const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)(!!field.getValue({ item: data })); const handleTogglePassword = value => { setShowPassword(value); if (!value) { onChange({ password: '' }); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { as: "fieldset", spacing: 4, className: "fields-controls__password", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Password protected'), help: (0,external_wp_i18n_namespaceObject.__)('Only visible to those who know the password'), checked: showPassword, onChange: handleTogglePassword }), showPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-controls__password-input", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { label: (0,external_wp_i18n_namespaceObject.__)('Password'), onChange: value => onChange({ password: value }), value: field.getValue({ item: data }) || '', placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password'), type: "text", __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, maxLength: 255 }) })] }); } /* harmony default export */ const edit = (PasswordEdit); ;// ./node_modules/@wordpress/fields/build-module/fields/password/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const passwordField = { id: 'password', type: 'text', Edit: edit, enableSorting: false, enableHiding: false, isVisible: item => item.status !== 'private' }; /** * Password field for BasePost. */ /* harmony default export */ const fields_password = (passwordField); ;// ./node_modules/@wordpress/fields/build-module/fields/title/view.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BaseTitleView({ item, className, children }) { const renderedTitle = getItemTitle(item); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: dist_clsx('fields-field__title', className), alignment: "center", justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: renderedTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)') }), children] }); } function TitleView({ item }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { item: item }); } ;// ./node_modules/@wordpress/fields/build-module/fields/page-title/view.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function PageTitleView({ item }) { const { frontPageId, postsPageId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = getEntityRecord('root', 'site'); return { frontPageId: siteSettings?.page_on_front, postsPageId: siteSettings?.page_for_posts }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { item: item, className: "fields-field__page-title", children: [frontPageId, postsPageId].includes(item.id) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { children: item.id === frontPageId ? (0,external_wp_i18n_namespaceObject.__)('Homepage') : (0,external_wp_i18n_namespaceObject.__)('Posts Page') }) }); } ;// ./node_modules/@wordpress/fields/build-module/fields/page-title/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const pageTitleField = { type: 'text', id: 'title', label: (0,external_wp_i18n_namespaceObject.__)('Title'), placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), getValue: ({ item }) => getItemTitle(item), render: PageTitleView, enableHiding: false, enableGlobalSearch: true }; /** * Title for the page entity. */ /* harmony default export */ const page_title = (pageTitleField); ;// ./node_modules/@wordpress/fields/build-module/fields/template-title/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const templateTitleField = { type: 'text', label: (0,external_wp_i18n_namespaceObject.__)('Template'), placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), id: 'title', getValue: ({ item }) => getItemTitle(item), render: TitleView, enableHiding: false, enableGlobalSearch: true }; /** * Title for the template entity. */ /* harmony default export */ const template_title = (templateTitleField); ;// ./node_modules/@wordpress/icons/build-module/icon/index.js /** * WordPress dependencies */ /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ /** * Return an SVG icon. * * @param {IconProps} props icon is the SVG component to render * size is a number specifying the icon size in pixels * Other props will be passed to wrapped SVG component * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. * * @return {JSX.Element} Icon component */ function Icon({ icon, size = 24, ...props }, ref) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); ;// ./node_modules/@wordpress/icons/build-module/library/lock-small.js /** * WordPress dependencies */ const lockSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" }) }); /* harmony default export */ const lock_small = (lockSmall); ;// ./node_modules/@wordpress/fields/build-module/fields/pattern-title/view.js /** * WordPress dependencies */ // @ts-ignore /** * Internal dependencies */ const { PATTERN_TYPES: view_PATTERN_TYPES } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); function PatternTitleView({ item }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { item: item, className: "fields-field__pattern-title", children: item.type === view_PATTERN_TYPES.theme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { placement: "top", text: (0,external_wp_i18n_namespaceObject.__)('This pattern cannot be edited.'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { icon: lock_small, size: 24 }) }) }); } ;// ./node_modules/@wordpress/fields/build-module/fields/pattern-title/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const patternTitleField = { type: 'text', id: 'title', label: (0,external_wp_i18n_namespaceObject.__)('Title'), placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), getValue: ({ item }) => getItemTitle(item), render: PatternTitleView, enableHiding: false, enableGlobalSearch: true }; /** * Title for the pattern entity. */ /* harmony default export */ const pattern_title = (patternTitleField); ;// ./node_modules/@wordpress/fields/build-module/fields/title/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const titleField = { type: 'text', id: 'title', label: (0,external_wp_i18n_namespaceObject.__)('Title'), placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), getValue: ({ item }) => getItemTitle(item), render: TitleView, enableHiding: false, enableGlobalSearch: true }; /** * Title for the any entity with a `title` property. * For patterns, pages or templates you should use the respective field * because there are some differences in the rendering, labels, etc. */ /* harmony default export */ const title = (titleField); ;// ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js /** * WordPress dependencies */ /** * Internal dependencies */ function getSubRegistry(subRegistries, registry, useSubRegistry) { if (!useSubRegistry) { return registry; } let subRegistry = subRegistries.get(registry); if (!subRegistry) { subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({ 'core/block-editor': external_wp_blockEditor_namespaceObject.storeConfig }, registry); // Todo: The interface store should also be created per instance. subRegistry.registerStore('core/editor', storeConfig); subRegistries.set(registry, subRegistry); } return subRegistry; } const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => ({ useSubRegistry = true, ...props }) => { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => new WeakMap()); const subRegistry = getSubRegistry(subRegistries, registry, useSubRegistry); if (subRegistry === registry) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: registry, ...props }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); }, 'withRegistryProvider'); /* harmony default export */ const with_registry_provider = (withRegistryProvider); ;// ./node_modules/@wordpress/editor/build-module/components/media-categories/index.js /* wp:polyfill */ /** * The `editor` settings here need to be in sync with the corresponding ones in `editor` package. * See `packages/editor/src/components/media-categories/index.js`. * * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`. * The rest of the settings would still need to be in sync though. */ /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */ /** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */ /** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */ const getExternalLink = (url, text) => `<a ${getExternalLinkAttributes(url)}>${text}</a>`; const getExternalLinkAttributes = url => `href="${url}" target="_blank" rel="noreferrer noopener"`; const getOpenverseLicense = (license, licenseVersion) => { let licenseName = license.trim(); // PDM has no abbreviation if (license !== 'pdm') { licenseName = license.toUpperCase().replace('SAMPLING', 'Sampling'); } // If version is known, append version to the name. // The license has to have a version to be valid. Only // PDM (public domain mark) doesn't have a version. if (licenseVersion) { licenseName += ` ${licenseVersion}`; } // For licenses other than public-domain marks, prepend 'CC' to the name. if (!['pdm', 'cc0'].includes(license)) { licenseName = `CC ${licenseName}`; } return licenseName; }; const getOpenverseCaption = item => { const { title, foreign_landing_url: foreignLandingUrl, creator, creator_url: creatorUrl, license, license_version: licenseVersion, license_url: licenseUrl } = item; const fullLicense = getOpenverseLicense(license, licenseVersion); const _creator = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(creator); let _caption; if (_creator) { _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: "CC0 1.0". (0,external_wp_i18n_namespaceObject._x)('"%1$s" by %2$s/ %3$s', 'caption'), getExternalLink(foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: "CC0 1.0". (0,external_wp_i18n_namespaceObject._x)('<a %1$s>Work</a> by %2$s/ %3$s', 'caption'), getExternalLinkAttributes(foreignLandingUrl), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense); } else { _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: "CC0 1.0". (0,external_wp_i18n_namespaceObject._x)('"%1$s"/ %2$s', 'caption'), getExternalLink(foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0". (0,external_wp_i18n_namespaceObject._x)('<a %1$s>Work</a>/ %2$s', 'caption'), getExternalLinkAttributes(foreignLandingUrl), licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense); } return _caption.replace(/\s{2}/g, ' '); }; const coreMediaFetch = async (query = {}) => { const mediaItems = await (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store).getMediaItems({ ...query, orderBy: !!query?.search ? 'relevance' : 'date' }); return mediaItems.map(mediaItem => ({ ...mediaItem, alt: mediaItem.alt_text, url: mediaItem.source_url, previewUrl: mediaItem.media_details?.sizes?.medium?.source_url, caption: mediaItem.caption?.raw })); }; /** @type {InserterMediaCategory[]} */ const inserterMediaCategories = [{ name: 'images', labels: { name: (0,external_wp_i18n_namespaceObject.__)('Images'), search_items: (0,external_wp_i18n_namespaceObject.__)('Search images') }, mediaType: 'image', async fetch(query = {}) { return coreMediaFetch({ ...query, media_type: 'image' }); } }, { name: 'videos', labels: { name: (0,external_wp_i18n_namespaceObject.__)('Videos'), search_items: (0,external_wp_i18n_namespaceObject.__)('Search videos') }, mediaType: 'video', async fetch(query = {}) { return coreMediaFetch({ ...query, media_type: 'video' }); } }, { name: 'audio', labels: { name: (0,external_wp_i18n_namespaceObject.__)('Audio'), search_items: (0,external_wp_i18n_namespaceObject.__)('Search audio') }, mediaType: 'audio', async fetch(query = {}) { return coreMediaFetch({ ...query, media_type: 'audio' }); } }, { name: 'openverse', labels: { name: (0,external_wp_i18n_namespaceObject.__)('Openverse'), search_items: (0,external_wp_i18n_namespaceObject.__)('Search Openverse') }, mediaType: 'image', async fetch(query = {}) { const defaultArgs = { mature: false, excluded_source: 'flickr,inaturalist,wikimedia', license: 'pdm,cc0' }; const finalQuery = { ...query, ...defaultArgs }; const mapFromInserterMediaRequest = { per_page: 'page_size', search: 'q' }; const url = new URL('https://api.openverse.org/v1/images/'); Object.entries(finalQuery).forEach(([key, value]) => { const queryKey = mapFromInserterMediaRequest[key] || key; url.searchParams.set(queryKey, value); }); const response = await window.fetch(url, { headers: { 'User-Agent': 'WordPress/inserter-media-fetch' } }); const jsonResponse = await response.json(); const results = jsonResponse.results; return results.map(result => ({ ...result, // This is a temp solution for better titles, until Openverse API // completes the cleaning up of some titles of their upstream data. title: result.title?.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title, sourceId: result.id, id: undefined, caption: getOpenverseCaption(result), previewUrl: result.thumbnail })); }, getReportUrl: ({ sourceId }) => `https://wordpress.org/openverse/image/${sourceId}/report/`, isExternalResource: true }]; /* harmony default export */ const media_categories = (inserterMediaCategories); ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } function stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const noop = () => {}; /** * Upload a media file when the file upload button is activated. * Wrapper around mediaUpload() that injects the current post ID. * * @param {Object} $0 Parameters object passed to the function. * @param {?Object} $0.additionalData Additional data to include in the request. * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. * @param {Array} $0.filesList List of files. * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. * @param {Function} $0.onError Function called when an error happens. * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. * @param {Function} $0.onSuccess Function called after the final representation of the file is available. * @param {boolean} $0.multiple Whether to allow multiple files to be uploaded. */ function mediaUpload({ additionalData = {}, allowedTypes, filesList, maxUploadFileSize, onError = noop, onFileChange, onSuccess, multiple = true }) { const { getCurrentPost, getEditorSettings } = (0,external_wp_data_namespaceObject.select)(store_store); const { lockPostAutosaving, unlockPostAutosaving, lockPostSaving, unlockPostSaving } = (0,external_wp_data_namespaceObject.dispatch)(store_store); const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; const lockKey = `image-upload-${esm_browser_v4()}`; let imageIsUploading = false; maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; const currentPost = getCurrentPost(); // Templates and template parts' numerical ID is stored in `wp_id`. const currentPostId = typeof currentPost?.id === 'number' ? currentPost.id : currentPost?.wp_id; const setSaveLock = () => { lockPostSaving(lockKey); lockPostAutosaving(lockKey); imageIsUploading = true; }; const postData = currentPostId ? { post: currentPostId } : {}; const clearSaveLock = () => { unlockPostSaving(lockKey); unlockPostAutosaving(lockKey); imageIsUploading = false; }; (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ allowedTypes, filesList, onFileChange: file => { if (!imageIsUploading) { setSaveLock(); } else { clearSaveLock(); } onFileChange?.(file); }, onSuccess, additionalData: { ...postData, ...additionalData }, maxUploadFileSize, onError: ({ message }) => { clearSaveLock(); onError(message); }, wpAllowedMimeTypes, multiple }); } ;// ./node_modules/@wordpress/editor/build-module/utils/media-sideload/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { sideloadMedia: mediaSideload } = unlock(external_wp_mediaUtils_namespaceObject.privateApis); /* harmony default export */ const media_sideload = (mediaSideload); // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js var cjs = __webpack_require__(66); var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs); ;// ./node_modules/is-plain-object/dist/is-plain-object.mjs /*! * is-plain-object <https://github.com/jonschlinkert/is-plain-object> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function isObject(o) { return Object.prototype.toString.call(o) === '[object Object]'; } function isPlainObject(o) { var ctor,prot; if (isObject(o) === false) return false; // If has modified constructor ctor = o.constructor; if (ctor === undefined) return true; // If has modified prototype prot = ctor.prototype; if (isObject(prot) === false) return false; // If constructor does not have an Object-specific method if (prot.hasOwnProperty('isPrototypeOf') === false) { return false; } // Most likely a plain Object return true; } ;// ./node_modules/@wordpress/editor/build-module/components/global-styles-provider/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { GlobalStylesContext, cleanEmptyObject } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function mergeBaseAndUserConfigs(base, user) { return cjs_default()(base, user, { /* * We only pass as arrays the presets, * in which case we want the new array of values * to override the old array (no merging). */ isMergeableObject: isPlainObject, /* * Exceptions to the above rule. * Background images should be replaced, not merged, * as they themselves are specific object definitions for the style. */ customMerge: key => { if (key === 'backgroundImage') { return (baseConfig, userConfig) => userConfig; } return undefined; } }); } function useGlobalStylesUserConfig() { const { globalStylesId, isReady, settings, styles, _links } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, getEditedEntityRecord, hasFinishedResolution, canUser } = select(external_wp_coreData_namespaceObject.store); const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId(); let record; /* * Ensure that the global styles ID request is complete by testing `_globalStylesId`, * before firing off the `canUser` OPTIONS request for user capabilities, otherwise it will * fetch `/wp/v2/global-styles` instead of `/wp/v2/global-styles/{id}`. * NOTE: Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`, * or set using the `block_editor_rest_api_preload_paths` filter, if this changes. */ const userCanEditGlobalStyles = _globalStylesId ? canUser('update', { kind: 'root', name: 'globalStyles', id: _globalStylesId }) : null; if (_globalStylesId && /* * Test that the OPTIONS request for user capabilities is complete * before fetching the global styles entity record. * This is to avoid fetching the global styles entity unnecessarily. */ typeof userCanEditGlobalStyles === 'boolean') { /* * Fetch the global styles entity record based on the user's capabilities. * The default context is `edit` for users who can edit global styles. * Otherwise, the context is `view`. * NOTE: There is an equivalent conditional check using `current_user_can()` in the backend * to preload the global styles entity. Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`, * or set using `block_editor_rest_api_preload_paths` filter, if this changes. */ if (userCanEditGlobalStyles) { record = getEditedEntityRecord('root', 'globalStyles', _globalStylesId); } else { record = getEntityRecord('root', 'globalStyles', _globalStylesId, { context: 'view' }); } } let hasResolved = false; if (hasFinishedResolution('__experimentalGetCurrentGlobalStylesId')) { if (_globalStylesId) { hasResolved = userCanEditGlobalStyles ? hasFinishedResolution('getEditedEntityRecord', ['root', 'globalStyles', _globalStylesId]) : hasFinishedResolution('getEntityRecord', ['root', 'globalStyles', _globalStylesId, { context: 'view' }]); } else { hasResolved = true; } } return { globalStylesId: _globalStylesId, isReady: hasResolved, settings: record?.settings, styles: record?.styles, _links: record?._links }; }, []); const { getEditedEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const config = (0,external_wp_element_namespaceObject.useMemo)(() => { return { settings: settings !== null && settings !== void 0 ? settings : {}, styles: styles !== null && styles !== void 0 ? styles : {}, _links: _links !== null && _links !== void 0 ? _links : {} }; }, [settings, styles, _links]); const setConfig = (0,external_wp_element_namespaceObject.useCallback)( /** * Set the global styles config. * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values. * Otherwise, overwrite the current config with the incoming object. * @param {Object} options Options for editEntityRecord Core selector. */ (callbackOrObject, options = {}) => { var _record$styles, _record$settings, _record$_links; const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId); const currentConfig = { styles: (_record$styles = record?.styles) !== null && _record$styles !== void 0 ? _record$styles : {}, settings: (_record$settings = record?.settings) !== null && _record$settings !== void 0 ? _record$settings : {}, _links: (_record$_links = record?._links) !== null && _record$_links !== void 0 ? _record$_links : {} }; const updatedConfig = typeof callbackOrObject === 'function' ? callbackOrObject(currentConfig) : callbackOrObject; editEntityRecord('root', 'globalStyles', globalStylesId, { styles: cleanEmptyObject(updatedConfig.styles) || {}, settings: cleanEmptyObject(updatedConfig.settings) || {}, _links: cleanEmptyObject(updatedConfig._links) || {} }, options); }, [globalStylesId, editEntityRecord, getEditedEntityRecord]); return [isReady, config, setConfig]; } function useGlobalStylesBaseConfig() { const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles(), []); return [!!baseConfig, baseConfig]; } function useGlobalStylesContext() { const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig(); const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig(); const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!baseConfig || !userConfig) { return {}; } return mergeBaseAndUserConfigs(baseConfig, userConfig); }, [userConfig, baseConfig]); const context = (0,external_wp_element_namespaceObject.useMemo)(() => { return { isReady: isUserConfigReady && isBaseConfigReady, user: userConfig, base: baseConfig, merged: mergedConfig, setUserConfig }; }, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]); return context; } function GlobalStylesProvider({ children }) { const context = useGlobalStylesContext(); if (!context.isReady) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesContext.Provider, { value: context, children: children }); } ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js /** * WordPress dependencies */ /** * Internal dependencies */ const use_block_editor_settings_EMPTY_OBJECT = {}; function __experimentalReusableBlocksSelect(select) { const { RECEIVE_INTERMEDIATE_RESULTS } = unlock(external_wp_coreData_namespaceObject.privateApis); const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store); return getEntityRecords('postType', 'wp_block', { per_page: -1, [RECEIVE_INTERMEDIATE_RESULTS]: true }); } const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', 'alignWide', 'blockInspectorTabs', 'maxUploadFileSize', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'canUpdateBlockBindings', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isPreviewMode', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme']; const { globalStylesDataKey, globalStylesLinksDataKey, selectBlockPatternsKey, reusableBlocksSelectKey, sectionRootClientIdKey } = unlock(external_wp_blockEditor_namespaceObject.privateApis); /** * React hook used to compute the block editor settings to use for the post editor. * * @param {Object} settings EditorProvider settings prop. * @param {string} postType Editor root level post type. * @param {string} postId Editor root level post ID. * @param {string} renderingMode Editor rendering mode. * * @return {Object} Block Editor Settings. */ function useBlockEditorSettings(settings, postType, postId, renderingMode) { var _mergedGlobalStyles$s, _mergedGlobalStyles$_, _settings$__experimen, _settings$__experimen2; const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const { allowRightClickOverrides, blockTypes, focusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, hasUploadPermissions, hiddenBlockTypes, canUseUnfilteredHTML, userCanCreatePages, pageOnFront, pageForPosts, userPatternCategories, restBlockPatternCategories, sectionRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _canUser; const { canUser, getRawEntityRecord, getEntityRecord, getUserPatternCategories, getBlockPatternCategories } = select(external_wp_coreData_namespaceObject.store); const { get } = select(external_wp_preferences_namespaceObject.store); const { getBlockTypes } = select(external_wp_blocks_namespaceObject.store); const { getBlocksByName, getBlockAttributes } = select(external_wp_blockEditor_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEntityRecord('root', 'site') : undefined; function getSectionRootBlock() { var _getBlocksByName$find; if (renderingMode === 'template-locked') { var _getBlocksByName$; return (_getBlocksByName$ = getBlocksByName('core/post-content')?.[0]) !== null && _getBlocksByName$ !== void 0 ? _getBlocksByName$ : ''; } return (_getBlocksByName$find = getBlocksByName('core/group').find(clientId => getBlockAttributes(clientId)?.tagName === 'main')) !== null && _getBlocksByName$find !== void 0 ? _getBlocksByName$find : ''; } return { allowRightClickOverrides: get('core', 'allowRightClickOverrides'), blockTypes: getBlockTypes(), canUseUnfilteredHTML: getRawEntityRecord('postType', postType, postId)?._links?.hasOwnProperty('wp:action-unfiltered-html'), focusMode: get('core', 'focusMode'), hasFixedToolbar: get('core', 'fixedToolbar') || !isLargeViewport, hiddenBlockTypes: get('core', 'hiddenBlockTypes'), isDistractionFree: get('core', 'distractionFree'), keepCaretInsideBlock: get('core', 'keepCaretInsideBlock'), hasUploadPermissions: (_canUser = canUser('create', { kind: 'root', name: 'media' })) !== null && _canUser !== void 0 ? _canUser : true, userCanCreatePages: canUser('create', { kind: 'postType', name: 'page' }), pageOnFront: siteSettings?.page_on_front, pageForPosts: siteSettings?.page_for_posts, userPatternCategories: getUserPatternCategories(), restBlockPatternCategories: getBlockPatternCategories(), sectionRootClientId: getSectionRootBlock() }; }, [postType, postId, isLargeViewport, renderingMode]); const { merged: mergedGlobalStyles } = useGlobalStylesContext(); const globalStylesData = (_mergedGlobalStyles$s = mergedGlobalStyles.styles) !== null && _mergedGlobalStyles$s !== void 0 ? _mergedGlobalStyles$s : use_block_editor_settings_EMPTY_OBJECT; const globalStylesLinksData = (_mergedGlobalStyles$_ = mergedGlobalStyles._links) !== null && _mergedGlobalStyles$_ !== void 0 ? _mergedGlobalStyles$_ : use_block_editor_settings_EMPTY_OBJECT; const settingsBlockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : // WP 6.0 settings.__experimentalBlockPatterns; // WP 5.9 const settingsBlockPatternCategories = (_settings$__experimen2 = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen2 !== void 0 ? _settings$__experimen2 : // WP 6.0 settings.__experimentalBlockPatternCategories; // WP 5.9 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || [])].filter(({ postTypes }) => { return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType); }), [settingsBlockPatterns, postType]); const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]); const { undo, setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); /** * Creates a Post entity. * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages. * * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord. * @return {Object} the post type object that was created. */ const createPageEntity = (0,external_wp_element_namespaceObject.useCallback)(options => { if (!userCanCreatePages) { return Promise.reject({ message: (0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Pages.') }); } return saveEntityRecord('postType', 'page', options); }, [saveEntityRecord, userCanCreatePages]); const allowedBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { // Omit hidden block types if exists and non-empty. if (hiddenBlockTypes && hiddenBlockTypes.length > 0) { // Defer to passed setting for `allowedBlockTypes` if provided as // anything other than `true` (where `true` is equivalent to allow // all block types). const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({ name }) => name) : settings.allowedBlockTypes || []; return defaultAllowedBlockTypes.filter(type => !hiddenBlockTypes.includes(type)); } return settings.allowedBlockTypes; }, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]); const forceDisableFocusMode = settings.focusMode === false; return (0,external_wp_element_namespaceObject.useMemo)(() => { const blockEditorSettings = { ...Object.fromEntries(Object.entries(settings).filter(([key]) => BLOCK_EDITOR_SETTINGS.includes(key))), [globalStylesDataKey]: globalStylesData, [globalStylesLinksDataKey]: globalStylesLinksData, allowedBlockTypes, allowRightClickOverrides, focusMode: focusMode && !forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, mediaUpload: hasUploadPermissions ? mediaUpload : undefined, mediaSideload: hasUploadPermissions ? media_sideload : undefined, __experimentalBlockPatterns: blockPatterns, [selectBlockPatternsKey]: select => { const { hasFinishedResolution, getBlockPatternsForPostType } = unlock(select(external_wp_coreData_namespaceObject.store)); const patterns = getBlockPatternsForPostType(postType); return hasFinishedResolution('getBlockPatterns') ? patterns : undefined; }, [reusableBlocksSelectKey]: __experimentalReusableBlocksSelect, __experimentalBlockPatternCategories: blockPatternCategories, __experimentalUserPatternCategories: userPatternCategories, __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings), inserterMediaCategories: media_categories, __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData, // Todo: This only checks the top level post, not the post within a template or any other entity that can be edited. // This might be better as a generic "canUser" selector. __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML, //Todo: this is only needed for native and should probably be removed. __experimentalUndo: undo, // Check whether we want all site editor frames to have outlines // including the navigation / pattern / parts editors. outlineMode: !isDistractionFree && postType === 'wp_template', // Check these two properties: they were not present in the site editor. __experimentalCreatePageEntity: createPageEntity, __experimentalUserCanCreatePages: userCanCreatePages, pageOnFront, pageForPosts, __experimentalPreferPatternsOnRoot: postType === 'wp_template', templateLock: postType === 'wp_navigation' ? 'insert' : settings.templateLock, template: postType === 'wp_navigation' ? [['core/navigation', {}, []]] : settings.template, __experimentalSetIsInserterOpened: setIsInserterOpened, [sectionRootClientIdKey]: sectionRootClientId, editorTool: renderingMode === 'post-only' && postType !== 'wp_template' ? 'edit' : undefined }; return blockEditorSettings; }, [allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened, sectionRootClientId, globalStylesData, globalStylesLinksData, renderingMode]); } /* harmony default export */ const use_block_editor_settings = (useBlockEditorSettings); ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-post-content-blocks.js /** * WordPress dependencies */ /** * Internal dependencies */ const POST_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content']; function usePostContentBlocks() { const contentOnlyBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => [...(0,external_wp_hooks_namespaceObject.applyFilters)('editor.postContentBlockTypes', POST_CONTENT_BLOCK_TYPES)], []); // Note that there are two separate subscriptions because the result for each // returns a new array. const contentOnlyIds = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getPostBlocksByName } = unlock(select(store_store)); return getPostBlocksByName(contentOnlyBlockTypes); }, [contentOnlyBlockTypes]); return contentOnlyIds; } ;// ./node_modules/@wordpress/editor/build-module/components/provider/disable-non-page-content-blocks.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Component that when rendered, makes it so that the site editor allows only * page content to be edited. */ function DisableNonPageContentBlocks() { const contentOnlyIds = usePostContentBlocks(); const { templateParts, isNavigationMode } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlocksByName, isNavigationMode: _isNavigationMode } = select(external_wp_blockEditor_namespaceObject.store); return { templateParts: getBlocksByName('core/template-part'), isNavigationMode: _isNavigationMode() }; }, []); const disabledIds = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockOrder } = select(external_wp_blockEditor_namespaceObject.store); return templateParts.flatMap(clientId => getBlockOrder(clientId)); }, [templateParts]); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); // The code here is split into multiple `useEffects` calls. // This is done to avoid setting/unsetting block editing modes multiple times unnecessarily. // // For example, the block editing mode of the root block (clientId: '') only // needs to be set once, not when `contentOnlyIds` or `disabledIds` change. // // It's also unlikely that these different types of blocks are being inserted // or removed at the same time, so using different effects reflects that. (0,external_wp_element_namespaceObject.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); setBlockEditingMode('', 'disabled'); return () => { unsetBlockEditingMode(''); }; }, [registry]); (0,external_wp_element_namespaceObject.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); registry.batch(() => { for (const clientId of contentOnlyIds) { setBlockEditingMode(clientId, 'contentOnly'); } }); return () => { registry.batch(() => { for (const clientId of contentOnlyIds) { unsetBlockEditingMode(clientId); } }); }; }, [contentOnlyIds, registry]); (0,external_wp_element_namespaceObject.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); registry.batch(() => { if (!isNavigationMode) { for (const clientId of templateParts) { setBlockEditingMode(clientId, 'contentOnly'); } } }); return () => { registry.batch(() => { if (!isNavigationMode) { for (const clientId of templateParts) { unsetBlockEditingMode(clientId); } } }); }; }, [templateParts, isNavigationMode, registry]); (0,external_wp_element_namespaceObject.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); registry.batch(() => { for (const clientId of disabledIds) { setBlockEditingMode(clientId, 'disabled'); } }); return () => { registry.batch(() => { for (const clientId of disabledIds) { unsetBlockEditingMode(clientId); } }); }; }, [disabledIds, registry]); return null; } ;// ./node_modules/@wordpress/editor/build-module/components/provider/navigation-block-editing-mode.js /** * WordPress dependencies */ /** * For the Navigation block editor, we need to force the block editor to contentOnly for that block. * * Set block editing mode to contentOnly when entering Navigation focus mode. * this ensures that non-content controls on the block will be hidden and thus * the user can focus on editing the Navigation Menu content only. */ function NavigationBlockEditingMode() { // In the navigation block editor, // the navigation block is the only root block. const blockClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlockOrder()?.[0], []); const { setBlockEditingMode, unsetBlockEditingMode } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!blockClientId) { return; } setBlockEditingMode(blockClientId, 'contentOnly'); return () => { unsetBlockEditingMode(blockClientId); }; }, [blockClientId, unsetBlockEditingMode, setBlockEditingMode]); } ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-hide-blocks-from-inserter.js /** * WordPress dependencies */ // These post types are "structural" block lists. // We should be allowed to use // the post content and template parts blocks within them. const POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART = ['wp_block', 'wp_template', 'wp_template_part']; /** * In some specific contexts, * the template part and post content blocks need to be hidden. * * @param {string} postType Post Type * @param {string} mode Rendering mode */ function useHideBlocksFromInserter(postType, mode) { (0,external_wp_element_namespaceObject.useEffect)(() => { /* * Prevent adding template part in the editor. */ (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => { if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(postType) && blockType.name === 'core/template-part' && mode === 'post-only') { return false; } return canInsert; }); /* * Prevent adding post content block (except in query block) in the editor. */ (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, { getBlockParentsByBlockName }) => { if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(postType) && blockType.name === 'core/post-content') { return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0; } return canInsert; }); return () => { (0,external_wp_hooks_namespaceObject.removeFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter'); (0,external_wp_hooks_namespaceObject.removeFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter'); }; }, [postType, mode]); } ;// ./node_modules/@wordpress/icons/build-module/library/keyboard.js /** * WordPress dependencies */ const keyboard = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z" })] }); /* harmony default export */ const library_keyboard = (keyboard); ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js /** * WordPress dependencies */ const listView = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); /* harmony default export */ const list_view = (listView); ;// ./node_modules/@wordpress/icons/build-module/library/code.js /** * WordPress dependencies */ const code = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" }) }); /* harmony default export */ const library_code = (code); ;// ./node_modules/@wordpress/icons/build-module/library/drawer-left.js /** * WordPress dependencies */ const drawerLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" }) }); /* harmony default export */ const drawer_left = (drawerLeft); ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js /** * WordPress dependencies */ const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" }) }); /* harmony default export */ const drawer_right = (drawerRight); ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js /** * WordPress dependencies */ const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) }); /* harmony default export */ const block_default = (blockDefault); ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js /** * WordPress dependencies */ const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); /* harmony default export */ const format_list_bullets = (formatListBullets); ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js /** * WordPress dependencies */ const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); /* harmony default export */ const library_pencil = (pencil); ;// ./node_modules/@wordpress/icons/build-module/library/edit.js /** * Internal dependencies */ /* harmony default export */ const library_edit = (library_pencil); ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js /** * WordPress dependencies */ const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); /* harmony default export */ const library_symbol = (symbol); ;// ./node_modules/@wordpress/icons/build-module/library/page.js /** * WordPress dependencies */ const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" })] }); /* harmony default export */ const library_page = (page); ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js /** * WordPress dependencies */ const rotateRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) }); /* harmony default export */ const rotate_right = (rotateRight); ;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js /** * WordPress dependencies */ const rotateLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) }); /* harmony default export */ const rotate_left = (rotateLeft); ;// external ["wp","commands"] const external_wp_commands_namespaceObject = window["wp"]["commands"]; ;// ./node_modules/@wordpress/icons/build-module/library/star-filled.js /** * WordPress dependencies */ const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" }) }); /* harmony default export */ const star_filled = (starFilled); ;// ./node_modules/@wordpress/icons/build-module/library/star-empty.js /** * WordPress dependencies */ const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", clipRule: "evenodd" }) }); /* harmony default export */ const star_empty = (starEmpty); ;// external ["wp","viewport"] const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; ;// external ["wp","plugins"] const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// ./node_modules/@wordpress/interface/build-module/store/deprecated.js /** * WordPress dependencies */ function normalizeComplementaryAreaScope(scope) { if (['core/edit-post', 'core/edit-site'].includes(scope)) { external_wp_deprecated_default()(`${scope} interface scope`, { alternative: 'core interface scope', hint: 'core/edit-post and core/edit-site are merging.', version: '6.6' }); return 'core'; } return scope; } function normalizeComplementaryAreaName(scope, name) { if (scope === 'core' && name === 'edit-site/template') { external_wp_deprecated_default()(`edit-site/template sidebar`, { alternative: 'edit-post/document', version: '6.6' }); return 'edit-post/document'; } if (scope === 'core' && name === 'edit-site/block-inspector') { external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, { alternative: 'edit-post/block', version: '6.6' }); return 'edit-post/block'; } return name; } ;// ./node_modules/@wordpress/interface/build-module/store/actions.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Set a default complementary area. * * @param {string} scope Complementary area scope. * @param {string} area Area identifier. * * @return {Object} Action object. */ const setDefaultComplementaryArea = (scope, area) => { scope = normalizeComplementaryAreaScope(scope); area = normalizeComplementaryAreaName(scope, area); return { type: 'SET_DEFAULT_COMPLEMENTARY_AREA', scope, area }; }; /** * Enable the complementary area. * * @param {string} scope Complementary area scope. * @param {string} area Area identifier. */ const enableComplementaryArea = (scope, area) => ({ registry, dispatch }) => { // Return early if there's no area. if (!area) { return; } scope = normalizeComplementaryAreaScope(scope); area = normalizeComplementaryAreaName(scope, area); const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); if (!isComplementaryAreaVisible) { registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true); } dispatch({ type: 'ENABLE_COMPLEMENTARY_AREA', scope, area }); }; /** * Disable the complementary area. * * @param {string} scope Complementary area scope. */ const disableComplementaryArea = scope => ({ registry }) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); if (isComplementaryAreaVisible) { registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false); } }; /** * Pins an item. * * @param {string} scope Item scope. * @param {string} item Item identifier. * * @return {Object} Action object. */ const pinItem = (scope, item) => ({ registry }) => { // Return early if there's no item. if (!item) { return; } scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do. if (pinnedItems?.[item] === true) { return; } registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, [item]: true }); }; /** * Unpins an item. * * @param {string} scope Item scope. * @param {string} item Item identifier. */ const unpinItem = (scope, item) => ({ registry }) => { // Return early if there's no item. if (!item) { return; } scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, [item]: false }); }; /** * Returns an action object used in signalling that a feature should be toggled. * * @param {string} scope The feature scope (e.g. core/edit-post). * @param {string} featureName The feature name. */ function toggleFeature(scope, featureName) { return function ({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { since: '6.0', alternative: `dispatch( 'core/preferences' ).toggle` }); registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); }; } /** * Returns an action object used in signalling that a feature should be set to * a true or false value * * @param {string} scope The feature scope (e.g. core/edit-post). * @param {string} featureName The feature name. * @param {boolean} value The value to set. * * @return {Object} Action object. */ function setFeatureValue(scope, featureName, value) { return function ({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { since: '6.0', alternative: `dispatch( 'core/preferences' ).set` }); registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); }; } /** * Returns an action object used in signalling that defaults should be set for features. * * @param {string} scope The feature scope (e.g. core/edit-post). * @param {Object<string, boolean>} defaults A key/value map of feature names to values. * * @return {Object} Action object. */ function setFeatureDefaults(scope, defaults) { return function ({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { since: '6.0', alternative: `dispatch( 'core/preferences' ).setDefaults` }); registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); }; } /** * Returns an action object used in signalling that the user opened a modal. * * @param {string} name A string that uniquely identifies the modal. * * @return {Object} Action object. */ function openModal(name) { return { type: 'OPEN_MODAL', name }; } /** * Returns an action object signalling that the user closed a modal. * * @return {Object} Action object. */ function closeModal() { return { type: 'CLOSE_MODAL' }; } ;// ./node_modules/@wordpress/interface/build-module/store/selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns the complementary area that is active in a given scope. * * @param {Object} state Global application state. * @param {string} scope Item scope. * * @return {string | null | undefined} The complementary area that is active in the given scope. */ const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled // visibility, this is the vanilla default. Other code relies on this // nuance in the return value. if (isComplementaryAreaVisible === undefined) { return undefined; } // Return `null` to indicate the user hid the complementary area. if (isComplementaryAreaVisible === false) { return null; } return state?.complementaryAreas?.[scope]; }); const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); const identifier = state?.complementaryAreas?.[scope]; return isVisible && identifier === undefined; }); /** * Returns a boolean indicating if an item is pinned or not. * * @param {Object} state Global application state. * @param {string} scope Scope. * @param {string} item Item to check. * * @return {boolean} True if the item is pinned and false otherwise. */ const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { var _pinnedItems$item; scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; }); /** * Returns a boolean indicating whether a feature is active for a particular * scope. * * @param {Object} state The store state. * @param {string} scope The scope of the feature (e.g. core/edit-post). * @param {string} featureName The name of the feature. * * @return {boolean} Is the feature enabled? */ const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, { since: '6.0', alternative: `select( 'core/preferences' ).get( scope, featureName )` }); return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); }); /** * Returns true if a modal is active, or false otherwise. * * @param {Object} state Global application state. * @param {string} modalName A string that uniquely identifies the modal. * * @return {boolean} Whether the modal is active. */ function isModalActive(state, modalName) { return state.activeModal === modalName; } ;// ./node_modules/@wordpress/interface/build-module/store/reducer.js /** * WordPress dependencies */ function complementaryAreas(state = {}, action) { switch (action.type) { case 'SET_DEFAULT_COMPLEMENTARY_AREA': { const { scope, area } = action; // If there's already an area, don't overwrite it. if (state[scope]) { return state; } return { ...state, [scope]: area }; } case 'ENABLE_COMPLEMENTARY_AREA': { const { scope, area } = action; return { ...state, [scope]: area }; } } return state; } /** * Reducer for storing the name of the open modal, or null if no modal is open. * * @param {Object} state Previous state. * @param {Object} action Action object containing the `name` of the modal * * @return {Object} Updated state */ function activeModal(state = null, action) { switch (action.type) { case 'OPEN_MODAL': return action.name; case 'CLOSE_MODAL': return null; } return state; } /* harmony default export */ const build_module_store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ complementaryAreas, activeModal })); ;// ./node_modules/@wordpress/interface/build-module/store/constants.js /** * The identifier for the data store. * * @type {string} */ const constants_STORE_NAME = 'core/interface'; ;// ./node_modules/@wordpress/interface/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Store definition for the interface namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore * * @type {Object} */ const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { reducer: build_module_store_reducer, actions: store_actions_namespaceObject, selectors: store_selectors_namespaceObject }); // Once we build a more generic persistence plugin that works across types of stores // we'd be able to replace this with a register call. (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Whether the role supports checked state. * * @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked * @param {import('react').AriaRole} role Role. * @return {boolean} Whether the role supports checked state. */ function roleSupportsCheckedState(role) { return ['checkbox', 'option', 'radio', 'switch', 'menuitemcheckbox', 'menuitemradio', 'treeitem'].includes(role); } function ComplementaryAreaToggle({ as = external_wp_components_namespaceObject.Button, scope, identifier: identifierProp, icon: iconProp, selectedIcon, name, shortcut, ...props }) { const ComponentToUse = as; const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const icon = iconProp || context.icon; const identifier = identifierProp || `${context.name}/${name}`; const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentToUse, { icon: selectedIcon && isSelected ? selectedIcon : icon, "aria-controls": identifier.replace('/', ':') // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked , "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : undefined, onClick: () => { if (isSelected) { disableComplementaryArea(scope); } else { enableComplementaryArea(scope, identifier); } }, shortcut: shortcut, ...props }); } ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ComplementaryAreaHeader = ({ children, className, toggleButtonProps }) => { const toggleButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { icon: close_small, ...toggleButtonProps }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('components-panel__header', 'interface-complementary-area-header', className), tabIndex: -1, children: [children, toggleButton] }); }; /* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader); ;// ./node_modules/@wordpress/interface/build-module/components/action-item/index.js /** * WordPress dependencies */ const action_item_noop = () => {}; function ActionItemSlot({ name, as: Component = external_wp_components_namespaceObject.MenuGroup, fillProps = {}, bubblesVirtually, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: name, bubblesVirtually: bubblesVirtually, fillProps: fillProps, children: fills => { if (!external_wp_element_namespaceObject.Children.toArray(fills).length) { return null; } // Special handling exists for backward compatibility. // It ensures that menu items created by plugin authors aren't // duplicated with automatically injected menu items coming // from pinnable plugin sidebars. // @see https://github.com/WordPress/gutenberg/issues/14457 const initializedByPlugins = []; external_wp_element_namespaceObject.Children.forEach(fills, ({ props: { __unstableExplicitMenuItem, __unstableTarget } }) => { if (__unstableTarget && __unstableExplicitMenuItem) { initializedByPlugins.push(__unstableTarget); } }); const children = external_wp_element_namespaceObject.Children.map(fills, child => { if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { return null; } return child; }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props, children: children }); } }); } function ActionItem({ name, as: Component = external_wp_components_namespaceObject.Button, onClick, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: name, children: ({ onClick: fpOnClick }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { onClick: onClick || fpOnClick ? (...args) => { (onClick || action_item_noop)(...args); (fpOnClick || action_item_noop)(...args); } : undefined, ...props }); } }); } ActionItem.Slot = ActionItemSlot; /* harmony default export */ const action_item = (ActionItem); ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const PluginsMenuItem = ({ // Menu item is marked with unstable prop for backward compatibility. // They are removed so they don't leak to DOM elements. // @see https://github.com/WordPress/gutenberg/issues/14457 __unstableExplicitMenuItem, __unstableTarget, ...restProps }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...restProps }); function ComplementaryAreaMoreMenuItem({ scope, target, __unstableExplicitMenuItem, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { as: toggleProps => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, { __unstableExplicitMenuItem: __unstableExplicitMenuItem, __unstableTarget: `${scope}/${target}`, as: PluginsMenuItem, name: `${scope}/plugin-more-menu`, ...toggleProps }); }, role: "menuitemcheckbox", selectedIcon: library_check, name: target, scope: scope, ...props }); } ;// ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js /** * External dependencies */ /** * WordPress dependencies */ function PinnedItems({ scope, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `PinnedItems/${scope}`, ...props }); } function PinnedItemsSlot({ scope, className, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `PinnedItems/${scope}`, ...props, children: fills => fills?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, 'interface-pinned-items'), children: fills }) }); } PinnedItems.Slot = PinnedItemsSlot; /* harmony default export */ const pinned_items = (PinnedItems); ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ANIMATION_DURATION = 0.3; function ComplementaryAreaSlot({ scope, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `ComplementaryArea/${scope}`, ...props }); } const SIDEBAR_WIDTH = 280; const variants = { open: { width: SIDEBAR_WIDTH }, closed: { width: 0 }, mobileOpen: { width: '100vw' } }; function ComplementaryAreaFill({ activeArea, isActive, scope, children, className, id }) { const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); // This is used to delay the exit animation to the next tick. // The reason this is done is to allow us to apply the right transition properties // When we switch from an open sidebar to another open sidebar. // we don't want to animate in this case. const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea); const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive); const [, setState] = (0,external_wp_element_namespaceObject.useState)({}); (0,external_wp_element_namespaceObject.useEffect)(() => { setState({}); }, [isActive]); const transition = { type: 'tween', duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `ComplementaryArea/${scope}`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: (previousIsActive || isActive) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: variants, initial: "closed", animate: isMobileViewport ? 'mobileOpen' : 'open', exit: "closed", transition: transition, className: "interface-complementary-area__fill", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { id: id, className: className, style: { width: isMobileViewport ? '100vw' : SIDEBAR_WIDTH }, children: children }) }) }) }); } function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { const previousIsSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); const shouldOpenWhenNotSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { // If the complementary area is active and the editor is switching from // a big to a small window size. if (isActive && isSmall && !previousIsSmallRef.current) { disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size // goes from small to big. shouldOpenWhenNotSmallRef.current = true; } else if ( // If there is a flag indicating the complementary area should be // enabled when we go from small to big window size and we are going // from a small to big window size. shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current) { // Remove the flag indicating the complementary area should be // enabled. shouldOpenWhenNotSmallRef.current = false; enableComplementaryArea(scope, identifier); } else if ( // If the flag is indicating the current complementary should be // reopened but another complementary area becomes active, remove // the flag. shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier) { shouldOpenWhenNotSmallRef.current = false; } if (isSmall !== previousIsSmallRef.current) { previousIsSmallRef.current = isSmall; } }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]); } function ComplementaryArea({ children, className, closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), identifier: identifierProp, header, headerClassName, icon: iconProp, isPinnable = true, panelClassName, scope, name, title, toggleShortcut, isActiveByDefault }) { const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const icon = iconProp || context.icon; const identifier = identifierProp || `${context.name}/${name}`; // This state is used to delay the rendering of the Fill // until the initial effect runs. // This prevents the animation from running on mount if // the complementary area is active by default. const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); const { isLoading, isActive, isPinned, activeArea, isSmall, isLarge, showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getActiveComplementaryArea, isComplementaryAreaLoading, isItemPinned } = select(store); const { get } = select(external_wp_preferences_namespaceObject.store); const _activeArea = getActiveComplementaryArea(scope); return { isLoading: isComplementaryAreaLoading(scope), isActive: _activeArea === identifier, isPinned: isItemPinned(scope, identifier), activeArea: _activeArea, isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'), showIconLabels: get('core', 'showIconLabels') }; }, [identifier, scope]); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); const { enableComplementaryArea, disableComplementaryArea, pinItem, unpinItem } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { // Set initial visibility: For large screens, enable if it's active by // default. For small screens, always initially disable. if (isActiveByDefault && activeArea === undefined && !isSmall) { enableComplementaryArea(scope, identifier); } else if (activeArea === undefined && isSmall) { disableComplementaryArea(scope, identifier); } setIsReady(true); }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]); if (!isReady) { return; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items, { scope: scope, children: isPinned && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { scope: scope, identifier: identifier, isPressed: isActive && (!showIconLabels || isLarge), "aria-expanded": isActive, "aria-disabled": isLoading, label: title, icon: showIconLabels ? library_check : icon, showTooltip: !showIconLabels, variant: showIconLabels ? 'tertiary' : undefined, size: "compact", shortcut: toggleShortcut }) }), name && isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { target: name, scope: scope, icon: icon, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComplementaryAreaFill, { activeArea: activeArea, isActive: isActive, className: dist_clsx('interface-complementary-area', className), scope: scope, id: identifier.replace('/', ':'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_header, { className: headerClassName, closeLabel: closeLabel, onClose: () => disableComplementaryArea(scope), toggleButtonProps: { label: closeLabel, size: 'compact', shortcut: toggleShortcut, scope, identifier }, children: header || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }), isPinnable && !isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "interface-complementary-area__pin-unpin-item", icon: isPinned ? star_filled : star_empty, label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), isPressed: isPinned, "aria-expanded": isPinned, size: "compact" })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { className: panelClassName, children: children })] })] }); } ComplementaryArea.Slot = ComplementaryAreaSlot; /* harmony default export */ const complementary_area = (ComplementaryArea); ;// ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js /** * WordPress dependencies */ const FullscreenMode = ({ isActive }) => { (0,external_wp_element_namespaceObject.useEffect)(() => { let isSticky = false; // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as // a consequence of the FullscreenMode setup. if (document.body.classList.contains('sticky-menu')) { isSticky = true; document.body.classList.remove('sticky-menu'); } return () => { if (isSticky) { document.body.classList.add('sticky-menu'); } }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isActive) { document.body.classList.add('is-fullscreen-mode'); } else { document.body.classList.remove('is-fullscreen-mode'); } return () => { if (isActive) { document.body.classList.remove('is-fullscreen-mode'); } }; }, [isActive]); return null; }; /* harmony default export */ const fullscreen_mode = (FullscreenMode); ;// ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js /** * WordPress dependencies */ /** * External dependencies */ const NavigableRegion = (0,external_wp_element_namespaceObject.forwardRef)(({ children, className, ariaLabel, as: Tag = 'div', ...props }, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ref: ref, className: dist_clsx('interface-navigable-region', className), "aria-label": ariaLabel, role: "region", tabIndex: "-1", ...props, children: children }); }); NavigableRegion.displayName = 'NavigableRegion'; /* harmony default export */ const navigable_region = (NavigableRegion); ;// ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const interface_skeleton_ANIMATION_DURATION = 0.25; const commonTransition = { type: 'tween', duration: interface_skeleton_ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; function useHTMLClass(className) { (0,external_wp_element_namespaceObject.useEffect)(() => { const element = document && document.querySelector(`html:not(.${className})`); if (!element) { return; } element.classList.toggle(className); return () => { element.classList.toggle(className); }; }, [className]); } const headerVariants = { hidden: { opacity: 1, marginTop: -60 }, visible: { opacity: 1, marginTop: 0 }, distractionFreeHover: { opacity: 1, marginTop: 0, transition: { ...commonTransition, delay: 0.2, delayChildren: 0.2 } }, distractionFreeHidden: { opacity: 0, marginTop: -60 }, distractionFreeDisabled: { opacity: 0, marginTop: 0, transition: { ...commonTransition, delay: 0.8, delayChildren: 0.8 } } }; function InterfaceSkeleton({ isDistractionFree, footer, header, editorNotices, sidebar, secondarySidebar, content, actions, labels, className }, ref) { const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const defaultTransition = { type: 'tween', duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; useHTMLClass('interface-interface-skeleton__html-container'); const defaultLabels = { /* translators: accessibility text for the top bar landmark region. */ header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'), /* translators: accessibility text for the content landmark region. */ body: (0,external_wp_i18n_namespaceObject.__)('Content'), /* translators: accessibility text for the secondary sidebar landmark region. */ secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), /* translators: accessibility text for the settings landmark region. */ sidebar: (0,external_wp_i18n_namespaceObject._x)('Settings', 'settings landmark area'), /* translators: accessibility text for the publish landmark region. */ actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), /* translators: accessibility text for the footer landmark region. */ footer: (0,external_wp_i18n_namespaceObject.__)('Footer') }; const mergedLabels = { ...defaultLabels, ...labels }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: ref, className: dist_clsx(className, 'interface-interface-skeleton', !!footer && 'has-footer'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__editor", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!header && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { as: external_wp_components_namespaceObject.__unstableMotion.div, className: "interface-interface-skeleton__header", "aria-label": mergedLabels.header, initial: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden', whileHover: isDistractionFree && !isMobileViewport ? 'distractionFreeHover' : 'visible', animate: isDistractionFree && !isMobileViewport ? 'distractionFreeDisabled' : 'visible', exit: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden', variants: headerVariants, transition: defaultTransition, children: header }) }), isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "interface-interface-skeleton__header", children: editorNotices }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__body", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!secondarySidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__secondary-sidebar", ariaLabel: mergedLabels.secondarySidebar, as: external_wp_components_namespaceObject.__unstableMotion.div, initial: "closed", animate: "open", exit: "closed", variants: { open: { width: secondarySidebarSize.width }, closed: { width: 0 } }, transition: defaultTransition, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { style: { position: 'absolute', width: isMobileViewport ? '100vw' : 'fit-content', height: '100%', left: 0 }, variants: { open: { x: 0 }, closed: { x: '-100%' } }, transition: defaultTransition, children: [secondarySidebarResizeListener, secondarySidebar] }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__content", ariaLabel: mergedLabels.body, children: content }), !!sidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__sidebar", ariaLabel: mergedLabels.sidebar, children: sidebar }), !!actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__actions", ariaLabel: mergedLabels.actions, children: actions })] })] }), !!footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__footer", ariaLabel: mergedLabels.footer, children: footer })] }); } /* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); ;// ./node_modules/@wordpress/interface/build-module/components/index.js ;// ./node_modules/@wordpress/interface/build-module/index.js ;// ./node_modules/@wordpress/editor/build-module/components/pattern-rename-modal/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { RenamePatternModal } = unlock(external_wp_patterns_namespaceObject.privateApis); const modalName = 'editor/pattern-rename'; function PatternRenameModal() { const { record, postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const _postType = getCurrentPostType(); return { record: getEditedEntityRecord('postType', _postType, getCurrentPostId()), postType: _postType }; }, []); const { closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(modalName)); if (!isActive || postType !== PATTERN_POST_TYPE) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternModal, { onClose: closeModal, pattern: record }); } ;// ./node_modules/@wordpress/editor/build-module/components/pattern-duplicate-modal/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { DuplicatePatternModal } = unlock(external_wp_patterns_namespaceObject.privateApis); const pattern_duplicate_modal_modalName = 'editor/pattern-duplicate'; function PatternDuplicateModal() { const { record, postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const _postType = getCurrentPostType(); return { record: getEditedEntityRecord('postType', _postType, getCurrentPostId()), postType: _postType }; }, []); const { closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(pattern_duplicate_modal_modalName)); if (!isActive || postType !== PATTERN_POST_TYPE) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DuplicatePatternModal, { onClose: closeModal, onSuccess: () => closeModal(), pattern: record }); } ;// ./node_modules/@wordpress/editor/build-module/components/commands/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const getEditorCommandLoader = () => function useEditorCommandLoader() { const { editorMode, isListViewOpen, showBlockBreadcrumbs, isDistractionFree, isFocusMode, isPreviewMode, isViewable, isCodeEditingEnabled, isRichEditingEnabled, isPublishSidebarEnabled } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _get, _getPostType$viewable; const { get } = select(external_wp_preferences_namespaceObject.store); const { isListViewOpened, getCurrentPostType, getEditorSettings } = select(store_store); const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { editorMode: (_get = get('core', 'editorMode')) !== null && _get !== void 0 ? _get : 'visual', isListViewOpen: isListViewOpened(), showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), isDistractionFree: get('core', 'distractionFree'), isFocusMode: get('core', 'focusMode'), isPreviewMode: getSettings().isPreviewMode, isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false, isCodeEditingEnabled: getEditorSettings().codeEditingEnabled, isRichEditingEnabled: getEditorSettings().richEditingEnabled, isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled() }; }, []); const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const { createInfoNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { __unstableSaveForPreview, setIsListViewOpened, switchEditorMode, toggleDistractionFree, toggleSpotlightMode, toggleTopToolbar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { openModal, enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getCurrentPostId } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { isBlockBasedTheme, canCreateTemplate } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: 'wp_template' }) }; }, []); const allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled; if (isPreviewMode) { return { commands: [], isLoading: false }; } const commands = []; commands.push({ name: 'core/open-shortcut-help', label: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), icon: library_keyboard, callback: ({ close }) => { close(); openModal('editor/keyboard-shortcut-help'); } }); commands.push({ name: 'core/toggle-distraction-free', label: isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Exit Distraction free') : (0,external_wp_i18n_namespaceObject.__)('Enter Distraction free'), callback: ({ close }) => { toggleDistractionFree(); close(); } }); commands.push({ name: 'core/open-preferences', label: (0,external_wp_i18n_namespaceObject.__)('Editor preferences'), callback: ({ close }) => { close(); openModal('editor/preferences'); } }); commands.push({ name: 'core/toggle-spotlight-mode', label: isFocusMode ? (0,external_wp_i18n_namespaceObject.__)('Exit Spotlight mode') : (0,external_wp_i18n_namespaceObject.__)('Enter Spotlight mode'), callback: ({ close }) => { toggleSpotlightMode(); close(); } }); commands.push({ name: 'core/toggle-list-view', label: isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('Close List View') : (0,external_wp_i18n_namespaceObject.__)('Open List View'), icon: list_view, callback: ({ close }) => { setIsListViewOpened(!isListViewOpen); close(); createInfoNotice(isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View off.') : (0,external_wp_i18n_namespaceObject.__)('List View on.'), { id: 'core/editor/toggle-list-view/notice', type: 'snackbar' }); } }); commands.push({ name: 'core/toggle-top-toolbar', label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), callback: ({ close }) => { toggleTopToolbar(); close(); } }); if (allowSwitchEditorMode) { commands.push({ name: 'core/toggle-code-editor', label: editorMode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Open code editor') : (0,external_wp_i18n_namespaceObject.__)('Exit code editor'), icon: library_code, callback: ({ close }) => { switchEditorMode(editorMode === 'visual' ? 'text' : 'visual'); close(); } }); } commands.push({ name: 'core/toggle-breadcrumbs', label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Hide block breadcrumbs') : (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs'), callback: ({ close }) => { toggle('core', 'showBlockBreadcrumbs'); close(); createInfoNotice(showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs hidden.') : (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs visible.'), { id: 'core/editor/toggle-breadcrumbs/notice', type: 'snackbar' }); } }); commands.push({ name: 'core/open-settings-sidebar', label: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings panel.'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, callback: ({ close }) => { const activeSidebar = getActiveComplementaryArea('core'); close(); if (activeSidebar === 'edit-post/document') { disableComplementaryArea('core'); } else { enableComplementaryArea('core', 'edit-post/document'); } } }); commands.push({ name: 'core/open-block-inspector', label: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Block settings panel'), icon: block_default, callback: ({ close }) => { const activeSidebar = getActiveComplementaryArea('core'); close(); if (activeSidebar === 'edit-post/block') { disableComplementaryArea('core'); } else { enableComplementaryArea('core', 'edit-post/block'); } } }); commands.push({ name: 'core/toggle-publish-sidebar', label: isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Disable pre-publish checks') : (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks'), icon: format_list_bullets, callback: ({ close }) => { close(); toggle('core', 'isPublishSidebarEnabled'); createInfoNotice(isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks disabled.') : (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks enabled.'), { id: 'core/editor/publish-sidebar/notice', type: 'snackbar' }); } }); if (isViewable) { commands.push({ name: 'core/preview-link', label: (0,external_wp_i18n_namespaceObject.__)('Preview in a new tab'), icon: library_external, callback: async ({ close }) => { close(); const postId = getCurrentPostId(); const link = await __unstableSaveForPreview(); window.open(link, `wp-preview-${postId}`); } }); } if (canCreateTemplate && isBlockBasedTheme) { const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); if (!isSiteEditor) { commands.push({ name: 'core/go-to-site-editor', label: (0,external_wp_i18n_namespaceObject.__)('Open Site Editor'), callback: ({ close }) => { close(); document.location = 'site-editor.php'; } }); } } return { commands, isLoading: false }; }; const getEditedEntityContextualCommands = () => function useEditedEntityContextualCommands() { const { postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType } = select(store_store); return { postType: getCurrentPostType() }; }, []); const { openModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const commands = []; if (postType === PATTERN_POST_TYPE) { commands.push({ name: 'core/rename-pattern', label: (0,external_wp_i18n_namespaceObject.__)('Rename pattern'), icon: library_edit, callback: ({ close }) => { openModal(modalName); close(); } }); commands.push({ name: 'core/duplicate-pattern', label: (0,external_wp_i18n_namespaceObject.__)('Duplicate pattern'), icon: library_symbol, callback: ({ close }) => { openModal(pattern_duplicate_modal_modalName); close(); } }); } return { isLoading: false, commands }; }; const getPageContentFocusCommands = () => function usePageContentFocusCommands() { const { onNavigateToEntityRecord, goBack, templateId, isPreviewMode } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getRenderingMode, getEditorSettings: _getEditorSettings, getCurrentTemplateId } = unlock(select(store_store)); const editorSettings = _getEditorSettings(); return { isTemplateHidden: getRenderingMode() === 'post-only', onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, getEditorSettings: _getEditorSettings, goBack: editorSettings.onNavigateToPreviousEntityRecord, templateId: getCurrentTemplateId(), isPreviewMode: editorSettings.isPreviewMode }; }, []); const { editedRecord: template, hasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', 'wp_template', templateId); if (isPreviewMode) { return { isLoading: false, commands: [] }; } const commands = []; if (templateId && hasResolved) { commands.push({ name: 'core/switch-to-template-focus', label: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: template title */ (0,external_wp_i18n_namespaceObject.__)('Edit template: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)), icon: library_layout, callback: ({ close }) => { onNavigateToEntityRecord({ postId: templateId, postType: 'wp_template' }); close(); } }); } if (!!goBack) { commands.push({ name: 'core/switch-to-previous-entity', label: (0,external_wp_i18n_namespaceObject.__)('Go back'), icon: library_page, callback: ({ close }) => { goBack(); close(); } }); } return { isLoading: false, commands }; }; const getManipulateDocumentCommands = () => function useManipulateDocumentCommands() { const { postType, postId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostId, getCurrentPostType } = select(store_store); return { postType: getCurrentPostType(), postId: getCurrentPostId() }; }, []); const { editedRecord: template, hasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId); // eslint-disable-next-line @wordpress/no-unused-vars-before-return const { revertTemplate } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); if (!hasResolved || ![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(postType)) { return { isLoading: true, commands: [] }; } const commands = []; if (isTemplateRevertable(template)) { const label = template.type === TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: template title */ (0,external_wp_i18n_namespaceObject.__)('Reset template: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: template part title */ (0,external_wp_i18n_namespaceObject.__)('Reset template part: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)); commands.push({ name: 'core/reset-template', label, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right : rotate_left, callback: ({ close }) => { revertTemplate(template); close(); } }); } return { isLoading: !hasResolved, commands }; }; function useCommands() { (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/editor/edit-ui', hook: getEditorCommandLoader() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/editor/contextual-commands', hook: getEditedEntityContextualCommands(), context: 'entity-edit' }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/editor/page-content-focus', hook: getPageContentFocusCommands(), context: 'entity-edit' }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/manipulate-document', hook: getManipulateDocumentCommands() }); } ;// ./node_modules/@wordpress/editor/build-module/components/block-removal-warnings/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { BlockRemovalWarningModal } = unlock(external_wp_blockEditor_namespaceObject.privateApis); // Prevent accidental removal of certain blocks, asking the user for confirmation first. const TEMPLATE_BLOCKS = ['core/post-content', 'core/post-template', 'core/query']; const BLOCK_REMOVAL_RULES = [{ // Template blocks. // The warning is only shown when a user manipulates templates or template parts. postTypes: ['wp_template', 'wp_template_part'], callback(removedBlocks) { const removedTemplateBlocks = removedBlocks.filter(({ name }) => TEMPLATE_BLOCKS.includes(name)); if (removedTemplateBlocks.length) { return (0,external_wp_i18n_namespaceObject._n)('Deleting this block will stop your post or page content from displaying on this template. It is not recommended.', 'Some of the deleted blocks will stop your post or page content from displaying on this template. It is not recommended.', removedBlocks.length); } } }, { // Pattern overrides. // The warning is only shown when the user edits a pattern. postTypes: ['wp_block'], callback(removedBlocks) { const removedBlocksWithOverrides = removedBlocks.filter(({ attributes }) => attributes?.metadata?.bindings && Object.values(attributes.metadata.bindings).some(binding => binding.source === 'core/pattern-overrides')); if (removedBlocksWithOverrides.length) { return (0,external_wp_i18n_namespaceObject._n)('The deleted block allows instance overrides. Removing it may result in content not displaying where this pattern is used. Are you sure you want to proceed?', 'Some of the deleted blocks allow instance overrides. Removing them may result in content not displaying where this pattern is used. Are you sure you want to proceed?', removedBlocks.length); } } }]; function BlockRemovalWarnings() { const currentPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); const removalRulesForPostType = (0,external_wp_element_namespaceObject.useMemo)(() => BLOCK_REMOVAL_RULES.filter(rule => rule.postTypes.includes(currentPostType)), [currentPostType]); // `BlockRemovalWarnings` is rendered in the editor provider, a shared component // across react native and web. However, `BlockRemovalWarningModal` is web only. // Check it exists before trying to render it. if (!BlockRemovalWarningModal) { return null; } if (!removalRulesForPostType) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarningModal, { rules: removalRulesForPostType }); } ;// ./node_modules/@wordpress/editor/build-module/components/start-page-options/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function useStartPatterns() { // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes, // and it has no postTypes declared and the current post type is page or if // the current post type is part of the postTypes declared. const { blockPatternsWithPostContentBlockType, postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getPatternsByBlockTypes, getBlocksByName } = select(external_wp_blockEditor_namespaceObject.store); const { getCurrentPostType, getRenderingMode } = select(store_store); const rootClientId = getRenderingMode() === 'post-only' ? '' : getBlocksByName('core/post-content')?.[0]; return { blockPatternsWithPostContentBlockType: getPatternsByBlockTypes('core/post-content', rootClientId), postType: getCurrentPostType() }; }, []); return (0,external_wp_element_namespaceObject.useMemo)(() => { if (!blockPatternsWithPostContentBlockType?.length) { return []; } /* * Filter patterns without postTypes declared if the current postType is page * or patterns that declare the current postType in its post type array. */ return blockPatternsWithPostContentBlockType.filter(pattern => { return postType === 'page' && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType); }); }, [postType, blockPatternsWithPostContentBlockType]); } function PatternSelection({ blockPatterns, onChoosePattern }) { const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { postType, postId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getCurrentPostId } = select(store_store); return { postType: getCurrentPostType(), postId: getCurrentPostId() }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { blockPatterns: blockPatterns, onClickPattern: (_pattern, blocks) => { editEntityRecord('postType', postType, postId, { blocks, content: ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization) }); onChoosePattern(); } }); } function StartPageOptionsModal({ onClose }) { const [showStartPatterns, setShowStartPatterns] = (0,external_wp_element_namespaceObject.useState)(true); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const startPatterns = useStartPatterns(); const hasStartPattern = startPatterns.length > 0; if (!hasStartPattern) { return null; } function handleClose() { onClose(); setPreference('core', 'enableChoosePatternModal', showStartPatterns); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { className: "editor-start-page-options__modal", title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'), isFullScreen: true, onRequestClose: handleClose, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-start-page-options__modal-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternSelection, { blockPatterns: startPatterns, onChoosePattern: handleClose }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "editor-start-page-options__modal__actions", justify: "flex-end", expanded: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, checked: showStartPatterns, label: (0,external_wp_i18n_namespaceObject.__)('Show starter patterns'), help: (0,external_wp_i18n_namespaceObject.__)('Shows starter patterns when creating a new page.'), onChange: newValue => { setShowStartPatterns(newValue); } }) }) })] }); } function StartPageOptions() { const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false); const { isEditedPostDirty, isEditedPostEmpty } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { isModalActive } = (0,external_wp_data_namespaceObject.useSelect)(store); const { enabled, postId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostId, getCurrentPostType } = select(store_store); const choosePatternModalEnabled = select(external_wp_preferences_namespaceObject.store).get('core', 'enableChoosePatternModal'); return { postId: getCurrentPostId(), enabled: choosePatternModalEnabled && TEMPLATE_POST_TYPE !== getCurrentPostType() }; }, []); // Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component. // Examples: changing pages in the List View, creating a new page via Command Palette. (0,external_wp_element_namespaceObject.useEffect)(() => { const isFreshPage = !isEditedPostDirty() && isEditedPostEmpty(); // Prevents immediately opening when features is enabled via preferences modal. const isPreferencesModalActive = isModalActive('editor/preferences'); if (!enabled || !isFreshPage || isPreferencesModalActive) { return; } // Open the modal after the initial render for a new page. setIsOpen(true); }, [enabled, postId, isEditedPostDirty, isEditedPostEmpty, isModalActive]); if (!isOpen) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptionsModal, { onClose: () => setIsOpen(false) }); } ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/config.js /** * WordPress dependencies */ const textFormattingShortcuts = [{ keyCombination: { modifier: 'primary', character: 'b' }, description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') }, { keyCombination: { modifier: 'primary', character: 'i' }, description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') }, { keyCombination: { modifier: 'primary', character: 'k' }, description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') }, { keyCombination: { modifier: 'primaryShift', character: 'k' }, description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') }, { keyCombination: { character: '[[' }, description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.') }, { keyCombination: { modifier: 'primary', character: 'u' }, description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') }, { keyCombination: { modifier: 'access', character: 'd' }, description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.') }, { keyCombination: { modifier: 'access', character: 'x' }, description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.') }, { keyCombination: { modifier: 'access', character: '0' }, aliases: [{ modifier: 'access', character: '7' }], description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.') }, { keyCombination: { modifier: 'access', character: '1-6' }, description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.') }, { keyCombination: { modifier: 'primaryShift', character: 'SPACE' }, description: (0,external_wp_i18n_namespaceObject.__)('Add non breaking space.') }]; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/shortcut.js /** * WordPress dependencies */ function KeyCombination({ keyCombination, forceAriaLabel }) { const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { className: "editor-keyboard-shortcut-help-modal__shortcut-key-combination", "aria-label": forceAriaLabel || ariaLabel, children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => { if (character === '+') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: character }, index); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { className: "editor-keyboard-shortcut-help-modal__shortcut-key", children: character }, index); }) }); } function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-keyboard-shortcut-help-modal__shortcut-description", children: description }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-keyboard-shortcut-help-modal__shortcut-term", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { keyCombination: keyCombination, forceAriaLabel: ariaLabel }), aliases.map((alias, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { keyCombination: alias, forceAriaLabel: ariaLabel }, index))] })] }); } /* harmony default export */ const keyboard_shortcut_help_modal_shortcut = (Shortcut); ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js /** * WordPress dependencies */ /** * Internal dependencies */ function DynamicShortcut({ name }) { const { keyCombination, description, aliases } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getShortcutKeyCombination, getShortcutDescription, getShortcutAliases } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { keyCombination: getShortcutKeyCombination(name), aliases: getShortcutAliases(name), description: getShortcutDescription(name) }; }, [name]); if (!keyCombination) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { keyCombination: keyCombination, description: description, aliases: aliases }); } /* harmony default export */ const dynamic_shortcut = (DynamicShortcut); ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'editor/keyboard-shortcut-help'; const ShortcutList = ({ shortcuts }) => /*#__PURE__*/ /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "editor-keyboard-shortcut-help-modal__shortcut-list", role: "list", children: shortcuts.map((shortcut, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "editor-keyboard-shortcut-help-modal__shortcut", children: typeof shortcut === 'string' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dynamic_shortcut, { name: shortcut }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { ...shortcut }) }, index)) }) /* eslint-enable jsx-a11y/no-redundant-roles */; const ShortcutSection = ({ title, shortcuts, className }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { className: dist_clsx('editor-keyboard-shortcut-help-modal__section', className), children: [!!title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "editor-keyboard-shortcut-help-modal__section-title", children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutList, { shortcuts: shortcuts })] }); const ShortcutCategorySection = ({ title, categoryName, additionalShortcuts = [] }) => { const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); }, [categoryName]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { title: title, shortcuts: categoryShortcuts.concat(additionalShortcuts) }); }; function KeyboardShortcutHelpModal() { const isModalActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(KEYBOARD_SHORTCUT_HELP_MODAL_NAME), []); const { openModal, closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const toggleModal = () => { if (isModalActive) { closeModal(); } else { openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); } }; (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/keyboard-shortcuts', toggleModal); if (!isModalActive) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { className: "editor-keyboard-shortcut-help-modal", title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), onRequestClose: toggleModal, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { className: "editor-keyboard-shortcut-help-modal__main-shortcuts", shortcuts: ['core/editor/keyboard-shortcuts'] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), categoryName: "global" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), categoryName: "selection" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), categoryName: "block", additionalShortcuts: [{ keyCombination: { character: '/' }, description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), /* translators: The forward-slash character. e.g. '/'. */ ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') }] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), shortcuts: textFormattingShortcuts }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('List View shortcuts'), categoryName: "list-view" })] }); } /* harmony default export */ const keyboard_shortcut_help_modal = (KeyboardShortcutHelpModal); ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/content-only-settings-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ function ContentOnlySettingsMenuItems({ clientId, onClose }) { const postContentBlocks = usePostContentBlocks(); const { entity, onNavigateToEntityRecord, canEditTemplates } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockParentsByBlockName, getSettings, getBlockAttributes, getBlockParents } = select(external_wp_blockEditor_namespaceObject.store); const { getCurrentTemplateId, getRenderingMode } = select(store_store); const patternParent = getBlockParentsByBlockName(clientId, 'core/block', true)[0]; let record; if (patternParent) { record = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_block', getBlockAttributes(patternParent).ref); } else if (getRenderingMode() === 'template-locked' && !getBlockParents(clientId).some(parent => postContentBlocks.includes(parent))) { record = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', getCurrentTemplateId()); } if (!record) { return {}; } const _canEditTemplates = select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: 'wp_template' }); return { canEditTemplates: _canEditTemplates, entity: record, onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord }; }, [clientId, postContentBlocks]); if (!entity) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateLockContentOnlyMenuItems, { clientId: clientId, onClose: onClose }); } const isPattern = entity.type === 'wp_block'; let helpText = isPattern ? (0,external_wp_i18n_namespaceObject.__)('Edit the pattern to move, delete, or make further changes to this block.') : (0,external_wp_i18n_namespaceObject.__)('Edit the template to move, delete, or make further changes to this block.'); if (!canEditTemplates) { helpText = (0,external_wp_i18n_namespaceObject.__)('Only users with permissions to edit the template can move or delete this block'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { onNavigateToEntityRecord({ postId: entity.id, postType: entity.type }); }, disabled: !canEditTemplates, children: isPattern ? (0,external_wp_i18n_namespaceObject.__)('Edit pattern') : (0,external_wp_i18n_namespaceObject.__)('Edit template') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", as: "p", className: "editor-content-only-settings-menu__description", children: helpText })] }); } function TemplateLockContentOnlyMenuItems({ clientId, onClose }) { const { contentLockingParent } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getContentLockingParent } = unlock(select(external_wp_blockEditor_namespaceObject.store)); return { contentLockingParent: getContentLockingParent(clientId) }; }, [clientId]); const blockDisplayInformation = (0,external_wp_blockEditor_namespaceObject.useBlockDisplayInformation)(contentLockingParent); const blockEditorActions = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); if (!blockDisplayInformation?.title) { return null; } const { modifyContentLockBlock } = unlock(blockEditorActions); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { modifyContentLockBlock(contentLockingParent); onClose(); }, children: (0,external_wp_i18n_namespaceObject._x)('Unlock', 'Unlock content locked blocks') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", as: "p", className: "editor-content-only-settings-menu__description", children: (0,external_wp_i18n_namespaceObject.__)('Temporarily unlock the parent block to edit, delete or make further changes to this block.') })] }); } function ContentOnlySettingsMenu() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => selectedClientIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenuItems, { clientId: selectedClientIds[0], onClose: onClose }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/start-template-options/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function useFallbackTemplateContent(slug, isCustom = false) { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, getDefaultTemplateId } = select(external_wp_coreData_namespaceObject.store); const templateId = getDefaultTemplateId({ slug, is_custom: isCustom, ignore_empty: true }); return templateId ? getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId)?.content?.raw : undefined; }, [slug, isCustom]); } function start_template_options_useStartPatterns(fallbackContent) { const { slug, patterns } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const { getEntityRecord, getBlockPatterns } = select(external_wp_coreData_namespaceObject.store); const postId = getCurrentPostId(); const postType = getCurrentPostType(); const record = getEntityRecord('postType', postType, postId); return { slug: record.slug, patterns: getBlockPatterns() }; }, []); const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet); // Duplicated from packages/block-library/src/pattern/edit.js. function injectThemeAttributeInBlockTemplateContent(block) { if (block.innerBlocks.find(innerBlock => innerBlock.name === 'core/template-part')) { block.innerBlocks = block.innerBlocks.map(innerBlock => { if (innerBlock.name === 'core/template-part' && innerBlock.attributes.theme === undefined) { innerBlock.attributes.theme = currentThemeStylesheet; } return innerBlock; }); } if (block.name === 'core/template-part' && block.attributes.theme === undefined) { block.attributes.theme = currentThemeStylesheet; } return block; } return (0,external_wp_element_namespaceObject.useMemo)(() => { // filter patterns that are supposed to be used in the current template being edited. return [{ name: 'fallback', blocks: (0,external_wp_blocks_namespaceObject.parse)(fallbackContent), title: (0,external_wp_i18n_namespaceObject.__)('Fallback content') }, ...patterns.filter(pattern => { return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some(templateType => slug.startsWith(templateType)); }).map(pattern => { return { ...pattern, blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content).map(block => injectThemeAttributeInBlockTemplateContent(block)) }; })]; }, [fallbackContent, slug, patterns]); } function start_template_options_PatternSelection({ fallbackContent, onChoosePattern, postType }) { const [,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType); const blockPatterns = start_template_options_useStartPatterns(fallbackContent); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { blockPatterns: blockPatterns, onClickPattern: (pattern, blocks) => { onChange(blocks, { selection: undefined }); onChoosePattern(); } }); } function StartModal({ slug, isCustom, onClose, postType }) { const fallbackContent = useFallbackTemplateContent(slug, isCustom); if (!fallbackContent) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { className: "editor-start-template-options__modal", title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'), closeLabel: (0,external_wp_i18n_namespaceObject.__)('Cancel'), focusOnMount: "firstElement", onRequestClose: onClose, isFullScreen: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-start-template-options__modal-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(start_template_options_PatternSelection, { fallbackContent: fallbackContent, slug: slug, isCustom: isCustom, postType: postType, onChoosePattern: () => { onClose(); } }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "editor-start-template-options__modal__actions", justify: "flex-end", expanded: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)('Skip') }) }) })] }); } function StartTemplateOptions() { const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); const { shouldOpenModal, slug, isCustom, postType, postId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const _postType = getCurrentPostType(); const _postId = getCurrentPostId(); const { getEditedEntityRecord, hasEditsForEntityRecord } = select(external_wp_coreData_namespaceObject.store); const templateRecord = getEditedEntityRecord('postType', _postType, _postId); const hasEdits = hasEditsForEntityRecord('postType', _postType, _postId); return { shouldOpenModal: !hasEdits && '' === templateRecord.content && TEMPLATE_POST_TYPE === _postType, slug: templateRecord.slug, isCustom: templateRecord.is_custom, postType: _postType, postId: _postId }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { // Should reset the modal state when navigating to a new page/post. setIsClosed(false); }, [postType, postId]); if (!shouldOpenModal || isClosed) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartModal, { slug: slug, isCustom: isCustom, postType: postType, onClose: () => setIsClosed(true) }); } ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Handles the keyboard shortcuts for the editor. * * It provides functionality for various keyboard shortcuts such as toggling editor mode, * toggling distraction-free mode, undo/redo, saving the post, toggling list view, * and toggling the sidebar. */ function EditorKeyboardShortcuts() { const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => { const { richEditingEnabled, codeEditingEnabled } = select(store_store).getEditorSettings(); return !richEditingEnabled || !codeEditingEnabled; }, []); const { getBlockSelectionStart } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { redo, undo, savePost, setIsListViewOpened, switchEditorMode, toggleDistractionFree } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isEditedPostDirty, isPostSavingLocked, isListViewOpened, getEditorMode } = (0,external_wp_data_namespaceObject.useSelect)(store_store); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-mode', () => { switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual'); }, { isDisabled: isModeToggleDisabled }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-distraction-free', () => { toggleDistractionFree(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => { undo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => { redo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => { event.preventDefault(); /** * Do not save the post if post saving is locked. */ if (isPostSavingLocked()) { return; } // TODO: This should be handled in the `savePost` effect in // considering `isSaveable`. See note on `isEditedPostSaveable` // selector about dirtiness and meta-boxes. // // See: `isEditedPostSaveable` if (!isEditedPostDirty()) { return; } savePost(); }); // Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', event => { if (!isListViewOpened()) { event.preventDefault(); setIsListViewOpened(true); } }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-sidebar', event => { // This shortcut has no known clashes, but use preventDefault to prevent any // obscure shortcuts from triggering. event.preventDefault(); const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(getActiveComplementaryArea('core')); if (isEditorSidebarOpened) { disableComplementaryArea('core'); } else { const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document'; enableComplementaryArea('core', sidebarToOpen); } }); return null; } ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-regular.js /** * WordPress dependencies */ function ConvertToRegularBlocks({ clientId, onClose }) { const { getBlocks } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]); if (!canRemove) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { replaceBlocks(clientId, getBlocks(clientId)); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Detach') }); } ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-template-part.js /** * WordPress dependencies */ /** * Internal dependencies */ function ConvertToTemplatePart({ clientIds, blocks }) { const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { canCreate } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { canCreate: select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType('core/template-part') }; }, []); if (!canCreate) { return null; } const onConvert = async templatePart => { replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', { slug: templatePart.slug, theme: templatePart.theme })); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), { type: 'snackbar' }); // The modal and this component will be unmounted because of `replaceBlocks` above, // so no need to call `closeModal` or `onClose`. }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: symbol_filled, onClick: () => { setIsModalOpen(true); }, "aria-expanded": isModalOpen, "aria-haspopup": "dialog", children: (0,external_wp_i18n_namespaceObject.__)('Create template part') }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModal, { closeModal: () => { setIsModalOpen(false); }, blocks: blocks, onCreate: onConvert })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function TemplatePartMenuItems() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartConverterMenuItem, { clientIds: selectedClientIds, onClose: onClose }) }); } function TemplatePartConverterMenuItem({ clientIds, onClose }) { const { blocks } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlocksByClientId } = select(external_wp_blockEditor_namespaceObject.store); return { blocks: getBlocksByClientId(clientIds) }; }, [clientIds]); // Allow converting a single template part to standard blocks. if (blocks.length === 1 && blocks[0]?.name === 'core/template-part') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToRegularBlocks, { clientId: clientIds[0], onClose: onClose }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToTemplatePart, { clientIds: clientIds, blocks: blocks }); } ;// ./node_modules/@wordpress/editor/build-module/components/provider/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { PatternsMenuItems } = unlock(external_wp_patterns_namespaceObject.privateApis); const provider_noop = () => {}; /** * These are global entities that are only there to split blocks into logical units * They don't provide a "context" for the current post/page being rendered. * So we should not use their ids as post context. This is important to allow post blocks * (post content, post title) to be used within them without issues. */ const NON_CONTEXTUAL_POST_TYPES = ['wp_block', 'wp_navigation', 'wp_template_part']; /** * Depending on the post, template and template mode, * returns the appropriate blocks and change handlers for the block editor provider. * * @param {Array} post Block list. * @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`. * @param {string} mode Rendering mode. * * @example * ```jsx * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode ); * ``` * * @return {Array} Block editor props. */ function useBlockEditorProps(post, template, mode) { const rootLevelPost = mode === 'template-locked' ? 'template' : 'post'; const [postBlocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', post.type, { id: post.id }); const [templateBlocks, onInputTemplate, onChangeTemplate] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', template?.type, { id: template?.id }); const maybeNavigationBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (post.type === 'wp_navigation') { return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', { ref: post.id, // As the parent editor is locked with `templateLock`, the template locking // must be explicitly "unset" on the block itself to allow the user to modify // the block's content. templateLock: false })]; } }, [post.type, post.id]); // It is important that we don't create a new instance of blocks on every change // We should only create a new instance if the blocks them selves change, not a dependency of them. const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (maybeNavigationBlocks) { return maybeNavigationBlocks; } if (rootLevelPost === 'template') { return templateBlocks; } return postBlocks; }, [maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks]); // Handle fallback to postBlocks outside of the above useMemo, to ensure // that constructed block templates that call `createBlock` are not generated // too frequently. This ensures that clientIds are stable. const disableRootLevelChanges = !!template && mode === 'template-locked' || post.type === 'wp_navigation'; if (disableRootLevelChanges) { return [blocks, provider_noop, provider_noop]; } return [blocks, rootLevelPost === 'post' ? onInput : onInputTemplate, rootLevelPost === 'post' ? onChange : onChangeTemplate]; } /** * This component provides the editor context and manages the state of the block editor. * * @param {Object} props The component props. * @param {Object} props.post The post object. * @param {Object} props.settings The editor settings. * @param {boolean} props.recovery Indicates if the editor is in recovery mode. * @param {Array} props.initialEdits The initial edits for the editor. * @param {Object} props.children The child components. * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider. * @param {Object} [props.__unstableTemplate] The template object. * * @example * ```jsx * <ExperimentalEditorProvider * post={ post } * settings={ settings } * recovery={ recovery } * initialEdits={ initialEdits } * __unstableTemplate={ template } * > * { children } * </ExperimentalEditorProvider> * * @return {Object} The rendered ExperimentalEditorProvider component. */ const ExperimentalEditorProvider = with_registry_provider(({ post, settings, recovery, initialEdits, children, BlockEditorProviderComponent = ExperimentalBlockEditorProvider, __unstableTemplate: template }) => { const hasTemplate = !!template; const { editorSettings, selection, isReady, mode, defaultMode, postTypeEntities } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditorSettings, getEditorSelection, getRenderingMode, __unstableIsEditorReady, getDefaultRenderingMode } = unlock(select(store_store)); const { getEntitiesConfig } = select(external_wp_coreData_namespaceObject.store); const _mode = getRenderingMode(); const _defaultMode = getDefaultRenderingMode(post.type); /** * To avoid content "flash", wait until rendering mode has been resolved. * This is important for the initial render of the editor. * * - Wait for template to be resolved if the default mode is 'template-locked'. * - Wait for default mode to be resolved otherwise. */ const hasResolvedDefaultMode = _defaultMode === 'template-locked' ? hasTemplate : _defaultMode !== undefined; // Wait until the default mode is retrieved and start rendering canvas. const isRenderingModeReady = _defaultMode !== undefined; return { editorSettings: getEditorSettings(), isReady: __unstableIsEditorReady(), mode: isRenderingModeReady ? _mode : undefined, defaultMode: hasResolvedDefaultMode ? _defaultMode : undefined, selection: getEditorSelection(), postTypeEntities: post.type === 'wp_template' ? getEntitiesConfig('postType') : null }; }, [post.type, hasTemplate]); const shouldRenderTemplate = hasTemplate && mode !== 'post-only'; const rootLevelPost = shouldRenderTemplate ? template : post; const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => { const postContext = {}; // If it is a template, try to inherit the post type from the name. if (post.type === 'wp_template') { if (post.slug === 'page') { postContext.postType = 'page'; } else if (post.slug === 'single') { postContext.postType = 'post'; } else if (post.slug.split('-')[0] === 'single') { // If the slug is single-{postType}, infer the post type from the name. const postTypeNames = postTypeEntities?.map(entity => entity.name) || []; const match = post.slug.match(`^single-(${postTypeNames.join('|')})(?:-.+)?$`); if (match) { postContext.postType = match[1]; } } } else if (!NON_CONTEXTUAL_POST_TYPES.includes(rootLevelPost.type) || shouldRenderTemplate) { postContext.postId = post.id; postContext.postType = post.type; } return { ...postContext, templateSlug: rootLevelPost.type === 'wp_template' ? rootLevelPost.slug : undefined }; }, [shouldRenderTemplate, post.id, post.type, post.slug, rootLevelPost.type, rootLevelPost.slug, postTypeEntities]); const { id, type } = rootLevelPost; const blockEditorSettings = use_block_editor_settings(editorSettings, type, id, mode); const [blocks, onInput, onChange] = useBlockEditorProps(post, template, mode); const { updatePostLock, setupEditor, updateEditorSettings, setCurrentTemplateId, setEditedPost, setRenderingMode } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); const { createWarningNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); // Ideally this should be synced on each change and not just something you do once. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { // Assume that we don't need to initialize in the case of an error recovery. if (recovery) { return; } updatePostLock(settings.postLock); setupEditor(post, initialEdits, settings.template); if (settings.autosave) { createWarningNotice((0,external_wp_i18n_namespaceObject.__)('There is an autosave of this post that is more recent than the version below.'), { id: 'autosave-exists', actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('View the autosave'), url: settings.autosave.editLink }] }); } // The dependencies of the hook are omitted deliberately // We only want to run setupEditor (with initialEdits) only once per post. // A better solution in the future would be to split this effect into multiple ones. }, []); // Synchronizes the active post with the state (0,external_wp_element_namespaceObject.useEffect)(() => { setEditedPost(post.type, post.id); }, [post.type, post.id, setEditedPost]); // Synchronize the editor settings as they change. (0,external_wp_element_namespaceObject.useEffect)(() => { updateEditorSettings(settings); }, [settings, updateEditorSettings]); // Synchronizes the active template with the state. (0,external_wp_element_namespaceObject.useEffect)(() => { setCurrentTemplateId(template?.id); }, [template?.id, setCurrentTemplateId]); // Sets the right rendering mode when loading the editor. (0,external_wp_element_namespaceObject.useEffect)(() => { if (defaultMode) { setRenderingMode(defaultMode); } }, [defaultMode, setRenderingMode]); useHideBlocksFromInserter(post.type, mode); // Register the editor commands. useCommands(); if (!isReady || !mode) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { kind: "root", type: "site", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { kind: "postType", type: post.type, id: post.id, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { value: defaultBlockContext, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockEditorProviderComponent, { value: blocks, onChange: onChange, onInput: onInput, selection: selection, settings: blockEditorSettings, useSubRegistry: false, children: [children, !settings.isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsMenuItems, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartMenuItems, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenu, {}), mode === 'template-locked' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DisableNonPageContentBlocks, {}), type === 'wp_navigation' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationBlockEditingMode, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorKeyboardShortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarnings, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartTemplateOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternRenameModal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternDuplicateModal, {})] })] }) }) }) }); }); /** * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor). * * It supports a large number of post types, including post, page, templates, * custom post types, patterns, template parts. * * All modification and changes are performed to the `@wordpress/core-data` store. * * @param {Object} props The component props. * @param {Object} [props.post] The post object to edit. This is required. * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post. * This is optional and can only be used when the post type supports templates (like posts and pages). * @param {Object} [props.settings] The settings object to use for the editor. * This is optional and can be used to override the default settings. * @param {React.ReactNode} [props.children] Children elements for which the BlockEditorProvider context should apply. * This is optional. * * @example * ```jsx * <EditorProvider * post={ post } * settings={ settings } * __unstableTemplate={ template } * > * { children } * </EditorProvider> * ``` * * @return {React.ReactNode} The rendered EditorProvider component. */ function EditorProvider(props) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalEditorProvider, { ...props, BlockEditorProviderComponent: external_wp_blockEditor_namespaceObject.BlockEditorProvider, children: props.children }); } /* harmony default export */ const provider = (EditorProvider); ;// ./node_modules/@wordpress/editor/build-module/dataviews/fields/content-preview/content-preview-view.js /** * WordPress dependencies */ /** * Internal dependencies */ // @ts-ignore const { useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function PostPreviewContainer({ template, post }) { const [backgroundColor = 'white'] = useGlobalStyle('color.background'); const [postBlocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', post.type, { id: post.id }); const [templateBlocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', template?.type, { id: template?.id }); const blocks = template && templateBlocks ? templateBlocks : postBlocks; const isEmpty = !blocks?.length; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-fields-content-preview", style: { backgroundColor }, children: [isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-fields-content-preview__empty", children: (0,external_wp_i18n_namespaceObject.__)('Empty content') }), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { blocks: blocks }) })] }); } function PostPreviewView({ item }) { const { settings, template } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getPostType$viewable; const { canUser, getPostType, getTemplateId, getEntityRecord } = unlock(select(external_wp_coreData_namespaceObject.store)); const canViewTemplate = canUser('read', { kind: 'postType', name: 'wp_template' }); const _settings = select(store_store).getEditorSettings(); // @ts-ignore const supportsTemplateMode = _settings.supportsTemplateMode; const isViewable = (_getPostType$viewable = getPostType(item.type)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; const templateId = supportsTemplateMode && isViewable && canViewTemplate ? getTemplateId(item.type, item.id) : null; return { settings: _settings, template: templateId ? getEntityRecord('postType', 'wp_template', templateId) : undefined }; }, [item.type, item.id]); // Wrap everything in a block editor provider to ensure 'styles' that are needed // for the previews are synced between the site editor store and the block editor store. // Additionally we need to have the `__experimentalBlockPatterns` setting in order to // render patterns inside the previews. // TODO: Same approach is used in the patterns list and it becomes obvious that some of // the block editor settings are needed in context where we don't have the block editor. // Explore how we can solve this in a better way. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorProvider, { post: item, settings: settings, __unstableTemplate: template, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewContainer, { template: template, post: item }) }); } ;// ./node_modules/@wordpress/editor/build-module/dataviews/fields/content-preview/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const postPreviewField = { type: 'media', id: 'content-preview', label: (0,external_wp_i18n_namespaceObject.__)('Content preview'), render: PostPreviewView, enableSorting: false }; /* harmony default export */ const content_preview = (postPreviewField); ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-actions.js /** * WordPress dependencies */ /** * Internal dependencies */ function registerEntityAction(kind, name, config) { return { type: 'REGISTER_ENTITY_ACTION', kind, name, config }; } function unregisterEntityAction(kind, name, actionId) { return { type: 'UNREGISTER_ENTITY_ACTION', kind, name, actionId }; } function registerEntityField(kind, name, config) { return { type: 'REGISTER_ENTITY_FIELD', kind, name, config }; } function unregisterEntityField(kind, name, fieldId) { return { type: 'UNREGISTER_ENTITY_FIELD', kind, name, fieldId }; } function setIsReady(kind, name) { return { type: 'SET_IS_READY', kind, name }; } const registerPostTypeSchema = postType => async ({ registry }) => { const isReady = unlock(registry.select(store_store)).isEntityReady('postType', postType); if (isReady) { return; } unlock(registry.dispatch(store_store)).setIsReady('postType', postType); const postTypeConfig = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); const canCreate = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: postType }); const currentTheme = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getCurrentTheme(); const actions = [postTypeConfig.viewable ? view_post : undefined, !!postTypeConfig.supports?.revisions ? view_post_revisions : undefined, // @ts-ignore false ? 0 : undefined, postTypeConfig.slug === 'wp_template_part' && canCreate && currentTheme?.is_block_theme ? duplicate_template_part : undefined, canCreate && postTypeConfig.slug === 'wp_block' ? duplicate_pattern : undefined, postTypeConfig.supports?.title ? rename_post : undefined, postTypeConfig.supports?.['page-attributes'] ? reorder_page : undefined, postTypeConfig.slug === 'wp_block' ? export_pattern : undefined, restore_post, reset_post, delete_post, trash_post, permanently_delete_post].filter(Boolean); const fields = [postTypeConfig.supports?.thumbnail && currentTheme?.theme_supports?.['post-thumbnails'] && featured_image, postTypeConfig.supports?.author && author, fields_status, date, slug, postTypeConfig.supports?.['page-attributes'] && fields_parent, postTypeConfig.supports?.comments && comment_status, fields_template, fields_password, postTypeConfig.supports?.editor && postTypeConfig.viewable && content_preview].filter(Boolean); if (postTypeConfig.supports?.title) { let _titleField; if (postType === 'page') { _titleField = page_title; } else if (postType === 'wp_template') { _titleField = template_title; } else if (postType === 'wp_block') { _titleField = pattern_title; } else { _titleField = title; } fields.push(_titleField); } registry.batch(() => { actions.forEach(action => { unlock(registry.dispatch(store_store)).registerEntityAction('postType', postType, action); }); fields.forEach(field => { unlock(registry.dispatch(store_store)).registerEntityField('postType', postType, field); }); }); (0,external_wp_hooks_namespaceObject.doAction)('core.registerPostTypeSchema', postType); }; ;// ./node_modules/@wordpress/editor/build-module/store/private-actions.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns an action object used to set which template is currently being used/edited. * * @param {string} id Template Id. * * @return {Object} Action object. */ function setCurrentTemplateId(id) { return { type: 'SET_CURRENT_TEMPLATE_ID', id }; } /** * Create a block based template. * * @param {?Object} template Template to create and assign. */ const createTemplate = template => async ({ select, dispatch, registry }) => { const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template); registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', select.getCurrentPostType(), select.getCurrentPostId(), { template: savedTemplate.slug }); registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now."), { type: 'snackbar', actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Go back'), onClick: () => dispatch.setRenderingMode(select.getEditorSettings().defaultRenderingMode) }] }); return savedTemplate; }; /** * Update the provided block types to be visible. * * @param {string[]} blockNames Names of block types to show. */ const showBlockTypes = blockNames => ({ registry }) => { var _registry$select$get; const existingBlockNames = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type)); registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', newBlockNames); }; /** * Update the provided block types to be hidden. * * @param {string[]} blockNames Names of block types to hide. */ const hideBlockTypes = blockNames => ({ registry }) => { var _registry$select$get2; const existingBlockNames = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]); registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', [...mergedBlockNames]); }; /** * Save entity records marked as dirty. * * @param {Object} options Options for the action. * @param {Function} [options.onSave] Callback when saving happens. * @param {object[]} [options.dirtyEntityRecords] Array of dirty entities. * @param {object[]} [options.entitiesToSkip] Array of entities to skip saving. * @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`. */ const saveDirtyEntities = ({ onSave, dirtyEntityRecords = [], entitiesToSkip = [], close } = {}) => ({ registry }) => { const PUBLISH_ON_SAVE_ENTITIES = [{ kind: 'postType', name: 'wp_navigation' }]; const saveNoticeId = 'site-editor-save-success'; const homeUrl = registry.select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(saveNoticeId); const entitiesToSave = dirtyEntityRecords.filter(({ kind, name, key, property }) => { return !entitiesToSkip.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property); }); close?.(entitiesToSave); const siteItemsToSave = []; const pendingSavedRecords = []; entitiesToSave.forEach(({ kind, name, key, property }) => { if ('root' === kind && 'site' === name) { siteItemsToSave.push(property); } else { if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) { registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(kind, name, key, { status: 'publish' }); } pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(kind, name, key)); } }); if (siteItemsToSave.length) { pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalSaveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave)); } registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); Promise.all(pendingSavedRecords).then(values => { return onSave ? onSave(values) : values; }).then(values => { if (values.some(value => typeof value === 'undefined')) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.')); } else { registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), { type: 'snackbar', id: saveNoticeId, actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('View site'), url: homeUrl }] }); } }).catch(error => registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} ${error}`)); }; /** * Reverts a template to its original theme-provided file. * * @param {Object} template The template to revert. * @param {Object} [options] * @param {boolean} [options.allowUndo] Whether to allow the user to undo * reverting the template. Default true. */ const private_actions_revertTemplate = (template, { allowUndo = true } = {}) => async ({ registry }) => { const noticeId = 'edit-site-template-reverted'; registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(noticeId); if (!isTemplateRevertable(template)) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), { type: 'snackbar' }); return; } try { const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type); if (!templateEntityConfig) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { type: 'snackbar' }); return; } const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, { context: 'edit', source: template.origin }); const fileTemplate = await external_wp_apiFetch_default()({ path: fileTemplatePath }); if (!fileTemplate) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { type: 'snackbar' }); return; } const serializeBlocks = ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); // We are fixing up the undo level here to make sure we can undo // the revert in the header toolbar correctly. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, { content: serializeBlocks, // Required to make the `undo` behave correctly. blocks: edited.blocks, // Required to revert the blocks in the editor. source: 'custom' // required to avoid turning the editor into a dirty state }, { undoIgnore: true // Required to merge this edit with the last undo level. }); const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, { content: serializeBlocks, blocks, source: 'theme' }); if (allowUndo) { const undoRevert = () => { registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, { content: serializeBlocks, blocks: edited.blocks, source: 'custom' }); }; registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reset.'), { type: 'snackbar', id: noticeId, actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Undo'), onClick: undoRevert }] }); } } catch (error) { const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.'); registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { type: 'snackbar' }); } }; /** * Action that removes an array of templates, template parts or patterns. * * @param {Array} items An array of template,template part or pattern objects to remove. */ const removeTemplates = items => async ({ registry }) => { const isResetting = items.every(item => item?.has_theme_file); const promiseResult = await Promise.allSettled(items.map(item => { return registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', item.type, item.id, { force: true }, { throwOnError: true }); })); // If all the promises were fulfilled with success. if (promiseResult.every(({ status }) => status === 'fulfilled')) { let successMessage; if (items.length === 1) { // Depending on how the entity was retrieved its title might be // an object or simple string. let title; if (typeof items[0].title === 'string') { title = items[0].title; } else if (typeof items[0].title?.rendered === 'string') { title = items[0].title?.rendered; } else if (typeof items[0].title?.raw === 'string') { title = items[0].title?.raw; } successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The template/part's name. */ (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The template/part's name. */ (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'template part'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); } else { successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('Items reset.') : (0,external_wp_i18n_namespaceObject.__)('Items deleted.'); } registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(successMessage, { type: 'snackbar', id: 'editor-template-deleted-success' }); } else { // If there was at lease one failure. let errorMessage; // If we were trying to delete a single template. if (promiseResult.length === 1) { if (promiseResult[0].reason?.message) { errorMessage = promiseResult[0].reason.message; } else { errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the item.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the item.'); } // If we were trying to delete a multiple templates } else { const errorMessages = new Set(); const failedPromises = promiseResult.filter(({ status }) => status === 'rejected'); for (const failedPromise of failedPromises) { if (failedPromise.reason?.message) { errorMessages.add(failedPromise.reason.message); } } if (errorMessages.size === 0) { errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items.'); } else if (errorMessages.size === 1) { errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the items: %s'), [...errorMessages][0]) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items: %s'), [...errorMessages][0]); } else { errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while reverting the items: %s'), [...errorMessages].join(',')) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the items: %s'), [...errorMessages].join(',')); } } registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { type: 'snackbar' }); } }; /** * Set the default rendering mode preference for the current post type. * * @param {string} mode The rendering mode to set as default. */ const setDefaultRenderingMode = mode => ({ select, registry }) => { var _registry$select$get$; const postType = select.getCurrentPostType(); const theme = registry.select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.stylesheet; const renderingModes = (_registry$select$get$ = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'renderingModes')?.[theme]) !== null && _registry$select$get$ !== void 0 ? _registry$select$get$ : {}; if (renderingModes[postType] === mode) { return; } const newModes = { [theme]: { ...renderingModes, [postType]: mode } }; registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'renderingModes', newModes); }; // EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js var fast_deep_equal = __webpack_require__(5215); var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal); ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js /** * WordPress dependencies */ const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) }); /* harmony default export */ const library_navigation = (navigation); ;// ./node_modules/@wordpress/icons/build-module/library/verse.js /** * WordPress dependencies */ const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) }); /* harmony default export */ const library_verse = (verse); ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-selectors.js /** * Internal dependencies */ const private_selectors_EMPTY_ARRAY = []; function getEntityActions(state, kind, name) { var _state$actions$kind$n; return (_state$actions$kind$n = state.actions[kind]?.[name]) !== null && _state$actions$kind$n !== void 0 ? _state$actions$kind$n : private_selectors_EMPTY_ARRAY; } function getEntityFields(state, kind, name) { var _state$fields$kind$na; return (_state$fields$kind$na = state.fields[kind]?.[name]) !== null && _state$fields$kind$na !== void 0 ? _state$fields$kind$na : private_selectors_EMPTY_ARRAY; } function isEntityReady(state, kind, name) { return state.isReady[kind]?.[name]; } ;// ./node_modules/@wordpress/editor/build-module/store/private-selectors.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const EMPTY_INSERTION_POINT = { rootClientId: undefined, insertionIndex: undefined, filterValue: undefined }; /** * These are rendering modes that the editor supports. */ const RENDERING_MODES = ['post-only', 'template-locked']; /** * Get the inserter. * * @param {Object} state Global application state. * * @return {Object} The root client ID, index to insert at and starting filter value. */ const getInserter = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { if (typeof state.blockInserterPanel === 'object') { return state.blockInserterPanel; } if (getRenderingMode(state) === 'template-locked') { const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content'); if (postContentClientId) { return { rootClientId: postContentClientId, insertionIndex: undefined, filterValue: undefined }; } } return EMPTY_INSERTION_POINT; }, state => { const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content'); return [state.blockInserterPanel, getRenderingMode(state), postContentClientId]; })); function getListViewToggleRef(state) { return state.listViewToggleRef; } function getInserterSidebarToggleRef(state) { return state.inserterSidebarToggleRef; } const CARD_ICONS = { wp_block: library_symbol, wp_navigation: library_navigation, page: library_page, post: library_verse }; const getPostIcon = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, options) => { { if (postType === 'wp_template_part' || postType === 'wp_template') { const templateAreas = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || []; const areaData = templateAreas.find(item => options.area === item.area); if (areaData?.icon) { return getTemplatePartIcon(areaData.icon); } return library_layout; } if (CARD_ICONS[postType]) { return CARD_ICONS[postType]; } const postTypeEntity = select(external_wp_coreData_namespaceObject.store).getPostType(postType); // `icon` is the `menu_icon` property of a post type. We // only handle `dashicons` for now, even if the `menu_icon` // also supports urls and svg as values. if (typeof postTypeEntity?.icon === 'string' && postTypeEntity.icon.startsWith('dashicons-')) { return postTypeEntity.icon.slice(10); } return library_page; } }); /** * Returns true if there are unsaved changes to the * post's meta fields, and false otherwise. * * @param {Object} state Global application state. * @param {string} postType The post type of the post. * @param {number} postId The ID of the post. * * @return {boolean} Whether there are edits or not in the meta fields of the relevant post. */ const hasPostMetaChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, postId) => { const { type: currentPostType, id: currentPostId } = getCurrentPost(state); // If no postType or postId is passed, use the current post. const edits = select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', postType || currentPostType, postId || currentPostId); if (!edits?.meta) { return false; } // Compare if anything apart from `footnotes` has changed. const originalPostMeta = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType || currentPostType, postId || currentPostId)?.meta; return !fast_deep_equal_default()({ ...originalPostMeta, footnotes: undefined }, { ...edits.meta, footnotes: undefined }); }); function private_selectors_getEntityActions(state, ...args) { return getEntityActions(state.dataviews, ...args); } function private_selectors_isEntityReady(state, ...args) { return isEntityReady(state.dataviews, ...args); } function private_selectors_getEntityFields(state, ...args) { return getEntityFields(state.dataviews, ...args); } /** * Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most * blocks that aren't descendants of the query block. * * @param {Object} state Global application state. * @param {Array|string} blockNames Block names of the blocks to retrieve. * * @return {Array} Block client IDs. */ const getPostBlocksByName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blockNames) => { blockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; const { getBlocksByName, getBlockParents, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); return getBlocksByName(blockNames).filter(clientId => getBlockParents(clientId).every(parentClientId => { const parentBlockName = getBlockName(parentClientId); return ( // Ignore descendents of the query block. parentBlockName !== 'core/query' && // Enable only the top-most block. !blockNames.includes(parentBlockName) ); })); }, () => [select(external_wp_blockEditor_namespaceObject.store).getBlocks()])); /** * Returns the default rendering mode for a post type by user preference or post type configuration. * * @param {Object} state Global application state. * @param {string} postType The post type. * * @return {string} The default rendering mode. Returns `undefined` while resolving value. */ const getDefaultRenderingMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType) => { const { getPostType, getCurrentTheme, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); // This needs to be called before `hasFinishedResolution`. // eslint-disable-next-line @wordpress/no-unused-vars-before-return const currentTheme = getCurrentTheme(); // eslint-disable-next-line @wordpress/no-unused-vars-before-return const postTypeEntity = getPostType(postType); // Wait for the post type and theme resolution. if (!hasFinishedResolution('getPostType', [postType]) || !hasFinishedResolution('getCurrentTheme')) { return undefined; } const theme = currentTheme?.stylesheet; const defaultModePreference = select(external_wp_preferences_namespaceObject.store).get('core', 'renderingModes')?.[theme]?.[postType]; const postTypeDefaultMode = Array.isArray(postTypeEntity?.supports?.editor) ? postTypeEntity.supports.editor.find(features => 'default-mode' in features)?.['default-mode'] : undefined; const defaultMode = defaultModePreference || postTypeDefaultMode; // Fallback gracefully to 'post-only' when rendering mode is not supported. if (!RENDERING_MODES.includes(defaultMode)) { return 'post-only'; } return defaultMode; }); ;// ./node_modules/@wordpress/editor/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Post editor data store configuration. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore */ const storeConfig = { reducer: store_reducer, selectors: selectors_namespaceObject, actions: actions_namespaceObject }; /** * Store definition for the editor namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore */ const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig }); (0,external_wp_data_namespaceObject.register)(store_store); unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject); unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject); ;// ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ /** * Object whose keys are the names of block attributes, where each value * represents the meta key to which the block attribute is intended to save. * * @see https://developer.wordpress.org/reference/functions/register_meta/ * * @typedef {Object<string,string>} WPMetaAttributeMapping */ /** * Given a mapping of attribute names (meta source attributes) to their * associated meta key, returns a higher order component that overrides its * `attributes` and `setAttributes` props to sync any changes with the edited * post's meta keys. * * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. * * @return {WPHigherOrderComponent} Higher-order component. */ const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => ({ attributes, setAttributes, ...props }) => { const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta'); const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...attributes, ...Object.fromEntries(Object.entries(metaAttributes).map(([attributeKey, metaKey]) => [attributeKey, meta[metaKey]])) }), [attributes, meta]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { attributes: mergedAttributes, setAttributes: nextAttributes => { const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( // Filter to intersection of keys between the updated // attributes and those with an associated meta key. ([key]) => key in metaAttributes).map(([attributeKey, value]) => [ // Rename the keys to the expected meta key name. metaAttributes[attributeKey], value])); if (Object.entries(nextMeta).length) { setMeta(nextMeta); } setAttributes(nextAttributes); }, ...props }); }, 'withMetaAttributeSource'); /** * Filters a registered block's settings to enhance a block's `edit` component * to upgrade meta-sourced attributes to use the post's meta entity property. * * @param {WPBlockSettings} settings Registered block settings. * * @return {WPBlockSettings} Filtered block settings. */ function shimAttributeSource(settings) { var _settings$attributes; /** @type {WPMetaAttributeMapping} */ const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(([, { source }]) => source === 'meta').map(([attributeKey, { meta }]) => [attributeKey, meta])); if (Object.entries(metaAttributes).length) { settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit); } return settings; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js /** * WordPress dependencies */ function getUserLabel(user) { const avatar = user.avatar_urls && user.avatar_urls[24] ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { className: "editor-autocompleters__user-avatar", alt: "", src: user.avatar_urls[24] }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-autocompleters__no-avatar" }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [avatar, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-autocompleters__user-name", children: user.name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-autocompleters__user-slug", children: user.slug })] }); } /** * A user mentions completer. * * @type {Object} */ /* harmony default export */ const user = ({ name: 'users', className: 'editor-autocompleters__user', triggerPrefix: '@', useItems(filterValue) { const users = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getUsers } = select(external_wp_coreData_namespaceObject.store); return getUsers({ context: 'view', search: encodeURIComponent(filterValue) }); }, [filterValue]); const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({ key: `user-${user.slug}`, value: user, label: getUserLabel(user) })) : [], [users]); return [options]; }, getOptionCompletion(user) { return `@${user.slug}`; } }); ;// ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js /** * WordPress dependencies */ /** * Internal dependencies */ function setDefaultCompleters(completers = []) { // Provide copies so filters may directly modify them. completers.push({ ...user }); return completers; } (0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); ;// ./node_modules/@wordpress/editor/build-module/hooks/media-upload.js /** * WordPress dependencies */ (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/editor/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload); ;// ./node_modules/@wordpress/editor/build-module/hooks/pattern-overrides.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ const { PatternOverridesControls, ResetOverridesControl, PatternOverridesBlockControls, PATTERN_TYPES: pattern_overrides_PATTERN_TYPES, PARTIAL_SYNCING_SUPPORTED_BLOCKS, PATTERN_SYNC_TYPES } = unlock(external_wp_patterns_namespaceObject.privateApis); /** * Override the default edit UI to include a new block inspector control for * assigning a partial syncing controls to supported blocks in the pattern editor. * Currently, only the `core/paragraph` block is supported. * * @param {Component} BlockEdit Original component. * * @return {Component} Wrapped component. */ const withPatternOverrideControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { const isSupportedBlock = !!PARTIAL_SYNCING_SUPPORTED_BLOCKS[props.name]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), props.isSelected && isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ControlsWithStoreSubscription, { ...props }), isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesBlockControls, {})] }); }, 'withPatternOverrideControls'); // Split into a separate component to avoid a store subscription // on every block. function ControlsWithStoreSubscription(props) { const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); const { hasPatternOverridesSource, isEditingSyncedPattern } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getEditedPostAttribute } = select(store_store); return { // For editing link to the site editor if the theme and user permissions support it. hasPatternOverridesSource: !!(0,external_wp_blocks_namespaceObject.getBlockBindingsSource)('core/pattern-overrides'), isEditingSyncedPattern: getCurrentPostType() === pattern_overrides_PATTERN_TYPES.user && getEditedPostAttribute('meta')?.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced && getEditedPostAttribute('wp_pattern_sync_status') !== PATTERN_SYNC_TYPES.unsynced }; }, []); const bindings = props.attributes.metadata?.bindings; const hasPatternBindings = !!bindings && Object.values(bindings).some(binding => binding.source === 'core/pattern-overrides'); const shouldShowPatternOverridesControls = isEditingSyncedPattern && blockEditingMode === 'default'; const shouldShowResetOverridesControl = !isEditingSyncedPattern && !!props.attributes.metadata?.name && blockEditingMode !== 'disabled' && hasPatternBindings; if (!hasPatternOverridesSource) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [shouldShowPatternOverridesControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesControls, { ...props }), shouldShowResetOverridesControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetOverridesControl, { ...props })] }); } (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/with-pattern-override-controls', withPatternOverrideControls); ;// ./node_modules/@wordpress/editor/build-module/hooks/index.js /** * Internal dependencies */ ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js ;// ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js /** * WordPress dependencies */ /** * Internal dependencies */ class AutosaveMonitor extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.needsAutosave = !!(props.isDirty && props.isAutosaveable); } componentDidMount() { if (!this.props.disableIntervalChecks) { this.setAutosaveTimer(); } } componentDidUpdate(prevProps) { if (this.props.disableIntervalChecks) { if (this.props.editsReference !== prevProps.editsReference) { this.props.autosave(); } return; } if (this.props.interval !== prevProps.interval) { clearTimeout(this.timerId); this.setAutosaveTimer(); } if (!this.props.isDirty) { this.needsAutosave = false; return; } if (this.props.isAutosaving && !prevProps.isAutosaving) { this.needsAutosave = false; return; } if (this.props.editsReference !== prevProps.editsReference) { this.needsAutosave = true; } } componentWillUnmount() { clearTimeout(this.timerId); } setAutosaveTimer(timeout = this.props.interval * 1000) { this.timerId = setTimeout(() => { this.autosaveTimerHandler(); }, timeout); } autosaveTimerHandler() { if (!this.props.isAutosaveable) { this.setAutosaveTimer(1000); return; } if (this.needsAutosave) { this.needsAutosave = false; this.props.autosave(); } this.setAutosaveTimer(); } render() { return null; } } /** * Monitors the changes made to the edited post and triggers autosave if necessary. * * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called. * The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as * the specific way of detecting changes. * * There are two caveats: * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second. * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`. * * @param {Object} props - The properties passed to the component. * @param {Function} props.autosave - The function to call when changes need to be saved. * @param {number} props.interval - The maximum time in seconds between an unsaved change and an autosave. * @param {boolean} props.isAutosaveable - If false, the check for changes is retried every second. * @param {boolean} props.disableIntervalChecks - If true, disables the timer and any change will immediately trigger `props.autosave()`. * @param {boolean} props.isDirty - Indicates if there are unsaved changes. * * @example * ```jsx * <AutosaveMonitor interval={30000} /> * ``` */ /* harmony default export */ const autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { const { getReferenceByDistinctEdits } = select(external_wp_coreData_namespaceObject.store); const { isEditedPostDirty, isEditedPostAutosaveable, isAutosavingPost, getEditorSettings } = select(store_store); const { interval = getEditorSettings().autosaveInterval } = ownProps; return { editsReference: getReferenceByDistinctEdits(), isDirty: isEditedPostDirty(), isAutosaveable: isEditedPostAutosaveable(), isAutosaving: isAutosavingPost(), interval }; }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({ autosave() { const { autosave = dispatch(store_store).autosave } = ownProps; autosave(); } }))])(AutosaveMonitor)); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js /** * WordPress dependencies */ const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); /* harmony default export */ const chevron_right_small = (chevronRightSmall); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js /** * WordPress dependencies */ const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); /* harmony default export */ const chevron_left_small = (chevronLeftSmall); ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/editor/build-module/utils/pageTypeBadge.js /** * WordPress dependencies */ /** * Custom hook to get the page type badge for the current post on edit site view. * * @param {number|string} postId postId of the current post being edited. */ function usePageTypeBadge(postId) { const { isFrontPage, isPostsPage } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canUser, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEditedEntityRecord('root', 'site') : undefined; const _postId = parseInt(postId, 10); return { isFrontPage: siteSettings?.page_on_front === _postId, isPostsPage: siteSettings?.page_for_posts === _postId }; }); if (isFrontPage) { return (0,external_wp_i18n_namespaceObject.__)('Homepage'); } else if (isPostsPage) { return (0,external_wp_i18n_namespaceObject.__)('Posts Page'); } return false; } ;// ./node_modules/@wordpress/editor/build-module/components/document-bar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import("@wordpress/components").IconType} IconType */ const MotionButton = (0,external_wp_components_namespaceObject.__unstableMotion)(external_wp_components_namespaceObject.Button); /** * This component renders a navigation bar at the top of the editor. It displays the title of the current document, * a back button (if applicable), and a command center button. It also handles different states of the document, * such as "not found" or "unsynced". * * @example * ```jsx * <DocumentBar /> * ``` * @param {Object} props The component props. * @param {string} props.title A title for the document, defaulting to the document or * template title currently being edited. * @param {IconType} props.icon An icon for the document, no default. * (A default icon indicating the document post type is no longer used.) * * @return {React.ReactNode} The rendered DocumentBar component. */ function DocumentBar(props) { const { postId, postType, postTypeLabel, documentTitle, isNotFound, templateTitle, onNavigateToPreviousEntityRecord, isTemplatePreview } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getCurrentTheme; const { getCurrentPostType, getCurrentPostId, getEditorSettings, getRenderingMode } = select(store_store); const { getEditedEntityRecord, getPostType, getCurrentTheme, isResolving: isResolvingSelector } = select(external_wp_coreData_namespaceObject.store); const _postType = getCurrentPostType(); const _postId = getCurrentPostId(); const _document = getEditedEntityRecord('postType', _postType, _postId); const { default_template_types: templateTypes = [] } = (_getCurrentTheme = getCurrentTheme()) !== null && _getCurrentTheme !== void 0 ? _getCurrentTheme : {}; const _templateInfo = getTemplateInfo({ templateTypes, template: _document }); const _postTypeLabel = getPostType(_postType)?.labels?.singular_name; return { postId: _postId, postType: _postType, postTypeLabel: _postTypeLabel, documentTitle: _document.title, isNotFound: !_document && !isResolvingSelector('getEditedEntityRecord', 'postType', _postType, _postId), templateTitle: _templateInfo.title, onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord, isTemplatePreview: getRenderingMode() === 'template-locked' }; }, []); const { open: openCommandCenter } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const isTemplate = TEMPLATE_POST_TYPES.includes(postType); const hasBackButton = !!onNavigateToPreviousEntityRecord; const entityTitle = isTemplate ? templateTitle : documentTitle; const title = props.title || entityTitle; const icon = props.icon; const pageTypeBadge = usePageTypeBadge(postId); const mountedRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { mountedRef.current = true; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('editor-document-bar', { 'has-back-button': hasBackButton }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: hasBackButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MotionButton, { className: "editor-document-bar__back", icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small : chevron_left_small, onClick: event => { event.stopPropagation(); onNavigateToPreviousEntityRecord(); }, size: "compact", initial: mountedRef.current ? { opacity: 0, transform: 'translateX(15%)' } : false // Don't show entry animation when DocumentBar mounts. , animate: { opacity: 1, transform: 'translateX(0%)' }, exit: { opacity: 0, transform: 'translateX(15%)' }, transition: isReducedMotion ? { duration: 0 } : undefined, children: (0,external_wp_i18n_namespaceObject.__)('Back') }) }), !isTemplate && isTemplatePreview && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: library_layout, className: "editor-document-bar__icon-layout" }), isNotFound ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('Document not found') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { className: "editor-document-bar__command", onClick: () => openCommandCenter(), size: "compact", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { className: "editor-document-bar__title" // Force entry animation when the back button is added or removed. , initial: mountedRef.current ? { opacity: 0, transform: hasBackButton ? 'translateX(15%)' : 'translateX(-15%)' } : false // Don't show entry animation when DocumentBar mounts. , animate: { opacity: 1, transform: 'translateX(0%)' }, transition: isReducedMotion ? { duration: 0 } : undefined, children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: icon }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, { size: "body", as: "h1", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__post-title", children: title ? (0,external_wp_dom_namespaceObject.__unstableStripHTML)(title) : (0,external_wp_i18n_namespaceObject.__)('No title') }), pageTypeBadge && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__post-type-label", children: `· ${pageTypeBadge}` }), postTypeLabel && !props.title && !pageTypeBadge && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__post-type-label", children: `· ${(0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postTypeLabel)}` })] })] }, hasBackButton), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__shortcut", children: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') })] })] }); } ;// external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js /** * External dependencies */ const TableOfContentsItem = ({ children, isValid, isDisabled, level, href, onSelect }) => { function handleClick(event) { if (isDisabled) { event.preventDefault(); return; } onSelect(); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: dist_clsx('document-outline__item', `is-${level.toLowerCase()}`, { 'is-invalid': !isValid, 'is-disabled': isDisabled }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("a", { href: href, className: "document-outline__button", "aria-disabled": isDisabled, onClick: handleClick, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "document-outline__emdash", "aria-hidden": "true" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { className: "document-outline__level", children: level }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "document-outline__item-content", children: children })] }) }); }; /* harmony default export */ const document_outline_item = (TableOfContentsItem); ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module constants */ const emptyHeadingContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)('(Empty heading)') }); const incorrectLevelContent = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)') }, "incorrect-message")]; const singleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)') }, "incorrect-message-h1")]; const multipleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-multiple-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)') }, "incorrect-message-multiple-h1")]; function EmptyOutlineIllustration() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { width: "138", height: "148", viewBox: "0 0 138 148", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { width: "138", height: "148", rx: "4", fill: "#F0F6FC" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "44", y1: "28", x2: "24", y2: "28", stroke: "#DDDDDD" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "48", y: "16", width: "27", height: "23", rx: "4", fill: "#DDDDDD" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z", fill: "black" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "55", y1: "59", x2: "24", y2: "59", stroke: "#DDDDDD" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "59", y: "47", width: "29", height: "23", rx: "4", fill: "#DDDDDD" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z", fill: "black" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "80", y1: "90", x2: "24", y2: "90", stroke: "#DDDDDD" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "84", y: "78", width: "30", height: "23", rx: "4", fill: "#F0B849" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z", fill: "black" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "66", y1: "121", x2: "24", y2: "121", stroke: "#DDDDDD" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "70", y: "109", width: "29", height: "23", rx: "4", fill: "#DDDDDD" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z", fill: "black" })] }); } /** * Returns an array of heading blocks enhanced with the following properties: * level - An integer with the heading level. * isEmpty - Flag indicating if the heading has no content. * * @param {?Array} blocks An array of blocks. * * @return {Array} An array of heading blocks enhanced with the properties described above. */ const computeOutlineHeadings = (blocks = []) => { return blocks.filter(block => block.name === 'core/heading').map(block => ({ ...block, level: block.attributes.level, isEmpty: isEmptyHeading(block) })); }; const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.trim().length === 0; /** * Renders a document outline component. * * @param {Object} props Props. * @param {Function} props.onSelect Function to be called when an outline item is selected * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled. * * @return {React.ReactNode} The rendered component. */ function DocumentOutline({ onSelect, hasOutlineItemsDisabled }) { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { title, isTitleSupported } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _postType$supports$ti; const { getEditedPostAttribute } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); const postType = getPostType(getEditedPostAttribute('type')); return { title: getEditedPostAttribute('title'), isTitleSupported: (_postType$supports$ti = postType?.supports?.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false }; }); const blocks = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getClientIdsWithDescendants, getBlock } = select(external_wp_blockEditor_namespaceObject.store); const clientIds = getClientIdsWithDescendants(); // Note: Don't modify data inside the `Array.map` callback, // all compulations should happen in `computeOutlineHeadings`. return clientIds.map(id => getBlock(id)); }); const contentBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => { // When rendering in `post-only` mode all blocks are considered content blocks. if (select(store_store).getRenderingMode() === 'post-only') { return undefined; } const { getBlocksByName, getClientIdsOfDescendants } = select(external_wp_blockEditor_namespaceObject.store); const [postContentClientId] = getBlocksByName('core/post-content'); // Do nothing if there's no post content block. if (!postContentClientId) { return undefined; } return getClientIdsOfDescendants(postContentClientId); }, []); const prevHeadingLevelRef = (0,external_wp_element_namespaceObject.useRef)(1); const headings = (0,external_wp_element_namespaceObject.useMemo)(() => computeOutlineHeadings(blocks), [blocks]); if (headings.length < 1) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-document-outline has-no-headings", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyOutlineIllustration, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Navigate the structure of your document and address issues like empty or incorrect heading levels.') })] }); } // Not great but it's the simplest way to locate the title right now. const titleNode = document.querySelector('.editor-post-title__input'); const hasTitle = isTitleSupported && title && titleNode; const countByLevel = headings.reduce((acc, heading) => ({ ...acc, [heading.level]: (acc[heading.level] || 0) + 1 }), {}); const hasMultipleH1 = countByLevel[1] > 1; function isContentBlock(clientId) { return Array.isArray(contentBlocks) ? contentBlocks.includes(clientId) : true; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "document-outline", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { children: [hasTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_outline_item, { level: (0,external_wp_i18n_namespaceObject.__)('Title'), isValid: true, onSelect: onSelect, href: `#${titleNode.id}`, isDisabled: hasOutlineItemsDisabled, children: title }), headings.map(item => { // Headings remain the same, go up by one, or down by any amount. // Otherwise there are missing levels. const isIncorrectLevel = item.level > prevHeadingLevelRef.current + 1; const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); prevHeadingLevelRef.current = item.level; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(document_outline_item, { level: `H${item.level}`, isValid: isValid, isDisabled: hasOutlineItemsDisabled || !isContentBlock(item.clientId), href: `#block-${item.clientId}`, onSelect: () => { selectBlock(item.clientId); onSelect?.(); }, children: [item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({ html: item.attributes.content })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings] }, item.clientId); })] }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js /** * WordPress dependencies */ /** * Component check if there are any headings (core/heading blocks) present in the document. * * @param {Object} props Props. * @param {React.ReactNode} props.children Children to be rendered. * * @return {React.ReactNode} The component to be rendered or null if there are headings. */ function DocumentOutlineCheck({ children }) { const hasHeadings = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getGlobalBlockCount } = select(external_wp_blockEditor_namespaceObject.store); return getGlobalBlockCount('core/heading') > 0; }); if (!hasHeadings) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js /** * WordPress dependencies */ /** * Component for registering editor keyboard shortcuts. * * @return {Element} The component to be rendered. */ function EditorKeyboardShortcutsRegister() { // Registering the shortcuts. const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: 'core/editor/toggle-mode', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'), keyCombination: { modifier: 'secondary', character: 'm' } }); registerShortcut({ name: 'core/editor/save', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), keyCombination: { modifier: 'primary', character: 's' } }); registerShortcut({ name: 'core/editor/undo', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), keyCombination: { modifier: 'primary', character: 'z' } }); registerShortcut({ name: 'core/editor/redo', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), keyCombination: { modifier: 'primaryShift', character: 'z' }, // Disable on Apple OS because it conflicts with the browser's // history shortcut. It's a fine alias for both Windows and Linux. // Since there's no conflict for Ctrl+Shift+Z on both Windows and // Linux, we keep it as the default for consistency. aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{ modifier: 'primary', character: 'y' }] }); registerShortcut({ name: 'core/editor/toggle-list-view', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the List View.'), keyCombination: { modifier: 'access', character: 'o' } }); registerShortcut({ name: 'core/editor/toggle-distraction-free', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Enter or exit distraction free mode.'), keyCombination: { modifier: 'primaryShift', character: '\\' } }); registerShortcut({ name: 'core/editor/toggle-sidebar', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings panel.'), keyCombination: { modifier: 'primaryShift', character: ',' } }); registerShortcut({ name: 'core/editor/keyboard-shortcuts', category: 'main', description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), keyCombination: { modifier: 'access', character: 'h' } }); registerShortcut({ name: 'core/editor/next-region', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), keyCombination: { modifier: 'ctrl', character: '`' }, aliases: [{ modifier: 'access', character: 'n' }] }); registerShortcut({ name: 'core/editor/previous-region', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), keyCombination: { modifier: 'ctrlShift', character: '`' }, aliases: [{ modifier: 'access', character: 'p' }, { modifier: 'ctrlShift', character: '~' }] }); }, [registerShortcut]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, {}); } /* harmony default export */ const register_shortcuts = (EditorKeyboardShortcutsRegister); ;// ./node_modules/@wordpress/icons/build-module/library/redo.js /** * WordPress dependencies */ const redo_redo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" }) }); /* harmony default export */ const library_redo = (redo_redo); ;// ./node_modules/@wordpress/icons/build-module/library/undo.js /** * WordPress dependencies */ const undo_undo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" }) }); /* harmony default export */ const library_undo = (undo_undo); ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js /** * WordPress dependencies */ /** * Internal dependencies */ function EditorHistoryRedo(props, ref) { const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y'); const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []); const { redo } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...props, ref: ref, icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('Redo'), shortcut: shortcut // If there are no redo levels we don't want to actually disable this // button, because it will remove focus for keyboard users. // See: https://github.com/WordPress/gutenberg/issues/3486 , "aria-disabled": !hasRedo, onClick: hasRedo ? redo : undefined, className: "editor-history__redo" }); } /** @typedef {import('react').Ref<HTMLElement>} Ref */ /** * Renders the redo button for the editor history. * * @param {Object} props - Props. * @param {Ref} ref - Forwarded ref. * * @return {React.ReactNode} The rendered component. */ /* harmony default export */ const editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo)); ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js /** * WordPress dependencies */ /** * Internal dependencies */ function EditorHistoryUndo(props, ref) { const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []); const { undo } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...props, ref: ref, icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('Undo'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this // button, because it will remove focus for keyboard users. // See: https://github.com/WordPress/gutenberg/issues/3486 , "aria-disabled": !hasUndo, onClick: hasUndo ? undo : undefined, className: "editor-history__undo" }); } /** @typedef {import('react').Ref<HTMLElement>} Ref */ /** * Renders the undo button for the editor history. * * @param {Object} props - Props. * @param {Ref} ref - Forwarded ref. * * @return {React.ReactNode} The rendered component. */ /* harmony default export */ const editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo)); ;// ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js /** * WordPress dependencies */ function TemplateValidationNotice() { const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); const isValid = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_blockEditor_namespaceObject.store).isValidTemplate(); }, []); const { setTemplateValidity, synchronizeTemplate } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); if (isValid) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { className: "editor-template-validation-notice", isDismissible: false, status: "warning", actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'), onClick: () => setTemplateValidity(true) }, { label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'), onClick: () => setShowConfirmDialog(true) }], children: (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showConfirmDialog, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Reset'), onConfirm: () => { setShowConfirmDialog(false); synchronizeTemplate(); }, onCancel: () => setShowConfirmDialog(false), size: "medium", children: (0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?') })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * This component renders the notices displayed in the editor. It displays pinned notices first, followed by dismissible * * @example * ```jsx * <EditorNotices /> * ``` * * @return {React.ReactNode} The rendered EditorNotices component. */ function EditorNotices() { const { notices } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ notices: select(external_wp_notices_namespaceObject.store).getNotices() }), []); const { removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const dismissibleNotices = notices.filter(({ isDismissible, type }) => isDismissible && type === 'default'); const nonDismissibleNotices = notices.filter(({ isDismissible, type }) => !isDismissible && type === 'default'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { notices: nonDismissibleNotices, className: "components-editor-notices__pinned" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { notices: dismissibleNotices, className: "components-editor-notices__dismissible", onRemove: removeNotice, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateValidationNotice, {}) })] }); } /* harmony default export */ const editor_notices = (EditorNotices); ;// ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js /** * WordPress dependencies */ // Last three notices. Slices from the tail end of the list. const MAX_VISIBLE_NOTICES = -3; /** * Renders the editor snackbars component. * * @return {React.ReactNode} The rendered component. */ function EditorSnackbars() { const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []); const { removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const snackbarNotices = notices.filter(({ type }) => type === 'snackbar').slice(MAX_VISIBLE_NOTICES); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SnackbarList, { notices: snackbarNotices, className: "components-editor-notices__snackbar", onRemove: removeNotice }); } ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js /** * WordPress dependencies */ /** * Internal dependencies */ function EntityRecordItem({ record, checked, onChange }) { const { name, kind, title, key } = record; // Handle templates that might use default descriptive titles. const { entityRecordTitle, hasPostMetaChanges } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getCurrentThe; if ('postType' !== kind || 'wp_template' !== name) { return { entityRecordTitle: title, hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key) }; } const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key); const { default_template_types: templateTypes = [] } = (_select$getCurrentThe = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()) !== null && _select$getCurrentThe !== void 0 ? _select$getCurrentThe : {}; return { entityRecordTitle: getTemplateInfo({ template, templateTypes }).title, hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key) }; }, [name, kind, title, key]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled'), checked: checked, onChange: onChange, className: "entities-saved-states__change-control" }) }), hasPostMetaChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "entities-saved-states__changes", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: (0,external_wp_i18n_namespaceObject.__)('Post Meta.') }) })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js /** * WordPress dependencies */ /** * Internal dependencies */ const { getGlobalStylesChanges, GlobalStylesContext: entity_type_list_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function getEntityDescription(entity, count) { switch (entity) { case 'site': return 1 === count ? (0,external_wp_i18n_namespaceObject.__)('This change will affect your whole site.') : (0,external_wp_i18n_namespaceObject.__)('These changes will affect your whole site.'); case 'wp_template': return (0,external_wp_i18n_namespaceObject.__)('This change will affect other parts of your site that use this template.'); case 'page': case 'post': return (0,external_wp_i18n_namespaceObject.__)('The following has been modified.'); } } function GlobalStylesDescription({ record }) { const { user: currentEditorGlobalStyles } = (0,external_wp_element_namespaceObject.useContext)(entity_type_list_GlobalStylesContext); const savedRecord = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord(record.kind, record.name, record.key), [record.kind, record.name, record.key]); const globalStylesChanges = getGlobalStylesChanges(currentEditorGlobalStyles, savedRecord, { maxResults: 10 }); return globalStylesChanges.length ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "entities-saved-states__changes", children: globalStylesChanges.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: change }, change)) }) : null; } function EntityDescription({ record, count }) { if ('globalStyles' === record?.name) { return null; } const description = getEntityDescription(record?.name, count); return description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { children: description }) : null; } function EntityTypeList({ list, unselectedEntities, setUnselectedEntities }) { const count = list.length; const firstRecord = list[0]; const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]); let entityLabel = entityConfig.label; if (firstRecord?.name === 'wp_template_part') { entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: entityLabel, initialOpen: true, className: "entities-saved-states__panel-body", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityDescription, { record: firstRecord, count: count }), list.map(record => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityRecordItem, { record: record, checked: !unselectedEntities.some(elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property), onChange: value => setUnselectedEntities(record, value) }, record.key || record.property); }), 'globalStyles' === firstRecord?.name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesDescription, { record: firstRecord })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.js /** * WordPress dependencies */ /** * Custom hook that determines if any entities are dirty (edited) and provides a way to manage selected/unselected entities. * * @return {Object} An object containing the following properties: * - dirtyEntityRecords: An array of dirty entity records. * - isDirty: A boolean indicating if there are any dirty entity records. * - setUnselectedEntities: A function to set the unselected entities. * - unselectedEntities: An array of unselected entities. */ const useIsDirty = () => { const { editedEntities, siteEdits, siteEntityConfig } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { __experimentalGetDirtyEntityRecords, getEntityRecordEdits, getEntityConfig } = select(external_wp_coreData_namespaceObject.store); return { editedEntities: __experimentalGetDirtyEntityRecords(), siteEdits: getEntityRecordEdits('root', 'site'), siteEntityConfig: getEntityConfig('root', 'site') }; }, []); const dirtyEntityRecords = (0,external_wp_element_namespaceObject.useMemo)(() => { var _siteEntityConfig$met; // Remove site object and decouple into its edited pieces. const editedEntitiesWithoutSite = editedEntities.filter(record => !(record.kind === 'root' && record.name === 'site')); const siteEntityLabels = (_siteEntityConfig$met = siteEntityConfig?.meta?.labels) !== null && _siteEntityConfig$met !== void 0 ? _siteEntityConfig$met : {}; const editedSiteEntities = []; for (const property in siteEdits) { editedSiteEntities.push({ kind: 'root', name: 'site', title: siteEntityLabels[property] || property, property }); } return [...editedEntitiesWithoutSite, ...editedSiteEntities]; }, [editedEntities, siteEdits, siteEntityConfig]); // Unchecked entities to be ignored by save function. const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]); const setUnselectedEntities = ({ kind, name, key, property }, checked) => { if (checked) { _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property)); } else { _setUnselectedEntities([...unselectedEntities, { kind, name, key, property }]); } }; const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0; return { dirtyEntityRecords, isDirty, setUnselectedEntities, unselectedEntities }; }; ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function identity(values) { return values; } /** * Renders the component for managing saved states of entities. * * @param {Object} props The component props. * @param {Function} props.close The function to close the dialog. * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior. * @param {string} props.variant Changes the layout of the component. When an `inline` value is provided, the action buttons are rendered at the end of the component instead of at the start. * * @return {React.ReactNode} The rendered component. */ function EntitiesSavedStates({ close, renderDialog, variant }) { const isDirtyProps = useIsDirty(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, { close: close, renderDialog: renderDialog, variant: variant, ...isDirtyProps }); } /** * Renders a panel for saving entities with dirty records. * * @param {Object} props The component props. * @param {string} props.additionalPrompt Additional prompt to display. * @param {Function} props.close Function to close the panel. * @param {Function} props.onSave Function to call when saving entities. * @param {boolean} props.saveEnabled Flag indicating if save is enabled. * @param {string} props.saveLabel Label for the save button. * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior. * @param {Array} props.dirtyEntityRecords Array of dirty entity records. * @param {boolean} props.isDirty Flag indicating if there are dirty entities. * @param {Function} props.setUnselectedEntities Function to set unselected entities. * @param {Array} props.unselectedEntities Array of unselected entities. * @param {string} props.variant Changes the layout of the component. When an `inline` value is provided, the action buttons are rendered at the end of the component instead of at the start. * * @return {React.ReactNode} The rendered component. */ function EntitiesSavedStatesExtensible({ additionalPrompt = undefined, close, onSave = identity, saveEnabled: saveEnabledProp = undefined, saveLabel = (0,external_wp_i18n_namespaceObject.__)('Save'), renderDialog, dirtyEntityRecords, isDirty, setUnselectedEntities, unselectedEntities, variant = 'default' }) { const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)(); const { saveDirtyEntities } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); // To group entities by type. const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => { const { name } = record; if (!acc[name]) { acc[name] = []; } acc[name].push(record); return acc; }, {}); // Sort entity groups. const { site: siteSavables, wp_template: templateSavables, wp_template_part: templatePartSavables, ...contentSavables } = partitionedSavables; const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray); const saveEnabled = saveEnabledProp !== null && saveEnabledProp !== void 0 ? saveEnabledProp : isDirty; // Explicitly define this with no argument passed. Using `close` on // its own will use the event object in place of the expected saved entities. const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]); const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ onClose: () => dismissPanel() }); const dialogLabelId = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'entities-saved-states__panel-label'); const dialogDescriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'entities-saved-states__panel-description'); const selectItemsToSaveDescription = !!dirtyEntityRecords.length ? (0,external_wp_i18n_namespaceObject.__)('Select the items you want to save.') : undefined; const isInline = variant === 'inline'; const actionButtons = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: isInline ? false : true, as: external_wp_components_namespaceObject.Button, variant: isInline ? 'tertiary' : 'secondary', size: isInline ? undefined : 'compact', onClick: dismissPanel, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: isInline ? false : true, as: external_wp_components_namespaceObject.Button, ref: saveButtonRef, variant: "primary", size: isInline ? undefined : 'compact', disabled: !saveEnabled, accessibleWhenDisabled: true, onClick: () => saveDirtyEntities({ onSave, dirtyEntityRecords, entitiesToSkip: unselectedEntities, close }), className: "editor-entities-saved-states__save-button", children: saveLabel })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: renderDialog ? saveDialogRef : undefined, ...(renderDialog && saveDialogProps), className: dist_clsx('entities-saved-states__panel', { 'is-inline': isInline }), role: renderDialog ? 'dialog' : undefined, "aria-labelledby": renderDialog ? dialogLabelId : undefined, "aria-describedby": renderDialog ? dialogDescriptionId : undefined, children: [!isInline && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "entities-saved-states__panel-header", gap: 2, children: actionButtons }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "entities-saved-states__text-prompt", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "entities-saved-states__text-prompt--header-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { id: renderDialog ? dialogLabelId : undefined, className: "entities-saved-states__text-prompt--header", children: (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { id: renderDialog ? dialogDescriptionId : undefined, children: [additionalPrompt, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "entities-saved-states__text-prompt--changes-count", children: isDirty ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of site changes waiting to be saved. */ (0,external_wp_i18n_namespaceObject._n)('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.', dirtyEntityRecords.length), dirtyEntityRecords.length), { strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}) }) : selectItemsToSaveDescription })] })] }), sortedPartitionedSavables.map(list => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityTypeList, { list: list, unselectedEntities: unselectedEntities, setUnselectedEntities: setUnselectedEntities }, list[0].name); }), isInline && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { direction: "row", justify: "flex-end", className: "entities-saved-states__panel-footer", children: actionButtons })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function getContent() { try { // While `select` in a component is generally discouraged, it is // used here because it (a) reduces the chance of data loss in the // case of additional errors by performing a direct retrieval and // (b) avoids the performance cost associated with unnecessary // content serialization throughout the lifetime of a non-erroring // application. return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent(); } catch (error) {} } function CopyButton({ text, children, variant = 'secondary' }) { const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: variant, ref: ref, children: children }); } class ErrorBoundary extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.state = { error: null }; } componentDidCatch(error) { (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error); } static getDerivedStateFromError(error) { return { error }; } render() { const { error } = this.state; const { canCopyContent = false } = this.props; if (!error) { return this.props.children; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "editor-error-boundary", alignment: "baseline", spacing: 4, justify: "space-between", expanded: false, wrap: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, children: [canCopyContent && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { text: getContent, children: (0,external_wp_i18n_namespaceObject.__)('Copy contents') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { variant: "primary", text: error?.stack, children: (0,external_wp_i18n_namespaceObject.__)('Copy error') })] })] }); } } /** * ErrorBoundary is used to catch JavaScript errors anywhere in a child component tree, log those errors, and display a fallback UI. * * It uses the lifecycle methods getDerivedStateFromError and componentDidCatch to catch errors in a child component tree. * * getDerivedStateFromError is used to render a fallback UI after an error has been thrown, and componentDidCatch is used to log error information. * * @class ErrorBoundary * @augments Component */ /* harmony default export */ const error_boundary = (ErrorBoundary); ;// ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; let hasStorageSupport; /** * Function which returns true if the current environment supports browser * sessionStorage, or false otherwise. The result of this function is cached and * reused in subsequent invocations. */ const hasSessionStorageSupport = () => { if (hasStorageSupport !== undefined) { return hasStorageSupport; } try { // Private Browsing in Safari 10 and earlier will throw an error when // attempting to set into sessionStorage. The test here is intentional in // causing a thrown error as condition bailing from local autosave. window.sessionStorage.setItem('__wpEditorTestSessionStorage', ''); window.sessionStorage.removeItem('__wpEditorTestSessionStorage'); hasStorageSupport = true; } catch { hasStorageSupport = false; } return hasStorageSupport; }; /** * Custom hook which manages the creation of a notice prompting the user to * restore a local autosave, if one exists. */ function useAutosaveNotice() { const { postId, isEditedPostNew, hasRemoteAutosave } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ postId: select(store_store).getCurrentPostId(), isEditedPostNew: select(store_store).isEditedPostNew(), hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave }), []); const { getEditedPostAttribute } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { createWarningNotice, removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { editPost, resetEditorBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); (0,external_wp_element_namespaceObject.useEffect)(() => { let localAutosave = localAutosaveGet(postId, isEditedPostNew); if (!localAutosave) { return; } try { localAutosave = JSON.parse(localAutosave); } catch { // Not usable if it can't be parsed. return; } const { post_title: title, content, excerpt } = localAutosave; const edits = { title, content, excerpt }; { // Only display a notice if there is a difference between what has been // saved and that which is stored in sessionStorage. const hasDifference = Object.keys(edits).some(key => { return edits[key] !== getEditedPostAttribute(key); }); if (!hasDifference) { // If there is no difference, it can be safely ejected from storage. localAutosaveClear(postId, isEditedPostNew); return; } } if (hasRemoteAutosave) { return; } const id = 'wpEditorAutosaveRestore'; createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), { id, actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'), onClick() { const { content: editsContent, ...editsWithoutContent } = edits; editPost(editsWithoutContent); resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content)); removeNotice(id); } }] }); }, [isEditedPostNew, postId]); } /** * Custom hook which ejects a local autosave after a successful save occurs. */ function useAutosavePurge() { const { postId, isEditedPostNew, isDirty, isAutosaving, didError } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ postId: select(store_store).getCurrentPostId(), isEditedPostNew: select(store_store).isEditedPostNew(), isDirty: select(store_store).isEditedPostDirty(), isAutosaving: select(store_store).isAutosavingPost(), didError: select(store_store).didPostSaveRequestFail() }), []); const lastIsDirtyRef = (0,external_wp_element_namespaceObject.useRef)(isDirty); const lastIsAutosavingRef = (0,external_wp_element_namespaceObject.useRef)(isAutosaving); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!didError && (lastIsAutosavingRef.current && !isAutosaving || lastIsDirtyRef.current && !isDirty)) { localAutosaveClear(postId, isEditedPostNew); } lastIsDirtyRef.current = isDirty; lastIsAutosavingRef.current = isAutosaving; }, [isDirty, isAutosaving, didError]); // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave. const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew); const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId); (0,external_wp_element_namespaceObject.useEffect)(() => { if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) { localAutosaveClear(postId, true); } }, [isEditedPostNew, postId]); } function LocalAutosaveMonitor() { const { autosave } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => { requestIdleCallback(() => autosave({ local: true })); }, []); useAutosaveNotice(); useAutosavePurge(); const localAutosaveInterval = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().localAutosaveInterval, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(autosave_monitor, { interval: localAutosaveInterval, autosave: deferredAutosave }); } /** * Monitors local autosaves of a post in the editor. * It uses several hooks and functions to manage autosave behavior: * - `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists. * - `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs. * - `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage. * - `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval. * * The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that. * * @module LocalAutosaveMonitor */ /* harmony default export */ const local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor)); ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Wrapper component that renders its children only if the post type supports page attributes. * * @param {Object} props - The component props. * @param {React.ReactNode} props.children - The child components to render. * * @return {React.ReactNode} The rendered child components or null if page attributes are not supported. */ function PageAttributesCheck({ children }) { const supportsPageAttributes = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); const postType = getPostType(getEditedPostAttribute('type')); return !!postType?.supports?.['page-attributes']; }, []); // Only render fields if post type supports page attributes or available templates exist. if (!supportsPageAttributes) { return null; } return children; } /* harmony default export */ const page_attributes_check = (PageAttributesCheck); ;// ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A component which renders its own children only if the current editor post * type supports one of the given `supportKeys` prop. * * @param {Object} props Props. * @param {React.ReactNode} props.children Children to be rendered if post * type supports. * @param {(string|string[])} props.supportKeys String or string array of keys * to test. * * @return {React.ReactNode} The component to be rendered. */ function PostTypeSupportCheck({ children, supportKeys }) { const postType = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return getPostType(getEditedPostAttribute('type')); }, []); let isSupported = !!postType; if (postType) { isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => !!postType.supports[key]); } if (!isSupported) { return null; } return children; } /* harmony default export */ const post_type_support_check = (PostTypeSupportCheck); ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js /** * WordPress dependencies */ /** * Internal dependencies */ function PageAttributesOrder() { const order = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getEditedPost; return (_select$getEditedPost = select(store_store).getEditedPostAttribute('menu_order')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 0; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null); const setUpdatedOrder = value => { setOrderInput(value); const newOrder = Number(value); if (Number.isInteger(newOrder) && value.trim?.() !== '') { editPost({ menu_order: newOrder }); } }; const value = orderInput !== null && orderInput !== void 0 ? orderInput : order; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Order'), help: (0,external_wp_i18n_namespaceObject.__)('Set the page order.'), value: value, onChange: setUpdatedOrder, hideLabelFromVision: true, onBlur: () => { setOrderInput(null); } }) }) }); } /** * Renders the Page Attributes Order component. A number input in an editor interface * for setting the order of a given page. * The component is now not used in core but was kept for backward compatibility. * * @return {React.ReactNode} The rendered component. */ function PageAttributesOrderWithChecks() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: "page-attributes", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {}) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-row/index.js /** * External dependencies */ /** * WordPress dependencies */ const PostPanelRow = (0,external_wp_element_namespaceObject.forwardRef)(({ className, label, children }, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: dist_clsx('editor-post-panel__row', className), ref: ref, children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-panel__row-label", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-panel__row-control", children: children })] }); }); /* harmony default export */ const post_panel_row = (PostPanelRow); ;// ./node_modules/@wordpress/editor/build-module/utils/terms.js /** * WordPress dependencies */ /** * Returns terms in a tree form. * * @param {Array} flatTerms Array of terms in flat format. * * @return {Array} Array of terms in tree format. */ function terms_buildTermsTree(flatTerms) { const flatTermsWithParentAndChildren = flatTerms.map(term => { return { children: [], parent: undefined, ...term }; }); // All terms should have a `parent` because we're about to index them by it. if (flatTermsWithParentAndChildren.some(({ parent }) => parent === undefined)) { return flatTermsWithParentAndChildren; } const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => { const { parent } = term; if (!acc[parent]) { acc[parent] = []; } acc[parent].push(term); return acc; }, {}); const fillWithChildren = terms => { return terms.map(term => { const children = termsByParent[term.id]; return { ...term, children: children && children.length ? fillWithChildren(children) : [] }; }); }; return fillWithChildren(termsByParent['0'] || []); } const unescapeString = arg => { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg); }; /** * Returns a term object with name unescaped. * * @param {Object} term The term object to unescape. * * @return {Object} Term object with name property unescaped. */ const unescapeTerm = term => { return { ...term, name: unescapeString(term.name) }; }; /** * Returns an array of term objects with names unescaped. * The unescape of each term is performed using the unescapeTerm function. * * @param {Object[]} terms Array of term objects to unescape. * * @return {Object[]} Array of term objects unescaped. */ const unescapeTerms = terms => { return (terms !== null && terms !== void 0 ? terms : []).map(unescapeTerm); }; ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function getTitle(post) { return post?.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`; } const parent_getItemPriority = (name, searchValue) => { const normalizedName = remove_accents_default()(name || '').toLowerCase(); const normalizedSearch = remove_accents_default()(searchValue || '').toLowerCase(); if (normalizedName === normalizedSearch) { return 0; } if (normalizedName.startsWith(normalizedSearch)) { return normalizedName.length; } return Infinity; }; /** * Renders the Page Attributes Parent component. A dropdown menu in an editor interface * for selecting the parent page of a given page. * * @return {React.ReactNode} The component to be rendered. Return null if post type is not hierarchical. */ function parent_PageAttributesParent() { const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false); const { isHierarchical, parentPostId, parentPostTitle, pageItems, isLoading } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _pType$hierarchical; const { getPostType, getEntityRecords, getEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const { getCurrentPostId, getEditedPostAttribute } = select(store_store); const postTypeSlug = getEditedPostAttribute('type'); const pageId = getEditedPostAttribute('parent'); const pType = getPostType(postTypeSlug); const postId = getCurrentPostId(); const postIsHierarchical = (_pType$hierarchical = pType?.hierarchical) !== null && _pType$hierarchical !== void 0 ? _pType$hierarchical : false; const query = { per_page: 100, exclude: postId, parent_exclude: postId, orderby: 'menu_order', order: 'asc', _fields: 'id,title,parent' }; // Perform a search when the field is changed. if (!!fieldValue) { query.search = fieldValue; } const parentPost = pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null; return { isHierarchical: postIsHierarchical, parentPostId: pageId, parentPostTitle: parentPost ? getTitle(parentPost) : '', pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null, isLoading: postIsHierarchical ? isResolving('getEntityRecords', ['postType', postTypeSlug, query]) : false }; }, [fieldValue]); const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { const getOptionsFromTree = (tree, level = 0) => { const mappedNodes = tree.map(treeNode => [{ value: treeNode.id, label: '— '.repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name), rawName: treeNode.name }, ...getOptionsFromTree(treeNode.children || [], level + 1)]); const sortedNodes = mappedNodes.sort(([a], [b]) => { const priorityA = parent_getItemPriority(a.rawName, fieldValue); const priorityB = parent_getItemPriority(b.rawName, fieldValue); return priorityA >= priorityB ? 1 : -1; }); return sortedNodes.flat(); }; if (!pageItems) { return []; } let tree = pageItems.map(item => ({ id: item.id, parent: item.parent, name: getTitle(item) })); // Only build a hierarchical tree when not searching. if (!fieldValue) { tree = terms_buildTermsTree(tree); } const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list. const optsHasParent = opts.find(item => item.value === parentPostId); if (parentPostTitle && !optsHasParent) { opts.unshift({ value: parentPostId, label: parentPostTitle }); } return opts; }, [pageItems, fieldValue, parentPostTitle, parentPostId]); if (!isHierarchical) { return null; } /** * Handle user input. * * @param {string} inputValue The current value of the input field. */ const handleKeydown = inputValue => { setFieldValue(inputValue); }; /** * Handle author selection. * * @param {Object} selectedPostId The selected Author. */ const handleChange = selectedPostId => { editPost({ parent: selectedPostId }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, className: "editor-page-attributes__parent", label: (0,external_wp_i18n_namespaceObject.__)('Parent'), help: (0,external_wp_i18n_namespaceObject.__)('Choose a parent page.'), value: parentPostId, options: parentOptions, onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300), onChange: handleChange, hideLabelFromVision: true, isLoading: isLoading }); } function PostParentToggle({ isOpen, onClick }) { const parentPost = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute } = select(store_store); const parentPostId = getEditedPostAttribute('parent'); if (!parentPostId) { return null; } const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const postTypeSlug = getEditedPostAttribute('type'); return getEntityRecord('postType', postTypeSlug, parentPostId); }, []); const parentTitle = (0,external_wp_element_namespaceObject.useMemo)(() => !parentPost ? (0,external_wp_i18n_namespaceObject.__)('None') : getTitle(parentPost), [parentPost]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-parent__panel-toggle", variant: "tertiary", "aria-expanded": isOpen, "aria-label": // translators: %s: Current post parent. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change parent: %s'), parentTitle), onClick: onClick, children: parentTitle }); } function ParentRow() { const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { // Site index. return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; }, []); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Parent'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, className: "editor-post-parent__panel-dropdown", contentClassName: "editor-post-parent__panel-dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostParentToggle, { isOpen: isOpen, onClick: onToggle }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-parent", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Parent'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The home URL of the WordPress installation without the scheme. */ (0,external_wp_i18n_namespaceObject.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %s<wbr />/services<wbr />/pricing.'), (0,external_wp_url_namespaceObject.filterURLForDisplay)(homeUrl).replace(/([/.])/g, '<wbr />$1')), { wbr: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'), { a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes') }) }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(parent_PageAttributesParent, {})] }) }) }); } /* harmony default export */ const page_attributes_parent = (parent_PageAttributesParent); ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const PANEL_NAME = 'page-attributes'; function AttributesPanel() { const { isEnabled, postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute, isEditorPanelEnabled } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { isEnabled: isEditorPanelEnabled(PANEL_NAME), postType: getPostType(getEditedPostAttribute('type')) }; }, []); if (!isEnabled || !postType) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ParentRow, {}); } /** * Renders the Page Attributes Panel component. * * @return {React.ReactNode} The rendered component. */ function PageAttributesPanel() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AttributesPanel, {}) }); } ;// ./node_modules/@wordpress/icons/build-module/library/add-template.js /** * WordPress dependencies */ const addTemplate = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z" }) }); /* harmony default export */ const add_template = (addTemplate); ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template-modal.js /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); function CreateNewTemplateModal({ onClose }) { const { defaultBlockTemplate, onNavigateToEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditorSettings, getCurrentTemplateId } = select(store_store); return { defaultBlockTemplate: getEditorSettings().defaultBlockTemplate, onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, getTemplateId: getCurrentTemplateId }; }); const { createTemplate } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const cancel = () => { setTitle(''); onClose(); }; const submit = async event => { event.preventDefault(); if (isBusy) { return; } setIsBusy(true); const newTemplateContent = defaultBlockTemplate !== null && defaultBlockTemplate !== void 0 ? defaultBlockTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { tagName: 'header', layout: { inherit: true } }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/site-title'), (0,external_wp_blocks_namespaceObject.createBlock)('core/site-tagline')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/separator'), (0,external_wp_blocks_namespaceObject.createBlock)('core/group', { tagName: 'main' }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { layout: { inherit: true } }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', { layout: { inherit: true } })])]); const newTemplate = await createTemplate({ slug: (0,external_wp_url_namespaceObject.cleanForSlug)(title || DEFAULT_TITLE), content: newTemplateContent, title: title || DEFAULT_TITLE }); setIsBusy(false); onNavigateToEntityRecord({ postId: newTemplate.id, postType: 'wp_template' }); cancel(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'), onRequestClose: cancel, focusOnMount: "firstContentElement", size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { className: "editor-post-template__create-form", onSubmit: submit, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Name'), value: title, onChange: setTitle, placeholder: DEFAULT_TITLE, disabled: isBusy, help: (0,external_wp_i18n_namespaceObject.__)( // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: cancel, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", isBusy: isBusy, "aria-disabled": isBusy, children: (0,external_wp_i18n_namespaceObject.__)('Create') })] })] }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/hooks.js /** * WordPress dependencies */ /** * Internal dependencies */ function useEditedPostContext() { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostId, getCurrentPostType } = select(store_store); return { postId: getCurrentPostId(), postType: getCurrentPostType() }; }, []); } function useAllowSwitchingTemplates() { const { postType, postId } = useEditedPostContext(); return (0,external_wp_data_namespaceObject.useSelect)(select => { const { canUser, getEntityRecord, getEntityRecords } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEntityRecord('root', 'site') : undefined; const templates = getEntityRecords('postType', 'wp_template', { per_page: -1 }); const isPostsPage = +postId === siteSettings?.page_for_posts; // If current page is set front page or posts page, we also need // to check if the current theme has a template for it. If not const isFrontPage = postType === 'page' && +postId === siteSettings?.page_on_front && templates?.some(({ slug }) => slug === 'front-page'); return !isPostsPage && !isFrontPage; }, [postId, postType]); } function useTemplates(postType) { return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { per_page: -1, post_type: postType }), [postType]); } function useAvailableTemplates(postType) { const currentTemplateSlug = useCurrentTemplateSlug(); const allowSwitchingTemplate = useAllowSwitchingTemplates(); const templates = useTemplates(postType); return (0,external_wp_element_namespaceObject.useMemo)(() => allowSwitchingTemplate && templates?.filter(template => template.is_custom && template.slug !== currentTemplateSlug && !!template.content.raw // Skip empty templates. ), [templates, currentTemplateSlug, allowSwitchingTemplate]); } function useCurrentTemplateSlug() { const { postType, postId } = useEditedPostContext(); const templates = useTemplates(postType); const entityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => { const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); return post?.template; }, [postType, postId]); if (!entityTemplate) { return; } // If a page has a `template` set and is not included in the list // of the theme's templates, do not return it, in order to resolve // to the current theme's default template. return templates?.find(template => template.slug === entityTemplate)?.slug; } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/classic-theme.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostTemplateToggle({ isOpen, onClick }) { const templateTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { const templateSlug = select(store_store).getEditedPostAttribute('template'); const { supportsTemplateMode, availableTemplates } = select(store_store).getEditorSettings(); if (!supportsTemplateMode && availableTemplates[templateSlug]) { return availableTemplates[templateSlug]; } const template = select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: 'wp_template' }) && select(store_store).getCurrentTemplateId(); return template?.title || template?.slug || availableTemplates?.[templateSlug]; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Template options'), onClick: onClick, children: templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template') }); } /** * Renders the dropdown content for selecting a post template. * * @param {Object} props The component props. * @param {Function} props.onClose The function to close the dropdown. * * @return {React.ReactNode} The rendered dropdown content. */ function PostTemplateDropdownContent({ onClose }) { var _options$find, _selectedOption$value; const allowSwitchingTemplate = useAllowSwitchingTemplates(); const { availableTemplates, fetchedTemplates, selectedTemplateSlug, canCreate, canEdit, currentTemplateId, onNavigateToEntityRecord, getEditorSettings } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canUser, getEntityRecords } = select(external_wp_coreData_namespaceObject.store); const editorSettings = select(store_store).getEditorSettings(); const canCreateTemplates = canUser('create', { kind: 'postType', name: 'wp_template' }); const _currentTemplateId = select(store_store).getCurrentTemplateId(); return { availableTemplates: editorSettings.availableTemplates, fetchedTemplates: canCreateTemplates ? getEntityRecords('postType', 'wp_template', { post_type: select(store_store).getCurrentPostType(), per_page: -1 }) : undefined, selectedTemplateSlug: select(store_store).getEditedPostAttribute('template'), canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode, canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId, currentTemplateId: _currentTemplateId, onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, getEditorSettings: select(store_store).getEditorSettings }; }, [allowSwitchingTemplate]); const options = (0,external_wp_element_namespaceObject.useMemo)(() => Object.entries({ ...availableTemplates, ...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({ slug, title }) => [slug, title.rendered])) }).map(([slug, title]) => ({ value: slug, label: title })), [availableTemplates, fetchedTemplates]); const selectedOption = (_options$find = options.find(option => option.value === selectedTemplateSlug)) !== null && _options$find !== void 0 ? _options$find : options.find(option => !option.value); // The default option has '' value. const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-template__classic-theme-dropdown", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Template'), help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'), actions: canCreate ? [{ icon: add_template, label: (0,external_wp_i18n_namespaceObject.__)('Add template'), onClick: () => setIsCreateModalOpen(true) }] : [], onClose: onClose }), !allowSwitchingTemplate ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)('Template'), value: (_selectedOption$value = selectedOption?.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '', options: options, onChange: slug => editPost({ template: slug || '' }) }), canEdit && onNavigateToEntityRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => { onNavigateToEntityRecord({ postId: currentTemplateId, postType: 'wp_template' }); onClose(); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), { type: 'snackbar', actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Go back'), onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() }] }); }, children: (0,external_wp_i18n_namespaceObject.__)('Edit template') }) }), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, { onClose: () => setIsCreateModalOpen(false) })] }); } function ClassicThemeControl() { const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, className: 'editor-post-template__dropdown', placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Template'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateToggle, { isOpen: isOpen, onClick: onToggle }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateDropdownContent, { onClose: onClose }) }) }); } /** * Provides a dropdown menu for selecting and managing post templates. * * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates. * * @return {React.ReactNode} The rendered ClassicThemeControl component. */ /* harmony default export */ const classic_theme = (ClassicThemeControl); ;// external ["wp","warning"] const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const { PreferenceBaseOption } = unlock(external_wp_preferences_namespaceObject.privateApis); function EnablePanelOption(props) { const { toggleEditorPanelEnabled } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isChecked, isRemoved } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isEditorPanelEnabled, isEditorPanelRemoved } = select(store_store); return { isChecked: isEditorPanelEnabled(props.panelName), isRemoved: isEditorPanelRemoved(props.panelName) }; }, [props.panelName]); if (isRemoved) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceBaseOption, { isChecked: isChecked, onChange: () => toggleEditorPanelEnabled(props.panelName), ...props }); } ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Fill, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption'); const EnablePluginDocumentSettingPanelOption = ({ label, panelName }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { label: label, panelName: panelName }) }); EnablePluginDocumentSettingPanelOption.Slot = Slot; /* harmony default export */ const enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption); ;// ./node_modules/@wordpress/editor/build-module/components/plugin-document-setting-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Fill: plugin_document_setting_panel_Fill, Slot: plugin_document_setting_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel'); /** * Renders items below the Status & Availability panel in the Document Sidebar. * * @param {Object} props Component properties. * @param {string} props.name Required. A machine-friendly name for the panel. * @param {string} [props.className] An optional class name added to the row. * @param {string} [props.title] The title of the panel * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. * @param {React.ReactNode} props.children Children to be rendered * * @example * ```js * // Using ES5 syntax * var el = React.createElement; * var __ = wp.i18n.__; * var registerPlugin = wp.plugins.registerPlugin; * var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel; * * function MyDocumentSettingPlugin() { * return el( * PluginDocumentSettingPanel, * { * className: 'my-document-setting-plugin', * title: 'My Panel', * name: 'my-panel', * }, * __( 'My Document Setting Panel' ) * ); * } * * registerPlugin( 'my-document-setting-plugin', { * render: MyDocumentSettingPlugin * } ); * ``` * * @example * ```jsx * // Using ESNext syntax * import { registerPlugin } from '@wordpress/plugins'; * import { PluginDocumentSettingPanel } from '@wordpress/editor'; * * const MyDocumentSettingTest = () => ( * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel"> * <p>My Document Setting Panel</p> * </PluginDocumentSettingPanel> * ); * * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } ); * ``` * * @return {React.ReactNode} The component to be rendered. */ const PluginDocumentSettingPanel = ({ name, className, title, icon, children }) => { const { name: pluginName } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const panelName = `${pluginName}/${name}`; const { opened, isEnabled } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isEditorPanelOpened, isEditorPanelEnabled } = select(store_store); return { opened: isEditorPanelOpened(panelName), isEnabled: isEditorPanelEnabled(panelName) }; }, [panelName]); const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); if (undefined === name) { true ? external_wp_warning_default()('PluginDocumentSettingPanel requires a name property.') : 0; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel, { label: title, panelName: panelName }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel_Fill, { children: isEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { className: className, title: title, icon: icon, opened: opened, onToggle: () => toggleEditorPanelOpened(panelName), children: children }) })] }); }; PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; /* harmony default export */ const plugin_document_setting_panel = (PluginDocumentSettingPanel); ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js /** * WordPress dependencies */ const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0; /** * Plugins may want to add an item to the menu either for every block * or only for the specific ones provided in the `allowedBlocks` component property. * * If there are multiple blocks selected the item will be rendered if every block * is of one allowed type (not necessarily the same). * * @param {string[]} selectedBlocks Array containing the names of the blocks selected * @param {string[]} allowedBlocks Array containing the names of the blocks allowed * @return {boolean} Whether the item will be rendered or not. */ const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks); /** * Renders a new item in the block settings menu. * * @param {Object} props Component props. * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list. * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element. * @param {string} props.label The menu item text. * @param {Function} props.onClick Callback function to be executed when the user click the menu item. * @param {boolean} [props.small] Whether to render the label or not. * @param {string} [props.role] The ARIA role for the menu item. * * @example * ```js * // Using ES5 syntax * var __ = wp.i18n.__; * var PluginBlockSettingsMenuItem = wp.editor.PluginBlockSettingsMenuItem; * * function doOnClick(){ * // To be called when the user clicks the menu item. * } * * function MyPluginBlockSettingsMenuItem() { * return React.createElement( * PluginBlockSettingsMenuItem, * { * allowedBlocks: [ 'core/paragraph' ], * icon: 'dashicon-name', * label: __( 'Menu item text' ), * onClick: doOnClick, * } * ); * } * ``` * * @example * ```jsx * // Using ESNext syntax * import { __ } from '@wordpress/i18n'; * import { PluginBlockSettingsMenuItem } from '@wordpress/editor'; * * const doOnClick = ( ) => { * // To be called when the user clicks the menu item. * }; * * const MyPluginBlockSettingsMenuItem = () => ( * <PluginBlockSettingsMenuItem * allowedBlocks={ [ 'core/paragraph' ] } * icon='dashicon-name' * label={ __( 'Menu item text' ) } * onClick={ doOnClick } /> * ); * ``` * * @return {React.ReactNode} The rendered component. */ const PluginBlockSettingsMenuItem = ({ allowedBlocks, icon, label, onClick, small, role }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedBlocks, onClose }) => { if (!shouldRenderItem(selectedBlocks, allowedBlocks)) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose), icon: icon, label: small ? label : undefined, role: role, children: !small && label }); } }); /* harmony default export */ const plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem); ;// ./node_modules/@wordpress/editor/build-module/components/plugin-more-menu-item/index.js /** * WordPress dependencies */ /** * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided. * The text within the component appears as the menu item label. * * @param {Object} props Component properties. * @param {React.ReactNode} [props.children] Children to be rendered. * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item. * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component. * * @example * ```js * // Using ES5 syntax * var __ = wp.i18n.__; * var PluginMoreMenuItem = wp.editor.PluginMoreMenuItem; * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. * * function onButtonClick() { * alert( 'Button clicked.' ); * } * * function MyButtonMoreMenuItem() { * return wp.element.createElement( * PluginMoreMenuItem, * { * icon: moreIcon, * onClick: onButtonClick, * }, * __( 'My button title' ) * ); * } * ``` * * @example * ```jsx * // Using ESNext syntax * import { __ } from '@wordpress/i18n'; * import { PluginMoreMenuItem } from '@wordpress/editor'; * import { more } from '@wordpress/icons'; * * function onButtonClick() { * alert( 'Button clicked.' ); * } * * const MyButtonMoreMenuItem = () => ( * <PluginMoreMenuItem * icon={ more } * onClick={ onButtonClick } * > * { __( 'My button title' ) } * </PluginMoreMenuItem> * ); * ``` * * @return {React.ReactNode} The rendered component. */ function PluginMoreMenuItem(props) { var _props$as; const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, { name: "core/plugin-more-menu", as: (_props$as = props.as) !== null && _props$as !== void 0 ? _props$as : external_wp_components_namespaceObject.MenuItem, icon: props.icon || context.icon, ...props }); } ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-publish-panel/index.js /** * WordPress dependencies */ const { Fill: plugin_post_publish_panel_Fill, Slot: plugin_post_publish_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel'); /** * Renders provided content to the post-publish panel in the publish flow * (side panel that opens after a user publishes the post). * * @param {Object} props Component properties. * @param {string} [props.className] An optional class name added to the panel. * @param {string} [props.title] Title displayed at the top of the panel. * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. * @param {React.ReactNode} props.children Children to be rendered * * @example * ```jsx * // Using ESNext syntax * import { __ } from '@wordpress/i18n'; * import { PluginPostPublishPanel } from '@wordpress/editor'; * * const MyPluginPostPublishPanel = () => ( * <PluginPostPublishPanel * className="my-plugin-post-publish-panel" * title={ __( 'My panel title' ) } * initialOpen={ true } * > * { __( 'My panel content' ) } * </PluginPostPublishPanel> * ); * ``` * * @return {React.ReactNode} The rendered component. */ const PluginPostPublishPanel = ({ children, className, title, initialOpen = false, icon }) => { const { icon: pluginIcon } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_publish_panel_Fill, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { className: className, initialOpen: initialOpen || !title, title: title, icon: icon !== null && icon !== void 0 ? icon : pluginIcon, children: children }) }); }; PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot; /* harmony default export */ const plugin_post_publish_panel = (PluginPostPublishPanel); ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-status-info/index.js /** * Defines as extensibility slot for the Summary panel. */ /** * WordPress dependencies */ const { Fill: plugin_post_status_info_Fill, Slot: plugin_post_status_info_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo'); /** * Renders a row in the Summary panel of the Document sidebar. * It should be noted that this is named and implemented around the function it serves * and not its location, which may change in future iterations. * * @param {Object} props Component properties. * @param {string} [props.className] An optional class name added to the row. * @param {React.ReactNode} props.children Children to be rendered. * * @example * ```js * // Using ES5 syntax * var __ = wp.i18n.__; * var PluginPostStatusInfo = wp.editor.PluginPostStatusInfo; * * function MyPluginPostStatusInfo() { * return React.createElement( * PluginPostStatusInfo, * { * className: 'my-plugin-post-status-info', * }, * __( 'My post status info' ) * ) * } * ``` * * @example * ```jsx * // Using ESNext syntax * import { __ } from '@wordpress/i18n'; * import { PluginPostStatusInfo } from '@wordpress/editor'; * * const MyPluginPostStatusInfo = () => ( * <PluginPostStatusInfo * className="my-plugin-post-status-info" * > * { __( 'My post status info' ) } * </PluginPostStatusInfo> * ); * ``` * * @return {React.ReactNode} The rendered component. */ const PluginPostStatusInfo = ({ children, className }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info_Fill, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { className: className, children: children }) }); PluginPostStatusInfo.Slot = plugin_post_status_info_Slot; /* harmony default export */ const plugin_post_status_info = (PluginPostStatusInfo); ;// ./node_modules/@wordpress/editor/build-module/components/plugin-pre-publish-panel/index.js /** * WordPress dependencies */ const { Fill: plugin_pre_publish_panel_Fill, Slot: plugin_pre_publish_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel'); /** * Renders provided content to the pre-publish side panel in the publish flow * (side panel that opens when a user first pushes "Publish" from the main editor). * * @param {Object} props Component props. * @param {string} [props.className] An optional class name added to the panel. * @param {string} [props.title] Title displayed at the top of the panel. * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. * When no title is provided it is always opened. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) * icon slug string, or an SVG WP element, to be rendered when * the sidebar is pinned to toolbar. * @param {React.ReactNode} props.children Children to be rendered * * @example * ```jsx * // Using ESNext syntax * import { __ } from '@wordpress/i18n'; * import { PluginPrePublishPanel } from '@wordpress/editor'; * * const MyPluginPrePublishPanel = () => ( * <PluginPrePublishPanel * className="my-plugin-pre-publish-panel" * title={ __( 'My panel title' ) } * initialOpen={ true } * > * { __( 'My panel content' ) } * </PluginPrePublishPanel> * ); * ``` * * @return {React.ReactNode} The rendered component. */ const PluginPrePublishPanel = ({ children, className, title, initialOpen = false, icon }) => { const { icon: pluginIcon } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_pre_publish_panel_Fill, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { className: className, initialOpen: initialOpen || !title, title: title, icon: icon !== null && icon !== void 0 ? icon : pluginIcon, children: children }) }); }; PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot; /* harmony default export */ const plugin_pre_publish_panel = (PluginPrePublishPanel); ;// ./node_modules/@wordpress/editor/build-module/components/plugin-preview-menu-item/index.js /** * WordPress dependencies */ /** * Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided. * The text within the component appears as the menu item label. * * @param {Object} props Component properties. * @param {React.ReactNode} [props.children] Children to be rendered. * @param {string} [props.href] When `href` is provided, the menu item is rendered as an anchor instead of a button. It corresponds to the `href` attribute of the anchor. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The icon to be rendered to the left of the menu item label. Can be a Dashicon slug or an SVG WP element. * @param {Function} [props.onClick] The callback function to be executed when the user clicks the menu item. * @param {...*} [props.other] Any additional props are passed through to the underlying MenuItem component. * * @example * ```jsx * import { __ } from '@wordpress/i18n'; * import { PluginPreviewMenuItem } from '@wordpress/editor'; * import { external } from '@wordpress/icons'; * * function onPreviewClick() { * // Handle preview action * } * * const ExternalPreviewMenuItem = () => ( * <PluginPreviewMenuItem * icon={ external } * onClick={ onPreviewClick } * > * { __( 'Preview in new tab' ) } * </PluginPreviewMenuItem> * ); * registerPlugin( 'external-preview-menu-item', { * render: ExternalPreviewMenuItem, * } ); * ``` * * @return {React.ReactNode} The rendered menu item component. */ function PluginPreviewMenuItem(props) { var _props$as; const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, { name: "core/plugin-preview-menu", as: (_props$as = props.as) !== null && _props$as !== void 0 ? _props$as : external_wp_components_namespaceObject.MenuItem, icon: props.icon || context.icon, ...props }); } ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar/index.js /** * WordPress dependencies */ /** * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: * * ```js * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' ); * ``` * * @see PluginSidebarMoreMenuItem * * @param {Object} props Element props. * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin. * @param {React.ReactNode} [props.children] Children to be rendered. * @param {string} [props.className] An optional class name added to the sidebar body. * @param {string} props.title Title displayed at the top of the sidebar. * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. * * @example * ```js * // Using ES5 syntax * var __ = wp.i18n.__; * var el = React.createElement; * var PanelBody = wp.components.PanelBody; * var PluginSidebar = wp.editor.PluginSidebar; * var moreIcon = React.createElement( 'svg' ); //... svg element. * * function MyPluginSidebar() { * return el( * PluginSidebar, * { * name: 'my-sidebar', * title: 'My sidebar title', * icon: moreIcon, * }, * el( * PanelBody, * {}, * __( 'My sidebar content' ) * ) * ); * } * ``` * * @example * ```jsx * // Using ESNext syntax * import { __ } from '@wordpress/i18n'; * import { PanelBody } from '@wordpress/components'; * import { PluginSidebar } from '@wordpress/editor'; * import { more } from '@wordpress/icons'; * * const MyPluginSidebar = () => ( * <PluginSidebar * name="my-sidebar" * title="My sidebar title" * icon={ more } * > * <PanelBody> * { __( 'My sidebar content' ) } * </PanelBody> * </PluginSidebar> * ); * ``` */ function PluginSidebar({ className, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area, { panelClassName: className, className: "editor-sidebar", scope: "core", ...props }); } ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar-more-menu-item/index.js /** * WordPress dependencies */ /** * Renders a menu item in `Plugins` group in `More Menu` drop down, * and can be used to activate the corresponding `PluginSidebar` component. * The text within the component appears as the menu item label. * * @param {Object} props Component props. * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar. * @param {React.ReactNode} [props.children] Children to be rendered. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. * * @example * ```js * // Using ES5 syntax * var __ = wp.i18n.__; * var PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem; * var moreIcon = React.createElement( 'svg' ); //... svg element. * * function MySidebarMoreMenuItem() { * return React.createElement( * PluginSidebarMoreMenuItem, * { * target: 'my-sidebar', * icon: moreIcon, * }, * __( 'My sidebar title' ) * ) * } * ``` * * @example * ```jsx * // Using ESNext syntax * import { __ } from '@wordpress/i18n'; * import { PluginSidebarMoreMenuItem } from '@wordpress/editor'; * import { more } from '@wordpress/icons'; * * const MySidebarMoreMenuItem = () => ( * <PluginSidebarMoreMenuItem * target="my-sidebar" * icon={ more } * > * { __( 'My sidebar title' ) } * </PluginSidebarMoreMenuItem> * ); * ``` * * @return {React.ReactNode} The rendered component. */ function PluginSidebarMoreMenuItem(props) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility. // @see https://github.com/WordPress/gutenberg/issues/14457 , { __unstableExplicitMenuItem: true, scope: "core", ...props }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/swap-template-button.js /** * WordPress dependencies */ /** * Internal dependencies */ function SwapTemplateButton({ onClick }) { const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); const { postType, postId } = useEditedPostContext(); const availableTemplates = useAvailableTemplates(postType); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); if (!availableTemplates?.length) { return null; } const onTemplateSelect = async template => { editEntityRecord('postType', postType, postId, { template: template.name }, { undoIgnore: true }); setShowModal(false); // Close the template suggestions modal first. onClick(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => setShowModal(true), children: (0,external_wp_i18n_namespaceObject.__)('Change template') }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Choose a template'), onRequestClose: () => setShowModal(false), overlayClassName: "editor-post-template__swap-template-modal", isFullScreen: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-template__swap-template-modal-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatesList, { postType: postType, onSelect: onTemplateSelect }) }) })] }); } function TemplatesList({ postType, onSelect }) { const availableTemplates = useAvailableTemplates(postType); const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => availableTemplates.map(template => ({ name: template.slug, blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw), title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered), id: template.id })), [availableTemplates]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { label: (0,external_wp_i18n_namespaceObject.__)('Templates'), blockPatterns: templatesAsPatterns, onClickPattern: onSelect }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/reset-default-template.js /** * WordPress dependencies */ /** * Internal dependencies */ function ResetDefaultTemplate({ onClick }) { const currentTemplateSlug = useCurrentTemplateSlug(); const allowSwitchingTemplate = useAllowSwitchingTemplates(); const { postType, postId } = useEditedPostContext(); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); // The default template in a post is indicated by an empty string. if (!currentTemplateSlug || !allowSwitchingTemplate) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { editEntityRecord('postType', postType, postId, { template: '' }, { undoIgnore: true }); onClick(); }, children: (0,external_wp_i18n_namespaceObject.__)('Use default template') }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template.js /** * WordPress dependencies */ /** * Internal dependencies */ function CreateNewTemplate({ onClick }) { const { canCreateTemplates } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canUser } = select(external_wp_coreData_namespaceObject.store); return { canCreateTemplates: canUser('create', { kind: 'postType', name: 'wp_template' }) }; }, []); const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); const allowSwitchingTemplate = useAllowSwitchingTemplates(); // The default template in a post is indicated by an empty string. if (!canCreateTemplates || !allowSwitchingTemplate) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { setIsCreateModalOpen(true); }, children: (0,external_wp_i18n_namespaceObject.__)('Create new template') }), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, { onClose: () => { setIsCreateModalOpen(false); onClick(); } })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/block-theme.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Internal dependencies */ function BlockThemeControl({ id }) { const { isTemplateHidden, onNavigateToEntityRecord, getEditorSettings, hasGoBack } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getRenderingMode, getEditorSettings: _getEditorSettings } = unlock(select(store_store)); const editorSettings = _getEditorSettings(); return { isTemplateHidden: getRenderingMode() === 'post-only', onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, getEditorSettings: _getEditorSettings, hasGoBack: editorSettings.hasOwnProperty('onNavigateToPreviousEntityRecord') }; }, []); const { get: getPreference } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); const { editedRecord: template, hasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', 'wp_template', id); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { setRenderingMode, setDefaultRenderingMode } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); const canCreateTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: 'wp_template' }), []); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, className: 'editor-post-template__dropdown', placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); if (!hasResolved) { return null; } // The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing // and assigns its own backlink to focusMode pages. const notificationAction = hasGoBack ? [{ label: (0,external_wp_i18n_namespaceObject.__)('Go back'), onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() }] : undefined; const mayShowTemplateEditNotice = () => { if (!getPreference('core/edit-site', 'welcomeGuideTemplate')) { createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), { type: 'snackbar', actions: notificationAction }); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Template'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { popoverProps: popoverProps, focusOnMount: true, toggleProps: { size: 'compact', variant: 'tertiary', tooltipPosition: 'middle left' }, label: (0,external_wp_i18n_namespaceObject.__)('Template options'), text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title), icon: null, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { onNavigateToEntityRecord({ postId: template.id, postType: 'wp_template' }); onClose(); mayShowTemplateEditNotice(); }, children: (0,external_wp_i18n_namespaceObject.__)('Edit template') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SwapTemplateButton, { onClick: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetDefaultTemplate, { onClick: onClose }), canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplate, { onClick: onClose })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: !isTemplateHidden ? library_check : undefined, isSelected: !isTemplateHidden, role: "menuitemcheckbox", onClick: () => { const newRenderingMode = isTemplateHidden ? 'template-locked' : 'post-only'; setRenderingMode(newRenderingMode); setDefaultRenderingMode(newRenderingMode); }, children: (0,external_wp_i18n_namespaceObject.__)('Show template') }) })] }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Displays the template controls based on the current editor settings and user permissions. * * @return {React.ReactNode} The rendered PostTemplatePanel component. */ function PostTemplatePanel() { const { templateId, isBlockTheme } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentTemplateId, getEditorSettings } = select(store_store); return { templateId: getCurrentTemplateId(), isBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme }; }, []); const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$canUser; const postTypeSlug = select(store_store).getCurrentPostType(); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); if (!postType?.viewable) { return false; } const settings = select(store_store).getEditorSettings(); const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0; if (hasTemplates) { return true; } if (!settings.supportsTemplateMode) { return false; } const canCreateTemplates = (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: 'wp_template' })) !== null && _select$canUser !== void 0 ? _select$canUser : false; return canCreateTemplates; }, []); const canViewTemplates = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$canUser2; return (_select$canUser2 = select(external_wp_coreData_namespaceObject.store).canUser('read', { kind: 'postType', name: 'wp_template' })) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false; }, []); if ((!isBlockTheme || !canViewTemplates) && isVisible) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(classic_theme, {}); } if (isBlockTheme && !!templateId) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockThemeControl, { id: templateId }); } return null; } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js const BASE_QUERY = { _fields: 'id,name', context: 'view' // Allows non-admins to perform requests. }; const AUTHORS_QUERY = { who: 'authors', per_page: 100, ...BASE_QUERY }; ;// ./node_modules/@wordpress/editor/build-module/components/post-author/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useAuthorsQuery(search) { const { authorId, authors, postAuthor, isLoading } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getUser, getUsers, isResolving } = select(external_wp_coreData_namespaceObject.store); const { getEditedPostAttribute } = select(store_store); const _authorId = getEditedPostAttribute('author'); const query = { ...AUTHORS_QUERY }; if (search) { query.search = search; query.search_columns = ['name']; } return { authorId: _authorId, authors: getUsers(query), postAuthor: getUser(_authorId, BASE_QUERY), isLoading: isResolving('getUsers', [query]) }; }, [search]); const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => { return { value: author.id, label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name) }; }); // Ensure the current author is included in the dropdown list. const foundAuthor = fetchedAuthors.findIndex(({ value }) => postAuthor?.id === value); let currentAuthor = []; if (foundAuthor < 0 && postAuthor) { currentAuthor = [{ value: postAuthor.id, label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name) }]; } else if (foundAuthor < 0 && !postAuthor) { currentAuthor = [{ value: 0, label: (0,external_wp_i18n_namespaceObject.__)('(No author)') }]; } return [...currentAuthor, ...fetchedAuthors]; }, [authors, postAuthor]); return { authorId, authorOptions, postAuthor, isLoading }; } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostAuthorCombobox() { const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { authorId, authorOptions, isLoading } = useAuthorsQuery(fieldValue); /** * Handle author selection. * * @param {number} postAuthorId The selected Author. */ const handleSelect = postAuthorId => { if (!postAuthorId) { return; } editPost({ author: postAuthorId }); }; /** * Handle user input. * * @param {string} inputValue The current value of the input field. */ const handleKeydown = inputValue => { setFieldValue(inputValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Author'), options: authorOptions, value: authorId, onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300), onChange: handleSelect, allowReset: false, hideLabelFromVision: true, isLoading: isLoading }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/select.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostAuthorSelect() { const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { authorId, authorOptions } = useAuthorsQuery(); const setAuthorId = value => { const author = Number(value); editPost({ author }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, className: "post-author-selector", label: (0,external_wp_i18n_namespaceObject.__)('Author'), options: authorOptions, onChange: setAuthorId, value: authorId, hideLabelFromVision: true }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const minimumUsersForCombobox = 25; /** * Renders the component for selecting the post author. * * @return {React.ReactNode} The rendered component. */ function PostAuthor() { const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => { const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); return authors?.length >= minimumUsersForCombobox; }, []); if (showCombobox) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCombobox, {}); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorSelect, {}); } /* harmony default export */ const post_author = (PostAuthor); ;// ./node_modules/@wordpress/editor/build-module/components/post-author/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Wrapper component that renders its children only if the post type supports the author. * * @param {Object} props The component props. * @param {React.ReactNode} props.children Children to be rendered. * * @return {React.ReactNode} The component to be rendered. Return `null` if the post type doesn't * supports the author or if there are no authors available. */ function PostAuthorCheck({ children }) { const { hasAssignAuthorAction, hasAuthors } = (0,external_wp_data_namespaceObject.useSelect)(select => { const post = select(store_store).getCurrentPost(); const canAssignAuthor = post?._links?.['wp:action-assign-author'] ? true : false; return { hasAssignAuthorAction: canAssignAuthor, hasAuthors: canAssignAuthor ? select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY)?.length >= 1 : false }; }, []); if (!hasAssignAuthorAction || !hasAuthors) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: "author", children: children }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostAuthorToggle({ isOpen, onClick }) { const { postAuthor } = useAuthorsQuery(); const authorName = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor?.name) || (0,external_wp_i18n_namespaceObject.__)('(No author)'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-author__panel-toggle", variant: "tertiary", "aria-expanded": isOpen, "aria-label": // translators: %s: Author name. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change author: %s'), authorName), onClick: onClick, children: authorName }); } /** * Renders the Post Author Panel component. * * @return {React.ReactNode} The rendered component. */ function panel_PostAuthor() { // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCheck, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Author'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, contentClassName: "editor-post-author__panel-dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorToggle, { isOpen: isOpen, onClick: onToggle }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-author", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Author'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_author, { onClose: onClose })] }) }) }) }); } /* harmony default export */ const panel = (panel_PostAuthor); ;// ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const COMMENT_OPTIONS = [{ label: (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'), value: 'open', description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') }, { label: (0,external_wp_i18n_namespaceObject.__)('Closed'), value: 'closed', description: [(0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies.'), (0,external_wp_i18n_namespaceObject.__)('Existing comments remain visible.')].join(' ') }]; function PostComments() { const commentStatus = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getEditedPost; return (_select$getEditedPost = select(store_store).getEditedPostAttribute('comment_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open'; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const handleStatus = newCommentStatus => editPost({ comment_status: newCommentStatus }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { className: "editor-change-status__options", hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)('Comment status'), options: COMMENT_OPTIONS, onChange: handleStatus, selected: commentStatus }) }) }); } /** * A form for managing comment status. * * @return {React.ReactNode} The rendered PostComments component. */ /* harmony default export */ const post_comments = (PostComments); ;// ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostPingbacks() { const pingStatus = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getEditedPost; return (_select$getEditedPost = select(store_store).getEditedPostAttribute('ping_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open'; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const onTogglePingback = () => editPost({ ping_status: pingStatus === 'open' ? 'closed' : 'open' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Enable pingbacks & trackbacks'), checked: pingStatus === 'open', onChange: onTogglePingback, help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'), children: (0,external_wp_i18n_namespaceObject.__)('Learn more about pingbacks & trackbacks') }) }); } /** * Renders a control for enabling or disabling pingbacks and trackbacks * in a WordPress post. * * @module PostPingbacks */ /* harmony default export */ const post_pingbacks = (PostPingbacks); ;// ./node_modules/@wordpress/editor/build-module/components/post-discussion/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const panel_PANEL_NAME = 'discussion-panel'; function ModalContents({ onClose }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-discussion", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Discussion'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: "comments", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_comments, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: "trackbacks", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pingbacks, {}) })] })] }); } function PostDiscussionToggle({ isOpen, onClick }) { const { commentStatus, pingStatus, commentsSupported, trackbacksSupported } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getEditedPostAttribu, _getEditedPostAttribu2; const { getEditedPostAttribute } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); const postType = getPostType(getEditedPostAttribute('type')); return { commentStatus: (_getEditedPostAttribu = getEditedPostAttribute('comment_status')) !== null && _getEditedPostAttribu !== void 0 ? _getEditedPostAttribu : 'open', pingStatus: (_getEditedPostAttribu2 = getEditedPostAttribute('ping_status')) !== null && _getEditedPostAttribu2 !== void 0 ? _getEditedPostAttribu2 : 'open', commentsSupported: !!postType.supports.comments, trackbacksSupported: !!postType.supports.trackbacks }; }, []); let label; if (commentStatus === 'open') { if (pingStatus === 'open') { label = (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'); } else { label = trackbacksSupported ? (0,external_wp_i18n_namespaceObject.__)('Comments only') : (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'); } } else if (pingStatus === 'open') { label = commentsSupported ? (0,external_wp_i18n_namespaceObject.__)('Pings only') : (0,external_wp_i18n_namespaceObject.__)('Pings enabled'); } else { label = (0,external_wp_i18n_namespaceObject.__)('Closed'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-discussion__panel-toggle", variant: "tertiary", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change discussion options'), "aria-expanded": isOpen, onClick: onClick, children: label }); } /** * This component allows to update comment and pingback * settings for the current post. Internally there are * checks whether the current post has support for the * above and if the `discussion-panel` panel is enabled. * * @return {React.ReactNode} The rendered PostDiscussionPanel component. */ function PostDiscussionPanel() { const { isEnabled } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isEditorPanelEnabled } = select(store_store); return { isEnabled: isEditorPanelEnabled(panel_PANEL_NAME) }; }, []); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); if (!isEnabled) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: ['comments', 'trackbacks'], children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, className: "editor-post-discussion__panel-dropdown", contentClassName: "editor-post-discussion__panel-dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionToggle, { isOpen: isOpen, onClick: onToggle }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModalContents, { onClose: onClose }) }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders an editable textarea for the post excerpt. * Templates, template parts and patterns use the `excerpt` field as a description semantically. * Additionally templates and template parts override the `excerpt` field as `description` in * REST API. So this component handles proper labeling and updating the edited entity. * * @param {Object} props - Component props. * @param {boolean} [props.hideLabelFromVision=false] - Whether to visually hide the textarea's label. * @param {boolean} [props.updateOnBlur=false] - Whether to update the post on change or use local state and update on blur. */ function PostExcerpt({ hideLabelFromVision = false, updateOnBlur = false }) { const { excerpt, shouldUseDescriptionLabel, usedAttribute } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getEditedPostAttribute } = select(store_store); const postType = getCurrentPostType(); // This special case is unfortunate, but the REST API of wp_template and wp_template_part // support the excerpt field through the "description" field rather than "excerpt". const _usedAttribute = ['wp_template', 'wp_template_part'].includes(postType) ? 'description' : 'excerpt'; return { excerpt: getEditedPostAttribute(_usedAttribute), // There are special cases where we want to label the excerpt as a description. shouldUseDescriptionLabel: ['wp_template', 'wp_template_part', 'wp_block'].includes(postType), usedAttribute: _usedAttribute }; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [localExcerpt, setLocalExcerpt] = (0,external_wp_element_namespaceObject.useState)((0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt)); const updatePost = value => { editPost({ [usedAttribute]: value }); }; const label = shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Write a description (optional)') : (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-excerpt", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { __nextHasNoMarginBottom: true, label: label, hideLabelFromVision: hideLabelFromVision, className: "editor-post-excerpt__textarea", onChange: updateOnBlur ? setLocalExcerpt : updatePost, onBlur: updateOnBlur ? () => updatePost(localExcerpt) : undefined, value: updateOnBlur ? localExcerpt : excerpt, help: !shouldUseDescriptionLabel ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'), children: (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts') }) : (0,external_wp_i18n_namespaceObject.__)('Write a description') }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js /** * Internal dependencies */ /** * Component for checking if the post type supports the excerpt field. * * @param {Object} props Props. * @param {React.ReactNode} props.children Children to be rendered. * * @return {React.ReactNode} The rendered component. */ function PostExcerptCheck({ children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: "excerpt", children: children }); } /* harmony default export */ const post_excerpt_check = (PostExcerptCheck); ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/plugin.js /** * Defines as extensibility slot for the Excerpt panel. */ /** * WordPress dependencies */ const { Fill: plugin_Fill, Slot: plugin_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostExcerpt'); /** * Renders a post excerpt panel in the post sidebar. * * @param {Object} props Component properties. * @param {string} [props.className] An optional class name added to the row. * @param {React.ReactNode} props.children Children to be rendered. * * @example * ```js * // Using ES5 syntax * var __ = wp.i18n.__; * var PluginPostExcerpt = wp.editPost.__experimentalPluginPostExcerpt; * * function MyPluginPostExcerpt() { * return React.createElement( * PluginPostExcerpt, * { * className: 'my-plugin-post-excerpt', * }, * __( 'Post excerpt custom content' ) * ) * } * ``` * * @example * ```jsx * // Using ESNext syntax * import { __ } from '@wordpress/i18n'; * import { __experimentalPluginPostExcerpt as PluginPostExcerpt } from '@wordpress/edit-post'; * * const MyPluginPostExcerpt = () => ( * <PluginPostExcerpt className="my-plugin-post-excerpt"> * { __( 'Post excerpt custom content' ) } * </PluginPostExcerpt> * ); * ``` * * @return {React.ReactNode} The rendered component. */ const PluginPostExcerpt = ({ children, className }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_Fill, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { className: className, children: children }) }); }; PluginPostExcerpt.Slot = plugin_Slot; /* harmony default export */ const post_excerpt_plugin = (PluginPostExcerpt); ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module Constants */ const post_excerpt_panel_PANEL_NAME = 'post-excerpt'; function ExcerptPanel() { const { isOpened, isEnabled, postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isEditorPanelOpened, isEditorPanelEnabled, getCurrentPostType } = select(store_store); return { isOpened: isEditorPanelOpened(post_excerpt_panel_PANEL_NAME), isEnabled: isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME), postType: getCurrentPostType() }; }, []); const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const toggleExcerptPanel = () => toggleEditorPanelOpened(post_excerpt_panel_PANEL_NAME); if (!isEnabled) { return null; } // There are special cases where we want to label the excerpt as a description. const shouldUseDescriptionLabel = ['wp_template', 'wp_template_part', 'wp_block'].includes(postType); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt'), opened: isOpened, onToggle: toggleExcerptPanel, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, { children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {}), fills] }) }) }); } /** * Is rendered if the post type supports excerpts and allows editing the excerpt. * * @return {React.ReactNode} The rendered PostExcerptPanel component. */ function PostExcerptPanel() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExcerptPanel, {}) }); } function PrivatePostExcerptPanel() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateExcerpt, {}) }); } function PrivateExcerpt() { const { shouldRender, excerpt, shouldBeUsedAsDescription, allowEditing } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getCurrentPostId, getEditedPostAttribute, isEditorPanelEnabled } = select(store_store); const postType = getCurrentPostType(); const isTemplateOrTemplatePart = ['wp_template', 'wp_template_part'].includes(postType); const isPattern = postType === 'wp_block'; // These post types use the `excerpt` field as a description semantically, so we need to // handle proper labeling and some flows where we should always render them as text. const _shouldBeUsedAsDescription = isTemplateOrTemplatePart || isPattern; const _usedAttribute = isTemplateOrTemplatePart ? 'description' : 'excerpt'; // We need to fetch the entity in this case to check if we'll allow editing. const template = isTemplateOrTemplatePart && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, getCurrentPostId()); // For post types that use excerpt as description, we do not abide // by the `isEnabled` panel flag in order to render them as text. const _shouldRender = isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME) || _shouldBeUsedAsDescription; return { excerpt: getEditedPostAttribute(_usedAttribute), shouldRender: _shouldRender, shouldBeUsedAsDescription: _shouldBeUsedAsDescription, // If we should render, allow editing for all post types that are not used as description. // For the rest allow editing only for user generated entities. allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template && template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file && template.is_custom) }; }, []); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const label = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt'); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, 'aria-label': label, headerTitle: label, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor, label]); if (!shouldRender) { return false; } const excerptText = !!excerpt && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { align: "left", numberOfLines: 4, truncate: allowEditing, children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt) }); if (!allowEditing) { return excerptText; } const excerptPlaceholder = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Add a description…') : (0,external_wp_i18n_namespaceObject.__)('Add an excerpt…'); const triggerEditLabel = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Edit description') : (0,external_wp_i18n_namespaceObject.__)('Edit excerpt'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [excerptText, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { className: "editor-post-excerpt__dropdown", contentClassName: "editor-post-excerpt__dropdown__content", popoverProps: popoverProps, focusOnMount: true, ref: setPopoverAnchor, renderToggle: ({ onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: onToggle, variant: "link", children: excerptText ? triggerEditLabel : excerptPlaceholder }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: label, onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, { children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, { hideLabelFromVision: true, updateOnBlur: true }), fills] }) }) })] }) })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Checks if the current theme supports specific features and renders the children if supported. * * @param {Object} props The component props. * @param {React.ReactNode} props.children The children to render if the theme supports the specified features. * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check. * * @return {React.ReactNode} The rendered children if the theme supports the specified features, otherwise null. */ function ThemeSupportCheck({ children, supportKeys }) { const { postType, themeSupports } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { postType: select(store_store).getEditedPostAttribute('type'), themeSupports: select(external_wp_coreData_namespaceObject.store).getThemeSupports() }; }, []); const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => { var _themeSupports$key; const supported = (_themeSupports$key = themeSupports?.[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false; // 'post-thumbnails' can be boolean or an array of post types. // In the latter case, we need to verify `postType` exists // within `supported`. If `postType` isn't passed, then the check // should fail. if ('post-thumbnails' === key && Array.isArray(supported)) { return supported.includes(postType); } return supported; }); if (!isSupported) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js /** * Internal dependencies */ /** * Wrapper component that renders its children only if the post type supports a featured image * and the theme supports post thumbnails. * * @param {Object} props Props. * @param {React.ReactNode} props.children Children to be rendered. * * @return {React.ReactNode} The rendered component. */ function PostFeaturedImageCheck({ children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ThemeSupportCheck, { supportKeys: "post-thumbnails", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: "thumbnail", children: children }) }); } /* harmony default export */ const post_featured_image_check = (PostFeaturedImageCheck); ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present. const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image'); const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Add a featured image'); const instructions = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.') }); function getMediaDetails(media, postId) { var _media$media_details$, _media$media_details$2; if (!media) { return {}; } const defaultSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'large', media.id, postId); if (defaultSize in ((_media$media_details$ = media?.media_details?.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) { return { mediaWidth: media.media_details.sizes[defaultSize].width, mediaHeight: media.media_details.sizes[defaultSize].height, mediaSourceUrl: media.media_details.sizes[defaultSize].source_url }; } // Use fallbackSize when defaultSize is not available. const fallbackSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId); if (fallbackSize in ((_media$media_details$2 = media?.media_details?.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) { return { mediaWidth: media.media_details.sizes[fallbackSize].width, mediaHeight: media.media_details.sizes[fallbackSize].height, mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url }; } // Use full image size when fallbackSize and defaultSize are not available. return { mediaWidth: media.media_details.width, mediaHeight: media.media_details.height, mediaSourceUrl: media.source_url }; } function PostFeaturedImage({ currentPostId, featuredImageId, onUpdateImage, onRemoveImage, media, postType, noticeUI, noticeOperations, isRequestingFeaturedImageMedia }) { const returnsFocusRef = (0,external_wp_element_namespaceObject.useRef)(false); const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { mediaSourceUrl } = getMediaDetails(media, currentPostId); function onDropFiles(filesList) { getSettings().mediaUpload({ allowedTypes: ALLOWED_MEDIA_TYPES, filesList, onFileChange([image]) { if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) { setIsLoading(true); return; } if (image) { onUpdateImage(image); } setIsLoading(false); }, onError(message) { noticeOperations.removeAllNotices(); noticeOperations.createErrorNotice(message); }, multiple: false }); } /** * Generates the featured image alt text for this editing context. * * @param {Object} imageMedia The image media object. * @param {string} imageMedia.alt_text The alternative text of the image. * @param {Object} imageMedia.media_details The media details of the image. * @param {Object} imageMedia.media_details.sizes The sizes of the image. * @param {Object} imageMedia.media_details.sizes.full The full size details of the image. * @param {string} imageMedia.media_details.sizes.full.file The file name of the full size image. * @param {string} imageMedia.slug The slug of the image. * @return {string} The featured image alt text. */ function getImageDescription(imageMedia) { if (imageMedia.alt_text) { return (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image alt text. (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), imageMedia.alt_text); } return (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image filename. (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), imageMedia.media_details.sizes?.full?.file || imageMedia.slug); } function returnFocus(node) { if (returnsFocusRef.current && node) { node.focus(); returnsFocusRef.current = false; } } const isMissingMedia = !isRequestingFeaturedImageMedia && !!featuredImageId && !media; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_featured_image_check, { children: [noticeUI, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-featured-image", children: [media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { id: `editor-post-featured-image-${featuredImageId}-describedby`, className: "hidden", children: getImageDescription(media) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, { fallback: instructions, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUpload, { title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, onSelect: onUpdateImage, unstableFeaturedImageFlow: true, allowedTypes: ALLOWED_MEDIA_TYPES, modalClass: "editor-post-featured-image__media-modal", render: ({ open }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-featured-image__container", children: [isMissingMedia ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)('Could not retrieve the featured image data.') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref: returnFocus, className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', onClick: open, "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or replace the featured image'), "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`, "aria-haspopup": "dialog", disabled: isLoading, accessibleWhenDisabled: true, children: [!!featuredImageId && media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { className: "editor-post-featured-image__preview-image", src: mediaSourceUrl, alt: getImageDescription(media) }), (isLoading || isRequestingFeaturedImageMedia) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)] }), !!featuredImageId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: dist_clsx('editor-post-featured-image__actions', { 'editor-post-featured-image__actions-missing-image': isMissingMedia, 'editor-post-featured-image__actions-is-requesting-image': isRequestingFeaturedImageMedia }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "editor-post-featured-image__action", onClick: open, "aria-haspopup": "dialog", variant: isMissingMedia ? 'secondary' : undefined, children: (0,external_wp_i18n_namespaceObject.__)('Replace') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "editor-post-featured-image__action", onClick: () => { onRemoveImage(); // Signal that the toggle button should be focused, // when it is rendered. Can't focus it directly here // because it's rendered conditionally. returnsFocusRef.current = true; }, variant: isMissingMedia ? 'secondary' : undefined, isDestructive: isMissingMedia, children: (0,external_wp_i18n_namespaceObject.__)('Remove') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: onDropFiles })] }), value: featuredImageId }) })] })] }); } const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => { const { getMedia, getPostType, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); const { getCurrentPostId, getEditedPostAttribute } = select(store_store); const featuredImageId = getEditedPostAttribute('featured_media'); return { media: featuredImageId ? getMedia(featuredImageId, { context: 'view' }) : null, currentPostId: getCurrentPostId(), postType: getPostType(getEditedPostAttribute('type')), featuredImageId, isRequestingFeaturedImageMedia: !!featuredImageId && !hasFinishedResolution('getMedia', [featuredImageId, { context: 'view' }]) }; }); const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { noticeOperations }, { select }) => { const { editPost } = dispatch(store_store); return { onUpdateImage(image) { editPost({ featured_media: image.id }); }, onDropImage(filesList) { select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({ allowedTypes: ['image'], filesList, onFileChange([image]) { editPost({ featured_media: image.id }); }, onError(message) { noticeOperations.removeAllNotices(); noticeOperations.createErrorNotice(message); }, multiple: false }); }, onRemoveImage() { editPost({ featured_media: 0 }); } }; }); /** * Renders the component for managing the featured image of a post. * * @param {Object} props Props. * @param {number} props.currentPostId ID of the current post. * @param {number} props.featuredImageId ID of the featured image. * @param {Function} props.onUpdateImage Function to call when the image is updated. * @param {Function} props.onRemoveImage Function to call when the image is removed. * @param {Object} props.media The media object representing the featured image. * @param {string} props.postType Post type. * @param {Element} props.noticeUI UI for displaying notices. * @param {Object} props.noticeOperations Operations for managing notices. * * @return {Element} Component to be rendered . */ /* harmony default export */ const post_featured_image = ((0,external_wp_compose_namespaceObject.compose)(external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage)); ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const post_featured_image_panel_PANEL_NAME = 'featured-image'; /** * Renders the panel for the post featured image. * * @param {Object} props Props. * @param {boolean} props.withPanelBody Whether to include the panel body. Default true. * * @return {React.ReactNode} The component to be rendered. * Return Null if the editor panel is disabled for featured image. */ function PostFeaturedImagePanel({ withPanelBody = true }) { var _postType$labels$feat; const { postType, isEnabled, isOpened } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute, isEditorPanelEnabled, isEditorPanelOpened } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { postType: getPostType(getEditedPostAttribute('type')), isEnabled: isEditorPanelEnabled(post_featured_image_panel_PANEL_NAME), isOpened: isEditorPanelOpened(post_featured_image_panel_PANEL_NAME) }; }, []); const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); if (!isEnabled) { return null; } if (!withPanelBody) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {}) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (_postType$labels$feat = postType?.labels?.featured_image) !== null && _postType$labels$feat !== void 0 ? _postType$labels$feat : (0,external_wp_i18n_namespaceObject.__)('Featured image'), opened: isOpened, onToggle: () => toggleEditorPanelOpened(post_featured_image_panel_PANEL_NAME), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {}) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-format/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Component check if there are any post formats. * * @param {Object} props The component props. * @param {React.ReactNode} props.children The child elements to render. * * @return {React.ReactNode} The rendered component or null if post formats are disabled. */ function PostFormatCheck({ children }) { const disablePostFormats = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().disablePostFormats, []); if (disablePostFormats) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: "post-formats", children: children }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-format/index.js /** * WordPress dependencies */ /** * Internal dependencies */ // All WP post formats, sorted alphabetically by translated name. const POST_FORMATS = [{ id: 'aside', caption: (0,external_wp_i18n_namespaceObject.__)('Aside') }, { id: 'audio', caption: (0,external_wp_i18n_namespaceObject.__)('Audio') }, { id: 'chat', caption: (0,external_wp_i18n_namespaceObject.__)('Chat') }, { id: 'gallery', caption: (0,external_wp_i18n_namespaceObject.__)('Gallery') }, { id: 'image', caption: (0,external_wp_i18n_namespaceObject.__)('Image') }, { id: 'link', caption: (0,external_wp_i18n_namespaceObject.__)('Link') }, { id: 'quote', caption: (0,external_wp_i18n_namespaceObject.__)('Quote') }, { id: 'standard', caption: (0,external_wp_i18n_namespaceObject.__)('Standard') }, { id: 'status', caption: (0,external_wp_i18n_namespaceObject.__)('Status') }, { id: 'video', caption: (0,external_wp_i18n_namespaceObject.__)('Video') }].sort((a, b) => { const normalizedA = a.caption.toUpperCase(); const normalizedB = b.caption.toUpperCase(); if (normalizedA < normalizedB) { return -1; } if (normalizedA > normalizedB) { return 1; } return 0; }); /** * `PostFormat` a component that allows changing the post format while also providing a suggestion for the current post. * * @example * ```jsx * <PostFormat /> * ``` * * @return {React.ReactNode} The rendered PostFormat component. */ function PostFormat() { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat); const postFormatSelectorId = `post-format-selector-${instanceId}`; const { postFormat, suggestedFormat, supportedFormats } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute, getSuggestedPostFormat } = select(store_store); const _postFormat = getEditedPostAttribute('format'); const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports(); return { postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard', suggestedFormat: getSuggestedPostFormat(), supportedFormats: themeSupports.formats }; }, []); const formats = POST_FORMATS.filter(format => { // Ensure current format is always in the set. // The current format may not be a format supported by the theme. return supportedFormats?.includes(format.id) || postFormat === format.id; }); const suggestion = formats.find(format => format.id === suggestedFormat); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const onUpdatePostFormat = format => editPost({ format }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatCheck, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-format", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { className: "editor-post-format__options", label: (0,external_wp_i18n_namespaceObject.__)('Post Format'), selected: postFormat, onChange: format => onUpdatePostFormat(format), id: postFormatSelectorId, options: formats.map(format => ({ label: format.caption, value: format.id })), hideLabelFromVision: true }), suggestion && suggestion.id !== postFormat && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "editor-post-format__suggestion", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => onUpdatePostFormat(suggestion.id), children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: post format */ (0,external_wp_i18n_namespaceObject.__)('Apply suggested format: %s'), suggestion.caption) }) })] }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Wrapper component that renders its children if the post has more than one revision. * * @param {Object} props Props. * @param {React.ReactNode} props.children Children to be rendered. * * @return {React.ReactNode} Rendered child components if post has more than one revision, otherwise null. */ function PostLastRevisionCheck({ children }) { const { lastRevisionId, revisionsCount } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } = select(store_store); return { lastRevisionId: getCurrentPostLastRevisionId(), revisionsCount: getCurrentPostRevisionsCount() }; }, []); if (!lastRevisionId || revisionsCount < 2) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: "revisions", children: children }); } /* harmony default export */ const post_last_revision_check = (PostLastRevisionCheck); ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function usePostLastRevisionInfo() { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } = select(store_store); return { lastRevisionId: getCurrentPostLastRevisionId(), revisionsCount: getCurrentPostRevisionsCount() }; }, []); } /** * Renders the component for displaying the last revision of a post. * * @return {React.ReactNode} The rendered component. */ function PostLastRevision() { const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { revision: lastRevisionId }), className: "editor-post-last-revision__title", icon: library_backup, iconPosition: "right", text: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: number of revisions. */ (0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount) }) }); } function PrivatePostLastRevision() { const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Revisions'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { revision: lastRevisionId }), className: "editor-private-post-last-revision__button", text: revisionsCount, variant: "tertiary", size: "compact" }) }) }); } /* harmony default export */ const post_last_revision = (PostLastRevision); ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the panel for displaying the last revision of a post. * * @return {React.ReactNode} The rendered component. */ function PostLastRevisionPanel() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { className: "editor-post-last-revision__panel", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision, {}) }) }); } /* harmony default export */ const post_last_revision_panel = (PostLastRevisionPanel); ;// ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A modal component that is displayed when a post is locked for editing by another user. * The modal provides information about the lock status and options to take over or exit the editor. * * @return {React.ReactNode} The rendered PostLockedModal component. */ function PostLockedModal() { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal); const hookName = 'core/editor/post-locked-modal-' + instanceId; const { autosave, updatePostLock } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isLocked, isTakeover, user, postId, postLockUtils, activePostLock, postType, previewLink } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isPostLocked, isPostLockTakeover, getPostLockUser, getCurrentPostId, getActivePostLock, getEditedPostAttribute, getEditedPostPreviewLink, getEditorSettings } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { isLocked: isPostLocked(), isTakeover: isPostLockTakeover(), user: getPostLockUser(), postId: getCurrentPostId(), postLockUtils: getEditorSettings().postLockUtils, activePostLock: getActivePostLock(), postType: getPostType(getEditedPostAttribute('type')), previewLink: getEditedPostPreviewLink() }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { /** * Keep the lock refreshed. * * When the user does not send a heartbeat in a heartbeat-tick * the user is no longer editing and another user can start editing. * * @param {Object} data Data to send in the heartbeat request. */ function sendPostLock(data) { if (isLocked) { return; } data['wp-refresh-post-lock'] = { lock: activePostLock, post_id: postId }; } /** * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing. * * @param {Object} data Data received in the heartbeat request */ function receivePostLock(data) { if (!data['wp-refresh-post-lock']) { return; } const received = data['wp-refresh-post-lock']; if (received.lock_error) { // Auto save and display the takeover modal. autosave(); updatePostLock({ isLocked: true, isTakeover: true, user: { name: received.lock_error.name, avatar: received.lock_error.avatar_src_2x } }); } else if (received.new_lock) { updatePostLock({ isLocked: false, activePostLock: received.new_lock }); } } /** * Unlock the post before the window is exited. */ function releasePostLock() { if (isLocked || !activePostLock) { return; } const data = new window.FormData(); data.append('action', 'wp-remove-post-lock'); data.append('_wpnonce', postLockUtils.unlockNonce); data.append('post_ID', postId); data.append('active_post_lock', activePostLock); if (window.navigator.sendBeacon) { window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); } else { const xhr = new window.XMLHttpRequest(); xhr.open('POST', postLockUtils.ajaxUrl, false); xhr.send(data); } } // Details on these events on the Heartbeat API docs // https://developer.wordpress.org/plugins/javascript/heartbeat-api/ (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.send', hookName, sendPostLock); (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.tick', hookName, receivePostLock); window.addEventListener('beforeunload', releasePostLock); return () => { (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.send', hookName); (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.tick', hookName); window.removeEventListener('beforeunload', releasePostLock); }; }, []); if (!isLocked) { return null; } const userDisplayName = user.name; const userAvatar = user.avatar; const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { 'get-post-lock': '1', lockKey: true, post: postId, action: 'edit', _wpnonce: postLockUtils.nonce }); const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { post_type: postType?.slug }); const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)('Someone else has taken over this post') : (0,external_wp_i18n_namespaceObject.__)('This post is already being edited'), focusOnMount: true, shouldCloseOnClickOutside: false, shouldCloseOnEsc: false, isDismissible: false // Do not remove this class, as this class is used by third party plugins. , className: "editor-post-locked-modal", size: "medium", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "top", spacing: 6, children: [!!userAvatar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: userAvatar, alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'), className: "editor-post-locked-modal__avatar", width: 64, height: 64 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [!!isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: user's display name */ (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), { strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), PreviewLink: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: previewLink, children: (0,external_wp_i18n_namespaceObject.__)('preview') }) }) }), !isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: user's display name */ (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), { strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), PreviewLink: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: previewLink, children: (0,external_wp_i18n_namespaceObject.__)('preview') }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('If you take over, the other user will lose editing control to the post, but their changes will be saved.') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "editor-post-locked-modal__buttons", justify: "flex-end", children: [!isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", href: unlockUrl, children: (0,external_wp_i18n_namespaceObject.__)('Take over') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", href: allPostsUrl, children: allPostsLabel })] })] })] }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * This component checks the publishing status of the current post. * If the post is already published or the user doesn't have the * capability to publish, it returns null. * * @param {Object} props Component properties. * @param {React.ReactNode} props.children Children to be rendered. * * @return {React.ReactNode} The rendered child elements or null if the post is already published or the user doesn't have the capability to publish. */ function PostPendingStatusCheck({ children }) { const { hasPublishAction, isPublished } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getCurrentPost$_link; const { isCurrentPostPublished, getCurrentPost } = select(store_store); return { hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, isPublished: isCurrentPostPublished() }; }, []); if (isPublished || !hasPublishAction) { return null; } return children; } /* harmony default export */ const post_pending_status_check = (PostPendingStatusCheck); ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A component for displaying and toggling the pending status of a post. * * @return {React.ReactNode} The rendered component. */ function PostPendingStatus() { const status = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('status'), []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const togglePendingStatus = () => { const updatedStatus = status === 'pending' ? 'draft' : 'pending'; editPost({ status: updatedStatus }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pending_status_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Pending review'), checked: status === 'pending', onChange: togglePendingStatus }) }); } /* harmony default export */ const post_pending_status = (PostPendingStatus); ;// ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function writeInterstitialMessage(targetDocument) { let markup = (0,external_wp_element_namespaceObject.renderToString)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-preview-button__interstitial-message", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 96 96", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { className: "outer", d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", fill: "none" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { className: "inner", d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z", fill: "none" })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Generating preview…') })] })); markup += ` <style> body { margin: 0; } .editor-post-preview-button__interstitial-message { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; width: 100vw; } @-webkit-keyframes paint { 0% { stroke-dashoffset: 0; } } @-moz-keyframes paint { 0% { stroke-dashoffset: 0; } } @-o-keyframes paint { 0% { stroke-dashoffset: 0; } } @keyframes paint { 0% { stroke-dashoffset: 0; } } .editor-post-preview-button__interstitial-message svg { width: 192px; height: 192px; stroke: #555d66; stroke-width: 0.75; } .editor-post-preview-button__interstitial-message svg .outer, .editor-post-preview-button__interstitial-message svg .inner { stroke-dasharray: 280; stroke-dashoffset: 280; -webkit-animation: paint 1.5s ease infinite alternate; -moz-animation: paint 1.5s ease infinite alternate; -o-animation: paint 1.5s ease infinite alternate; animation: paint 1.5s ease infinite alternate; } p { text-align: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } </style> `; /** * Filters the interstitial message shown when generating previews. * * @param {string} markup The preview interstitial markup. */ markup = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostPreview.interstitialMarkup', markup); targetDocument.write(markup); targetDocument.title = (0,external_wp_i18n_namespaceObject.__)('Generating preview…'); targetDocument.close(); } /** * Renders a button that opens a new window or tab for the preview, * writes the interstitial message to this window, and then navigates * to the actual preview link. The button is not rendered if the post * is not viewable and disabled if the post is not saveable. * * @param {Object} props The component props. * @param {string} props.className The class name for the button. * @param {string} props.textContent The text content for the button. * @param {boolean} props.forceIsAutosaveable Whether to force autosave. * @param {string} props.role The role attribute for the button. * @param {Function} props.onPreview The callback function for preview event. * * @return {React.ReactNode} The rendered button component. */ function PostPreviewButton({ className, textContent, forceIsAutosaveable, role, onPreview }) { const { postId, currentPostLink, previewLink, isSaveable, isViewable } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _postType$viewable; const editor = select(store_store); const core = select(external_wp_coreData_namespaceObject.store); const postType = core.getPostType(editor.getCurrentPostType('type')); const canView = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false; if (!canView) { return { isViewable: canView }; } return { postId: editor.getCurrentPostId(), currentPostLink: editor.getCurrentPostAttribute('link'), previewLink: editor.getEditedPostPreviewLink(), isSaveable: editor.isEditedPostSaveable(), isViewable: canView }; }, []); const { __unstableSaveForPreview } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); if (!isViewable) { return null; } const targetId = `wp-preview-${postId}`; const openPreviewWindow = async event => { // Our Preview button has its 'href' and 'target' set correctly for a11y // purposes. Unfortunately, though, we can't rely on the default 'click' // handler since sometimes it incorrectly opens a new tab instead of reusing // the existing one. // https://github.com/WordPress/gutenberg/pull/8330 event.preventDefault(); // Open up a Preview tab if needed. This is where we'll show the preview. const previewWindow = window.open('', targetId); // Focus the Preview tab. This might not do anything, depending on the browser's // and user's preferences. // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus previewWindow.focus(); writeInterstitialMessage(previewWindow.document); const link = await __unstableSaveForPreview({ forceIsAutosaveable }); previewWindow.location = link; onPreview?.(); }; // Link to the `?preview=true` URL if we have it, since this lets us see // changes that were autosaved since the post was last published. Otherwise, // just link to the post's URL. const href = previewLink || currentPostLink; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: !className ? 'tertiary' : undefined, className: className || 'editor-post-preview', href: href, target: targetId, accessibleWhenDisabled: true, disabled: !isSaveable, onClick: openPreviewWindow, role: role, size: "compact", children: textContent || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [(0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: /* translators: accessibility text */ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') })] }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the label for the publish button. * * @return {string} The label for the publish button. */ function PublishButtonLabel() { const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const { isPublished, isBeingScheduled, isSaving, isPublishing, hasPublishAction, isAutosaving, hasNonPostEntityChanges, postStatusHasChanged, postStatus } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getCurrentPost$_link; const { isCurrentPostPublished, isEditedPostBeingScheduled, isSavingPost, isPublishingPost, getCurrentPost, getCurrentPostType, isAutosavingPost, getPostEdits, getEditedPostAttribute } = select(store_store); return { isPublished: isCurrentPostPublished(), isBeingScheduled: isEditedPostBeingScheduled(), isSaving: isSavingPost(), isPublishing: isPublishingPost(), hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, postType: getCurrentPostType(), isAutosaving: isAutosavingPost(), hasNonPostEntityChanges: select(store_store).hasNonPostEntityChanges(), postStatusHasChanged: !!getPostEdits()?.status, postStatus: getEditedPostAttribute('status') }; }, []); if (isPublishing) { /* translators: button label text should, if possible, be under 16 characters. */ return (0,external_wp_i18n_namespaceObject.__)('Publishing…'); } else if ((isPublished || isBeingScheduled) && isSaving && !isAutosaving) { /* translators: button label text should, if possible, be under 16 characters. */ return (0,external_wp_i18n_namespaceObject.__)('Saving…'); } if (!hasPublishAction) { // TODO: this is because "Submit for review" string is too long in some languages. // @see https://github.com/WordPress/gutenberg/issues/10475 return isSmallerThanMediumViewport ? (0,external_wp_i18n_namespaceObject.__)('Publish') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review'); } if (hasNonPostEntityChanges || isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || !postStatusHasChanged && postStatus === 'future') { return (0,external_wp_i18n_namespaceObject.__)('Save'); } if (isBeingScheduled) { return (0,external_wp_i18n_namespaceObject.__)('Schedule'); } return (0,external_wp_i18n_namespaceObject.__)('Publish'); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const post_publish_button_noop = () => {}; class PostPublishButton extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.createOnClick = this.createOnClick.bind(this); this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this); this.state = { entitiesSavedStatesCallback: false }; } createOnClick(callback) { return (...args) => { const { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } = this.props; // If a post with non-post entities is published, but the user // elects to not save changes to the non-post entities, those // entities will still be dirty when the Publish button is clicked. // We also need to check that the `setEntitiesSavedStatesCallback` // prop was passed. See https://github.com/WordPress/gutenberg/pull/37383 if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) { // The modal for multiple entity saving will open, // hold the callback for saving/publishing the post // so that we can call it if the post entity is checked. this.setState({ entitiesSavedStatesCallback: () => callback(...args) }); // Open the save panel by setting its callback. // To set a function on the useState hook, we must set it // with another function (() => myFunction). Passing the // function on its own will cause an error when called. setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates); return post_publish_button_noop; } return callback(...args); }; } closeEntitiesSavedStates(savedEntities) { const { postType, postId } = this.props; const { entitiesSavedStatesCallback } = this.state; this.setState({ entitiesSavedStatesCallback: false }, () => { if (savedEntities && savedEntities.some(elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) { // The post entity was checked, call the held callback from `createOnClick`. entitiesSavedStatesCallback(); } }); } render() { const { forceIsDirty, hasPublishAction, isBeingScheduled, isOpen, isPostSavingLocked, isPublishable, isPublished, isSaveable, isSaving, isAutoSaving, isToggle, savePostStatus, onSubmit = post_publish_button_noop, onToggle, visibility, hasNonPostEntityChanges, isSavingNonPostEntityChanges, postStatus, postStatusHasChanged } = this.props; const isButtonDisabled = (isSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); const isToggleDisabled = (isPublished || isSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); // If the new status has not changed explicitly, we derive it from // other factors, like having a publish action, etc.. We need to preserve // this because it affects when to show the pre and post publish panels. // If it has changed though explicitly, we need to respect that. let publishStatus = 'publish'; if (postStatusHasChanged) { publishStatus = postStatus; } else if (!hasPublishAction) { publishStatus = 'pending'; } else if (visibility === 'private') { publishStatus = 'private'; } else if (isBeingScheduled) { publishStatus = 'future'; } const onClickButton = () => { if (isButtonDisabled) { return; } onSubmit(); savePostStatus(publishStatus); }; // Callback to open the publish panel. const onClickToggle = () => { if (isToggleDisabled) { return; } onToggle(); }; const buttonProps = { 'aria-disabled': isButtonDisabled, className: 'editor-post-publish-button', isBusy: !isAutoSaving && isSaving, variant: 'primary', onClick: this.createOnClick(onClickButton), 'aria-haspopup': hasNonPostEntityChanges ? 'dialog' : undefined }; const toggleProps = { 'aria-disabled': isToggleDisabled, 'aria-expanded': isOpen, className: 'editor-post-publish-panel__toggle', isBusy: isSaving && isPublished, variant: 'primary', size: 'compact', onClick: this.createOnClick(onClickToggle), 'aria-haspopup': hasNonPostEntityChanges ? 'dialog' : undefined }; const componentProps = isToggle ? toggleProps : buttonProps; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...componentProps, className: `${componentProps.className} editor-post-publish-button__button`, size: "compact", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PublishButtonLabel, {}) }) }); } } /** * Renders the publish button. */ /* harmony default export */ const post_publish_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { var _getCurrentPost$_link; const { isSavingPost, isAutosavingPost, isEditedPostBeingScheduled, getEditedPostVisibility, isCurrentPostPublished, isEditedPostSaveable, isEditedPostPublishable, isPostSavingLocked, getCurrentPost, getCurrentPostType, getCurrentPostId, hasNonPostEntityChanges, isSavingNonPostEntityChanges, getEditedPostAttribute, getPostEdits } = select(store_store); return { isSaving: isSavingPost(), isAutoSaving: isAutosavingPost(), isBeingScheduled: isEditedPostBeingScheduled(), visibility: getEditedPostVisibility(), isSaveable: isEditedPostSaveable(), isPostSavingLocked: isPostSavingLocked(), isPublishable: isEditedPostPublishable(), isPublished: isCurrentPostPublished(), hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, postType: getCurrentPostType(), postId: getCurrentPostId(), postStatus: getEditedPostAttribute('status'), postStatusHasChanged: getPostEdits()?.status, hasNonPostEntityChanges: hasNonPostEntityChanges(), isSavingNonPostEntityChanges: isSavingNonPostEntityChanges() }; }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { const { editPost, savePost } = dispatch(store_store); return { savePostStatus: status => { editPost({ status }, { undoIgnore: true }); savePost(); } }; })])(PostPublishButton)); ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js /** * WordPress dependencies */ const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) }); /* harmony default export */ const library_wordpress = (wordpress); ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js /** * WordPress dependencies */ const visibilityOptions = { public: { label: (0,external_wp_i18n_namespaceObject.__)('Public'), info: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') }, private: { label: (0,external_wp_i18n_namespaceObject.__)('Private'), info: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') }, password: { label: (0,external_wp_i18n_namespaceObject.__)('Password protected'), info: (0,external_wp_i18n_namespaceObject.__)('Only those with the password can view this post.') } }; ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Allows users to set the visibility of a post. * * @param {Object} props The component props. * @param {Function} props.onClose Function to call when the popover is closed. * @return {React.ReactNode} The rendered component. */ function PostVisibility({ onClose }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostVisibility); const { status, visibility, password } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ status: select(store_store).getEditedPostAttribute('status'), visibility: select(store_store).getEditedPostVisibility(), password: select(store_store).getEditedPostAttribute('password') })); const { editPost, savePost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [hasPassword, setHasPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); const [showPrivateConfirmDialog, setShowPrivateConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); const setPublic = () => { editPost({ status: visibility === 'private' ? 'draft' : status, password: '' }); setHasPassword(false); }; const setPrivate = () => { setShowPrivateConfirmDialog(true); }; const confirmPrivate = () => { editPost({ status: 'private', password: '' }); setHasPassword(false); setShowPrivateConfirmDialog(false); savePost(); }; const handleDialogCancel = () => { setShowPrivateConfirmDialog(false); }; const setPasswordProtected = () => { editPost({ status: visibility === 'private' ? 'draft' : status, password: password || '' }); setHasPassword(true); }; const updatePassword = event => { editPost({ password: event.target.value }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-visibility", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Visibility'), help: (0,external_wp_i18n_namespaceObject.__)('Control how this post is viewed.'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "editor-post-visibility__fieldset", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Visibility') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, { instanceId: instanceId, value: "public", label: visibilityOptions.public.label, info: visibilityOptions.public.info, checked: visibility === 'public' && !hasPassword, onChange: setPublic }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, { instanceId: instanceId, value: "private", label: visibilityOptions.private.label, info: visibilityOptions.private.info, checked: visibility === 'private', onChange: setPrivate }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, { instanceId: instanceId, value: "password", label: visibilityOptions.password.label, info: visibilityOptions.password.info, checked: hasPassword, onChange: setPasswordProtected }), hasPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-visibility__password", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "label", htmlFor: `editor-post-visibility__password-input-${instanceId}`, children: (0,external_wp_i18n_namespaceObject.__)('Create password') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { className: "editor-post-visibility__password-input", id: `editor-post-visibility__password-input-${instanceId}`, type: "text", onChange: updatePassword, value: password, placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password') })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showPrivateConfirmDialog, onConfirm: confirmPrivate, onCancel: handleDialogCancel, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Publish'), size: "medium", children: (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?') })] }); } function PostVisibilityChoice({ instanceId, value, label, info, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-visibility__choice", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { type: "radio", name: `editor-post-visibility__setting-${instanceId}`, value: value, id: `editor-post-${value}-${instanceId}`, "aria-describedby": `editor-post-${value}-${instanceId}-description`, className: "editor-post-visibility__radio", ...props }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: `editor-post-${value}-${instanceId}`, className: "editor-post-visibility__label", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { id: `editor-post-${value}-${instanceId}-description`, className: "editor-post-visibility__info", children: info })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns the label for the current post visibility setting. * * @return {string} Post visibility label. */ function PostVisibilityLabel() { return usePostVisibilityLabel(); } /** * Get the label for the current post visibility setting. * * @return {string} Post visibility label. */ function usePostVisibilityLabel() { const visibility = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostVisibility()); return visibilityOptions[visibility]?.label; } ;// ./node_modules/date-fns/toDate.mjs /** * @name toDate * @category Common Helpers * @summary Convert the given argument to an instance of Date. * * @description * Convert the given argument to an instance of Date. * * If the argument is an instance of Date, the function returns its clone. * * If the argument is a number, it is treated as a timestamp. * * If the argument is none of the above, the function returns Invalid Date. * * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param argument - The value to convert * * @returns The parsed date in the local time zone * * @example * // Clone the date: * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) * //=> Tue Feb 11 2014 11:30:30 * * @example * // Convert the timestamp to date: * const result = toDate(1392098430000) * //=> Tue Feb 11 2014 11:30:30 */ function toDate(argument) { const argStr = Object.prototype.toString.call(argument); // Clone the date if ( argument instanceof Date || (typeof argument === "object" && argStr === "[object Date]") ) { // Prevent the date to lose the milliseconds when passed to new Date() in IE10 return new argument.constructor(+argument); } else if ( typeof argument === "number" || argStr === "[object Number]" || typeof argument === "string" || argStr === "[object String]" ) { // TODO: Can we get rid of as? return new Date(argument); } else { // TODO: Can we get rid of as? return new Date(NaN); } } // Fallback for modularized imports: /* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate))); ;// ./node_modules/date-fns/startOfMonth.mjs /** * @name startOfMonth * @category Month Helpers * @summary Return the start of a month for the given date. * * @description * Return the start of a month for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * * @returns The start of a month * * @example * // The start of a month for 2 September 2014 11:55:00: * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0)) * //=> Mon Sep 01 2014 00:00:00 */ function startOfMonth(date) { const _date = toDate(date); _date.setDate(1); _date.setHours(0, 0, 0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth))); ;// ./node_modules/date-fns/endOfMonth.mjs /** * @name endOfMonth * @category Month Helpers * @summary Return the end of a month for the given date. * * @description * Return the end of a month for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * * @returns The end of a month * * @example * // The end of a month for 2 September 2014 11:55:00: * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0)) * //=> Tue Sep 30 2014 23:59:59.999 */ function endOfMonth(date) { const _date = toDate(date); const month = _date.getMonth(); _date.setFullYear(_date.getFullYear(), month + 1, 0); _date.setHours(23, 59, 59, 999); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_endOfMonth = ((/* unused pure expression or super */ null && (endOfMonth))); ;// ./node_modules/date-fns/constants.mjs /** * @module constants * @summary Useful constants * @description * Collection of useful date constants. * * The constants could be imported from `date-fns/constants`: * * ```ts * import { maxTime, minTime } from "./constants/date-fns/constants"; * * function isAllowedTime(time) { * return time <= maxTime && time >= minTime; * } * ``` */ /** * @constant * @name daysInWeek * @summary Days in 1 week. */ const daysInWeek = 7; /** * @constant * @name daysInYear * @summary Days in 1 year. * * @description * How many days in a year. * * One years equals 365.2425 days according to the formula: * * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400. * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days */ const daysInYear = 365.2425; /** * @constant * @name maxTime * @summary Maximum allowed time. * * @example * import { maxTime } from "./constants/date-fns/constants"; * * const isValid = 8640000000000001 <= maxTime; * //=> false * * new Date(8640000000000001); * //=> Invalid Date */ const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000; /** * @constant * @name minTime * @summary Minimum allowed time. * * @example * import { minTime } from "./constants/date-fns/constants"; * * const isValid = -8640000000000001 >= minTime; * //=> false * * new Date(-8640000000000001) * //=> Invalid Date */ const minTime = -maxTime; /** * @constant * @name millisecondsInWeek * @summary Milliseconds in 1 week. */ const millisecondsInWeek = 604800000; /** * @constant * @name millisecondsInDay * @summary Milliseconds in 1 day. */ const millisecondsInDay = 86400000; /** * @constant * @name millisecondsInMinute * @summary Milliseconds in 1 minute */ const millisecondsInMinute = 60000; /** * @constant * @name millisecondsInHour * @summary Milliseconds in 1 hour */ const millisecondsInHour = 3600000; /** * @constant * @name millisecondsInSecond * @summary Milliseconds in 1 second */ const millisecondsInSecond = 1000; /** * @constant * @name minutesInYear * @summary Minutes in 1 year. */ const minutesInYear = 525600; /** * @constant * @name minutesInMonth * @summary Minutes in 1 month. */ const minutesInMonth = 43200; /** * @constant * @name minutesInDay * @summary Minutes in 1 day. */ const minutesInDay = 1440; /** * @constant * @name minutesInHour * @summary Minutes in 1 hour. */ const minutesInHour = 60; /** * @constant * @name monthsInQuarter * @summary Months in 1 quarter. */ const monthsInQuarter = 3; /** * @constant * @name monthsInYear * @summary Months in 1 year. */ const monthsInYear = 12; /** * @constant * @name quartersInYear * @summary Quarters in 1 year */ const quartersInYear = 4; /** * @constant * @name secondsInHour * @summary Seconds in 1 hour. */ const secondsInHour = 3600; /** * @constant * @name secondsInMinute * @summary Seconds in 1 minute. */ const secondsInMinute = 60; /** * @constant * @name secondsInDay * @summary Seconds in 1 day. */ const secondsInDay = secondsInHour * 24; /** * @constant * @name secondsInWeek * @summary Seconds in 1 week. */ const secondsInWeek = secondsInDay * 7; /** * @constant * @name secondsInYear * @summary Seconds in 1 year. */ const secondsInYear = secondsInDay * daysInYear; /** * @constant * @name secondsInMonth * @summary Seconds in 1 month */ const secondsInMonth = secondsInYear / 12; /** * @constant * @name secondsInQuarter * @summary Seconds in 1 quarter. */ const secondsInQuarter = secondsInMonth * 3; ;// ./node_modules/date-fns/parseISO.mjs /** * The {@link parseISO} function options. */ /** * @name parseISO * @category Common Helpers * @summary Parse ISO string * * @description * Parse the given string in ISO 8601 format and return an instance of Date. * * Function accepts complete ISO 8601 formats as well as partial implementations. * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 * * If the argument isn't a string, the function cannot parse the string or * the values are invalid, it returns Invalid Date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param argument - The value to convert * @param options - An object with options * * @returns The parsed date in the local time zone * * @example * // Convert string '2014-02-11T11:30:30' to date: * const result = parseISO('2014-02-11T11:30:30') * //=> Tue Feb 11 2014 11:30:30 * * @example * // Convert string '+02014101' to date, * // if the additional number of digits in the extended year format is 1: * const result = parseISO('+02014101', { additionalDigits: 1 }) * //=> Fri Apr 11 2014 00:00:00 */ function parseISO(argument, options) { const additionalDigits = options?.additionalDigits ?? 2; const dateStrings = splitDateString(argument); let date; if (dateStrings.date) { const parseYearResult = parseYear(dateStrings.date, additionalDigits); date = parseDate(parseYearResult.restDateString, parseYearResult.year); } if (!date || isNaN(date.getTime())) { return new Date(NaN); } const timestamp = date.getTime(); let time = 0; let offset; if (dateStrings.time) { time = parseTime(dateStrings.time); if (isNaN(time)) { return new Date(NaN); } } if (dateStrings.timezone) { offset = parseTimezone(dateStrings.timezone); if (isNaN(offset)) { return new Date(NaN); } } else { const dirtyDate = new Date(timestamp + time); // JS parsed string assuming it's in UTC timezone // but we need it to be parsed in our timezone // so we use utc values to build date in our timezone. // Year values from 0 to 99 map to the years 1900 to 1999 // so set year explicitly with setFullYear. const result = new Date(0); result.setFullYear( dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate(), ); result.setHours( dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds(), ); return result; } return new Date(timestamp + time + offset); } const patterns = { dateTimeDelimiter: /[T ]/, timeZoneDelimiter: /[Z ]/i, timezone: /([Z+-].*)$/, }; const dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; const timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; function splitDateString(dateString) { const dateStrings = {}; const array = dateString.split(patterns.dateTimeDelimiter); let timeString; // The regex match should only return at maximum two array elements. // [date], [time], or [date, time]. if (array.length > 2) { return dateStrings; } if (/:/.test(array[0])) { timeString = array[0]; } else { dateStrings.date = array[0]; timeString = array[1]; if (patterns.timeZoneDelimiter.test(dateStrings.date)) { dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; timeString = dateString.substr( dateStrings.date.length, dateString.length, ); } } if (timeString) { const token = patterns.timezone.exec(timeString); if (token) { dateStrings.time = timeString.replace(token[1], ""); dateStrings.timezone = token[1]; } else { dateStrings.time = timeString; } } return dateStrings; } function parseYear(dateString, additionalDigits) { const regex = new RegExp( "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)", ); const captures = dateString.match(regex); // Invalid ISO-formatted year if (!captures) return { year: NaN, restDateString: "" }; const year = captures[1] ? parseInt(captures[1]) : null; const century = captures[2] ? parseInt(captures[2]) : null; // either year or century is null, not both return { year: century === null ? year : century * 100, restDateString: dateString.slice((captures[1] || captures[2]).length), }; } function parseDate(dateString, year) { // Invalid ISO-formatted year if (year === null) return new Date(NaN); const captures = dateString.match(dateRegex); // Invalid ISO-formatted string if (!captures) return new Date(NaN); const isWeekDate = !!captures[4]; const dayOfYear = parseDateUnit(captures[1]); const month = parseDateUnit(captures[2]) - 1; const day = parseDateUnit(captures[3]); const week = parseDateUnit(captures[4]); const dayOfWeek = parseDateUnit(captures[5]) - 1; if (isWeekDate) { if (!validateWeekDate(year, week, dayOfWeek)) { return new Date(NaN); } return dayOfISOWeekYear(year, week, dayOfWeek); } else { const date = new Date(0); if ( !validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear) ) { return new Date(NaN); } date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); return date; } } function parseDateUnit(value) { return value ? parseInt(value) : 1; } function parseTime(timeString) { const captures = timeString.match(timeRegex); if (!captures) return NaN; // Invalid ISO-formatted time const hours = parseTimeUnit(captures[1]); const minutes = parseTimeUnit(captures[2]); const seconds = parseTimeUnit(captures[3]); if (!validateTime(hours, minutes, seconds)) { return NaN; } return ( hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000 ); } function parseTimeUnit(value) { return (value && parseFloat(value.replace(",", "."))) || 0; } function parseTimezone(timezoneString) { if (timezoneString === "Z") return 0; const captures = timezoneString.match(timezoneRegex); if (!captures) return 0; const sign = captures[1] === "+" ? -1 : 1; const hours = parseInt(captures[2]); const minutes = (captures[3] && parseInt(captures[3])) || 0; if (!validateTimezone(hours, minutes)) { return NaN; } return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute); } function dayOfISOWeekYear(isoWeekYear, week, day) { const date = new Date(0); date.setUTCFullYear(isoWeekYear, 0, 4); const fourthOfJanuaryDay = date.getUTCDay() || 7; const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; date.setUTCDate(date.getUTCDate() + diff); return date; } // Validation functions // February is null to handle the leap year (using ||) const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; function isLeapYearIndex(year) { return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0); } function validateDate(year, month, date) { return ( month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28)) ); } function validateDayOfYearDate(year, dayOfYear) { return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365); } function validateWeekDate(_year, week, day) { return week >= 1 && week <= 53 && day >= 0 && day <= 6; } function validateTime(hours, minutes, seconds) { if (hours === 24) { return minutes === 0 && seconds === 0; } return ( seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25 ); } function validateTimezone(_hours, minutes) { return minutes >= 0 && minutes <= 59; } // Fallback for modularized imports: /* harmony default export */ const date_fns_parseISO = ((/* unused pure expression or super */ null && (parseISO))); ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { PrivatePublishDateTimePicker } = unlock(external_wp_blockEditor_namespaceObject.privateApis); /** * Renders the PostSchedule component. It allows the user to schedule a post. * * @param {Object} props Props. * @param {Function} props.onClose Function to close the component. * * @return {React.ReactNode} The rendered component. */ function PostSchedule(props) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostSchedule, { ...props, showPopoverHeaderActions: true, isCompact: false }); } function PrivatePostSchedule({ onClose, showPopoverHeaderActions, isCompact }) { const { postDate, postType } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ postDate: select(store_store).getEditedPostAttribute('date'), postType: select(store_store).getCurrentPostType() }), []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const onUpdateDate = date => editPost({ date }); const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)(startOfMonth(new Date(postDate))); // Pick up published and scheduled site posts. const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, { status: 'publish,future', after: startOfMonth(previewedMonth).toISOString(), before: endOfMonth(previewedMonth).toISOString(), exclude: [select(store_store).getCurrentPostId()], per_page: 100, _fields: 'id,date' }), [previewedMonth, postType]); const events = (0,external_wp_element_namespaceObject.useMemo)(() => (eventsByPostType || []).map(({ date: eventDate }) => ({ date: new Date(eventDate) })), [eventsByPostType]); const settings = (0,external_wp_date_namespaceObject.getSettings)(); // To know if the current timezone is a 12 hour time with look for "a" in the time format // We also make sure this a is not escaped by a "/" const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a. .replace(/\\\\/g, '') // Replace "//" with empty strings. .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash. ); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePublishDateTimePicker, { currentDate: postDate, onChange: onUpdateDate, is12Hour: is12HourTime, dateOrder: /* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */ (0,external_wp_i18n_namespaceObject._x)('dmy', 'date order'), events: events, onMonthPreviewed: date => setPreviewedMonth(parseISO(date)), onClose: onClose, isCompact: isCompact, showPopoverHeaderActions: showPopoverHeaderActions }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the PostScheduleLabel component. * * @param {Object} props Props. * * @return {React.ReactNode} The rendered component. */ function PostScheduleLabel(props) { return usePostScheduleLabel(props); } /** * Custom hook to get the label for post schedule. * * @param {Object} options Options for the hook. * @param {boolean} options.full Whether to get the full label or not. Default is false. * * @return {string} The label for post schedule. */ function usePostScheduleLabel({ full = false } = {}) { const { date, isFloating } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ date: select(store_store).getEditedPostAttribute('date'), isFloating: select(store_store).isEditedPostDateFloating() }), []); return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, { isFloating }); } function getFullPostScheduleLabel(dateAttribute) { const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); const timezoneAbbreviation = getTimezoneAbbreviation(); const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)( // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date); return (0,external_wp_i18n_namespaceObject.isRTL)() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`; } function getPostScheduleLabel(dateAttribute, { isFloating = false, now = new Date() } = {}) { if (!dateAttribute || isFloating) { return (0,external_wp_i18n_namespaceObject.__)('Immediately'); } // If the user timezone does not equal the site timezone then using words // like 'tomorrow' is confusing, so show the full date. if (!isTimezoneSameAsSiteTimezone(now)) { return getFullPostScheduleLabel(dateAttribute); } const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); if (isSameDay(date, now)) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Time of day the post is scheduled for. (0,external_wp_i18n_namespaceObject.__)('Today at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking space. (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date)); } const tomorrow = new Date(now); tomorrow.setDate(tomorrow.getDate() + 1); if (isSameDay(date, tomorrow)) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Time of day the post is scheduled for. (0,external_wp_i18n_namespaceObject.__)('Tomorrow at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking space. (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date)); } if (date.getFullYear() === now.getFullYear()) { return (0,external_wp_date_namespaceObject.dateI18n)( // translators: If using a space between 'g:i' and 'a', use a non-breaking space. (0,external_wp_i18n_namespaceObject._x)('F j g:i\xa0a', 'post schedule date format without year'), date); } return (0,external_wp_date_namespaceObject.dateI18n)( // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date); } function getTimezoneAbbreviation() { const { timezone } = (0,external_wp_date_namespaceObject.getSettings)(); if (timezone.abbr && isNaN(Number(timezone.abbr))) { return timezone.abbr; } const symbol = timezone.offset < 0 ? '' : '+'; return `UTC${symbol}${timezone.offsetFormatted}`; } function isTimezoneSameAsSiteTimezone(date) { const { timezone } = (0,external_wp_date_namespaceObject.getSettings)(); const siteOffset = Number(timezone.offset); const dateOffset = -1 * (date.getTimezoneOffset() / 60); return siteOffset === dateOffset; } function isSameDay(left, right) { return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear(); } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js /** * WordPress dependencies */ /** * Internal dependencies */ const MIN_MOST_USED_TERMS = 3; const DEFAULT_QUERY = { per_page: 10, orderby: 'count', order: 'desc', hide_empty: true, _fields: 'id,name,count', context: 'view' }; function MostUsedTerms({ onSelect, taxonomy }) { const { _terms, showTerms } = (0,external_wp_data_namespaceObject.useSelect)(select => { const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY); return { _terms: mostUsedTerms, showTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS }; }, [taxonomy.slug]); if (!showTerms) { return null; } const terms = unescapeTerms(_terms); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-taxonomies__flat-term-most-used", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "h3", className: "editor-post-taxonomies__flat-term-most-used-label", children: taxonomy.labels.most_used }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { role: "list", className: "editor-post-taxonomies__flat-term-most-used-list", children: terms.map(term => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => onSelect(term), children: term.name }) }, term.id)) })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Shared reference to an empty array for cases where it is important to avoid * returning a new array reference on every invocation. * * @type {Array<any>} */ const flat_term_selector_EMPTY_ARRAY = []; /** * How the max suggestions limit was chosen: * - Matches the `per_page` range set by the REST API. * - Can't use "unbound" query. The `FormTokenField` needs a fixed number. * - Matches default for `FormTokenField`. */ const MAX_TERMS_SUGGESTIONS = 100; const flat_term_selector_DEFAULT_QUERY = { per_page: MAX_TERMS_SUGGESTIONS, _fields: 'id,name', context: 'view' }; const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase(); const termNamesToIds = (names, terms) => { return names.map(termName => terms.find(term => isSameTermName(term.name, termName))?.id).filter(id => id !== undefined); }; const Wrapper = ({ children, __nextHasNoMarginBottom }) => __nextHasNoMarginBottom ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: children }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: children }); /** * Renders a flat term selector component. * * @param {Object} props The component props. * @param {string} props.slug The slug of the taxonomy. * @param {boolean} props.__nextHasNoMarginBottom Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 7.0. (The prop can be safely removed once this happens.) * * @return {React.ReactNode} The rendered flat term selector component. */ function FlatTermSelector({ slug, __nextHasNoMarginBottom }) { var _taxonomy$labels$add_, _taxonomy$labels$sing2; const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]); const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500); if (!__nextHasNoMarginBottom) { external_wp_deprecated_default()('Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector', { since: '6.7', version: '7.0', hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.' }); } const { terms, termIds, taxonomy, hasAssignAction, hasCreateAction, hasResolvedTerms } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _post$_links, _post$_links2; const { getCurrentPost, getEditedPostAttribute } = select(store_store); const { getEntityRecords, getEntityRecord, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); const post = getCurrentPost(); const _taxonomy = getEntityRecord('root', 'taxonomy', slug); const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY; const query = { ...flat_term_selector_DEFAULT_QUERY, include: _termIds?.join(','), per_page: -1 }; return { hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false, hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false, taxonomy: _taxonomy, termIds: _termIds, terms: _termIds?.length ? getEntityRecords('taxonomy', slug, query) : flat_term_selector_EMPTY_ARRAY, hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query]) }; }, [slug]); const { searchResults } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store); return { searchResults: !!search ? getEntityRecords('taxonomy', slug, { ...flat_term_selector_DEFAULT_QUERY, search }) : flat_term_selector_EMPTY_ARRAY }; }, [search, slug]); // Update terms state only after the selectors are resolved. // We're using this to avoid terms temporarily disappearing on slow networks // while core data makes REST API requests. (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasResolvedTerms) { const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name)); setValues(newValues); } }, [terms, hasResolvedTerms]); const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => { return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name)); }, [searchResults]); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); if (!hasAssignAction) { return null; } async function findOrCreateTerm(term) { try { const newTerm = await saveEntityRecord('taxonomy', slug, term, { throwOnError: true }); return unescapeTerm(newTerm); } catch (error) { if (error.code !== 'term_exists') { throw error; } return { id: error.data.term_id, name: term.name }; } } function onUpdateTerms(newTermIds) { editPost({ [taxonomy.rest_base]: newTermIds }); } function onChange(termNames) { const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])]; const uniqueTerms = termNames.reduce((acc, name) => { if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) { acc.push(name); } return acc; }, []); const newTermNames = uniqueTerms.filter(termName => !availableTerms.find(term => isSameTermName(term.name, termName))); // Optimistically update term values. // The selector will always re-fetch terms later. setValues(uniqueTerms); if (newTermNames.length === 0) { onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); return; } if (!hasCreateAction) { return; } Promise.all(newTermNames.map(termName => findOrCreateTerm({ name: termName }))).then(newTerms => { const newAvailableTerms = availableTerms.concat(newTerms); onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms)); }).catch(error => { createErrorNotice(error.message, { type: 'snackbar' }); // In case of a failure, try assigning available terms. // This will invalidate the optimistic update. onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); }); } function appendTerm(newTerm) { var _taxonomy$labels$sing; if (termIds.includes(newTerm.id)) { return; } const newTermIds = [...termIds, newTerm.id]; const defaultName = slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term'); const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName); (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); onUpdateTerms(newTermIds); } const newTermLabel = (_taxonomy$labels$add_ = taxonomy?.labels?.add_new_item) !== null && _taxonomy$labels$add_ !== void 0 ? _taxonomy$labels$add_ : slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Add new tag') : (0,external_wp_i18n_namespaceObject.__)('Add new Term'); const singularName = (_taxonomy$labels$sing2 = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing2 !== void 0 ? _taxonomy$labels$sing2 : slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term'); const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), singularName); const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName); const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { __nextHasNoMarginBottom: __nextHasNoMarginBottom, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormTokenField, { __next40pxDefaultSize: true, value: values, suggestions: suggestions, onChange: onChange, onInputChange: debouncedSearch, maxSuggestions: MAX_TERMS_SUGGESTIONS, label: newTermLabel, messages: { added: termAddedLabel, removed: termRemovedLabel, remove: removeTermLabel }, __nextHasNoMarginBottom: __nextHasNoMarginBottom }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MostUsedTerms, { taxonomy: taxonomy, onSelect: appendTerm })] }); } /* harmony default export */ const flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector)); ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const TagsPanel = () => { const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)('Add tags') }, "label")]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flat_term_selector, { slug: "post_tag", __nextHasNoMarginBottom: true })] }); }; const MaybeTagsPanel = () => { const { hasTags, isPostTypeSupported } = (0,external_wp_data_namespaceObject.useSelect)(select => { const postType = select(store_store).getCurrentPostType(); const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'taxonomy', 'post_tag'); const _isPostTypeSupported = tagsTaxonomy?.types?.includes(postType); const areTagsFetched = tagsTaxonomy !== undefined; const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute(tagsTaxonomy.rest_base); return { hasTags: !!tags?.length, isPostTypeSupported: areTagsFetched && _isPostTypeSupported }; }, []); const [hadTagsWhenOpeningThePanel] = (0,external_wp_element_namespaceObject.useState)(hasTags); if (!isPostTypeSupported) { return null; } /* * We only want to show the tag panel if the post didn't have * any tags when the user hit the Publish button. * * We can't use the prop.hasTags because it'll change to true * if the user adds a new tag within the pre-publish panel. * This would force a re-render and a new prop.hasTags check, * hiding this panel and keeping the user from adding * more than one tag. */ if (!hadTagsWhenOpeningThePanel) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagsPanel, {}); } return null; }; /* harmony default export */ const maybe_tags_panel = (MaybeTagsPanel); ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const getSuggestion = (supportedFormats, suggestedPostFormat) => { const formats = POST_FORMATS.filter(format => supportedFormats?.includes(format.id)); return formats.find(format => format.id === suggestedPostFormat); }; const PostFormatSuggestion = ({ suggestedPostFormat, suggestionText, onUpdatePostFormat }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => onUpdatePostFormat(suggestedPostFormat), children: suggestionText }); function PostFormatPanel() { const { currentPostFormat, suggestion } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getThemeSuppo; const { getEditedPostAttribute, getSuggestedPostFormat } = select(store_store); const supportedFormats = (_select$getThemeSuppo = select(external_wp_coreData_namespaceObject.store).getThemeSupports().formats) !== null && _select$getThemeSuppo !== void 0 ? _select$getThemeSuppo : []; return { currentPostFormat: getEditedPostAttribute('format'), suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat()) }; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const onUpdatePostFormat = format => editPost({ format }); const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)('Use a post format') }, "label")]; if (!suggestion || suggestion.id === currentPostFormat) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatSuggestion, { onUpdatePostFormat: onUpdatePostFormat, suggestedPostFormat: suggestion.id, suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: post format */ (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption) }) })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module Constants */ const hierarchical_term_selector_DEFAULT_QUERY = { per_page: -1, orderby: 'name', order: 'asc', _fields: 'id,name,parent', context: 'view' }; const MIN_TERMS_COUNT_FOR_FILTER = 8; const hierarchical_term_selector_EMPTY_ARRAY = []; /** * Sort Terms by Selected. * * @param {Object[]} termsTree Array of terms in tree format. * @param {number[]} terms Selected terms. * * @return {Object[]} Sorted array of terms. */ function sortBySelected(termsTree, terms) { const treeHasSelection = termTree => { if (terms.indexOf(termTree.id) !== -1) { return true; } if (undefined === termTree.children) { return false; } return termTree.children.map(treeHasSelection).filter(child => child).length > 0; }; const termOrChildIsSelected = (termA, termB) => { const termASelected = treeHasSelection(termA); const termBSelected = treeHasSelection(termB); if (termASelected === termBSelected) { return 0; } if (termASelected && !termBSelected) { return -1; } if (!termASelected && termBSelected) { return 1; } return 0; }; const newTermTree = [...termsTree]; newTermTree.sort(termOrChildIsSelected); return newTermTree; } /** * Find term by parent id or name. * * @param {Object[]} terms Array of Terms. * @param {number|string} parent id. * @param {string} name Term name. * @return {Object} Term object. */ function findTerm(terms, parent, name) { return terms.find(term => { return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); }); } /** * Get filter matcher function. * * @param {string} filterValue Filter value. * @return {(function(Object): (Object|boolean))} Matcher function. */ function getFilterMatcher(filterValue) { const matchTermsForFilter = originalTerm => { if ('' === filterValue) { return originalTerm; } // Shallow clone, because we'll be filtering the term's children and // don't want to modify the original term. const term = { ...originalTerm }; // Map and filter the children, recursive so we deal with grandchildren // and any deeper levels. if (term.children.length > 0) { term.children = term.children.map(matchTermsForFilter).filter(child => child); } // If the term's name contains the filterValue, or it has children // (i.e. some child matched at some point in the tree) then return it. if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) { return term; } // Otherwise, return false. After mapping, the list of terms will need // to have false values filtered out. return false; }; return matchTermsForFilter; } /** * Hierarchical term selector. * * @param {Object} props Component props. * @param {string} props.slug Taxonomy slug. * @return {Element} Hierarchical term selector component. */ function HierarchicalTermSelector({ slug }) { var _taxonomy$labels$sear, _taxonomy$name; const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false); const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)(''); /** * @type {[number|'', Function]} */ const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)(''); const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false); const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]); const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const { hasCreateAction, hasAssignAction, terms, loading, availableTerms, taxonomy } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _post$_links, _post$_links2; const { getCurrentPost, getEditedPostAttribute } = select(store_store); const { getEntityRecord, getEntityRecords, isResolving } = select(external_wp_coreData_namespaceObject.store); const _taxonomy = getEntityRecord('root', 'taxonomy', slug); const post = getCurrentPost(); return { hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false, hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false, terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY, loading: isResolving('getEntityRecords', ['taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY]), availableTerms: getEntityRecords('taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY, taxonomy: _taxonomy }; }, [slug]); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)(() => sortBySelected(terms_buildTermsTree(availableTerms), terms), // Remove `terms` from the dependency list to avoid reordering every time // checking or unchecking a term. [availableTerms]); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); if (!hasAssignAction) { return null; } /** * Append new term. * * @param {Object} term Term object. * @return {Promise} A promise that resolves to save term object. */ const addTerm = term => { return saveEntityRecord('taxonomy', slug, term, { throwOnError: true }); }; /** * Update terms for post. * * @param {number[]} termIds Term ids. */ const onUpdateTerms = termIds => { editPost({ [taxonomy.rest_base]: termIds }); }; /** * Handler for checking term. * * @param {number} termId */ const onChange = termId => { const hasTerm = terms.includes(termId); const newTerms = hasTerm ? terms.filter(id => id !== termId) : [...terms, termId]; onUpdateTerms(newTerms); }; const onChangeFormName = value => { setFormName(value); }; /** * Handler for changing form parent. * * @param {number|''} parentId Parent post id. */ const onChangeFormParent = parentId => { setFormParent(parentId); }; const onToggleForm = () => { setShowForm(!showForm); }; const onAddTerm = async event => { var _taxonomy$labels$sing; event.preventDefault(); if (formName === '' || adding) { return; } // Check if the term we are adding already exists. const existingTerm = findTerm(availableTerms, formParent, formName); if (existingTerm) { // If the term we are adding exists but is not selected select it. if (!terms.some(term => term === existingTerm.id)) { onUpdateTerms([...terms, existingTerm.id]); } setFormName(''); setFormParent(''); return; } setAdding(true); let newTerm; try { newTerm = await addTerm({ name: formName, parent: formParent ? formParent : undefined }); } catch (error) { createErrorNotice(error.message, { type: 'snackbar' }); return; } const defaultName = slug === 'category' ? (0,external_wp_i18n_namespaceObject.__)('Category') : (0,external_wp_i18n_namespaceObject.__)('Term'); const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName); (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); setAdding(false); setFormName(''); setFormParent(''); onUpdateTerms([...terms, newTerm.id]); }; const setFilter = value => { const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter(term => term); const getResultCount = termsTree => { let count = 0; for (let i = 0; i < termsTree.length; i++) { count++; if (undefined !== termsTree[i].children) { count += getResultCount(termsTree[i].children); } } return count; }; setFilterValue(value); setFilteredTermsTree(newFilteredTermsTree); const resultCount = getResultCount(newFilteredTermsTree); const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', resultCount), resultCount); debouncedSpeak(resultsFoundMessage, 'assertive'); }; const renderTerms = renderedTerms => { return renderedTerms.map(term => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-taxonomies__hierarchical-terms-choice", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, checked: terms.indexOf(term.id) !== -1, onChange: () => { const termId = parseInt(term.id, 10); onChange(termId); }, label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(term.name) }), !!term.children.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-taxonomies__hierarchical-terms-subchoices", children: renderTerms(term.children) })] }, term.id); }); }; const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => { var _taxonomy$labels$labe; return (_taxonomy$labels$labe = taxonomy?.labels?.[labelProperty]) !== null && _taxonomy$labels$labe !== void 0 ? _taxonomy$labels$labe : slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory; }; const newTermButtonLabel = labelWithFallback('add_new_item', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); const newTermLabel = labelWithFallback('new_item_name', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); const parentSelectLabel = labelWithFallback('parent_item', (0,external_wp_i18n_namespaceObject.__)('Parent Category'), (0,external_wp_i18n_namespaceObject.__)('Parent Term')); const noParentOption = `— ${parentSelectLabel} —`; const newTermSubmitLabel = newTermButtonLabel; const filterLabel = (_taxonomy$labels$sear = taxonomy?.labels?.search_items) !== null && _taxonomy$labels$sear !== void 0 ? _taxonomy$labels$sear : (0,external_wp_i18n_namespaceObject.__)('Search Terms'); const groupLabel = (_taxonomy$name = taxonomy?.name) !== null && _taxonomy$name !== void 0 ? _taxonomy$name : (0,external_wp_i18n_namespaceObject.__)('Terms'); const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "column", gap: "4", children: [showFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: filterLabel, placeholder: filterLabel, value: filterValue, onChange: setFilter }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-taxonomies__hierarchical-terms-list", tabIndex: "0", role: "group", "aria-label": groupLabel, children: renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree) }), !loading && hasCreateAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: onToggleForm, className: "editor-post-taxonomies__hierarchical-terms-add", "aria-expanded": showForm, variant: "link", children: newTermButtonLabel }) }), showForm && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onAddTerm, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "column", gap: "4", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, className: "editor-post-taxonomies__hierarchical-terms-input", label: newTermLabel, value: formName, onChange: onChangeFormName, required: true }), !!availableTerms.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TreeSelect, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: parentSelectLabel, noOptionLabel: noParentOption, onChange: onChangeFormParent, selectedId: formParent, tree: availableTermsTree }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", type: "submit", className: "editor-post-taxonomies__hierarchical-terms-submit", children: newTermSubmitLabel }) })] }) })] }); } /* harmony default export */ const hierarchical_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(HierarchicalTermSelector)); ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function MaybeCategoryPanel() { const hasNoCategory = (0,external_wp_data_namespaceObject.useSelect)(select => { const postType = select(store_store).getCurrentPostType(); const { canUser, getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const categoriesTaxonomy = getEntityRecord('root', 'taxonomy', 'category'); const defaultCategoryId = canUser('read', { kind: 'root', name: 'site' }) ? getEntityRecord('root', 'site')?.default_category : undefined; const defaultCategory = defaultCategoryId ? getEntityRecord('taxonomy', 'category', defaultCategoryId) : undefined; const postTypeSupportsCategories = categoriesTaxonomy && categoriesTaxonomy.types.some(type => type === postType); const categories = categoriesTaxonomy && select(store_store).getEditedPostAttribute(categoriesTaxonomy.rest_base); // This boolean should return true if everything is loaded // ( categoriesTaxonomy, defaultCategory ) // and the post has not been assigned a category different than "uncategorized". return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (categories?.length === 0 || categories?.length === 1 && defaultCategory?.id === categories[0]); }, []); const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { // We use state to avoid hiding the panel if the user edits the categories // and adds one within the panel itself (while visible). if (hasNoCategory) { setShouldShowPanel(true); } }, [hasNoCategory]); if (!shouldShowPanel) { return null; } const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)('Assign a category') }, "label")]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(hierarchical_term_selector, { slug: "category" })] }); } /* harmony default export */ const maybe_category_panel = (MaybeCategoryPanel); ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/media-util.js /** * External dependencies */ /** * WordPress dependencies */ /** * Generate a list of unique basenames given a list of URLs. * * We want all basenames to be unique, since sometimes the extension * doesn't reflect the mime type, and may end up getting changed by * the server, on upload. * * @param {string[]} urls The list of URLs * @return {Record< string, string >} A URL => basename record. */ function generateUniqueBasenames(urls) { const basenames = new Set(); return Object.fromEntries(urls.map(url => { // We prefer to match the remote filename, if possible. const filename = (0,external_wp_url_namespaceObject.getFilename)(url); let basename = ''; if (filename) { const parts = filename.split('.'); if (parts.length > 1) { // Assume the last part is the extension. parts.pop(); } basename = parts.join('.'); } if (!basename) { // It looks like we don't have a basename, so let's use a UUID. basename = esm_browser_v4(); } if (basenames.has(basename)) { // Append a UUID to deduplicate the basename. // The server will try to deduplicate on its own if we don't do this, // but it may run into a race condition // (see https://github.com/WordPress/gutenberg/issues/64899). // Deduplicating the filenames before uploading is safer. basename = `${basename}-${esm_browser_v4()}`; } basenames.add(basename); return [url, basename]; })); } /** * Fetch a list of URLs, turning those into promises for files with * unique filenames. * * @param {string[]} urls The list of URLs * @return {Record< string, Promise< File > >} A URL => File promise record. */ function fetchMedia(urls) { return Object.fromEntries(Object.entries(generateUniqueBasenames(urls)).map(([url, basename]) => { const filePromise = window.fetch(url.includes('?') ? url : url + '?').then(response => response.blob()).then(blob => { // The server will reject the upload if it doesn't have an extension, // even though it'll rewrite the file name to match the mime type. // Here we provide it with a safe extension to get it past that check. return new File([blob], `${basename}.png`, { type: blob.type }); }); return [url, filePromise]; })); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-upload-media.js /** * WordPress dependencies */ /** * Internal dependencies */ function flattenBlocks(blocks) { const result = []; blocks.forEach(block => { result.push(block); result.push(...flattenBlocks(block.innerBlocks)); }); return result; } /** * Determine whether a block has external media. * * Different blocks use different attribute names (and potentially * different logic as well) in determining whether the media is * present, and whether it's external. * * @param {{name: string, attributes: Object}} block The block. * @return {boolean?} Whether the block has external media */ function hasExternalMedia(block) { if (block.name === 'core/image' || block.name === 'core/cover') { return block.attributes.url && !block.attributes.id; } if (block.name === 'core/media-text') { return block.attributes.mediaUrl && !block.attributes.mediaId; } return undefined; } /** * Retrieve media info from a block. * * Different blocks use different attribute names, so we need this * function to normalize things into a consistent naming scheme. * * @param {{name: string, attributes: Object}} block The block. * @return {{url: ?string, alt: ?string, id: ?number}} The media info for the block. */ function getMediaInfo(block) { if (block.name === 'core/image' || block.name === 'core/cover') { const { url, alt, id } = block.attributes; return { url, alt, id }; } if (block.name === 'core/media-text') { const { mediaUrl: url, mediaAlt: alt, mediaId: id } = block.attributes; return { url, alt, id }; } return {}; } // Image component to represent a single image in the upload dialog. function Image({ clientId, alt, url }) { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.img, { tabIndex: 0, role: "button", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Select image block.'), onClick: () => { selectBlock(clientId); }, onKeyDown: event => { if (event.key === 'Enter' || event.key === ' ') { selectBlock(clientId); event.preventDefault(); } }, alt: alt, src: url, animate: { opacity: 1 }, exit: { opacity: 0, scale: 0 }, style: { width: '32px', height: '32px', objectFit: 'cover', borderRadius: '2px', cursor: 'pointer' }, whileHover: { scale: 1.08 } }, clientId); } function MaybeUploadMediaPanel() { const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); const [isAnimating, setIsAnimating] = (0,external_wp_element_namespaceObject.useState)(false); const [hadUploadError, setHadUploadError] = (0,external_wp_element_namespaceObject.useState)(false); const { editorBlocks, mediaUpload } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ editorBlocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks(), mediaUpload: select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload }), []); // Get a list of blocks with external media. const blocksWithExternalMedia = flattenBlocks(editorBlocks).filter(block => hasExternalMedia(block)); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); if (!mediaUpload || !blocksWithExternalMedia.length) { return null; } const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)('External media') }, "label")]; /** * Update an individual block to point to newly-added library media. * * Different blocks use different attribute names, so we need this * function to ensure we modify the correct attributes for each type. * * @param {{name: string, attributes: Object}} block The block. * @param {{id: number, url: string}} media Media library file info. */ function updateBlockWithUploadedMedia(block, media) { if (block.name === 'core/image' || block.name === 'core/cover') { updateBlockAttributes(block.clientId, { id: media.id, url: media.url }); } if (block.name === 'core/media-text') { updateBlockAttributes(block.clientId, { mediaId: media.id, mediaUrl: media.url }); } } // Handle fetching and uploading all external media in the post. function uploadImages() { setIsUploading(true); setHadUploadError(false); // Multiple blocks can be using the same URL, so we // should ensure we only fetch and upload each of them once. const mediaUrls = new Set(blocksWithExternalMedia.map(block => { const { url } = getMediaInfo(block); return url; })); // Create an upload promise for each URL, that we can wait for in all // blocks that make use of that media. const uploadPromises = Object.fromEntries(Object.entries(fetchMedia([...mediaUrls])).map(([url, filePromise]) => { const uploadPromise = filePromise.then(blob => new Promise((resolve, reject) => { mediaUpload({ filesList: [blob], onFileChange: ([media]) => { if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { return; } resolve(media); }, onError() { reject(); } }); })); return [url, uploadPromise]; })); // Wait for all blocks to be updated with library media. Promise.allSettled(blocksWithExternalMedia.map(block => { const { url } = getMediaInfo(block); return uploadPromises[url].then(media => updateBlockWithUploadedMedia(block, media)).then(() => setIsAnimating(true)).catch(() => setHadUploadError(true)); })).finally(() => { setIsUploading(false); }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: true, title: panelBodyTitle, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { style: { display: 'inline-flex', flexWrap: 'wrap', gap: '8px' }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { onExitComplete: () => setIsAnimating(false), children: blocksWithExternalMedia.map(block => { const { url, alt } = getMediaInfo(block); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Image, { clientId: block.clientId, url: url, alt: alt }, block.clientId); }) }), isUploading || isAnimating ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "primary", onClick: uploadImages, children: (0,external_wp_i18n_namespaceObject._x)('Upload', 'verb') })] }), hadUploadError && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Upload failed, try again.') })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostPublishPanelPrepublish({ children }) { const { isBeingScheduled, isRequestingSiteIcon, hasPublishAction, siteIconUrl, siteTitle, siteHome } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getCurrentPost$_link; const { getCurrentPost, isEditedPostBeingScheduled } = select(store_store); const { getEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; return { hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, isBeingScheduled: isEditedPostBeingScheduled(), isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), siteIconUrl: siteData.site_icon_url, siteTitle: siteData.name, siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home) }; }, []); let siteIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "components-site-icon", size: "36px", icon: library_wordpress }); if (siteIconUrl) { siteIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), className: "components-site-icon", src: siteIconUrl }); } if (isRequestingSiteIcon) { siteIcon = null; } let prePublishTitle, prePublishBodyText; if (!hasPublishAction) { prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to submit for review?'); prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be reviewed and then approved.'); } else if (isBeingScheduled) { prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to schedule?'); prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be published at the specified date and time.'); } else { prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to publish?'); prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Double-check your settings before publishing.'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-publish-panel__prepublish", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: prePublishTitle }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: prePublishBodyText }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-site-card", children: [siteIcon, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-site-info", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-site-name", children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-site-home", children: siteHome })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeUploadMediaPanel, {}), hasPublishAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityLabel, {}) }, "label")], children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibility, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}) }, "label")], children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, {}) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_tags_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_category_panel, {}), children] }); } /* harmony default export */ const prepublish = (PostPublishPanelPrepublish); ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js /** * WordPress dependencies */ /** * Internal dependencies */ const POSTNAME = '%postname%'; const PAGENAME = '%pagename%'; /** * Returns URL for a future post. * * @param {Object} post Post object. * * @return {string} PostPublish URL. */ const getFuturePostUrl = post => { const { slug } = post; if (post.permalink_template.includes(POSTNAME)) { return post.permalink_template.replace(POSTNAME, slug); } if (post.permalink_template.includes(PAGENAME)) { return post.permalink_template.replace(PAGENAME, slug); } return post.permalink_template; }; function postpublish_CopyButton({ text }) { const [showCopyConfirmation, setShowCopyConfirmation] = (0,external_wp_element_namespaceObject.useState)(false); const timeoutIdRef = (0,external_wp_element_namespaceObject.useRef)(); const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, () => { setShowCopyConfirmation(true); if (timeoutIdRef.current) { clearTimeout(timeoutIdRef.current); } timeoutIdRef.current = setTimeout(() => { setShowCopyConfirmation(false); }, 4000); }); (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { if (timeoutIdRef.current) { clearTimeout(timeoutIdRef.current); } }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", ref: ref, children: showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy') }); } function PostPublishPanelPostpublish({ focusOnMount, children }) { const { post, postType, isScheduled } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute, getCurrentPost, isCurrentPostScheduled } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { post: getCurrentPost(), postType: getPostType(getEditedPostAttribute('type')), isScheduled: isCurrentPostScheduled() }; }, []); const postLabel = postType?.labels?.singular_name; const viewPostLabel = postType?.labels?.view_item; const addNewPostLabel = postType?.labels?.add_new_item; const link = post.status === 'future' ? getFuturePostUrl(post) : post.link; const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', { post_type: post.type }); const postLinkRef = (0,external_wp_element_namespaceObject.useCallback)(node => { if (focusOnMount && node) { node.focus(); } }, [focusOnMount]); const postPublishNonLinkHeader = isScheduled ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [(0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}), "."] }) : (0,external_wp_i18n_namespaceObject.__)('is now live.'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "post-publish-panel__postpublish", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { className: "post-publish-panel__postpublish-header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { ref: postLinkRef, href: link, children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)') }), ' ', postPublishNonLinkHeader] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "post-publish-panel__postpublish-subheader", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: (0,external_wp_i18n_namespaceObject.__)('What’s next?') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "post-publish-panel__postpublish-post-address-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, className: "post-publish-panel__postpublish-post-address", readOnly: true, label: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: post type singular name */ (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel), value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link), onFocus: event => event.target.select() }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "post-publish-panel__postpublish-post-address__copy-button-wrap", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(postpublish_CopyButton, { text: link }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "post-publish-panel__postpublish-buttons", children: [!isScheduled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", href: link, __next40pxDefaultSize: true, children: viewPostLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: isScheduled ? 'primary' : 'secondary', __next40pxDefaultSize: true, href: addLink, children: addNewPostLabel })] })] }), children] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ class PostPublishPanel extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.onSubmit = this.onSubmit.bind(this); this.cancelButtonNode = (0,external_wp_element_namespaceObject.createRef)(); } componentDidMount() { // This timeout is necessary to make sure the `useEffect` hook of // `useFocusReturn` gets the correct element (the button that opens the // PostPublishPanel) otherwise it will get this button. this.timeoutID = setTimeout(() => { this.cancelButtonNode.current.focus(); }, 0); } componentWillUnmount() { clearTimeout(this.timeoutID); } componentDidUpdate(prevProps) { // Automatically collapse the publish sidebar when a post // is published and the user makes an edit. if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty || this.props.currentPostId !== prevProps.currentPostId) { this.props.onClose(); } } onSubmit() { const { onClose, hasPublishAction, isPostTypeViewable } = this.props; if (!hasPublishAction || !isPostTypeViewable) { onClose(); } } render() { const { forceIsDirty, isBeingScheduled, isPublished, isPublishSidebarEnabled, isScheduled, isSaving, isSavingNonPostEntityChanges, onClose, onTogglePublishSidebar, PostPublishExtension, PrePublishExtension, currentPostId, ...additionalProps } = this.props; const { hasPublishAction, isDirty, isPostTypeViewable, ...propsForPanel } = additionalProps; const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; const isPrePublish = !isPublishedOrScheduled && !isSaving; const isPostPublish = isPublishedOrScheduled && !isSaving; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-publish-panel", ...propsForPanel, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__header", children: isPostPublish ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", onClick: onClose, icon: close_small, label: (0,external_wp_i18n_namespaceObject.__)('Close panel') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__header-cancel-button", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ref: this.cancelButtonNode, accessibleWhenDisabled: true, disabled: isSavingNonPostEntityChanges, onClick: onClose, variant: "secondary", size: "compact", children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__header-publish-button", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button, { onSubmit: this.onSubmit, forceIsDirty: forceIsDirty }) })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-publish-panel__content", children: [isPrePublish && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(prepublish, { children: PrePublishExtension && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrePublishExtension, {}) }), isPostPublish && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishPanelPostpublish, { focusOnMount: true, children: PostPublishExtension && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishExtension, {}) }), isSaving && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__footer", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'), checked: isPublishSidebarEnabled, onChange: onTogglePublishSidebar }) })] }); } } /** * Renders a panel for publishing a post. */ /* harmony default export */ const post_publish_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { var _getCurrentPost$_link; const { getPostType } = select(external_wp_coreData_namespaceObject.store); const { getCurrentPost, getCurrentPostId, getEditedPostAttribute, isCurrentPostPublished, isCurrentPostScheduled, isEditedPostBeingScheduled, isEditedPostDirty, isAutosavingPost, isSavingPost, isSavingNonPostEntityChanges } = select(store_store); const { isPublishSidebarEnabled } = select(store_store); const postType = getPostType(getEditedPostAttribute('type')); return { hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, isPostTypeViewable: postType?.viewable, isBeingScheduled: isEditedPostBeingScheduled(), isDirty: isEditedPostDirty(), isPublished: isCurrentPostPublished(), isPublishSidebarEnabled: isPublishSidebarEnabled(), isSaving: isSavingPost() && !isAutosavingPost(), isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(), isScheduled: isCurrentPostScheduled(), currentPostId: getCurrentPostId() }; }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { isPublishSidebarEnabled }) => { const { disablePublishSidebar, enablePublishSidebar } = dispatch(store_store); return { onTogglePublishSidebar: () => { if (isPublishSidebarEnabled) { disablePublishSidebar(); } else { enablePublishSidebar(); } } }; }), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing])(PostPublishPanel)); ;// ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js /** * WordPress dependencies */ const cloudUpload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.3 10.1C17.3 7.60001 15.2 5.70001 12.5 5.70001C10.3 5.70001 8.4 7.10001 7.9 9.00001H7.7C5.7 9.00001 4 10.7 4 12.8C4 14.9 5.7 16.6 7.7 16.6H9.5V15.2H7.7C6.5 15.2 5.5 14.1 5.5 12.9C5.5 11.7 6.5 10.5 7.7 10.5H9L9.3 9.40001C9.7 8.10001 11 7.20001 12.5 7.20001C14.3 7.20001 15.8 8.50001 15.8 10.1V11.4L17.1 11.6C17.9 11.7 18.5 12.5 18.5 13.4C18.5 14.4 17.7 15.2 16.8 15.2H14.5V16.6H16.7C18.5 16.6 19.9 15.1 19.9 13.3C20 11.7 18.8 10.4 17.3 10.1Z M14.1245 14.2426L15.1852 13.182L12.0032 10L8.82007 13.1831L9.88072 14.2438L11.25 12.8745V18H12.75V12.8681L14.1245 14.2426Z" }) }); /* harmony default export */ const cloud_upload = (cloudUpload); ;// ./node_modules/@wordpress/icons/build-module/library/cloud.js /** * WordPress dependencies */ const cloud = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z" }) }); /* harmony default export */ const library_cloud = (cloud); ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Wrapper component that renders its children only if post has a sticky action. * * @param {Object} props Props. * @param {React.ReactNode} props.children Children to be rendered. * * @return {React.ReactNode} The component to be rendered or null if post type is not 'post' or hasStickyAction is false. */ function PostStickyCheck({ children }) { const { hasStickyAction, postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _post$_links$wpActio; const post = select(store_store).getCurrentPost(); return { hasStickyAction: (_post$_links$wpActio = post._links?.['wp:action-sticky']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false, postType: select(store_store).getCurrentPostType() }; }, []); if (postType !== 'post' || !hasStickyAction) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the PostSticky component. It provides a checkbox control for the sticky post feature. * * @return {React.ReactNode} The rendered component. */ function PostSticky() { const postSticky = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getEditedPost; return (_select$getEditedPost = select(store_store).getEditedPostAttribute('sticky')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : false; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStickyCheck, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { className: "editor-post-sticky__checkbox-control", label: (0,external_wp_i18n_namespaceObject.__)('Sticky'), help: (0,external_wp_i18n_namespaceObject.__)('Pin this post to the top of the blog'), checked: postSticky, onChange: () => editPost({ sticky: !postSticky }), __nextHasNoMarginBottom: true }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-status/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const postStatusesInfo = { 'auto-draft': { label: (0,external_wp_i18n_namespaceObject.__)('Draft'), icon: library_drafts }, draft: { label: (0,external_wp_i18n_namespaceObject.__)('Draft'), icon: library_drafts }, pending: { label: (0,external_wp_i18n_namespaceObject.__)('Pending'), icon: library_pending }, private: { label: (0,external_wp_i18n_namespaceObject.__)('Private'), icon: not_allowed }, future: { label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), icon: library_scheduled }, publish: { label: (0,external_wp_i18n_namespaceObject.__)('Published'), icon: library_published } }; const STATUS_OPTIONS = [{ label: (0,external_wp_i18n_namespaceObject.__)('Draft'), value: 'draft', description: (0,external_wp_i18n_namespaceObject.__)('Not ready to publish.') }, { label: (0,external_wp_i18n_namespaceObject.__)('Pending'), value: 'pending', description: (0,external_wp_i18n_namespaceObject.__)('Waiting for review before publishing.') }, { label: (0,external_wp_i18n_namespaceObject.__)('Private'), value: 'private', description: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') }, { label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), value: 'future', description: (0,external_wp_i18n_namespaceObject.__)('Publish automatically on a chosen date.') }, { label: (0,external_wp_i18n_namespaceObject.__)('Published'), value: 'publish', description: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') }]; const DESIGN_POST_TYPES = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE]; function PostStatus() { const { status, date, password, postId, postType, canEdit } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getCurrentPost$_link; const { getEditedPostAttribute, getCurrentPostId, getCurrentPostType, getCurrentPost } = select(store_store); return { status: getEditedPostAttribute('status'), date: getEditedPostAttribute('date'), password: getEditedPostAttribute('password'), postId: getCurrentPostId(), postType: getCurrentPostType(), canEdit: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false }; }, []); const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); const passwordInputId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostStatus, 'editor-change-status__password-input'); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), headerTitle: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); if (DESIGN_POST_TYPES.includes(postType)) { return null; } const updatePost = ({ status: newStatus = status, password: newPassword = password, date: newDate = date }) => { editEntityRecord('postType', postType, postId, { status: newStatus, date: newDate, password: newPassword }); }; const handleTogglePassword = value => { setShowPassword(value); if (!value) { updatePost({ password: '' }); } }; const handleStatus = value => { let newDate = date; let newPassword = password; if (status === 'future' && new Date(date) > new Date()) { newDate = null; } if (value === 'private' && password) { newPassword = ''; } updatePost({ status: value, date: newDate, password: newPassword }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Status'), ref: setPopoverAnchor, children: canEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { className: "editor-post-status", contentClassName: "editor-change-status__content", popoverProps: popoverProps, focusOnMount: true, renderToggle: ({ onToggle, isOpen }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "editor-post-status__toggle", variant: "tertiary", size: "compact", onClick: onToggle, icon: postStatusesInfo[status]?.icon, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Current post status. (0,external_wp_i18n_namespaceObject.__)('Change status: %s'), postStatusesInfo[status]?.label), "aria-expanded": isOpen, children: postStatusesInfo[status]?.label }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { className: "editor-change-status__options", hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)('Status'), options: STATUS_OPTIONS, onChange: handleStatus, selected: status === 'auto-draft' ? 'draft' : status }), status === 'future' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-change-status__publish-date-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostSchedule, { showPopoverHeaderActions: false, isCompact: true }) }), status !== 'private' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { as: "fieldset", spacing: 4, className: "editor-change-status__password-fieldset", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Password protected'), help: (0,external_wp_i18n_namespaceObject.__)('Only visible to those who know the password'), checked: showPassword, onChange: handleTogglePassword }), showPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-change-status__password-input", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { label: (0,external_wp_i18n_namespaceObject.__)('Password'), onChange: value => updatePost({ password: value }), value: password, placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password'), type: "text", id: passwordInputId, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, maxLength: 255 }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSticky, {})] }) })] }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-status is-read-only", children: postStatusesInfo[status]?.label }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Component showing whether the post is saved or not and providing save * buttons. * * @param {Object} props Component props. * @param {?boolean} props.forceIsDirty Whether to force the post to be marked * as dirty. * @return {import('react').ComponentType} The component. */ function PostSavedState({ forceIsDirty }) { const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); const { isAutosaving, isDirty, isNew, isPublished, isSaveable, isSaving, isScheduled, hasPublishAction, showIconLabels, postStatus, postStatusHasChanged } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getCurrentPost$_link; const { isEditedPostNew, isCurrentPostPublished, isCurrentPostScheduled, isEditedPostDirty, isSavingPost, isEditedPostSaveable, getCurrentPost, isAutosavingPost, getEditedPostAttribute, getPostEdits } = select(store_store); const { get } = select(external_wp_preferences_namespaceObject.store); return { isAutosaving: isAutosavingPost(), isDirty: forceIsDirty || isEditedPostDirty(), isNew: isEditedPostNew(), isPublished: isCurrentPostPublished(), isSaving: isSavingPost(), isSaveable: isEditedPostSaveable(), isScheduled: isCurrentPostScheduled(), hasPublishAction: (_getCurrentPost$_link = getCurrentPost()?._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, showIconLabels: get('core', 'showIconLabels'), postStatus: getEditedPostAttribute('status'), postStatusHasChanged: !!getPostEdits()?.status }; }, [forceIsDirty]); const isPending = postStatus === 'pending'; const { savePost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving); (0,external_wp_element_namespaceObject.useEffect)(() => { let timeoutId; if (wasSaving && !isSaving) { setForceSavedMessage(true); timeoutId = setTimeout(() => { setForceSavedMessage(false); }, 1000); } return () => clearTimeout(timeoutId); }, [isSaving]); // Once the post has been submitted for review this button // is not needed for the contributor role. if (!hasPublishAction && isPending) { return null; } // We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft. // The reason for this is that this button handles the `save as pending` and `save draft` actions. // An exception for this is when the post has a custom status and there should be a way to save changes without // having to publish. This should be handled better in the future when custom statuses have better support. // @see https://github.com/WordPress/gutenberg/issues/3144. const isIneligibleStatus = !['pending', 'draft', 'auto-draft'].includes(postStatus) && STATUS_OPTIONS.map(({ value }) => value).includes(postStatus); if (isPublished || isScheduled || isIneligibleStatus || postStatusHasChanged && ['pending', 'draft'].includes(postStatus)) { return null; } /* translators: button label text should, if possible, be under 16 characters. */ const label = isPending ? (0,external_wp_i18n_namespaceObject.__)('Save as pending') : (0,external_wp_i18n_namespaceObject.__)('Save draft'); /* translators: button label text should, if possible, be under 16 characters. */ const shortLabel = (0,external_wp_i18n_namespaceObject.__)('Save'); const isSaved = forceSavedMessage || !isNew && !isDirty; const isSavedState = isSaving || isSaved; const isDisabled = isSaving || isSaved || !isSaveable; let text; if (isSaving) { text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)('Autosaving') : (0,external_wp_i18n_namespaceObject.__)('Saving'); } else if (isSaved) { text = (0,external_wp_i18n_namespaceObject.__)('Saved'); } else if (isLargeViewport) { text = label; } else if (showIconLabels) { text = shortLabel; } // Use common Button instance for all saved states so that focus is not // lost. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { className: isSaveable || isSaving ? dist_clsx({ 'editor-post-save-draft': !isSavedState, 'editor-post-saved-state': isSavedState, 'is-saving': isSaving, 'is-autosaving': isAutosaving, 'is-saved': isSaved, [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({ type: 'loading' })]: isSaving }) : undefined, onClick: isDisabled ? undefined : () => savePost() /* * We want the tooltip to show the keyboard shortcut only when the * button does something, i.e. when it's not disabled. */, shortcut: isDisabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s'), variant: "tertiary", size: "compact", icon: isLargeViewport ? undefined : cloud_upload, label: text || label, "aria-disabled": isDisabled, children: [isSavedState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { icon: isSaved ? library_check : library_cloud }), text] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Wrapper component that renders its children only if post has a publish action. * * @param {Object} props Props. * @param {React.ReactNode} props.children Children to be rendered. * * @return {React.ReactNode} - The component to be rendered or null if there is no publish action. */ function PostScheduleCheck({ children }) { const hasPublishAction = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getCurrentPos; return (_select$getCurrentPos = select(store_store).getCurrentPost()._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false; }, []); if (!hasPublishAction) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const panel_DESIGN_POST_TYPES = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE]; /** * Renders the Post Schedule Panel component. * * @return {React.ReactNode} The rendered component. */ function PostSchedulePanel() { const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Change publish date'), placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); const label = usePostScheduleLabel(); const fullLabel = usePostScheduleLabel({ full: true }); if (panel_DESIGN_POST_TYPES.includes(postType)) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleCheck, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Publish'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, focusOnMount: true, className: "editor-post-schedule__panel-dropdown", contentClassName: "editor-post-schedule__dialog", renderToggle: ({ onToggle, isOpen }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-schedule__dialog-toggle", variant: "tertiary", tooltipPosition: "middle left", onClick: onToggle, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Current post date. (0,external_wp_i18n_namespaceObject.__)('Change date: %s'), label), label: fullLabel, showTooltip: label !== fullLabel, "aria-expanded": isOpen, children: label }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, { onClose: onClose }) }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders a button component that allows the user to switch a post to draft status. * * @return {React.ReactNode} The rendered component. */ function PostSwitchToDraftButton() { external_wp_deprecated_default()('wp.editor.PostSwitchToDraftButton', { since: '6.7', version: '6.9' }); const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); const { editPost, savePost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isSaving, isPublished, isScheduled } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } = select(store_store); return { isSaving: isSavingPost(), isPublished: isCurrentPostPublished(), isScheduled: isCurrentPostScheduled() }; }, []); const isDisabled = isSaving || !isPublished && !isScheduled; let alertMessage; let confirmButtonText; if (isPublished) { alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unpublish this post?'); confirmButtonText = (0,external_wp_i18n_namespaceObject.__)('Unpublish'); } else if (isScheduled) { alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unschedule this post?'); confirmButtonText = (0,external_wp_i18n_namespaceObject.__)('Unschedule'); } const handleConfirm = () => { setShowConfirmDialog(false); editPost({ status: 'draft' }); savePost(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "editor-post-switch-to-draft", onClick: () => { if (!isDisabled) { setShowConfirmDialog(true); } }, "aria-disabled": isDisabled, variant: "secondary", style: { flexGrow: '1', justifyContent: 'center' }, children: (0,external_wp_i18n_namespaceObject.__)('Switch to draft') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showConfirmDialog, onConfirm: handleConfirm, onCancel: () => setShowConfirmDialog(false), confirmButtonText: confirmButtonText, children: alertMessage })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-sync-status/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the sync status of a post. * * @return {React.ReactNode} The rendered sync status component. */ function PostSyncStatus() { const { syncStatus, postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute } = select(store_store); const meta = getEditedPostAttribute('meta'); // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead. const currentSyncStatus = meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : getEditedPostAttribute('wp_pattern_sync_status'); return { syncStatus: currentSyncStatus, postType: getEditedPostAttribute('type') }; }); if (postType !== 'wp_block') { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Sync status'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-sync-status__value", children: syncStatus === 'unsynced' ? (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)') : (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)') }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const post_taxonomies_identity = x => x; function PostTaxonomies({ taxonomyWrapper = post_taxonomies_identity }) { const { postType, taxonomies } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { postType: select(store_store).getCurrentPostType(), taxonomies: select(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'taxonomy', { per_page: -1 }) }; }, []); const visibleTaxonomies = (taxonomies !== null && taxonomies !== void 0 ? taxonomies : []).filter(taxonomy => // In some circumstances .visibility can end up as undefined so optional chaining operator required. // https://github.com/WordPress/gutenberg/issues/40326 taxonomy.types.includes(postType) && taxonomy.visibility?.show_ui); return visibleTaxonomies.map(taxonomy => { const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; const taxonomyComponentProps = { slug: taxonomy.slug, ...(taxonomy.hierarchical ? {} : { __nextHasNoMarginBottom: true }) }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: taxonomyWrapper(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyComponent, { ...taxonomyComponentProps }), taxonomy) }, `taxonomy-${taxonomy.slug}`); }); } /** * Renders the taxonomies associated with a post. * * @param {Object} props The component props. * @param {Function} props.taxonomyWrapper The wrapper function for each taxonomy component. * * @return {Array} An array of JSX elements representing the visible taxonomies. */ /* harmony default export */ const post_taxonomies = (PostTaxonomies); ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the children components only if the current post type has taxonomies. * * @param {Object} props The component props. * @param {React.ReactNode} props.children The children components to render. * * @return {React.ReactNode} The rendered children components or null if the current post type has no taxonomies. */ function PostTaxonomiesCheck({ children }) { const hasTaxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => { const postType = select(store_store).getCurrentPostType(); const taxonomies = select(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'taxonomy', { per_page: -1 }); return taxonomies?.some(taxonomy => taxonomy.types.includes(postType)); }, []); if (!hasTaxonomies) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders a panel for a specific taxonomy. * * @param {Object} props The component props. * @param {Object} props.taxonomy The taxonomy object. * @param {React.ReactNode} props.children The child components. * * @return {React.ReactNode} The rendered taxonomy panel. */ function TaxonomyPanel({ taxonomy, children }) { const slug = taxonomy?.slug; const panelName = slug ? `taxonomy-panel-${slug}` : ''; const { isEnabled, isOpened } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isEditorPanelEnabled, isEditorPanelOpened } = select(store_store); return { isEnabled: slug ? isEditorPanelEnabled(panelName) : false, isOpened: slug ? isEditorPanelOpened(panelName) : false }; }, [panelName, slug]); const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); if (!isEnabled) { return null; } const taxonomyMenuName = taxonomy?.labels?.menu_name; if (!taxonomyMenuName) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: taxonomyMenuName, opened: isOpened, onToggle: () => toggleEditorPanelOpened(panelName), children: children }); } /** * Component that renders the post taxonomies panel. * * @return {React.ReactNode} The rendered component. */ function panel_PostTaxonomies() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTaxonomiesCheck, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_taxonomies, { taxonomyWrapper: (content, taxonomy) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyPanel, { taxonomy: taxonomy, children: content }); } }) }); } // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js var lib = __webpack_require__(4132); ;// ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Displays the Post Text Editor along with content in Visual and Text mode. * * @return {React.ReactNode} The rendered PostTextEditor component. */ function PostTextEditor() { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor); const { content, blocks, type, id } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const { getCurrentPostType, getCurrentPostId } = select(store_store); const _type = getCurrentPostType(); const _id = getCurrentPostId(); const editedRecord = getEditedEntityRecord('postType', _type, _id); return { content: editedRecord?.content, blocks: editedRecord?.blocks, type: _type, id: _id }; }, []); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); // Replicates the logic found in getEditedPostContent(). const value = (0,external_wp_element_namespaceObject.useMemo)(() => { if (content instanceof Function) { return content({ blocks }); } else if (blocks) { // If we have parsed blocks already, they should be our source of truth. // Parsing applies block deprecations and legacy block conversions that // unparsed content will not have. return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks); } return content; }, [content, blocks]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "label", htmlFor: `post-content-${instanceId}`, children: (0,external_wp_i18n_namespaceObject.__)('Type text or HTML') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(lib/* default */.A, { autoComplete: "off", dir: "auto", value: value, onChange: event => { editEntityRecord('postType', type, id, { content: event.target.value, blocks: undefined, selection: undefined }); }, className: "editor-post-text-editor", id: `post-content-${instanceId}`, placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML') })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-title/constants.js const DEFAULT_CLASSNAMES = 'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text'; const REGEXP_NEWLINES = /[\r\n]+/g; ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title-focus.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Custom hook that manages the focus behavior of the post title input field. * * @param {Element} forwardedRef - The forwarded ref for the input field. * * @return {Object} - The ref object. */ function usePostTitleFocus(forwardedRef) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const { isCleanNewPost } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isCleanNewPost: _isCleanNewPost } = select(store_store); return { isCleanNewPost: _isCleanNewPost() }; }, []); (0,external_wp_element_namespaceObject.useImperativeHandle)(forwardedRef, () => ({ focus: () => { ref?.current?.focus(); } })); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!ref.current) { return; } const { defaultView } = ref.current.ownerDocument; const { name, parent } = defaultView; const ownerDocument = name === 'editor-canvas' ? parent.document : defaultView.document; const { activeElement, body } = ownerDocument; // Only autofocus the title when the post is entirely empty. This should // only happen for a new post, which means we focus the title on new // post so the author can start typing right away, without needing to // click anything. if (isCleanNewPost && (!activeElement || body === activeElement)) { ref.current.focus(); } }, [isCleanNewPost]); return { ref }; } ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Custom hook for managing the post title in the editor. * * @return {Object} An object containing the current title and a function to update the title. */ function usePostTitle() { const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { title } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute } = select(store_store); return { title: getEditedPostAttribute('title') }; }, []); function updateTitle(newTitle) { editPost({ title: newTitle }); } return { title, setTitle: updateTitle }; } ;// ./node_modules/@wordpress/editor/build-module/components/post-title/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const PostTitle = (0,external_wp_element_namespaceObject.forwardRef)((_, forwardedRef) => { const { placeholder } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); const { titlePlaceholder } = getSettings(); return { placeholder: titlePlaceholder }; }, []); const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); const { ref: focusRef } = usePostTitleFocus(forwardedRef); const { title, setTitle: onUpdate } = usePostTitle(); const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({}); const { clearSelectedBlock, insertBlocks, insertDefaultBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title'); const { value, onChange, ref: richTextRef } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ value: title, onChange(newValue) { onUpdate(newValue.replace(REGEXP_NEWLINES, ' ')); }, placeholder: decodedPlaceholder, selectionStart: selection.start, selectionEnd: selection.end, onSelectionChange(newStart, newEnd) { setSelection(sel => { const { start, end } = sel; if (start === newStart && end === newEnd) { return sel; } return { start: newStart, end: newEnd }; }); }, __unstableDisableFormats: false }); function onInsertBlockAfter(blocks) { insertBlocks(blocks, 0); } function onSelect() { setIsSelected(true); clearSelectedBlock(); } function onUnselect() { setIsSelected(false); setSelection({}); } function onEnterPress() { insertDefaultBlock(undefined, undefined, 0); } function onKeyDown(event) { if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { event.preventDefault(); onEnterPress(); } } function onPaste(event) { const clipboardData = event.clipboardData; let plainText = ''; let html = ''; try { plainText = clipboardData.getData('text/plain'); html = clipboardData.getData('text/html'); } catch (error) { // Some browsers like UC Browser paste plain text by default and // don't support clipboardData at all, so allow default // behaviour. return; } // Allows us to ask for this information when we get a report. window.console.log('Received HTML:\n\n', html); window.console.log('Received plain text:\n\n', plainText); const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML: html, plainText }); event.preventDefault(); if (!content.length) { return; } if (typeof content !== 'string') { const [firstBlock] = content; if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) { // Strip HTML to avoid unwanted HTML being added to the title. // In the majority of cases it is assumed that HTML in the title // is undesirable. const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(firstBlock.attributes.content); onUpdate(contentNoHTML); onInsertBlockAfter(content.slice(1)); } else { onInsertBlockAfter(content); } } else { // Strip HTML to avoid unwanted HTML being added to the title. // In the majority of cases it is assumed that HTML in the title // is undesirable. const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(content); onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ html: contentNoHTML }))); } } // The wp-block className is important for editor styles. // This same block is used in both the visual and the code editor. const className = dist_clsx(DEFAULT_CLASSNAMES, { 'is-selected': isSelected }); return /*#__PURE__*/ /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, focusRef]), contentEditable: true, className: className, "aria-label": decodedPlaceholder, role: "textbox", "aria-multiline": "true", onFocus: onSelect, onBlur: onUnselect, onKeyDown: onKeyDown, onPaste: onPaste }) /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */; }); /** * Renders the `PostTitle` component. * * @param {Object} _ Unused parameter. * @param {Element} forwardedRef Forwarded ref for the component. * * @return {React.ReactNode} The rendered PostTitle component. */ /* harmony default export */ const post_title = ((0,external_wp_element_namespaceObject.forwardRef)((_, forwardedRef) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: "title", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTitle, { ref: forwardedRef }) }))); ;// ./node_modules/@wordpress/editor/build-module/components/post-title/post-title-raw.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders a raw post title input field. * * @param {Object} _ Unused parameter. * @param {Element} forwardedRef Reference to the component's DOM node. * * @return {React.ReactNode} The rendered component. */ function PostTitleRaw(_, forwardedRef) { const { placeholder } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); const { titlePlaceholder } = getSettings(); return { placeholder: titlePlaceholder }; }, []); const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); const { title, setTitle: onUpdate } = usePostTitle(); const { ref: focusRef } = usePostTitleFocus(forwardedRef); function onChange(value) { onUpdate(value.replace(REGEXP_NEWLINES, ' ')); } function onSelect() { setIsSelected(true); } function onUnselect() { setIsSelected(false); } // The wp-block className is important for editor styles. // This same block is used in both the visual and the code editor. const className = dist_clsx(DEFAULT_CLASSNAMES, { 'is-selected': isSelected, 'is-raw-text': true }); const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { ref: focusRef, value: title, onChange: onChange, onFocus: onSelect, onBlur: onUnselect, label: placeholder, className: className, placeholder: decodedPlaceholder, hideLabelFromVision: true, autoComplete: "off", dir: "auto", rows: 1, __nextHasNoMarginBottom: true }); } /* harmony default export */ const post_title_raw = ((0,external_wp_element_namespaceObject.forwardRef)(PostTitleRaw)); ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Wrapper component that renders its children only if the post can be trashed. * * @param {Object} props The component props. * @param {React.ReactNode} props.children The child components. * * @return {React.ReactNode} The rendered child components or null if the post can't be trashed. */ function PostTrashCheck({ children }) { const { canTrashPost } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isEditedPostNew, getCurrentPostId, getCurrentPostType } = select(store_store); const { canUser } = select(external_wp_coreData_namespaceObject.store); const postType = getCurrentPostType(); const postId = getCurrentPostId(); const isNew = isEditedPostNew(); const canUserDelete = !!postId ? canUser('delete', { kind: 'postType', name: postType, id: postId }) : false; return { canTrashPost: (!isNew || postId) && canUserDelete && !GLOBAL_POST_TYPES.includes(postType) }; }, []); if (!canTrashPost) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Displays the Post Trash Button and Confirm Dialog in the Editor. * * @param {?{onActionPerformed: Object}} An object containing the onActionPerformed function. * @return {React.ReactNode} The rendered PostTrash component. */ function PostTrash({ onActionPerformed }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { isNew, isDeleting, postId, title } = (0,external_wp_data_namespaceObject.useSelect)(select => { const store = select(store_store); return { isNew: store.isEditedPostNew(), isDeleting: store.isDeletingPost(), postId: store.getCurrentPostId(), title: store.getCurrentPostAttribute('title') }; }, []); const { trashPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); if (isNew || !postId) { return null; } const handleConfirm = async () => { setShowConfirmDialog(false); await trashPost(); const item = await registry.resolveSelect(store_store).getCurrentPost(); // After the post is trashed, we want to trigger the onActionPerformed callback, so the user is redirect // to the post view depending on if the user is on post editor or site editor. onActionPerformed?.('move-to-trash', [item]); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PostTrashCheck, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "editor-post-trash", isDestructive: true, variant: "secondary", isBusy: isDeleting, "aria-disabled": isDeleting, onClick: isDeleting ? undefined : () => setShowConfirmDialog(true), children: (0,external_wp_i18n_namespaceObject.__)('Move to trash') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showConfirmDialog, onConfirm: handleConfirm, onCancel: () => setShowConfirmDialog(false), confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Move to trash'), size: "small", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The item's title. (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move "%s" to the trash?'), title) })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-url/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the `PostURL` component. * * @example * ```jsx * <PostURL /> * ``` * * @param {{ onClose: () => void }} props The props for the component. * @param {() => void} props.onClose Callback function to be executed when the popover is closed. * * @return {React.ReactNode} The rendered PostURL component. */ function PostURL({ onClose }) { const { isEditable, postSlug, postLink, permalinkPrefix, permalinkSuffix, permalink } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _post$_links$wpActio; const post = select(store_store).getCurrentPost(); const postTypeSlug = select(store_store).getCurrentPostType(); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); const permalinkParts = select(store_store).getPermalinkParts(); const hasPublishAction = (_post$_links$wpActio = post?._links?.['wp:action-publish']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false; return { isEditable: select(store_store).isPermalinkEditable() && hasPublishAction, postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getEditedPostSlug()), viewPostLabel: postType?.labels.view_item, postLink: post.link, permalinkPrefix: permalinkParts?.prefix, permalinkSuffix: permalinkParts?.suffix, permalink: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getPermalink()) }; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false); const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => { createNotice('info', (0,external_wp_i18n_namespaceObject.__)('Copied Permalink to clipboard.'), { isDismissible: true, type: 'snackbar' }); }); const postUrlSlugDescriptionId = 'editor-post-url__slug-description-' + (0,external_wp_compose_namespaceObject.useInstanceId)(PostURL); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-url", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Slug'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "editor-post-url__intro", children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>'), { span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: postUrlSlugDescriptionId }), a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink') }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { children: "/" }), suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: copy_small, ref: copyButtonRef, size: "small", label: "Copy" }) }), label: (0,external_wp_i18n_namespaceObject.__)('Slug'), hideLabelFromVision: true, value: forceEmptyField ? '' : postSlug, autoComplete: "off", spellCheck: "false", type: "text", className: "editor-post-url__input", onChange: newValue => { editPost({ slug: newValue }); // When we delete the field the permalink gets // reverted to the original value. // The forceEmptyField logic allows the user to have // the field temporarily empty while typing. if (!newValue) { if (!forceEmptyField) { setForceEmptyField(true); } return; } if (forceEmptyField) { setForceEmptyField(false); } }, onBlur: event => { editPost({ slug: (0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value) }); if (forceEmptyField) { setForceEmptyField(false); } }, "aria-describedby": postUrlSlugDescriptionId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "editor-post-url__permalink", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__permalink-visual-label", children: (0,external_wp_i18n_namespaceObject.__)('Permalink:') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ExternalLink, { className: "editor-post-url__link", href: postLink, target: "_blank", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__link-prefix", children: permalinkPrefix }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__link-slug", children: postSlug }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__link-suffix", children: permalinkSuffix })] })] })] }), !isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { className: "editor-post-url__link", href: postLink, target: "_blank", children: postLink })] })] })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-url/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Check if the post URL is valid and visible. * * @param {Object} props The component props. * @param {React.ReactNode} props.children The child components. * * @return {React.ReactNode} The child components if the post URL is valid and visible, otherwise null. */ function PostURLCheck({ children }) { const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { const postTypeSlug = select(store_store).getCurrentPostType(); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); if (!postType?.viewable) { return false; } const post = select(store_store).getCurrentPost(); if (!post.link) { return false; } const permalinkParts = select(store_store).getPermalinkParts(); if (!permalinkParts) { return false; } return true; }, []); if (!isVisible) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-url/label.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Represents a label component for a post URL. * * @return {React.ReactNode} The PostURLLabel component. */ function PostURLLabel() { return usePostURLLabel(); } /** * Custom hook to get the label for the post URL. * * @return {string} The filtered and decoded post URL label. */ function usePostURLLabel() { const postLink = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getPermalink(), []); return (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postLink)); } ;// ./node_modules/@wordpress/editor/build-module/components/post-url/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the `PostURLPanel` component. * * @return {React.ReactNode} The rendered PostURLPanel component. */ function PostURLPanel() { const { isFrontPage } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostId } = select(store_store); const { getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEditedEntityRecord('root', 'site') : undefined; const _id = getCurrentPostId(); return { isFrontPage: siteSettings?.page_on_front === _id }; }, []); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); const label = isFrontPage ? (0,external_wp_i18n_namespaceObject.__)('Link') : (0,external_wp_i18n_namespaceObject.__)('Slug'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLCheck, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_panel_row, { label: label, ref: setPopoverAnchor, children: [!isFrontPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, className: "editor-post-url__panel-dropdown", contentClassName: "editor-post-url__panel-dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLToggle, { isOpen: isOpen, onClick: onToggle }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURL, { onClose: onClose }) }), isFrontPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FrontPageLink, {})] }) }); } function PostURLToggle({ isOpen, onClick }) { const { slug } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { slug: select(store_store).getEditedPostSlug() }; }, []); const decodedSlug = (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(slug); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-url__panel-toggle", variant: "tertiary", "aria-expanded": isOpen, "aria-label": // translators: %s: Current post link. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change link: %s'), decodedSlug), onClick: onClick, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: decodedSlug }) }); } function FrontPageLink() { const { postLink } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPost } = select(store_store); return { postLink: getCurrentPost()?.link }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { className: "editor-post-url__front-page-link", href: postLink, target: "_blank", children: postLink }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Determines if the current post can be edited (published) * and passes this information to the provided render function. * * @param {Object} props The component props. * @param {Function} props.render Function to render the component. * Receives an object with a `canEdit` property. * @return {React.ReactNode} The rendered component. */ function PostVisibilityCheck({ render }) { const canEdit = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getCurrentPos; return (_select$getCurrentPos = select(store_store).getCurrentPost()._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false; }); return render({ canEdit }); } ;// ./node_modules/@wordpress/icons/build-module/library/info.js /** * WordPress dependencies */ const info = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" }) }); /* harmony default export */ const library_info = (info); ;// external ["wp","wordcount"] const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; ;// ./node_modules/@wordpress/editor/build-module/components/word-count/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the word count of the post content. * * @return {React.ReactNode} The rendered WordCount component. */ function WordCount() { const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); /* * translators: If your word count is based on single characters (e.g. East Asian characters), * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. * Do not translate into your own language. */ const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "word-count", children: (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) }); } ;// ./node_modules/@wordpress/editor/build-module/components/time-to-read/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Average reading rate - based on average taken from * https://irisreading.com/average-reading-speed-in-various-languages/ * (Characters/minute used for Chinese rather than words). * * @type {number} A rough estimate of the average reading rate across multiple languages. */ const AVERAGE_READING_RATE = 189; /** * Component for showing Time To Read in Content. * * @return {React.ReactNode} The rendered TimeToRead component. */ function TimeToRead() { const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); /* * translators: If your word count is based on single characters (e.g. East Asian characters), * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. * Do not translate into your own language. */ const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); const minutesToRead = Math.round((0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) / AVERAGE_READING_RATE); const minutesToReadString = minutesToRead === 0 ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('<span>< 1</span> minute'), { span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) }) : (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: the number of minutes to read the post. */ (0,external_wp_i18n_namespaceObject._n)('<span>%s</span> minute', '<span>%s</span> minutes', minutesToRead), minutesToRead), { span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "time-to-read", children: minutesToReadString }); } ;// ./node_modules/@wordpress/editor/build-module/components/character-count/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the character count of the post content. * * @return {number} The character count. */ function CharacterCount() { const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); return (0,external_wp_wordcount_namespaceObject.count)(content, 'characters_including_spaces'); } ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function TableOfContentsPanel({ hasOutlineItemsDisabled, onRequestClose }) { const { headingCount, paragraphCount, numberOfBlocks } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getGlobalBlockCount } = select(external_wp_blockEditor_namespaceObject.store); return { headingCount: getGlobalBlockCount('core/heading'), paragraphCount: getGlobalBlockCount('core/paragraph'), numberOfBlocks: getGlobalBlockCount() }; }, []); return ( /*#__PURE__*/ /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "table-of-contents__wrapper", role: "note", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'), tabIndex: "0", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { role: "list", className: "table-of-contents__counts", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [(0,external_wp_i18n_namespaceObject.__)('Words'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {})] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [(0,external_wp_i18n_namespaceObject.__)('Characters'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [(0,external_wp_i18n_namespaceObject.__)('Time to read'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {})] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [(0,external_wp_i18n_namespaceObject.__)('Headings'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: headingCount })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [(0,external_wp_i18n_namespaceObject.__)('Paragraphs'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: paragraphCount })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [(0,external_wp_i18n_namespaceObject.__)('Blocks'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: numberOfBlocks })] })] }) }), headingCount > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("hr", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "table-of-contents__title", children: (0,external_wp_i18n_namespaceObject.__)('Document Outline') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, { onSelect: onRequestClose, hasOutlineItemsDisabled: hasOutlineItemsDisabled })] })] }) /* eslint-enable jsx-a11y/no-redundant-roles */ ); } /* harmony default export */ const table_of_contents_panel = (TableOfContentsPanel); ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function TableOfContents({ hasOutlineItemsDisabled, repositionDropdown, ...props }, ref) { const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: repositionDropdown ? 'right' : 'bottom' }, className: "table-of-contents", contentClassName: "table-of-contents__popover", renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...props, ref: ref, onClick: hasBlocks ? onToggle : undefined, icon: library_info, "aria-expanded": isOpen, "aria-haspopup": "true" /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('Details'), tooltipPosition: "bottom", "aria-disabled": !hasBlocks }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(table_of_contents_panel, { onRequestClose: onClose, hasOutlineItemsDisabled: hasOutlineItemsDisabled }) }); } /** * Renders a table of contents component. * * @param {Object} props The component props. * @param {boolean} props.hasOutlineItemsDisabled Whether outline items are disabled. * @param {boolean} props.repositionDropdown Whether to reposition the dropdown. * @param {Element.ref} ref The component's ref. * * @return {React.ReactNode} The rendered table of contents component. */ /* harmony default export */ const table_of_contents = ((0,external_wp_element_namespaceObject.forwardRef)(TableOfContents)); ;// ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js /** * WordPress dependencies */ /** * Warns the user if there are unsaved changes before leaving the editor. * Compatible with Post Editor and Site Editor. * * @return {React.ReactNode} The component. */ function UnsavedChangesWarning() { const { __experimentalGetDirtyEntityRecords } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { /** * Warns the user if there are unsaved changes before leaving the editor. * * @param {Event} event `beforeunload` event. * * @return {string | undefined} Warning prompt message, if unsaved changes exist. */ const warnIfUnsavedChanges = event => { // We need to call the selector directly in the listener to avoid race // conditions with `BrowserURL` where `componentDidUpdate` gets the // new value of `isEditedPostDirty` before this component does, // causing this component to incorrectly think a trashed post is still dirty. const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); if (dirtyEntityRecords.length > 0) { event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.'); return event.returnValue; } }; window.addEventListener('beforeunload', warnIfUnsavedChanges); return () => { window.removeEventListener('beforeunload', warnIfUnsavedChanges); }; }, [__experimentalGetDirtyEntityRecords]); return null; } ;// external ["wp","serverSideRender"] const external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"]; var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject); ;// ./node_modules/@wordpress/editor/build-module/components/deprecated.js // Block Creation Components. /** * WordPress dependencies */ function deprecateComponent(name, Wrapped, staticsToHoist = []) { const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { external_wp_deprecated_default()('wp.editor.' + name, { since: '5.3', alternative: 'wp.blockEditor.' + name, version: '6.2' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapped, { ref: ref, ...props }); }); staticsToHoist.forEach(staticName => { Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]); }); return Component; } function deprecateFunction(name, func) { return (...args) => { external_wp_deprecated_default()('wp.editor.' + name, { since: '5.3', alternative: 'wp.blockEditor.' + name, version: '6.2' }); return func(...args); }; } /** * @deprecated since 5.3, use `wp.blockEditor.RichText` instead. */ const RichText = deprecateComponent('RichText', external_wp_blockEditor_namespaceObject.RichText, ['Content']); RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_namespaceObject.RichText.isEmpty); /** * @deprecated since 5.3, use `wp.blockEditor.Autocomplete` instead. */ const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_namespaceObject.Autocomplete); /** * @deprecated since 5.3, use `wp.blockEditor.AlignmentToolbar` instead. */ const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_namespaceObject.AlignmentToolbar); /** * @deprecated since 5.3, use `wp.blockEditor.BlockAlignmentToolbar` instead. */ const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar); /** * @deprecated since 5.3, use `wp.blockEditor.BlockControls` instead. */ const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_namespaceObject.BlockControls, ['Slot']); /** * @deprecated since 5.3, use `wp.blockEditor.BlockEdit` instead. */ const BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_namespaceObject.BlockEdit); /** * @deprecated since 5.3, use `wp.blockEditor.BlockEditorKeyboardShortcuts` instead. */ const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts); /** * @deprecated since 5.3, use `wp.blockEditor.BlockFormatControls` instead. */ const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_namespaceObject.BlockFormatControls, ['Slot']); /** * @deprecated since 5.3, use `wp.blockEditor.BlockIcon` instead. */ const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_namespaceObject.BlockIcon); /** * @deprecated since 5.3, use `wp.blockEditor.BlockInspector` instead. */ const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_namespaceObject.BlockInspector); /** * @deprecated since 5.3, use `wp.blockEditor.BlockList` instead. */ const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_namespaceObject.BlockList); /** * @deprecated since 5.3, use `wp.blockEditor.BlockMover` instead. */ const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_namespaceObject.BlockMover); /** * @deprecated since 5.3, use `wp.blockEditor.BlockNavigationDropdown` instead. */ const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_namespaceObject.BlockNavigationDropdown); /** * @deprecated since 5.3, use `wp.blockEditor.BlockSelectionClearer` instead. */ const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_namespaceObject.BlockSelectionClearer); /** * @deprecated since 5.3, use `wp.blockEditor.BlockSettingsMenu` instead. */ const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_namespaceObject.BlockSettingsMenu); /** * @deprecated since 5.3, use `wp.blockEditor.BlockTitle` instead. */ const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_namespaceObject.BlockTitle); /** * @deprecated since 5.3, use `wp.blockEditor.BlockToolbar` instead. */ const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_namespaceObject.BlockToolbar); /** * @deprecated since 5.3, use `wp.blockEditor.ColorPalette` instead. */ const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_namespaceObject.ColorPalette); /** * @deprecated since 5.3, use `wp.blockEditor.ContrastChecker` instead. */ const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_namespaceObject.ContrastChecker); /** * @deprecated since 5.3, use `wp.blockEditor.CopyHandler` instead. */ const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_namespaceObject.CopyHandler); /** * @deprecated since 5.3, use `wp.blockEditor.DefaultBlockAppender` instead. */ const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_namespaceObject.DefaultBlockAppender); /** * @deprecated since 5.3, use `wp.blockEditor.FontSizePicker` instead. */ const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_namespaceObject.FontSizePicker); /** * @deprecated since 5.3, use `wp.blockEditor.Inserter` instead. */ const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_namespaceObject.Inserter); /** * @deprecated since 5.3, use `wp.blockEditor.InnerBlocks` instead. */ const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_namespaceObject.InnerBlocks, ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']); /** * @deprecated since 5.3, use `wp.blockEditor.InspectorAdvancedControls` instead. */ const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ['Slot']); /** * @deprecated since 5.3, use `wp.blockEditor.InspectorControls` instead. */ const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_namespaceObject.InspectorControls, ['Slot']); /** * @deprecated since 5.3, use `wp.blockEditor.PanelColorSettings` instead. */ const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_namespaceObject.PanelColorSettings); /** * @deprecated since 5.3, use `wp.blockEditor.PlainText` instead. */ const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_namespaceObject.PlainText); /** * @deprecated since 5.3, use `wp.blockEditor.RichTextShortcut` instead. */ const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_namespaceObject.RichTextShortcut); /** * @deprecated since 5.3, use `wp.blockEditor.RichTextToolbarButton` instead. */ const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_namespaceObject.RichTextToolbarButton); /** * @deprecated since 5.3, use `wp.blockEditor.__unstableRichTextInputEvent` instead. */ const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent); /** * @deprecated since 5.3, use `wp.blockEditor.MediaPlaceholder` instead. */ const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_namespaceObject.MediaPlaceholder); /** * @deprecated since 5.3, use `wp.blockEditor.MediaUpload` instead. */ const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_namespaceObject.MediaUpload); /** * @deprecated since 5.3, use `wp.blockEditor.MediaUploadCheck` instead. */ const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_namespaceObject.MediaUploadCheck); /** * @deprecated since 5.3, use `wp.blockEditor.MultiSelectScrollIntoView` instead. */ const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView); /** * @deprecated since 5.3, use `wp.blockEditor.NavigableToolbar` instead. */ const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_namespaceObject.NavigableToolbar); /** * @deprecated since 5.3, use `wp.blockEditor.ObserveTyping` instead. */ const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_namespaceObject.ObserveTyping); /** * @deprecated since 5.3, use `wp.blockEditor.SkipToSelectedBlock` instead. */ const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_namespaceObject.SkipToSelectedBlock); /** * @deprecated since 5.3, use `wp.blockEditor.URLInput` instead. */ const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_namespaceObject.URLInput); /** * @deprecated since 5.3, use `wp.blockEditor.URLInputButton` instead. */ const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_namespaceObject.URLInputButton); /** * @deprecated since 5.3, use `wp.blockEditor.URLPopover` instead. */ const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_namespaceObject.URLPopover); /** * @deprecated since 5.3, use `wp.blockEditor.Warning` instead. */ const Warning = deprecateComponent('Warning', external_wp_blockEditor_namespaceObject.Warning); /** * @deprecated since 5.3, use `wp.blockEditor.WritingFlow` instead. */ const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_namespaceObject.WritingFlow); /** * @deprecated since 5.3, use `wp.blockEditor.createCustomColorsHOC` instead. */ const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_namespaceObject.createCustomColorsHOC); /** * @deprecated since 5.3, use `wp.blockEditor.getColorClassName` instead. */ const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_namespaceObject.getColorClassName); /** * @deprecated since 5.3, use `wp.blockEditor.getColorObjectByAttributeValues` instead. */ const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues); /** * @deprecated since 5.3, use `wp.blockEditor.getColorObjectByColorValue` instead. */ const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_namespaceObject.getColorObjectByColorValue); /** * @deprecated since 5.3, use `wp.blockEditor.getFontSize` instead. */ const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_namespaceObject.getFontSize); /** * @deprecated since 5.3, use `wp.blockEditor.getFontSizeClass` instead. */ const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_namespaceObject.getFontSizeClass); /** * @deprecated since 5.3, use `wp.blockEditor.createCustomColorsHOC` instead. */ const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_namespaceObject.withColorContext); /** * @deprecated since 5.3, use `wp.blockEditor.withColors` instead. */ const withColors = deprecateFunction('withColors', external_wp_blockEditor_namespaceObject.withColors); /** * @deprecated since 5.3, use `wp.blockEditor.withFontSizes` instead. */ const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_namespaceObject.withFontSizes); ;// ./node_modules/@wordpress/editor/build-module/components/index.js /** * Internal dependencies */ // Block Creation Components. // Post Related Components. // State Related Components. /** * Handles the keyboard shortcuts for the editor. * * It provides functionality for various keyboard shortcuts such as toggling editor mode, * toggling distraction-free mode, undo/redo, saving the post, toggling list view, * and toggling the sidebar. */ const VisualEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; /** * Handles the keyboard shortcuts for the editor. * * It provides functionality for various keyboard shortcuts such as toggling editor mode, * toggling distraction-free mode, undo/redo, saving the post, toggling list view, * and toggling the sidebar. */ const TextEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; ;// ./node_modules/@wordpress/editor/build-module/utils/url.js /** * WordPress dependencies */ /** * Performs some basic cleanup of a string for use as a post slug * * This replicates some of what sanitize_title() does in WordPress core, but * is only designed to approximate what the slug will be. * * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters. * Removes combining diacritical marks. Converts whitespace, periods, * and forward slashes to hyphens. Removes any remaining non-word characters * except hyphens and underscores. Converts remaining string to lowercase. * It does not account for octets, HTML entities, or other encoded characters. * * @param {string} string Title or slug to be processed * * @return {string} Processed string */ function cleanForSlug(string) { external_wp_deprecated_default()('wp.editor.cleanForSlug', { since: '12.7', plugin: 'Gutenberg', alternative: 'wp.url.cleanForSlug' }); return (0,external_wp_url_namespaceObject.cleanForSlug)(string); } ;// ./node_modules/@wordpress/editor/build-module/utils/index.js /** * Internal dependencies */ ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/content-slot-fill.js /** * WordPress dependencies */ const EditorContentSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)(Symbol('EditCanvasContainerSlot')); /* harmony default export */ const content_slot_fill = (EditorContentSlotFill); ;// ./node_modules/@wordpress/editor/build-module/components/header/back-button.js /** * WordPress dependencies */ // Keeping an old name for backward compatibility. const slotName = '__experimentalMainDashboardButton'; const useHasBackButton = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); return Boolean(fills && fills.length); }; const { Fill: back_button_Fill, Slot: back_button_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); const BackButton = back_button_Fill; const BackButtonSlot = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button_Slot, { bubblesVirtually: true, fillProps: { length: !fills ? 0 : fills.length } }); }; BackButton.Slot = BackButtonSlot; /* harmony default export */ const back_button = (BackButton); ;// ./node_modules/@wordpress/icons/build-module/library/comment.js /** * WordPress dependencies */ const comment = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z" }) }); /* harmony default export */ const library_comment = (comment); ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/constants.js const collabHistorySidebarName = 'edit-post/collab-history-sidebar'; const collabSidebarName = 'edit-post/collab-sidebar'; ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js /** * WordPress dependencies */ const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); /* harmony default export */ const more_vertical = (moreVertical); ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-author-info.js /** * WordPress dependencies */ /** * Render author information for a comment. * * @param {Object} props - Component properties. * @param {string} props.avatar - URL of the author's avatar. * @param {string} props.name - Name of the author. * @param {string} props.date - Date of the comment. * * @return {React.ReactNode} The JSX element representing the author's information. */ function CommentAuthorInfo({ avatar, name, date }) { const dateSettings = (0,external_wp_date_namespaceObject.getSettings)(); const [dateTimeFormat = dateSettings.formats.time] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'site', 'time_format'); const { currentUserAvatar, currentUserName } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _userData$avatar_urls; const userData = select(external_wp_coreData_namespaceObject.store).getCurrentUser(); const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); const { __experimentalDiscussionSettings } = getSettings(); const defaultAvatar = __experimentalDiscussionSettings?.avatarURL; return { currentUserAvatar: (_userData$avatar_urls = userData?.avatar_urls[48]) !== null && _userData$avatar_urls !== void 0 ? _userData$avatar_urls : defaultAvatar, currentUserName: userData?.name }; }, []); const currentDate = new Date(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: avatar !== null && avatar !== void 0 ? avatar : currentUserAvatar, className: "editor-collab-sidebar-panel__user-avatar" // translators: alt text for user avatar image , alt: (0,external_wp_i18n_namespaceObject.__)('User avatar'), width: 32, height: 32 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "0", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-collab-sidebar-panel__user-name", children: name !== null && name !== void 0 ? name : currentUserName }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { dateTime: (0,external_wp_date_namespaceObject.dateI18n)('c', date !== null && date !== void 0 ? date : currentDate), className: "editor-collab-sidebar-panel__user-time", children: (0,external_wp_date_namespaceObject.dateI18n)(dateTimeFormat, date !== null && date !== void 0 ? date : currentDate) })] })] }); } /* harmony default export */ const comment_author_info = (CommentAuthorInfo); ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/utils.js /** * Sanitizes a comment string by removing non-printable ASCII characters. * * @param {string} str - The comment string to sanitize. * @return {string} - The sanitized comment string. */ function sanitizeCommentString(str) { return str.trim(); } /** * Extracts comment IDs from an array of blocks. * * This function recursively traverses the blocks and their inner blocks to * collect all comment IDs found in the block attributes. * * @param {Array} blocks - The array of blocks to extract comment IDs from. * @return {Array} An array of comment IDs extracted from the blocks. */ function getCommentIdsFromBlocks(blocks) { // Recursive function to extract comment IDs from blocks const extractCommentIds = items => { return items.reduce((commentIds, block) => { // Check for comment IDs in the current block's attributes if (block.attributes && block.attributes.blockCommentId && !commentIds.includes(block.attributes.blockCommentId)) { commentIds.push(block.attributes.blockCommentId); } // Recursively check inner blocks if (block.innerBlocks && block.innerBlocks.length > 0) { const innerCommentIds = extractCommentIds(block.innerBlocks); commentIds.push(...innerCommentIds); } return commentIds; }, []); }; // Extract all comment IDs recursively return extractCommentIds(blocks); } ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-form.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * EditComment component. * * @param {Object} props - The component props. * @param {Function} props.onSubmit - The function to call when updating the comment. * @param {Function} props.onCancel - The function to call when canceling the comment update. * @param {Object} props.thread - The comment thread object. * @param {string} props.submitButtonText - The text to display on the submit button. * @return {React.ReactNode} The CommentForm component. */ function CommentForm({ onSubmit, onCancel, thread, submitButtonText }) { var _thread$content$raw; const [inputComment, setInputComment] = (0,external_wp_element_namespaceObject.useState)((_thread$content$raw = thread?.content?.raw) !== null && _thread$content$raw !== void 0 ? _thread$content$raw : ''); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, value: inputComment !== null && inputComment !== void 0 ? inputComment : '', onChange: setInputComment }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, accessibleWhenDisabled: true, variant: "primary", onClick: () => { onSubmit(inputComment); setInputComment(''); }, disabled: 0 === sanitizeCommentString(inputComment).length, text: submitButtonText }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onCancel, text: (0,external_wp_i18n_namespaceObject._x)('Cancel', 'Cancel comment button') })] })] }); } /* harmony default export */ const comment_form = (CommentForm); ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comments.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the Comments component. * * @param {Object} props - The component props. * @param {Array} props.threads - The array of comment threads. * @param {Function} props.onEditComment - The function to handle comment editing. * @param {Function} props.onAddReply - The function to add a reply to a comment. * @param {Function} props.onCommentDelete - The function to delete a comment. * @param {Function} props.onCommentResolve - The function to mark a comment as resolved. * @param {boolean} props.showCommentBoard - Whether to show the comment board. * @param {Function} props.setShowCommentBoard - The function to set the comment board visibility. * @return {React.ReactNode} The rendered Comments component. */ function Comments({ threads, onEditComment, onAddReply, onCommentDelete, onCommentResolve, showCommentBoard, setShowCommentBoard }) { const { blockCommentId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockAttributes, getSelectedBlockClientId } = select(external_wp_blockEditor_namespaceObject.store); const _clientId = getSelectedBlockClientId(); return { blockCommentId: _clientId ? getBlockAttributes(_clientId)?.blockCommentId : null }; }, []); const [focusThread, setFocusThread] = (0,external_wp_element_namespaceObject.useState)(showCommentBoard && blockCommentId ? blockCommentId : null); const clearThreadFocus = () => { setFocusThread(null); setShowCommentBoard(false); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ // If there are no comments, show a message indicating no comments are available. (!Array.isArray(threads) || threads.length === 0) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { alignment: "left", className: "editor-collab-sidebar-panel__thread", justify: "flex-start", spacing: "3", children: // translators: message displayed when there are no comments available (0,external_wp_i18n_namespaceObject.__)('No comments available') }), Array.isArray(threads) && threads.length > 0 && threads.map(thread => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: dist_clsx('editor-collab-sidebar-panel__thread', { 'editor-collab-sidebar-panel__active-thread': blockCommentId && blockCommentId === thread.id, 'editor-collab-sidebar-panel__focus-thread': focusThread && focusThread === thread.id }), id: thread.id, spacing: "3", onClick: () => setFocusThread(thread.id), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Thread, { thread: thread, onAddReply: onAddReply, onCommentDelete: onCommentDelete, onCommentResolve: onCommentResolve, onEditComment: onEditComment, isFocused: focusThread === thread.id, clearThreadFocus: clearThreadFocus }) }, thread.id))] }); } function Thread({ thread, onEditComment, onAddReply, onCommentDelete, onCommentResolve, isFocused, clearThreadFocus }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentBoard, { thread: thread, onResolve: onCommentResolve, onEdit: onEditComment, onDelete: onCommentDelete, status: thread.status }), 0 < thread?.reply?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!isFocused && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "editor-collab-sidebar-panel__show-more-reply", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: number of replies. (0,external_wp_i18n_namespaceObject._x)('%s more replies..', 'Show replies button'), thread?.reply?.length) }), isFocused && thread.reply.map(reply => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "editor-collab-sidebar-panel__child-thread", id: reply.id, spacing: "2", children: ['approved' !== thread.status && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentBoard, { thread: reply, onEdit: onEditComment, onDelete: onCommentDelete }), 'approved' === thread.status && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentBoard, { thread: reply })] }, reply.id))] }), 'approved' !== thread.status && isFocused && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "editor-collab-sidebar-panel__child-thread", spacing: "2", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", className: "editor-collab-sidebar-panel__comment-field", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_form, { onSubmit: inputComment => { onAddReply(inputComment, thread.id); }, onCancel: event => { event.stopPropagation(); // Prevent the parent onClick from being triggered clearThreadFocus(); }, submitButtonText: (0,external_wp_i18n_namespaceObject._x)('Reply', 'Add reply comment') }) })] })] }); } const CommentBoard = ({ thread, onResolve, onEdit, onDelete, status }) => { const [actionState, setActionState] = (0,external_wp_element_namespaceObject.useState)(false); const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); const handleConfirmDelete = () => { onDelete(thread.id); setActionState(false); setShowConfirmDialog(false); }; const handleConfirmResolve = () => { onResolve(thread.id); setActionState(false); setShowConfirmDialog(false); }; const handleCancel = () => { setActionState(false); setShowConfirmDialog(false); }; const actions = [onEdit && { title: (0,external_wp_i18n_namespaceObject._x)('Edit', 'Edit comment'), onClick: () => { setActionState('edit'); } }, onDelete && { title: (0,external_wp_i18n_namespaceObject._x)('Delete', 'Delete comment'), onClick: () => { setActionState('delete'); setShowConfirmDialog(true); } }]; const moreActions = actions.filter(item => item?.onClick); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info, { avatar: thread?.author_avatar_urls?.[48], name: thread?.author_name, date: thread?.date }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "editor-collab-sidebar-panel__comment-status", children: [status !== 'approved' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "right", justify: "flex-end", spacing: "0", children: [0 === thread?.parent && onResolve && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { label: (0,external_wp_i18n_namespaceObject._x)('Resolve', 'Mark comment as resolved'), __next40pxDefaultSize: true, icon: library_published, onClick: () => { setActionState('resolve'); setShowConfirmDialog(true); }, showTooltip: true }), 0 < moreActions.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject._x)('Select an action', 'Select comment action'), className: "editor-collab-sidebar-panel__comment-dropdown-menu", controls: moreActions })] }), status === 'approved' && /*#__PURE__*/ // translators: tooltip for resolved comment (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: (0,external_wp_i18n_namespaceObject.__)('Resolved'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { icon: library_check }) })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", className: "editor-collab-sidebar-panel__user-comment", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", className: "editor-collab-sidebar-panel__comment-field", children: ['edit' === actionState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_form, { onSubmit: value => { onEdit(thread.id, value); setActionState(false); }, onCancel: () => handleCancel(), thread: thread, submitButtonText: (0,external_wp_i18n_namespaceObject._x)('Update', 'verb') }), 'edit' !== actionState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: thread?.content?.raw })] }) }), 'resolve' === actionState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showConfirmDialog, onConfirm: handleConfirmResolve, onCancel: handleCancel, confirmButtonText: "Yes", cancelButtonText: "No", children: // translators: message displayed when confirming an action (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to mark this comment as resolved?') }), 'delete' === actionState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showConfirmDialog, onConfirm: handleConfirmDelete, onCancel: handleCancel, confirmButtonText: "Yes", cancelButtonText: "No", children: // translators: message displayed when confirming an action (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this comment?') })] }); }; ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/add-comment.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the UI for adding a comment in the Gutenberg editor's collaboration sidebar. * * @param {Object} props - The component props. * @param {Function} props.onSubmit - A callback function to be called when the user submits a comment. * @param {boolean} props.showCommentBoard - The function to edit the comment. * @param {Function} props.setShowCommentBoard - The function to delete the comment. * @return {React.ReactNode} The rendered comment input UI. */ function AddComment({ onSubmit, showCommentBoard, setShowCommentBoard }) { const { clientId, blockCommentId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlock } = select(external_wp_blockEditor_namespaceObject.store); const selectedBlock = getSelectedBlock(); return { clientId: selectedBlock?.clientId, blockCommentId: selectedBlock?.attributes?.blockCommentId }; }); if (!showCommentBoard || !clientId || undefined !== blockCommentId) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", className: "editor-collab-sidebar-panel__thread editor-collab-sidebar-panel__active-thread editor-collab-sidebar-panel__focus-thread", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_form, { onSubmit: inputComment => { onSubmit(inputComment); }, onCancel: () => { setShowCommentBoard(false); }, submitButtonText: (0,external_wp_i18n_namespaceObject._x)('Comment', 'Add comment button') })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-button.js /** * WordPress dependencies */ /** * Internal dependencies */ const { CommentIconSlotFill } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const AddCommentButton = ({ onClick }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentIconSlotFill.Fill, { children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: library_comment, onClick: () => { onClick(); onClose(); }, "aria-haspopup": "dialog", children: (0,external_wp_i18n_namespaceObject._x)('Comment', 'Add comment button') }) }); }; /* harmony default export */ const comment_button = (AddCommentButton); ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-button-toolbar.js /** * WordPress dependencies */ /** * Internal dependencies */ const { CommentIconToolbarSlotFill } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const AddCommentToolbarButton = ({ onClick }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentIconToolbarSlotFill.Fill, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { accessibleWhenDisabled: true, icon: library_comment, label: (0,external_wp_i18n_namespaceObject._x)('Comment', 'View comment'), onClick: onClick }) }); }; /* harmony default export */ const comment_button_toolbar = (AddCommentToolbarButton); ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const modifyBlockCommentAttributes = settings => { if (!settings.attributes.blockCommentId) { settings.attributes = { ...settings.attributes, blockCommentId: { type: 'number' } }; } return settings; }; // Apply the filter to all core blocks (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'block-comment/modify-core-block-attributes', modifyBlockCommentAttributes); function CollabSidebarContent({ showCommentBoard, setShowCommentBoard, styles, comments }) { const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { saveEntityRecord, deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { getEntityRecord } = (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store); const { postId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostId } = select(store_store); const _postId = getCurrentPostId(); return { postId: _postId }; }, []); const { getSelectedBlockClientId } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); // Function to save the comment. const addNewComment = async (comment, parentCommentId) => { const args = { post: postId, content: comment, comment_type: 'block_comment', comment_approved: 0 }; // Create a new object, conditionally including the parent property const updatedArgs = { ...args, ...(parentCommentId ? { parent: parentCommentId } : {}) }; const savedRecord = await saveEntityRecord('root', 'comment', updatedArgs); if (savedRecord) { // If it's a main comment, update the block attributes with the comment id. if (!parentCommentId) { updateBlockAttributes(getSelectedBlockClientId(), { blockCommentId: savedRecord?.id }); } createNotice('snackbar', parentCommentId ? // translators: Reply added successfully (0,external_wp_i18n_namespaceObject.__)('Reply added successfully.') : // translators: Comment added successfully (0,external_wp_i18n_namespaceObject.__)('Comment added successfully.'), { type: 'snackbar', isDismissible: true }); } else { onError(); } }; const onCommentResolve = async commentId => { const savedRecord = await saveEntityRecord('root', 'comment', { id: commentId, status: 'approved' }); if (savedRecord) { // translators: Comment resolved successfully createNotice('snackbar', (0,external_wp_i18n_namespaceObject.__)('Comment marked as resolved.'), { type: 'snackbar', isDismissible: true }); } else { onError(); } }; const onEditComment = async (commentId, comment) => { const savedRecord = await saveEntityRecord('root', 'comment', { id: commentId, content: comment }); if (savedRecord) { createNotice('snackbar', // translators: Comment edited successfully (0,external_wp_i18n_namespaceObject.__)('Comment edited successfully.'), { type: 'snackbar', isDismissible: true }); } else { onError(); } }; const onError = () => { createNotice('error', // translators: Error message when comment submission fails (0,external_wp_i18n_namespaceObject.__)('Something went wrong. Please try publishing the post, or you may have already submitted your comment earlier.'), { isDismissible: true }); }; const onCommentDelete = async commentId => { const childComment = await getEntityRecord('root', 'comment', commentId); await deleteEntityRecord('root', 'comment', commentId); if (childComment && !childComment.parent) { updateBlockAttributes(getSelectedBlockClientId(), { blockCommentId: undefined }); } createNotice('snackbar', // translators: Comment deleted successfully (0,external_wp_i18n_namespaceObject.__)('Comment deleted successfully.'), { type: 'snackbar', isDismissible: true }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-collab-sidebar-panel", style: styles, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddComment, { onSubmit: addNewComment, showCommentBoard: showCommentBoard, setShowCommentBoard: setShowCommentBoard }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Comments, { threads: comments, onEditComment: onEditComment, onAddReply: addNewComment, onCommentDelete: onCommentDelete, onCommentResolve: onCommentResolve, showCommentBoard: showCommentBoard, setShowCommentBoard: setShowCommentBoard }, getSelectedBlockClientId())] }); } /** * Renders the Collab sidebar. */ function CollabSidebar() { const [showCommentBoard, setShowCommentBoard] = (0,external_wp_element_namespaceObject.useState)(false); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); const { postId, postType, postStatus, threads } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostId, getCurrentPostType } = select(store_store); const _postId = getCurrentPostId(); const data = !!_postId && typeof _postId === 'number' ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'comment', { post: _postId, type: 'block_comment', status: 'any', per_page: 100 }) : null; return { postId: _postId, postType: getCurrentPostType(), postStatus: select(store_store).getEditedPostAttribute('status'), threads: data }; }, []); const { blockCommentId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockAttributes, getSelectedBlockClientId } = select(external_wp_blockEditor_namespaceObject.store); const _clientId = getSelectedBlockClientId(); return { blockCommentId: _clientId ? getBlockAttributes(_clientId)?.blockCommentId : null }; }, []); const openCollabBoard = () => { setShowCommentBoard(true); enableComplementaryArea('core', 'edit-post/collab-sidebar'); }; const [blocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType, { id: postId }); // Process comments to build the tree structure const { resultComments, sortedThreads } = (0,external_wp_element_namespaceObject.useMemo)(() => { // Create a compare to store the references to all objects by id const compare = {}; const result = []; const filteredComments = (threads !== null && threads !== void 0 ? threads : []).filter(comment => comment.status !== 'trash'); // Initialize each object with an empty `reply` array filteredComments.forEach(item => { compare[item.id] = { ...item, reply: [] }; }); // Iterate over the data to build the tree structure filteredComments.forEach(item => { if (item.parent === 0) { // If parent is 0, it's a root item, push it to the result array result.push(compare[item.id]); } else if (compare[item.parent]) { // Otherwise, find its parent and push it to the parent's `reply` array compare[item.parent].reply.push(compare[item.id]); } }); if (0 === result?.length) { return { resultComments: [], sortedThreads: [] }; } const updatedResult = result.map(item => ({ ...item, reply: [...item.reply].reverse() })); const blockCommentIds = getCommentIdsFromBlocks(blocks); const threadIdMap = new Map(updatedResult.map(thread => [thread.id, thread])); const sortedComments = blockCommentIds.map(id => threadIdMap.get(id)).filter(thread => thread !== undefined); return { resultComments: updatedResult, sortedThreads: sortedComments }; }, [threads, blocks]); // Get the global styles to set the background color of the sidebar. const { merged: GlobalStyles } = useGlobalStylesContext(); const backgroundColor = GlobalStyles?.styles?.color?.background; if (0 < resultComments.length) { const unsubscribe = (0,external_wp_data_namespaceObject.subscribe)(() => { const activeSidebar = getActiveComplementaryArea('core'); if (!activeSidebar) { enableComplementaryArea('core', collabSidebarName); unsubscribe(); } }); } if (postStatus === 'publish') { return null; // or maybe return some message indicating no threads are available. } const AddCommentComponent = blockCommentId ? comment_button_toolbar : comment_button; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddCommentComponent, { onClick: openCollabBoard }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginSidebar, { identifier: collabHistorySidebarName // translators: Comments sidebar title , title: (0,external_wp_i18n_namespaceObject.__)('Comments'), icon: library_comment, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CollabSidebarContent, { comments: resultComments, showCommentBoard: showCommentBoard, setShowCommentBoard: setShowCommentBoard }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginSidebar, { isPinnable: false, header: false, identifier: collabSidebarName, className: "editor-collab-sidebar", headerClassName: "editor-collab-sidebar__header", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CollabSidebarContent, { comments: sortedThreads, showCommentBoard: showCommentBoard, setShowCommentBoard: setShowCommentBoard, styles: { backgroundColor } }) })] }); } ;// ./node_modules/@wordpress/icons/build-module/library/next.js /** * WordPress dependencies */ const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) }); /* harmony default export */ const library_next = (next); ;// ./node_modules/@wordpress/icons/build-module/library/previous.js /** * WordPress dependencies */ const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) }); /* harmony default export */ const library_previous = (previous); ;// ./node_modules/@wordpress/editor/build-module/components/collapsible-block-toolbar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useHasBlockToolbar } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function CollapsibleBlockToolbar({ isCollapsed, onToggle }) { const { blockSelectionStart } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { blockSelectionStart: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() }; }, []); const hasBlockToolbar = useHasBlockToolbar(); const hasBlockSelection = !!blockSelectionStart; (0,external_wp_element_namespaceObject.useEffect)(() => { // If we have a new block selection, show the block tools if (blockSelectionStart) { onToggle(false); } }, [blockSelectionStart, onToggle]); if (!hasBlockToolbar) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('editor-collapsible-block-toolbar', { 'is-collapsed': isCollapsed || !hasBlockSelection }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { name: "block-toolbar" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "editor-collapsible-block-toolbar__toggle", icon: isCollapsed ? library_next : library_previous, onClick: () => { onToggle(!isCollapsed); }, label: isCollapsed ? (0,external_wp_i18n_namespaceObject.__)('Show block tools') : (0,external_wp_i18n_namespaceObject.__)('Hide block tools'), size: "compact" })] }); } ;// ./node_modules/@wordpress/icons/build-module/library/plus.js /** * WordPress dependencies */ const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); /* harmony default export */ const library_plus = (plus); ;// ./node_modules/@wordpress/editor/build-module/components/document-tools/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function DocumentTools({ className, disableBlockTools = false }) { const { setIsInserterOpened, setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isDistractionFree, isInserterOpened, isListViewOpen, listViewShortcut, inserterSidebarToggleRef, listViewToggleRef, showIconLabels, showTools } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { get } = select(external_wp_preferences_namespaceObject.store); const { isListViewOpened, getEditorMode, getInserterSidebarToggleRef, getListViewToggleRef, getRenderingMode, getCurrentPostType } = unlock(select(store_store)); const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { isInserterOpened: select(store_store).isInserterOpened(), isListViewOpen: isListViewOpened(), listViewShortcut: getShortcutRepresentation('core/editor/toggle-list-view'), inserterSidebarToggleRef: getInserterSidebarToggleRef(), listViewToggleRef: getListViewToggleRef(), showIconLabels: get('core', 'showIconLabels'), isDistractionFree: get('core', 'distractionFree'), isVisualMode: getEditorMode() === 'visual', showTools: !!window?.__experimentalEditorWriteMode && (getRenderingMode() !== 'post-only' || getCurrentPostType() === 'wp_template') }; }, []); const preventDefault = event => { // Because the inserter behaves like a dialog, // if the inserter is opened already then when we click on the toggle button // then the initial click event will close the inserter and then be propagated // to the inserter toggle and it will open it again. // To prevent this we need to stop the propagation of the event. // This won't be necessary when the inserter no longer behaves like a dialog. if (isInserterOpened) { event.preventDefault(); } }; const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide'); /* translators: accessibility text for the editor toolbar */ const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools'); const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); const toggleInserter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsInserterOpened(!isInserterOpened), [isInserterOpened, setIsInserterOpened]); /* translators: button label text should, if possible, be under 16 characters. */ const longLabel = (0,external_wp_i18n_namespaceObject._x)('Block Inserter', 'Generic label for block inserter button'); const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'); return ( /*#__PURE__*/ // Some plugins expect and use the `edit-post-header-toolbar` CSS class to // find the toolbar and inject UI elements into it. This is not officially // supported, but we're keeping it in the list of class names for backwards // compatibility. (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.NavigableToolbar, { className: dist_clsx('editor-document-tools', 'edit-post-header-toolbar', className), "aria-label": toolbarAriaLabel, variant: "unstyled", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-document-tools__left", children: [!isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { ref: inserterSidebarToggleRef, className: "editor-document-tools__inserter-toggle", variant: "primary", isPressed: isInserterOpened, onMouseDown: preventDefault, onClick: toggleInserter, disabled: disableBlockTools, icon: library_plus, label: showIconLabels ? shortLabel : longLabel, showTooltip: !showIconLabels, "aria-expanded": isInserterOpened }), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [showTools && isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { as: external_wp_blockEditor_namespaceObject.ToolSelector, showTooltip: !showIconLabels, variant: showIconLabels ? 'tertiary' : undefined, disabled: disableBlockTools, size: "compact" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { as: editor_history_undo, showTooltip: !showIconLabels, variant: showIconLabels ? 'tertiary' : undefined, size: "compact" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { as: editor_history_redo, showTooltip: !showIconLabels, variant: showIconLabels ? 'tertiary' : undefined, size: "compact" }), !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { className: "editor-document-tools__document-overview-toggle", icon: list_view, disabled: disableBlockTools, isPressed: isListViewOpen /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('Document Overview'), onClick: toggleListView, shortcut: listViewShortcut, showTooltip: !showIconLabels, variant: showIconLabels ? 'tertiary' : undefined, "aria-expanded": isListViewOpen, ref: listViewToggleRef })] })] }) }) ); } /* harmony default export */ const document_tools = (DocumentTools); ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/copy-content-menu-item.js /** * WordPress dependencies */ /** * Internal dependencies */ function CopyContentMenuItem() { const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { getCurrentPostId, getCurrentPostType } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { getEditedEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); function getText() { const record = getEditedEntityRecord('postType', getCurrentPostType(), getCurrentPostId()); if (!record) { return ''; } if (typeof record.content === 'function') { return record.content(record); } else if (record.blocks) { return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); } else if (record.content) { return record.content; } } function onSuccess() { createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), { isDismissible: true, type: 'snackbar' }); } const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ref: ref, children: (0,external_wp_i18n_namespaceObject.__)('Copy all blocks') }); } ;// ./node_modules/@wordpress/editor/build-module/components/mode-switcher/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Set of available mode options. * * @type {Array} */ const MODES = [{ value: 'visual', label: (0,external_wp_i18n_namespaceObject.__)('Visual editor') }, { value: 'text', label: (0,external_wp_i18n_namespaceObject.__)('Code editor') }]; function ModeSwitcher() { const { shortcut, isRichEditingEnabled, isCodeEditingEnabled, mode } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/editor/toggle-mode'), isRichEditingEnabled: select(store_store).getEditorSettings().richEditingEnabled, isCodeEditingEnabled: select(store_store).getEditorSettings().codeEditingEnabled, mode: select(store_store).getEditorMode() }), []); const { switchEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); let selectedMode = mode; if (!isRichEditingEnabled && mode === 'visual') { selectedMode = 'text'; } if (!isCodeEditingEnabled && mode === 'text') { selectedMode = 'visual'; } const choices = MODES.map(choice => { if (!isCodeEditingEnabled && choice.value === 'text') { choice = { ...choice, disabled: true }; } if (!isRichEditingEnabled && choice.value === 'visual') { choice = { ...choice, disabled: true, info: (0,external_wp_i18n_namespaceObject.__)('You can enable the visual editor in your profile settings.') }; } if (choice.value !== selectedMode && !choice.disabled) { return { ...choice, shortcut }; } return choice; }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Editor'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { choices: choices, value: selectedMode, onSelect: switchEditorMode }) }); } /* harmony default export */ const mode_switcher = (ModeSwitcher); ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/tools-more-menu-group.js /** * WordPress dependencies */ const { Fill: ToolsMoreMenuGroup, Slot: tools_more_menu_group_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup'); ToolsMoreMenuGroup.Slot = ({ fillProps }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group_Slot, { fillProps: fillProps }); /* harmony default export */ const tools_more_menu_group = (ToolsMoreMenuGroup); ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/view-more-menu-group.js /** * WordPress dependencies */ const { Fill: ViewMoreMenuGroup, Slot: view_more_menu_group_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)(external_wp_element_namespaceObject.Platform.OS === 'web' ? Symbol('ViewMoreMenuGroup') : 'ViewMoreMenuGroup'); ViewMoreMenuGroup.Slot = ({ fillProps }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group_Slot, { fillProps: fillProps }); /* harmony default export */ const view_more_menu_group = (ViewMoreMenuGroup); ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function MoreMenu() { const { openModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const { toggleDistractionFree } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'), []); const turnOffDistractionFree = () => { setPreference('core', 'distractionFree', false); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Options'), popoverProps: { placement: 'bottom-end', className: 'more-menu-dropdown__content' }, toggleProps: { showTooltip: !showIconLabels, ...(showIconLabels && { variant: 'tertiary' }), tooltipPosition: 'bottom', size: 'compact' }, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core", name: "fixedToolbar", onToggle: turnOffDistractionFree, label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated.'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core", name: "distractionFree", label: (0,external_wp_i18n_namespaceObject.__)('Distraction free'), info: (0,external_wp_i18n_namespaceObject.__)('Write with calmness'), handleToggling: false, onToggle: () => toggleDistractionFree({ createNotice: false }), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated.'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated.'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('\\') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core", name: "focusMode", label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'), info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated.'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group.Slot, { fillProps: { onClose } })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mode_switcher, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item.Slot, { name: "core/plugin-more-menu", label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), fillProps: { onClick: onClose } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Tools'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => openModal('editor/keyboard-shortcut-help'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h'), children: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyContentMenuItem, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { icon: library_external, href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'), target: "_blank", rel: "noopener noreferrer", children: [(0,external_wp_i18n_namespaceObject.__)('Help'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: /* translators: accessibility text */ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group.Slot, { fillProps: { onClose } })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => openModal('editor/preferences'), children: (0,external_wp_i18n_namespaceObject.__)('Preferences') }) })] }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/post-publish-button-or-toggle.js /** * WordPress dependencies */ /** * Internal dependencies */ const IS_TOGGLE = 'toggle'; const IS_BUTTON = 'button'; function PostPublishButtonOrToggle({ forceIsDirty, setEntitiesSavedStatesCallback }) { let component; const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const { togglePublishSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { hasPublishAction, isBeingScheduled, isPending, isPublished, isPublishSidebarEnabled, isPublishSidebarOpened, isScheduled, postStatus, postStatusHasChanged } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getCurrentPos; return { hasPublishAction: (_select$getCurrentPos = !!select(store_store).getCurrentPost()?._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false, isBeingScheduled: select(store_store).isEditedPostBeingScheduled(), isPending: select(store_store).isCurrentPostPending(), isPublished: select(store_store).isCurrentPostPublished(), isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled(), isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), isScheduled: select(store_store).isCurrentPostScheduled(), postStatus: select(store_store).getEditedPostAttribute('status'), postStatusHasChanged: select(store_store).getPostEdits()?.status }; }, []); /** * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar): * * 1) We want to show a BUTTON when the post status is at the _final stage_ * for a particular role (see https://wordpress.org/documentation/article/post-status/): * * - is published * - post status has changed explicitly to something different than 'future' or 'publish' * - is scheduled to be published * - is pending and can't be published (but only for viewports >= medium). * Originally, we considered showing a button for pending posts that couldn't be published * (for example, for an author with the contributor role). Some languages can have * long translations for "Submit for review", so given the lack of UI real estate available * we decided to take into account the viewport in that case. * See: https://github.com/WordPress/gutenberg/issues/10475 * * 2) Then, in small viewports, we'll show a TOGGLE. * * 3) Finally, we'll use the publish sidebar status to decide: * * - if it is enabled, we show a TOGGLE * - if it is disabled, we show a BUTTON */ if (isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) { component = IS_BUTTON; } else if (isSmallerThanMediumViewport || isPublishSidebarEnabled) { component = IS_TOGGLE; } else { component = IS_BUTTON; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button, { forceIsDirty: forceIsDirty, isOpen: isPublishSidebarOpened, isToggle: component === IS_TOGGLE, onToggle: togglePublishSidebar, setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-view-link/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostViewLink() { const { hasLoaded, permalink, isPublished, label, showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)(select => { // Grab post type to retrieve the view_item label. const postTypeSlug = select(store_store).getCurrentPostType(); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); const { get } = select(external_wp_preferences_namespaceObject.store); return { permalink: select(store_store).getPermalink(), isPublished: select(store_store).isCurrentPostPublished(), label: postType?.labels.view_item, hasLoaded: !!postType, showIconLabels: get('core', 'showIconLabels') }; }, []); // Only render the view button if the post is published and has a permalink. if (!isPublished || !permalink || !hasLoaded) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: library_external, label: label || (0,external_wp_i18n_namespaceObject.__)('View post'), href: permalink, target: "_blank", showTooltip: !showIconLabels, size: "compact" }); } ;// ./node_modules/@wordpress/icons/build-module/library/desktop.js /** * WordPress dependencies */ const desktop = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z" }) }); /* harmony default export */ const library_desktop = (desktop); ;// ./node_modules/@wordpress/icons/build-module/library/mobile.js /** * WordPress dependencies */ const mobile = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) }); /* harmony default export */ const library_mobile = (mobile); ;// ./node_modules/@wordpress/icons/build-module/library/tablet.js /** * WordPress dependencies */ const tablet = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z" }) }); /* harmony default export */ const library_tablet = (tablet); ;// ./node_modules/@wordpress/editor/build-module/components/preview-dropdown/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function PreviewDropdown({ forceIsAutosaveable, disabled }) { const { deviceType, homeUrl, isTemplate, isViewable, showIconLabels, isTemplateHidden, templateId } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getPostType$viewable; const { getDeviceType, getCurrentPostType, getCurrentTemplateId } = select(store_store); const { getRenderingMode } = unlock(select(store_store)); const { getEntityRecord, getPostType } = select(external_wp_coreData_namespaceObject.store); const { get } = select(external_wp_preferences_namespaceObject.store); const _currentPostType = getCurrentPostType(); return { deviceType: getDeviceType(), homeUrl: getEntityRecord('root', '__unstableBase')?.home, isTemplate: _currentPostType === 'wp_template', isViewable: (_getPostType$viewable = getPostType(_currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false, showIconLabels: get('core', 'showIconLabels'), isTemplateHidden: getRenderingMode() === 'post-only', templateId: getCurrentTemplateId() }; }, []); const { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); const { resetZoomLevel } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); const handleDevicePreviewChange = newDeviceType => { setDeviceType(newDeviceType); resetZoomLevel(); }; const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); if (isMobile) { return null; } const popoverProps = { placement: 'bottom-end' }; const toggleProps = { className: 'editor-preview-dropdown__toggle', iconPosition: 'right', size: 'compact', showTooltip: !showIconLabels, disabled, accessibleWhenDisabled: disabled }; const menuProps = { 'aria-label': (0,external_wp_i18n_namespaceObject.__)('View options') }; const deviceIcons = { desktop: library_desktop, mobile: library_mobile, tablet: library_tablet }; /** * The choices for the device type. * * @type {Array} */ const choices = [{ value: 'Desktop', label: (0,external_wp_i18n_namespaceObject.__)('Desktop'), icon: library_desktop }, { value: 'Tablet', label: (0,external_wp_i18n_namespaceObject.__)('Tablet'), icon: library_tablet }, { value: 'Mobile', label: (0,external_wp_i18n_namespaceObject.__)('Mobile'), icon: library_mobile }]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { className: dist_clsx('editor-preview-dropdown', `editor-preview-dropdown--${deviceType.toLowerCase()}`), popoverProps: popoverProps, toggleProps: toggleProps, menuProps: menuProps, icon: deviceIcons[deviceType.toLowerCase()], label: (0,external_wp_i18n_namespaceObject.__)('View'), disableOpenOnArrowDown: disabled, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { choices: choices, value: deviceType, onSelect: handleDevicePreviewChange }) }), isTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { href: homeUrl, target: "_blank", icon: library_external, onClick: onClose, children: [(0,external_wp_i18n_namespaceObject.__)('View site'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: /* translators: accessibility text */ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') })] }) }), !isTemplate && !!templateId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: !isTemplateHidden ? library_check : undefined, isSelected: !isTemplateHidden, role: "menuitemcheckbox", onClick: () => { const newRenderingMode = isTemplateHidden ? 'template-locked' : 'post-only'; setRenderingMode(newRenderingMode); setDefaultRenderingMode(newRenderingMode); }, children: (0,external_wp_i18n_namespaceObject.__)('Show template') }) }), isViewable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewButton, { className: "editor-preview-dropdown__button-external", role: "menuitem", forceIsAutosaveable: forceIsAutosaveable, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), textContent: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [(0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: library_external })] }), onPreview: onClose }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item.Slot, { name: "core/plugin-preview-menu", fillProps: { onClick: onClose } })] }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/square.js /** * WordPress dependencies */ const square = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fill: "none", d: "M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "square" }) }); /* harmony default export */ const library_square = (square); ;// ./node_modules/@wordpress/editor/build-module/components/zoom-out-toggle/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const ZoomOutToggle = ({ disabled }) => { const { isZoomOut, showIconLabels, isDistractionFree } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ isZoomOut: unlock(select(external_wp_blockEditor_namespaceObject.store)).isZoomOut(), showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'), isDistractionFree: select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree') })); const { resetZoomLevel, setZoomLevel } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); const { registerShortcut, unregisterShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: 'core/editor/zoom', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Enter or exit zoom out.'), keyCombination: { // `primaryShift+0` (`ctrl+shift+0`) is the shortcut for switching // to input mode in Windows, so apply a different key combination. modifier: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? 'primaryShift' : 'secondary', character: '0' } }); return () => { unregisterShortcut('core/editor/zoom'); }; }, [registerShortcut, unregisterShortcut]); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/zoom', () => { if (isZoomOut) { resetZoomLevel(); } else { setZoomLevel('auto-scaled'); } }, { isDisabled: isDistractionFree }); const handleZoomOut = () => { if (isZoomOut) { resetZoomLevel(); } else { setZoomLevel('auto-scaled'); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { accessibleWhenDisabled: true, disabled: disabled, onClick: handleZoomOut, icon: library_square, label: (0,external_wp_i18n_namespaceObject.__)('Zoom Out'), isPressed: isZoomOut, size: "compact", showTooltip: !showIconLabels, className: "editor-zoom-out-toggle" }); }; /* harmony default export */ const zoom_out_toggle = (ZoomOutToggle); ;// ./node_modules/@wordpress/editor/build-module/components/header/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const isBlockCommentExperimentEnabled = window?.__experimentalEnableBlockComment; const toolbarVariations = { distractionFreeDisabled: { y: '-50px' }, distractionFreeHover: { y: 0 }, distractionFreeHidden: { y: '-50px' }, visible: { y: 0 }, hidden: { y: 0 } }; const backButtonVariations = { distractionFreeDisabled: { x: '-100%' }, distractionFreeHover: { x: 0 }, distractionFreeHidden: { x: '-100%' }, visible: { x: 0 }, hidden: { x: 0 } }; function header_Header({ customSaveButton, forceIsDirty, forceDisableBlockTools, setEntitiesSavedStatesCallback, title }) { const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const isTooNarrowForDocumentBar = (0,external_wp_compose_namespaceObject.useMediaQuery)('(max-width: 403px)'); const { postType, isTextEditor, isPublishSidebarOpened, showIconLabels, hasFixedToolbar, hasBlockSelection, hasSectionRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { get: getPreference } = select(external_wp_preferences_namespaceObject.store); const { getEditorMode, getCurrentPostType, isPublishSidebarOpened: _isPublishSidebarOpened } = select(store_store); const { getBlockSelectionStart, getSectionRootClientId } = unlock(select(external_wp_blockEditor_namespaceObject.store)); return { postType: getCurrentPostType(), isTextEditor: getEditorMode() === 'text', isPublishSidebarOpened: _isPublishSidebarOpened(), showIconLabels: getPreference('core', 'showIconLabels'), hasFixedToolbar: getPreference('core', 'fixedToolbar'), hasBlockSelection: !!getBlockSelectionStart(), hasSectionRootClientId: !!getSectionRootClientId() }; }, []); const canBeZoomedOut = ['post', 'page', 'wp_template'].includes(postType) && hasSectionRootClientId; const disablePreviewOption = [NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE].includes(postType) || forceDisableBlockTools; const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0,external_wp_element_namespaceObject.useState)(true); const hasCenter = !isTooNarrowForDocumentBar && (!hasFixedToolbar || hasFixedToolbar && (!hasBlockSelection || isBlockToolsCollapsed)); const hasBackButton = useHasBackButton(); /* * The edit-post-header classname is only kept for backward compatibility * as some plugins might be relying on its presence. */ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-header edit-post-header", children: [hasBackButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { className: "editor-header__back-button", variants: backButtonVariations, transition: { type: 'tween' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button.Slot, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: toolbarVariations, className: "editor-header__toolbar", transition: { type: 'tween' }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_tools, { disableBlockTools: forceDisableBlockTools || isTextEditor }), hasFixedToolbar && isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CollapsibleBlockToolbar, { isCollapsed: isBlockToolsCollapsed, onToggle: setIsBlockToolsCollapsed })] }), hasCenter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { className: "editor-header__center", variants: toolbarVariations, transition: { type: 'tween' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentBar, { title: title }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: toolbarVariations, transition: { type: 'tween' }, className: "editor-header__settings", children: [!customSaveButton && !isPublishSidebarOpened && /*#__PURE__*/ /* * This button isn't completely hidden by the publish sidebar. * We can't hide the whole toolbar when the publish sidebar is open because * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node. * We track that DOM node to return focus to the PostPublishButtonOrToggle * when the publish sidebar has been closed. */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSavedState, { forceIsDirty: forceIsDirty }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostViewLink, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewDropdown, { forceIsAutosaveable: forceIsDirty, disabled: disablePreviewOption }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewButton, { className: "editor-header__post-preview-button", forceIsAutosaveable: forceIsDirty }), isWideViewport && canBeZoomedOut && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(zoom_out_toggle, { disabled: forceDisableBlockTools }), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items.Slot, { scope: "core" }), !customSaveButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishButtonOrToggle, { forceIsDirty: forceIsDirty, setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback }), isBlockCommentExperimentEnabled ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CollabSidebar, {}) : undefined, customSaveButton, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {})] })] }); } /* harmony default export */ const components_header = (header_Header); ;// ./node_modules/@wordpress/editor/build-module/components/inserter-sidebar/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { PrivateInserterLibrary } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function InserterSidebar() { const { blockSectionRootClientId, inserterSidebarToggleRef, inserter, showMostUsedBlocks, sidebarIsOpened } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getInserterSidebarToggleRef, getInserter, isPublishSidebarOpened } = unlock(select(store_store)); const { getBlockRootClientId, isZoomOut, getSectionRootClientId } = unlock(select(external_wp_blockEditor_namespaceObject.store)); const { get } = select(external_wp_preferences_namespaceObject.store); const { getActiveComplementaryArea } = select(store); const getBlockSectionRootClientId = () => { if (isZoomOut()) { const sectionRootClientId = getSectionRootClientId(); if (sectionRootClientId) { return sectionRootClientId; } } return getBlockRootClientId(); }; return { inserterSidebarToggleRef: getInserterSidebarToggleRef(), inserter: getInserter(), showMostUsedBlocks: get('core', 'mostUsedBlocks'), blockSectionRootClientId: getBlockSectionRootClientId(), sidebarIsOpened: !!(getActiveComplementaryArea('core') || isPublishSidebarOpened()) }; }, []); const { setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); // When closing the inserter, focus should return to the toggle button. const closeInserterSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsInserterOpened(false); inserterSidebarToggleRef.current?.focus(); }, [inserterSidebarToggleRef, setIsInserterOpened]); const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => { if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { event.preventDefault(); closeInserterSidebar(); } }, [closeInserterSidebar]); const inserterContents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-inserter-sidebar__content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterLibrary, { showMostUsedBlocks: showMostUsedBlocks, showInserterHelpPanel: true, shouldFocusBlock: isMobileViewport, rootClientId: blockSectionRootClientId, onSelect: inserter.onSelect, __experimentalInitialTab: inserter.tab, __experimentalInitialCategory: inserter.category, __experimentalFilterValue: inserter.filterValue, onPatternCategorySelection: sidebarIsOpened ? () => disableComplementaryArea('core') : undefined, ref: libraryRef, onClose: closeInserterSidebar }) }); return ( /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/no-static-element-interactions (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { onKeyDown: closeOnEscape, className: "editor-inserter-sidebar", children: inserterContents }) ); } ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/list-view-outline.js /** * WordPress dependencies */ /** * Internal dependencies */ function ListViewOutline() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-list-view-sidebar__outline", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('Characters:') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('Words:') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {})] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('Time to read:') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {})] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, {})] }); } ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { TabbedSidebar } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ListViewSidebar() { const { setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { getListViewToggleRef } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store)); // This hook handles focus when the sidebar first renders. const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); // When closing the list view, focus should return to the toggle button. const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsListViewOpened(false); getListViewToggleRef().current?.focus(); }, [getListViewToggleRef, setIsListViewOpened]); const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => { if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { event.preventDefault(); closeListView(); } }, [closeListView]); // Use internal state instead of a ref to make sure that the component // re-renders when the dropZoneElement updates. const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null); // Tracks our current tab. const [tab, setTab] = (0,external_wp_element_namespaceObject.useState)('list-view'); // This ref refers to the sidebar as a whole. const sidebarRef = (0,external_wp_element_namespaceObject.useRef)(); // This ref refers to the tab panel. const tabsRef = (0,external_wp_element_namespaceObject.useRef)(); // This ref refers to the list view application area. const listViewRef = (0,external_wp_element_namespaceObject.useRef)(); // Must merge the refs together so focus can be handled properly in the next function. const listViewContainerRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([focusOnMountRef, listViewRef, setDropZoneElement]); /* * Callback function to handle list view or outline focus. * * @param {string} currentTab The current tab. Either list view or outline. * * @return void */ function handleSidebarFocus(currentTab) { // Tab panel focus. const tabPanelFocus = external_wp_dom_namespaceObject.focus.tabbable.find(tabsRef.current)[0]; // List view tab is selected. if (currentTab === 'list-view') { // Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks. const listViewApplicationFocus = external_wp_dom_namespaceObject.focus.tabbable.find(listViewRef.current)[0]; const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : tabPanelFocus; listViewFocusArea.focus(); // Outline tab is selected. } else { tabPanelFocus.focus(); } } const handleToggleListViewShortcut = (0,external_wp_element_namespaceObject.useCallback)(() => { // If the sidebar has focus, it is safe to close. if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) { closeListView(); } else { // If the list view or outline does not have focus, focus should be moved to it. handleSidebarFocus(tab); } }, [closeListView, tab]); // This only fires when the sidebar is open because of the conditional rendering. // It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', handleToggleListViewShortcut); return ( /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/no-static-element-interactions (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar", onKeyDown: closeOnEscape, ref: sidebarRef, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TabbedSidebar, { tabs: [{ name: 'list-view', title: (0,external_wp_i18n_namespaceObject._x)('List View', 'Post overview'), panel: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar__list-view-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar__list-view-panel-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalListView, { dropZoneElement: dropZoneElement }) }) }), panelRef: listViewContainerRef }, { name: 'outline', title: (0,external_wp_i18n_namespaceObject._x)('Outline', 'Post overview'), panel: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar__list-view-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewOutline, {}) }) }], onClose: closeListView, onSelect: tabName => setTab(tabName), defaultTabId: "list-view", ref: tabsRef, closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close') }) }) ); } ;// ./node_modules/@wordpress/editor/build-module/components/save-publish-panels/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Fill: save_publish_panels_Fill, Slot: save_publish_panels_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel'); const ActionsPanelFill = (/* unused pure expression or super */ null && (save_publish_panels_Fill)); function SavePublishPanels({ setEntitiesSavedStatesCallback, closeEntitiesSavedStates, isEntitiesSavedStatesOpen, forceIsDirtyPublishPanel }) { const { closePublishSidebar, togglePublishSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { publishSidebarOpened, isPublishable, isDirty, hasOtherEntitiesChanges } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isPublishSidebarOpened, isEditedPostPublishable, isCurrentPostPublished, isEditedPostDirty, hasNonPostEntityChanges } = select(store_store); const _hasOtherEntitiesChanges = hasNonPostEntityChanges(); return { publishSidebarOpened: isPublishSidebarOpened(), isPublishable: !isCurrentPostPublished() && isEditedPostPublishable(), isDirty: _hasOtherEntitiesChanges || isEditedPostDirty(), hasOtherEntitiesChanges: _hasOtherEntitiesChanges }; }, []); const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []); // It is ok for these components to be unmounted when not in visual use. // We don't want more than one present at a time, decide which to render. let unmountableContent; if (publishSidebarOpened) { unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_panel, { onClose: closePublishSidebar, forceIsDirty: forceIsDirtyPublishPanel, PrePublishExtension: plugin_pre_publish_panel.Slot, PostPublishExtension: plugin_post_publish_panel.Slot }); } else if (isPublishable && !hasOtherEntitiesChanges) { unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-layout__toggle-publish-panel", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: togglePublishSidebar, "aria-expanded": false, children: (0,external_wp_i18n_namespaceObject.__)('Open publish panel') }) }); } else { unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-layout__toggle-entities-saved-states-panel", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: openEntitiesSavedStates, "aria-expanded": false, "aria-haspopup": "dialog", disabled: !isDirty, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Open save panel') }) }); } // Since EntitiesSavedStates controls its own panel, we can keep it // always mounted to retain its own component state (such as checkboxes). return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isEntitiesSavedStatesOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStates, { close: closeEntitiesSavedStates, renderDialog: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(save_publish_panels_Slot, { bubblesVirtually: true }), !isEntitiesSavedStatesOpen && unmountableContent] }); } ;// ./node_modules/@wordpress/editor/build-module/components/text-editor/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function TextEditor({ autoFocus = false }) { const { switchEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { shortcut, isRichEditingEnabled } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditorSettings } = select(store_store); const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { shortcut: getShortcutRepresentation('core/editor/toggle-mode'), isRichEditingEnabled: getEditorSettings().richEditingEnabled }; }, []); const titleRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (autoFocus) { return; } titleRef?.current?.focus(); }, [autoFocus]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-text-editor", children: [isRichEditingEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-text-editor__toolbar", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { children: (0,external_wp_i18n_namespaceObject.__)('Editing code') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => switchEditorMode('visual'), shortcut: shortcut, children: (0,external_wp_i18n_namespaceObject.__)('Exit code editor') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-text-editor__body", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title_raw, { ref: titleRef }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTextEditor, {})] })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/edit-template-blocks-notification.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Component that: * * - Displays a 'Edit your template to edit this block' notification when the * user is focusing on editing page content and clicks on a disabled template * block. * - Displays a 'Edit your template to edit this block' dialog when the user * is focusing on editing page content and double clicks on a disabled * template block. * * @param {Object} props * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block * editor iframe canvas. */ function EditTemplateBlocksNotification({ contentRef }) { const { onNavigateToEntityRecord, templateId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditorSettings, getCurrentTemplateId } = select(store_store); return { onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, templateId: getCurrentTemplateId() }; }, []); const canEditTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: 'wp_template' }), []); const [isDialogOpen, setIsDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const handleDblClick = event => { if (!canEditTemplate) { return; } if (!event.target.classList.contains('is-root-container') || event.target.dataset?.type === 'core/template-part') { return; } if (!event.defaultPrevented) { event.preventDefault(); setIsDialogOpen(true); } }; const canvas = contentRef.current; canvas?.addEventListener('dblclick', handleDblClick); return () => { canvas?.removeEventListener('dblclick', handleDblClick); }; }, [contentRef, canEditTemplate]); if (!canEditTemplate) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: isDialogOpen, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Edit template'), onConfirm: () => { setIsDialogOpen(false); onNavigateToEntityRecord({ postId: templateId, postType: 'wp_template' }); }, onCancel: () => setIsDialogOpen(false), size: "medium", children: (0,external_wp_i18n_namespaceObject.__)('You’ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?') }); } ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/resize-handle.js /** * WordPress dependencies */ const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels. function ResizeHandle({ direction, resizeWidthBy }) { function handleKeyDown(event) { const { keyCode } = event; if (keyCode !== external_wp_keycodes_namespaceObject.LEFT && keyCode !== external_wp_keycodes_namespaceObject.RIGHT) { return; } event.preventDefault(); if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) { resizeWidthBy(DELTA_DISTANCE); } else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) { resizeWidthBy(-DELTA_DISTANCE); } } const resizeHandleVariants = { active: { opacity: 1, scaleY: 1.3 } }; const resizableHandleHelpId = `resizable-editor__resize-help-${direction}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.button, { className: `editor-resizable-editor__resize-handle is-${direction}`, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), "aria-describedby": resizableHandleHelpId, onKeyDown: handleKeyDown, variants: resizeHandleVariants, whileFocus: "active", whileHover: "active", whileTap: "active", role: "separator", "aria-orientation": "vertical" }, "handle") }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: resizableHandleHelpId, children: (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.') })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ // Removes the inline styles in the drag handles. const HANDLE_STYLES_OVERRIDE = { position: undefined, userSelect: undefined, cursor: undefined, width: undefined, height: undefined, top: undefined, right: undefined, bottom: undefined, left: undefined }; function ResizableEditor({ className, enableResizing, height, children }) { const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)('100%'); const resizableRef = (0,external_wp_element_namespaceObject.useRef)(); const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => { if (resizableRef.current) { setWidth(resizableRef.current.offsetWidth + deltaPixels); } }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { className: dist_clsx('editor-resizable-editor', className, { 'is-resizable': enableResizing }), ref: api => { resizableRef.current = api?.resizable; }, size: { width: enableResizing ? width : '100%', height: enableResizing && height ? height : '100%' }, onResizeStop: (event, direction, element) => { setWidth(element.style.width); }, minWidth: 300, maxWidth: "100%", maxHeight: "100%", enable: { left: enableResizing, right: enableResizing }, showHandle: enableResizing // The editor is centered horizontally, resizing it only // moves half the distance. Hence double the ratio to correctly // align the cursor to the resizer handle. , resizeRatio: 2, handleComponent: { left: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizeHandle, { direction: "left", resizeWidthBy: resizeWidthBy }), right: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizeHandle, { direction: "right", resizeWidthBy: resizeWidthBy }) }, handleClasses: undefined, handleStyles: { left: HANDLE_STYLES_OVERRIDE, right: HANDLE_STYLES_OVERRIDE }, children: children }); } /* harmony default export */ const resizable_editor = (ResizableEditor); ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/use-select-nearest-editable-block.js /** * WordPress dependencies */ /** * Internal dependencies */ const DISTANCE_THRESHOLD = 500; function clamp(value, min, max) { return Math.min(Math.max(value, min), max); } function distanceFromRect(x, y, rect) { const dx = x - clamp(x, rect.left, rect.right); const dy = y - clamp(y, rect.top, rect.bottom); return Math.sqrt(dx * dx + dy * dy); } function useSelectNearestEditableBlock({ isEnabled = true } = {}) { const { getEnabledClientIdsTree, getBlockName, getBlockOrder } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store)); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { if (!isEnabled) { return; } const selectNearestEditableBlock = (x, y) => { const editableBlockClientIds = getEnabledClientIdsTree().flatMap(({ clientId }) => { const blockName = getBlockName(clientId); if (blockName === 'core/template-part') { return []; } if (blockName === 'core/post-content') { const innerBlocks = getBlockOrder(clientId); if (innerBlocks.length) { return innerBlocks; } } return [clientId]; }); let nearestDistance = Infinity, nearestClientId = null; for (const clientId of editableBlockClientIds) { const block = element.querySelector(`[data-block="${clientId}"]`); if (!block) { continue; } const rect = block.getBoundingClientRect(); const distance = distanceFromRect(x, y, rect); if (distance < nearestDistance && distance < DISTANCE_THRESHOLD) { nearestDistance = distance; nearestClientId = clientId; } } if (nearestClientId) { selectBlock(nearestClientId); } }; const handleClick = event => { const shouldSelect = event.target === element || event.target.classList.contains('is-root-container'); if (shouldSelect) { selectNearestEditableBlock(event.clientX, event.clientY); } }; element.addEventListener('click', handleClick); return () => element.removeEventListener('click', handleClick); }, [isEnabled]); } ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/use-zoom-out-mode-exit.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Allows Zoom Out mode to be exited by double clicking in the selected block. */ function useZoomOutModeExit() { const { getSettings, isZoomOut } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store)); const { resetZoomLevel } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onDoubleClick(event) { if (!isZoomOut()) { return; } if (!event.defaultPrevented) { event.preventDefault(); const { __experimentalSetIsInserterOpened } = getSettings(); if (typeof __experimentalSetIsInserterOpened === 'function') { __experimentalSetIsInserterOpened(false); } resetZoomLevel(); } } node.addEventListener('dblclick', onDoubleClick); return () => { node.removeEventListener('dblclick', onDoubleClick); }; }, [getSettings, isZoomOut, resetZoomLevel]); } ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { LayoutStyle, useLayoutClasses, useLayoutStyles, ExperimentalBlockCanvas: BlockCanvas, useFlashEditableBlocks } = unlock(external_wp_blockEditor_namespaceObject.privateApis); /** * These post types have a special editor where they don't allow you to fill the title * and they don't apply the layout styles. */ const visual_editor_DESIGN_POST_TYPES = [PATTERN_POST_TYPE, TEMPLATE_POST_TYPE, NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE]; /** * Given an array of nested blocks, find the first Post Content * block inside it, recursing through any nesting levels, * and return its attributes. * * @param {Array} blocks A list of blocks. * * @return {Object | undefined} The Post Content block. */ function getPostContentAttributes(blocks) { for (let i = 0; i < blocks.length; i++) { if (blocks[i].name === 'core/post-content') { return blocks[i].attributes; } if (blocks[i].innerBlocks.length) { const nestedPostContent = getPostContentAttributes(blocks[i].innerBlocks); if (nestedPostContent) { return nestedPostContent; } } } } function checkForPostContentAtRootLevel(blocks) { for (let i = 0; i < blocks.length; i++) { if (blocks[i].name === 'core/post-content') { return true; } } return false; } function VisualEditor({ // Ideally as we unify post and site editors, we won't need these props. autoFocus, styles, disableIframe = false, iframeProps, contentRef, className }) { const [contentHeight, setContentHeight] = (0,external_wp_element_namespaceObject.useState)(''); const effectContentHeight = (0,external_wp_compose_namespaceObject.useResizeObserver)(([entry]) => { setContentHeight(entry.borderBoxSize[0].blockSize); }); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); const { renderingMode, postContentAttributes, editedPostTemplate = {}, wrapperBlockName, wrapperUniqueId, deviceType, isFocusedEntity, isDesignPostType, postType, isPreview } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostId, getCurrentPostType, getCurrentTemplateId, getEditorSettings, getRenderingMode, getDeviceType } = select(store_store); const { getPostType, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const postTypeSlug = getCurrentPostType(); const _renderingMode = getRenderingMode(); let _wrapperBlockName; if (postTypeSlug === PATTERN_POST_TYPE) { _wrapperBlockName = 'core/block'; } else if (_renderingMode === 'post-only') { _wrapperBlockName = 'core/post-content'; } const editorSettings = getEditorSettings(); const supportsTemplateMode = editorSettings.supportsTemplateMode; const postTypeObject = getPostType(postTypeSlug); const currentTemplateId = getCurrentTemplateId(); const template = currentTemplateId ? getEditedEntityRecord('postType', TEMPLATE_POST_TYPE, currentTemplateId) : undefined; return { renderingMode: _renderingMode, postContentAttributes: editorSettings.postContentAttributes, isDesignPostType: visual_editor_DESIGN_POST_TYPES.includes(postTypeSlug), // Post template fetch returns a 404 on classic themes, which // messes with e2e tests, so check it's a block theme first. editedPostTemplate: postTypeObject?.viewable && supportsTemplateMode ? template : undefined, wrapperBlockName: _wrapperBlockName, wrapperUniqueId: getCurrentPostId(), deviceType: getDeviceType(), isFocusedEntity: !!editorSettings.onNavigateToPreviousEntityRecord, postType: postTypeSlug, isPreview: editorSettings.isPreviewMode }; }, []); const { isCleanNewPost } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { hasRootPaddingAwareAlignments, themeHasDisabledLayoutStyles, themeSupportsLayout, isZoomedOut } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings, isZoomOut: _isZoomOut } = unlock(select(external_wp_blockEditor_namespaceObject.store)); const _settings = getSettings(); return { themeHasDisabledLayoutStyles: _settings.disableLayoutStyles, themeSupportsLayout: _settings.supportsLayout, hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments, isZoomedOut: _isZoomOut() }; }, []); const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType); const [globalLayoutSettings] = (0,external_wp_blockEditor_namespaceObject.useSettings)('layout'); // fallbackLayout is used if there is no Post Content, // and for Post Title. const fallbackLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { if (renderingMode !== 'post-only' || isDesignPostType) { return { type: 'default' }; } if (themeSupportsLayout) { // We need to ensure support for wide and full alignments, // so we add the constrained type. return { ...globalLayoutSettings, type: 'constrained' }; } // Set default layout for classic themes so all alignments are supported. return { type: 'default' }; }, [renderingMode, themeSupportsLayout, globalLayoutSettings, isDesignPostType]); const newestPostContentAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!editedPostTemplate?.content && !editedPostTemplate?.blocks && postContentAttributes) { return postContentAttributes; } // When in template editing mode, we can access the blocks directly. if (editedPostTemplate?.blocks) { return getPostContentAttributes(editedPostTemplate?.blocks); } // If there are no blocks, we have to parse the content string. // Best double-check it's a string otherwise the parse function gets unhappy. const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : ''; return getPostContentAttributes((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || {}; }, [editedPostTemplate?.content, editedPostTemplate?.blocks, postContentAttributes]); const hasPostContentAtRootLevel = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!editedPostTemplate?.content && !editedPostTemplate?.blocks) { return false; } // When in template editing mode, we can access the blocks directly. if (editedPostTemplate?.blocks) { return checkForPostContentAtRootLevel(editedPostTemplate?.blocks); } // If there are no blocks, we have to parse the content string. // Best double-check it's a string otherwise the parse function gets unhappy. const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : ''; return checkForPostContentAtRootLevel((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || false; }, [editedPostTemplate?.content, editedPostTemplate?.blocks]); const { layout = {}, align = '' } = newestPostContentAttributes || {}; const postContentLayoutClasses = useLayoutClasses(newestPostContentAttributes, 'core/post-content'); const blockListLayoutClass = dist_clsx({ 'is-layout-flow': !themeSupportsLayout }, themeSupportsLayout && postContentLayoutClasses, align && `align${align}`); const postContentLayoutStyles = useLayoutStyles(newestPostContentAttributes, 'core/post-content', '.block-editor-block-list__layout.is-root-container'); // Update type for blocks using legacy layouts. const postContentLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { return layout && (layout?.type === 'constrained' || layout?.inherit || layout?.contentSize || layout?.wideSize) ? { ...globalLayoutSettings, ...layout, type: 'constrained' } : { ...globalLayoutSettings, ...layout, type: 'default' }; }, [layout?.type, layout?.inherit, layout?.contentSize, layout?.wideSize, globalLayoutSettings]); // If there is a Post Content block we use its layout for the block list; // if not, this must be a classic theme, in which case we use the fallback layout. const blockListLayout = postContentAttributes ? postContentLayout : fallbackLayout; const postEditorLayout = blockListLayout?.type === 'default' && !hasPostContentAtRootLevel ? fallbackLayout : blockListLayout; const observeTypingRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(); const titleRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!autoFocus || !isCleanNewPost()) { return; } titleRef?.current?.focus(); }, [autoFocus, isCleanNewPost]); // Add some styles for alignwide/alignfull Post Content and its children. const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;} .is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);} .is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;} .is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`; const forceFullHeight = postType === NAVIGATION_POST_TYPE; const enableResizing = [NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE].includes(postType) && // Disable in previews / view mode. !isPreview && // Disable resizing in mobile viewport. !isMobileViewport && // Disable resizing in zoomed-out mode. !isZoomedOut; const iframeStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { return [...(styles !== null && styles !== void 0 ? styles : []), { // Ensures margins of children are contained so that the body background paints behind them. // Otherwise, the background of html (when zoomed out) would show there and appear broken. It’s // important mostly for post-only views yet conceivably an issue in templated views too. css: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${ // Some themes will have `min-height: 100vh` for the root container, // which isn't a requirement in auto resize mode. enableResizing ? 'min-height:0!important;' : ''}}` }]; }, [styles, enableResizing]); const localRef = (0,external_wp_element_namespaceObject.useRef)(); const typewriterRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)(); contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([localRef, contentRef, renderingMode === 'post-only' ? typewriterRef : null, useFlashEditableBlocks({ isEnabled: renderingMode === 'template-locked' }), useSelectNearestEditableBlock({ isEnabled: renderingMode === 'template-locked' }), useZoomOutModeExit(), // Avoid resize listeners when not needed, these will trigger // unnecessary re-renders when animating the iframe width. enableResizing ? effectContentHeight : null]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('editor-visual-editor', // this class is here for backward compatibility reasons. 'edit-post-visual-editor', className, { 'has-padding': isFocusedEntity || enableResizing, 'is-resizable': enableResizing, 'is-iframed': !disableIframe }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_editor, { enableResizing: enableResizing, height: contentHeight && !forceFullHeight ? contentHeight : '100%', children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockCanvas, { shouldIframe: !disableIframe, contentRef: contentRef, styles: iframeStyles, height: "100%", iframeProps: { ...iframeProps, style: { ...iframeProps?.style, ...deviceStyles } }, children: [themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === 'post-only' && !isDesignPostType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { selector: ".editor-visual-editor__post-title-wrapper", layout: fallbackLayout }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { selector: ".block-editor-block-list__layout.is-root-container", layout: postEditorLayout }), align && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { css: alignCSS }), postContentLayoutStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { layout: postContentLayout, css: postContentLayoutStyles })] }), renderingMode === 'post-only' && !isDesignPostType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('editor-visual-editor__post-title-wrapper', // The following class is only here for backward compatibility // some themes might be using it to style the post title. 'edit-post-visual-editor__post-title-wrapper', { 'has-global-padding': hasRootPaddingAwareAlignments }), contentEditable: false, ref: observeTypingRef, style: { // This is using inline styles // so it's applied for both iframed and non iframed editors. marginTop: '4rem' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title, { ref: titleRef }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.RecursionProvider, { blockName: wrapperBlockName, uniqueId: wrapperUniqueId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { className: dist_clsx('is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' || isDesignPostType ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content`, // Ensure root level blocks receive default/flow blockGap styling rules. { 'has-global-padding': renderingMode === 'post-only' && !isDesignPostType && hasRootPaddingAwareAlignments }), layout: blockListLayout, dropZoneElement: // When iframed, pass in the html element of the iframe to // ensure the drop zone extends to the edges of the iframe. disableIframe ? localRef.current : localRef.current?.parentNode, __unstableDisableDropZone: // In template preview mode, disable drop zones at the root of the template. renderingMode === 'template-locked' ? true : false }), renderingMode === 'template-locked' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditTemplateBlocksNotification, { contentRef: localRef })] })] }) }) }); } /* harmony default export */ const visual_editor = (VisualEditor); ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const interfaceLabels = { /* translators: accessibility text for the editor top bar landmark region. */ header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'), /* translators: accessibility text for the editor content landmark region. */ body: (0,external_wp_i18n_namespaceObject.__)('Editor content'), /* translators: accessibility text for the editor settings landmark region. */ sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'), /* translators: accessibility text for the editor publish landmark region. */ actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'), /* translators: accessibility text for the editor footer landmark region. */ footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer') }; function EditorInterface({ className, styles, children, forceIsDirty, contentRef, disableIframe, autoFocus, customSaveButton, customSavePanel, forceDisableBlockTools, title, iframeProps }) { const { mode, isRichEditingEnabled, isInserterOpened, isListViewOpened, isDistractionFree, isPreviewMode, showBlockBreadcrumbs, documentLabel } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { get } = select(external_wp_preferences_namespaceObject.store); const { getEditorSettings, getPostTypeLabel } = select(store_store); const editorSettings = getEditorSettings(); const postTypeLabel = getPostTypeLabel(); return { mode: select(store_store).getEditorMode(), isRichEditingEnabled: editorSettings.richEditingEnabled, isInserterOpened: select(store_store).isInserterOpened(), isListViewOpened: select(store_store).isListViewOpened(), isDistractionFree: get('core', 'distractionFree'), isPreviewMode: editorSettings.isPreviewMode, showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), documentLabel: // translators: Default label for the Document in the Block Breadcrumb. postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun, breadcrumb') }; }, []); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('Document Overview') : (0,external_wp_i18n_namespaceObject.__)('Block Library'); // Local state for save panel. // Note 'truthy' callback implies an open panel. const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false); const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => { if (typeof entitiesSavedStatesCallback === 'function') { entitiesSavedStatesCallback(arg); } setEntitiesSavedStatesCallback(false); }, [entitiesSavedStatesCallback]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(interface_skeleton, { isDistractionFree: isDistractionFree, className: dist_clsx('editor-editor-interface', className, { 'is-entity-save-view-open': !!entitiesSavedStatesCallback, 'is-distraction-free': isDistractionFree && !isPreviewMode }), labels: { ...interfaceLabels, secondarySidebar: secondarySidebarLabel }, header: !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_header, { forceIsDirty: forceIsDirty, setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback, customSaveButton: customSaveButton, forceDisableBlockTools: forceDisableBlockTools, title: title }), editorNotices: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}), secondarySidebar: !isPreviewMode && mode === 'visual' && (isInserterOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InserterSidebar, {}) || isListViewOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewSidebar, {})), sidebar: !isPreviewMode && !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area.Slot, { scope: "core" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!isDistractionFree && !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(content_slot_fill.Slot, { children: ([editorCanvasView]) => editorCanvasView ? editorCanvasView : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!isPreviewMode && (mode === 'text' || !isRichEditingEnabled) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextEditor // We should auto-focus the canvas (title) on load. // eslint-disable-next-line jsx-a11y/no-autofocus , { autoFocus: autoFocus }), !isPreviewMode && !isLargeViewport && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }), (isPreviewMode || isRichEditingEnabled && mode === 'visual') && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visual_editor, { styles: styles, contentRef: contentRef, disableIframe: disableIframe // We should auto-focus the canvas (title) on load. // eslint-disable-next-line jsx-a11y/no-autofocus , autoFocus: autoFocus, iframeProps: iframeProps }), children] }) })] }), footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && isRichEditingEnabled && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { rootLabelText: documentLabel }), actions: !isPreviewMode ? customSavePanel || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePublishPanels, { closeEntitiesSavedStates: closeEntitiesSavedStates, isEntitiesSavedStatesOpen: entitiesSavedStatesCallback, setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback, forceIsDirtyPublishPanel: forceIsDirty }) : undefined }); } ;// ./node_modules/@wordpress/editor/build-module/components/pattern-overrides-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { OverridesPanel } = unlock(external_wp_patterns_namespaceObject.privateApis); function PatternOverridesPanel() { const supportsPatternOverridesPanel = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType() === 'wp_block', []); if (!supportsPatternOverridesPanel) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverridesPanel, {}); } ;// ./node_modules/@wordpress/editor/build-module/utils/get-item-title.js /** * WordPress dependencies */ /** * Helper function to get the title of a post item. * This is duplicated from the `@wordpress/fields` package. * `packages/fields/src/actions/utils.ts` * * @param {Object} item The post item. * @return {string} The title of the item, or an empty string if the title is not found. */ function get_item_title_getItemTitle(item) { if (typeof item.title === 'string') { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); } if (item.title && 'rendered' in item.title) { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); } if (item.title && 'raw' in item.title) { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); } return ''; } ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/set-as-homepage.js /** * WordPress dependencies */ /** * Internal dependencies */ const SetAsHomepageModal = ({ items, closeModal }) => { const [item] = items; const pageTitle = get_item_title_getItemTitle(item); const { showOnFront, currentHomePage, isSaving } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = getEntityRecord('root', 'site'); const currentHomePageItem = getEntityRecord('postType', 'page', siteSettings?.page_on_front); return { showOnFront: siteSettings?.show_on_front, currentHomePage: currentHomePageItem, isSaving: isSavingEntityRecord('root', 'site') }; }); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); async function onSetPageAsHomepage(event) { event.preventDefault(); try { await saveEntityRecord('root', 'site', { page_on_front: item.id, show_on_front: 'page' }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Homepage updated.'), { type: 'snackbar' }); } catch (error) { const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while setting the homepage.'); createErrorNotice(errorMessage, { type: 'snackbar' }); } finally { closeModal?.(); } } let modalWarning = ''; if ('posts' === showOnFront) { modalWarning = (0,external_wp_i18n_namespaceObject.__)('This will replace the current homepage which is set to display latest posts.'); } else if (currentHomePage) { modalWarning = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: title of the current home page. (0,external_wp_i18n_namespaceObject.__)('This will replace the current homepage: "%s"'), get_item_title_getItemTitle(currentHomePage)); } const modalText = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: title of the page to be set as the homepage, %2$s: homepage replacement warning message. (0,external_wp_i18n_namespaceObject.__)('Set "%1$s" as the site homepage? %2$s'), pageTitle, modalWarning).trim(); // translators: Button label to confirm setting the specified page as the homepage. const modalButtonLabel = (0,external_wp_i18n_namespaceObject.__)('Set homepage'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onSetPageAsHomepage, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: modalText }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal?.(); }, disabled: isSaving, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", disabled: isSaving, accessibleWhenDisabled: true, children: modalButtonLabel })] })] }) }); }; const useSetAsHomepageAction = () => { const { pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEntityRecord('root', 'site') : undefined; return { pageOnFront: siteSettings?.page_on_front, pageForPosts: siteSettings?.page_for_posts }; }); return (0,external_wp_element_namespaceObject.useMemo)(() => ({ id: 'set-as-homepage', label: (0,external_wp_i18n_namespaceObject.__)('Set as homepage'), isEligible(post) { if (post.status !== 'publish') { return false; } if (post.type !== 'page') { return false; } // Don't show the action if the page is already set as the homepage. if (pageOnFront === post.id) { return false; } // Don't show the action if the page is already set as the page for posts. if (pageForPosts === post.id) { return false; } return true; }, RenderModal: SetAsHomepageModal }), [pageForPosts, pageOnFront]); }; ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/set-as-posts-page.js /** * WordPress dependencies */ /** * Internal dependencies */ const SetAsPostsPageModal = ({ items, closeModal }) => { const [item] = items; const pageTitle = get_item_title_getItemTitle(item); const { currentPostsPage, isPageForPostsSet, isSaving } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = getEntityRecord('root', 'site'); const currentPostsPageItem = getEntityRecord('postType', 'page', siteSettings?.page_for_posts); return { currentPostsPage: currentPostsPageItem, isPageForPostsSet: siteSettings?.page_for_posts !== 0, isSaving: isSavingEntityRecord('root', 'site') }; }); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); async function onSetPageAsPostsPage(event) { event.preventDefault(); try { await saveEntityRecord('root', 'site', { page_for_posts: item.id, show_on_front: 'page' }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Posts page updated.'), { type: 'snackbar' }); } catch (error) { const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while setting the posts page.'); createErrorNotice(errorMessage, { type: 'snackbar' }); } finally { closeModal?.(); } } const modalWarning = isPageForPostsSet && currentPostsPage ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: title of the current posts page. (0,external_wp_i18n_namespaceObject.__)('This will replace the current posts page: "%s"'), get_item_title_getItemTitle(currentPostsPage)) : (0,external_wp_i18n_namespaceObject.__)('This page will show the latest posts.'); const modalText = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: title of the page to be set as the posts page, %2$s: posts page replacement warning message. (0,external_wp_i18n_namespaceObject.__)('Set "%1$s" as the posts page? %2$s'), pageTitle, modalWarning); // translators: Button label to confirm setting the specified page as the posts page. const modalButtonLabel = (0,external_wp_i18n_namespaceObject.__)('Set posts page'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onSetPageAsPostsPage, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: modalText }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal?.(); }, disabled: isSaving, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", disabled: isSaving, accessibleWhenDisabled: true, children: modalButtonLabel })] })] }) }); }; const useSetAsPostsPageAction = () => { const { pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEntityRecord('root', 'site') : undefined; return { pageOnFront: siteSettings?.page_on_front, pageForPosts: siteSettings?.page_for_posts }; }); return (0,external_wp_element_namespaceObject.useMemo)(() => ({ id: 'set-as-posts-page', label: (0,external_wp_i18n_namespaceObject.__)('Set as posts page'), isEligible(post) { if (post.status !== 'publish') { return false; } if (post.type !== 'page') { return false; } // Don't show the action if the page is already set as the homepage. if (pageOnFront === post.id) { return false; } // Don't show the action if the page is already set as the page for posts. if (pageForPosts === post.id) { return false; } return true; }, RenderModal: SetAsPostsPageModal }), [pageForPosts, pageOnFront]); }; ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/actions.js /** * WordPress dependencies */ /** * Internal dependencies */ function usePostActions({ postType, onActionPerformed, context }) { const { defaultActions } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityActions } = unlock(select(store_store)); return { defaultActions: getEntityActions('postType', postType) }; }, [postType]); const { canManageOptions, hasFrontPageTemplate } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store); const templates = getEntityRecords('postType', 'wp_template', { per_page: -1 }); return { canManageOptions: select(external_wp_coreData_namespaceObject.store).canUser('update', { kind: 'root', name: 'site' }), hasFrontPageTemplate: !!templates?.find(template => template?.slug === 'front-page') }; }); const setAsHomepageAction = useSetAsHomepageAction(); const setAsPostsPageAction = useSetAsPostsPageAction(); const shouldShowHomepageActions = canManageOptions && !hasFrontPageTemplate; const { registerPostTypeSchema } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); (0,external_wp_element_namespaceObject.useEffect)(() => { registerPostTypeSchema(postType); }, [registerPostTypeSchema, postType]); return (0,external_wp_element_namespaceObject.useMemo)(() => { let actions = [...defaultActions]; if (shouldShowHomepageActions) { actions.push(setAsHomepageAction, setAsPostsPageAction); } // Ensure "Move to trash" is always the last action. actions = actions.sort((a, b) => b.id === 'move-to-trash' ? -1 : 0); // Filter actions based on provided context. If not provided // all actions are returned. We'll have a single entry for getting the actions // and the consumer should provide the context to filter the actions, if needed. // Actions should also provide the `context` they support, if it's specific, to // compare with the provided context to get all the actions. // Right now the only supported context is `list`. actions = actions.filter(action => { if (!action.context) { return true; } return action.context === context; }); if (onActionPerformed) { for (let i = 0; i < actions.length; ++i) { if (actions[i].callback) { const existingCallback = actions[i].callback; actions[i] = { ...actions[i], callback: (items, argsObject) => { existingCallback(items, { ...argsObject, onActionPerformed: _items => { if (argsObject?.onActionPerformed) { argsObject.onActionPerformed(_items); } onActionPerformed(actions[i].id, _items); } }); } }; } if (actions[i].RenderModal) { const ExistingRenderModal = actions[i].RenderModal; actions[i] = { ...actions[i], RenderModal: props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExistingRenderModal, { ...props, onActionPerformed: _items => { if (props.onActionPerformed) { props.onActionPerformed(_items); } onActionPerformed(actions[i].id, _items); } }); } }; } } } return actions; }, [context, defaultActions, onActionPerformed, setAsHomepageAction, setAsPostsPageAction, shouldShowHomepageActions]); } ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Menu, kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function PostActions({ postType, postId, onActionPerformed }) { const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); const { item, permissions } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedEntityRecord, getEntityRecordPermissions } = unlock(select(external_wp_coreData_namespaceObject.store)); return { item: getEditedEntityRecord('postType', postType, postId), permissions: getEntityRecordPermissions('postType', postType, postId) }; }, [postId, postType]); const itemWithPermissions = (0,external_wp_element_namespaceObject.useMemo)(() => { return { ...item, permissions }; }, [item, permissions]); const allActions = usePostActions({ postType, onActionPerformed }); const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { return allActions.filter(action => { return !action.isEligible || action.isEligible(itemWithPermissions); }); }, [allActions, itemWithPermissions]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { placement: "bottom-end", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Actions'), disabled: !actions.length, accessibleWhenDisabled: true, className: "editor-all-actions-button" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, { actions: actions, items: [itemWithPermissions], setActiveModalAction: setActiveModalAction }) })] }), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { action: activeModalAction, items: [itemWithPermissions], closeModal: () => setActiveModalAction(null) })] }); } // From now on all the functions on this file are copied as from the dataviews packages, // The editor packages should not be using the dataviews packages directly, // and the dataviews package should not be using the editor packages directly, // so duplicating the code here seems like the least bad option. function DropdownMenuItemTrigger({ action, onClick, items }) { const label = typeof action.label === 'string' ? action.label : action.label(items); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { onClick: onClick, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: label }) }); } function ActionModal({ action, items, closeModal }) { const label = typeof action.label === 'string' ? action.label : action.label(items); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: action.modalHeader || label, __experimentalHideHeader: !!action.hideModalHeader, onRequestClose: closeModal !== null && closeModal !== void 0 ? closeModal : () => {}, focusOnMount: "firstContentElement", size: "medium", overlayClassName: `editor-action-modal editor-action-modal__${kebabCase(action.id)}`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { items: items, closeModal: closeModal }) }); } function ActionsDropdownMenuGroup({ actions, items, setActiveModalAction }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Group, { children: actions.map(action => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItemTrigger, { action: action, onClick: () => { if ('RenderModal' in action) { setActiveModalAction(action); return; } action.callback(items, { registry }); }, items: items }, action.id); }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-card-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Badge: post_card_panel_Badge } = unlock(external_wp_components_namespaceObject.privateApis); /** * Renders a title of the post type and the available quick actions available within a 3-dot dropdown. * * @param {Object} props - Component props. * @param {string} [props.postType] - The post type string. * @param {string|string[]} [props.postId] - The post id or list of post ids. * @param {Function} [props.onActionPerformed] - A callback function for when a quick action is performed. * @return {React.ReactNode} The rendered component. */ function PostCardPanel({ postType, postId, onActionPerformed }) { const postIds = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(postId) ? postId : [postId], [postId]); const { postTitle, icon, labels } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedEntityRecord, getCurrentTheme, getPostType } = select(external_wp_coreData_namespaceObject.store); const { getPostIcon } = unlock(select(store_store)); let _title = ''; const _record = getEditedEntityRecord('postType', postType, postIds[0]); if (postIds.length === 1) { var _getCurrentTheme; const { default_template_types: templateTypes = [] } = (_getCurrentTheme = getCurrentTheme()) !== null && _getCurrentTheme !== void 0 ? _getCurrentTheme : {}; const _templateInfo = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType) ? getTemplateInfo({ template: _record, templateTypes }) : {}; _title = _templateInfo?.title || _record?.title; } return { postTitle: _title, icon: getPostIcon(postType, { area: _record?.area }), labels: getPostType(postType)?.labels }; }, [postIds, postType]); const pageTypeBadge = usePageTypeBadge(postId); let title = (0,external_wp_i18n_namespaceObject.__)('No title'); if (labels?.name && postIds.length > 1) { title = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %i number of selected items %s: Name of the plural post type e.g: "Posts". (0,external_wp_i18n_namespaceObject.__)('%i %s'), postId.length, labels?.name); } else if (postTitle) { title = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(postTitle); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, className: "editor-post-card-panel", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, className: "editor-post-card-panel__header", align: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "editor-post-card-panel__icon", icon: icon }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, { numberOfLines: 2, truncate: true, className: "editor-post-card-panel__title", as: "h2", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-card-panel__title-name", children: title }), pageTypeBadge && postIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_card_panel_Badge, { children: pageTypeBadge })] }), postIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostActions, { postType: postType, postId: postIds[0], onActionPerformed: onActionPerformed })] }), postIds.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "editor-post-card-panel__description", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the plural post type e.g: "Posts". (0,external_wp_i18n_namespaceObject.__)('Changes will be applied to all selected %s.'), labels?.name.toLowerCase()) })] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-content-information/index.js /** * WordPress dependencies */ /** * Internal dependencies */ // Taken from packages/editor/src/components/time-to-read/index.js. const post_content_information_AVERAGE_READING_RATE = 189; // This component renders the wordcount and reading time for the post. function PostContentInformation() { const { postContent } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } = select(store_store); const { canUser } = select(external_wp_coreData_namespaceObject.store); const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEntityRecord('root', 'site') : undefined; const postType = getCurrentPostType(); const _id = getCurrentPostId(); const isPostsPage = +_id === siteSettings?.page_for_posts; const showPostContentInfo = !isPostsPage && ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType); return { postContent: showPostContentInfo && getEditedPostAttribute('content') }; }, []); /* * translators: If your word count is based on single characters (e.g. East Asian characters), * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. * Do not translate into your own language. */ const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); const wordsCounted = (0,external_wp_element_namespaceObject.useMemo)(() => postContent ? (0,external_wp_wordcount_namespaceObject.count)(postContent, wordCountType) : 0, [postContent, wordCountType]); if (!wordsCounted) { return null; } const readingTime = Math.round(wordsCounted / post_content_information_AVERAGE_READING_RATE); const wordsCountText = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the number of words in the post. (0,external_wp_i18n_namespaceObject._n)('%s word', '%s words', wordsCounted), wordsCounted.toLocaleString()); const minutesText = readingTime <= 1 ? (0,external_wp_i18n_namespaceObject.__)('1 minute') : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: the number of minutes to read the post. */ (0,external_wp_i18n_namespaceObject._n)('%s minute', '%s minutes', readingTime), readingTime.toLocaleString()); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-content-information", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */ (0,external_wp_i18n_namespaceObject.__)('%1$s, %2$s read time.'), wordsCountText, minutesText) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-format/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the Post Author Panel component. * * @return {React.ReactNode} The rendered component. */ function panel_PostFormat() { const { postFormat } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute } = select(store_store); const _postFormat = getEditedPostAttribute('format'); return { postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard' }; }, []); const activeFormat = POST_FORMATS.find(format => format.id === postFormat); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatCheck, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Format'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, contentClassName: "editor-post-format__dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Current post format. (0,external_wp_i18n_namespaceObject.__)('Change format: %s'), activeFormat?.caption), onClick: onToggle, children: activeFormat?.caption }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-format__dialog-content", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Format'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormat, {})] }) }) }) }); } /* harmony default export */ const post_format_panel = (panel_PostFormat); ;// ./node_modules/@wordpress/editor/build-module/components/post-last-edited-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostLastEditedPanel() { const modified = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('modified'), []); const lastEditedText = modified && (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Human-readable time difference, e.g. "2 days ago". (0,external_wp_i18n_namespaceObject.__)('Last edited %s.'), (0,external_wp_date_namespaceObject.humanTimeDiff)(modified)); if (!lastEditedText) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-last-edited-panel", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: lastEditedText }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-section/index.js /** * External dependencies */ /** * WordPress dependencies */ function PostPanelSection({ className, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: dist_clsx('editor-post-panel__section', className), children: children }); } /* harmony default export */ const post_panel_section = (PostPanelSection); ;// ./node_modules/@wordpress/editor/build-module/components/blog-title/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const blog_title_EMPTY_OBJECT = {}; function BlogTitle() { const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { postsPageTitle, postsPageId, isTemplate, postSlug } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEntityRecord('root', 'site') : undefined; const _postsPageRecord = siteSettings?.page_for_posts ? getEditedEntityRecord('postType', 'page', siteSettings?.page_for_posts) : blog_title_EMPTY_OBJECT; const { getEditedPostAttribute, getCurrentPostType } = select(store_store); return { postsPageId: _postsPageRecord?.id, postsPageTitle: _postsPageRecord?.title, isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, postSlug: getEditedPostAttribute('slug') }; }, []); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); if (!isTemplate || !['home', 'index'].includes(postSlug) || !postsPageId) { return null; } const setPostsPageTitle = newValue => { editEntityRecord('postType', 'page', postsPageId, { title: newValue }); }; const decodedTitle = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postsPageTitle); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Blog title'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, contentClassName: "editor-blog-title-dropdown__content", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Current post link. (0,external_wp_i18n_namespaceObject.__)('Change blog title: %s'), decodedTitle), onClick: onToggle, children: decodedTitle }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Blog title'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), size: "__unstable-large", value: postsPageTitle, onChange: (0,external_wp_compose_namespaceObject.debounce)(setPostsPageTitle, 300), label: (0,external_wp_i18n_namespaceObject.__)('Blog title'), help: (0,external_wp_i18n_namespaceObject.__)('Set the Posts Page title. Appears in search results, and when the page is shared on social media.'), hideLabelFromVision: true })] }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/posts-per-page/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostsPerPage() { const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { postsPerPage, isTemplate, postSlug } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute, getCurrentPostType } = select(store_store); const { getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEditedEntityRecord('root', 'site') : undefined; return { isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, postSlug: getEditedPostAttribute('slug'), postsPerPage: siteSettings?.posts_per_page || 1 }; }, []); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); if (!isTemplate || !['home', 'index'].includes(postSlug)) { return null; } const setPostsPerPage = newValue => { editEntityRecord('root', 'site', undefined, { posts_per_page: newValue }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, contentClassName: "editor-posts-per-page-dropdown__content", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change posts per page'), onClick: onToggle, children: postsPerPage }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Posts per page'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { placeholder: 0, value: postsPerPage, size: "__unstable-large", spinControls: "custom", step: "1", min: "1", onChange: setPostsPerPage, label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'), help: (0,external_wp_i18n_namespaceObject.__)('Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.'), hideLabelFromVision: true })] }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/site-discussion/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const site_discussion_COMMENT_OPTIONS = [{ label: (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'), value: 'open', description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') }, { label: (0,external_wp_i18n_namespaceObject.__)('Closed'), value: '', description: [(0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies.'), (0,external_wp_i18n_namespaceObject.__)('Existing comments remain visible.')].join(' ') }]; function SiteDiscussion() { const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { allowCommentsOnNewPosts, isTemplate, postSlug } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedPostAttribute, getCurrentPostType } = select(store_store); const { getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEditedEntityRecord('root', 'site') : undefined; return { isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, postSlug: getEditedPostAttribute('slug'), allowCommentsOnNewPosts: siteSettings?.default_comment_status || '' }; }, []); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); if (!isTemplate || !['home', 'index'].includes(postSlug)) { return null; } const setAllowCommentsOnNewPosts = newValue => { editEntityRecord('root', 'site', undefined, { default_comment_status: newValue ? 'open' : null }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), ref: setPopoverAnchor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, contentClassName: "editor-site-discussion-dropdown__content", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change discussion settings'), onClick: onToggle, children: allowCommentsOnNewPosts ? (0,external_wp_i18n_namespaceObject.__)('Comments open') : (0,external_wp_i18n_namespaceObject.__)('Comments closed') }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Discussion'), onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('Changes will apply to new posts only. Individual posts may override these settings.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { className: "editor-site-discussion__options", hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)('Comment status'), options: site_discussion_COMMENT_OPTIONS, onChange: setAllowCommentsOnNewPosts, selected: allowCommentsOnNewPosts })] })] }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/post-summary.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module Constants */ const post_summary_PANEL_NAME = 'post-status'; function PostSummary({ onActionPerformed }) { const { isRemovedPostStatusPanel, postType, postId } = (0,external_wp_data_namespaceObject.useSelect)(select => { // We use isEditorPanelRemoved to hide the panel if it was programmatically removed. We do // not use isEditorPanelEnabled since this panel should not be disabled through the UI. const { isEditorPanelRemoved, getCurrentPostType, getCurrentPostId } = select(store_store); return { isRemovedPostStatusPanel: isEditorPanelRemoved(post_summary_PANEL_NAME), postType: getCurrentPostType(), postId: getCurrentPostId() }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_section, { className: "editor-post-summary", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info.Slot, { children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { postType: postType, postId: postId, onActionPerformed: onActionPerformed }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFeaturedImagePanel, { withPanelBody: false }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostExcerptPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostContentInformation, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostLastEditedPanel, {})] }), !isRemovedPostStatusPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStatus, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedulePanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplatePanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostLastRevision, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSyncStatus, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlogTitle, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsPerPage, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteDiscussion, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_panel, {}), fills] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTrash, { onActionPerformed: onActionPerformed })] })] }) }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/hooks.js /** * WordPress dependencies */ /** * Internal dependencies */ const { EXCLUDED_PATTERN_SOURCES, PATTERN_TYPES: hooks_PATTERN_TYPES } = unlock(external_wp_patterns_namespaceObject.privateApis); function injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet) { block.innerBlocks = block.innerBlocks.map(innerBlock => { return injectThemeAttributeInBlockTemplateContent(innerBlock, currentThemeStylesheet); }); if (block.name === 'core/template-part' && block.attributes.theme === undefined) { block.attributes.theme = currentThemeStylesheet; } return block; } /** * Filter all patterns and return only the ones that are compatible with the current template. * * @param {Array} patterns An array of patterns. * @param {Object} template The current template. * @return {Array} Array of patterns that are compatible with the current template. */ function filterPatterns(patterns, template) { // Filter out duplicates. const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name); // Filter out core/directory patterns not included in theme.json. const filterOutExcludedPatternSources = pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source); // Looks for patterns that have the same template type as the current template, // or have a block type that matches the current template area. const filterCompatiblePatterns = pattern => pattern.templateTypes?.includes(template.slug) || pattern.blockTypes?.includes('core/template-part/' + template.area); return patterns.filter((pattern, index, items) => { return filterOutDuplicatesByName(pattern, index, items) && filterOutExcludedPatternSources(pattern) && filterCompatiblePatterns(pattern); }); } function preparePatterns(patterns, currentThemeStylesheet) { return patterns.map(pattern => ({ ...pattern, keywords: pattern.keywords || [], type: hooks_PATTERN_TYPES.theme, blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { __unstableSkipMigrationLogs: true }).map(block => injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet)) })); } function useAvailablePatterns(template) { const { blockPatterns, restBlockPatterns, currentThemeStylesheet } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _settings$__experimen; const { getEditorSettings } = select(store_store); const settings = getEditorSettings(); return { blockPatterns: (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns, restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), currentThemeStylesheet: select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet }; }, []); return (0,external_wp_element_namespaceObject.useMemo)(() => { const mergedPatterns = [...(blockPatterns || []), ...(restBlockPatterns || [])]; const filteredPatterns = filterPatterns(mergedPatterns, template); return preparePatterns(filteredPatterns, template, currentThemeStylesheet); }, [blockPatterns, restBlockPatterns, template, currentThemeStylesheet]); } ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function post_transform_panel_TemplatesList({ availableTemplates, onSelect }) { if (!availableTemplates || availableTemplates?.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { label: (0,external_wp_i18n_namespaceObject.__)('Templates'), blockPatterns: availableTemplates, onClickPattern: onSelect, showTitlesAsTooltip: true }); } function PostTransform() { const { record, postType, postId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const type = getCurrentPostType(); const id = getCurrentPostId(); return { postType: type, postId: id, record: getEditedEntityRecord('postType', type, id) }; }, []); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const availablePatterns = useAvailablePatterns(record); const onTemplateSelect = async selectedTemplate => { await editEntityRecord('postType', postType, postId, { blocks: selectedTemplate.blocks, content: (0,external_wp_blocks_namespaceObject.serialize)(selectedTemplate.blocks) }); }; if (!availablePatterns?.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Design'), initialOpen: record.type === TEMPLATE_PART_POST_TYPE, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_transform_panel_TemplatesList, { availableTemplates: availablePatterns, onSelect: onTemplateSelect }) }); } function PostTransformPanel() { const { postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType } = select(store_store); return { postType: getCurrentPostType() }; }, []); if (![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(postType)) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransform, {}); } ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/constants.js const sidebars = { document: 'edit-post/document', block: 'edit-post/block' }; ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/header.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const SidebarHeader = (_, ref) => { const { documentLabel } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getPostTypeLabel } = select(store_store); return { documentLabel: // translators: Default label for the Document sidebar tab, not selected. getPostTypeLabel() || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun, panel') }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { ref: ref, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: sidebars.document // Used for focus management in the SettingsSidebar component. , "data-tab-id": sidebars.document, children: documentLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: sidebars.block // Used for focus management in the SettingsSidebar component. , "data-tab-id": sidebars.block, children: (0,external_wp_i18n_namespaceObject.__)('Block') })] }); }; /* harmony default export */ const sidebar_header = ((0,external_wp_element_namespaceObject.forwardRef)(SidebarHeader)); ;// ./node_modules/@wordpress/editor/build-module/components/template-content-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { BlockQuickNavigation } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const template_content_panel_POST_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content']; const TEMPLATE_PART_BLOCK = 'core/template-part'; function TemplateContentPanel() { const postContentBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_hooks_namespaceObject.applyFilters)('editor.postContentBlockTypes', template_content_panel_POST_CONTENT_BLOCK_TYPES), []); const { clientIds, postType, renderingMode } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType, getPostBlocksByName, getRenderingMode } = unlock(select(store_store)); const _postType = getCurrentPostType(); return { postType: _postType, clientIds: getPostBlocksByName(TEMPLATE_POST_TYPE === _postType ? TEMPLATE_PART_BLOCK : postContentBlockTypes), renderingMode: getRenderingMode() }; }, [postContentBlockTypes]); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (renderingMode === 'post-only' && postType !== TEMPLATE_POST_TYPE || clientIds.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Content'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, { clientIds: clientIds, onSelect: () => { enableComplementaryArea('core', 'edit-post/document'); } }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/template-part-content-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { BlockQuickNavigation: template_part_content_panel_BlockQuickNavigation } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function TemplatePartContentPanelInner() { const blockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockTypes } = select(external_wp_blocks_namespaceObject.store); return getBlockTypes(); }, []); const themeBlockNames = (0,external_wp_element_namespaceObject.useMemo)(() => { return blockTypes.filter(blockType => { return blockType.category === 'theme'; }).map(({ name }) => name); }, [blockTypes]); const themeBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlocksByName } = select(external_wp_blockEditor_namespaceObject.store); return getBlocksByName(themeBlockNames); }, [themeBlockNames]); if (themeBlocks.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Content'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(template_part_content_panel_BlockQuickNavigation, { clientIds: themeBlocks }) }); } function TemplatePartContentPanel() { const postType = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentPostType } = select(store_store); return getCurrentPostType(); }, []); if (postType !== TEMPLATE_PART_POST_TYPE) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartContentPanelInner, {}); } ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-auto-switch-editor-sidebars.js /** * WordPress dependencies */ /** * This listener hook monitors for block selection and triggers the appropriate * sidebar state. */ function useAutoSwitchEditorSidebars() { const { hasBlockSelection } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() }; }, []); const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { get: getPreference } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { const activeGeneralSidebar = getActiveComplementaryArea('core'); const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar); const isDistractionFree = getPreference('core', 'distractionFree'); if (!isEditorSidebarOpened || isDistractionFree) { return; } if (hasBlockSelection) { enableComplementaryArea('core', 'edit-post/block'); } else { enableComplementaryArea('core', 'edit-post/document'); } }, [hasBlockSelection, getActiveComplementaryArea, enableComplementaryArea, getPreference]); } /* harmony default export */ const use_auto_switch_editor_sidebars = (useAutoSwitchEditorSidebars); ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Tabs: sidebar_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ web: true, native: false }); const SidebarContent = ({ tabName, keyboardShortcut, onActionPerformed, extraPanels }) => { const tabListRef = (0,external_wp_element_namespaceObject.useRef)(null); // Because `PluginSidebar` renders a `ComplementaryArea`, we // need to forward the `Tabs` context so it can be passed through the // underlying slot/fill. const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(sidebar_Tabs.Context); // This effect addresses a race condition caused by tabbing from the last // block in the editor into the settings sidebar. Without this effect, the // selected tab and browser focus can become separated in an unexpected way // (e.g the "block" tab is focused, but the "post" tab is selected). (0,external_wp_element_namespaceObject.useEffect)(() => { const tabsElements = Array.from(tabListRef.current?.querySelectorAll('[role="tab"]') || []); const selectedTabElement = tabsElements.find( // We are purposefully using a custom `data-tab-id` attribute here // because we don't want rely on any assumptions about `Tabs` // component internals. element => element.getAttribute('data-tab-id') === tabName); const activeElement = selectedTabElement?.ownerDocument.activeElement; const tabsHasFocus = tabsElements.some(element => { return activeElement && activeElement.id === element.id; }); if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) { selectedTabElement?.focus(); } }, [tabName]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginSidebar, { identifier: tabName, header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.Context.Provider, { value: tabsContextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_header, { ref: tabListRef }) }), closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings') // This classname is added so we can apply a corrective negative // margin to the panel. // see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049 , className: "editor-sidebar__panel", headerClassName: "editor-sidebar__panel-tabs", title: /* translators: button label text should, if possible, be under 16 characters. */ (0,external_wp_i18n_namespaceObject._x)('Settings', 'panel button label'), toggleShortcut: keyboardShortcut, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.Context.Provider, { value: tabsContextValue, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.TabPanel, { tabId: sidebars.document, focusable: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSummary, { onActionPerformed: onActionPerformed }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateContentPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartContentPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransformPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_PostTaxonomies, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesPanel, {}), extraPanels] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.TabPanel, { tabId: sidebars.block, focusable: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockInspector, {}) })] }) }); }; const Sidebar = ({ extraPanels, onActionPerformed }) => { use_auto_switch_editor_sidebars(); const { tabName, keyboardShortcut, showSummary } = (0,external_wp_data_namespaceObject.useSelect)(select => { const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/editor/toggle-sidebar'); const sidebar = select(store).getActiveComplementaryArea('core'); const _isEditorSidebarOpened = [sidebars.block, sidebars.document].includes(sidebar); let _tabName = sidebar; if (!_isEditorSidebarOpened) { _tabName = !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() ? sidebars.block : sidebars.document; } return { tabName: _tabName, keyboardShortcut: shortcut, showSummary: ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE].includes(select(store_store).getCurrentPostType()) }; }, []); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)(newSelectedTabId => { if (!!newSelectedTabId) { enableComplementaryArea('core', newSelectedTabId); } }, [enableComplementaryArea]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs, { selectedTabId: tabName, onSelect: onTabSelect, selectOnMove: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { tabName: tabName, keyboardShortcut: keyboardShortcut, showSummary: showSummary, onActionPerformed: onActionPerformed, extraPanels: extraPanels }) }); }; /* harmony default export */ const components_sidebar = (Sidebar); ;// ./node_modules/@wordpress/editor/build-module/components/editor/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function Editor({ postType, postId, templateId, settings, children, initialEdits, // This could be part of the settings. onActionPerformed, // The following abstractions are not ideal but necessary // to account for site editor and post editor differences for now. extraContent, extraSidebarPanels, ...props }) { const { post, template, hasLoadedPost, error } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, getResolutionError, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); const postArgs = ['postType', postType, postId]; return { post: getEntityRecord(...postArgs), template: templateId ? getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId) : undefined, hasLoadedPost: hasFinishedResolution('getEntityRecord', postArgs), error: getResolutionError('getEntityRecord', postArgs)?.message }; }, [postType, postId, templateId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [hasLoadedPost && !post && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: !!error ? 'error' : 'warning', isDismissible: false, children: !error ? (0,external_wp_i18n_namespaceObject.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?") : error }), !!post && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalEditorProvider, { post: post, __unstableTemplate: template, settings: settings, initialEdits: initialEdits, useSubRegistry: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorInterface, { ...props, children: extraContent }), children, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_sidebar, { onActionPerformed: onActionPerformed, extraPanels: extraSidebarPanels })] })] }); } /* harmony default export */ const editor = (Editor); ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-publish-sidebar.js /** * WordPress dependencies */ /** * Internal dependencies */ const { PreferenceBaseOption: enable_publish_sidebar_PreferenceBaseOption } = unlock(external_wp_preferences_namespaceObject.privateApis); function EnablePublishSidebarOption(props) { const isChecked = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(store_store).isPublishSidebarEnabled(); }, []); const { enablePublishSidebar, disablePublishSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_publish_sidebar_PreferenceBaseOption, { isChecked: isChecked, onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar(), ...props }); } ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/block-visibility.js /** * WordPress dependencies */ /** * Internal dependencies */ const { BlockManager } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const block_visibility_EMPTY_ARRAY = []; function BlockVisibility() { const { showBlockTypes, hideBlockTypes } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); const { blockTypes, allowedBlockTypes: _allowedBlockTypes, hiddenBlockTypes: _hiddenBlockTypes } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$get; return { blockTypes: select(external_wp_blocks_namespaceObject.store).getBlockTypes(), allowedBlockTypes: select(store_store).getEditorSettings().allowedBlockTypes, hiddenBlockTypes: (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _select$get !== void 0 ? _select$get : block_visibility_EMPTY_ARRAY }; }, []); const allowedBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { if (_allowedBlockTypes === true) { return blockTypes; } return blockTypes.filter(({ name }) => { return _allowedBlockTypes?.includes(name); }); }, [_allowedBlockTypes, blockTypes]); const filteredBlockTypes = allowedBlockTypes.filter(blockType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'inserter', true) && (!blockType.parent || blockType.parent.includes('core/post-content'))); // Some hidden blocks become unregistered // by removing for instance the plugin that registered them, yet // they're still remain as hidden by the user's action. // We consider "hidden", blocks which were hidden and // are still registered. const hiddenBlockTypes = _hiddenBlockTypes.filter(hiddenBlock => { return filteredBlockTypes.some(registeredBlock => registeredBlock.name === hiddenBlock); }); const selectedBlockTypes = filteredBlockTypes.filter(blockType => !hiddenBlockTypes.includes(blockType.name)); const onChangeSelectedBlockTypes = newSelectedBlockTypes => { if (selectedBlockTypes.length > newSelectedBlockTypes.length) { const blockTypesToHide = selectedBlockTypes.filter(blockType => !newSelectedBlockTypes.find(({ name }) => name === blockType.name)); hideBlockTypes(blockTypesToHide.map(({ name }) => name)); } else if (selectedBlockTypes.length < newSelectedBlockTypes.length) { const blockTypesToShow = newSelectedBlockTypes.filter(blockType => !selectedBlockTypes.find(({ name }) => name === blockType.name)); showBlockTypes(blockTypesToShow.map(({ name }) => name)); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockManager, { blockTypes: filteredBlockTypes, selectedBlockTypes: selectedBlockTypes, onChange: onChangeSelectedBlockTypes }); } ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { PreferencesModal, PreferencesModalTabs, PreferencesModalSection, PreferenceToggleControl } = unlock(external_wp_preferences_namespaceObject.privateApis); function EditorPreferencesModal({ extraSections = {} }) { const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(store).isModalActive('editor/preferences'); }, []); const { closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!isActive) { return null; } // Please wrap all contents inside PreferencesModalContents to prevent all // hooks from executing when the modal is not open. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, { closeModal: closeModal, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalContents, { extraSections: extraSections }) }); } function PreferencesModalContents({ extraSections = {} }) { const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditorSettings } = select(store_store); const { get } = select(external_wp_preferences_namespaceObject.store); const isRichEditingEnabled = getEditorSettings().richEditingEnabled; const isDistractionFreeEnabled = get('core', 'distractionFree'); return !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled; }, [isLargeViewport]); const { setIsListViewOpened, setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{ name: 'general', tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)('Interface'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "showListViewByDefault", help: (0,external_wp_i18n_namespaceObject.__)('Opens the List View panel by default.'), label: (0,external_wp_i18n_namespaceObject.__)('Always open List View') }), showBlockBreadcrumbsOption && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "showBlockBreadcrumbs", help: (0,external_wp_i18n_namespaceObject.__)('Display the block hierarchy trail at the bottom of the editor.'), label: (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "allowRightClickOverrides", help: (0,external_wp_i18n_namespaceObject.__)('Allows contextual List View menus via right-click, overriding browser defaults.'), label: (0,external_wp_i18n_namespaceObject.__)('Allow right-click contextual menus') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "enableChoosePatternModal", help: (0,external_wp_i18n_namespaceObject.__)('Shows starter patterns when creating a new page.'), label: (0,external_wp_i18n_namespaceObject.__)('Show starter patterns') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)('Document settings'), description: (0,external_wp_i18n_namespaceObject.__)('Select what settings are shown in the document panel.'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_taxonomies, { taxonomyWrapper: (content, taxonomy) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { label: taxonomy.labels.menu_name, panelName: `taxonomy-panel-${taxonomy.slug}` }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { label: (0,external_wp_i18n_namespaceObject.__)('Featured image'), panelName: "featured-image" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'), panelName: "post-excerpt" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { supportKeys: ['comments', 'trackbacks'], children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), panelName: "discussion-panel" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'), panelName: "page-attributes" }) })] }), isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)('Publishing'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePublishSidebarOption, { help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'), label: (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks') }) }), extraSections?.general] }) }, { name: 'appearance', tabLabel: (0,external_wp_i18n_namespaceObject.__)('Appearance'), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), description: (0,external_wp_i18n_namespaceObject.__)('Customize the editor interface to suit your needs.'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "fixedToolbar", onToggle: () => setPreference('core', 'distractionFree', false), help: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place.'), label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "distractionFree", onToggle: () => { setPreference('core', 'fixedToolbar', true); setIsInserterOpened(false); setIsListViewOpened(false); }, help: (0,external_wp_i18n_namespaceObject.__)('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'), label: (0,external_wp_i18n_namespaceObject.__)('Distraction free') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "focusMode", help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'), label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode') }), extraSections?.appearance] }) }, { name: 'accessibility', tabLabel: (0,external_wp_i18n_namespaceObject.__)('Accessibility'), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)('Navigation'), description: (0,external_wp_i18n_namespaceObject.__)('Optimize the editing experience for enhanced control.'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "keepCaretInsideBlock", help: (0,external_wp_i18n_namespaceObject.__)('Keeps the text cursor within blocks while navigating with arrow keys, preventing it from moving to other blocks and enhancing accessibility for keyboard users.'), label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)('Interface'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "showIconLabels", label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'), help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons across the interface.') }) })] }) }, { name: 'blocks', tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)('Inserter'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core", featureName: "mostUsedBlocks", help: (0,external_wp_i18n_namespaceObject.__)('Adds a category with the most frequently used blocks in the inserter.'), label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)('Manage block visibility'), description: (0,external_wp_i18n_namespaceObject.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockVisibility, {}) })] }) }, window.__experimentalMediaProcessing && { name: 'media', tabLabel: (0,external_wp_i18n_namespaceObject.__)('Media'), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)('General'), description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the media upload flow.'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core/media", featureName: "optimizeOnUpload", help: (0,external_wp_i18n_namespaceObject.__)('Compress media items before uploading to the server.'), label: (0,external_wp_i18n_namespaceObject.__)('Pre-upload compression') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { scope: "core/media", featureName: "requireApproval", help: (0,external_wp_i18n_namespaceObject.__)('Require approval step when optimizing existing media.'), label: (0,external_wp_i18n_namespaceObject.__)('Approval step') })] }) }) }].filter(Boolean), [showBlockBreadcrumbsOption, extraSections, setIsInserterOpened, setIsListViewOpened, setPreference, isLargeViewport]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalTabs, { sections: sections }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-fields/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function usePostFields({ postType }) { const { registerPostTypeSchema } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); (0,external_wp_element_namespaceObject.useEffect)(() => { registerPostTypeSchema(postType); }, [registerPostTypeSchema, postType]); const { defaultFields } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityFields } = unlock(select(store_store)); return { defaultFields: getEntityFields('postType', postType) }; }, [postType]); const { records: authors, isResolving: isLoadingAuthors } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'user', { per_page: -1 }); const fields = (0,external_wp_element_namespaceObject.useMemo)(() => defaultFields.map(field => { if (field.id === 'author') { return { ...field, elements: authors?.map(({ id, name }) => ({ value: id, label: name })) }; } return field; }), [authors, defaultFields]); return { isLoading: isLoadingAuthors, fields }; } /** * Hook to get the fields for a post (BasePost or BasePostWithEmbeddedAuthor). */ /* harmony default export */ const post_fields = (usePostFields); ;// ./node_modules/@wordpress/editor/build-module/bindings/pattern-overrides.js /** * WordPress dependencies */ const CONTENT = 'content'; /* harmony default export */ const pattern_overrides = ({ name: 'core/pattern-overrides', getValues({ select, clientId, context, bindings }) { const patternOverridesContent = context['pattern/overrides']; const { getBlockAttributes } = select(external_wp_blockEditor_namespaceObject.store); const currentBlockAttributes = getBlockAttributes(clientId); const overridesValues = {}; for (const attributeName of Object.keys(bindings)) { const overridableValue = patternOverridesContent?.[currentBlockAttributes?.metadata?.name]?.[attributeName]; // If it has not been overridden, return the original value. // Check undefined because empty string is a valid value. if (overridableValue === undefined) { overridesValues[attributeName] = currentBlockAttributes[attributeName]; continue; } else { overridesValues[attributeName] = overridableValue === '' ? undefined : overridableValue; } } return overridesValues; }, setValues({ select, dispatch, clientId, bindings }) { const { getBlockAttributes, getBlockParentsByBlockName, getBlocks } = select(external_wp_blockEditor_namespaceObject.store); const currentBlockAttributes = getBlockAttributes(clientId); const blockName = currentBlockAttributes?.metadata?.name; if (!blockName) { return; } const [patternClientId] = getBlockParentsByBlockName(clientId, 'core/block', true); // Extract the updated attributes from the source bindings. const attributes = Object.entries(bindings).reduce((attrs, [key, { newValue }]) => { attrs[key] = newValue; return attrs; }, {}); // If there is no pattern client ID, sync blocks with the same name and same attributes. if (!patternClientId) { const syncBlocksWithSameName = blocks => { for (const block of blocks) { if (block.attributes?.metadata?.name === blockName) { dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(block.clientId, attributes); } syncBlocksWithSameName(block.innerBlocks); } }; syncBlocksWithSameName(getBlocks()); return; } const currentBindingValue = getBlockAttributes(patternClientId)?.[CONTENT]; dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(patternClientId, { [CONTENT]: { ...currentBindingValue, [blockName]: { ...currentBindingValue?.[blockName], ...Object.entries(attributes).reduce((acc, [key, value]) => { // TODO: We need a way to represent `undefined` in the serialized overrides. // Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871 // We use an empty string to represent undefined for now until // we support a richer format for overrides and the block bindings API. acc[key] = value === undefined ? '' : value; return acc; }, {}) } } }); }, canUserEditValue: () => true }); ;// ./node_modules/@wordpress/editor/build-module/bindings/post-meta.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Gets a list of post meta fields with their values and labels * to be consumed in the needed callbacks. * If the value is not available based on context, like in templates, * it falls back to the default value, label, or key. * * @param {Object} select The select function from the data store. * @param {Object} context The context provided. * @return {Object} List of post meta fields with their value and label. * * @example * ```js * { * field_1_key: { * label: 'Field 1 Label', * value: 'Field 1 Value', * }, * field_2_key: { * label: 'Field 2 Label', * value: 'Field 2 Value', * }, * ... * } * ``` */ function getPostMetaFields(select, context) { const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const { getRegisteredPostMeta } = unlock(select(external_wp_coreData_namespaceObject.store)); let entityMetaValues; // Try to get the current entity meta values. if (context?.postType && context?.postId) { entityMetaValues = getEditedEntityRecord('postType', context?.postType, context?.postId).meta; } const registeredFields = getRegisteredPostMeta(context?.postType); const metaFields = {}; Object.entries(registeredFields || {}).forEach(([key, props]) => { // Don't include footnotes or private fields. if (key !== 'footnotes' && key.charAt(0) !== '_') { var _entityMetaValues$key; metaFields[key] = { label: props.title || key, value: // When using the entity value, an empty string IS a valid value. (_entityMetaValues$key = entityMetaValues?.[key]) !== null && _entityMetaValues$key !== void 0 ? _entityMetaValues$key : // When using the default, an empty string IS NOT a valid value. props.default || undefined, type: props.type }; } }); if (!Object.keys(metaFields || {}).length) { return null; } return metaFields; } /* harmony default export */ const post_meta = ({ name: 'core/post-meta', getValues({ select, context, bindings }) { const metaFields = getPostMetaFields(select, context); const newValues = {}; for (const [attributeName, source] of Object.entries(bindings)) { var _ref; // Use the value, the field label, or the field key. const fieldKey = source.args.key; const { value: fieldValue, label: fieldLabel } = metaFields?.[fieldKey] || {}; newValues[attributeName] = (_ref = fieldValue !== null && fieldValue !== void 0 ? fieldValue : fieldLabel) !== null && _ref !== void 0 ? _ref : fieldKey; } return newValues; }, setValues({ dispatch, context, bindings }) { const newMeta = {}; Object.values(bindings).forEach(({ args, newValue }) => { newMeta[args.key] = newValue; }); dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', context?.postType, context?.postId, { meta: newMeta }); }, canUserEditValue({ select, context, args }) { // Lock editing in query loop. if (context?.query || context?.queryId) { return false; } // Lock editing when `postType` is not defined. if (!context?.postType) { return false; } const fieldValue = getPostMetaFields(select, context)?.[args.key]?.value; // Empty string or `false` could be a valid value, so we need to check if the field value is undefined. if (fieldValue === undefined) { return false; } // Check that custom fields metabox is not enabled. const areCustomFieldsEnabled = select(store_store).getEditorSettings().enableCustomFields; if (areCustomFieldsEnabled) { return false; } // Check that the user has the capability to edit post meta. const canUserEdit = select(external_wp_coreData_namespaceObject.store).canUser('update', { kind: 'postType', name: context?.postType, id: context?.postId }); if (!canUserEdit) { return false; } return true; }, getFieldsList({ select, context }) { return getPostMetaFields(select, context); } }); ;// ./node_modules/@wordpress/editor/build-module/bindings/api.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Function to register core block bindings sources provided by the editor. * * @example * ```js * import { registerCoreBlockBindingsSources } from '@wordpress/editor'; * * registerCoreBlockBindingsSources(); * ``` */ function registerCoreBlockBindingsSources() { (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(pattern_overrides); (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(post_meta); } ;// ./node_modules/@wordpress/editor/build-module/private-apis.js /** * WordPress dependencies */ /** * Internal dependencies */ const { store: interfaceStore, ...remainingInterfaceApis } = build_module_namespaceObject; const privateApis = {}; lock(privateApis, { CreateTemplatePartModal: CreateTemplatePartModal, patternTitleField: pattern_title, templateTitleField: template_title, BackButton: back_button, EntitiesSavedStatesExtensible: EntitiesSavedStatesExtensible, Editor: editor, EditorContentSlotFill: content_slot_fill, GlobalStylesProvider: GlobalStylesProvider, mergeBaseAndUserConfigs: mergeBaseAndUserConfigs, PluginPostExcerpt: post_excerpt_plugin, PostCardPanel: PostCardPanel, PreferencesModal: EditorPreferencesModal, usePostActions: usePostActions, usePostFields: post_fields, ToolsMoreMenuGroup: tools_more_menu_group, ViewMoreMenuGroup: view_more_menu_group, ResizableEditor: resizable_editor, registerCoreBlockBindingsSources: registerCoreBlockBindingsSources, getTemplateInfo: getTemplateInfo, // This is a temporary private API while we're updating the site editor to use EditorProvider. interfaceStore, ...remainingInterfaceApis }); ;// ./node_modules/@wordpress/editor/build-module/dataviews/api.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @typedef {import('@wordpress/dataviews').Action} Action * @typedef {import('@wordpress/dataviews').Field} Field */ /** * Registers a new DataViews action. * * This is an experimental API and is subject to change. * it's only available in the Gutenberg plugin for now. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {Action} config Action configuration. */ function api_registerEntityAction(kind, name, config) { const { registerEntityAction: _registerEntityAction } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); if (false) {} } /** * Unregisters a DataViews action. * * This is an experimental API and is subject to change. * it's only available in the Gutenberg plugin for now. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {string} actionId Action ID. */ function api_unregisterEntityAction(kind, name, actionId) { const { unregisterEntityAction: _unregisterEntityAction } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); if (false) {} } /** * Registers a new DataViews field. * * This is an experimental API and is subject to change. * it's only available in the Gutenberg plugin for now. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {Field} config Field configuration. */ function api_registerEntityField(kind, name, config) { const { registerEntityField: _registerEntityField } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); if (false) {} } /** * Unregisters a DataViews field. * * This is an experimental API and is subject to change. * it's only available in the Gutenberg plugin for now. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {string} fieldId Field ID. */ function api_unregisterEntityField(kind, name, fieldId) { const { unregisterEntityField: _unregisterEntityField } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); if (false) {} } ;// ./node_modules/@wordpress/editor/build-module/index.js /** * Internal dependencies */ /* * Backward compatibility */ })(); (window.wp = window.wp || {}).editor = __webpack_exports__; /******/ })() ; dist/blob.js 0000644 00000011016 15125140777 0006773 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ createBlobURL: () => (/* binding */ createBlobURL), /* harmony export */ downloadBlob: () => (/* binding */ downloadBlob), /* harmony export */ getBlobByURL: () => (/* binding */ getBlobByURL), /* harmony export */ getBlobTypeByURL: () => (/* binding */ getBlobTypeByURL), /* harmony export */ isBlobURL: () => (/* binding */ isBlobURL), /* harmony export */ revokeBlobURL: () => (/* binding */ revokeBlobURL) /* harmony export */ }); /* wp:polyfill */ const cache = {}; /** * Create a blob URL from a file. * * @param file The file to create a blob URL for. * * @return The blob URL. */ function createBlobURL(file) { const url = window.URL.createObjectURL(file); cache[url] = file; return url; } /** * Retrieve a file based on a blob URL. The file must have been created by * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return * `undefined`. * * @param url The blob URL. * * @return The file for the blob URL. */ function getBlobByURL(url) { return cache[url]; } /** * Retrieve a blob type based on URL. The file must have been created by * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return * `undefined`. * * @param url The blob URL. * * @return The blob type. */ function getBlobTypeByURL(url) { return getBlobByURL(url)?.type.split('/')[0]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ). } /** * Remove the resource and file cache from memory. * * @param url The blob URL. */ function revokeBlobURL(url) { if (cache[url]) { window.URL.revokeObjectURL(url); } delete cache[url]; } /** * Check whether a url is a blob url. * * @param url The URL. * * @return Is the url a blob url? */ function isBlobURL(url) { if (!url || !url.indexOf) { return false; } return url.indexOf('blob:') === 0; } /** * Downloads a file, e.g., a text or readable stream, in the browser. * Appropriate for downloading smaller file sizes, e.g., < 5 MB. * * Example usage: * * ```js * const fileContent = JSON.stringify( * { * "title": "My Post", * }, * null, * 2 * ); * const filename = 'file.json'; * * downloadBlob( filename, fileContent, 'application/json' ); * ``` * * @param filename File name. * @param content File content (BufferSource | Blob | string). * @param contentType (Optional) File mime type. Default is `''`. */ function downloadBlob(filename, content, contentType = '') { if (!filename || !content) { return; } const file = new window.Blob([content], { type: contentType }); const url = window.URL.createObjectURL(file); const anchorElement = document.createElement('a'); anchorElement.href = url; anchorElement.download = filename; anchorElement.style.display = 'none'; document.body.appendChild(anchorElement); anchorElement.click(); document.body.removeChild(anchorElement); window.URL.revokeObjectURL(url); } (window.wp = window.wp || {}).blob = __webpack_exports__; /******/ })() ; dist/components.js 0000644 00010774643 15125140777 0010271 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 66: /***/ ((module) => { "use strict"; var isMergeableObject = function isMergeableObject(value) { return isNonNullObject(value) && !isSpecial(value) }; function isNonNullObject(value) { return !!value && typeof value === 'object' } function isSpecial(value) { var stringValue = Object.prototype.toString.call(value); return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value) } // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; function isReactElement(value) { return value.$$typeof === REACT_ELEMENT_TYPE } function emptyTarget(val) { return Array.isArray(val) ? [] : {} } function cloneUnlessOtherwiseSpecified(value, options) { return (options.clone !== false && options.isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, options) : value } function defaultArrayMerge(target, source, options) { return target.concat(source).map(function(element) { return cloneUnlessOtherwiseSpecified(element, options) }) } function getMergeFunction(key, options) { if (!options.customMerge) { return deepmerge } var customMerge = options.customMerge(key); return typeof customMerge === 'function' ? customMerge : deepmerge } function getEnumerableOwnPropertySymbols(target) { return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { return Object.propertyIsEnumerable.call(target, symbol) }) : [] } function getKeys(target) { return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) } function propertyIsOnObject(object, property) { try { return property in object } catch(_) { return false } } // Protects from prototype poisoning and unexpected merging up the prototype chain. function propertyIsUnsafe(target, key) { return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. } function mergeObject(target, source, options) { var destination = {}; if (options.isMergeableObject(target)) { getKeys(target).forEach(function(key) { destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); }); } getKeys(source).forEach(function(key) { if (propertyIsUnsafe(target, key)) { return } if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { destination[key] = getMergeFunction(key, options)(target[key], source[key], options); } else { destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); } }); return destination } function deepmerge(target, source, options) { options = options || {}; options.arrayMerge = options.arrayMerge || defaultArrayMerge; options.isMergeableObject = options.isMergeableObject || isMergeableObject; // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() // implementations can use it. The caller may not replace it. options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; var sourceIsArray = Array.isArray(source); var targetIsArray = Array.isArray(target); var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; if (!sourceAndTargetTypesMatch) { return cloneUnlessOtherwiseSpecified(source, options) } else if (sourceIsArray) { return options.arrayMerge(target, source, options) } else { return mergeObject(target, source, options) } } deepmerge.all = function deepmergeAll(array, options) { if (!Array.isArray(array)) { throw new Error('first argument should be an array') } return array.reduce(function(prev, next) { return deepmerge(prev, next, options) }, {}) }; var deepmerge_1 = deepmerge; module.exports = deepmerge_1; /***/ }), /***/ 83: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; /** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var React = __webpack_require__(1609); function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React.useState, useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue; function useSyncExternalStore$2(subscribe, getSnapshot) { var value = getSnapshot(), _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1]; useLayoutEffect( function () { inst.value = value; inst.getSnapshot = getSnapshot; checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); }, [subscribe, value, getSnapshot] ); useEffect( function () { checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); return subscribe(function () { checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); }); }, [subscribe] ); useDebugValue(value); return value; } function checkIfSnapshotChanged(inst) { var latestGetSnapshot = inst.getSnapshot; inst = inst.value; try { var nextValue = latestGetSnapshot(); return !objectIs(inst, nextValue); } catch (error) { return !0; } } function useSyncExternalStore$1(subscribe, getSnapshot) { return getSnapshot(); } var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim; /***/ }), /***/ 422: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (true) { module.exports = __webpack_require__(83); } else {} /***/ }), /***/ 1178: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (true) { module.exports = __webpack_require__(2950); } else {} /***/ }), /***/ 1609: /***/ ((module) => { "use strict"; module.exports = window["React"]; /***/ }), /***/ 1880: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var reactIs = __webpack_require__(1178); /** * Copyright 2015, Yahoo! Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ var REACT_STATICS = { childContextTypes: true, contextType: true, contextTypes: true, defaultProps: true, displayName: true, getDefaultProps: true, getDerivedStateFromError: true, getDerivedStateFromProps: true, mixins: true, propTypes: true, type: true }; var KNOWN_STATICS = { name: true, length: true, prototype: true, caller: true, callee: true, arguments: true, arity: true }; var FORWARD_REF_STATICS = { '$$typeof': true, render: true, defaultProps: true, displayName: true, propTypes: true }; var MEMO_STATICS = { '$$typeof': true, compare: true, defaultProps: true, displayName: true, propTypes: true, type: true }; var TYPE_STATICS = {}; TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; function getStatics(component) { // React v16.11 and below if (reactIs.isMemo(component)) { return MEMO_STATICS; } // React v16.12 and above return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; } var defineProperty = Object.defineProperty; var getOwnPropertyNames = Object.getOwnPropertyNames; var getOwnPropertySymbols = Object.getOwnPropertySymbols; var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var getPrototypeOf = Object.getPrototypeOf; var objectPrototype = Object.prototype; function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components if (objectPrototype) { var inheritedComponent = getPrototypeOf(sourceComponent); if (inheritedComponent && inheritedComponent !== objectPrototype) { hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); } } var keys = getOwnPropertyNames(sourceComponent); if (getOwnPropertySymbols) { keys = keys.concat(getOwnPropertySymbols(sourceComponent)); } var targetStatics = getStatics(targetComponent); var sourceStatics = getStatics(sourceComponent); for (var i = 0; i < keys.length; ++i) { var key = keys[i]; if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { var descriptor = getOwnPropertyDescriptor(sourceComponent, key); try { // Avoid failures from read-only properties defineProperty(targetComponent, key, descriptor); } catch (e) {} } } } return targetComponent; } module.exports = hoistNonReactStatics; /***/ }), /***/ 2950: /***/ ((__unused_webpack_module, exports) => { "use strict"; /** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; /***/ }), /***/ 7734: /***/ ((module) => { "use strict"; // do not edit .js files directly - edit src/index.jst var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if ((a instanceof Map) && (b instanceof Map)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false; return true; } if ((a instanceof Set) && (b instanceof Set)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; return true; } if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }), /***/ 8924: /***/ ((__unused_webpack_module, exports) => { // Copyright (c) 2014 Rafael Caricio. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. var GradientParser = {}; GradientParser.parse = (function() { var tokens = { linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i, repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i, radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i, repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i, sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i, extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/, positionKeywords: /^(left|center|right|top|bottom)/i, pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/, percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/, emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/, angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/, startCall: /^\(/, endCall: /^\)/, comma: /^,/, hexColor: /^\#([0-9a-fA-F]+)/, literalColor: /^([a-zA-Z]+)/, rgbColor: /^rgb/i, rgbaColor: /^rgba/i, number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/ }; var input = ''; function error(msg) { var err = new Error(input + ': ' + msg); err.source = input; throw err; } function getAST() { var ast = matchListDefinitions(); if (input.length > 0) { error('Invalid input not EOF'); } return ast; } function matchListDefinitions() { return matchListing(matchDefinition); } function matchDefinition() { return matchGradient( 'linear-gradient', tokens.linearGradient, matchLinearOrientation) || matchGradient( 'repeating-linear-gradient', tokens.repeatingLinearGradient, matchLinearOrientation) || matchGradient( 'radial-gradient', tokens.radialGradient, matchListRadialOrientations) || matchGradient( 'repeating-radial-gradient', tokens.repeatingRadialGradient, matchListRadialOrientations); } function matchGradient(gradientType, pattern, orientationMatcher) { return matchCall(pattern, function(captures) { var orientation = orientationMatcher(); if (orientation) { if (!scan(tokens.comma)) { error('Missing comma before color stops'); } } return { type: gradientType, orientation: orientation, colorStops: matchListing(matchColorStop) }; }); } function matchCall(pattern, callback) { var captures = scan(pattern); if (captures) { if (!scan(tokens.startCall)) { error('Missing ('); } result = callback(captures); if (!scan(tokens.endCall)) { error('Missing )'); } return result; } } function matchLinearOrientation() { return matchSideOrCorner() || matchAngle(); } function matchSideOrCorner() { return match('directional', tokens.sideOrCorner, 1); } function matchAngle() { return match('angular', tokens.angleValue, 1); } function matchListRadialOrientations() { var radialOrientations, radialOrientation = matchRadialOrientation(), lookaheadCache; if (radialOrientation) { radialOrientations = []; radialOrientations.push(radialOrientation); lookaheadCache = input; if (scan(tokens.comma)) { radialOrientation = matchRadialOrientation(); if (radialOrientation) { radialOrientations.push(radialOrientation); } else { input = lookaheadCache; } } } return radialOrientations; } function matchRadialOrientation() { var radialType = matchCircle() || matchEllipse(); if (radialType) { radialType.at = matchAtPosition(); } else { var defaultPosition = matchPositioning(); if (defaultPosition) { radialType = { type: 'default-radial', at: defaultPosition }; } } return radialType; } function matchCircle() { var circle = match('shape', /^(circle)/i, 0); if (circle) { circle.style = matchLength() || matchExtentKeyword(); } return circle; } function matchEllipse() { var ellipse = match('shape', /^(ellipse)/i, 0); if (ellipse) { ellipse.style = matchDistance() || matchExtentKeyword(); } return ellipse; } function matchExtentKeyword() { return match('extent-keyword', tokens.extentKeywords, 1); } function matchAtPosition() { if (match('position', /^at/, 0)) { var positioning = matchPositioning(); if (!positioning) { error('Missing positioning value'); } return positioning; } } function matchPositioning() { var location = matchCoordinates(); if (location.x || location.y) { return { type: 'position', value: location }; } } function matchCoordinates() { return { x: matchDistance(), y: matchDistance() }; } function matchListing(matcher) { var captures = matcher(), result = []; if (captures) { result.push(captures); while (scan(tokens.comma)) { captures = matcher(); if (captures) { result.push(captures); } else { error('One extra comma'); } } } return result; } function matchColorStop() { var color = matchColor(); if (!color) { error('Expected color definition'); } color.length = matchDistance(); return color; } function matchColor() { return matchHexColor() || matchRGBAColor() || matchRGBColor() || matchLiteralColor(); } function matchLiteralColor() { return match('literal', tokens.literalColor, 0); } function matchHexColor() { return match('hex', tokens.hexColor, 1); } function matchRGBColor() { return matchCall(tokens.rgbColor, function() { return { type: 'rgb', value: matchListing(matchNumber) }; }); } function matchRGBAColor() { return matchCall(tokens.rgbaColor, function() { return { type: 'rgba', value: matchListing(matchNumber) }; }); } function matchNumber() { return scan(tokens.number)[1]; } function matchDistance() { return match('%', tokens.percentageValue, 1) || matchPositionKeyword() || matchLength(); } function matchPositionKeyword() { return match('position-keyword', tokens.positionKeywords, 1); } function matchLength() { return match('px', tokens.pixelValue, 1) || match('em', tokens.emValue, 1); } function match(type, pattern, captureIndex) { var captures = scan(pattern); if (captures) { return { type: type, value: captures[captureIndex] }; } } function scan(regexp) { var captures, blankCaptures; blankCaptures = /^[\n\r\t\s]+/.exec(input); if (blankCaptures) { consume(blankCaptures[0].length); } captures = regexp.exec(input); if (captures) { consume(captures[0].length); } return captures; } function consume(size) { input = input.substr(size); } return function(code) { input = code.toString(); return getAST(); }; })(); exports.parse = (GradientParser || {}).parse; /***/ }), /***/ 9664: /***/ ((module) => { module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __nested_webpack_require_187__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_187__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __nested_webpack_require_187__.m = modules; /******/ /******/ // expose the module cache /******/ __nested_webpack_require_187__.c = installedModules; /******/ /******/ // __webpack_public_path__ /******/ __nested_webpack_require_187__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __nested_webpack_require_187__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __nested_webpack_require_1468__) { module.exports = __nested_webpack_require_1468__(1); /***/ }), /* 1 */ /***/ (function(module, exports, __nested_webpack_require_1587__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _utils = __nested_webpack_require_1587__(2); Object.defineProperty(exports, 'combineChunks', { enumerable: true, get: function get() { return _utils.combineChunks; } }); Object.defineProperty(exports, 'fillInChunks', { enumerable: true, get: function get() { return _utils.fillInChunks; } }); Object.defineProperty(exports, 'findAll', { enumerable: true, get: function get() { return _utils.findAll; } }); Object.defineProperty(exports, 'findChunks', { enumerable: true, get: function get() { return _utils.findChunks; } }); /***/ }), /* 2 */ /***/ (function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** * Creates an array of chunk objects representing both higlightable and non highlightable pieces of text that match each search word. * @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean }) */ var findAll = exports.findAll = function findAll(_ref) { var autoEscape = _ref.autoEscape, _ref$caseSensitive = _ref.caseSensitive, caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive, _ref$findChunks = _ref.findChunks, findChunks = _ref$findChunks === undefined ? defaultFindChunks : _ref$findChunks, sanitize = _ref.sanitize, searchWords = _ref.searchWords, textToHighlight = _ref.textToHighlight; return fillInChunks({ chunksToHighlight: combineChunks({ chunks: findChunks({ autoEscape: autoEscape, caseSensitive: caseSensitive, sanitize: sanitize, searchWords: searchWords, textToHighlight: textToHighlight }) }), totalLength: textToHighlight ? textToHighlight.length : 0 }); }; /** * Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks. * @return {start:number, end:number}[] */ var combineChunks = exports.combineChunks = function combineChunks(_ref2) { var chunks = _ref2.chunks; chunks = chunks.sort(function (first, second) { return first.start - second.start; }).reduce(function (processedChunks, nextChunk) { // First chunk just goes straight in the array... if (processedChunks.length === 0) { return [nextChunk]; } else { // ... subsequent chunks get checked to see if they overlap... var prevChunk = processedChunks.pop(); if (nextChunk.start <= prevChunk.end) { // It may be the case that prevChunk completely surrounds nextChunk, so take the // largest of the end indeces. var endIndex = Math.max(prevChunk.end, nextChunk.end); processedChunks.push({ highlight: false, start: prevChunk.start, end: endIndex }); } else { processedChunks.push(prevChunk, nextChunk); } return processedChunks; } }, []); return chunks; }; /** * Examine text for any matches. * If we find matches, add them to the returned array as a "chunk" object ({start:number, end:number}). * @return {start:number, end:number}[] */ var defaultFindChunks = function defaultFindChunks(_ref3) { var autoEscape = _ref3.autoEscape, caseSensitive = _ref3.caseSensitive, _ref3$sanitize = _ref3.sanitize, sanitize = _ref3$sanitize === undefined ? defaultSanitize : _ref3$sanitize, searchWords = _ref3.searchWords, textToHighlight = _ref3.textToHighlight; textToHighlight = sanitize(textToHighlight); return searchWords.filter(function (searchWord) { return searchWord; }) // Remove empty words .reduce(function (chunks, searchWord) { searchWord = sanitize(searchWord); if (autoEscape) { searchWord = escapeRegExpFn(searchWord); } var regex = new RegExp(searchWord, caseSensitive ? 'g' : 'gi'); var match = void 0; while (match = regex.exec(textToHighlight)) { var _start = match.index; var _end = regex.lastIndex; // We do not return zero-length matches if (_end > _start) { chunks.push({ highlight: false, start: _start, end: _end }); } // Prevent browsers like Firefox from getting stuck in an infinite loop // See http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/ if (match.index === regex.lastIndex) { regex.lastIndex++; } } return chunks; }, []); }; // Allow the findChunks to be overridden in findAll, // but for backwards compatibility we export as the old name exports.findChunks = defaultFindChunks; /** * Given a set of chunks to highlight, create an additional set of chunks * to represent the bits of text between the highlighted text. * @param chunksToHighlight {start:number, end:number}[] * @param totalLength number * @return {start:number, end:number, highlight:boolean}[] */ var fillInChunks = exports.fillInChunks = function fillInChunks(_ref4) { var chunksToHighlight = _ref4.chunksToHighlight, totalLength = _ref4.totalLength; var allChunks = []; var append = function append(start, end, highlight) { if (end - start > 0) { allChunks.push({ start: start, end: end, highlight: highlight }); } }; if (chunksToHighlight.length === 0) { append(0, totalLength, false); } else { var lastIndex = 0; chunksToHighlight.forEach(function (chunk) { append(lastIndex, chunk.start, false); append(chunk.start, chunk.end, true); lastIndex = chunk.end; }); append(lastIndex, totalLength, false); } return allChunks; }; function defaultSanitize(string) { return string; } function escapeRegExpFn(string) { return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); } /***/ }) /******/ ]); /***/ }), /***/ 9681: /***/ ((module) => { var characterMap = { "À": "A", "Á": "A", "Â": "A", "Ã": "A", "Ä": "A", "Å": "A", "Ấ": "A", "Ắ": "A", "Ẳ": "A", "Ẵ": "A", "Ặ": "A", "Æ": "AE", "Ầ": "A", "Ằ": "A", "Ȃ": "A", "Ả": "A", "Ạ": "A", "Ẩ": "A", "Ẫ": "A", "Ậ": "A", "Ç": "C", "Ḉ": "C", "È": "E", "É": "E", "Ê": "E", "Ë": "E", "Ế": "E", "Ḗ": "E", "Ề": "E", "Ḕ": "E", "Ḝ": "E", "Ȇ": "E", "Ẻ": "E", "Ẽ": "E", "Ẹ": "E", "Ể": "E", "Ễ": "E", "Ệ": "E", "Ì": "I", "Í": "I", "Î": "I", "Ï": "I", "Ḯ": "I", "Ȋ": "I", "Ỉ": "I", "Ị": "I", "Ð": "D", "Ñ": "N", "Ò": "O", "Ó": "O", "Ô": "O", "Õ": "O", "Ö": "O", "Ø": "O", "Ố": "O", "Ṍ": "O", "Ṓ": "O", "Ȏ": "O", "Ỏ": "O", "Ọ": "O", "Ổ": "O", "Ỗ": "O", "Ộ": "O", "Ờ": "O", "Ở": "O", "Ỡ": "O", "Ớ": "O", "Ợ": "O", "Ù": "U", "Ú": "U", "Û": "U", "Ü": "U", "Ủ": "U", "Ụ": "U", "Ử": "U", "Ữ": "U", "Ự": "U", "Ý": "Y", "à": "a", "á": "a", "â": "a", "ã": "a", "ä": "a", "å": "a", "ấ": "a", "ắ": "a", "ẳ": "a", "ẵ": "a", "ặ": "a", "æ": "ae", "ầ": "a", "ằ": "a", "ȃ": "a", "ả": "a", "ạ": "a", "ẩ": "a", "ẫ": "a", "ậ": "a", "ç": "c", "ḉ": "c", "è": "e", "é": "e", "ê": "e", "ë": "e", "ế": "e", "ḗ": "e", "ề": "e", "ḕ": "e", "ḝ": "e", "ȇ": "e", "ẻ": "e", "ẽ": "e", "ẹ": "e", "ể": "e", "ễ": "e", "ệ": "e", "ì": "i", "í": "i", "î": "i", "ï": "i", "ḯ": "i", "ȋ": "i", "ỉ": "i", "ị": "i", "ð": "d", "ñ": "n", "ò": "o", "ó": "o", "ô": "o", "õ": "o", "ö": "o", "ø": "o", "ố": "o", "ṍ": "o", "ṓ": "o", "ȏ": "o", "ỏ": "o", "ọ": "o", "ổ": "o", "ỗ": "o", "ộ": "o", "ờ": "o", "ở": "o", "ỡ": "o", "ớ": "o", "ợ": "o", "ù": "u", "ú": "u", "û": "u", "ü": "u", "ủ": "u", "ụ": "u", "ử": "u", "ữ": "u", "ự": "u", "ý": "y", "ÿ": "y", "Ā": "A", "ā": "a", "Ă": "A", "ă": "a", "Ą": "A", "ą": "a", "Ć": "C", "ć": "c", "Ĉ": "C", "ĉ": "c", "Ċ": "C", "ċ": "c", "Č": "C", "č": "c", "C̆": "C", "c̆": "c", "Ď": "D", "ď": "d", "Đ": "D", "đ": "d", "Ē": "E", "ē": "e", "Ĕ": "E", "ĕ": "e", "Ė": "E", "ė": "e", "Ę": "E", "ę": "e", "Ě": "E", "ě": "e", "Ĝ": "G", "Ǵ": "G", "ĝ": "g", "ǵ": "g", "Ğ": "G", "ğ": "g", "Ġ": "G", "ġ": "g", "Ģ": "G", "ģ": "g", "Ĥ": "H", "ĥ": "h", "Ħ": "H", "ħ": "h", "Ḫ": "H", "ḫ": "h", "Ĩ": "I", "ĩ": "i", "Ī": "I", "ī": "i", "Ĭ": "I", "ĭ": "i", "Į": "I", "į": "i", "İ": "I", "ı": "i", "IJ": "IJ", "ij": "ij", "Ĵ": "J", "ĵ": "j", "Ķ": "K", "ķ": "k", "Ḱ": "K", "ḱ": "k", "K̆": "K", "k̆": "k", "Ĺ": "L", "ĺ": "l", "Ļ": "L", "ļ": "l", "Ľ": "L", "ľ": "l", "Ŀ": "L", "ŀ": "l", "Ł": "l", "ł": "l", "Ḿ": "M", "ḿ": "m", "M̆": "M", "m̆": "m", "Ń": "N", "ń": "n", "Ņ": "N", "ņ": "n", "Ň": "N", "ň": "n", "ʼn": "n", "N̆": "N", "n̆": "n", "Ō": "O", "ō": "o", "Ŏ": "O", "ŏ": "o", "Ő": "O", "ő": "o", "Œ": "OE", "œ": "oe", "P̆": "P", "p̆": "p", "Ŕ": "R", "ŕ": "r", "Ŗ": "R", "ŗ": "r", "Ř": "R", "ř": "r", "R̆": "R", "r̆": "r", "Ȓ": "R", "ȓ": "r", "Ś": "S", "ś": "s", "Ŝ": "S", "ŝ": "s", "Ş": "S", "Ș": "S", "ș": "s", "ş": "s", "Š": "S", "š": "s", "Ţ": "T", "ţ": "t", "ț": "t", "Ț": "T", "Ť": "T", "ť": "t", "Ŧ": "T", "ŧ": "t", "T̆": "T", "t̆": "t", "Ũ": "U", "ũ": "u", "Ū": "U", "ū": "u", "Ŭ": "U", "ŭ": "u", "Ů": "U", "ů": "u", "Ű": "U", "ű": "u", "Ų": "U", "ų": "u", "Ȗ": "U", "ȗ": "u", "V̆": "V", "v̆": "v", "Ŵ": "W", "ŵ": "w", "Ẃ": "W", "ẃ": "w", "X̆": "X", "x̆": "x", "Ŷ": "Y", "ŷ": "y", "Ÿ": "Y", "Y̆": "Y", "y̆": "y", "Ź": "Z", "ź": "z", "Ż": "Z", "ż": "z", "Ž": "Z", "ž": "z", "ſ": "s", "ƒ": "f", "Ơ": "O", "ơ": "o", "Ư": "U", "ư": "u", "Ǎ": "A", "ǎ": "a", "Ǐ": "I", "ǐ": "i", "Ǒ": "O", "ǒ": "o", "Ǔ": "U", "ǔ": "u", "Ǖ": "U", "ǖ": "u", "Ǘ": "U", "ǘ": "u", "Ǚ": "U", "ǚ": "u", "Ǜ": "U", "ǜ": "u", "Ứ": "U", "ứ": "u", "Ṹ": "U", "ṹ": "u", "Ǻ": "A", "ǻ": "a", "Ǽ": "AE", "ǽ": "ae", "Ǿ": "O", "ǿ": "o", "Þ": "TH", "þ": "th", "Ṕ": "P", "ṕ": "p", "Ṥ": "S", "ṥ": "s", "X́": "X", "x́": "x", "Ѓ": "Г", "ѓ": "г", "Ќ": "К", "ќ": "к", "A̋": "A", "a̋": "a", "E̋": "E", "e̋": "e", "I̋": "I", "i̋": "i", "Ǹ": "N", "ǹ": "n", "Ồ": "O", "ồ": "o", "Ṑ": "O", "ṑ": "o", "Ừ": "U", "ừ": "u", "Ẁ": "W", "ẁ": "w", "Ỳ": "Y", "ỳ": "y", "Ȁ": "A", "ȁ": "a", "Ȅ": "E", "ȅ": "e", "Ȉ": "I", "ȉ": "i", "Ȍ": "O", "ȍ": "o", "Ȑ": "R", "ȑ": "r", "Ȕ": "U", "ȕ": "u", "B̌": "B", "b̌": "b", "Č̣": "C", "č̣": "c", "Ê̌": "E", "ê̌": "e", "F̌": "F", "f̌": "f", "Ǧ": "G", "ǧ": "g", "Ȟ": "H", "ȟ": "h", "J̌": "J", "ǰ": "j", "Ǩ": "K", "ǩ": "k", "M̌": "M", "m̌": "m", "P̌": "P", "p̌": "p", "Q̌": "Q", "q̌": "q", "Ř̩": "R", "ř̩": "r", "Ṧ": "S", "ṧ": "s", "V̌": "V", "v̌": "v", "W̌": "W", "w̌": "w", "X̌": "X", "x̌": "x", "Y̌": "Y", "y̌": "y", "A̧": "A", "a̧": "a", "B̧": "B", "b̧": "b", "Ḑ": "D", "ḑ": "d", "Ȩ": "E", "ȩ": "e", "Ɛ̧": "E", "ɛ̧": "e", "Ḩ": "H", "ḩ": "h", "I̧": "I", "i̧": "i", "Ɨ̧": "I", "ɨ̧": "i", "M̧": "M", "m̧": "m", "O̧": "O", "o̧": "o", "Q̧": "Q", "q̧": "q", "U̧": "U", "u̧": "u", "X̧": "X", "x̧": "x", "Z̧": "Z", "z̧": "z", "й":"и", "Й":"И", "ё":"е", "Ё":"Е", }; var chars = Object.keys(characterMap).join('|'); var allAccents = new RegExp(chars, 'g'); var firstAccent = new RegExp(chars, ''); function matcher(match) { return characterMap[match]; } var removeAccents = function(string) { return string.replace(allAccents, matcher); }; var hasAccents = function(string) { return !!string.match(firstAccent); }; module.exports = removeAccents; module.exports.has = hasAccents; module.exports.remove = removeAccents; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/create fake namespace object */ /******/ (() => { /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); /******/ var leafPrototypes; /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 16: return value when it's Promise-like /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = this(value); /******/ if(mode & 8) return value; /******/ if(typeof value === 'object' && value) { /******/ if((mode & 4) && value.__esModule) return value; /******/ if((mode & 16) && typeof value.then === 'function') return value; /******/ } /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } /******/ def['default'] = () => (value); /******/ __webpack_require__.d(ns, def); /******/ return ns; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/nonce */ /******/ (() => { /******/ __webpack_require__.nc = undefined; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { AlignmentMatrixControl: () => (/* reexport */ alignment_matrix_control), AnglePickerControl: () => (/* reexport */ angle_picker_control), Animate: () => (/* reexport */ animate), Autocomplete: () => (/* reexport */ Autocomplete), BaseControl: () => (/* reexport */ base_control), BlockQuotation: () => (/* reexport */ external_wp_primitives_namespaceObject.BlockQuotation), BorderBoxControl: () => (/* reexport */ border_box_control_component), BorderControl: () => (/* reexport */ border_control_component), BoxControl: () => (/* reexport */ box_control), Button: () => (/* reexport */ build_module_button), ButtonGroup: () => (/* reexport */ button_group), Card: () => (/* reexport */ card_component), CardBody: () => (/* reexport */ card_body_component), CardDivider: () => (/* reexport */ card_divider_component), CardFooter: () => (/* reexport */ card_footer_component), CardHeader: () => (/* reexport */ card_header_component), CardMedia: () => (/* reexport */ card_media_component), CheckboxControl: () => (/* reexport */ checkbox_control), Circle: () => (/* reexport */ external_wp_primitives_namespaceObject.Circle), ClipboardButton: () => (/* reexport */ ClipboardButton), ColorIndicator: () => (/* reexport */ color_indicator), ColorPalette: () => (/* reexport */ color_palette), ColorPicker: () => (/* reexport */ LegacyAdapter), ComboboxControl: () => (/* reexport */ combobox_control), Composite: () => (/* reexport */ Composite), CustomGradientPicker: () => (/* reexport */ custom_gradient_picker), CustomSelectControl: () => (/* reexport */ custom_select_control), Dashicon: () => (/* reexport */ dashicon), DatePicker: () => (/* reexport */ date), DateTimePicker: () => (/* reexport */ build_module_date_time), Disabled: () => (/* reexport */ disabled), Draggable: () => (/* reexport */ draggable), DropZone: () => (/* reexport */ drop_zone), DropZoneProvider: () => (/* reexport */ DropZoneProvider), Dropdown: () => (/* reexport */ dropdown), DropdownMenu: () => (/* reexport */ dropdown_menu), DuotonePicker: () => (/* reexport */ duotone_picker), DuotoneSwatch: () => (/* reexport */ duotone_swatch), ExternalLink: () => (/* reexport */ external_link), Fill: () => (/* reexport */ slot_fill_Fill), Flex: () => (/* reexport */ flex_component), FlexBlock: () => (/* reexport */ flex_block_component), FlexItem: () => (/* reexport */ flex_item_component), FocalPointPicker: () => (/* reexport */ focal_point_picker), FocusReturnProvider: () => (/* reexport */ with_focus_return_Provider), FocusableIframe: () => (/* reexport */ FocusableIframe), FontSizePicker: () => (/* reexport */ font_size_picker), FormFileUpload: () => (/* reexport */ form_file_upload), FormToggle: () => (/* reexport */ form_toggle), FormTokenField: () => (/* reexport */ form_token_field), G: () => (/* reexport */ external_wp_primitives_namespaceObject.G), GradientPicker: () => (/* reexport */ gradient_picker), Guide: () => (/* reexport */ guide), GuidePage: () => (/* reexport */ GuidePage), HorizontalRule: () => (/* reexport */ external_wp_primitives_namespaceObject.HorizontalRule), Icon: () => (/* reexport */ build_module_icon), IconButton: () => (/* reexport */ deprecated), IsolatedEventContainer: () => (/* reexport */ isolated_event_container), KeyboardShortcuts: () => (/* reexport */ keyboard_shortcuts), Line: () => (/* reexport */ external_wp_primitives_namespaceObject.Line), MenuGroup: () => (/* reexport */ menu_group), MenuItem: () => (/* reexport */ menu_item), MenuItemsChoice: () => (/* reexport */ menu_items_choice), Modal: () => (/* reexport */ modal), NavigableMenu: () => (/* reexport */ navigable_container_menu), Navigator: () => (/* reexport */ navigator_Navigator), Notice: () => (/* reexport */ build_module_notice), NoticeList: () => (/* reexport */ list), Panel: () => (/* reexport */ panel), PanelBody: () => (/* reexport */ body), PanelHeader: () => (/* reexport */ panel_header), PanelRow: () => (/* reexport */ row), Path: () => (/* reexport */ external_wp_primitives_namespaceObject.Path), Placeholder: () => (/* reexport */ placeholder), Polygon: () => (/* reexport */ external_wp_primitives_namespaceObject.Polygon), Popover: () => (/* reexport */ popover), ProgressBar: () => (/* reexport */ progress_bar), QueryControls: () => (/* reexport */ query_controls), RadioControl: () => (/* reexport */ radio_control), RangeControl: () => (/* reexport */ range_control), Rect: () => (/* reexport */ external_wp_primitives_namespaceObject.Rect), ResizableBox: () => (/* reexport */ resizable_box), ResponsiveWrapper: () => (/* reexport */ responsive_wrapper), SVG: () => (/* reexport */ external_wp_primitives_namespaceObject.SVG), SandBox: () => (/* reexport */ sandbox), ScrollLock: () => (/* reexport */ scroll_lock), SearchControl: () => (/* reexport */ search_control), SelectControl: () => (/* reexport */ select_control), Slot: () => (/* reexport */ slot_fill_Slot), SlotFillProvider: () => (/* reexport */ Provider), Snackbar: () => (/* reexport */ snackbar), SnackbarList: () => (/* reexport */ snackbar_list), Spinner: () => (/* reexport */ spinner), TabPanel: () => (/* reexport */ tab_panel), TabbableContainer: () => (/* reexport */ tabbable), TextControl: () => (/* reexport */ text_control), TextHighlight: () => (/* reexport */ text_highlight), TextareaControl: () => (/* reexport */ textarea_control), TimePicker: () => (/* reexport */ date_time_time), Tip: () => (/* reexport */ build_module_tip), ToggleControl: () => (/* reexport */ toggle_control), Toolbar: () => (/* reexport */ toolbar), ToolbarButton: () => (/* reexport */ toolbar_button), ToolbarDropdownMenu: () => (/* reexport */ toolbar_dropdown_menu), ToolbarGroup: () => (/* reexport */ toolbar_group), ToolbarItem: () => (/* reexport */ toolbar_item), Tooltip: () => (/* reexport */ tooltip), TreeSelect: () => (/* reexport */ tree_select), VisuallyHidden: () => (/* reexport */ visually_hidden_component), __experimentalAlignmentMatrixControl: () => (/* reexport */ alignment_matrix_control), __experimentalApplyValueToSides: () => (/* reexport */ applyValueToSides), __experimentalBorderBoxControl: () => (/* reexport */ border_box_control_component), __experimentalBorderControl: () => (/* reexport */ border_control_component), __experimentalBoxControl: () => (/* reexport */ box_control), __experimentalConfirmDialog: () => (/* reexport */ confirm_dialog_component), __experimentalDimensionControl: () => (/* reexport */ dimension_control), __experimentalDivider: () => (/* reexport */ divider_component), __experimentalDropdownContentWrapper: () => (/* reexport */ dropdown_content_wrapper), __experimentalElevation: () => (/* reexport */ elevation_component), __experimentalGrid: () => (/* reexport */ grid_component), __experimentalHStack: () => (/* reexport */ h_stack_component), __experimentalHasSplitBorders: () => (/* reexport */ hasSplitBorders), __experimentalHeading: () => (/* reexport */ heading_component), __experimentalInputControl: () => (/* reexport */ input_control), __experimentalInputControlPrefixWrapper: () => (/* reexport */ input_prefix_wrapper), __experimentalInputControlSuffixWrapper: () => (/* reexport */ input_suffix_wrapper), __experimentalIsDefinedBorder: () => (/* reexport */ isDefinedBorder), __experimentalIsEmptyBorder: () => (/* reexport */ isEmptyBorder), __experimentalItem: () => (/* reexport */ item_component), __experimentalItemGroup: () => (/* reexport */ item_group_component), __experimentalNavigation: () => (/* reexport */ navigation), __experimentalNavigationBackButton: () => (/* reexport */ back_button), __experimentalNavigationGroup: () => (/* reexport */ group), __experimentalNavigationItem: () => (/* reexport */ navigation_item), __experimentalNavigationMenu: () => (/* reexport */ navigation_menu), __experimentalNavigatorBackButton: () => (/* reexport */ legacy_NavigatorBackButton), __experimentalNavigatorButton: () => (/* reexport */ legacy_NavigatorButton), __experimentalNavigatorProvider: () => (/* reexport */ NavigatorProvider), __experimentalNavigatorScreen: () => (/* reexport */ legacy_NavigatorScreen), __experimentalNavigatorToParentButton: () => (/* reexport */ legacy_NavigatorToParentButton), __experimentalNumberControl: () => (/* reexport */ number_control), __experimentalPaletteEdit: () => (/* reexport */ palette_edit), __experimentalParseQuantityAndUnitFromRawValue: () => (/* reexport */ parseQuantityAndUnitFromRawValue), __experimentalRadio: () => (/* reexport */ radio_group_radio), __experimentalRadioGroup: () => (/* reexport */ radio_group), __experimentalScrollable: () => (/* reexport */ scrollable_component), __experimentalSpacer: () => (/* reexport */ spacer_component), __experimentalStyleProvider: () => (/* reexport */ style_provider), __experimentalSurface: () => (/* reexport */ surface_component), __experimentalText: () => (/* reexport */ text_component), __experimentalToggleGroupControl: () => (/* reexport */ toggle_group_control_component), __experimentalToggleGroupControlOption: () => (/* reexport */ toggle_group_control_option_component), __experimentalToggleGroupControlOptionIcon: () => (/* reexport */ toggle_group_control_option_icon_component), __experimentalToolbarContext: () => (/* reexport */ toolbar_context), __experimentalToolsPanel: () => (/* reexport */ tools_panel_component), __experimentalToolsPanelContext: () => (/* reexport */ ToolsPanelContext), __experimentalToolsPanelItem: () => (/* reexport */ tools_panel_item_component), __experimentalTreeGrid: () => (/* reexport */ tree_grid), __experimentalTreeGridCell: () => (/* reexport */ cell), __experimentalTreeGridItem: () => (/* reexport */ tree_grid_item), __experimentalTreeGridRow: () => (/* reexport */ tree_grid_row), __experimentalTruncate: () => (/* reexport */ truncate_component), __experimentalUnitControl: () => (/* reexport */ unit_control), __experimentalUseCustomUnits: () => (/* reexport */ useCustomUnits), __experimentalUseNavigator: () => (/* reexport */ useNavigator), __experimentalUseSlot: () => (/* reexport */ useSlot), __experimentalUseSlotFills: () => (/* reexport */ useSlotFills), __experimentalVStack: () => (/* reexport */ v_stack_component), __experimentalView: () => (/* reexport */ component), __experimentalZStack: () => (/* reexport */ z_stack_component), __unstableAnimatePresence: () => (/* reexport */ AnimatePresence), __unstableComposite: () => (/* reexport */ legacy_Composite), __unstableCompositeGroup: () => (/* reexport */ legacy_CompositeGroup), __unstableCompositeItem: () => (/* reexport */ legacy_CompositeItem), __unstableDisclosureContent: () => (/* reexport */ disclosure_DisclosureContent), __unstableGetAnimateClassName: () => (/* reexport */ getAnimateClassName), __unstableMotion: () => (/* reexport */ motion), __unstableUseAutocompleteProps: () => (/* reexport */ useAutocompleteProps), __unstableUseCompositeState: () => (/* reexport */ useCompositeState), __unstableUseNavigateRegions: () => (/* reexport */ useNavigateRegions), createSlotFill: () => (/* reexport */ createSlotFill), navigateRegions: () => (/* reexport */ navigate_regions), privateApis: () => (/* reexport */ privateApis), useBaseControlProps: () => (/* reexport */ useBaseControlProps), useNavigator: () => (/* reexport */ useNavigator), withConstrainedTabbing: () => (/* reexport */ with_constrained_tabbing), withFallbackStyles: () => (/* reexport */ with_fallback_styles), withFilters: () => (/* reexport */ withFilters), withFocusOutside: () => (/* reexport */ with_focus_outside), withFocusReturn: () => (/* reexport */ with_focus_return), withNotices: () => (/* reexport */ with_notices), withSpokenMessages: () => (/* reexport */ with_spoken_messages) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/text/styles.js var text_styles_namespaceObject = {}; __webpack_require__.r(text_styles_namespaceObject); __webpack_require__.d(text_styles_namespaceObject, { Text: () => (Text), block: () => (styles_block), destructive: () => (destructive), highlighterText: () => (highlighterText), muted: () => (muted), positive: () => (positive), upperCase: () => (upperCase) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js var toggle_group_control_option_base_styles_namespaceObject = {}; __webpack_require__.r(toggle_group_control_option_base_styles_namespaceObject); __webpack_require__.d(toggle_group_control_option_base_styles_namespaceObject, { Rp: () => (ButtonContentView), y0: () => (LabelView), uG: () => (buttonView), eh: () => (labelBlock) }); ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/clsx/dist/clsx.mjs function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js "use client"; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var _3YLGPPWQ_spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __objRest = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop]; } return target; }; ;// ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js "use client"; var _3YLGPPWQ_defProp = Object.defineProperty; var _3YLGPPWQ_defProps = Object.defineProperties; var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors; var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols; var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty; var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable; var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var _chunks_3YLGPPWQ_spreadValues = (a, b) => { for (var prop in b || (b = {})) if (_3YLGPPWQ_hasOwnProp.call(b, prop)) _3YLGPPWQ_defNormalProp(a, prop, b[prop]); if (_3YLGPPWQ_getOwnPropSymbols) for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) { if (_3YLGPPWQ_propIsEnum.call(b, prop)) _3YLGPPWQ_defNormalProp(a, prop, b[prop]); } return a; }; var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b)); var _3YLGPPWQ_objRest = (source, exclude) => { var target = {}; for (var prop in source) if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && _3YLGPPWQ_getOwnPropSymbols) for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) { if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop)) target[prop] = source[prop]; } return target; }; ;// ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js "use client"; // src/utils/misc.ts function noop(..._) { } function shallowEqual(a, b) { if (a === b) return true; if (!a) return false; if (!b) return false; if (typeof a !== "object") return false; if (typeof b !== "object") return false; const aKeys = Object.keys(a); const bKeys = Object.keys(b); const { length } = aKeys; if (bKeys.length !== length) return false; for (const key of aKeys) { if (a[key] !== b[key]) { return false; } } return true; } function applyState(argument, currentValue) { if (isUpdater(argument)) { const value = isLazyValue(currentValue) ? currentValue() : currentValue; return argument(value); } return argument; } function isUpdater(argument) { return typeof argument === "function"; } function isLazyValue(value) { return typeof value === "function"; } function isObject(arg) { return typeof arg === "object" && arg != null; } function isEmpty(arg) { if (Array.isArray(arg)) return !arg.length; if (isObject(arg)) return !Object.keys(arg).length; if (arg == null) return true; if (arg === "") return true; return false; } function isInteger(arg) { if (typeof arg === "number") { return Math.floor(arg) === arg; } return String(Math.floor(Number(arg))) === arg; } function PBFD2E7P_hasOwnProperty(object, prop) { if (typeof Object.hasOwn === "function") { return Object.hasOwn(object, prop); } return Object.prototype.hasOwnProperty.call(object, prop); } function chain(...fns) { return (...args) => { for (const fn of fns) { if (typeof fn === "function") { fn(...args); } } }; } function cx(...args) { return args.filter(Boolean).join(" ") || void 0; } function normalizeString(str) { return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); } function omit(object, keys) { const result = _chunks_3YLGPPWQ_spreadValues({}, object); for (const key of keys) { if (PBFD2E7P_hasOwnProperty(result, key)) { delete result[key]; } } return result; } function pick(object, paths) { const result = {}; for (const key of paths) { if (PBFD2E7P_hasOwnProperty(object, key)) { result[key] = object[key]; } } return result; } function identity(value) { return value; } function beforePaint(cb = noop) { const raf = requestAnimationFrame(cb); return () => cancelAnimationFrame(raf); } function afterPaint(cb = noop) { let raf = requestAnimationFrame(() => { raf = requestAnimationFrame(cb); }); return () => cancelAnimationFrame(raf); } function invariant(condition, message) { if (condition) return; if (typeof message !== "string") throw new Error("Invariant failed"); throw new Error(message); } function getKeys(obj) { return Object.keys(obj); } function isFalsyBooleanCallback(booleanOrCallback, ...args) { const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; if (result == null) return false; return !result; } function disabledFromProps(props) { return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; } function removeUndefinedValues(obj) { const result = {}; for (const key in obj) { if (obj[key] !== void 0) { result[key] = obj[key]; } } return result; } function defaultValue(...values) { for (const value of values) { if (value !== void 0) return value; } return void 0; } // EXTERNAL MODULE: external "React" var external_React_ = __webpack_require__(1609); var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2); var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_); ;// ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js "use client"; // src/utils/misc.ts function setRef(ref, value) { if (typeof ref === "function") { ref(value); } else if (ref) { ref.current = value; } } function isValidElementWithRef(element) { if (!element) return false; if (!(0,external_React_.isValidElement)(element)) return false; if ("ref" in element.props) return true; if ("ref" in element) return true; return false; } function getRefProperty(element) { if (!isValidElementWithRef(element)) return null; const props = _3YLGPPWQ_spreadValues({}, element.props); return props.ref || element.ref; } function mergeProps(base, overrides) { const props = _3YLGPPWQ_spreadValues({}, base); for (const key in overrides) { if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue; if (key === "className") { const prop = "className"; props[prop] = base[prop] ? `${base[prop]} ${overrides[prop]}` : overrides[prop]; continue; } if (key === "style") { const prop = "style"; props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop]; continue; } const overrideValue = overrides[key]; if (typeof overrideValue === "function" && key.startsWith("on")) { const baseValue = base[key]; if (typeof baseValue === "function") { props[key] = (...args) => { overrideValue(...args); baseValue(...args); }; continue; } } props[key] = overrideValue; } return props; } ;// ./node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js "use client"; // src/utils/dom.ts var canUseDOM = checkIsBrowser(); function checkIsBrowser() { var _a; return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); } function getDocument(node) { if (!node) return document; if ("self" in node) return node.document; return node.ownerDocument || document; } function getWindow(node) { if (!node) return self; if ("self" in node) return node.self; return getDocument(node).defaultView || window; } function getActiveElement(node, activeDescendant = false) { const { activeElement } = getDocument(node); if (!(activeElement == null ? void 0 : activeElement.nodeName)) { return null; } if (isFrame(activeElement) && activeElement.contentDocument) { return getActiveElement( activeElement.contentDocument.body, activeDescendant ); } if (activeDescendant) { const id = activeElement.getAttribute("aria-activedescendant"); if (id) { const element = getDocument(activeElement).getElementById(id); if (element) { return element; } } } return activeElement; } function contains(parent, child) { return parent === child || parent.contains(child); } function isFrame(element) { return element.tagName === "IFRAME"; } function isButton(element) { const tagName = element.tagName.toLowerCase(); if (tagName === "button") return true; if (tagName === "input" && element.type) { return buttonInputTypes.indexOf(element.type) !== -1; } return false; } var buttonInputTypes = [ "button", "color", "file", "image", "reset", "submit" ]; function isVisible(element) { if (typeof element.checkVisibility === "function") { return element.checkVisibility(); } const htmlElement = element; return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; } function isTextField(element) { try { const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; const isTextArea = element.tagName === "TEXTAREA"; return isTextInput || isTextArea || false; } catch (error) { return false; } } function isTextbox(element) { return element.isContentEditable || isTextField(element); } function getTextboxValue(element) { if (isTextField(element)) { return element.value; } if (element.isContentEditable) { const range = getDocument(element).createRange(); range.selectNodeContents(element); return range.toString(); } return ""; } function getTextboxSelection(element) { let start = 0; let end = 0; if (isTextField(element)) { start = element.selectionStart || 0; end = element.selectionEnd || 0; } else if (element.isContentEditable) { const selection = getDocument(element).getSelection(); if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) { const range = selection.getRangeAt(0); const nextRange = range.cloneRange(); nextRange.selectNodeContents(element); nextRange.setEnd(range.startContainer, range.startOffset); start = nextRange.toString().length; nextRange.setEnd(range.endContainer, range.endOffset); end = nextRange.toString().length; } } return { start, end }; } function getPopupRole(element, fallback) { const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; const role = element == null ? void 0 : element.getAttribute("role"); if (role && allowedPopupRoles.indexOf(role) !== -1) { return role; } return fallback; } function getPopupItemRole(element, fallback) { var _a; const itemRoleByPopupRole = { menu: "menuitem", listbox: "option", tree: "treeitem" }; const popupRole = getPopupRole(element); if (!popupRole) return fallback; const key = popupRole; return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback; } function scrollIntoViewIfNeeded(element, arg) { if (isPartiallyHidden(element) && "scrollIntoView" in element) { element.scrollIntoView(arg); } } function getScrollingElement(element) { if (!element) return null; const isScrollableOverflow = (overflow) => { if (overflow === "auto") return true; if (overflow === "scroll") return true; return false; }; if (element.clientHeight && element.scrollHeight > element.clientHeight) { const { overflowY } = getComputedStyle(element); if (isScrollableOverflow(overflowY)) return element; } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { const { overflowX } = getComputedStyle(element); if (isScrollableOverflow(overflowX)) return element; } return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; } function isPartiallyHidden(element) { const elementRect = element.getBoundingClientRect(); const scroller = getScrollingElement(element); if (!scroller) return false; const scrollerRect = scroller.getBoundingClientRect(); const isHTML = scroller.tagName === "HTML"; const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top; const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom; const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left; const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right; const top = elementRect.top < scrollerTop; const left = elementRect.left < scrollerLeft; const bottom = elementRect.bottom > scrollerBottom; const right = elementRect.right > scrollerRight; return top || left || bottom || right; } function setSelectionRange(element, ...args) { if (/text|search|password|tel|url/i.test(element.type)) { element.setSelectionRange(...args); } } function sortBasedOnDOMPosition(items, getElement) { const pairs = items.map((item, index) => [index, item]); let isOrderDifferent = false; pairs.sort(([indexA, a], [indexB, b]) => { const elementA = getElement(a); const elementB = getElement(b); if (elementA === elementB) return 0; if (!elementA || !elementB) return 0; if (isElementPreceding(elementA, elementB)) { if (indexA > indexB) { isOrderDifferent = true; } return -1; } if (indexA < indexB) { isOrderDifferent = true; } return 1; }); if (isOrderDifferent) { return pairs.map(([_, item]) => item); } return items; } function isElementPreceding(a, b) { return Boolean( b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING ); } ;// ./node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js "use client"; // src/utils/platform.ts function isTouchDevice() { return canUseDOM && !!navigator.maxTouchPoints; } function isApple() { if (!canUseDOM) return false; return /mac|iphone|ipad|ipod/i.test(navigator.platform); } function isSafari() { return canUseDOM && isApple() && /apple/i.test(navigator.vendor); } function isFirefox() { return canUseDOM && /firefox\//i.test(navigator.userAgent); } function isMac() { return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice(); } ;// ./node_modules/@ariakit/core/esm/utils/events.js "use client"; // src/utils/events.ts function isPortalEvent(event) { return Boolean( event.currentTarget && !contains(event.currentTarget, event.target) ); } function isSelfTarget(event) { return event.target === event.currentTarget; } function isOpeningInNewTab(event) { const element = event.currentTarget; if (!element) return false; const isAppleDevice = isApple(); if (isAppleDevice && !event.metaKey) return false; if (!isAppleDevice && !event.ctrlKey) return false; const tagName = element.tagName.toLowerCase(); if (tagName === "a") return true; if (tagName === "button" && element.type === "submit") return true; if (tagName === "input" && element.type === "submit") return true; return false; } function isDownloading(event) { const element = event.currentTarget; if (!element) return false; const tagName = element.tagName.toLowerCase(); if (!event.altKey) return false; if (tagName === "a") return true; if (tagName === "button" && element.type === "submit") return true; if (tagName === "input" && element.type === "submit") return true; return false; } function fireEvent(element, type, eventInit) { const event = new Event(type, eventInit); return element.dispatchEvent(event); } function fireBlurEvent(element, eventInit) { const event = new FocusEvent("blur", eventInit); const defaultAllowed = element.dispatchEvent(event); const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true }); element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); return defaultAllowed; } function fireFocusEvent(element, eventInit) { const event = new FocusEvent("focus", eventInit); const defaultAllowed = element.dispatchEvent(event); const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true }); element.dispatchEvent(new FocusEvent("focusin", bubbleInit)); return defaultAllowed; } function fireKeyboardEvent(element, type, eventInit) { const event = new KeyboardEvent(type, eventInit); return element.dispatchEvent(event); } function fireClickEvent(element, eventInit) { const event = new MouseEvent("click", eventInit); return element.dispatchEvent(event); } function isFocusEventOutside(event, container) { const containerElement = container || event.currentTarget; const relatedTarget = event.relatedTarget; return !relatedTarget || !contains(containerElement, relatedTarget); } function getInputType(event) { const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event; if (!nativeEvent) return; if (!("inputType" in nativeEvent)) return; if (typeof nativeEvent.inputType !== "string") return; return nativeEvent.inputType; } function queueBeforeEvent(element, type, callback, timeout) { const createTimer = (callback2) => { if (timeout) { const timerId2 = setTimeout(callback2, timeout); return () => clearTimeout(timerId2); } const timerId = requestAnimationFrame(callback2); return () => cancelAnimationFrame(timerId); }; const cancelTimer = createTimer(() => { element.removeEventListener(type, callSync, true); callback(); }); const callSync = () => { cancelTimer(); callback(); }; element.addEventListener(type, callSync, { once: true, capture: true }); return cancelTimer; } function addGlobalEventListener(type, listener, options, scope = window) { const children = []; try { scope.document.addEventListener(type, listener, options); for (const frame of Array.from(scope.frames)) { children.push(addGlobalEventListener(type, listener, options, frame)); } } catch (e) { } const removeEventListener = () => { try { scope.document.removeEventListener(type, listener, options); } catch (e) { } for (const remove of children) { remove(); } }; return removeEventListener; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js "use client"; // src/utils/hooks.ts var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject); var useReactId = _React.useId; var useReactDeferredValue = _React.useDeferredValue; var useReactInsertionEffect = _React.useInsertionEffect; var useSafeLayoutEffect = canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect; function useInitialValue(value) { const [initialValue] = (0,external_React_.useState)(value); return initialValue; } function useLazyValue(init) { const ref = useRef(); if (ref.current === void 0) { ref.current = init(); } return ref.current; } function useLiveRef(value) { const ref = (0,external_React_.useRef)(value); useSafeLayoutEffect(() => { ref.current = value; }); return ref; } function usePreviousValue(value) { const [previousValue, setPreviousValue] = useState(value); if (value !== previousValue) { setPreviousValue(value); } return previousValue; } function useEvent(callback) { const ref = (0,external_React_.useRef)(() => { throw new Error("Cannot call an event handler while rendering."); }); if (useReactInsertionEffect) { useReactInsertionEffect(() => { ref.current = callback; }); } else { ref.current = callback; } return (0,external_React_.useCallback)((...args) => { var _a; return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); }, []); } function useTransactionState(callback) { const [state, setState] = (0,external_React_.useState)(null); useSafeLayoutEffect(() => { if (state == null) return; if (!callback) return; let prevState = null; callback((prev) => { prevState = prev; return state; }); return () => { callback(prevState); }; }, [state, callback]); return [state, setState]; } function useMergeRefs(...refs) { return (0,external_React_.useMemo)(() => { if (!refs.some(Boolean)) return; return (value) => { for (const ref of refs) { setRef(ref, value); } }; }, refs); } function useId(defaultId) { if (useReactId) { const reactId = useReactId(); if (defaultId) return defaultId; return reactId; } const [id, setId] = (0,external_React_.useState)(defaultId); useSafeLayoutEffect(() => { if (defaultId || id) return; const random = Math.random().toString(36).slice(2, 8); setId(`id-${random}`); }, [defaultId, id]); return defaultId || id; } function useDeferredValue(value) { if (useReactDeferredValue) { return useReactDeferredValue(value); } const [deferredValue, setDeferredValue] = useState(value); useEffect(() => { const raf = requestAnimationFrame(() => setDeferredValue(value)); return () => cancelAnimationFrame(raf); }, [value]); return deferredValue; } function useTagName(refOrElement, type) { const stringOrUndefined = (type2) => { if (typeof type2 !== "string") return; return type2; }; const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type)); useSafeLayoutEffect(() => { const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); }, [refOrElement, type]); return tagName; } function useAttribute(refOrElement, attributeName, defaultValue) { const initialValue = useInitialValue(defaultValue); const [attribute, setAttribute] = (0,external_React_.useState)(initialValue); (0,external_React_.useEffect)(() => { const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; if (!element) return; const callback = () => { const value = element.getAttribute(attributeName); setAttribute(value == null ? initialValue : value); }; const observer = new MutationObserver(callback); observer.observe(element, { attributeFilter: [attributeName] }); callback(); return () => observer.disconnect(); }, [refOrElement, attributeName, initialValue]); return attribute; } function useUpdateEffect(effect, deps) { const mounted = (0,external_React_.useRef)(false); (0,external_React_.useEffect)(() => { if (mounted.current) { return effect(); } mounted.current = true; }, deps); (0,external_React_.useEffect)( () => () => { mounted.current = false; }, [] ); } function useUpdateLayoutEffect(effect, deps) { const mounted = useRef(false); useSafeLayoutEffect(() => { if (mounted.current) { return effect(); } mounted.current = true; }, deps); useSafeLayoutEffect( () => () => { mounted.current = false; }, [] ); } function useForceUpdate() { return (0,external_React_.useReducer)(() => [], []); } function useBooleanEvent(booleanOrCallback) { return useEvent( typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback ); } function useWrapElement(props, callback, deps = []) { const wrapElement = (0,external_React_.useCallback)( (element) => { if (props.wrapElement) { element = props.wrapElement(element); } return callback(element); }, [...deps, props.wrapElement] ); return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement }); } function usePortalRef(portalProp = false, portalRefProp) { const [portalNode, setPortalNode] = (0,external_React_.useState)(null); const portalRef = useMergeRefs(setPortalNode, portalRefProp); const domReady = !portalProp || portalNode; return { portalRef, portalNode, domReady }; } function useMetadataProps(props, key, value) { const parent = props.onLoadedMetadataCapture; const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => { return Object.assign(() => { }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value })); }, [parent, key, value]); return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }]; } function useIsMouseMoving() { (0,external_React_.useEffect)(() => { addGlobalEventListener("mousemove", setMouseMoving, true); addGlobalEventListener("mousedown", resetMouseMoving, true); addGlobalEventListener("mouseup", resetMouseMoving, true); addGlobalEventListener("keydown", resetMouseMoving, true); addGlobalEventListener("scroll", resetMouseMoving, true); }, []); const isMouseMoving = useEvent(() => mouseMoving); return isMouseMoving; } var mouseMoving = false; var previousScreenX = 0; var previousScreenY = 0; function hasMouseMovement(event) { const movementX = event.movementX || event.screenX - previousScreenX; const movementY = event.movementY || event.screenY - previousScreenY; previousScreenX = event.screenX; previousScreenY = event.screenY; return movementX || movementY || "production" === "test"; } function setMouseMoving(event) { if (!hasMouseMovement(event)) return; mouseMoving = true; } function resetMouseMoving() { mouseMoving = false; } ;// ./node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js "use client"; // src/utils/store.ts function getInternal(store, key) { const internals = store.__unstableInternals; invariant(internals, "Invalid store"); return internals[key]; } function createStore(initialState, ...stores) { let state = initialState; let prevStateBatch = state; let lastUpdate = Symbol(); let destroy = noop; const instances = /* @__PURE__ */ new Set(); const updatedKeys = /* @__PURE__ */ new Set(); const setups = /* @__PURE__ */ new Set(); const listeners = /* @__PURE__ */ new Set(); const batchListeners = /* @__PURE__ */ new Set(); const disposables = /* @__PURE__ */ new WeakMap(); const listenerKeys = /* @__PURE__ */ new WeakMap(); const storeSetup = (callback) => { setups.add(callback); return () => setups.delete(callback); }; const storeInit = () => { const initialized = instances.size; const instance = Symbol(); instances.add(instance); const maybeDestroy = () => { instances.delete(instance); if (instances.size) return; destroy(); }; if (initialized) return maybeDestroy; const desyncs = getKeys(state).map( (key) => chain( ...stores.map((store) => { var _a; const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store); if (!storeState) return; if (!PBFD2E7P_hasOwnProperty(storeState, key)) return; return sync(store, [key], (state2) => { setState( key, state2[key], // @ts-expect-error - Not public API. This is just to prevent // infinite loops. true ); }); }) ) ); const teardowns = []; for (const setup2 of setups) { teardowns.push(setup2()); } const cleanups = stores.map(init); destroy = chain(...desyncs, ...teardowns, ...cleanups); return maybeDestroy; }; const sub = (keys, listener, set = listeners) => { set.add(listener); listenerKeys.set(listener, keys); return () => { var _a; (_a = disposables.get(listener)) == null ? void 0 : _a(); disposables.delete(listener); listenerKeys.delete(listener); set.delete(listener); }; }; const storeSubscribe = (keys, listener) => sub(keys, listener); const storeSync = (keys, listener) => { disposables.set(listener, listener(state, state)); return sub(keys, listener); }; const storeBatch = (keys, listener) => { disposables.set(listener, listener(state, prevStateBatch)); return sub(keys, listener, batchListeners); }; const storePick = (keys) => createStore(pick(state, keys), finalStore); const storeOmit = (keys) => createStore(omit(state, keys), finalStore); const getState = () => state; const setState = (key, value, fromStores = false) => { var _a; if (!PBFD2E7P_hasOwnProperty(state, key)) return; const nextValue = applyState(value, state[key]); if (nextValue === state[key]) return; if (!fromStores) { for (const store of stores) { (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue); } } const prevState = state; state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue }); const thisUpdate = Symbol(); lastUpdate = thisUpdate; updatedKeys.add(key); const run = (listener, prev, uKeys) => { var _a2; const keys = listenerKeys.get(listener); const updated = (k) => uKeys ? uKeys.has(k) : k === key; if (!keys || keys.some(updated)) { (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); disposables.set(listener, listener(state, prev)); } }; for (const listener of listeners) { run(listener, prevState); } queueMicrotask(() => { if (lastUpdate !== thisUpdate) return; const snapshot = state; for (const listener of batchListeners) { run(listener, prevStateBatch, updatedKeys); } prevStateBatch = snapshot; updatedKeys.clear(); }); }; const finalStore = { getState, setState, __unstableInternals: { setup: storeSetup, init: storeInit, subscribe: storeSubscribe, sync: storeSync, batch: storeBatch, pick: storePick, omit: storeOmit } }; return finalStore; } function setup(store, ...args) { if (!store) return; return getInternal(store, "setup")(...args); } function init(store, ...args) { if (!store) return; return getInternal(store, "init")(...args); } function subscribe(store, ...args) { if (!store) return; return getInternal(store, "subscribe")(...args); } function sync(store, ...args) { if (!store) return; return getInternal(store, "sync")(...args); } function batch(store, ...args) { if (!store) return; return getInternal(store, "batch")(...args); } function omit2(store, ...args) { if (!store) return; return getInternal(store, "omit")(...args); } function pick2(store, ...args) { if (!store) return; return getInternal(store, "pick")(...args); } function mergeStore(...stores) { const initialState = stores.reduce((state, store2) => { var _a; const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); if (!nextState) return state; return Object.assign(state, nextState); }, {}); const store = createStore(initialState, ...stores); return Object.assign({}, ...stores, store); } function throwOnConflictingProps(props, store) { if (true) return; if (!store) return; const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { var _a; const stateKey = key.replace("default", ""); return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`; }); if (!defaultKeys.length) return; const storeState = store.getState(); const conflictingProps = defaultKeys.filter( (key) => PBFD2E7P_hasOwnProperty(storeState, key) ); if (!conflictingProps.length) return; throw new Error( `Passing a store prop in conjunction with a default state is not supported. const store = useSelectStore(); <SelectProvider store={store} defaultValue="Apple" /> ^ ^ Instead, pass the default state to the topmost store: const store = useSelectStore({ defaultValue: "Apple" }); <SelectProvider store={store} /> See https://github.com/ariakit/ariakit/pull/2745 for more details. If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit ` ); } // EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js var shim = __webpack_require__(422); ;// ./node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js "use client"; // src/utils/store.tsx var { useSyncExternalStore } = shim; var noopSubscribe = () => () => { }; function useStoreState(store, keyOrSelector = identity) { const storeSubscribe = external_React_.useCallback( (callback) => { if (!store) return noopSubscribe(); return subscribe(store, null, callback); }, [store] ); const getSnapshot = () => { const key = typeof keyOrSelector === "string" ? keyOrSelector : null; const selector = typeof keyOrSelector === "function" ? keyOrSelector : null; const state = store == null ? void 0 : store.getState(); if (selector) return selector(state); if (!state) return; if (!key) return; if (!PBFD2E7P_hasOwnProperty(state, key)) return; return state[key]; }; return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); } function useStoreStateObject(store, object) { const objRef = external_React_.useRef( {} ); const storeSubscribe = external_React_.useCallback( (callback) => { if (!store) return noopSubscribe(); return subscribe(store, null, callback); }, [store] ); const getSnapshot = () => { const state = store == null ? void 0 : store.getState(); let updated = false; const obj = objRef.current; for (const prop in object) { const keyOrSelector = object[prop]; if (typeof keyOrSelector === "function") { const value = keyOrSelector(state); if (value !== obj[prop]) { obj[prop] = value; updated = true; } } if (typeof keyOrSelector === "string") { if (!state) continue; if (!PBFD2E7P_hasOwnProperty(state, keyOrSelector)) continue; const value = state[keyOrSelector]; if (value !== obj[prop]) { obj[prop] = value; updated = true; } } } if (updated) { objRef.current = _3YLGPPWQ_spreadValues({}, obj); } return objRef.current; }; return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); } function useStoreProps(store, props, key, setKey) { const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0; const setValue = setKey ? props[setKey] : void 0; const propsRef = useLiveRef({ value, setValue }); useSafeLayoutEffect(() => { return sync(store, [key], (state, prev) => { const { value: value2, setValue: setValue2 } = propsRef.current; if (!setValue2) return; if (state[key] === prev[key]) return; if (state[key] === value2) return; setValue2(state[key]); }); }, [store, key]); useSafeLayoutEffect(() => { if (value === void 0) return; store.setState(key, value); return batch(store, [key], () => { if (value === void 0) return; store.setState(key, value); }); }); } function YV4JVR4I_useStore(createStore, props) { const [store, setStore] = external_React_.useState(() => createStore(props)); useSafeLayoutEffect(() => init(store), [store]); const useState2 = external_React_.useCallback( (keyOrSelector) => useStoreState(store, keyOrSelector), [store] ); const memoizedStore = external_React_.useMemo( () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }), [store, useState2] ); const updateStore = useEvent(() => { setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState()))); }); return [memoizedStore, updateStore]; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js "use client"; // src/collection/collection-store.ts function useCollectionStoreProps(store, update, props) { useUpdateEffect(update, [props.store]); useStoreProps(store, props, "items", "setItems"); return store; } function useCollectionStore(props = {}) { const [store, update] = useStore(Core.createCollectionStore, props); return useCollectionStoreProps(store, update, props); } ;// ./node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js "use client"; // src/collection/collection-store.ts function getCommonParent(items) { var _a; const firstItem = items.find((item) => !!item.element); const lastItem = [...items].reverse().find((item) => !!item.element); let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { const parent = parentElement; if (lastItem && parent.contains(lastItem.element)) { return parentElement; } parentElement = parentElement.parentElement; } return getDocument(parentElement).body; } function getPrivateStore(store) { return store == null ? void 0 : store.__unstablePrivateStore; } function createCollectionStore(props = {}) { var _a; throwOnConflictingProps(props, props.store); const syncState = (_a = props.store) == null ? void 0 : _a.getState(); const items = defaultValue( props.items, syncState == null ? void 0 : syncState.items, props.defaultItems, [] ); const itemsMap = new Map(items.map((item) => [item.id, item])); const initialState = { items, renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) }; const syncPrivateStore = getPrivateStore(props.store); const privateStore = createStore( { items, renderedItems: initialState.renderedItems }, syncPrivateStore ); const collection = createStore(initialState, props.store); const sortItems = (renderedItems) => { const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element); privateStore.setState("renderedItems", sortedItems); collection.setState("renderedItems", sortedItems); }; setup(collection, () => init(privateStore)); setup(privateStore, () => { return batch(privateStore, ["items"], (state) => { collection.setState("items", state.items); }); }); setup(privateStore, () => { return batch(privateStore, ["renderedItems"], (state) => { let firstRun = true; let raf = requestAnimationFrame(() => { const { renderedItems } = collection.getState(); if (state.renderedItems === renderedItems) return; sortItems(state.renderedItems); }); if (typeof IntersectionObserver !== "function") { return () => cancelAnimationFrame(raf); } const ioCallback = () => { if (firstRun) { firstRun = false; return; } cancelAnimationFrame(raf); raf = requestAnimationFrame(() => sortItems(state.renderedItems)); }; const root = getCommonParent(state.renderedItems); const observer = new IntersectionObserver(ioCallback, { root }); for (const item of state.renderedItems) { if (!item.element) continue; observer.observe(item.element); } return () => { cancelAnimationFrame(raf); observer.disconnect(); }; }); }); const mergeItem = (item, setItems, canDeleteFromMap = false) => { let prevItem; setItems((items2) => { const index = items2.findIndex(({ id }) => id === item.id); const nextItems = items2.slice(); if (index !== -1) { prevItem = items2[index]; const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item); nextItems[index] = nextItem; itemsMap.set(item.id, nextItem); } else { nextItems.push(item); itemsMap.set(item.id, item); } return nextItems; }); const unmergeItem = () => { setItems((items2) => { if (!prevItem) { if (canDeleteFromMap) { itemsMap.delete(item.id); } return items2.filter(({ id }) => id !== item.id); } const index = items2.findIndex(({ id }) => id === item.id); if (index === -1) return items2; const nextItems = items2.slice(); nextItems[index] = prevItem; itemsMap.set(item.id, prevItem); return nextItems; }); }; return unmergeItem; }; const registerItem = (item) => mergeItem( item, (getItems) => privateStore.setState("items", getItems), true ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), { registerItem, renderItem: (item) => chain( registerItem(item), mergeItem( item, (getItems) => privateStore.setState("renderedItems", getItems) ) ), item: (id) => { if (!id) return null; let item = itemsMap.get(id); if (!item) { const { items: items2 } = privateStore.getState(); item = items2.find((item2) => item2.id === id); if (item) { itemsMap.set(id, item); } } return item || null; }, // @ts-expect-error Internal __unstablePrivateStore: privateStore }); } ;// ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js "use client"; // src/utils/array.ts function toArray(arg) { if (Array.isArray(arg)) { return arg; } return typeof arg !== "undefined" ? [arg] : []; } function addItemToArray(array, item, index = -1) { if (!(index in array)) { return [...array, item]; } return [...array.slice(0, index), item, ...array.slice(index)]; } function flatten2DArray(array) { const flattened = []; for (const row of array) { flattened.push(...row); } return flattened; } function reverseArray(array) { return array.slice().reverse(); } ;// ./node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js "use client"; // src/composite/composite-store.ts var NULL_ITEM = { id: null }; function findFirstEnabledItem(items, excludeId) { return items.find((item) => { if (excludeId) { return !item.disabled && item.id !== excludeId; } return !item.disabled; }); } function getEnabledItems(items, excludeId) { return items.filter((item) => { if (excludeId) { return !item.disabled && item.id !== excludeId; } return !item.disabled; }); } function getItemsInRow(items, rowId) { return items.filter((item) => item.rowId === rowId); } function flipItems(items, activeId, shouldInsertNullItem = false) { const index = items.findIndex((item) => item.id === activeId); return [ ...items.slice(index + 1), ...shouldInsertNullItem ? [NULL_ITEM] : [], ...items.slice(0, index) ]; } function groupItemsByRows(items) { const rows = []; for (const item of items) { const row = rows.find((currentRow) => { var _a; return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; }); if (row) { row.push(item); } else { rows.push([item]); } } return rows; } function getMaxRowLength(array) { let maxLength = 0; for (const { length } of array) { if (length > maxLength) { maxLength = length; } } return maxLength; } function createEmptyItem(rowId) { return { id: "__EMPTY_ITEM__", disabled: true, rowId }; } function normalizeRows(rows, activeId, focusShift) { const maxLength = getMaxRowLength(rows); for (const row of rows) { for (let i = 0; i < maxLength; i += 1) { const item = row[i]; if (!item || focusShift && item.disabled) { const isFirst = i === 0; const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1]; row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); } } } return rows; } function verticalizeItems(items) { const rows = groupItemsByRows(items); const maxLength = getMaxRowLength(rows); const verticalized = []; for (let i = 0; i < maxLength; i += 1) { for (const row of rows) { const item = row[i]; if (item) { verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), { // If there's no rowId, it means that it's not a grid composite, but // a single row instead. So, instead of verticalizing it, that is, // assigning a different rowId based on the column index, we keep it // undefined so they will be part of the same row. This is useful // when using up/down on one-dimensional composites. rowId: item.rowId ? `${i}` : void 0 })); } } } return verticalized; } function createCompositeStore(props = {}) { var _a; const syncState = (_a = props.store) == null ? void 0 : _a.getState(); const collection = createCollectionStore(props); const activeId = defaultValue( props.activeId, syncState == null ? void 0 : syncState.activeId, props.defaultActiveId ); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), { id: defaultValue( props.id, syncState == null ? void 0 : syncState.id, `id-${Math.random().toString(36).slice(2, 8)}` ), activeId, baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), includesBaseElement: defaultValue( props.includesBaseElement, syncState == null ? void 0 : syncState.includesBaseElement, activeId === null ), moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), orientation: defaultValue( props.orientation, syncState == null ? void 0 : syncState.orientation, "both" ), rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), virtualFocus: defaultValue( props.virtualFocus, syncState == null ? void 0 : syncState.virtualFocus, false ), focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) }); const composite = createStore(initialState, collection, props.store); setup( composite, () => sync(composite, ["renderedItems", "activeId"], (state) => { composite.setState("activeId", (activeId2) => { var _a2; if (activeId2 !== void 0) return activeId2; return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id; }); }) ); const getNextId = (direction = "next", options = {}) => { var _a2, _b; const defaultState = composite.getState(); const { skip = 0, activeId: activeId2 = defaultState.activeId, focusShift = defaultState.focusShift, focusLoop = defaultState.focusLoop, focusWrap = defaultState.focusWrap, includesBaseElement = defaultState.includesBaseElement, renderedItems = defaultState.renderedItems, rtl = defaultState.rtl } = options; const isVerticalDirection = direction === "up" || direction === "down"; const isNextDirection = direction === "next" || direction === "down"; const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; const canShift = focusShift && !skip; let items = !isVerticalDirection ? renderedItems : flatten2DArray( normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift) ); items = canReverse ? reverseArray(items) : items; items = isVerticalDirection ? verticalizeItems(items) : items; if (activeId2 == null) { return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id; } const activeItem = items.find((item) => item.id === activeId2); if (!activeItem) { return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id; } const isGrid = items.some((item) => item.rowId); const activeIndex = items.indexOf(activeItem); const nextItems = items.slice(activeIndex + 1); const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); if (skip) { const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; return nextItem2 == null ? void 0 : nextItem2.id; } const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false; if (canLoop) { const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId); const sortedItems = flipItems(loopItems, activeId2, hasNullItem); const nextItem2 = findFirstEnabledItem(sortedItems, activeId2); return nextItem2 == null ? void 0 : nextItem2.id; } if (canWrap) { const nextItem2 = findFirstEnabledItem( // We can use nextItems, which contains all the next items, including // items from other rows, to wrap between rows. However, if there is a // null item (the composite container), we'll only use the next items in // the row. So moving next from the last item will focus on the // composite container. On grid composites, horizontal navigation never // focuses on the composite container, only vertical. hasNullItem ? nextItemsInRow : nextItems, activeId2 ); const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; return nextId; } const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); if (!nextItem && hasNullItem) { return null; } return nextItem == null ? void 0 : nextItem.id; }; return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), { setBaseElement: (element) => composite.setState("baseElement", element), setActiveId: (id) => composite.setState("activeId", id), move: (id) => { if (id === void 0) return; composite.setState("activeId", id); composite.setState("moves", (moves) => moves + 1); }, first: () => { var _a2; return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id; }, last: () => { var _a2; return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; }, next: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("next", options); }, previous: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("previous", options); }, down: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("down", options); }, up: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("up", options); } }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js "use client"; // src/composite/composite-store.ts function useCompositeStoreOptions(props) { const id = useId(props.id); return _3YLGPPWQ_spreadValues({ id }, props); } function useCompositeStoreProps(store, update, props) { store = useCollectionStoreProps(store, update, props); useStoreProps(store, props, "activeId", "setActiveId"); useStoreProps(store, props, "includesBaseElement"); useStoreProps(store, props, "virtualFocus"); useStoreProps(store, props, "orientation"); useStoreProps(store, props, "rtl"); useStoreProps(store, props, "focusLoop"); useStoreProps(store, props, "focusWrap"); useStoreProps(store, props, "focusShift"); return store; } function useCompositeStore(props = {}) { props = useCompositeStoreOptions(props); const [store, update] = YV4JVR4I_useStore(createCompositeStore, props); return useCompositeStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js "use client"; // src/composite/utils.ts var _5VQZOHHZ_NULL_ITEM = { id: null }; function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) { const index = items.findIndex((item) => item.id === activeId); return [ ...items.slice(index + 1), ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [], ...items.slice(0, index) ]; } function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) { return items.find((item) => { if (excludeId) { return !item.disabled && item.id !== excludeId; } return !item.disabled; }); } function getEnabledItem(store, id) { if (!id) return null; return store.item(id) || null; } function _5VQZOHHZ_groupItemsByRows(items) { const rows = []; for (const item of items) { const row = rows.find((currentRow) => { var _a; return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; }); if (row) { row.push(item); } else { rows.push([item]); } } return rows; } function selectTextField(element, collapseToEnd = false) { if (isTextField(element)) { element.setSelectionRange( collapseToEnd ? element.value.length : 0, element.value.length ); } else if (element.isContentEditable) { const selection = getDocument(element).getSelection(); selection == null ? void 0 : selection.selectAllChildren(element); if (collapseToEnd) { selection == null ? void 0 : selection.collapseToEnd(); } } } var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY"); function focusSilently(element) { element[FOCUS_SILENTLY] = true; element.focus({ preventScroll: true }); } function silentlyFocused(element) { const isSilentlyFocused = element[FOCUS_SILENTLY]; delete element[FOCUS_SILENTLY]; return isSilentlyFocused; } function isItem(store, element, exclude) { if (!element) return false; if (element === exclude) return false; const item = store.item(element.id); if (!item) return false; if (exclude && item.element === exclude) return false; return true; } ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js "use client"; // src/utils/system.tsx function forwardRef2(render) { const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref }))); Role.displayName = render.displayName || render.name; return Role; } function memo2(Component, propsAreEqual) { return external_React_.memo(Component, propsAreEqual); } function LMDWO4NN_createElement(Type, props) { const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]); const mergedRef = useMergeRefs(props.ref, getRefProperty(render)); let element; if (external_React_.isValidElement(render)) { const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef }); element = external_React_.cloneElement(render, mergeProps(rest, renderProps)); } else if (render) { element = render(rest); } else { element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest)); } if (wrapElement) { return wrapElement(element); } return element; } function createHook(useProps) { const useRole = (props = {}) => { return useProps(props); }; useRole.displayName = useProps.name; return useRole; } function createStoreContext(providers = [], scopedProviders = []) { const context = external_React_.createContext(void 0); const scopedContext = external_React_.createContext(void 0); const useContext2 = () => external_React_.useContext(context); const useScopedContext = (onlyScoped = false) => { const scoped = external_React_.useContext(scopedContext); const store = useContext2(); if (onlyScoped) return scoped; return scoped || store; }; const useProviderContext = () => { const scoped = external_React_.useContext(scopedContext); const store = useContext2(); if (scoped && scoped === store) return; return store; }; const ContextProvider = (props) => { return providers.reduceRight( (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props)) ); }; const ScopedContextProvider = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight( (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props)) ) })); }; return { context, scopedContext, useContext: useContext2, useScopedContext, useProviderContext, ContextProvider, ScopedContextProvider }; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js "use client"; // src/collection/collection-context.tsx var ctx = createStoreContext(); var useCollectionContext = ctx.useContext; var useCollectionScopedContext = ctx.useScopedContext; var useCollectionProviderContext = ctx.useProviderContext; var CollectionContextProvider = ctx.ContextProvider; var CollectionScopedContextProvider = ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js "use client"; // src/composite/composite-context.tsx var P7GR5CS5_ctx = createStoreContext( [CollectionContextProvider], [CollectionScopedContextProvider] ); var useCompositeContext = P7GR5CS5_ctx.useContext; var useCompositeScopedContext = P7GR5CS5_ctx.useScopedContext; var useCompositeProviderContext = P7GR5CS5_ctx.useProviderContext; var CompositeContextProvider = P7GR5CS5_ctx.ContextProvider; var CompositeScopedContextProvider = P7GR5CS5_ctx.ScopedContextProvider; var CompositeItemContext = (0,external_React_.createContext)( void 0 ); var CompositeRowContext = (0,external_React_.createContext)( void 0 ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js "use client"; // src/focusable/focusable-context.tsx var FocusableContext = (0,external_React_.createContext)(true); ;// ./node_modules/@ariakit/core/esm/utils/focus.js "use client"; // src/utils/focus.ts var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])"; function hasNegativeTabIndex(element) { const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10); return tabIndex < 0; } function isFocusable(element) { if (!element.matches(selector)) return false; if (!isVisible(element)) return false; if (element.closest("[inert]")) return false; return true; } function isTabbable(element) { if (!isFocusable(element)) return false; if (hasNegativeTabIndex(element)) return false; if (!("form" in element)) return true; if (!element.form) return true; if (element.checked) return true; if (element.type !== "radio") return true; const radioGroup = element.form.elements.namedItem(element.name); if (!radioGroup) return true; if (!("length" in radioGroup)) return true; const activeElement = getActiveElement(element); if (!activeElement) return true; if (activeElement === element) return true; if (!("form" in activeElement)) return true; if (activeElement.form !== element.form) return true; if (activeElement.name !== element.name) return true; return false; } function getAllFocusableIn(container, includeContainer) { const elements = Array.from( container.querySelectorAll(selector) ); if (includeContainer) { elements.unshift(container); } const focusableElements = elements.filter(isFocusable); focusableElements.forEach((element, i) => { if (isFrame(element) && element.contentDocument) { const frameBody = element.contentDocument.body; focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody)); } }); return focusableElements; } function getAllFocusable(includeBody) { return getAllFocusableIn(document.body, includeBody); } function getFirstFocusableIn(container, includeContainer) { const [first] = getAllFocusableIn(container, includeContainer); return first || null; } function getFirstFocusable(includeBody) { return getFirstFocusableIn(document.body, includeBody); } function getAllTabbableIn(container, includeContainer, fallbackToFocusable) { const elements = Array.from( container.querySelectorAll(selector) ); const tabbableElements = elements.filter(isTabbable); if (includeContainer && isTabbable(container)) { tabbableElements.unshift(container); } tabbableElements.forEach((element, i) => { if (isFrame(element) && element.contentDocument) { const frameBody = element.contentDocument.body; const allFrameTabbable = getAllTabbableIn( frameBody, false, fallbackToFocusable ); tabbableElements.splice(i, 1, ...allFrameTabbable); } }); if (!tabbableElements.length && fallbackToFocusable) { return elements; } return tabbableElements; } function getAllTabbable(fallbackToFocusable) { return getAllTabbableIn(document.body, false, fallbackToFocusable); } function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) { const [first] = getAllTabbableIn( container, includeContainer, fallbackToFocusable ); return first || null; } function getFirstTabbable(fallbackToFocusable) { return getFirstTabbableIn(document.body, false, fallbackToFocusable); } function getLastTabbableIn(container, includeContainer, fallbackToFocusable) { const allTabbable = getAllTabbableIn( container, includeContainer, fallbackToFocusable ); return allTabbable[allTabbable.length - 1] || null; } function getLastTabbable(fallbackToFocusable) { return getLastTabbableIn(document.body, false, fallbackToFocusable); } function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) { const activeElement = getActiveElement(container); const allFocusable = getAllFocusableIn(container, includeContainer); const activeIndex = allFocusable.indexOf(activeElement); const nextFocusableElements = allFocusable.slice(activeIndex + 1); return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null; } function getNextTabbable(fallbackToFirst, fallbackToFocusable) { return getNextTabbableIn( document.body, false, fallbackToFirst, fallbackToFocusable ); } function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) { const activeElement = getActiveElement(container); const allFocusable = getAllFocusableIn(container, includeContainer).reverse(); const activeIndex = allFocusable.indexOf(activeElement); const previousFocusableElements = allFocusable.slice(activeIndex + 1); return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null; } function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) { return getPreviousTabbableIn( document.body, false, fallbackToFirst, fallbackToFocusable ); } function getClosestFocusable(element) { while (element && !isFocusable(element)) { element = element.closest(selector); } return element || null; } function hasFocus(element) { const activeElement = getActiveElement(element); if (!activeElement) return false; if (activeElement === element) return true; const activeDescendant = activeElement.getAttribute("aria-activedescendant"); if (!activeDescendant) return false; return activeDescendant === element.id; } function hasFocusWithin(element) { const activeElement = getActiveElement(element); if (!activeElement) return false; if (contains(element, activeElement)) return true; const activeDescendant = activeElement.getAttribute("aria-activedescendant"); if (!activeDescendant) return false; if (!("id" in element)) return false; if (activeDescendant === element.id) return true; return !!element.querySelector(`#${CSS.escape(activeDescendant)}`); } function focusIfNeeded(element) { if (!hasFocusWithin(element) && isFocusable(element)) { element.focus(); } } function disableFocus(element) { var _a; const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : ""; element.setAttribute("data-tabindex", currentTabindex); element.setAttribute("tabindex", "-1"); } function disableFocusIn(container, includeContainer) { const tabbableElements = getAllTabbableIn(container, includeContainer); for (const element of tabbableElements) { disableFocus(element); } } function restoreFocusIn(container) { const elements = container.querySelectorAll("[data-tabindex]"); const restoreTabIndex = (element) => { const tabindex = element.getAttribute("data-tabindex"); element.removeAttribute("data-tabindex"); if (tabindex) { element.setAttribute("tabindex", tabindex); } else { element.removeAttribute("tabindex"); } }; if (container.hasAttribute("data-tabindex")) { restoreTabIndex(container); } for (const element of elements) { restoreTabIndex(element); } } function focusIntoView(element, options) { if (!("scrollIntoView" in element)) { element.focus(); } else { element.focus({ preventScroll: true }); element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options)); } } ;// ./node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js "use client"; // src/focusable/focusable.tsx var TagName = "div"; var isSafariBrowser = isSafari(); var alwaysFocusVisibleInputTypes = [ "text", "search", "url", "tel", "email", "password", "number", "date", "month", "week", "time", "datetime", "datetime-local" ]; var safariFocusAncestorSymbol = Symbol("safariFocusAncestor"); function isSafariFocusAncestor(element) { if (!element) return false; return !!element[safariFocusAncestorSymbol]; } function markSafariFocusAncestor(element, value) { if (!element) return; element[safariFocusAncestorSymbol] = value; } function isAlwaysFocusVisible(element) { const { tagName, readOnly, type } = element; if (tagName === "TEXTAREA" && !readOnly) return true; if (tagName === "SELECT" && !readOnly) return true; if (tagName === "INPUT" && !readOnly) { return alwaysFocusVisibleInputTypes.includes(type); } if (element.isContentEditable) return true; const role = element.getAttribute("role"); if (role === "combobox" && element.dataset.name) { return true; } return false; } function getLabels(element) { if ("labels" in element) { return element.labels; } return null; } function isNativeCheckboxOrRadio(element) { const tagName = element.tagName.toLowerCase(); if (tagName === "input" && element.type) { return element.type === "radio" || element.type === "checkbox"; } return false; } function isNativeTabbable(tagName) { if (!tagName) return true; return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; } function supportsDisabledAttribute(tagName) { if (!tagName) return true; return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; } function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { if (!focusable) { return tabIndexProp; } if (trulyDisabled) { if (nativeTabbable && !supportsDisabled) { return -1; } return; } if (nativeTabbable) { return tabIndexProp; } return tabIndexProp || 0; } function useDisableEvent(onEvent, disabled) { return useEvent((event) => { onEvent == null ? void 0 : onEvent(event); if (event.defaultPrevented) return; if (disabled) { event.stopPropagation(); event.preventDefault(); } }); } var isKeyboardModality = true; function onGlobalMouseDown(event) { const target = event.target; if (target && "hasAttribute" in target) { if (!target.hasAttribute("data-focus-visible")) { isKeyboardModality = false; } } } function onGlobalKeyDown(event) { if (event.metaKey) return; if (event.ctrlKey) return; if (event.altKey) return; isKeyboardModality = true; } var useFocusable = createHook( function useFocusable2(_a) { var _b = _a, { focusable = true, accessibleWhenDisabled, autoFocus, onFocusVisible } = _b, props = __objRest(_b, [ "focusable", "accessibleWhenDisabled", "autoFocus", "onFocusVisible" ]); const ref = (0,external_React_.useRef)(null); (0,external_React_.useEffect)(() => { if (!focusable) return; addGlobalEventListener("mousedown", onGlobalMouseDown, true); addGlobalEventListener("keydown", onGlobalKeyDown, true); }, [focusable]); if (isSafariBrowser) { (0,external_React_.useEffect)(() => { if (!focusable) return; const element = ref.current; if (!element) return; if (!isNativeCheckboxOrRadio(element)) return; const labels = getLabels(element); if (!labels) return; const onMouseUp = () => queueMicrotask(() => element.focus()); for (const label of labels) { label.addEventListener("mouseup", onMouseUp); } return () => { for (const label of labels) { label.removeEventListener("mouseup", onMouseUp); } }; }, [focusable]); } const disabled = focusable && disabledFromProps(props); const trulyDisabled = !!disabled && !accessibleWhenDisabled; const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false); (0,external_React_.useEffect)(() => { if (!focusable) return; if (trulyDisabled && focusVisible) { setFocusVisible(false); } }, [focusable, trulyDisabled, focusVisible]); (0,external_React_.useEffect)(() => { if (!focusable) return; if (!focusVisible) return; const element = ref.current; if (!element) return; if (typeof IntersectionObserver === "undefined") return; const observer = new IntersectionObserver(() => { if (!isFocusable(element)) { setFocusVisible(false); } }); observer.observe(element); return () => observer.disconnect(); }, [focusable, focusVisible]); const onKeyPressCapture = useDisableEvent( props.onKeyPressCapture, disabled ); const onMouseDownCapture = useDisableEvent( props.onMouseDownCapture, disabled ); const onClickCapture = useDisableEvent(props.onClickCapture, disabled); const onMouseDownProp = props.onMouseDown; const onMouseDown = useEvent((event) => { onMouseDownProp == null ? void 0 : onMouseDownProp(event); if (event.defaultPrevented) return; if (!focusable) return; const element = event.currentTarget; if (!isSafariBrowser) return; if (isPortalEvent(event)) return; if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; let receivedFocus = false; const onFocus = () => { receivedFocus = true; }; const options = { capture: true, once: true }; element.addEventListener("focusin", onFocus, options); const focusableContainer = getClosestFocusable(element.parentElement); markSafariFocusAncestor(focusableContainer, true); queueBeforeEvent(element, "mouseup", () => { element.removeEventListener("focusin", onFocus, true); markSafariFocusAncestor(focusableContainer, false); if (receivedFocus) return; focusIfNeeded(element); }); }); const handleFocusVisible = (event, currentTarget) => { if (currentTarget) { event.currentTarget = currentTarget; } if (!focusable) return; const element = event.currentTarget; if (!element) return; if (!hasFocus(element)) return; onFocusVisible == null ? void 0 : onFocusVisible(event); if (event.defaultPrevented) return; element.dataset.focusVisible = "true"; setFocusVisible(true); }; const onKeyDownCaptureProp = props.onKeyDownCapture; const onKeyDownCapture = useEvent((event) => { onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); if (event.defaultPrevented) return; if (!focusable) return; if (focusVisible) return; if (event.metaKey) return; if (event.altKey) return; if (event.ctrlKey) return; if (!isSelfTarget(event)) return; const element = event.currentTarget; const applyFocusVisible = () => handleFocusVisible(event, element); queueBeforeEvent(element, "focusout", applyFocusVisible); }); const onFocusCaptureProp = props.onFocusCapture; const onFocusCapture = useEvent((event) => { onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); if (event.defaultPrevented) return; if (!focusable) return; if (!isSelfTarget(event)) { setFocusVisible(false); return; } const element = event.currentTarget; const applyFocusVisible = () => handleFocusVisible(event, element); if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { queueBeforeEvent(event.target, "focusout", applyFocusVisible); } else { setFocusVisible(false); } }); const onBlurProp = props.onBlur; const onBlur = useEvent((event) => { onBlurProp == null ? void 0 : onBlurProp(event); if (!focusable) return; if (!isFocusEventOutside(event)) return; setFocusVisible(false); }); const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext); const autoFocusRef = useEvent((element) => { if (!focusable) return; if (!autoFocus) return; if (!element) return; if (!autoFocusOnShow) return; queueMicrotask(() => { if (hasFocus(element)) return; if (!isFocusable(element)) return; element.focus(); }); }); const tagName = useTagName(ref); const nativeTabbable = focusable && isNativeTabbable(tagName); const supportsDisabled = focusable && supportsDisabledAttribute(tagName); const styleProp = props.style; const style = (0,external_React_.useMemo)(() => { if (trulyDisabled) { return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp); } return styleProp; }, [trulyDisabled, styleProp]); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ "data-focus-visible": focusable && focusVisible || void 0, "data-autofocus": autoFocus || void 0, "aria-disabled": disabled || void 0 }, props), { ref: useMergeRefs(ref, autoFocusRef, props.ref), style, tabIndex: getTabIndex( focusable, trulyDisabled, nativeTabbable, supportsDisabled, props.tabIndex ), disabled: supportsDisabled && trulyDisabled ? true : void 0, // TODO: Test Focusable contentEditable. contentEditable: disabled ? void 0 : props.contentEditable, onKeyPressCapture, onClickCapture, onMouseDownCapture, onMouseDown, onKeyDownCapture, onFocusCapture, onBlur }); return removeUndefinedValues(props); } ); var Focusable = forwardRef2(function Focusable2(props) { const htmlProps = useFocusable(props); return LMDWO4NN_createElement(TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/ITI7HKP4.js "use client"; // src/composite/composite.tsx var ITI7HKP4_TagName = "div"; function isGrid(items) { return items.some((item) => !!item.rowId); } function isPrintableKey(event) { const target = event.target; if (target && !isTextField(target)) return false; return event.key.length === 1 && !event.ctrlKey && !event.metaKey; } function isModifierKey(event) { return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; } function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) { return useEvent((event) => { var _a; onKeyboardEvent == null ? void 0 : onKeyboardEvent(event); if (event.defaultPrevented) return; if (event.isPropagationStopped()) return; if (!isSelfTarget(event)) return; if (isModifierKey(event)) return; if (isPrintableKey(event)) return; const state = store.getState(); const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element; if (!activeElement) return; const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]); const previousElement = previousElementRef == null ? void 0 : previousElementRef.current; if (activeElement !== previousElement) { activeElement.focus(); } if (!fireKeyboardEvent(activeElement, event.type, eventInit)) { event.preventDefault(); } if (event.currentTarget.contains(activeElement)) { event.stopPropagation(); } }); } function findFirstEnabledItemInTheLastRow(items) { return _5VQZOHHZ_findFirstEnabledItem( flatten2DArray(reverseArray(_5VQZOHHZ_groupItemsByRows(items))) ); } function useScheduleFocus(store) { const [scheduled, setScheduled] = (0,external_React_.useState)(false); const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []); const activeItem = store.useState( (state) => getEnabledItem(store, state.activeId) ); (0,external_React_.useEffect)(() => { const activeElement = activeItem == null ? void 0 : activeItem.element; if (!scheduled) return; if (!activeElement) return; setScheduled(false); activeElement.focus({ preventScroll: true }); }, [activeItem, scheduled]); return schedule; } var useComposite = createHook( function useComposite2(_a) { var _b = _a, { store, composite = true, focusOnMove = composite, moveOnKeyPress = true } = _b, props = __objRest(_b, [ "store", "composite", "focusOnMove", "moveOnKeyPress" ]); const context = useCompositeProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const previousElementRef = (0,external_React_.useRef)(null); const scheduleFocus = useScheduleFocus(store); const moves = store.useState("moves"); const [, setBaseElement] = useTransactionState( composite ? store.setBaseElement : null ); (0,external_React_.useEffect)(() => { var _a2; if (!store) return; if (!moves) return; if (!composite) return; if (!focusOnMove) return; const { activeId: activeId2 } = store.getState(); const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; if (!itemElement) return; focusIntoView(itemElement); }, [store, moves, composite, focusOnMove]); useSafeLayoutEffect(() => { if (!store) return; if (!moves) return; if (!composite) return; const { baseElement, activeId: activeId2 } = store.getState(); const isSelfAcive = activeId2 === null; if (!isSelfAcive) return; if (!baseElement) return; const previousElement = previousElementRef.current; previousElementRef.current = null; if (previousElement) { fireBlurEvent(previousElement, { relatedTarget: baseElement }); } if (!hasFocus(baseElement)) { baseElement.focus(); } }, [store, moves, composite]); const activeId = store.useState("activeId"); const virtualFocus = store.useState("virtualFocus"); useSafeLayoutEffect(() => { var _a2; if (!store) return; if (!composite) return; if (!virtualFocus) return; const previousElement = previousElementRef.current; previousElementRef.current = null; if (!previousElement) return; const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element; const relatedTarget = activeElement || getActiveElement(previousElement); if (relatedTarget === previousElement) return; fireBlurEvent(previousElement, { relatedTarget }); }, [store, activeId, virtualFocus, composite]); const onKeyDownCapture = useKeyboardEventProxy( store, props.onKeyDownCapture, previousElementRef ); const onKeyUpCapture = useKeyboardEventProxy( store, props.onKeyUpCapture, previousElementRef ); const onFocusCaptureProp = props.onFocusCapture; const onFocusCapture = useEvent((event) => { onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); if (event.defaultPrevented) return; if (!store) return; const { virtualFocus: virtualFocus2 } = store.getState(); if (!virtualFocus2) return; const previousActiveElement = event.relatedTarget; const isSilentlyFocused = silentlyFocused(event.currentTarget); if (isSelfTarget(event) && isSilentlyFocused) { event.stopPropagation(); previousElementRef.current = previousActiveElement; } }); const onFocusProp = props.onFocus; const onFocus = useEvent((event) => { onFocusProp == null ? void 0 : onFocusProp(event); if (event.defaultPrevented) return; if (!composite) return; if (!store) return; const { relatedTarget } = event; const { virtualFocus: virtualFocus2 } = store.getState(); if (virtualFocus2) { if (isSelfTarget(event) && !isItem(store, relatedTarget)) { queueMicrotask(scheduleFocus); } } else if (isSelfTarget(event)) { store.setActiveId(null); } }); const onBlurCaptureProp = props.onBlurCapture; const onBlurCapture = useEvent((event) => { var _a2; onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); if (event.defaultPrevented) return; if (!store) return; const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState(); if (!virtualFocus2) return; const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; const nextActiveElement = event.relatedTarget; const nextActiveElementIsItem = isItem(store, nextActiveElement); const previousElement = previousElementRef.current; previousElementRef.current = null; if (isSelfTarget(event) && nextActiveElementIsItem) { if (nextActiveElement === activeElement) { if (previousElement && previousElement !== nextActiveElement) { fireBlurEvent(previousElement, event); } } else if (activeElement) { fireBlurEvent(activeElement, event); } else if (previousElement) { fireBlurEvent(previousElement, event); } event.stopPropagation(); } else { const targetIsItem = isItem(store, event.target); if (!targetIsItem && activeElement) { fireBlurEvent(activeElement, event); } } }); const onKeyDownProp = props.onKeyDown; const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); const onKeyDown = useEvent((event) => { var _a2; onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (event.defaultPrevented) return; if (!store) return; if (!isSelfTarget(event)) return; const { orientation, renderedItems, activeId: activeId2 } = store.getState(); const activeItem = getEnabledItem(store, activeId2); if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return; const isVertical = orientation !== "horizontal"; const isHorizontal = orientation !== "vertical"; const grid = isGrid(renderedItems); const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End"; if (isHorizontalKey && isTextField(event.currentTarget)) return; const up = () => { if (grid) { const item = findFirstEnabledItemInTheLastRow(renderedItems); return item == null ? void 0 : item.id; } return store == null ? void 0 : store.last(); }; const keyMap = { ArrowUp: (grid || isVertical) && up, ArrowRight: (grid || isHorizontal) && store.first, ArrowDown: (grid || isVertical) && store.first, ArrowLeft: (grid || isHorizontal) && store.last, Home: store.first, End: store.last, PageUp: store.first, PageDown: store.last }; const action = keyMap[event.key]; if (action) { const id = action(); if (id !== void 0) { if (!moveOnKeyPressProp(event)) return; event.preventDefault(); store.move(id); } } }); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }), [store] ); const activeDescendant = store.useState((state) => { var _a2; if (!store) return; if (!composite) return; if (!state.virtualFocus) return; return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id; }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ "aria-activedescendant": activeDescendant }, props), { ref: useMergeRefs(ref, setBaseElement, props.ref), onKeyDownCapture, onKeyUpCapture, onFocusCapture, onFocus, onBlurCapture, onKeyDown }); const focusable = store.useState( (state) => composite && (state.virtualFocus || state.activeId === null) ); props = useFocusable(_3YLGPPWQ_spreadValues({ focusable }, props)); return props; } ); var ITI7HKP4_Composite = forwardRef2(function Composite2(props) { const htmlProps = useComposite(props); return LMDWO4NN_createElement(ITI7HKP4_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/composite/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const CompositeContext = (0,external_wp_element_namespaceObject.createContext)({}); const context_useCompositeContext = () => (0,external_wp_element_namespaceObject.useContext)(CompositeContext); ;// ./node_modules/@ariakit/react-core/esm/__chunks/7HVFURXT.js "use client"; // src/group/group-label-context.tsx var GroupLabelContext = (0,external_React_.createContext)(void 0); ;// ./node_modules/@ariakit/react-core/esm/__chunks/36LIF33V.js "use client"; // src/group/group.tsx var _36LIF33V_TagName = "div"; var useGroup = createHook( function useGroup2(props) { const [labelId, setLabelId] = (0,external_React_.useState)(); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GroupLabelContext.Provider, { value: setLabelId, children: element }), [] ); props = _3YLGPPWQ_spreadValues({ role: "group", "aria-labelledby": labelId }, props); return removeUndefinedValues(props); } ); var Group = forwardRef2(function Group2(props) { const htmlProps = useGroup(props); return LMDWO4NN_createElement(_36LIF33V_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/YORGHBM4.js "use client"; // src/composite/composite-group.tsx var YORGHBM4_TagName = "div"; var useCompositeGroup = createHook( function useCompositeGroup2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); props = useGroup(props); return props; } ); var YORGHBM4_CompositeGroup = forwardRef2(function CompositeGroup2(props) { const htmlProps = useCompositeGroup(props); return LMDWO4NN_createElement(YORGHBM4_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/composite/group.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const CompositeGroup = (0,external_wp_element_namespaceObject.forwardRef)(function CompositeGroup(props, ref) { var _props$store; const context = context_useCompositeContext(); // @ts-expect-error The store prop is undocumented and only used by the // legacy compat layer. The `store` prop is documented, but its type is // obfuscated to discourage its use outside of the component's internals. const store = (_props$store = props.store) !== null && _props$store !== void 0 ? _props$store : context.store; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(YORGHBM4_CompositeGroup, { store: store, ...props, ref: ref }); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/YUOJWFSO.js "use client"; // src/group/group-label.tsx var YUOJWFSO_TagName = "div"; var useGroupLabel = createHook( function useGroupLabel2(props) { const setLabelId = (0,external_React_.useContext)(GroupLabelContext); const id = useId(props.id); useSafeLayoutEffect(() => { setLabelId == null ? void 0 : setLabelId(id); return () => setLabelId == null ? void 0 : setLabelId(void 0); }, [setLabelId, id]); props = _3YLGPPWQ_spreadValues({ id, "aria-hidden": true }, props); return removeUndefinedValues(props); } ); var GroupLabel = forwardRef2(function GroupLabel2(props) { const htmlProps = useGroupLabel(props); return LMDWO4NN_createElement(YUOJWFSO_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/SWSPTQMT.js "use client"; // src/composite/composite-group-label.tsx var SWSPTQMT_TagName = "div"; var useCompositeGroupLabel = createHook(function useCompositeGroupLabel2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); props = useGroupLabel(props); return props; }); var SWSPTQMT_CompositeGroupLabel = forwardRef2(function CompositeGroupLabel2(props) { const htmlProps = useCompositeGroupLabel(props); return LMDWO4NN_createElement(SWSPTQMT_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/composite/group-label.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const CompositeGroupLabel = (0,external_wp_element_namespaceObject.forwardRef)(function CompositeGroupLabel(props, ref) { var _props$store; const context = context_useCompositeContext(); // @ts-expect-error The store prop is undocumented and only used by the // legacy compat layer. The `store` prop is documented, but its type is // obfuscated to discourage its use outside of the component's internals. const store = (_props$store = props.store) !== null && _props$store !== void 0 ? _props$store : context.store; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SWSPTQMT_CompositeGroupLabel, { store: store, ...props, ref: ref }); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/UQQRIHDV.js "use client"; // src/composite/composite-hover.tsx var UQQRIHDV_TagName = "div"; function getMouseDestination(event) { const relatedTarget = event.relatedTarget; if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) { return relatedTarget; } return null; } function hoveringInside(event) { const nextElement = getMouseDestination(event); if (!nextElement) return false; return contains(event.currentTarget, nextElement); } var symbol = Symbol("composite-hover"); function movingToAnotherItem(event) { let dest = getMouseDestination(event); if (!dest) return false; do { if (PBFD2E7P_hasOwnProperty(dest, symbol) && dest[symbol]) return true; dest = dest.parentElement; } while (dest); return false; } var useCompositeHover = createHook( function useCompositeHover2(_a) { var _b = _a, { store, focusOnHover = true, blurOnHoverEnd = !!focusOnHover } = _b, props = __objRest(_b, [ "store", "focusOnHover", "blurOnHoverEnd" ]); const context = useCompositeContext(); store = store || context; invariant( store, false && 0 ); const isMouseMoving = useIsMouseMoving(); const onMouseMoveProp = props.onMouseMove; const focusOnHoverProp = useBooleanEvent(focusOnHover); const onMouseMove = useEvent((event) => { onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); if (event.defaultPrevented) return; if (!isMouseMoving()) return; if (!focusOnHoverProp(event)) return; if (!hasFocusWithin(event.currentTarget)) { const baseElement = store == null ? void 0 : store.getState().baseElement; if (baseElement && !hasFocus(baseElement)) { baseElement.focus(); } } store == null ? void 0 : store.setActiveId(event.currentTarget.id); }); const onMouseLeaveProp = props.onMouseLeave; const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); const onMouseLeave = useEvent((event) => { var _a2; onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event); if (event.defaultPrevented) return; if (!isMouseMoving()) return; if (hoveringInside(event)) return; if (movingToAnotherItem(event)) return; if (!focusOnHoverProp(event)) return; if (!blurOnHoverEndProp(event)) return; store == null ? void 0 : store.setActiveId(null); (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus(); }); const ref = (0,external_React_.useCallback)((element) => { if (!element) return; element[symbol] = true; }, []); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(ref, props.ref), onMouseMove, onMouseLeave }); return removeUndefinedValues(props); } ); var UQQRIHDV_CompositeHover = memo2( forwardRef2(function CompositeHover2(props) { const htmlProps = useCompositeHover(props); return LMDWO4NN_createElement(UQQRIHDV_TagName, htmlProps); }) ); ;// ./node_modules/@wordpress/components/build-module/composite/hover.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const CompositeHover = (0,external_wp_element_namespaceObject.forwardRef)(function CompositeHover(props, ref) { var _props$store; const context = context_useCompositeContext(); // @ts-expect-error The store prop is undocumented and only used by the // legacy compat layer. The `store` prop is documented, but its type is // obfuscated to discourage its use outside of the component's internals. const store = (_props$store = props.store) !== null && _props$store !== void 0 ? _props$store : context.store; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UQQRIHDV_CompositeHover, { store: store, ...props, ref: ref }); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/RZ4GPYOB.js "use client"; // src/collection/collection-item.tsx var RZ4GPYOB_TagName = "div"; var useCollectionItem = createHook( function useCollectionItem2(_a) { var _b = _a, { store, shouldRegisterItem = true, getItem = identity, element: element } = _b, props = __objRest(_b, [ "store", "shouldRegisterItem", "getItem", // @ts-expect-error This prop may come from a collection renderer. "element" ]); const context = useCollectionContext(); store = store || context; const id = useId(props.id); const ref = (0,external_React_.useRef)(element); (0,external_React_.useEffect)(() => { const element2 = ref.current; if (!id) return; if (!element2) return; if (!shouldRegisterItem) return; const item = getItem({ id, element: element2 }); return store == null ? void 0 : store.renderItem(item); }, [id, shouldRegisterItem, getItem, store]); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(ref, props.ref) }); return removeUndefinedValues(props); } ); var CollectionItem = forwardRef2(function CollectionItem2(props) { const htmlProps = useCollectionItem(props); return LMDWO4NN_createElement(RZ4GPYOB_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/KUU7WJ55.js "use client"; // src/command/command.tsx var KUU7WJ55_TagName = "button"; function isNativeClick(event) { if (!event.isTrusted) return false; const element = event.currentTarget; if (event.key === "Enter") { return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; } if (event.key === " ") { return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; } return false; } var KUU7WJ55_symbol = Symbol("command"); var useCommand = createHook( function useCommand2(_a) { var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]); const ref = (0,external_React_.useRef)(null); const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)(false); (0,external_React_.useEffect)(() => { if (!ref.current) return; setIsNativeButton(isButton(ref.current)); }, []); const [active, setActive] = (0,external_React_.useState)(false); const activeRef = (0,external_React_.useRef)(false); const disabled = disabledFromProps(props); const [isDuplicate, metadataProps] = useMetadataProps(props, KUU7WJ55_symbol, true); const onKeyDownProp = props.onKeyDown; const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); const element = event.currentTarget; if (event.defaultPrevented) return; if (isDuplicate) return; if (disabled) return; if (!isSelfTarget(event)) return; if (isTextField(element)) return; if (element.isContentEditable) return; const isEnter = clickOnEnter && event.key === "Enter"; const isSpace = clickOnSpace && event.key === " "; const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; const shouldPreventSpace = event.key === " " && !clickOnSpace; if (shouldPreventEnter || shouldPreventSpace) { event.preventDefault(); return; } if (isEnter || isSpace) { const nativeClick = isNativeClick(event); if (isEnter) { if (!nativeClick) { event.preventDefault(); const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); const click = () => fireClickEvent(element, eventInit); if (isFirefox()) { queueBeforeEvent(element, "keyup", click); } else { queueMicrotask(click); } } } else if (isSpace) { activeRef.current = true; if (!nativeClick) { event.preventDefault(); setActive(true); } } } }); const onKeyUpProp = props.onKeyUp; const onKeyUp = useEvent((event) => { onKeyUpProp == null ? void 0 : onKeyUpProp(event); if (event.defaultPrevented) return; if (isDuplicate) return; if (disabled) return; if (event.metaKey) return; const isSpace = clickOnSpace && event.key === " "; if (activeRef.current && isSpace) { activeRef.current = false; if (!isNativeClick(event)) { event.preventDefault(); setActive(false); const element = event.currentTarget; const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); queueMicrotask(() => fireClickEvent(element, eventInit)); } } }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({ "data-active": active || void 0, type: isNativeButton ? "button" : void 0 }, metadataProps), props), { ref: useMergeRefs(ref, props.ref), onKeyDown, onKeyUp }); props = useFocusable(props); return props; } ); var Command = forwardRef2(function Command2(props) { const htmlProps = useCommand(props); return LMDWO4NN_createElement(KUU7WJ55_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/P2CTZE2T.js "use client"; // src/composite/composite-item.tsx var P2CTZE2T_TagName = "button"; function isEditableElement(element) { if (isTextbox(element)) return true; return element.tagName === "INPUT" && !isButton(element); } function getNextPageOffset(scrollingElement, pageUp = false) { const height = scrollingElement.clientHeight; const { top } = scrollingElement.getBoundingClientRect(); const pageSize = Math.max(height * 0.875, height - 40) * 1.5; const pageOffset = pageUp ? height - pageSize + top : pageSize + top; if (scrollingElement.tagName === "HTML") { return pageOffset + scrollingElement.scrollTop; } return pageOffset; } function getItemOffset(itemElement, pageUp = false) { const { top } = itemElement.getBoundingClientRect(); if (pageUp) { return top + itemElement.clientHeight; } return top; } function findNextPageItemId(element, store, next, pageUp = false) { var _a; if (!store) return; if (!next) return; const { renderedItems } = store.getState(); const scrollingElement = getScrollingElement(element); if (!scrollingElement) return; const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); let id; let prevDifference; for (let i = 0; i < renderedItems.length; i += 1) { const previousId = id; id = next(i); if (!id) break; if (id === previousId) continue; const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element; if (!itemElement) continue; const itemOffset = getItemOffset(itemElement, pageUp); const difference = itemOffset - nextPageOffset; const absDifference = Math.abs(difference); if (pageUp && difference <= 0 || !pageUp && difference >= 0) { if (prevDifference !== void 0 && prevDifference < absDifference) { id = previousId; } break; } prevDifference = absDifference; } return id; } function targetIsAnotherItem(event, store) { if (isSelfTarget(event)) return false; return isItem(store, event.target); } var useCompositeItem = createHook( function useCompositeItem2(_a) { var _b = _a, { store, rowId: rowIdProp, preventScrollOnKeyDown = false, moveOnKeyPress = true, tabbable = false, getItem: getItemProp, "aria-setsize": ariaSetSizeProp, "aria-posinset": ariaPosInSetProp } = _b, props = __objRest(_b, [ "store", "rowId", "preventScrollOnKeyDown", "moveOnKeyPress", "tabbable", "getItem", "aria-setsize", "aria-posinset" ]); const context = useCompositeContext(); store = store || context; const id = useId(props.id); const ref = (0,external_React_.useRef)(null); const row = (0,external_React_.useContext)(CompositeRowContext); const disabled = disabledFromProps(props); const trulyDisabled = disabled && !props.accessibleWhenDisabled; const { rowId, baseElement, isActiveItem, ariaSetSize, ariaPosInSet, isTabbable } = useStoreStateObject(store, { rowId(state) { if (rowIdProp) return rowIdProp; if (!state) return; if (!(row == null ? void 0 : row.baseElement)) return; if (row.baseElement !== state.baseElement) return; return row.id; }, baseElement(state) { return (state == null ? void 0 : state.baseElement) || void 0; }, isActiveItem(state) { return !!state && state.activeId === id; }, ariaSetSize(state) { if (ariaSetSizeProp != null) return ariaSetSizeProp; if (!state) return; if (!(row == null ? void 0 : row.ariaSetSize)) return; if (row.baseElement !== state.baseElement) return; return row.ariaSetSize; }, ariaPosInSet(state) { if (ariaPosInSetProp != null) return ariaPosInSetProp; if (!state) return; if (!(row == null ? void 0 : row.ariaPosInSet)) return; if (row.baseElement !== state.baseElement) return; const itemsInRow = state.renderedItems.filter( (item) => item.rowId === rowId ); return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); }, isTabbable(state) { if (!(state == null ? void 0 : state.renderedItems.length)) return true; if (state.virtualFocus) return false; if (tabbable) return true; if (state.activeId === null) return false; const item = store == null ? void 0 : store.item(state.activeId); if (item == null ? void 0 : item.disabled) return true; if (!(item == null ? void 0 : item.element)) return true; return state.activeId === id; } }); const getItem = (0,external_React_.useCallback)( (item) => { var _a2; const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { id: id || item.id, rowId, disabled: !!trulyDisabled, children: (_a2 = item.element) == null ? void 0 : _a2.textContent }); if (getItemProp) { return getItemProp(nextItem); } return nextItem; }, [id, rowId, trulyDisabled, getItemProp] ); const onFocusProp = props.onFocus; const hasFocusedComposite = (0,external_React_.useRef)(false); const onFocus = useEvent((event) => { onFocusProp == null ? void 0 : onFocusProp(event); if (event.defaultPrevented) return; if (isPortalEvent(event)) return; if (!id) return; if (!store) return; if (targetIsAnotherItem(event, store)) return; const { virtualFocus, baseElement: baseElement2 } = store.getState(); store.setActiveId(id); if (isTextbox(event.currentTarget)) { selectTextField(event.currentTarget); } if (!virtualFocus) return; if (!isSelfTarget(event)) return; if (isEditableElement(event.currentTarget)) return; if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return; if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) { event.currentTarget.scrollIntoView({ block: "nearest", inline: "nearest" }); } hasFocusedComposite.current = true; const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget); if (fromComposite) { focusSilently(baseElement2); } else { baseElement2.focus(); } }); const onBlurCaptureProp = props.onBlurCapture; const onBlurCapture = useEvent((event) => { onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); if (event.defaultPrevented) return; const state = store == null ? void 0 : store.getState(); if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) { hasFocusedComposite.current = false; event.preventDefault(); event.stopPropagation(); } }); const onKeyDownProp = props.onKeyDown; const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (event.defaultPrevented) return; if (!isSelfTarget(event)) return; if (!store) return; const { currentTarget } = event; const state = store.getState(); const item = store.item(id); const isGrid = !!(item == null ? void 0 : item.rowId); const isVertical = state.orientation !== "horizontal"; const isHorizontal = state.orientation !== "vertical"; const canHomeEnd = () => { if (isGrid) return true; if (isHorizontal) return true; if (!state.baseElement) return true; if (!isTextField(state.baseElement)) return true; return false; }; const keyMap = { ArrowUp: (isGrid || isVertical) && store.up, ArrowRight: (isGrid || isHorizontal) && store.next, ArrowDown: (isGrid || isVertical) && store.down, ArrowLeft: (isGrid || isHorizontal) && store.previous, Home: () => { if (!canHomeEnd()) return; if (!isGrid || event.ctrlKey) { return store == null ? void 0 : store.first(); } return store == null ? void 0 : store.previous(-1); }, End: () => { if (!canHomeEnd()) return; if (!isGrid || event.ctrlKey) { return store == null ? void 0 : store.last(); } return store == null ? void 0 : store.next(-1); }, PageUp: () => { return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true); }, PageDown: () => { return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down); } }; const action = keyMap[event.key]; if (action) { if (isTextbox(currentTarget)) { const selection = getTextboxSelection(currentTarget); const isLeft = isHorizontal && event.key === "ArrowLeft"; const isRight = isHorizontal && event.key === "ArrowRight"; const isUp = isVertical && event.key === "ArrowUp"; const isDown = isVertical && event.key === "ArrowDown"; if (isRight || isDown) { const { length: valueLength } = getTextboxValue(currentTarget); if (selection.end !== valueLength) return; } else if ((isLeft || isUp) && selection.start !== 0) return; } const nextId = action(); if (preventScrollOnKeyDownProp(event) || nextId !== void 0) { if (!moveOnKeyPressProp(event)) return; event.preventDefault(); store.move(nextId); } } }); const providerValue = (0,external_React_.useMemo)( () => ({ id, baseElement }), [id, baseElement] ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }), [providerValue] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, "data-active-item": isActiveItem || void 0 }, props), { ref: useMergeRefs(ref, props.ref), tabIndex: isTabbable ? props.tabIndex : -1, onFocus, onBlurCapture, onKeyDown }); props = useCommand(props); props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store }, props), { getItem, shouldRegisterItem: id ? props.shouldRegisterItem : false })); return removeUndefinedValues(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { "aria-setsize": ariaSetSize, "aria-posinset": ariaPosInSet })); } ); var P2CTZE2T_CompositeItem = memo2( forwardRef2(function CompositeItem2(props) { const htmlProps = useCompositeItem(props); return LMDWO4NN_createElement(P2CTZE2T_TagName, htmlProps); }) ); ;// ./node_modules/@wordpress/components/build-module/composite/item.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const CompositeItem = (0,external_wp_element_namespaceObject.forwardRef)(function CompositeItem(props, ref) { var _props$store; const context = context_useCompositeContext(); // @ts-expect-error The store prop is undocumented and only used by the // legacy compat layer. The `store` prop is documented, but its type is // obfuscated to discourage its use outside of the component's internals. const store = (_props$store = props.store) !== null && _props$store !== void 0 ? _props$store : context.store; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(P2CTZE2T_CompositeItem, { store: store, ...props, ref: ref }); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/J2LQO3EC.js "use client"; // src/composite/composite-row.tsx var J2LQO3EC_TagName = "div"; var useCompositeRow = createHook( function useCompositeRow2(_a) { var _b = _a, { store, "aria-setsize": ariaSetSize, "aria-posinset": ariaPosInSet } = _b, props = __objRest(_b, [ "store", "aria-setsize", "aria-posinset" ]); const context = useCompositeContext(); store = store || context; invariant( store, false && 0 ); const id = useId(props.id); const baseElement = store.useState( (state) => state.baseElement || void 0 ); const providerValue = (0,external_React_.useMemo)( () => ({ id, baseElement, ariaSetSize, ariaPosInSet }), [id, baseElement, ariaSetSize, ariaPosInSet] ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeRowContext.Provider, { value: providerValue, children: element }), [providerValue] ); props = _3YLGPPWQ_spreadValues({ id }, props); return removeUndefinedValues(props); } ); var J2LQO3EC_CompositeRow = forwardRef2(function CompositeRow2(props) { const htmlProps = useCompositeRow(props); return LMDWO4NN_createElement(J2LQO3EC_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/composite/row.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const CompositeRow = (0,external_wp_element_namespaceObject.forwardRef)(function CompositeRow(props, ref) { var _props$store; const context = context_useCompositeContext(); // @ts-expect-error The store prop is undocumented and only used by the // legacy compat layer. The `store` prop is documented, but its type is // obfuscated to discourage its use outside of the component's internals. const store = (_props$store = props.store) !== null && _props$store !== void 0 ? _props$store : context.store; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(J2LQO3EC_CompositeRow, { store: store, ...props, ref: ref }); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/T7VMP3TM.js "use client"; // src/composite/composite-typeahead.tsx var T7VMP3TM_TagName = "div"; var chars = ""; function clearChars() { chars = ""; } function isValidTypeaheadEvent(event) { const target = event.target; if (target && isTextField(target)) return false; if (event.key === " " && chars.length) return true; return event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && /^[\p{Letter}\p{Number}]$/u.test(event.key); } function isSelfTargetOrItem(event, items) { if (isSelfTarget(event)) return true; const target = event.target; if (!target) return false; const isItem = items.some((item) => item.element === target); return isItem; } function T7VMP3TM_getEnabledItems(items) { return items.filter((item) => !item.disabled); } function itemTextStartsWith(item, text) { var _a; const itemText = ((_a = item.element) == null ? void 0 : _a.textContent) || item.children || // The composite item object itself doesn't include a value property, but // other components like Select do. Since CompositeTypeahead is a generic // component that can be used with those as well, we also consider the value // property as a fallback for the typeahead text content. "value" in item && item.value; if (!itemText) return false; return normalizeString(itemText).trim().toLowerCase().startsWith(text.toLowerCase()); } function getSameInitialItems(items, char, activeId) { if (!activeId) return items; const activeItem = items.find((item) => item.id === activeId); if (!activeItem) return items; if (!itemTextStartsWith(activeItem, char)) return items; if (chars !== char && itemTextStartsWith(activeItem, chars)) return items; chars = char; return _5VQZOHHZ_flipItems( items.filter((item) => itemTextStartsWith(item, chars)), activeId ).filter((item) => item.id !== activeId); } var useCompositeTypeahead = createHook(function useCompositeTypeahead2(_a) { var _b = _a, { store, typeahead = true } = _b, props = __objRest(_b, ["store", "typeahead"]); const context = useCompositeContext(); store = store || context; invariant( store, false && 0 ); const onKeyDownCaptureProp = props.onKeyDownCapture; const cleanupTimeoutRef = (0,external_React_.useRef)(0); const onKeyDownCapture = useEvent((event) => { onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); if (event.defaultPrevented) return; if (!typeahead) return; if (!store) return; if (!isValidTypeaheadEvent(event)) { return clearChars(); } const { renderedItems, items, activeId, id } = store.getState(); let enabledItems = T7VMP3TM_getEnabledItems( items.length > renderedItems.length ? items : renderedItems ); const document = getDocument(event.currentTarget); const selector = `[data-offscreen-id="${id}"]`; const offscreenItems = document.querySelectorAll(selector); for (const element of offscreenItems) { const disabled = element.ariaDisabled === "true" || "disabled" in element && !!element.disabled; enabledItems.push({ id: element.id, element, disabled }); } if (offscreenItems.length) { enabledItems = sortBasedOnDOMPosition(enabledItems, (i) => i.element); } if (!isSelfTargetOrItem(event, enabledItems)) return clearChars(); event.preventDefault(); window.clearTimeout(cleanupTimeoutRef.current); cleanupTimeoutRef.current = window.setTimeout(() => { chars = ""; }, 500); const char = event.key.toLowerCase(); chars += char; enabledItems = getSameInitialItems(enabledItems, char, activeId); const item = enabledItems.find((item2) => itemTextStartsWith(item2, chars)); if (item) { store.move(item.id); } else { clearChars(); } }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { onKeyDownCapture }); return removeUndefinedValues(props); }); var T7VMP3TM_CompositeTypeahead = forwardRef2(function CompositeTypeahead2(props) { const htmlProps = useCompositeTypeahead(props); return LMDWO4NN_createElement(T7VMP3TM_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/composite/typeahead.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const CompositeTypeahead = (0,external_wp_element_namespaceObject.forwardRef)(function CompositeTypeahead(props, ref) { var _props$store; const context = context_useCompositeContext(); // @ts-expect-error The store prop is undocumented and only used by the // legacy compat layer. The `store` prop is documented, but its type is // obfuscated to discourage its use outside of the component's internals. const store = (_props$store = props.store) !== null && _props$store !== void 0 ? _props$store : context.store; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(T7VMP3TM_CompositeTypeahead, { store: store, ...props, ref: ref }); }); ;// ./node_modules/@wordpress/components/build-module/composite/index.js /** * Composite is a component that may contain navigable items represented by * Composite.Item. It's inspired by the WAI-ARIA Composite Role and implements * all the keyboard navigation mechanisms to ensure that there's only one * tab stop for the whole Composite element. This means that it can behave as * a roving tabindex or aria-activedescendant container. * * @see https://ariakit.org/components/composite */ /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders a widget based on the WAI-ARIA [`composite`](https://w3c.github.io/aria/#composite) * role, which provides a single tab stop on the page and arrow key navigation * through the focusable descendants. * * @example * ```jsx * import { Composite } from '@wordpress/components'; * * <Composite> * <Composite.Item>Item 1</Composite.Item> * <Composite.Item>Item 2</Composite.Item> * </Composite> * ``` */ const Composite = Object.assign((0,external_wp_element_namespaceObject.forwardRef)(function Composite({ // Composite store props activeId, defaultActiveId, setActiveId, focusLoop = false, focusWrap = false, focusShift = false, virtualFocus = false, orientation = 'both', rtl = (0,external_wp_i18n_namespaceObject.isRTL)(), // Composite component props children, disabled = false, // Rest props ...props }, ref) { // @ts-expect-error The store prop is undocumented and only used by the // legacy compat layer. const storeProp = props.store; const internalStore = useCompositeStore({ activeId, defaultActiveId, setActiveId, focusLoop, focusWrap, focusShift, virtualFocus, orientation, rtl }); const store = storeProp !== null && storeProp !== void 0 ? storeProp : internalStore; const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ store }), [store]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ITI7HKP4_Composite, { disabled: disabled, store: store, ...props, ref: ref, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContext.Provider, { value: contextValue, children: children }) }); }), { /** * Renders a group element for composite items. * * @example * ```jsx * import { Composite } from '@wordpress/components'; * * <Composite> * <Composite.Group> * <Composite.GroupLabel>Label</Composite.GroupLabel> * <Composite.Item>Item 1</Composite.Item> * <Composite.Item>Item 2</Composite.Item> * </CompositeGroup> * </Composite> * ``` */ Group: Object.assign(CompositeGroup, { displayName: 'Composite.Group' }), /** * Renders a label in a composite group. This component must be wrapped with * `Composite.Group` so the `aria-labelledby` prop is properly set on the * composite group element. * * @example * ```jsx * import { Composite } from '@wordpress/components'; * * <Composite> * <Composite.Group> * <Composite.GroupLabel>Label</Composite.GroupLabel> * <Composite.Item>Item 1</Composite.Item> * <Composite.Item>Item 2</Composite.Item> * </CompositeGroup> * </Composite> * ``` */ GroupLabel: Object.assign(CompositeGroupLabel, { displayName: 'Composite.GroupLabel' }), /** * Renders a composite item. * * @example * ```jsx * import { Composite } from '@wordpress/components'; * * <Composite> * <Composite.Item>Item 1</Composite.Item> * <Composite.Item>Item 2</Composite.Item> * <Composite.Item>Item 3</Composite.Item> * </Composite> * ``` */ Item: Object.assign(CompositeItem, { displayName: 'Composite.Item' }), /** * Renders a composite row. Wrapping `Composite.Item` elements within * `Composite.Row` will create a two-dimensional composite widget, such as a * grid. * * @example * ```jsx * import { Composite } from '@wordpress/components'; * * <Composite> * <Composite.Row> * <Composite.Item>Item 1.1</Composite.Item> * <Composite.Item>Item 1.2</Composite.Item> * <Composite.Item>Item 1.3</Composite.Item> * </Composite.Row> * <Composite.Row> * <Composite.Item>Item 2.1</Composite.Item> * <Composite.Item>Item 2.2</Composite.Item> * <Composite.Item>Item 2.3</Composite.Item> * </Composite.Row> * </Composite> * ``` */ Row: Object.assign(CompositeRow, { displayName: 'Composite.Row' }), /** * Renders an element in a composite widget that receives focus on mouse move * and loses focus to the composite base element on mouse leave. This should * be combined with the `Composite.Item` component. * * @example * ```jsx * import { Composite } from '@wordpress/components'; * * <Composite> * <Composite.Hover render={ <Composite.Item /> }> * Item 1 * </Composite.Hover> * <Composite.Hover render={ <Composite.Item /> }> * Item 2 * </Composite.Hover> * </Composite> * ``` */ Hover: Object.assign(CompositeHover, { displayName: 'Composite.Hover' }), /** * Renders a component that adds typeahead functionality to composite * components. Hitting printable character keys will move focus to the next * composite item that begins with the input characters. * * @example * ```jsx * import { Composite } from '@wordpress/components'; * * <Composite render={ <CompositeTypeahead /> }> * <Composite.Item>Item 1</Composite.Item> * <Composite.Item>Item 2</Composite.Item> * </Composite> * ``` */ Typeahead: Object.assign(CompositeTypeahead, { displayName: 'Composite.Typeahead' }), /** * The React context used by the composite components. It can be used by * to access the composite store, and to forward the context when composite * sub-components are rendered across portals (ie. `SlotFill` components) * that would not otherwise forward the context to the `Fill` children. * * @example * ```jsx * import { Composite } from '@wordpress/components'; * import { useContext } from '@wordpress/element'; * * const compositeContext = useContext( Composite.Context ); * ``` */ Context: Object.assign(CompositeContext, { displayName: 'Composite.Context' }) }); ;// ./node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js "use client"; // src/disclosure/disclosure-store.ts function createDisclosureStore(props = {}) { const store = mergeStore( props.store, omit2(props.disclosure, ["contentElement", "disclosureElement"]) ); throwOnConflictingProps(props, store); const syncState = store == null ? void 0 : store.getState(); const open = defaultValue( props.open, syncState == null ? void 0 : syncState.open, props.defaultOpen, false ); const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); const initialState = { open, animated, animating: !!animated && open, mounted: open, contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) }; const disclosure = createStore(initialState, store); setup( disclosure, () => sync(disclosure, ["animated", "animating"], (state) => { if (state.animated) return; disclosure.setState("animating", false); }) ); setup( disclosure, () => subscribe(disclosure, ["open"], () => { if (!disclosure.getState().animated) return; disclosure.setState("animating", true); }) ); setup( disclosure, () => sync(disclosure, ["open", "animating"], (state) => { disclosure.setState("mounted", state.open || state.animating); }) ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), { disclosure: props.disclosure, setOpen: (value) => disclosure.setState("open", value), show: () => disclosure.setState("open", true), hide: () => disclosure.setState("open", false), toggle: () => disclosure.setState("open", (open2) => !open2), stopAnimation: () => disclosure.setState("animating", false), setContentElement: (value) => disclosure.setState("contentElement", value), setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js "use client"; // src/disclosure/disclosure-store.ts function useDisclosureStoreProps(store, update, props) { useUpdateEffect(update, [props.store, props.disclosure]); useStoreProps(store, props, "open", "setOpen"); useStoreProps(store, props, "mounted", "setMounted"); useStoreProps(store, props, "animated"); return Object.assign(store, { disclosure: props.disclosure }); } function useDisclosureStore(props = {}) { const [store, update] = YV4JVR4I_useStore(createDisclosureStore, props); return useDisclosureStoreProps(store, update, props); } ;// ./node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js "use client"; // src/dialog/dialog-store.ts function createDialogStore(props = {}) { return createDisclosureStore(props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js "use client"; // src/dialog/dialog-store.ts function useDialogStoreProps(store, update, props) { return useDisclosureStoreProps(store, update, props); } function useDialogStore(props = {}) { const [store, update] = YV4JVR4I_useStore(createDialogStore, props); return useDialogStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js "use client"; // src/popover/popover-store.ts function usePopoverStoreProps(store, update, props) { useUpdateEffect(update, [props.popover]); useStoreProps(store, props, "placement"); return useDialogStoreProps(store, update, props); } function usePopoverStore(props = {}) { const [store, update] = useStore(Core.createPopoverStore, props); return usePopoverStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/FTXTWCCT.js "use client"; // src/hovercard/hovercard-store.ts function useHovercardStoreProps(store, update, props) { useStoreProps(store, props, "timeout"); useStoreProps(store, props, "showTimeout"); useStoreProps(store, props, "hideTimeout"); return usePopoverStoreProps(store, update, props); } function useHovercardStore(props = {}) { const [store, update] = useStore(Core.createHovercardStore, props); return useHovercardStoreProps(store, update, props); } ;// ./node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js "use client"; // src/popover/popover-store.ts function createPopoverStore(_a = {}) { var _b = _a, { popover: otherPopover } = _b, props = _3YLGPPWQ_objRest(_b, [ "popover" ]); const store = mergeStore( props.store, omit2(otherPopover, [ "arrowElement", "anchorElement", "contentElement", "popoverElement", "disclosureElement" ]) ); throwOnConflictingProps(props, store); const syncState = store == null ? void 0 : store.getState(); const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store })); const placement = defaultValue( props.placement, syncState == null ? void 0 : syncState.placement, "bottom" ); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), { placement, currentPlacement: placement, anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), rendered: Symbol("rendered") }); const popover = createStore(initialState, dialog, store); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), { setAnchorElement: (element) => popover.setState("anchorElement", element), setPopoverElement: (element) => popover.setState("popoverElement", element), setArrowElement: (element) => popover.setState("arrowElement", element), render: () => popover.setState("rendered", Symbol("rendered")) }); } ;// ./node_modules/@ariakit/core/esm/__chunks/JTLIIJ4U.js "use client"; // src/hovercard/hovercard-store.ts function createHovercardStore(props = {}) { var _a; const syncState = (_a = props.store) == null ? void 0 : _a.getState(); const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { placement: defaultValue( props.placement, syncState == null ? void 0 : syncState.placement, "bottom" ) })); const timeout = defaultValue(props.timeout, syncState == null ? void 0 : syncState.timeout, 500); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, popover.getState()), { timeout, showTimeout: defaultValue(props.showTimeout, syncState == null ? void 0 : syncState.showTimeout), hideTimeout: defaultValue(props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout), autoFocusOnShow: defaultValue(syncState == null ? void 0 : syncState.autoFocusOnShow, false) }); const hovercard = createStore(initialState, popover, props.store); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), hovercard), { setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value) }); } ;// ./node_modules/@ariakit/core/esm/tooltip/tooltip-store.js "use client"; // src/tooltip/tooltip-store.ts function createTooltipStore(props = {}) { var _a; if (false) {} const syncState = (_a = props.store) == null ? void 0 : _a.getState(); const hovercard = createHovercardStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { placement: defaultValue( props.placement, syncState == null ? void 0 : syncState.placement, "top" ), hideTimeout: defaultValue(props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout, 0) })); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, hovercard.getState()), { type: defaultValue(props.type, syncState == null ? void 0 : syncState.type, "description"), skipTimeout: defaultValue(props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300) }); const tooltip = createStore(initialState, hovercard, props.store); return _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, hovercard), tooltip); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/YTDK2NGG.js "use client"; // src/tooltip/tooltip-store.ts function useTooltipStoreProps(store, update, props) { useStoreProps(store, props, "type"); useStoreProps(store, props, "skipTimeout"); return useHovercardStoreProps(store, update, props); } function useTooltipStore(props = {}) { const [store, update] = YV4JVR4I_useStore(createTooltipStore, props); return useTooltipStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/XL7CSKGW.js "use client"; // src/role/role.tsx var XL7CSKGW_TagName = "div"; var XL7CSKGW_elements = [ "a", "button", "details", "dialog", "div", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "img", "input", "label", "li", "nav", "ol", "p", "section", "select", "span", "summary", "textarea", "ul", "svg" ]; var useRole = createHook( function useRole2(props) { return props; } ); var Role = forwardRef2( // @ts-expect-error function Role2(props) { return LMDWO4NN_createElement(XL7CSKGW_TagName, props); } ); Object.assign( Role, XL7CSKGW_elements.reduce((acc, element) => { acc[element] = forwardRef2(function Role3(props) { return LMDWO4NN_createElement(element, props); }); return acc; }, {}) ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js "use client"; // src/disclosure/disclosure-context.tsx var S6EF7IVO_ctx = createStoreContext(); var useDisclosureContext = S6EF7IVO_ctx.useContext; var useDisclosureScopedContext = S6EF7IVO_ctx.useScopedContext; var useDisclosureProviderContext = S6EF7IVO_ctx.useProviderContext; var DisclosureContextProvider = S6EF7IVO_ctx.ContextProvider; var DisclosureScopedContextProvider = S6EF7IVO_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js "use client"; // src/dialog/dialog-context.tsx var RS7LB2H4_ctx = createStoreContext( [DisclosureContextProvider], [DisclosureScopedContextProvider] ); var useDialogContext = RS7LB2H4_ctx.useContext; var useDialogScopedContext = RS7LB2H4_ctx.useScopedContext; var useDialogProviderContext = RS7LB2H4_ctx.useProviderContext; var DialogContextProvider = RS7LB2H4_ctx.ContextProvider; var DialogScopedContextProvider = RS7LB2H4_ctx.ScopedContextProvider; var DialogHeadingContext = (0,external_React_.createContext)(void 0); var DialogDescriptionContext = (0,external_React_.createContext)(void 0); ;// ./node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js "use client"; // src/popover/popover-context.tsx var MTZPJQMC_ctx = createStoreContext( [DialogContextProvider], [DialogScopedContextProvider] ); var usePopoverContext = MTZPJQMC_ctx.useContext; var usePopoverScopedContext = MTZPJQMC_ctx.useScopedContext; var usePopoverProviderContext = MTZPJQMC_ctx.useProviderContext; var PopoverContextProvider = MTZPJQMC_ctx.ContextProvider; var PopoverScopedContextProvider = MTZPJQMC_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/EM5CXX6A.js "use client"; // src/hovercard/hovercard-context.tsx var EM5CXX6A_ctx = createStoreContext( [PopoverContextProvider], [PopoverScopedContextProvider] ); var useHovercardContext = EM5CXX6A_ctx.useContext; var useHovercardScopedContext = EM5CXX6A_ctx.useScopedContext; var useHovercardProviderContext = EM5CXX6A_ctx.useProviderContext; var HovercardContextProvider = EM5CXX6A_ctx.ContextProvider; var HovercardScopedContextProvider = EM5CXX6A_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/BYC7LY2E.js "use client"; // src/hovercard/hovercard-anchor.tsx var BYC7LY2E_TagName = "a"; var useHovercardAnchor = createHook( function useHovercardAnchor2(_a) { var _b = _a, { store, showOnHover = true } = _b, props = __objRest(_b, ["store", "showOnHover"]); const context = useHovercardProviderContext(); store = store || context; invariant( store, false && 0 ); const disabled = disabledFromProps(props); const showTimeoutRef = (0,external_React_.useRef)(0); (0,external_React_.useEffect)(() => () => window.clearTimeout(showTimeoutRef.current), []); (0,external_React_.useEffect)(() => { const onMouseLeave = (event) => { if (!store) return; const { anchorElement } = store.getState(); if (!anchorElement) return; if (event.target !== anchorElement) return; window.clearTimeout(showTimeoutRef.current); showTimeoutRef.current = 0; }; return addGlobalEventListener("mouseleave", onMouseLeave, true); }, [store]); const onMouseMoveProp = props.onMouseMove; const showOnHoverProp = useBooleanEvent(showOnHover); const isMouseMoving = useIsMouseMoving(); const onMouseMove = useEvent((event) => { onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); if (disabled) return; if (!store) return; if (event.defaultPrevented) return; if (showTimeoutRef.current) return; if (!isMouseMoving()) return; if (!showOnHoverProp(event)) return; const element = event.currentTarget; store.setAnchorElement(element); store.setDisclosureElement(element); const { showTimeout, timeout } = store.getState(); const showHovercard = () => { showTimeoutRef.current = 0; if (!isMouseMoving()) return; store == null ? void 0 : store.setAnchorElement(element); store == null ? void 0 : store.show(); queueMicrotask(() => { store == null ? void 0 : store.setDisclosureElement(element); }); }; const timeoutMs = showTimeout != null ? showTimeout : timeout; if (timeoutMs === 0) { showHovercard(); } else { showTimeoutRef.current = window.setTimeout(showHovercard, timeoutMs); } }); const onClickProp = props.onClick; const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (!store) return; window.clearTimeout(showTimeoutRef.current); showTimeoutRef.current = 0; }); const ref = (0,external_React_.useCallback)( (element) => { if (!store) return; const { anchorElement } = store.getState(); if (anchorElement == null ? void 0 : anchorElement.isConnected) return; store.setAnchorElement(element); }, [store] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(ref, props.ref), onMouseMove, onClick }); props = useFocusable(props); return props; } ); var HovercardAnchor = forwardRef2(function HovercardAnchor2(props) { const htmlProps = useHovercardAnchor(props); return LMDWO4NN_createElement(BYC7LY2E_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/F4IYJ42G.js "use client"; // src/tooltip/tooltip-context.tsx var F4IYJ42G_ctx = createStoreContext( [HovercardContextProvider], [HovercardScopedContextProvider] ); var useTooltipContext = F4IYJ42G_ctx.useContext; var useTooltipScopedContext = F4IYJ42G_ctx.useScopedContext; var useTooltipProviderContext = F4IYJ42G_ctx.useProviderContext; var TooltipContextProvider = F4IYJ42G_ctx.ContextProvider; var TooltipScopedContextProvider = F4IYJ42G_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/tooltip/tooltip-anchor.js "use client"; // src/tooltip/tooltip-anchor.tsx var tooltip_anchor_TagName = "div"; var globalStore = createStore({ activeStore: null }); function createRemoveStoreCallback(store) { return () => { const { activeStore } = globalStore.getState(); if (activeStore !== store) return; globalStore.setState("activeStore", null); }; } var useTooltipAnchor = createHook( function useTooltipAnchor2(_a) { var _b = _a, { store, showOnHover = true } = _b, props = __objRest(_b, ["store", "showOnHover"]); const context = useTooltipProviderContext(); store = store || context; invariant( store, false && 0 ); const canShowOnHoverRef = (0,external_React_.useRef)(false); (0,external_React_.useEffect)(() => { return sync(store, ["mounted"], (state) => { if (state.mounted) return; canShowOnHoverRef.current = false; }); }, [store]); (0,external_React_.useEffect)(() => { if (!store) return; return chain( // Immediately remove the current store from the global store when // the component unmounts. This is useful, for example, to avoid // showing tooltips immediately on serial tests. createRemoveStoreCallback(store), sync(store, ["mounted", "skipTimeout"], (state) => { if (!store) return; if (state.mounted) { const { activeStore } = globalStore.getState(); if (activeStore !== store) { activeStore == null ? void 0 : activeStore.hide(); } return globalStore.setState("activeStore", store); } const id = setTimeout( createRemoveStoreCallback(store), state.skipTimeout ); return () => clearTimeout(id); }) ); }, [store]); const onMouseEnterProp = props.onMouseEnter; const onMouseEnter = useEvent((event) => { onMouseEnterProp == null ? void 0 : onMouseEnterProp(event); canShowOnHoverRef.current = true; }); const onFocusVisibleProp = props.onFocusVisible; const onFocusVisible = useEvent((event) => { onFocusVisibleProp == null ? void 0 : onFocusVisibleProp(event); if (event.defaultPrevented) return; store == null ? void 0 : store.setAnchorElement(event.currentTarget); store == null ? void 0 : store.show(); }); const onBlurProp = props.onBlur; const onBlur = useEvent((event) => { onBlurProp == null ? void 0 : onBlurProp(event); if (event.defaultPrevented) return; const { activeStore } = globalStore.getState(); canShowOnHoverRef.current = false; if (activeStore === store) { globalStore.setState("activeStore", null); } }); const type = store.useState("type"); const contentId = store.useState((state) => { var _a2; return (_a2 = state.contentElement) == null ? void 0 : _a2.id; }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ "aria-labelledby": type === "label" ? contentId : void 0 }, props), { onMouseEnter, onFocusVisible, onBlur }); props = useHovercardAnchor(_3YLGPPWQ_spreadValues({ store, showOnHover(event) { if (!canShowOnHoverRef.current) return false; if (isFalsyBooleanCallback(showOnHover, event)) return false; const { activeStore } = globalStore.getState(); if (!activeStore) return true; store == null ? void 0 : store.show(); return false; } }, props)); return props; } ); var TooltipAnchor = forwardRef2(function TooltipAnchor2(props) { const htmlProps = useTooltipAnchor(props); return LMDWO4NN_createElement(tooltip_anchor_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/X7QOZUD3.js "use client"; // src/hovercard/utils/polygon.ts function getEventPoint(event) { return [event.clientX, event.clientY]; } function isPointInPolygon(point, polygon) { const [x, y] = point; let inside = false; const length = polygon.length; for (let l = length, i = 0, j = l - 1; i < l; j = i++) { const [xi, yi] = polygon[i]; const [xj, yj] = polygon[j]; const [, vy] = polygon[j === 0 ? l - 1 : j - 1] || [0, 0]; const where = (yi - yj) * (x - xi) - (xi - xj) * (y - yi); if (yj < yi) { if (y >= yj && y < yi) { if (where === 0) return true; if (where > 0) { if (y === yj) { if (y > vy) { inside = !inside; } } else { inside = !inside; } } } } else if (yi < yj) { if (y > yi && y <= yj) { if (where === 0) return true; if (where < 0) { if (y === yj) { if (y < vy) { inside = !inside; } } else { inside = !inside; } } } } else if (y === yi && (x >= xj && x <= xi || x >= xi && x <= xj)) { return true; } } return inside; } function getEnterPointPlacement(enterPoint, rect) { const { top, right, bottom, left } = rect; const [x, y] = enterPoint; const placementX = x < left ? "left" : x > right ? "right" : null; const placementY = y < top ? "top" : y > bottom ? "bottom" : null; return [placementX, placementY]; } function getElementPolygon(element, enterPoint) { const rect = element.getBoundingClientRect(); const { top, right, bottom, left } = rect; const [x, y] = getEnterPointPlacement(enterPoint, rect); const polygon = [enterPoint]; if (x) { if (y !== "top") { polygon.push([x === "left" ? left : right, top]); } polygon.push([x === "left" ? right : left, top]); polygon.push([x === "left" ? right : left, bottom]); if (y !== "bottom") { polygon.push([x === "left" ? left : right, bottom]); } } else if (y === "top") { polygon.push([left, top]); polygon.push([left, bottom]); polygon.push([right, bottom]); polygon.push([right, top]); } else { polygon.push([left, bottom]); polygon.push([left, top]); polygon.push([right, top]); polygon.push([right, bottom]); } return polygon; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/63XF7ACK.js "use client"; // src/dialog/utils/is-backdrop.ts function _63XF7ACK_isBackdrop(element, ...ids) { if (!element) return false; const backdrop = element.getAttribute("data-backdrop"); if (backdrop == null) return false; if (backdrop === "") return true; if (backdrop === "true") return true; if (!ids.length) return true; return ids.some((id) => backdrop === id); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/K2ZF5NU7.js "use client"; // src/dialog/utils/orchestrate.ts var cleanups = /* @__PURE__ */ new WeakMap(); function orchestrate(element, key, setup) { if (!cleanups.has(element)) { cleanups.set(element, /* @__PURE__ */ new Map()); } const elementCleanups = cleanups.get(element); const prevCleanup = elementCleanups.get(key); if (!prevCleanup) { elementCleanups.set(key, setup()); return () => { var _a; (_a = elementCleanups.get(key)) == null ? void 0 : _a(); elementCleanups.delete(key); }; } const cleanup = setup(); const nextCleanup = () => { cleanup(); prevCleanup(); elementCleanups.delete(key); }; elementCleanups.set(key, nextCleanup); return () => { const isCurrent = elementCleanups.get(key) === nextCleanup; if (!isCurrent) return; cleanup(); elementCleanups.set(key, prevCleanup); }; } function setAttribute(element, attr, value) { const setup = () => { const previousValue = element.getAttribute(attr); element.setAttribute(attr, value); return () => { if (previousValue == null) { element.removeAttribute(attr); } else { element.setAttribute(attr, previousValue); } }; }; return orchestrate(element, attr, setup); } function setProperty(element, property, value) { const setup = () => { const exists = property in element; const previousValue = element[property]; element[property] = value; return () => { if (!exists) { delete element[property]; } else { element[property] = previousValue; } }; }; return orchestrate(element, property, setup); } function assignStyle(element, style) { if (!element) return () => { }; const setup = () => { const prevStyle = element.style.cssText; Object.assign(element.style, style); return () => { element.style.cssText = prevStyle; }; }; return orchestrate(element, "style", setup); } function setCSSProperty(element, property, value) { if (!element) return () => { }; const setup = () => { const previousValue = element.style.getPropertyValue(property); element.style.setProperty(property, value); return () => { if (previousValue) { element.style.setProperty(property, previousValue); } else { element.style.removeProperty(property); } }; }; return orchestrate(element, property, setup); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/AOUGVQZ3.js "use client"; // src/dialog/utils/walk-tree-outside.ts var ignoreTags = ["SCRIPT", "STYLE"]; function getSnapshotPropertyName(id) { return `__ariakit-dialog-snapshot-${id}`; } function inSnapshot(id, element) { const doc = getDocument(element); const propertyName = getSnapshotPropertyName(id); if (!doc.body[propertyName]) return true; do { if (element === doc.body) return false; if (element[propertyName]) return true; if (!element.parentElement) return false; element = element.parentElement; } while (true); } function isValidElement(id, element, ignoredElements) { if (ignoreTags.includes(element.tagName)) return false; if (!inSnapshot(id, element)) return false; return !ignoredElements.some( (enabledElement) => enabledElement && contains(element, enabledElement) ); } function AOUGVQZ3_walkTreeOutside(id, elements, callback, ancestorCallback) { for (let element of elements) { if (!(element == null ? void 0 : element.isConnected)) continue; const hasAncestorAlready = elements.some((maybeAncestor) => { if (!maybeAncestor) return false; if (maybeAncestor === element) return false; return maybeAncestor.contains(element); }); const doc = getDocument(element); const originalElement = element; while (element.parentElement && element !== doc.body) { ancestorCallback == null ? void 0 : ancestorCallback(element.parentElement, originalElement); if (!hasAncestorAlready) { for (const child of element.parentElement.children) { if (isValidElement(id, child, elements)) { callback(child, originalElement); } } } element = element.parentElement; } } } function createWalkTreeSnapshot(id, elements) { const { body } = getDocument(elements[0]); const cleanups = []; const markElement = (element) => { cleanups.push(setProperty(element, getSnapshotPropertyName(id), true)); }; AOUGVQZ3_walkTreeOutside(id, elements, markElement); return chain(setProperty(body, getSnapshotPropertyName(id), true), () => { for (const cleanup of cleanups) { cleanup(); } }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/2PGBN2Y4.js "use client"; // src/dialog/utils/mark-tree-outside.ts function getPropertyName(id = "", ancestor = false) { return `__ariakit-dialog-${ancestor ? "ancestor" : "outside"}${id ? `-${id}` : ""}`; } function markElement(element, id = "") { return chain( setProperty(element, getPropertyName(), true), setProperty(element, getPropertyName(id), true) ); } function markAncestor(element, id = "") { return chain( setProperty(element, getPropertyName("", true), true), setProperty(element, getPropertyName(id, true), true) ); } function isElementMarked(element, id) { const ancestorProperty = getPropertyName(id, true); if (element[ancestorProperty]) return true; const elementProperty = getPropertyName(id); do { if (element[elementProperty]) return true; if (!element.parentElement) return false; element = element.parentElement; } while (true); } function markTreeOutside(id, elements) { const cleanups = []; const ids = elements.map((el) => el == null ? void 0 : el.id); AOUGVQZ3_walkTreeOutside( id, elements, (element) => { if (_63XF7ACK_isBackdrop(element, ...ids)) return; cleanups.unshift(markElement(element, id)); }, (ancestor, element) => { const isAnotherDialogAncestor = element.hasAttribute("data-dialog") && element.id !== id; if (isAnotherDialogAncestor) return; cleanups.unshift(markAncestor(ancestor, id)); } ); const restoreAccessibilityTree = () => { for (const cleanup of cleanups) { cleanup(); } }; return restoreAccessibilityTree; } ;// external "ReactDOM" const external_ReactDOM_namespaceObject = window["ReactDOM"]; ;// ./node_modules/@ariakit/react-core/esm/__chunks/VGCJ63VH.js "use client"; // src/disclosure/disclosure-content.tsx var VGCJ63VH_TagName = "div"; function afterTimeout(timeoutMs, cb) { const timeoutId = setTimeout(cb, timeoutMs); return () => clearTimeout(timeoutId); } function VGCJ63VH_afterPaint(cb) { let raf = requestAnimationFrame(() => { raf = requestAnimationFrame(cb); }); return () => cancelAnimationFrame(raf); } function parseCSSTime(...times) { return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => { const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3; const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier; if (currentTime > longestTime) return currentTime; return longestTime; }, 0); } function isHidden(mounted, hidden, alwaysVisible) { return !alwaysVisible && hidden !== false && (!mounted || !!hidden); } var useDisclosureContent = createHook(function useDisclosureContent2(_a) { var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); const context = useDisclosureProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const id = useId(props.id); const [transition, setTransition] = (0,external_React_.useState)(null); const open = store.useState("open"); const mounted = store.useState("mounted"); const animated = store.useState("animated"); const contentElement = store.useState("contentElement"); const otherElement = useStoreState(store.disclosure, "contentElement"); useSafeLayoutEffect(() => { if (!ref.current) return; store == null ? void 0 : store.setContentElement(ref.current); }, [store]); useSafeLayoutEffect(() => { let previousAnimated; store == null ? void 0 : store.setState("animated", (animated2) => { previousAnimated = animated2; return true; }); return () => { if (previousAnimated === void 0) return; store == null ? void 0 : store.setState("animated", previousAnimated); }; }, [store]); useSafeLayoutEffect(() => { if (!animated) return; if (!(contentElement == null ? void 0 : contentElement.isConnected)) { setTransition(null); return; } return VGCJ63VH_afterPaint(() => { setTransition(open ? "enter" : mounted ? "leave" : null); }); }, [animated, contentElement, open, mounted]); useSafeLayoutEffect(() => { if (!store) return; if (!animated) return; if (!transition) return; if (!contentElement) return; const stopAnimation = () => store == null ? void 0 : store.setState("animating", false); const stopAnimationSync = () => (0,external_ReactDOM_namespaceObject.flushSync)(stopAnimation); if (transition === "leave" && open) return; if (transition === "enter" && !open) return; if (typeof animated === "number") { const timeout2 = animated; return afterTimeout(timeout2, stopAnimationSync); } const { transitionDuration, animationDuration, transitionDelay, animationDelay } = getComputedStyle(contentElement); const { transitionDuration: transitionDuration2 = "0", animationDuration: animationDuration2 = "0", transitionDelay: transitionDelay2 = "0", animationDelay: animationDelay2 = "0" } = otherElement ? getComputedStyle(otherElement) : {}; const delay = parseCSSTime( transitionDelay, animationDelay, transitionDelay2, animationDelay2 ); const duration = parseCSSTime( transitionDuration, animationDuration, transitionDuration2, animationDuration2 ); const timeout = delay + duration; if (!timeout) { if (transition === "enter") { store.setState("animated", false); } stopAnimation(); return; } const frameRate = 1e3 / 60; const maxTimeout = Math.max(timeout - frameRate, 0); return afterTimeout(maxTimeout, stopAnimationSync); }, [store, animated, contentElement, otherElement, open, transition]); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }), [store] ); const hidden = isHidden(mounted, props.hidden, alwaysVisible); const styleProp = props.style; const style = (0,external_React_.useMemo)(() => { if (hidden) { return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, styleProp), { display: "none" }); } return styleProp; }, [hidden, styleProp]); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, "data-open": open || void 0, "data-enter": transition === "enter" || void 0, "data-leave": transition === "leave" || void 0, hidden }, props), { ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref), style }); return removeUndefinedValues(props); }); var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) { const htmlProps = useDisclosureContent(props); return LMDWO4NN_createElement(VGCJ63VH_TagName, htmlProps); }); var DisclosureContent = forwardRef2(function DisclosureContent2(_a) { var _b = _a, { unmountOnHide } = _b, props = __objRest(_b, [ "unmountOnHide" ]); const context = useDisclosureProviderContext(); const store = props.store || context; const mounted = useStoreState( store, (state) => !unmountOnHide || (state == null ? void 0 : state.mounted) ); if (mounted === false) return null; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _3YLGPPWQ_spreadValues({}, props)); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/63FEHJZV.js "use client"; // src/dialog/dialog-backdrop.tsx function DialogBackdrop({ store, backdrop, alwaysVisible, hidden }) { const ref = (0,external_React_.useRef)(null); const disclosure = useDisclosureStore({ disclosure: store }); const contentElement = useStoreState(store, "contentElement"); (0,external_React_.useEffect)(() => { const backdrop2 = ref.current; const dialog = contentElement; if (!backdrop2) return; if (!dialog) return; backdrop2.style.zIndex = getComputedStyle(dialog).zIndex; }, [contentElement]); useSafeLayoutEffect(() => { const id = contentElement == null ? void 0 : contentElement.id; if (!id) return; const backdrop2 = ref.current; if (!backdrop2) return; return markAncestor(backdrop2, id); }, [contentElement]); const props = useDisclosureContent({ ref, store: disclosure, role: "presentation", "data-backdrop": (contentElement == null ? void 0 : contentElement.id) || "", alwaysVisible, hidden: hidden != null ? hidden : void 0, style: { position: "fixed", top: 0, right: 0, bottom: 0, left: 0 } }); if (!backdrop) return null; if ((0,external_React_.isValidElement)(backdrop)) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Role, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { render: backdrop })); } const Component = typeof backdrop !== "boolean" ? backdrop : "div"; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Role, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, {}) })); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/IGR4SXG2.js "use client"; // src/dialog/utils/is-focus-trap.ts function isFocusTrap(element, ...ids) { if (!element) return false; const attr = element.getAttribute("data-focus-trap"); if (attr == null) return false; if (!ids.length) return true; if (attr === "") return false; return ids.some((id) => attr === id); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/ESSM74HH.js "use client"; // src/dialog/utils/disable-accessibility-tree-outside.ts function hideElementFromAccessibilityTree(element) { return setAttribute(element, "aria-hidden", "true"); } function disableAccessibilityTreeOutside(id, elements) { const cleanups = []; const ids = elements.map((el) => el == null ? void 0 : el.id); walkTreeOutside(id, elements, (element) => { if (isBackdrop(element, ...ids)) return; cleanups.unshift(hideElementFromAccessibilityTree(element)); }); const restoreAccessibilityTree = () => { for (const cleanup of cleanups) { cleanup(); } }; return restoreAccessibilityTree; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/677M2CI3.js "use client"; // src/dialog/utils/supports-inert.ts function supportsInert() { return "inert" in HTMLElement.prototype; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/KZAQFFOU.js "use client"; // src/dialog/utils/disable-tree.ts function disableTree(element, ignoredElements) { if (!("style" in element)) return noop; if (supportsInert()) { return setProperty(element, "inert", true); } const tabbableElements = getAllTabbableIn(element, true); const enableElements = tabbableElements.map((element2) => { if (ignoredElements == null ? void 0 : ignoredElements.some((el) => el && contains(el, element2))) return noop; const restoreFocusMethod = orchestrate(element2, "focus", () => { element2.focus = noop; return () => { delete element2.focus; }; }); return chain(setAttribute(element2, "tabindex", "-1"), restoreFocusMethod); }); return chain( ...enableElements, hideElementFromAccessibilityTree(element), assignStyle(element, { pointerEvents: "none", userSelect: "none", cursor: "default" }) ); } function disableTreeOutside(id, elements) { const cleanups = []; const ids = elements.map((el) => el == null ? void 0 : el.id); AOUGVQZ3_walkTreeOutside( id, elements, (element) => { if (_63XF7ACK_isBackdrop(element, ...ids)) return; if (isFocusTrap(element, ...ids)) return; cleanups.unshift(disableTree(element, elements)); }, (element) => { if (!element.hasAttribute("role")) return; if (elements.some((el) => el && contains(el, element))) return; cleanups.unshift(setAttribute(element, "role", "none")); } ); const restoreTreeOutside = () => { for (const cleanup of cleanups) { cleanup(); } }; return restoreTreeOutside; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/YKJECYU7.js "use client"; // src/dialog/utils/use-root-dialog.ts function useRootDialog({ attribute, contentId, contentElement, enabled }) { const [updated, retry] = useForceUpdate(); const isRootDialog = (0,external_React_.useCallback)(() => { if (!enabled) return false; if (!contentElement) return false; const { body } = getDocument(contentElement); const id = body.getAttribute(attribute); return !id || id === contentId; }, [updated, enabled, contentElement, attribute, contentId]); (0,external_React_.useEffect)(() => { if (!enabled) return; if (!contentId) return; if (!contentElement) return; const { body } = getDocument(contentElement); if (isRootDialog()) { body.setAttribute(attribute, contentId); return () => body.removeAttribute(attribute); } const observer = new MutationObserver(() => (0,external_ReactDOM_namespaceObject.flushSync)(retry)); observer.observe(body, { attributeFilter: [attribute] }); return () => observer.disconnect(); }, [updated, enabled, contentId, contentElement, isRootDialog, attribute]); return isRootDialog; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/BGQ3KQ5M.js "use client"; // src/dialog/utils/use-prevent-body-scroll.ts function getPaddingProperty(documentElement) { const documentLeft = documentElement.getBoundingClientRect().left; const scrollbarX = Math.round(documentLeft) + documentElement.scrollLeft; return scrollbarX ? "paddingLeft" : "paddingRight"; } function usePreventBodyScroll(contentElement, contentId, enabled) { const isRootDialog = useRootDialog({ attribute: "data-dialog-prevent-body-scroll", contentElement, contentId, enabled }); (0,external_React_.useEffect)(() => { if (!isRootDialog()) return; if (!contentElement) return; const doc = getDocument(contentElement); const win = getWindow(contentElement); const { documentElement, body } = doc; const cssScrollbarWidth = documentElement.style.getPropertyValue("--scrollbar-width"); const scrollbarWidth = cssScrollbarWidth ? Number.parseInt(cssScrollbarWidth) : win.innerWidth - documentElement.clientWidth; const setScrollbarWidthProperty = () => setCSSProperty( documentElement, "--scrollbar-width", `${scrollbarWidth}px` ); const paddingProperty = getPaddingProperty(documentElement); const setStyle = () => assignStyle(body, { overflow: "hidden", [paddingProperty]: `${scrollbarWidth}px` }); const setIOSStyle = () => { var _a, _b; const { scrollX, scrollY, visualViewport } = win; const offsetLeft = (_a = visualViewport == null ? void 0 : visualViewport.offsetLeft) != null ? _a : 0; const offsetTop = (_b = visualViewport == null ? void 0 : visualViewport.offsetTop) != null ? _b : 0; const restoreStyle = assignStyle(body, { position: "fixed", overflow: "hidden", top: `${-(scrollY - Math.floor(offsetTop))}px`, left: `${-(scrollX - Math.floor(offsetLeft))}px`, right: "0", [paddingProperty]: `${scrollbarWidth}px` }); return () => { restoreStyle(); if (true) { win.scrollTo({ left: scrollX, top: scrollY, behavior: "instant" }); } }; }; const isIOS = isApple() && !isMac(); return chain( setScrollbarWidthProperty(), isIOS ? setIOSStyle() : setStyle() ); }, [isRootDialog, contentElement]); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/TOU75OXH.js "use client"; // src/dialog/utils/use-nested-dialogs.tsx var NestedDialogsContext = (0,external_React_.createContext)({}); function useNestedDialogs(store) { const context = (0,external_React_.useContext)(NestedDialogsContext); const [dialogs, setDialogs] = (0,external_React_.useState)([]); const add = (0,external_React_.useCallback)( (dialog) => { var _a; setDialogs((dialogs2) => [...dialogs2, dialog]); return chain((_a = context.add) == null ? void 0 : _a.call(context, dialog), () => { setDialogs((dialogs2) => dialogs2.filter((d) => d !== dialog)); }); }, [context] ); useSafeLayoutEffect(() => { return sync(store, ["open", "contentElement"], (state) => { var _a; if (!state.open) return; if (!state.contentElement) return; return (_a = context.add) == null ? void 0 : _a.call(context, store); }); }, [store, context]); const providerValue = (0,external_React_.useMemo)(() => ({ store, add }), [store, add]); const wrapElement = (0,external_React_.useCallback)( (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NestedDialogsContext.Provider, { value: providerValue, children: element }), [providerValue] ); return { wrapElement, nestedDialogs: dialogs }; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/HLTQOHKZ.js "use client"; // src/dialog/utils/use-previous-mouse-down-ref.ts function usePreviousMouseDownRef(enabled) { const previousMouseDownRef = (0,external_React_.useRef)(); (0,external_React_.useEffect)(() => { if (!enabled) { previousMouseDownRef.current = null; return; } const onMouseDown = (event) => { previousMouseDownRef.current = event.target; }; return addGlobalEventListener("mousedown", onMouseDown, true); }, [enabled]); return previousMouseDownRef; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/WBDYNH73.js "use client"; // src/dialog/utils/use-hide-on-interact-outside.ts function isInDocument(target) { if (target.tagName === "HTML") return true; return contains(getDocument(target).body, target); } function isDisclosure(disclosure, target) { if (!disclosure) return false; if (contains(disclosure, target)) return true; const activeId = target.getAttribute("aria-activedescendant"); if (activeId) { const activeElement = getDocument(disclosure).getElementById(activeId); if (activeElement) { return contains(disclosure, activeElement); } } return false; } function isMouseEventOnDialog(event, dialog) { if (!("clientY" in event)) return false; const rect = dialog.getBoundingClientRect(); if (rect.width === 0 || rect.height === 0) return false; return rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width; } function useEventOutside({ store, type, listener, capture, domReady }) { const callListener = useEvent(listener); const open = useStoreState(store, "open"); const focusedRef = (0,external_React_.useRef)(false); useSafeLayoutEffect(() => { if (!open) return; if (!domReady) return; const { contentElement } = store.getState(); if (!contentElement) return; const onFocus = () => { focusedRef.current = true; }; contentElement.addEventListener("focusin", onFocus, true); return () => contentElement.removeEventListener("focusin", onFocus, true); }, [store, open, domReady]); (0,external_React_.useEffect)(() => { if (!open) return; const onEvent = (event) => { const { contentElement, disclosureElement } = store.getState(); const target = event.target; if (!contentElement) return; if (!target) return; if (!isInDocument(target)) return; if (contains(contentElement, target)) return; if (isDisclosure(disclosureElement, target)) return; if (target.hasAttribute("data-focus-trap")) return; if (isMouseEventOnDialog(event, contentElement)) return; const focused = focusedRef.current; if (focused && !isElementMarked(target, contentElement.id)) return; if (isSafariFocusAncestor(target)) return; callListener(event); }; return addGlobalEventListener(type, onEvent, capture); }, [open, capture]); } function shouldHideOnInteractOutside(hideOnInteractOutside, event) { if (typeof hideOnInteractOutside === "function") { return hideOnInteractOutside(event); } return !!hideOnInteractOutside; } function useHideOnInteractOutside(store, hideOnInteractOutside, domReady) { const open = useStoreState(store, "open"); const previousMouseDownRef = usePreviousMouseDownRef(open); const props = { store, domReady, capture: true }; useEventOutside(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { type: "click", listener: (event) => { const { contentElement } = store.getState(); const previousMouseDown = previousMouseDownRef.current; if (!previousMouseDown) return; if (!isVisible(previousMouseDown)) return; if (!isElementMarked(previousMouseDown, contentElement == null ? void 0 : contentElement.id)) return; if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return; store.hide(); } })); useEventOutside(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { type: "focusin", listener: (event) => { const { contentElement } = store.getState(); if (!contentElement) return; if (event.target === getDocument(contentElement)) return; if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return; store.hide(); } })); useEventOutside(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { type: "contextmenu", listener: (event) => { if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return; store.hide(); } })); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/6GXEOXGT.js "use client"; // src/dialog/utils/prepend-hidden-dismiss.ts function prependHiddenDismiss(container, onClick) { const document = getDocument(container); const button = document.createElement("button"); button.type = "button"; button.tabIndex = -1; button.textContent = "Dismiss popup"; Object.assign(button.style, { border: "0px", clip: "rect(0 0 0 0)", height: "1px", margin: "-1px", overflow: "hidden", padding: "0px", position: "absolute", whiteSpace: "nowrap", width: "1px" }); button.addEventListener("click", onClick); container.prepend(button); const removeHiddenDismiss = () => { button.removeEventListener("click", onClick); button.remove(); }; return removeHiddenDismiss; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/ZWYATQFU.js "use client"; // src/focusable/focusable-container.tsx var ZWYATQFU_TagName = "div"; var useFocusableContainer = createHook(function useFocusableContainer2(_a) { var _b = _a, { autoFocusOnShow = true } = _b, props = __objRest(_b, ["autoFocusOnShow"]); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FocusableContext.Provider, { value: autoFocusOnShow, children: element }), [autoFocusOnShow] ); return props; }); var FocusableContainer = forwardRef2(function FocusableContainer2(props) { const htmlProps = useFocusableContainer(props); return LMDWO4NN_createElement(ZWYATQFU_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/CZ4GFWYL.js "use client"; // src/heading/heading-context.tsx var HeadingContext = (0,external_React_.createContext)(0); ;// ./node_modules/@ariakit/react-core/esm/__chunks/5M6RIVE2.js "use client"; // src/heading/heading-level.tsx function HeadingLevel({ level, children }) { const contextLevel = (0,external_React_.useContext)(HeadingContext); const nextLevel = Math.max( Math.min(level || contextLevel + 1, 6), 1 ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingContext.Provider, { value: nextLevel, children }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/XX67R432.js "use client"; // src/visually-hidden/visually-hidden.tsx var XX67R432_TagName = "span"; var useVisuallyHidden = createHook( function useVisuallyHidden2(props) { props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { style: _3YLGPPWQ_spreadValues({ border: 0, clip: "rect(0 0 0 0)", height: "1px", margin: "-1px", overflow: "hidden", padding: 0, position: "absolute", whiteSpace: "nowrap", width: "1px" }, props.style) }); return props; } ); var VisuallyHidden = forwardRef2(function VisuallyHidden2(props) { const htmlProps = useVisuallyHidden(props); return LMDWO4NN_createElement(XX67R432_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/W3VI7GFU.js "use client"; // src/focus-trap/focus-trap.tsx var W3VI7GFU_TagName = "span"; var useFocusTrap = createHook( function useFocusTrap2(props) { props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ "data-focus-trap": "", tabIndex: 0, "aria-hidden": true }, props), { style: _3YLGPPWQ_spreadValues({ // Prevents unintended scroll jumps. position: "fixed", top: 0, left: 0 }, props.style) }); props = useVisuallyHidden(props); return props; } ); var FocusTrap = forwardRef2(function FocusTrap2(props) { const htmlProps = useFocusTrap(props); return LMDWO4NN_createElement(W3VI7GFU_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/AOQQTIBO.js "use client"; // src/portal/portal-context.tsx var PortalContext = (0,external_React_.createContext)(null); ;// ./node_modules/@ariakit/react-core/esm/__chunks/O37CNYMR.js "use client"; // src/portal/portal.tsx var O37CNYMR_TagName = "div"; function getRootElement(element) { return getDocument(element).body; } function getPortalElement(element, portalElement) { if (!portalElement) { return getDocument(element).createElement("div"); } if (typeof portalElement === "function") { return portalElement(element); } return portalElement; } function getRandomId(prefix = "id") { return `${prefix ? `${prefix}-` : ""}${Math.random().toString(36).slice(2, 8)}`; } function queueFocus(element) { queueMicrotask(() => { element == null ? void 0 : element.focus(); }); } var usePortal = createHook(function usePortal2(_a) { var _b = _a, { preserveTabOrder, preserveTabOrderAnchor, portalElement, portalRef, portal = true } = _b, props = __objRest(_b, [ "preserveTabOrder", "preserveTabOrderAnchor", "portalElement", "portalRef", "portal" ]); const ref = (0,external_React_.useRef)(null); const refProp = useMergeRefs(ref, props.ref); const context = (0,external_React_.useContext)(PortalContext); const [portalNode, setPortalNode] = (0,external_React_.useState)(null); const [anchorPortalNode, setAnchorPortalNode] = (0,external_React_.useState)( null ); const outerBeforeRef = (0,external_React_.useRef)(null); const innerBeforeRef = (0,external_React_.useRef)(null); const innerAfterRef = (0,external_React_.useRef)(null); const outerAfterRef = (0,external_React_.useRef)(null); useSafeLayoutEffect(() => { const element = ref.current; if (!element || !portal) { setPortalNode(null); return; } const portalEl = getPortalElement(element, portalElement); if (!portalEl) { setPortalNode(null); return; } const isPortalInDocument = portalEl.isConnected; if (!isPortalInDocument) { const rootElement = context || getRootElement(element); rootElement.appendChild(portalEl); } if (!portalEl.id) { portalEl.id = element.id ? `portal/${element.id}` : getRandomId(); } setPortalNode(portalEl); setRef(portalRef, portalEl); if (isPortalInDocument) return; return () => { portalEl.remove(); setRef(portalRef, null); }; }, [portal, portalElement, context, portalRef]); useSafeLayoutEffect(() => { if (!portal) return; if (!preserveTabOrder) return; if (!preserveTabOrderAnchor) return; const doc = getDocument(preserveTabOrderAnchor); const element = doc.createElement("span"); element.style.position = "fixed"; preserveTabOrderAnchor.insertAdjacentElement("afterend", element); setAnchorPortalNode(element); return () => { element.remove(); setAnchorPortalNode(null); }; }, [portal, preserveTabOrder, preserveTabOrderAnchor]); (0,external_React_.useEffect)(() => { if (!portalNode) return; if (!preserveTabOrder) return; let raf = 0; const onFocus = (event) => { if (!isFocusEventOutside(event)) return; const focusing = event.type === "focusin"; cancelAnimationFrame(raf); if (focusing) { return restoreFocusIn(portalNode); } raf = requestAnimationFrame(() => { disableFocusIn(portalNode, true); }); }; portalNode.addEventListener("focusin", onFocus, true); portalNode.addEventListener("focusout", onFocus, true); return () => { cancelAnimationFrame(raf); portalNode.removeEventListener("focusin", onFocus, true); portalNode.removeEventListener("focusout", onFocus, true); }; }, [portalNode, preserveTabOrder]); props = useWrapElement( props, (element) => { element = // While the portal node is not in the DOM, we need to pass the // current context to the portal context, otherwise it's going to // reset to the body element on nested portals. /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PortalContext.Provider, { value: portalNode || context, children: element }); if (!portal) return element; if (!portalNode) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { ref: refProp, id: props.id, style: { position: "fixed" }, hidden: true } ); } element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ preserveTabOrder && portalNode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FocusTrap, { ref: innerBeforeRef, "data-focus-trap": props.id, className: "__focus-trap-inner-before", onFocus: (event) => { if (isFocusEventOutside(event, portalNode)) { queueFocus(getNextTabbable()); } else { queueFocus(outerBeforeRef.current); } } } ), element, preserveTabOrder && portalNode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FocusTrap, { ref: innerAfterRef, "data-focus-trap": props.id, className: "__focus-trap-inner-after", onFocus: (event) => { if (isFocusEventOutside(event, portalNode)) { queueFocus(getPreviousTabbable()); } else { queueFocus(outerAfterRef.current); } } } ) ] }); if (portalNode) { element = (0,external_ReactDOM_namespaceObject.createPortal)(element, portalNode); } let preserveTabOrderElement = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ preserveTabOrder && portalNode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FocusTrap, { ref: outerBeforeRef, "data-focus-trap": props.id, className: "__focus-trap-outer-before", onFocus: (event) => { const fromOuter = event.relatedTarget === outerAfterRef.current; if (!fromOuter && isFocusEventOutside(event, portalNode)) { queueFocus(innerBeforeRef.current); } else { queueFocus(getPreviousTabbable()); } } } ), preserveTabOrder && // We're using position: fixed here so that the browser doesn't // add margin to the element when setting gap on a parent element. /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-owns": portalNode == null ? void 0 : portalNode.id, style: { position: "fixed" } }), preserveTabOrder && portalNode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FocusTrap, { ref: outerAfterRef, "data-focus-trap": props.id, className: "__focus-trap-outer-after", onFocus: (event) => { if (isFocusEventOutside(event, portalNode)) { queueFocus(innerAfterRef.current); } else { const nextTabbable = getNextTabbable(); if (nextTabbable === innerBeforeRef.current) { requestAnimationFrame(() => { var _a2; return (_a2 = getNextTabbable()) == null ? void 0 : _a2.focus(); }); return; } queueFocus(nextTabbable); } } } ) ] }); if (anchorPortalNode && preserveTabOrder) { preserveTabOrderElement = (0,external_ReactDOM_namespaceObject.createPortal)( preserveTabOrderElement, anchorPortalNode ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ preserveTabOrderElement, element ] }); }, [portalNode, context, portal, props.id, preserveTabOrder, anchorPortalNode] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: refProp }); return props; }); var Portal = forwardRef2(function Portal2(props) { const htmlProps = usePortal(props); return LMDWO4NN_createElement(O37CNYMR_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/JC64G2H7.js "use client"; // src/dialog/dialog.tsx var JC64G2H7_TagName = "div"; var JC64G2H7_isSafariBrowser = isSafari(); function isAlreadyFocusingAnotherElement(dialog) { const activeElement = getActiveElement(); if (!activeElement) return false; if (dialog && contains(dialog, activeElement)) return false; if (isFocusable(activeElement)) return true; return false; } function getElementFromProp(prop, focusable = false) { if (!prop) return null; const element = "current" in prop ? prop.current : prop; if (!element) return null; if (focusable) return isFocusable(element) ? element : null; return element; } var useDialog = createHook(function useDialog2(_a) { var _b = _a, { store: storeProp, open: openProp, onClose, focusable = true, modal = true, portal = !!modal, backdrop = !!modal, hideOnEscape = true, hideOnInteractOutside = true, getPersistentElements, preventBodyScroll = !!modal, autoFocusOnShow = true, autoFocusOnHide = true, initialFocus, finalFocus, unmountOnHide, unstable_treeSnapshotKey } = _b, props = __objRest(_b, [ "store", "open", "onClose", "focusable", "modal", "portal", "backdrop", "hideOnEscape", "hideOnInteractOutside", "getPersistentElements", "preventBodyScroll", "autoFocusOnShow", "autoFocusOnHide", "initialFocus", "finalFocus", "unmountOnHide", "unstable_treeSnapshotKey" ]); const context = useDialogProviderContext(); const ref = (0,external_React_.useRef)(null); const store = useDialogStore({ store: storeProp || context, open: openProp, setOpen(open2) { if (open2) return; const dialog = ref.current; if (!dialog) return; const event = new Event("close", { bubbles: false, cancelable: true }); if (onClose) { dialog.addEventListener("close", onClose, { once: true }); } dialog.dispatchEvent(event); if (!event.defaultPrevented) return; store.setOpen(true); } }); const { portalRef, domReady } = usePortalRef(portal, props.portalRef); const preserveTabOrderProp = props.preserveTabOrder; const preserveTabOrder = useStoreState( store, (state) => preserveTabOrderProp && !modal && state.mounted ); const id = useId(props.id); const open = useStoreState(store, "open"); const mounted = useStoreState(store, "mounted"); const contentElement = useStoreState(store, "contentElement"); const hidden = isHidden(mounted, props.hidden, props.alwaysVisible); usePreventBodyScroll(contentElement, id, preventBodyScroll && !hidden); useHideOnInteractOutside(store, hideOnInteractOutside, domReady); const { wrapElement, nestedDialogs } = useNestedDialogs(store); props = useWrapElement(props, wrapElement, [wrapElement]); useSafeLayoutEffect(() => { if (!open) return; const dialog = ref.current; const activeElement = getActiveElement(dialog, true); if (!activeElement) return; if (activeElement.tagName === "BODY") return; if (dialog && contains(dialog, activeElement)) return; store.setDisclosureElement(activeElement); }, [store, open]); if (JC64G2H7_isSafariBrowser) { (0,external_React_.useEffect)(() => { if (!mounted) return; const { disclosureElement } = store.getState(); if (!disclosureElement) return; if (!isButton(disclosureElement)) return; const onMouseDown = () => { let receivedFocus = false; const onFocus = () => { receivedFocus = true; }; const options = { capture: true, once: true }; disclosureElement.addEventListener("focusin", onFocus, options); queueBeforeEvent(disclosureElement, "mouseup", () => { disclosureElement.removeEventListener("focusin", onFocus, true); if (receivedFocus) return; focusIfNeeded(disclosureElement); }); }; disclosureElement.addEventListener("mousedown", onMouseDown); return () => { disclosureElement.removeEventListener("mousedown", onMouseDown); }; }, [store, mounted]); } (0,external_React_.useEffect)(() => { if (!mounted) return; if (!domReady) return; const dialog = ref.current; if (!dialog) return; const win = getWindow(dialog); const viewport = win.visualViewport || win; const setViewportHeight = () => { var _a2, _b2; const height = (_b2 = (_a2 = win.visualViewport) == null ? void 0 : _a2.height) != null ? _b2 : win.innerHeight; dialog.style.setProperty("--dialog-viewport-height", `${height}px`); }; setViewportHeight(); viewport.addEventListener("resize", setViewportHeight); return () => { viewport.removeEventListener("resize", setViewportHeight); }; }, [mounted, domReady]); (0,external_React_.useEffect)(() => { if (!modal) return; if (!mounted) return; if (!domReady) return; const dialog = ref.current; if (!dialog) return; const existingDismiss = dialog.querySelector("[data-dialog-dismiss]"); if (existingDismiss) return; return prependHiddenDismiss(dialog, store.hide); }, [store, modal, mounted, domReady]); useSafeLayoutEffect(() => { if (!supportsInert()) return; if (open) return; if (!mounted) return; if (!domReady) return; const dialog = ref.current; if (!dialog) return; return disableTree(dialog); }, [open, mounted, domReady]); const canTakeTreeSnapshot = open && domReady; useSafeLayoutEffect(() => { if (!id) return; if (!canTakeTreeSnapshot) return; const dialog = ref.current; return createWalkTreeSnapshot(id, [dialog]); }, [id, canTakeTreeSnapshot, unstable_treeSnapshotKey]); const getPersistentElementsProp = useEvent(getPersistentElements); useSafeLayoutEffect(() => { if (!id) return; if (!canTakeTreeSnapshot) return; const { disclosureElement } = store.getState(); const dialog = ref.current; const persistentElements = getPersistentElementsProp() || []; const allElements = [ dialog, ...persistentElements, ...nestedDialogs.map((dialog2) => dialog2.getState().contentElement) ]; if (modal) { return chain( markTreeOutside(id, allElements), disableTreeOutside(id, allElements) ); } return markTreeOutside(id, [disclosureElement, ...allElements]); }, [ id, store, canTakeTreeSnapshot, getPersistentElementsProp, nestedDialogs, modal, unstable_treeSnapshotKey ]); const mayAutoFocusOnShow = !!autoFocusOnShow; const autoFocusOnShowProp = useBooleanEvent(autoFocusOnShow); const [autoFocusEnabled, setAutoFocusEnabled] = (0,external_React_.useState)(false); (0,external_React_.useEffect)(() => { if (!open) return; if (!mayAutoFocusOnShow) return; if (!domReady) return; if (!(contentElement == null ? void 0 : contentElement.isConnected)) return; const element = getElementFromProp(initialFocus, true) || // If no initial focus is specified, we try to focus the first element // with the autofocus attribute. If it's an Ariakit component, the // Focusable component will consume the autoFocus prop and add the // data-autofocus attribute to the element instead. contentElement.querySelector( "[data-autofocus=true],[autofocus]" ) || // We have to fallback to the first focusable element otherwise portaled // dialogs with preserveTabOrder set to true will not receive focus // properly because the elements aren't tabbable until the dialog receives // focus. getFirstTabbableIn(contentElement, true, portal && preserveTabOrder) || // Finally, we fallback to the dialog element itself. contentElement; const isElementFocusable = isFocusable(element); if (!autoFocusOnShowProp(isElementFocusable ? element : null)) return; setAutoFocusEnabled(true); queueMicrotask(() => { element.focus(); if (!JC64G2H7_isSafariBrowser) return; element.scrollIntoView({ block: "nearest", inline: "nearest" }); }); }, [ open, mayAutoFocusOnShow, domReady, contentElement, initialFocus, portal, preserveTabOrder, autoFocusOnShowProp ]); const mayAutoFocusOnHide = !!autoFocusOnHide; const autoFocusOnHideProp = useBooleanEvent(autoFocusOnHide); const [hasOpened, setHasOpened] = (0,external_React_.useState)(false); (0,external_React_.useEffect)(() => { if (!open) return; setHasOpened(true); return () => setHasOpened(false); }, [open]); const focusOnHide = (0,external_React_.useCallback)( (dialog, retry = true) => { const { disclosureElement } = store.getState(); if (isAlreadyFocusingAnotherElement(dialog)) return; let element = getElementFromProp(finalFocus) || disclosureElement; if (element == null ? void 0 : element.id) { const doc = getDocument(element); const selector = `[aria-activedescendant="${element.id}"]`; const composite = doc.querySelector(selector); if (composite) { element = composite; } } if (element && !isFocusable(element)) { const maybeParentDialog = element.closest("[data-dialog]"); if (maybeParentDialog == null ? void 0 : maybeParentDialog.id) { const doc = getDocument(maybeParentDialog); const selector = `[aria-controls~="${maybeParentDialog.id}"]`; const control = doc.querySelector(selector); if (control) { element = control; } } } const isElementFocusable = element && isFocusable(element); if (!isElementFocusable && retry) { requestAnimationFrame(() => focusOnHide(dialog, false)); return; } if (!autoFocusOnHideProp(isElementFocusable ? element : null)) return; if (!isElementFocusable) return; element == null ? void 0 : element.focus(); }, [store, finalFocus, autoFocusOnHideProp] ); const focusedOnHideRef = (0,external_React_.useRef)(false); useSafeLayoutEffect(() => { if (open) return; if (!hasOpened) return; if (!mayAutoFocusOnHide) return; const dialog = ref.current; focusedOnHideRef.current = true; focusOnHide(dialog); }, [open, hasOpened, domReady, mayAutoFocusOnHide, focusOnHide]); (0,external_React_.useEffect)(() => { if (!hasOpened) return; if (!mayAutoFocusOnHide) return; const dialog = ref.current; return () => { if (focusedOnHideRef.current) { focusedOnHideRef.current = false; return; } focusOnHide(dialog); }; }, [hasOpened, mayAutoFocusOnHide, focusOnHide]); const hideOnEscapeProp = useBooleanEvent(hideOnEscape); (0,external_React_.useEffect)(() => { if (!domReady) return; if (!mounted) return; const onKeyDown = (event) => { if (event.key !== "Escape") return; if (event.defaultPrevented) return; const dialog = ref.current; if (!dialog) return; if (isElementMarked(dialog)) return; const target = event.target; if (!target) return; const { disclosureElement } = store.getState(); const isValidTarget = () => { if (target.tagName === "BODY") return true; if (contains(dialog, target)) return true; if (!disclosureElement) return true; if (contains(disclosureElement, target)) return true; return false; }; if (!isValidTarget()) return; if (!hideOnEscapeProp(event)) return; store.hide(); }; return addGlobalEventListener("keydown", onKeyDown, true); }, [store, domReady, mounted, hideOnEscapeProp]); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevel, { level: modal ? 1 : void 0, children: element }), [modal] ); const hiddenProp = props.hidden; const alwaysVisible = props.alwaysVisible; props = useWrapElement( props, (element) => { if (!backdrop) return element; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DialogBackdrop, { store, backdrop, hidden: hiddenProp, alwaysVisible } ), element ] }); }, [store, backdrop, hiddenProp, alwaysVisible] ); const [headingId, setHeadingId] = (0,external_React_.useState)(); const [descriptionId, setDescriptionId] = (0,external_React_.useState)(); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogHeadingContext.Provider, { value: setHeadingId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogDescriptionContext.Provider, { value: setDescriptionId, children: element }) }) }), [store] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, "data-dialog": "", role: "dialog", tabIndex: focusable ? -1 : void 0, "aria-labelledby": headingId, "aria-describedby": descriptionId }, props), { ref: useMergeRefs(ref, props.ref) }); props = useFocusableContainer(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { autoFocusOnShow: autoFocusEnabled })); props = useDisclosureContent(_3YLGPPWQ_spreadValues({ store }, props)); props = useFocusable(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { focusable })); props = usePortal(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ portal }, props), { portalRef, preserveTabOrder })); return props; }); function createDialogComponent(Component, useProviderContext = useDialogProviderContext) { return forwardRef2(function DialogComponent(props) { const context = useProviderContext(); const store = props.store || context; const mounted = useStoreState( store, (state) => !props.unmountOnHide || (state == null ? void 0 : state.mounted) || !!props.open ); if (!mounted) return null; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, _3YLGPPWQ_spreadValues({}, props)); }); } var Dialog = createDialogComponent( forwardRef2(function Dialog2(props) { const htmlProps = useDialog(props); return LMDWO4NN_createElement(JC64G2H7_TagName, htmlProps); }), useDialogProviderContext ); ;// ./node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs const floating_ui_utils_sides = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left'])); const alignments = (/* unused pure expression or super */ null && (['start', 'end'])); const floating_ui_utils_placements = /*#__PURE__*/(/* unused pure expression or super */ null && (floating_ui_utils_sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []))); const floating_ui_utils_min = Math.min; const floating_ui_utils_max = Math.max; const round = Math.round; const floor = Math.floor; const createCoords = v => ({ x: v, y: v }); const oppositeSideMap = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; const oppositeAlignmentMap = { start: 'end', end: 'start' }; function clamp(start, value, end) { return floating_ui_utils_max(start, floating_ui_utils_min(value, end)); } function floating_ui_utils_evaluate(value, param) { return typeof value === 'function' ? value(param) : value; } function floating_ui_utils_getSide(placement) { return placement.split('-')[0]; } function floating_ui_utils_getAlignment(placement) { return placement.split('-')[1]; } function getOppositeAxis(axis) { return axis === 'x' ? 'y' : 'x'; } function getAxisLength(axis) { return axis === 'y' ? 'height' : 'width'; } function floating_ui_utils_getSideAxis(placement) { return ['top', 'bottom'].includes(floating_ui_utils_getSide(placement)) ? 'y' : 'x'; } function getAlignmentAxis(placement) { return getOppositeAxis(floating_ui_utils_getSideAxis(placement)); } function floating_ui_utils_getAlignmentSides(placement, rects, rtl) { if (rtl === void 0) { rtl = false; } const alignment = floating_ui_utils_getAlignment(placement); const alignmentAxis = getAlignmentAxis(placement); const length = getAxisLength(alignmentAxis); let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top'; if (rects.reference[length] > rects.floating[length]) { mainAlignmentSide = getOppositePlacement(mainAlignmentSide); } return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; } function getExpandedPlacements(placement) { const oppositePlacement = getOppositePlacement(placement); return [floating_ui_utils_getOppositeAlignmentPlacement(placement), oppositePlacement, floating_ui_utils_getOppositeAlignmentPlacement(oppositePlacement)]; } function floating_ui_utils_getOppositeAlignmentPlacement(placement) { return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]); } function getSideList(side, isStart, rtl) { const lr = ['left', 'right']; const rl = ['right', 'left']; const tb = ['top', 'bottom']; const bt = ['bottom', 'top']; switch (side) { case 'top': case 'bottom': if (rtl) return isStart ? rl : lr; return isStart ? lr : rl; case 'left': case 'right': return isStart ? tb : bt; default: return []; } } function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { const alignment = floating_ui_utils_getAlignment(placement); let list = getSideList(floating_ui_utils_getSide(placement), direction === 'start', rtl); if (alignment) { list = list.map(side => side + "-" + alignment); if (flipAlignment) { list = list.concat(list.map(floating_ui_utils_getOppositeAlignmentPlacement)); } } return list; } function getOppositePlacement(placement) { return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]); } function expandPaddingObject(padding) { return { top: 0, right: 0, bottom: 0, left: 0, ...padding }; } function floating_ui_utils_getPaddingObject(padding) { return typeof padding !== 'number' ? expandPaddingObject(padding) : { top: padding, right: padding, bottom: padding, left: padding }; } function floating_ui_utils_rectToClientRect(rect) { return { ...rect, top: rect.y, left: rect.x, right: rect.x + rect.width, bottom: rect.y + rect.height }; } ;// ./node_modules/@floating-ui/core/dist/floating-ui.core.mjs function computeCoordsFromPlacement(_ref, placement, rtl) { let { reference, floating } = _ref; const sideAxis = floating_ui_utils_getSideAxis(placement); const alignmentAxis = getAlignmentAxis(placement); const alignLength = getAxisLength(alignmentAxis); const side = floating_ui_utils_getSide(placement); const isVertical = sideAxis === 'y'; const commonX = reference.x + reference.width / 2 - floating.width / 2; const commonY = reference.y + reference.height / 2 - floating.height / 2; const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; let coords; switch (side) { case 'top': coords = { x: commonX, y: reference.y - floating.height }; break; case 'bottom': coords = { x: commonX, y: reference.y + reference.height }; break; case 'right': coords = { x: reference.x + reference.width, y: commonY }; break; case 'left': coords = { x: reference.x - floating.width, y: commonY }; break; default: coords = { x: reference.x, y: reference.y }; } switch (floating_ui_utils_getAlignment(placement)) { case 'start': coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); break; case 'end': coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); break; } return coords; } /** * Computes the `x` and `y` coordinates that will place the floating element * next to a reference element when it is given a certain positioning strategy. * * This export does not have any `platform` interface logic. You will need to * write one for the platform you are using Floating UI with. */ const computePosition = async (reference, floating, config) => { const { placement = 'bottom', strategy = 'absolute', middleware = [], platform } = config; const validMiddleware = middleware.filter(Boolean); const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating)); let rects = await platform.getElementRects({ reference, floating, strategy }); let { x, y } = computeCoordsFromPlacement(rects, placement, rtl); let statefulPlacement = placement; let middlewareData = {}; let resetCount = 0; for (let i = 0; i < validMiddleware.length; i++) { const { name, fn } = validMiddleware[i]; const { x: nextX, y: nextY, data, reset } = await fn({ x, y, initialPlacement: placement, placement: statefulPlacement, strategy, middlewareData, rects, platform, elements: { reference, floating } }); x = nextX != null ? nextX : x; y = nextY != null ? nextY : y; middlewareData = { ...middlewareData, [name]: { ...middlewareData[name], ...data } }; if (reset && resetCount <= 50) { resetCount++; if (typeof reset === 'object') { if (reset.placement) { statefulPlacement = reset.placement; } if (reset.rects) { rects = reset.rects === true ? await platform.getElementRects({ reference, floating, strategy }) : reset.rects; } ({ x, y } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); } i = -1; continue; } } return { x, y, placement: statefulPlacement, strategy, middlewareData }; }; /** * Resolves with an object of overflow side offsets that determine how much the * element is overflowing a given clipping boundary on each side. * - positive = overflowing the boundary by that number of pixels * - negative = how many pixels left before it will overflow * - 0 = lies flush with the boundary * @see https://floating-ui.com/docs/detectOverflow */ async function detectOverflow(state, options) { var _await$platform$isEle; if (options === void 0) { options = {}; } const { x, y, platform, rects, elements, strategy } = state; const { boundary = 'clippingAncestors', rootBoundary = 'viewport', elementContext = 'floating', altBoundary = false, padding = 0 } = floating_ui_utils_evaluate(options, state); const paddingObject = floating_ui_utils_getPaddingObject(padding); const altContext = elementContext === 'floating' ? 'reference' : 'floating'; const element = elements[altBoundary ? altContext : elementContext]; const clippingClientRect = floating_ui_utils_rectToClientRect(await platform.getClippingRect({ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))), boundary, rootBoundary, strategy })); const rect = elementContext === 'floating' ? { ...rects.floating, x, y } : rects.reference; const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)); const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || { x: 1, y: 1 } : { x: 1, y: 1 }; const elementClientRect = floating_ui_utils_rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({ rect, offsetParent, strategy }) : rect); return { top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x }; } /** * Provides data to position an inner element of the floating element so that it * appears centered to the reference element. * @see https://floating-ui.com/docs/arrow */ const arrow = options => ({ name: 'arrow', options, async fn(state) { const { x, y, placement, rects, platform, elements, middlewareData } = state; // Since `element` is required, we don't Partial<> the type. const { element, padding = 0 } = floating_ui_utils_evaluate(options, state) || {}; if (element == null) { return {}; } const paddingObject = floating_ui_utils_getPaddingObject(padding); const coords = { x, y }; const axis = getAlignmentAxis(placement); const length = getAxisLength(axis); const arrowDimensions = await platform.getDimensions(element); const isYAxis = axis === 'y'; const minProp = isYAxis ? 'top' : 'left'; const maxProp = isYAxis ? 'bottom' : 'right'; const clientProp = isYAxis ? 'clientHeight' : 'clientWidth'; const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; const startDiff = coords[axis] - rects.reference[axis]; const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element)); let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; // DOM platform can return `window` as the `offsetParent`. if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) { clientSize = elements.floating[clientProp] || rects.floating[length]; } const centerToReference = endDiff / 2 - startDiff / 2; // If the padding is large enough that it causes the arrow to no longer be // centered, modify the padding so that it is centered. const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; const minPadding = floating_ui_utils_min(paddingObject[minProp], largestPossiblePadding); const maxPadding = floating_ui_utils_min(paddingObject[maxProp], largestPossiblePadding); // Make sure the arrow doesn't overflow the floating element if the center // point is outside the floating element's bounds. const min$1 = minPadding; const max = clientSize - arrowDimensions[length] - maxPadding; const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; const offset = clamp(min$1, center, max); // If the reference is small enough that the arrow's padding causes it to // to point to nothing for an aligned placement, adjust the offset of the // floating element itself. To ensure `shift()` continues to take action, // a single reset is performed when this is true. const shouldAddOffset = !middlewareData.arrow && floating_ui_utils_getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0; return { [axis]: coords[axis] + alignmentOffset, data: { [axis]: offset, centerOffset: center - offset - alignmentOffset, ...(shouldAddOffset && { alignmentOffset }) }, reset: shouldAddOffset }; } }); function getPlacementList(alignment, autoAlignment, allowedPlacements) { const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement); return allowedPlacementsSortedByAlignment.filter(placement => { if (alignment) { return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false); } return true; }); } /** * Optimizes the visibility of the floating element by choosing the placement * that has the most space available automatically, without needing to specify a * preferred placement. Alternative to `flip`. * @see https://floating-ui.com/docs/autoPlacement */ const autoPlacement = function (options) { if (options === void 0) { options = {}; } return { name: 'autoPlacement', options, async fn(state) { var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE; const { rects, middlewareData, placement, platform, elements } = state; const { crossAxis = false, alignment, allowedPlacements = placements, autoAlignment = true, ...detectOverflowOptions } = evaluate(options, state); const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements; const overflow = await detectOverflow(state, detectOverflowOptions); const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0; const currentPlacement = placements$1[currentIndex]; if (currentPlacement == null) { return {}; } const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); // Make `computeCoords` start from the right place. if (placement !== currentPlacement) { return { reset: { placement: placements$1[0] } }; } const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]]; const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), { placement: currentPlacement, overflows: currentOverflows }]; const nextPlacement = placements$1[currentIndex + 1]; // There are more placements to check. if (nextPlacement) { return { data: { index: currentIndex + 1, overflows: allOverflows }, reset: { placement: nextPlacement } }; } const placementsSortedByMostSpace = allOverflows.map(d => { const alignment = getAlignment(d.placement); return [d.placement, alignment && crossAxis ? // Check along the mainAxis and main crossAxis side. d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) : // Check only the mainAxis. d.overflows[0], d.overflows]; }).sort((a, b) => a[1] - b[1]); const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0, // Aligned placements should not check their opposite crossAxis // side. getAlignment(d[0]) ? 2 : 3).every(v => v <= 0)); const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0]; if (resetPlacement !== placement) { return { data: { index: currentIndex + 1, overflows: allOverflows }, reset: { placement: resetPlacement } }; } return {}; } }; }; /** * Optimizes the visibility of the floating element by flipping the `placement` * in order to keep it in view when the preferred placement(s) will overflow the * clipping boundary. Alternative to `autoPlacement`. * @see https://floating-ui.com/docs/flip */ const flip = function (options) { if (options === void 0) { options = {}; } return { name: 'flip', options, async fn(state) { var _middlewareData$arrow, _middlewareData$flip; const { placement, middlewareData, rects, initialPlacement, platform, elements } = state; const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = 'bestFit', fallbackAxisSideDirection = 'none', flipAlignment = true, ...detectOverflowOptions } = floating_ui_utils_evaluate(options, state); // If a reset by the arrow was caused due to an alignment offset being // added, we should skip any logic now since `flip()` has already done its // work. // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { return {}; } const side = floating_ui_utils_getSide(placement); const isBasePlacement = floating_ui_utils_getSide(initialPlacement) === initialPlacement; const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') { fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); } const placements = [initialPlacement, ...fallbackPlacements]; const overflow = await detectOverflow(state, detectOverflowOptions); const overflows = []; let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; if (checkMainAxis) { overflows.push(overflow[side]); } if (checkCrossAxis) { const sides = floating_ui_utils_getAlignmentSides(placement, rects, rtl); overflows.push(overflow[sides[0]], overflow[sides[1]]); } overflowsData = [...overflowsData, { placement, overflows }]; // One or more sides is overflowing. if (!overflows.every(side => side <= 0)) { var _middlewareData$flip2, _overflowsData$filter; const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; const nextPlacement = placements[nextIndex]; if (nextPlacement) { // Try next placement and re-run the lifecycle. return { data: { index: nextIndex, overflows: overflowsData }, reset: { placement: nextPlacement } }; } // First, find the candidates that fit on the mainAxis side of overflow, // then find the placement that fits the best on the main crossAxis side. let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; // Otherwise fallback. if (!resetPlacement) { switch (fallbackStrategy) { case 'bestFit': { var _overflowsData$map$so; const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0]; if (placement) { resetPlacement = placement; } break; } case 'initialPlacement': resetPlacement = initialPlacement; break; } } if (placement !== resetPlacement) { return { reset: { placement: resetPlacement } }; } } return {}; } }; }; function getSideOffsets(overflow, rect) { return { top: overflow.top - rect.height, right: overflow.right - rect.width, bottom: overflow.bottom - rect.height, left: overflow.left - rect.width }; } function isAnySideFullyClipped(overflow) { return sides.some(side => overflow[side] >= 0); } /** * Provides data to hide the floating element in applicable situations, such as * when it is not in the same clipping context as the reference element. * @see https://floating-ui.com/docs/hide */ const hide = function (options) { if (options === void 0) { options = {}; } return { name: 'hide', options, async fn(state) { const { rects } = state; const { strategy = 'referenceHidden', ...detectOverflowOptions } = evaluate(options, state); switch (strategy) { case 'referenceHidden': { const overflow = await detectOverflow(state, { ...detectOverflowOptions, elementContext: 'reference' }); const offsets = getSideOffsets(overflow, rects.reference); return { data: { referenceHiddenOffsets: offsets, referenceHidden: isAnySideFullyClipped(offsets) } }; } case 'escaped': { const overflow = await detectOverflow(state, { ...detectOverflowOptions, altBoundary: true }); const offsets = getSideOffsets(overflow, rects.floating); return { data: { escapedOffsets: offsets, escaped: isAnySideFullyClipped(offsets) } }; } default: { return {}; } } } }; }; function getBoundingRect(rects) { const minX = min(...rects.map(rect => rect.left)); const minY = min(...rects.map(rect => rect.top)); const maxX = max(...rects.map(rect => rect.right)); const maxY = max(...rects.map(rect => rect.bottom)); return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } function getRectsByLine(rects) { const sortedRects = rects.slice().sort((a, b) => a.y - b.y); const groups = []; let prevRect = null; for (let i = 0; i < sortedRects.length; i++) { const rect = sortedRects[i]; if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) { groups.push([rect]); } else { groups[groups.length - 1].push(rect); } prevRect = rect; } return groups.map(rect => rectToClientRect(getBoundingRect(rect))); } /** * Provides improved positioning for inline reference elements that can span * over multiple lines, such as hyperlinks or range selections. * @see https://floating-ui.com/docs/inline */ const inline = function (options) { if (options === void 0) { options = {}; } return { name: 'inline', options, async fn(state) { const { placement, elements, rects, platform, strategy } = state; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a // ClientRect's bounds, despite the event listener being triggered. A // padding of 2 seems to handle this issue. const { padding = 2, x, y } = evaluate(options, state); const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []); const clientRects = getRectsByLine(nativeClientRects); const fallback = rectToClientRect(getBoundingRect(nativeClientRects)); const paddingObject = getPaddingObject(padding); function getBoundingClientRect() { // There are two rects and they are disjoined. if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) { // Find the first rect in which the point is fully inside. return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback; } // There are 2 or more connected rects. if (clientRects.length >= 2) { if (getSideAxis(placement) === 'y') { const firstRect = clientRects[0]; const lastRect = clientRects[clientRects.length - 1]; const isTop = getSide(placement) === 'top'; const top = firstRect.top; const bottom = lastRect.bottom; const left = isTop ? firstRect.left : lastRect.left; const right = isTop ? firstRect.right : lastRect.right; const width = right - left; const height = bottom - top; return { top, bottom, left, right, width, height, x: left, y: top }; } const isLeftSide = getSide(placement) === 'left'; const maxRight = max(...clientRects.map(rect => rect.right)); const minLeft = min(...clientRects.map(rect => rect.left)); const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight); const top = measureRects[0].top; const bottom = measureRects[measureRects.length - 1].bottom; const left = minLeft; const right = maxRight; const width = right - left; const height = bottom - top; return { top, bottom, left, right, width, height, x: left, y: top }; } return fallback; } const resetRects = await platform.getElementRects({ reference: { getBoundingClientRect }, floating: elements.floating, strategy }); if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) { return { reset: { rects: resetRects } }; } return {}; } }; }; // For type backwards-compatibility, the `OffsetOptions` type was also // Derivable. async function convertValueToCoords(state, options) { const { placement, platform, elements } = state; const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); const side = floating_ui_utils_getSide(placement); const alignment = floating_ui_utils_getAlignment(placement); const isVertical = floating_ui_utils_getSideAxis(placement) === 'y'; const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1; const crossAxisMulti = rtl && isVertical ? -1 : 1; const rawValue = floating_ui_utils_evaluate(options, state); // eslint-disable-next-line prefer-const let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === 'number' ? { mainAxis: rawValue, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...rawValue }; if (alignment && typeof alignmentAxis === 'number') { crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis; } return isVertical ? { x: crossAxis * crossAxisMulti, y: mainAxis * mainAxisMulti } : { x: mainAxis * mainAxisMulti, y: crossAxis * crossAxisMulti }; } /** * Modifies the placement by translating the floating element along the * specified axes. * A number (shorthand for `mainAxis` or distance), or an axes configuration * object may be passed. * @see https://floating-ui.com/docs/offset */ const offset = function (options) { if (options === void 0) { options = 0; } return { name: 'offset', options, async fn(state) { const { x, y } = state; const diffCoords = await convertValueToCoords(state, options); return { x: x + diffCoords.x, y: y + diffCoords.y, data: diffCoords }; } }; }; /** * Optimizes the visibility of the floating element by shifting it in order to * keep it in view when it will overflow the clipping boundary. * @see https://floating-ui.com/docs/shift */ const shift = function (options) { if (options === void 0) { options = {}; } return { name: 'shift', options, async fn(state) { const { x, y, placement } = state; const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: _ref => { let { x, y } = _ref; return { x, y }; } }, ...detectOverflowOptions } = floating_ui_utils_evaluate(options, state); const coords = { x, y }; const overflow = await detectOverflow(state, detectOverflowOptions); const crossAxis = floating_ui_utils_getSideAxis(floating_ui_utils_getSide(placement)); const mainAxis = getOppositeAxis(crossAxis); let mainAxisCoord = coords[mainAxis]; let crossAxisCoord = coords[crossAxis]; if (checkMainAxis) { const minSide = mainAxis === 'y' ? 'top' : 'left'; const maxSide = mainAxis === 'y' ? 'bottom' : 'right'; const min = mainAxisCoord + overflow[minSide]; const max = mainAxisCoord - overflow[maxSide]; mainAxisCoord = clamp(min, mainAxisCoord, max); } if (checkCrossAxis) { const minSide = crossAxis === 'y' ? 'top' : 'left'; const maxSide = crossAxis === 'y' ? 'bottom' : 'right'; const min = crossAxisCoord + overflow[minSide]; const max = crossAxisCoord - overflow[maxSide]; crossAxisCoord = clamp(min, crossAxisCoord, max); } const limitedCoords = limiter.fn({ ...state, [mainAxis]: mainAxisCoord, [crossAxis]: crossAxisCoord }); return { ...limitedCoords, data: { x: limitedCoords.x - x, y: limitedCoords.y - y } }; } }; }; /** * Built-in `limiter` that will stop `shift()` at a certain point. */ const limitShift = function (options) { if (options === void 0) { options = {}; } return { options, fn(state) { const { x, y, placement, rects, middlewareData } = state; const { offset = 0, mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true } = floating_ui_utils_evaluate(options, state); const coords = { x, y }; const crossAxis = floating_ui_utils_getSideAxis(placement); const mainAxis = getOppositeAxis(crossAxis); let mainAxisCoord = coords[mainAxis]; let crossAxisCoord = coords[crossAxis]; const rawOffset = floating_ui_utils_evaluate(offset, state); const computedOffset = typeof rawOffset === 'number' ? { mainAxis: rawOffset, crossAxis: 0 } : { mainAxis: 0, crossAxis: 0, ...rawOffset }; if (checkMainAxis) { const len = mainAxis === 'y' ? 'height' : 'width'; const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; if (mainAxisCoord < limitMin) { mainAxisCoord = limitMin; } else if (mainAxisCoord > limitMax) { mainAxisCoord = limitMax; } } if (checkCrossAxis) { var _middlewareData$offse, _middlewareData$offse2; const len = mainAxis === 'y' ? 'width' : 'height'; const isOriginSide = ['top', 'left'].includes(floating_ui_utils_getSide(placement)); const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); if (crossAxisCoord < limitMin) { crossAxisCoord = limitMin; } else if (crossAxisCoord > limitMax) { crossAxisCoord = limitMax; } } return { [mainAxis]: mainAxisCoord, [crossAxis]: crossAxisCoord }; } }; }; /** * Provides data that allows you to change the size of the floating element — * for instance, prevent it from overflowing the clipping boundary or match the * width of the reference element. * @see https://floating-ui.com/docs/size */ const size = function (options) { if (options === void 0) { options = {}; } return { name: 'size', options, async fn(state) { const { placement, rects, platform, elements } = state; const { apply = () => {}, ...detectOverflowOptions } = floating_ui_utils_evaluate(options, state); const overflow = await detectOverflow(state, detectOverflowOptions); const side = floating_ui_utils_getSide(placement); const alignment = floating_ui_utils_getAlignment(placement); const isYAxis = floating_ui_utils_getSideAxis(placement) === 'y'; const { width, height } = rects.floating; let heightSide; let widthSide; if (side === 'top' || side === 'bottom') { heightSide = side; widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right'; } else { widthSide = side; heightSide = alignment === 'end' ? 'top' : 'bottom'; } const overflowAvailableHeight = height - overflow[heightSide]; const overflowAvailableWidth = width - overflow[widthSide]; const noShift = !state.middlewareData.shift; let availableHeight = overflowAvailableHeight; let availableWidth = overflowAvailableWidth; if (isYAxis) { const maximumClippingWidth = width - overflow.left - overflow.right; availableWidth = alignment || noShift ? floating_ui_utils_min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth; } else { const maximumClippingHeight = height - overflow.top - overflow.bottom; availableHeight = alignment || noShift ? floating_ui_utils_min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight; } if (noShift && !alignment) { const xMin = floating_ui_utils_max(overflow.left, 0); const xMax = floating_ui_utils_max(overflow.right, 0); const yMin = floating_ui_utils_max(overflow.top, 0); const yMax = floating_ui_utils_max(overflow.bottom, 0); if (isYAxis) { availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : floating_ui_utils_max(overflow.left, overflow.right)); } else { availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : floating_ui_utils_max(overflow.top, overflow.bottom)); } } await apply({ ...state, availableWidth, availableHeight }); const nextDimensions = await platform.getDimensions(elements.floating); if (width !== nextDimensions.width || height !== nextDimensions.height) { return { reset: { rects: true } }; } return {}; } }; }; ;// ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs /** * Custom positioning reference element. * @see https://floating-ui.com/docs/virtual-elements */ const dist_floating_ui_utils_sides = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left'])); const floating_ui_utils_alignments = (/* unused pure expression or super */ null && (['start', 'end'])); const dist_floating_ui_utils_placements = /*#__PURE__*/(/* unused pure expression or super */ null && (dist_floating_ui_utils_sides.reduce((acc, side) => acc.concat(side, side + "-" + floating_ui_utils_alignments[0], side + "-" + floating_ui_utils_alignments[1]), []))); const dist_floating_ui_utils_min = Math.min; const dist_floating_ui_utils_max = Math.max; const floating_ui_utils_round = Math.round; const floating_ui_utils_floor = Math.floor; const floating_ui_utils_createCoords = v => ({ x: v, y: v }); const floating_ui_utils_oppositeSideMap = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; const floating_ui_utils_oppositeAlignmentMap = { start: 'end', end: 'start' }; function floating_ui_utils_clamp(start, value, end) { return dist_floating_ui_utils_max(start, dist_floating_ui_utils_min(value, end)); } function dist_floating_ui_utils_evaluate(value, param) { return typeof value === 'function' ? value(param) : value; } function dist_floating_ui_utils_getSide(placement) { return placement.split('-')[0]; } function dist_floating_ui_utils_getAlignment(placement) { return placement.split('-')[1]; } function floating_ui_utils_getOppositeAxis(axis) { return axis === 'x' ? 'y' : 'x'; } function floating_ui_utils_getAxisLength(axis) { return axis === 'y' ? 'height' : 'width'; } function dist_floating_ui_utils_getSideAxis(placement) { return ['top', 'bottom'].includes(dist_floating_ui_utils_getSide(placement)) ? 'y' : 'x'; } function floating_ui_utils_getAlignmentAxis(placement) { return floating_ui_utils_getOppositeAxis(dist_floating_ui_utils_getSideAxis(placement)); } function dist_floating_ui_utils_getAlignmentSides(placement, rects, rtl) { if (rtl === void 0) { rtl = false; } const alignment = dist_floating_ui_utils_getAlignment(placement); const alignmentAxis = floating_ui_utils_getAlignmentAxis(placement); const length = floating_ui_utils_getAxisLength(alignmentAxis); let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top'; if (rects.reference[length] > rects.floating[length]) { mainAlignmentSide = floating_ui_utils_getOppositePlacement(mainAlignmentSide); } return [mainAlignmentSide, floating_ui_utils_getOppositePlacement(mainAlignmentSide)]; } function floating_ui_utils_getExpandedPlacements(placement) { const oppositePlacement = floating_ui_utils_getOppositePlacement(placement); return [dist_floating_ui_utils_getOppositeAlignmentPlacement(placement), oppositePlacement, dist_floating_ui_utils_getOppositeAlignmentPlacement(oppositePlacement)]; } function dist_floating_ui_utils_getOppositeAlignmentPlacement(placement) { return placement.replace(/start|end/g, alignment => floating_ui_utils_oppositeAlignmentMap[alignment]); } function floating_ui_utils_getSideList(side, isStart, rtl) { const lr = ['left', 'right']; const rl = ['right', 'left']; const tb = ['top', 'bottom']; const bt = ['bottom', 'top']; switch (side) { case 'top': case 'bottom': if (rtl) return isStart ? rl : lr; return isStart ? lr : rl; case 'left': case 'right': return isStart ? tb : bt; default: return []; } } function floating_ui_utils_getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { const alignment = dist_floating_ui_utils_getAlignment(placement); let list = floating_ui_utils_getSideList(dist_floating_ui_utils_getSide(placement), direction === 'start', rtl); if (alignment) { list = list.map(side => side + "-" + alignment); if (flipAlignment) { list = list.concat(list.map(dist_floating_ui_utils_getOppositeAlignmentPlacement)); } } return list; } function floating_ui_utils_getOppositePlacement(placement) { return placement.replace(/left|right|bottom|top/g, side => floating_ui_utils_oppositeSideMap[side]); } function floating_ui_utils_expandPaddingObject(padding) { return { top: 0, right: 0, bottom: 0, left: 0, ...padding }; } function dist_floating_ui_utils_getPaddingObject(padding) { return typeof padding !== 'number' ? floating_ui_utils_expandPaddingObject(padding) : { top: padding, right: padding, bottom: padding, left: padding }; } function dist_floating_ui_utils_rectToClientRect(rect) { const { x, y, width, height } = rect; return { width, height, top: y, left: x, right: x + width, bottom: y + height, x, y }; } ;// ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs function hasWindow() { return typeof window !== 'undefined'; } function getNodeName(node) { if (isNode(node)) { return (node.nodeName || '').toLowerCase(); } // Mocked nodes in testing environments may not be instances of Node. By // returning `#document` an infinite loop won't occur. // https://github.com/floating-ui/floating-ui/issues/2317 return '#document'; } function floating_ui_utils_dom_getWindow(node) { var _node$ownerDocument; return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; } function getDocumentElement(node) { var _ref; return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; } function isNode(value) { if (!hasWindow()) { return false; } return value instanceof Node || value instanceof floating_ui_utils_dom_getWindow(value).Node; } function isElement(value) { if (!hasWindow()) { return false; } return value instanceof Element || value instanceof floating_ui_utils_dom_getWindow(value).Element; } function isHTMLElement(value) { if (!hasWindow()) { return false; } return value instanceof HTMLElement || value instanceof floating_ui_utils_dom_getWindow(value).HTMLElement; } function isShadowRoot(value) { if (!hasWindow() || typeof ShadowRoot === 'undefined') { return false; } return value instanceof ShadowRoot || value instanceof floating_ui_utils_dom_getWindow(value).ShadowRoot; } function isOverflowElement(element) { const { overflow, overflowX, overflowY, display } = floating_ui_utils_dom_getComputedStyle(element); return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display); } function isTableElement(element) { return ['table', 'td', 'th'].includes(getNodeName(element)); } function isTopLayer(element) { return [':popover-open', ':modal'].some(selector => { try { return element.matches(selector); } catch (e) { return false; } }); } function isContainingBlock(elementOrCss) { const webkit = isWebKit(); const css = isElement(elementOrCss) ? floating_ui_utils_dom_getComputedStyle(elementOrCss) : elementOrCss; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block // https://drafts.csswg.org/css-transforms-2/#individual-transforms return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value)); } function getContainingBlock(element) { let currentNode = getParentNode(element); while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { if (isContainingBlock(currentNode)) { return currentNode; } else if (isTopLayer(currentNode)) { return null; } currentNode = getParentNode(currentNode); } return null; } function isWebKit() { if (typeof CSS === 'undefined' || !CSS.supports) return false; return CSS.supports('-webkit-backdrop-filter', 'none'); } function isLastTraversableNode(node) { return ['html', 'body', '#document'].includes(getNodeName(node)); } function floating_ui_utils_dom_getComputedStyle(element) { return floating_ui_utils_dom_getWindow(element).getComputedStyle(element); } function getNodeScroll(element) { if (isElement(element)) { return { scrollLeft: element.scrollLeft, scrollTop: element.scrollTop }; } return { scrollLeft: element.scrollX, scrollTop: element.scrollY }; } function getParentNode(node) { if (getNodeName(node) === 'html') { return node; } const result = // Step into the shadow DOM of the parent of a slotted node. node.assignedSlot || // DOM Element detected. node.parentNode || // ShadowRoot detected. isShadowRoot(node) && node.host || // Fallback. getDocumentElement(node); return isShadowRoot(result) ? result.host : result; } function getNearestOverflowAncestor(node) { const parentNode = getParentNode(node); if (isLastTraversableNode(parentNode)) { return node.ownerDocument ? node.ownerDocument.body : node.body; } if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { return parentNode; } return getNearestOverflowAncestor(parentNode); } function getOverflowAncestors(node, list, traverseIframes) { var _node$ownerDocument2; if (list === void 0) { list = []; } if (traverseIframes === void 0) { traverseIframes = true; } const scrollableAncestor = getNearestOverflowAncestor(node); const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); const win = floating_ui_utils_dom_getWindow(scrollableAncestor); if (isBody) { const frameElement = getFrameElement(win); return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); } return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); } function getFrameElement(win) { return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; } ;// ./node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs function getCssDimensions(element) { const css = floating_ui_utils_dom_getComputedStyle(element); // In testing environments, the `width` and `height` properties are empty // strings for SVG elements, returning NaN. Fallback to `0` in this case. let width = parseFloat(css.width) || 0; let height = parseFloat(css.height) || 0; const hasOffset = isHTMLElement(element); const offsetWidth = hasOffset ? element.offsetWidth : width; const offsetHeight = hasOffset ? element.offsetHeight : height; const shouldFallback = floating_ui_utils_round(width) !== offsetWidth || floating_ui_utils_round(height) !== offsetHeight; if (shouldFallback) { width = offsetWidth; height = offsetHeight; } return { width, height, $: shouldFallback }; } function unwrapElement(element) { return !isElement(element) ? element.contextElement : element; } function getScale(element) { const domElement = unwrapElement(element); if (!isHTMLElement(domElement)) { return floating_ui_utils_createCoords(1); } const rect = domElement.getBoundingClientRect(); const { width, height, $ } = getCssDimensions(domElement); let x = ($ ? floating_ui_utils_round(rect.width) : rect.width) / width; let y = ($ ? floating_ui_utils_round(rect.height) : rect.height) / height; // 0, NaN, or Infinity should always fallback to 1. if (!x || !Number.isFinite(x)) { x = 1; } if (!y || !Number.isFinite(y)) { y = 1; } return { x, y }; } const noOffsets = /*#__PURE__*/floating_ui_utils_createCoords(0); function getVisualOffsets(element) { const win = floating_ui_utils_dom_getWindow(element); if (!isWebKit() || !win.visualViewport) { return noOffsets; } return { x: win.visualViewport.offsetLeft, y: win.visualViewport.offsetTop }; } function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { if (isFixed === void 0) { isFixed = false; } if (!floatingOffsetParent || isFixed && floatingOffsetParent !== floating_ui_utils_dom_getWindow(element)) { return false; } return isFixed; } function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { if (includeScale === void 0) { includeScale = false; } if (isFixedStrategy === void 0) { isFixedStrategy = false; } const clientRect = element.getBoundingClientRect(); const domElement = unwrapElement(element); let scale = floating_ui_utils_createCoords(1); if (includeScale) { if (offsetParent) { if (isElement(offsetParent)) { scale = getScale(offsetParent); } } else { scale = getScale(element); } } const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : floating_ui_utils_createCoords(0); let x = (clientRect.left + visualOffsets.x) / scale.x; let y = (clientRect.top + visualOffsets.y) / scale.y; let width = clientRect.width / scale.x; let height = clientRect.height / scale.y; if (domElement) { const win = floating_ui_utils_dom_getWindow(domElement); const offsetWin = offsetParent && isElement(offsetParent) ? floating_ui_utils_dom_getWindow(offsetParent) : offsetParent; let currentWin = win; let currentIFrame = currentWin.frameElement; while (currentIFrame && offsetParent && offsetWin !== currentWin) { const iframeScale = getScale(currentIFrame); const iframeRect = currentIFrame.getBoundingClientRect(); const css = floating_ui_utils_dom_getComputedStyle(currentIFrame); const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; x *= iframeScale.x; y *= iframeScale.y; width *= iframeScale.x; height *= iframeScale.y; x += left; y += top; currentWin = floating_ui_utils_dom_getWindow(currentIFrame); currentIFrame = currentWin.frameElement; } } return floating_ui_utils_rectToClientRect({ width, height, x, y }); } const topLayerSelectors = [':popover-open', ':modal']; function floating_ui_dom_isTopLayer(floating) { return topLayerSelectors.some(selector => { try { return floating.matches(selector); } catch (e) { return false; } }); } function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { let { elements, rect, offsetParent, strategy } = _ref; const isFixed = strategy === 'fixed'; const documentElement = getDocumentElement(offsetParent); const topLayer = elements ? floating_ui_dom_isTopLayer(elements.floating) : false; if (offsetParent === documentElement || topLayer && isFixed) { return rect; } let scroll = { scrollLeft: 0, scrollTop: 0 }; let scale = floating_ui_utils_createCoords(1); const offsets = floating_ui_utils_createCoords(0); const isOffsetParentAnElement = isHTMLElement(offsetParent); if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { scroll = getNodeScroll(offsetParent); } if (isHTMLElement(offsetParent)) { const offsetRect = getBoundingClientRect(offsetParent); scale = getScale(offsetParent); offsets.x = offsetRect.x + offsetParent.clientLeft; offsets.y = offsetRect.y + offsetParent.clientTop; } } return { width: rect.width * scale.x, height: rect.height * scale.y, x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x, y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y }; } function getClientRects(element) { return Array.from(element.getClientRects()); } function getWindowScrollBarX(element) { // If <html> has a CSS width greater than the viewport, then this will be // incorrect for RTL. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft; } // Gets the entire size of the scrollable document area, even extending outside // of the `<html>` and `<body>` rect bounds if horizontally scrollable. function getDocumentRect(element) { const html = getDocumentElement(element); const scroll = getNodeScroll(element); const body = element.ownerDocument.body; const width = dist_floating_ui_utils_max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); const height = dist_floating_ui_utils_max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); let x = -scroll.scrollLeft + getWindowScrollBarX(element); const y = -scroll.scrollTop; if (floating_ui_utils_dom_getComputedStyle(body).direction === 'rtl') { x += dist_floating_ui_utils_max(html.clientWidth, body.clientWidth) - width; } return { width, height, x, y }; } function getViewportRect(element, strategy) { const win = floating_ui_utils_dom_getWindow(element); const html = getDocumentElement(element); const visualViewport = win.visualViewport; let width = html.clientWidth; let height = html.clientHeight; let x = 0; let y = 0; if (visualViewport) { width = visualViewport.width; height = visualViewport.height; const visualViewportBased = isWebKit(); if (!visualViewportBased || visualViewportBased && strategy === 'fixed') { x = visualViewport.offsetLeft; y = visualViewport.offsetTop; } } return { width, height, x, y }; } // Returns the inner client rect, subtracting scrollbars if present. function getInnerBoundingClientRect(element, strategy) { const clientRect = getBoundingClientRect(element, true, strategy === 'fixed'); const top = clientRect.top + element.clientTop; const left = clientRect.left + element.clientLeft; const scale = isHTMLElement(element) ? getScale(element) : floating_ui_utils_createCoords(1); const width = element.clientWidth * scale.x; const height = element.clientHeight * scale.y; const x = left * scale.x; const y = top * scale.y; return { width, height, x, y }; } function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { let rect; if (clippingAncestor === 'viewport') { rect = getViewportRect(element, strategy); } else if (clippingAncestor === 'document') { rect = getDocumentRect(getDocumentElement(element)); } else if (isElement(clippingAncestor)) { rect = getInnerBoundingClientRect(clippingAncestor, strategy); } else { const visualOffsets = getVisualOffsets(element); rect = { ...clippingAncestor, x: clippingAncestor.x - visualOffsets.x, y: clippingAncestor.y - visualOffsets.y }; } return floating_ui_utils_rectToClientRect(rect); } function hasFixedPositionAncestor(element, stopNode) { const parentNode = getParentNode(element); if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { return false; } return floating_ui_utils_dom_getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode); } // A "clipping ancestor" is an `overflow` element with the characteristic of // clipping (or hiding) child elements. This returns all clipping ancestors // of the given element up the tree. function getClippingElementAncestors(element, cache) { const cachedResult = cache.get(element); if (cachedResult) { return cachedResult; } let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body'); let currentContainingBlockComputedStyle = null; const elementIsFixed = floating_ui_utils_dom_getComputedStyle(element).position === 'fixed'; let currentNode = elementIsFixed ? getParentNode(element) : element; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { const computedStyle = floating_ui_utils_dom_getComputedStyle(currentNode); const currentNodeIsContaining = isContainingBlock(currentNode); if (!currentNodeIsContaining && computedStyle.position === 'fixed') { currentContainingBlockComputedStyle = null; } const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); if (shouldDropCurrentNode) { // Drop non-containing blocks. result = result.filter(ancestor => ancestor !== currentNode); } else { // Record last containing block for next iteration. currentContainingBlockComputedStyle = computedStyle; } currentNode = getParentNode(currentNode); } cache.set(element, result); return result; } // Gets the maximum area that the element is visible in due to any number of // clipping ancestors. function getClippingRect(_ref) { let { element, boundary, rootBoundary, strategy } = _ref; const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary); const clippingAncestors = [...elementClippingAncestors, rootBoundary]; const firstClippingAncestor = clippingAncestors[0]; const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); accRect.top = dist_floating_ui_utils_max(rect.top, accRect.top); accRect.right = dist_floating_ui_utils_min(rect.right, accRect.right); accRect.bottom = dist_floating_ui_utils_min(rect.bottom, accRect.bottom); accRect.left = dist_floating_ui_utils_max(rect.left, accRect.left); return accRect; }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); return { width: clippingRect.right - clippingRect.left, height: clippingRect.bottom - clippingRect.top, x: clippingRect.left, y: clippingRect.top }; } function getDimensions(element) { const { width, height } = getCssDimensions(element); return { width, height }; } function getRectRelativeToOffsetParent(element, offsetParent, strategy) { const isOffsetParentAnElement = isHTMLElement(offsetParent); const documentElement = getDocumentElement(offsetParent); const isFixed = strategy === 'fixed'; const rect = getBoundingClientRect(element, true, isFixed, offsetParent); let scroll = { scrollLeft: 0, scrollTop: 0 }; const offsets = floating_ui_utils_createCoords(0); if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { scroll = getNodeScroll(offsetParent); } if (isOffsetParentAnElement) { const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); offsets.x = offsetRect.x + offsetParent.clientLeft; offsets.y = offsetRect.y + offsetParent.clientTop; } else if (documentElement) { offsets.x = getWindowScrollBarX(documentElement); } } const x = rect.left + scroll.scrollLeft - offsets.x; const y = rect.top + scroll.scrollTop - offsets.y; return { x, y, width: rect.width, height: rect.height }; } function getTrueOffsetParent(element, polyfill) { if (!isHTMLElement(element) || floating_ui_utils_dom_getComputedStyle(element).position === 'fixed') { return null; } if (polyfill) { return polyfill(element); } return element.offsetParent; } // Gets the closest ancestor positioned element. Handles some edge cases, // such as table ancestors and cross browser bugs. function getOffsetParent(element, polyfill) { const window = floating_ui_utils_dom_getWindow(element); if (!isHTMLElement(element) || floating_ui_dom_isTopLayer(element)) { return window; } let offsetParent = getTrueOffsetParent(element, polyfill); while (offsetParent && isTableElement(offsetParent) && floating_ui_utils_dom_getComputedStyle(offsetParent).position === 'static') { offsetParent = getTrueOffsetParent(offsetParent, polyfill); } if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && floating_ui_utils_dom_getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) { return window; } return offsetParent || getContainingBlock(element) || window; } const getElementRects = async function (data) { const getOffsetParentFn = this.getOffsetParent || getOffsetParent; const getDimensionsFn = this.getDimensions; return { reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), floating: { x: 0, y: 0, ...(await getDimensionsFn(data.floating)) } }; }; function isRTL(element) { return floating_ui_utils_dom_getComputedStyle(element).direction === 'rtl'; } const platform = { convertOffsetParentRelativeRectToViewportRelativeRect, getDocumentElement: getDocumentElement, getClippingRect, getOffsetParent, getElementRects, getClientRects, getDimensions, getScale, isElement: isElement, isRTL }; // https://samthor.au/2021/observing-dom/ function observeMove(element, onMove) { let io = null; let timeoutId; const root = getDocumentElement(element); function cleanup() { var _io; clearTimeout(timeoutId); (_io = io) == null || _io.disconnect(); io = null; } function refresh(skip, threshold) { if (skip === void 0) { skip = false; } if (threshold === void 0) { threshold = 1; } cleanup(); const { left, top, width, height } = element.getBoundingClientRect(); if (!skip) { onMove(); } if (!width || !height) { return; } const insetTop = floating_ui_utils_floor(top); const insetRight = floating_ui_utils_floor(root.clientWidth - (left + width)); const insetBottom = floating_ui_utils_floor(root.clientHeight - (top + height)); const insetLeft = floating_ui_utils_floor(left); const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; const options = { rootMargin, threshold: dist_floating_ui_utils_max(0, dist_floating_ui_utils_min(1, threshold)) || 1 }; let isFirstUpdate = true; function handleObserve(entries) { const ratio = entries[0].intersectionRatio; if (ratio !== threshold) { if (!isFirstUpdate) { return refresh(); } if (!ratio) { timeoutId = setTimeout(() => { refresh(false, 1e-7); }, 100); } else { refresh(false, ratio); } } isFirstUpdate = false; } // Older browsers don't support a `document` as the root and will throw an // error. try { io = new IntersectionObserver(handleObserve, { ...options, // Handle <iframe>s root: root.ownerDocument }); } catch (e) { io = new IntersectionObserver(handleObserve, options); } io.observe(element); } refresh(true); return cleanup; } /** * Automatically updates the position of the floating element when necessary. * Should only be called when the floating element is mounted on the DOM or * visible on the screen. * @returns cleanup function that should be invoked when the floating element is * removed from the DOM or hidden from the screen. * @see https://floating-ui.com/docs/autoUpdate */ function autoUpdate(reference, floating, update, options) { if (options === void 0) { options = {}; } const { ancestorScroll = true, ancestorResize = true, elementResize = typeof ResizeObserver === 'function', layoutShift = typeof IntersectionObserver === 'function', animationFrame = false } = options; const referenceEl = unwrapElement(reference); const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : []; ancestors.forEach(ancestor => { ancestorScroll && ancestor.addEventListener('scroll', update, { passive: true }); ancestorResize && ancestor.addEventListener('resize', update); }); const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; let reobserveFrame = -1; let resizeObserver = null; if (elementResize) { resizeObserver = new ResizeObserver(_ref => { let [firstEntry] = _ref; if (firstEntry && firstEntry.target === referenceEl && resizeObserver) { // Prevent update loops when using the `size` middleware. // https://github.com/floating-ui/floating-ui/issues/1740 resizeObserver.unobserve(floating); cancelAnimationFrame(reobserveFrame); reobserveFrame = requestAnimationFrame(() => { var _resizeObserver; (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); }); } update(); }); if (referenceEl && !animationFrame) { resizeObserver.observe(referenceEl); } resizeObserver.observe(floating); } let frameId; let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; if (animationFrame) { frameLoop(); } function frameLoop() { const nextRefRect = getBoundingClientRect(reference); if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) { update(); } prevRefRect = nextRefRect; frameId = requestAnimationFrame(frameLoop); } update(); return () => { var _resizeObserver2; ancestors.forEach(ancestor => { ancestorScroll && ancestor.removeEventListener('scroll', update); ancestorResize && ancestor.removeEventListener('resize', update); }); cleanupIo == null || cleanupIo(); (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); resizeObserver = null; if (animationFrame) { cancelAnimationFrame(frameId); } }; } /** * Optimizes the visibility of the floating element by choosing the placement * that has the most space available automatically, without needing to specify a * preferred placement. Alternative to `flip`. * @see https://floating-ui.com/docs/autoPlacement */ const floating_ui_dom_autoPlacement = (/* unused pure expression or super */ null && (autoPlacement$1)); /** * Optimizes the visibility of the floating element by shifting it in order to * keep it in view when it will overflow the clipping boundary. * @see https://floating-ui.com/docs/shift */ const floating_ui_dom_shift = shift; /** * Optimizes the visibility of the floating element by flipping the `placement` * in order to keep it in view when the preferred placement(s) will overflow the * clipping boundary. Alternative to `autoPlacement`. * @see https://floating-ui.com/docs/flip */ const floating_ui_dom_flip = flip; /** * Provides data that allows you to change the size of the floating element — * for instance, prevent it from overflowing the clipping boundary or match the * width of the reference element. * @see https://floating-ui.com/docs/size */ const floating_ui_dom_size = size; /** * Provides data to hide the floating element in applicable situations, such as * when it is not in the same clipping context as the reference element. * @see https://floating-ui.com/docs/hide */ const floating_ui_dom_hide = (/* unused pure expression or super */ null && (hide$1)); /** * Provides data to position an inner element of the floating element so that it * appears centered to the reference element. * @see https://floating-ui.com/docs/arrow */ const floating_ui_dom_arrow = arrow; /** * Provides improved positioning for inline reference elements that can span * over multiple lines, such as hyperlinks or range selections. * @see https://floating-ui.com/docs/inline */ const floating_ui_dom_inline = (/* unused pure expression or super */ null && (inline$1)); /** * Built-in `limiter` that will stop `shift()` at a certain point. */ const floating_ui_dom_limitShift = limitShift; /** * Computes the `x` and `y` coordinates that will place the floating element * next to a given reference element. */ const floating_ui_dom_computePosition = (reference, floating, options) => { // This caches the expensive `getClippingElementAncestors` function so that // multiple lifecycle resets re-use the same result. It only lives for a // single call. If other functions become expensive, we can add them as well. const cache = new Map(); const mergedOptions = { platform, ...options }; const platformWithCache = { ...mergedOptions.platform, _c: cache }; return computePosition(reference, floating, { ...mergedOptions, platform: platformWithCache }); }; ;// ./node_modules/@ariakit/react-core/esm/__chunks/T6C2RYFI.js "use client"; // src/popover/popover.tsx var T6C2RYFI_TagName = "div"; function createDOMRect(x = 0, y = 0, width = 0, height = 0) { if (typeof DOMRect === "function") { return new DOMRect(x, y, width, height); } const rect = { x, y, width, height, top: y, right: x + width, bottom: y + height, left: x }; return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, rect), { toJSON: () => rect }); } function getDOMRect(anchorRect) { if (!anchorRect) return createDOMRect(); const { x, y, width, height } = anchorRect; return createDOMRect(x, y, width, height); } function getAnchorElement(anchorElement, getAnchorRect) { const contextElement = anchorElement || void 0; return { contextElement, getBoundingClientRect: () => { const anchor = anchorElement; const anchorRect = getAnchorRect == null ? void 0 : getAnchorRect(anchor); if (anchorRect || !anchor) { return getDOMRect(anchorRect); } return anchor.getBoundingClientRect(); } }; } function isValidPlacement(flip2) { return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(flip2); } function roundByDPR(value) { const dpr = window.devicePixelRatio || 1; return Math.round(value * dpr) / dpr; } function getOffsetMiddleware(arrowElement, props) { return offset(({ placement }) => { var _a; const arrowOffset = ((arrowElement == null ? void 0 : arrowElement.clientHeight) || 0) / 2; const finalGutter = typeof props.gutter === "number" ? props.gutter + arrowOffset : (_a = props.gutter) != null ? _a : arrowOffset; const hasAlignment = !!placement.split("-")[1]; return { crossAxis: !hasAlignment ? props.shift : void 0, mainAxis: finalGutter, alignmentAxis: props.shift }; }); } function getFlipMiddleware(props) { if (props.flip === false) return; const fallbackPlacements = typeof props.flip === "string" ? props.flip.split(" ") : void 0; invariant( !fallbackPlacements || fallbackPlacements.every(isValidPlacement), false && 0 ); return floating_ui_dom_flip({ padding: props.overflowPadding, fallbackPlacements }); } function getShiftMiddleware(props) { if (!props.slide && !props.overlap) return; return floating_ui_dom_shift({ mainAxis: props.slide, crossAxis: props.overlap, padding: props.overflowPadding, limiter: floating_ui_dom_limitShift() }); } function getSizeMiddleware(props) { return floating_ui_dom_size({ padding: props.overflowPadding, apply({ elements, availableWidth, availableHeight, rects }) { const wrapper = elements.floating; const referenceWidth = Math.round(rects.reference.width); availableWidth = Math.floor(availableWidth); availableHeight = Math.floor(availableHeight); wrapper.style.setProperty( "--popover-anchor-width", `${referenceWidth}px` ); wrapper.style.setProperty( "--popover-available-width", `${availableWidth}px` ); wrapper.style.setProperty( "--popover-available-height", `${availableHeight}px` ); if (props.sameWidth) { wrapper.style.width = `${referenceWidth}px`; } if (props.fitViewport) { wrapper.style.maxWidth = `${availableWidth}px`; wrapper.style.maxHeight = `${availableHeight}px`; } } }); } function getArrowMiddleware(arrowElement, props) { if (!arrowElement) return; return floating_ui_dom_arrow({ element: arrowElement, padding: props.arrowPadding }); } var usePopover = createHook( function usePopover2(_a) { var _b = _a, { store, modal = false, portal = !!modal, preserveTabOrder = true, autoFocusOnShow = true, wrapperProps, fixed = false, flip: flip2 = true, shift: shift2 = 0, slide = true, overlap = false, sameWidth = false, fitViewport = false, gutter, arrowPadding = 4, overflowPadding = 8, getAnchorRect, updatePosition } = _b, props = __objRest(_b, [ "store", "modal", "portal", "preserveTabOrder", "autoFocusOnShow", "wrapperProps", "fixed", "flip", "shift", "slide", "overlap", "sameWidth", "fitViewport", "gutter", "arrowPadding", "overflowPadding", "getAnchorRect", "updatePosition" ]); const context = usePopoverProviderContext(); store = store || context; invariant( store, false && 0 ); const arrowElement = store.useState("arrowElement"); const anchorElement = store.useState("anchorElement"); const disclosureElement = store.useState("disclosureElement"); const popoverElement = store.useState("popoverElement"); const contentElement = store.useState("contentElement"); const placement = store.useState("placement"); const mounted = store.useState("mounted"); const rendered = store.useState("rendered"); const defaultArrowElementRef = (0,external_React_.useRef)(null); const [positioned, setPositioned] = (0,external_React_.useState)(false); const { portalRef, domReady } = usePortalRef(portal, props.portalRef); const getAnchorRectProp = useEvent(getAnchorRect); const updatePositionProp = useEvent(updatePosition); const hasCustomUpdatePosition = !!updatePosition; useSafeLayoutEffect(() => { if (!(popoverElement == null ? void 0 : popoverElement.isConnected)) return; popoverElement.style.setProperty( "--popover-overflow-padding", `${overflowPadding}px` ); const anchor = getAnchorElement(anchorElement, getAnchorRectProp); const updatePosition2 = async () => { if (!mounted) return; if (!arrowElement) { defaultArrowElementRef.current = defaultArrowElementRef.current || document.createElement("div"); } const arrow2 = arrowElement || defaultArrowElementRef.current; const middleware = [ getOffsetMiddleware(arrow2, { gutter, shift: shift2 }), getFlipMiddleware({ flip: flip2, overflowPadding }), getShiftMiddleware({ slide, shift: shift2, overlap, overflowPadding }), getArrowMiddleware(arrow2, { arrowPadding }), getSizeMiddleware({ sameWidth, fitViewport, overflowPadding }) ]; const pos = await floating_ui_dom_computePosition(anchor, popoverElement, { placement, strategy: fixed ? "fixed" : "absolute", middleware }); store == null ? void 0 : store.setState("currentPlacement", pos.placement); setPositioned(true); const x = roundByDPR(pos.x); const y = roundByDPR(pos.y); Object.assign(popoverElement.style, { top: "0", left: "0", transform: `translate3d(${x}px,${y}px,0)` }); if (arrow2 && pos.middlewareData.arrow) { const { x: arrowX, y: arrowY } = pos.middlewareData.arrow; const side = pos.placement.split("-")[0]; const centerX = arrow2.clientWidth / 2; const centerY = arrow2.clientHeight / 2; const originX = arrowX != null ? arrowX + centerX : -centerX; const originY = arrowY != null ? arrowY + centerY : -centerY; popoverElement.style.setProperty( "--popover-transform-origin", { top: `${originX}px calc(100% + ${centerY}px)`, bottom: `${originX}px ${-centerY}px`, left: `calc(100% + ${centerX}px) ${originY}px`, right: `${-centerX}px ${originY}px` }[side] ); Object.assign(arrow2.style, { left: arrowX != null ? `${arrowX}px` : "", top: arrowY != null ? `${arrowY}px` : "", [side]: "100%" }); } }; const update = async () => { if (hasCustomUpdatePosition) { await updatePositionProp({ updatePosition: updatePosition2 }); setPositioned(true); } else { await updatePosition2(); } }; const cancelAutoUpdate = autoUpdate(anchor, popoverElement, update, { // JSDOM doesn't support ResizeObserver elementResize: typeof ResizeObserver === "function" }); return () => { setPositioned(false); cancelAutoUpdate(); }; }, [ store, rendered, popoverElement, arrowElement, anchorElement, popoverElement, placement, mounted, domReady, fixed, flip2, shift2, slide, overlap, sameWidth, fitViewport, gutter, arrowPadding, overflowPadding, getAnchorRectProp, hasCustomUpdatePosition, updatePositionProp ]); useSafeLayoutEffect(() => { if (!mounted) return; if (!domReady) return; if (!(popoverElement == null ? void 0 : popoverElement.isConnected)) return; if (!(contentElement == null ? void 0 : contentElement.isConnected)) return; const applyZIndex = () => { popoverElement.style.zIndex = getComputedStyle(contentElement).zIndex; }; applyZIndex(); let raf = requestAnimationFrame(() => { raf = requestAnimationFrame(applyZIndex); }); return () => cancelAnimationFrame(raf); }, [mounted, domReady, popoverElement, contentElement]); const position = fixed ? "fixed" : "absolute"; props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, wrapperProps), { style: _3YLGPPWQ_spreadValues({ // https://floating-ui.com/docs/computeposition#initial-layout position, top: 0, left: 0, width: "max-content" }, wrapperProps == null ? void 0 : wrapperProps.style), ref: store == null ? void 0 : store.setPopoverElement, children: element }) ), [store, position, wrapperProps] ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PopoverScopedContextProvider, { value: store, children: element }), [store] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ // data-placing is not part of the public API. We're setting this here so // we can wait for the popover to be positioned before other components // move focus into it. For example, this attribute is observed by the // Combobox component with the autoSelect behavior. "data-placing": !positioned || void 0 }, props), { style: _3YLGPPWQ_spreadValues({ position: "relative" }, props.style) }); props = useDialog(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store, modal, portal, preserveTabOrder, preserveTabOrderAnchor: disclosureElement || anchorElement, autoFocusOnShow: positioned && autoFocusOnShow }, props), { portalRef })); return props; } ); var Popover = createDialogComponent( forwardRef2(function Popover2(props) { const htmlProps = usePopover(props); return LMDWO4NN_createElement(T6C2RYFI_TagName, htmlProps); }), usePopoverProviderContext ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/KQKDTOT4.js "use client"; // src/hovercard/hovercard.tsx var KQKDTOT4_TagName = "div"; function isMovingOnHovercard(target, card, anchor, nested) { if (hasFocusWithin(card)) return true; if (!target) return false; if (contains(card, target)) return true; if (anchor && contains(anchor, target)) return true; if (nested == null ? void 0 : nested.some((card2) => isMovingOnHovercard(target, card2, anchor))) { return true; } return false; } function useAutoFocusOnHide(_a) { var _b = _a, { store } = _b, props = __objRest(_b, [ "store" ]); const [autoFocusOnHide, setAutoFocusOnHide] = (0,external_React_.useState)(false); const mounted = store.useState("mounted"); (0,external_React_.useEffect)(() => { if (!mounted) { setAutoFocusOnHide(false); } }, [mounted]); const onFocusProp = props.onFocus; const onFocus = useEvent((event) => { onFocusProp == null ? void 0 : onFocusProp(event); if (event.defaultPrevented) return; setAutoFocusOnHide(true); }); const finalFocusRef = (0,external_React_.useRef)(null); (0,external_React_.useEffect)(() => { return sync(store, ["anchorElement"], (state) => { finalFocusRef.current = state.anchorElement; }); }, []); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ autoFocusOnHide, finalFocus: finalFocusRef }, props), { onFocus }); return props; } var NestedHovercardContext = (0,external_React_.createContext)(null); var useHovercard = createHook( function useHovercard2(_a) { var _b = _a, { store, modal = false, portal = !!modal, hideOnEscape = true, hideOnHoverOutside = true, disablePointerEventsOnApproach = !!hideOnHoverOutside } = _b, props = __objRest(_b, [ "store", "modal", "portal", "hideOnEscape", "hideOnHoverOutside", "disablePointerEventsOnApproach" ]); const context = useHovercardProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const [nestedHovercards, setNestedHovercards] = (0,external_React_.useState)([]); const hideTimeoutRef = (0,external_React_.useRef)(0); const enterPointRef = (0,external_React_.useRef)(null); const { portalRef, domReady } = usePortalRef(portal, props.portalRef); const isMouseMoving = useIsMouseMoving(); const mayHideOnHoverOutside = !!hideOnHoverOutside; const hideOnHoverOutsideProp = useBooleanEvent(hideOnHoverOutside); const mayDisablePointerEvents = !!disablePointerEventsOnApproach; const disablePointerEventsProp = useBooleanEvent( disablePointerEventsOnApproach ); const open = store.useState("open"); const mounted = store.useState("mounted"); (0,external_React_.useEffect)(() => { if (!domReady) return; if (!mounted) return; if (!mayHideOnHoverOutside && !mayDisablePointerEvents) return; const element = ref.current; if (!element) return; const onMouseMove = (event) => { if (!store) return; if (!isMouseMoving()) return; const { anchorElement, hideTimeout, timeout } = store.getState(); const enterPoint = enterPointRef.current; const [target] = event.composedPath(); const anchor = anchorElement; if (isMovingOnHovercard(target, element, anchor, nestedHovercards)) { enterPointRef.current = target && anchor && contains(anchor, target) ? getEventPoint(event) : null; window.clearTimeout(hideTimeoutRef.current); hideTimeoutRef.current = 0; return; } if (hideTimeoutRef.current) return; if (enterPoint) { const currentPoint = getEventPoint(event); const polygon = getElementPolygon(element, enterPoint); if (isPointInPolygon(currentPoint, polygon)) { enterPointRef.current = currentPoint; if (!disablePointerEventsProp(event)) return; event.preventDefault(); event.stopPropagation(); return; } } if (!hideOnHoverOutsideProp(event)) return; hideTimeoutRef.current = window.setTimeout(() => { hideTimeoutRef.current = 0; store == null ? void 0 : store.hide(); }, hideTimeout != null ? hideTimeout : timeout); }; return chain( addGlobalEventListener("mousemove", onMouseMove, true), () => clearTimeout(hideTimeoutRef.current) ); }, [ store, isMouseMoving, domReady, mounted, mayHideOnHoverOutside, mayDisablePointerEvents, nestedHovercards, disablePointerEventsProp, hideOnHoverOutsideProp ]); (0,external_React_.useEffect)(() => { if (!domReady) return; if (!mounted) return; if (!mayDisablePointerEvents) return; const disableEvent = (event) => { const element = ref.current; if (!element) return; const enterPoint = enterPointRef.current; if (!enterPoint) return; const polygon = getElementPolygon(element, enterPoint); if (isPointInPolygon(getEventPoint(event), polygon)) { if (!disablePointerEventsProp(event)) return; event.preventDefault(); event.stopPropagation(); } }; return chain( // Note: we may need to add pointer events here in the future. addGlobalEventListener("mouseenter", disableEvent, true), addGlobalEventListener("mouseover", disableEvent, true), addGlobalEventListener("mouseout", disableEvent, true), addGlobalEventListener("mouseleave", disableEvent, true) ); }, [domReady, mounted, mayDisablePointerEvents, disablePointerEventsProp]); (0,external_React_.useEffect)(() => { if (!domReady) return; if (open) return; store == null ? void 0 : store.setAutoFocusOnShow(false); }, [store, domReady, open]); const openRef = useLiveRef(open); (0,external_React_.useEffect)(() => { if (!domReady) return; return () => { if (!openRef.current) { store == null ? void 0 : store.setAutoFocusOnShow(false); } }; }, [store, domReady]); const registerOnParent = (0,external_React_.useContext)(NestedHovercardContext); useSafeLayoutEffect(() => { if (modal) return; if (!portal) return; if (!mounted) return; if (!domReady) return; const element = ref.current; if (!element) return; return registerOnParent == null ? void 0 : registerOnParent(element); }, [modal, portal, mounted, domReady]); const registerNestedHovercard = (0,external_React_.useCallback)( (element) => { setNestedHovercards((prevElements) => [...prevElements, element]); const parentUnregister = registerOnParent == null ? void 0 : registerOnParent(element); return () => { setNestedHovercards( (prevElements) => prevElements.filter((item) => item !== element) ); parentUnregister == null ? void 0 : parentUnregister(); }; }, [registerOnParent] ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(HovercardScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NestedHovercardContext.Provider, { value: registerNestedHovercard, children: element }) }), [store, registerNestedHovercard] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(ref, props.ref) }); props = useAutoFocusOnHide(_3YLGPPWQ_spreadValues({ store }, props)); const autoFocusOnShow = store.useState( (state) => modal || state.autoFocusOnShow ); props = usePopover(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store, modal, portal, autoFocusOnShow }, props), { portalRef, hideOnEscape(event) { if (isFalsyBooleanCallback(hideOnEscape, event)) return false; requestAnimationFrame(() => { requestAnimationFrame(() => { store == null ? void 0 : store.hide(); }); }); return true; } })); return props; } ); var Hovercard = createDialogComponent( forwardRef2(function Hovercard2(props) { const htmlProps = useHovercard(props); return LMDWO4NN_createElement(KQKDTOT4_TagName, htmlProps); }), useHovercardProviderContext ); ;// ./node_modules/@ariakit/react-core/esm/tooltip/tooltip.js "use client"; // src/tooltip/tooltip.tsx var tooltip_TagName = "div"; var useTooltip = createHook( function useTooltip2(_a) { var _b = _a, { store, portal = true, gutter = 8, preserveTabOrder = false, hideOnHoverOutside = true, hideOnInteractOutside = true } = _b, props = __objRest(_b, [ "store", "portal", "gutter", "preserveTabOrder", "hideOnHoverOutside", "hideOnInteractOutside" ]); const context = useTooltipProviderContext(); store = store || context; invariant( store, false && 0 ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TooltipScopedContextProvider, { value: store, children: element }), [store] ); const role = store.useState( (state) => state.type === "description" ? "tooltip" : "none" ); props = _3YLGPPWQ_spreadValues({ role }, props); props = useHovercard(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { store, portal, gutter, preserveTabOrder, hideOnHoverOutside(event) { if (isFalsyBooleanCallback(hideOnHoverOutside, event)) return false; const anchorElement = store == null ? void 0 : store.getState().anchorElement; if (!anchorElement) return true; if ("focusVisible" in anchorElement.dataset) return false; return true; }, hideOnInteractOutside: (event) => { if (isFalsyBooleanCallback(hideOnInteractOutside, event)) return false; const anchorElement = store == null ? void 0 : store.getState().anchorElement; if (!anchorElement) return true; if (contains(anchorElement, event.target)) return false; return true; } })); return props; } ); var Tooltip = createDialogComponent( forwardRef2(function Tooltip2(props) { const htmlProps = useTooltip(props); return LMDWO4NN_createElement(tooltip_TagName, htmlProps); }), useTooltipProviderContext ); ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// ./node_modules/@wordpress/components/build-module/shortcut/index.js /** * Internal dependencies */ /** * Shortcut component is used to display keyboard shortcuts, and it can be customized with a custom display and aria label if needed. * * ```jsx * import { Shortcut } from '@wordpress/components'; * * const MyShortcut = () => { * return ( * <Shortcut shortcut={{ display: 'Ctrl + S', ariaLabel: 'Save' }} /> * ); * }; * ``` */ function Shortcut(props) { const { shortcut, className } = props; if (!shortcut) { return null; } let displayText; let ariaLabel; if (typeof shortcut === 'string') { displayText = shortcut; } if (shortcut !== null && typeof shortcut === 'object') { displayText = shortcut.display; ariaLabel = shortcut.ariaLabel; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: className, "aria-label": ariaLabel, children: displayText }); } /* harmony default export */ const build_module_shortcut = (Shortcut); ;// ./node_modules/@wordpress/components/build-module/popover/utils.js /** * External dependencies */ /** * Internal dependencies */ const POSITION_TO_PLACEMENT = { bottom: 'bottom', top: 'top', 'middle left': 'left', 'middle right': 'right', 'bottom left': 'bottom-end', 'bottom center': 'bottom', 'bottom right': 'bottom-start', 'top left': 'top-end', 'top center': 'top', 'top right': 'top-start', 'middle left left': 'left', 'middle left right': 'left', 'middle left bottom': 'left-end', 'middle left top': 'left-start', 'middle right left': 'right', 'middle right right': 'right', 'middle right bottom': 'right-end', 'middle right top': 'right-start', 'bottom left left': 'bottom-end', 'bottom left right': 'bottom-end', 'bottom left bottom': 'bottom-end', 'bottom left top': 'bottom-end', 'bottom center left': 'bottom', 'bottom center right': 'bottom', 'bottom center bottom': 'bottom', 'bottom center top': 'bottom', 'bottom right left': 'bottom-start', 'bottom right right': 'bottom-start', 'bottom right bottom': 'bottom-start', 'bottom right top': 'bottom-start', 'top left left': 'top-end', 'top left right': 'top-end', 'top left bottom': 'top-end', 'top left top': 'top-end', 'top center left': 'top', 'top center right': 'top', 'top center bottom': 'top', 'top center top': 'top', 'top right left': 'top-start', 'top right right': 'top-start', 'top right bottom': 'top-start', 'top right top': 'top-start', // `middle`/`middle center [corner?]` positions are associated to a fallback // `bottom` placement because there aren't any corresponding placement values. middle: 'bottom', 'middle center': 'bottom', 'middle center bottom': 'bottom', 'middle center left': 'bottom', 'middle center right': 'bottom', 'middle center top': 'bottom' }; /** * Converts the `Popover`'s legacy "position" prop to the new "placement" prop * (used by `floating-ui`). * * @param position The legacy position * @return The corresponding placement */ const positionToPlacement = position => { var _POSITION_TO_PLACEMEN; return (_POSITION_TO_PLACEMEN = POSITION_TO_PLACEMENT[position]) !== null && _POSITION_TO_PLACEMEN !== void 0 ? _POSITION_TO_PLACEMEN : 'bottom'; }; /** * @typedef AnimationOrigin * @type {Object} * @property {number} originX A number between 0 and 1 (in CSS logical properties jargon, 0 is "start", 0.5 is "center", and 1 is "end") * @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom) */ const PLACEMENT_TO_ANIMATION_ORIGIN = { top: { originX: 0.5, originY: 1 }, // open from bottom, center 'top-start': { originX: 0, originY: 1 }, // open from bottom, left 'top-end': { originX: 1, originY: 1 }, // open from bottom, right right: { originX: 0, originY: 0.5 }, // open from middle, left 'right-start': { originX: 0, originY: 0 }, // open from top, left 'right-end': { originX: 0, originY: 1 }, // open from bottom, left bottom: { originX: 0.5, originY: 0 }, // open from top, center 'bottom-start': { originX: 0, originY: 0 }, // open from top, left 'bottom-end': { originX: 1, originY: 0 }, // open from top, right left: { originX: 1, originY: 0.5 }, // open from middle, right 'left-start': { originX: 1, originY: 0 }, // open from top, right 'left-end': { originX: 1, originY: 1 }, // open from bottom, right overlay: { originX: 0.5, originY: 0.5 } // open from center, center }; /** * Given the floating-ui `placement`, compute the framer-motion props for the * popover's entry animation. * * @param placement A placement string from floating ui * @return The object containing the motion props */ const placementToMotionAnimationProps = placement => { const translateProp = placement.startsWith('top') || placement.startsWith('bottom') ? 'translateY' : 'translateX'; const translateDirection = placement.startsWith('top') || placement.startsWith('left') ? 1 : -1; return { style: PLACEMENT_TO_ANIMATION_ORIGIN[placement], initial: { opacity: 0, scale: 0, [translateProp]: `${2 * translateDirection}em` }, animate: { opacity: 1, scale: 1, [translateProp]: 0 }, transition: { duration: 0.1, ease: [0, 0, 0.2, 1] } }; }; function isTopBottom(anchorRef) { return !!anchorRef?.top; } function isRef(anchorRef) { return !!anchorRef?.current; } const getReferenceElement = ({ anchor, anchorRef, anchorRect, getAnchorRect, fallbackReferenceElement }) => { var _referenceElement; let referenceElement = null; if (anchor) { referenceElement = anchor; } else if (isTopBottom(anchorRef)) { // Create a virtual element for the ref. The expectation is that // if anchorRef.top is defined, then anchorRef.bottom is defined too. // Seems to be used by the block toolbar, when multiple blocks are selected // (top and bottom blocks are used to calculate the resulting rect). referenceElement = { getBoundingClientRect() { const topRect = anchorRef.top.getBoundingClientRect(); const bottomRect = anchorRef.bottom.getBoundingClientRect(); return new window.DOMRect(topRect.x, topRect.y, topRect.width, bottomRect.bottom - topRect.top); } }; } else if (isRef(anchorRef)) { // Standard React ref. referenceElement = anchorRef.current; } else if (anchorRef) { // If `anchorRef` holds directly the element's value (no `current` key) // This is a weird scenario and should be deprecated. referenceElement = anchorRef; } else if (anchorRect) { // Create a virtual element for the ref. referenceElement = { getBoundingClientRect() { return anchorRect; } }; } else if (getAnchorRect) { // Create a virtual element for the ref. referenceElement = { getBoundingClientRect() { var _rect$x, _rect$y, _rect$width, _rect$height; const rect = getAnchorRect(fallbackReferenceElement); return new window.DOMRect((_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left, (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top, (_rect$width = rect.width) !== null && _rect$width !== void 0 ? _rect$width : rect.right - rect.left, (_rect$height = rect.height) !== null && _rect$height !== void 0 ? _rect$height : rect.bottom - rect.top); } }; } else if (fallbackReferenceElement) { // If no explicit ref is passed via props, fall back to // anchoring to the popover's parent node. referenceElement = fallbackReferenceElement.parentElement; } // Convert any `undefined` value to `null`. return (_referenceElement = referenceElement) !== null && _referenceElement !== void 0 ? _referenceElement : null; }; /** * Computes the final coordinate that needs to be applied to the floating * element when applying transform inline styles, defaulting to `undefined` * if the provided value is `null` or `NaN`. * * @param c input coordinate (usually as returned from floating-ui) * @return The coordinate's value to be used for inline styles. An `undefined` * return value means "no style set" for this coordinate. */ const computePopoverPosition = c => c === null || Number.isNaN(c) ? undefined : Math.round(c); ;// ./node_modules/@wordpress/components/build-module/tooltip/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const TooltipInternalContext = (0,external_wp_element_namespaceObject.createContext)({ isNestedInTooltip: false }); /** * Time over anchor to wait before showing tooltip */ const TOOLTIP_DELAY = 700; const CONTEXT_VALUE = { isNestedInTooltip: true }; function UnforwardedTooltip(props, ref) { const { children, className, delay = TOOLTIP_DELAY, hideOnClick = true, placement, position, shortcut, text, ...restProps } = props; const { isNestedInTooltip } = (0,external_wp_element_namespaceObject.useContext)(TooltipInternalContext); const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(tooltip_Tooltip, 'tooltip'); const describedById = text || shortcut ? baseId : undefined; const isOnlyChild = external_wp_element_namespaceObject.Children.count(children) === 1; // console error if more than one child element is added if (!isOnlyChild) { if (false) {} } // Compute tooltip's placement: // - give priority to `placement` prop, if defined // - otherwise, compute it from the legacy `position` prop (if defined) // - finally, fallback to the default placement: 'bottom' let computedPlacement; if (placement !== undefined) { computedPlacement = placement; } else if (position !== undefined) { computedPlacement = positionToPlacement(position); external_wp_deprecated_default()('`position` prop in wp.components.tooltip', { since: '6.4', alternative: '`placement` prop' }); } computedPlacement = computedPlacement || 'bottom'; const tooltipStore = useTooltipStore({ placement: computedPlacement, showTimeout: delay }); const mounted = useStoreState(tooltipStore, 'mounted'); if (isNestedInTooltip) { return isOnlyChild ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Role, { ...restProps, render: children }) : children; } // TODO: this is a temporary workaround to minimize the effects of the // Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to // the tooltip anchor anymore since 0.4.0, so we need to add it manually. // The `aria-describedby` attribute is added only if the anchor doesn't have // one already, and if the tooltip text is not the same as the anchor's // `aria-label` // See: https://github.com/WordPress/gutenberg/pull/64066 // See: https://github.com/WordPress/gutenberg/pull/65989 function addDescribedById(element) { return describedById && mounted && element.props['aria-describedby'] === undefined && element.props['aria-label'] !== text ? (0,external_wp_element_namespaceObject.cloneElement)(element, { 'aria-describedby': describedById }) : element; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(TooltipInternalContext.Provider, { value: CONTEXT_VALUE, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TooltipAnchor, { onClick: hideOnClick ? tooltipStore.hide : undefined, store: tooltipStore, render: isOnlyChild ? addDescribedById(children) : undefined, ref: ref, children: isOnlyChild ? undefined : children }), isOnlyChild && (text || shortcut) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tooltip, { ...restProps, className: dist_clsx('components-tooltip', className), unmountOnHide: true, gutter: 4, id: describedById, overflowPadding: 0.5, store: tooltipStore, children: [text, shortcut && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_shortcut, { className: text ? 'components-tooltip__shortcut' : '', shortcut: shortcut })] })] }); } const tooltip_Tooltip = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTooltip); /* harmony default export */ const tooltip = (tooltip_Tooltip); ;// external ["wp","warning"] const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js var cjs = __webpack_require__(66); var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs); // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js var es6 = __webpack_require__(7734); var es6_default = /*#__PURE__*/__webpack_require__.n(es6); ;// ./node_modules/is-plain-object/dist/is-plain-object.mjs /*! * is-plain-object <https://github.com/jonschlinkert/is-plain-object> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function is_plain_object_isObject(o) { return Object.prototype.toString.call(o) === '[object Object]'; } function isPlainObject(o) { var ctor,prot; if (is_plain_object_isObject(o) === false) return false; // If has modified constructor ctor = o.constructor; if (ctor === undefined) return true; // If has modified prototype prot = ctor.prototype; if (is_plain_object_isObject(prot) === false) return false; // If constructor does not have an Object-specific method if (prot.hasOwnProperty('isPrototypeOf') === false) { return false; } // Most likely a plain Object return true; } ;// ./node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.js /** * WordPress dependencies */ /** * A `React.useEffect` that will not run on the first render. * Source: * https://github.com/ariakit/ariakit/blob/main/packages/ariakit-react-core/src/utils/hooks.ts * * @param {import('react').EffectCallback} effect * @param {import('react').DependencyList} deps */ function use_update_effect_useUpdateEffect(effect, deps) { const mountedRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (mountedRef.current) { return effect(); } mountedRef.current = true; return undefined; // 1. This hook needs to pass a dep list that isn't an array literal // 2. `effect` is missing from the array, and will need to be added carefully to avoid additional warnings // see https://github.com/WordPress/gutenberg/pull/41166 }, deps); (0,external_wp_element_namespaceObject.useEffect)(() => () => { mountedRef.current = false; }, []); } /* harmony default export */ const use_update_effect = (use_update_effect_useUpdateEffect); ;// ./node_modules/@wordpress/components/build-module/context/context-system-provider.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ComponentsContext = (0,external_wp_element_namespaceObject.createContext)(/** @type {Record<string, any>} */{}); const useComponentsContext = () => (0,external_wp_element_namespaceObject.useContext)(ComponentsContext); /** * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value. * * Note: This function will warn if it detects an un-memoized `value` * * @param {Object} props * @param {Record<string, any>} props.value * @return {Record<string, any>} The consolidated value. */ function useContextSystemBridge({ value }) { const parentContext = useComponentsContext(); const valueRef = (0,external_wp_element_namespaceObject.useRef)(value); use_update_effect(() => { if ( // Objects are equivalent. es6_default()(valueRef.current, value) && // But not the same reference. valueRef.current !== value) { true ? external_wp_warning_default()(`Please memoize your context: ${JSON.stringify(value)}`) : 0; } }, [value]); // `parentContext` will always be memoized (i.e., the result of this hook itself) // or the default value from when the `ComponentsContext` was originally // initialized (which will never change, it's a static variable) // so this memoization will prevent `deepmerge()` from rerunning unless // the references to `value` change OR the `parentContext` has an actual material change // (because again, it's guaranteed to be memoized or a static reference to the empty object // so we know that the only changes for `parentContext` are material ones... i.e., why we // don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are // correctly warning when the `value` isn't being properly memoized. All of that to say // that this should be super safe to assume that `useMemo` will only run on actual // changes to the two dependencies, therefore saving us calls to `deepmerge()`! const config = (0,external_wp_element_namespaceObject.useMemo)(() => { // Deep clone `parentContext` to avoid mutating it later. return cjs_default()(parentContext !== null && parentContext !== void 0 ? parentContext : {}, value !== null && value !== void 0 ? value : {}, { isMergeableObject: isPlainObject }); }, [parentContext, value]); return config; } /** * A Provider component that can modify props for connected components within * the Context system. * * @example * ```jsx * <ContextSystemProvider value={{ Button: { size: 'small' }}}> * <Button>...</Button> * </ContextSystemProvider> * ``` * * @template {Record<string, any>} T * @param {Object} options * @param {import('react').ReactNode} options.children Children to render. * @param {T} options.value Props to render into connected components. * @return {JSX.Element} A Provider wrapped component. */ const BaseContextSystemProvider = ({ children, value }) => { const contextValue = useContextSystemBridge({ value }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentsContext.Provider, { value: contextValue, children: children }); }; const ContextSystemProvider = (0,external_wp_element_namespaceObject.memo)(BaseContextSystemProvider); ;// ./node_modules/@wordpress/components/build-module/context/constants.js const COMPONENT_NAMESPACE = 'data-wp-component'; const CONNECTED_NAMESPACE = 'data-wp-c16t'; /** * Special key where the connected namespaces are stored. * This is attached to Context connected components as a static property. */ const CONNECT_STATIC_NAMESPACE = '__contextSystemKey__'; ;// ./node_modules/@wordpress/components/build-module/context/utils.js /** * Internal dependencies */ /** * Creates a dedicated context namespace HTML attribute for components. * ns is short for "namespace" * * @example * ```jsx * <div {...ns('Container')} /> * ``` * * @param {string} componentName The name for the component. * @return {Record<string, any>} A props object with the namespaced HTML attribute. */ function getNamespace(componentName) { return { [COMPONENT_NAMESPACE]: componentName }; } /** * Creates a dedicated connected context namespace HTML attribute for components. * ns is short for "namespace" * * @example * ```jsx * <div {...cns()} /> * ``` * * @return {Record<string, any>} A props object with the namespaced HTML attribute. */ function getConnectedNamespace() { return { [CONNECTED_NAMESPACE]: true }; } ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; var result = dist_es2015_replace(dist_es2015_replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function dist_es2015_replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/dot-case/dist.es2015/index.js function dotCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "." }, options)); } ;// ./node_modules/param-case/dist.es2015/index.js function paramCase(input, options) { if (options === void 0) { options = {}; } return dotCase(input, __assign({ delimiter: "-" }, options)); } ;// ./node_modules/memize/dist/index.js /** * Memize options object. * * @typedef MemizeOptions * * @property {number} [maxSize] Maximum size of the cache. */ /** * Internal cache entry. * * @typedef MemizeCacheNode * * @property {?MemizeCacheNode|undefined} [prev] Previous node. * @property {?MemizeCacheNode|undefined} [next] Next node. * @property {Array<*>} args Function arguments for cache * entry. * @property {*} val Function result. */ /** * Properties of the enhanced function for controlling cache. * * @typedef MemizeMemoizedFunction * * @property {()=>void} clear Clear the cache. */ /** * Accepts a function to be memoized, and returns a new memoized function, with * optional options. * * @template {(...args: any[]) => any} F * * @param {F} fn Function to memoize. * @param {MemizeOptions} [options] Options object. * * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. */ function memize(fn, options) { var size = 0; /** @type {?MemizeCacheNode|undefined} */ var head; /** @type {?MemizeCacheNode|undefined} */ var tail; options = options || {}; function memoized(/* ...args */) { var node = head, len = arguments.length, args, i; searchCache: while (node) { // Perform a shallow equality test to confirm that whether the node // under test is a candidate for the arguments passed. Two arrays // are shallowly equal if their length matches and each entry is // strictly equal between the two sets. Avoid abstracting to a // function which could incur an arguments leaking deoptimization. // Check whether node arguments match arguments length if (node.args.length !== arguments.length) { node = node.next; continue; } // Check whether node arguments match arguments values for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } // At this point we can assume we've found a match // Surface matched node to head if not already if (node !== head) { // As tail, shift to previous. Must only shift if not also // head, since if both head and tail, there is no previous. if (node === tail) { tail = node.prev; } // Adjust siblings to point to each other. If node was tail, // this also handles new tail's empty `next` assignment. /** @type {MemizeCacheNode} */ (node.prev).next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; /** @type {MemizeCacheNode} */ (head).prev = node; head = node; } // Return immediately return node.val; } // No cached value found. Continue to insertion phase: // Create a copy of arguments (avoid leaking deoptimization) args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args: args, // Generate the result from original function val: fn.apply(null, args), }; // Don't need to check whether node is already head, since it would // have been returned above already if it was // Shift existing head down list if (head) { head.prev = node; node.next = head; } else { // If no head, follows that there's no tail (at initial or reset) tail = node; } // Trim tail if we're reached max size and are pending cache insertion if (size === /** @type {MemizeOptions} */ (options).maxSize) { tail = /** @type {MemizeCacheNode} */ (tail).prev; /** @type {MemizeCacheNode} */ (tail).next = null; } else { size++; } head = node; return node.val; } memoized.clear = function () { head = null; tail = null; size = 0; }; // Ignore reason: There's not a clear solution to create an intersection of // the function with additional properties, where the goal is to retain the // function signature of the incoming argument and add control properties // on the return value. // @ts-ignore return memoized; } ;// ./node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.js /** * External dependencies */ /** * Generates the connected component CSS className based on the namespace. * * @param namespace The name of the connected component. * @return The generated CSS className. */ function getStyledClassName(namespace) { const kebab = paramCase(namespace); return `components-${kebab}`; } const getStyledClassNameFromKey = memize(getStyledClassName); ;// ./node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js /* Based off glamor's StyleSheet, thanks Sunil ❤️ high performance StyleSheet for css-in-js systems - uses multiple style tags behind the scenes for millions of rules - uses `insertRule` for appending in production for *much* faster performance // usage import { StyleSheet } from '@emotion/sheet' let styleSheet = new StyleSheet({ key: '', container: document.head }) styleSheet.insert('#box { border: 1px solid red; }') - appends a css rule into the stylesheet styleSheet.flush() - empties the stylesheet of all its contents */ // $FlowFixMe function sheetForTag(tag) { if (tag.sheet) { // $FlowFixMe return tag.sheet; } // this weirdness brought to you by firefox /* istanbul ignore next */ for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { // $FlowFixMe return document.styleSheets[i]; } } } function createStyleElement(options) { var tag = document.createElement('style'); tag.setAttribute('data-emotion', options.key); if (options.nonce !== undefined) { tag.setAttribute('nonce', options.nonce); } tag.appendChild(document.createTextNode('')); tag.setAttribute('data-s', ''); return tag; } var StyleSheet = /*#__PURE__*/function () { // Using Node instead of HTMLElement since container may be a ShadowRoot function StyleSheet(options) { var _this = this; this._insertTag = function (tag) { var before; if (_this.tags.length === 0) { if (_this.insertionPoint) { before = _this.insertionPoint.nextSibling; } else if (_this.prepend) { before = _this.container.firstChild; } else { before = _this.before; } } else { before = _this.tags[_this.tags.length - 1].nextSibling; } _this.container.insertBefore(tag, before); _this.tags.push(tag); }; this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy; this.tags = []; this.ctr = 0; this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets this.key = options.key; this.container = options.container; this.prepend = options.prepend; this.insertionPoint = options.insertionPoint; this.before = null; } var _proto = StyleSheet.prototype; _proto.hydrate = function hydrate(nodes) { nodes.forEach(this._insertTag); }; _proto.insert = function insert(rule) { // the max length is how many rules we have per style tag, it's 65000 in speedy mode // it's 1 in dev because we insert source maps that map a single rule to a location // and you can only have one source map per style tag if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { this._insertTag(createStyleElement(this)); } var tag = this.tags[this.tags.length - 1]; if (false) { var isImportRule; } if (this.isSpeedy) { var sheet = sheetForTag(tag); try { // this is the ultrafast version, works across browsers // the big drawback is that the css won't be editable in devtools sheet.insertRule(rule, sheet.cssRules.length); } catch (e) { if (false) {} } } else { tag.appendChild(document.createTextNode(rule)); } this.ctr++; }; _proto.flush = function flush() { // $FlowFixMe this.tags.forEach(function (tag) { return tag.parentNode && tag.parentNode.removeChild(tag); }); this.tags = []; this.ctr = 0; if (false) {} }; return StyleSheet; }(); ;// ./node_modules/stylis/src/Utility.js /** * @param {number} * @return {number} */ var abs = Math.abs /** * @param {number} * @return {string} */ var Utility_from = String.fromCharCode /** * @param {object} * @return {object} */ var Utility_assign = Object.assign /** * @param {string} value * @param {number} length * @return {number} */ function hash (value, length) { return Utility_charat(value, 0) ^ 45 ? (((((((length << 2) ^ Utility_charat(value, 0)) << 2) ^ Utility_charat(value, 1)) << 2) ^ Utility_charat(value, 2)) << 2) ^ Utility_charat(value, 3) : 0 } /** * @param {string} value * @return {string} */ function trim (value) { return value.trim() } /** * @param {string} value * @param {RegExp} pattern * @return {string?} */ function Utility_match (value, pattern) { return (value = pattern.exec(value)) ? value[0] : value } /** * @param {string} value * @param {(string|RegExp)} pattern * @param {string} replacement * @return {string} */ function Utility_replace (value, pattern, replacement) { return value.replace(pattern, replacement) } /** * @param {string} value * @param {string} search * @return {number} */ function indexof (value, search) { return value.indexOf(search) } /** * @param {string} value * @param {number} index * @return {number} */ function Utility_charat (value, index) { return value.charCodeAt(index) | 0 } /** * @param {string} value * @param {number} begin * @param {number} end * @return {string} */ function Utility_substr (value, begin, end) { return value.slice(begin, end) } /** * @param {string} value * @return {number} */ function Utility_strlen (value) { return value.length } /** * @param {any[]} value * @return {number} */ function Utility_sizeof (value) { return value.length } /** * @param {any} value * @param {any[]} array * @return {any} */ function Utility_append (value, array) { return array.push(value), value } /** * @param {string[]} array * @param {function} callback * @return {string} */ function Utility_combine (array, callback) { return array.map(callback).join('') } ;// ./node_modules/stylis/src/Tokenizer.js var line = 1 var column = 1 var Tokenizer_length = 0 var position = 0 var character = 0 var characters = '' /** * @param {string} value * @param {object | null} root * @param {object | null} parent * @param {string} type * @param {string[] | string} props * @param {object[] | string} children * @param {number} length */ function node (value, root, parent, type, props, children, length) { return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''} } /** * @param {object} root * @param {object} props * @return {object} */ function Tokenizer_copy (root, props) { return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props) } /** * @return {number} */ function Tokenizer_char () { return character } /** * @return {number} */ function prev () { character = position > 0 ? Utility_charat(characters, --position) : 0 if (column--, character === 10) column = 1, line-- return character } /** * @return {number} */ function next () { character = position < Tokenizer_length ? Utility_charat(characters, position++) : 0 if (column++, character === 10) column = 1, line++ return character } /** * @return {number} */ function peek () { return Utility_charat(characters, position) } /** * @return {number} */ function caret () { return position } /** * @param {number} begin * @param {number} end * @return {string} */ function slice (begin, end) { return Utility_substr(characters, begin, end) } /** * @param {number} type * @return {number} */ function token (type) { switch (type) { // \0 \t \n \r \s whitespace token case 0: case 9: case 10: case 13: case 32: return 5 // ! + , / > @ ~ isolate token case 33: case 43: case 44: case 47: case 62: case 64: case 126: // ; { } breakpoint token case 59: case 123: case 125: return 4 // : accompanied token case 58: return 3 // " ' ( [ opening delimit token case 34: case 39: case 40: case 91: return 2 // ) ] closing delimit token case 41: case 93: return 1 } return 0 } /** * @param {string} value * @return {any[]} */ function alloc (value) { return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), position = 0, [] } /** * @param {any} value * @return {any} */ function dealloc (value) { return characters = '', value } /** * @param {number} type * @return {string} */ function delimit (type) { return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) } /** * @param {string} value * @return {string[]} */ function Tokenizer_tokenize (value) { return dealloc(tokenizer(alloc(value))) } /** * @param {number} type * @return {string} */ function whitespace (type) { while (character = peek()) if (character < 33) next() else break return token(type) > 2 || token(character) > 3 ? '' : ' ' } /** * @param {string[]} children * @return {string[]} */ function tokenizer (children) { while (next()) switch (token(character)) { case 0: append(identifier(position - 1), children) break case 2: append(delimit(character), children) break default: append(from(character), children) } return children } /** * @param {number} index * @param {number} count * @return {string} */ function escaping (index, count) { while (--count && next()) // not 0-9 A-F a-f if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97)) break return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) } /** * @param {number} type * @return {number} */ function delimiter (type) { while (next()) switch (character) { // ] ) " ' case type: return position // " ' case 34: case 39: if (type !== 34 && type !== 39) delimiter(character) break // ( case 40: if (type === 41) delimiter(type) break // \ case 92: next() break } return position } /** * @param {number} type * @param {number} index * @return {number} */ function commenter (type, index) { while (next()) // // if (type + character === 47 + 10) break // /* else if (type + character === 42 + 42 && peek() === 47) break return '/*' + slice(index, position - 1) + '*' + Utility_from(type === 47 ? type : next()) } /** * @param {number} index * @return {string} */ function identifier (index) { while (!token(peek())) next() return slice(index, position) } ;// ./node_modules/stylis/src/Enum.js var Enum_MS = '-ms-' var Enum_MOZ = '-moz-' var Enum_WEBKIT = '-webkit-' var COMMENT = 'comm' var Enum_RULESET = 'rule' var Enum_DECLARATION = 'decl' var PAGE = '@page' var MEDIA = '@media' var IMPORT = '@import' var CHARSET = '@charset' var VIEWPORT = '@viewport' var SUPPORTS = '@supports' var DOCUMENT = '@document' var NAMESPACE = '@namespace' var Enum_KEYFRAMES = '@keyframes' var FONT_FACE = '@font-face' var COUNTER_STYLE = '@counter-style' var FONT_FEATURE_VALUES = '@font-feature-values' ;// ./node_modules/stylis/src/Serializer.js /** * @param {object[]} children * @param {function} callback * @return {string} */ function Serializer_serialize (children, callback) { var output = '' var length = Utility_sizeof(children) for (var i = 0; i < length; i++) output += callback(children[i], i, children, callback) || '' return output } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback * @return {string} */ function stringify (element, index, children, callback) { switch (element.type) { case IMPORT: case Enum_DECLARATION: return element.return = element.return || element.value case COMMENT: return '' case Enum_KEYFRAMES: return element.return = element.value + '{' + Serializer_serialize(element.children, callback) + '}' case Enum_RULESET: element.value = element.props.join(',') } return Utility_strlen(children = Serializer_serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' } ;// ./node_modules/stylis/src/Middleware.js /** * @param {function[]} collection * @return {function} */ function middleware (collection) { var length = Utility_sizeof(collection) return function (element, index, children, callback) { var output = '' for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || '' return output } } /** * @param {function} callback * @return {function} */ function rulesheet (callback) { return function (element) { if (!element.root) if (element = element.return) callback(element) } } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback */ function prefixer (element, index, children, callback) { if (element.length > -1) if (!element.return) switch (element.type) { case DECLARATION: element.return = prefix(element.value, element.length, children) return case KEYFRAMES: return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback) case RULESET: if (element.length) return combine(element.props, function (value) { switch (match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback) // :placeholder case '::placeholder': return serialize([ copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]}) ], callback) } return '' }) } } /** * @param {object} element * @param {number} index * @param {object[]} children */ function namespace (element) { switch (element.type) { case RULESET: element.props = element.props.map(function (value) { return combine(tokenize(value), function (value, index, children) { switch (charat(value, 0)) { // \f case 12: return substr(value, 1, strlen(value)) // \0 ( + > ~ case 0: case 40: case 43: case 62: case 126: return value // : case 58: if (children[++index] === 'global') children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1) // \s case 32: return index === 1 ? '' : value default: switch (index) { case 0: element = value return sizeof(children) > 1 ? '' : value case index = sizeof(children) - 1: case 2: return index === 2 ? value + element + element : value + element default: return value } } }) }) } } ;// ./node_modules/stylis/src/Parser.js /** * @param {string} value * @return {object[]} */ function compile (value) { return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value)) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {string[]} rule * @param {string[]} rules * @param {string[]} rulesets * @param {number[]} pseudo * @param {number[]} points * @param {string[]} declarations * @return {object} */ function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { var index = 0 var offset = 0 var length = pseudo var atrule = 0 var property = 0 var previous = 0 var variable = 1 var scanning = 1 var ampersand = 1 var character = 0 var type = '' var props = rules var children = rulesets var reference = rule var characters = type while (scanning) switch (previous = character, character = next()) { // ( case 40: if (previous != 108 && Utility_charat(characters, length - 1) == 58) { if (indexof(characters += Utility_replace(delimit(character), '&', '&\f'), '&\f') != -1) ampersand = -1 break } // " ' [ case 34: case 39: case 91: characters += delimit(character) break // \t \n \r \s case 9: case 10: case 13: case 32: characters += whitespace(previous) break // \ case 92: characters += escaping(caret() - 1, 7) continue // / case 47: switch (peek()) { case 42: case 47: Utility_append(comment(commenter(next(), caret()), root, parent), declarations) break default: characters += '/' } break // { case 123 * variable: points[index++] = Utility_strlen(characters) * ampersand // } ; \0 case 125 * variable: case 59: case 0: switch (character) { // \0 } case 0: case 125: scanning = 0 // ; case 59 + offset: if (property > 0 && (Utility_strlen(characters) - length)) Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility_replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations) break // @ ; case 59: characters += ';' // { rule/at-rule default: Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets) if (character === 123) if (offset === 0) parse(characters, root, reference, reference, props, rulesets, length, points, children) else switch (atrule === 99 && Utility_charat(characters, 3) === 110 ? 100 : atrule) { // d m s case 100: case 109: case 115: parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children) break default: parse(characters, reference, reference, reference, [''], children, 0, points, children) } } index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo break // : case 58: length = 1 + Utility_strlen(characters), property = previous default: if (variable < 1) if (character == 123) --variable else if (character == 125 && variable++ == 0 && prev() == 125) continue switch (characters += Utility_from(character), character * variable) { // & case 38: ampersand = offset > 0 ? 1 : (characters += '\f', -1) break // , case 44: points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1 break // @ case 64: // - if (peek() === 45) characters += delimit(next()) atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++ break // - case 45: if (previous === 45 && Utility_strlen(characters) == 2) variable = 0 } } return rulesets } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} index * @param {number} offset * @param {string[]} rules * @param {number[]} points * @param {string} type * @param {string[]} props * @param {string[]} children * @param {number} length * @return {object} */ function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) { var post = offset - 1 var rule = offset === 0 ? rules : [''] var size = Utility_sizeof(rule) for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) if (z = trim(j > 0 ? rule[x] + ' ' + y : Utility_replace(y, /&\f/g, rule[x]))) props[k++] = z return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length) } /** * @param {number} value * @param {object} root * @param {object?} parent * @return {object} */ function comment (value, root, parent) { return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} length * @return {object} */ function declaration (value, root, parent, length) { return node(value, root, parent, Enum_DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length) } ;// ./node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { var previous = 0; var character = 0; while (true) { previous = character; character = peek(); // &\f if (previous === 38 && character === 12) { points[index] = 1; } if (token(character)) { break; } next(); } return slice(begin, position); }; var toRules = function toRules(parsed, points) { // pretend we've started with a comma var index = -1; var character = 44; do { switch (token(character)) { case 0: // &\f if (character === 38 && peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1; } parsed[index] += identifierWithPointTracking(position - 1, points, index); break; case 2: parsed[index] += delimit(character); break; case 4: // comma if (character === 44) { // colon parsed[++index] = peek() === 58 ? '&\f' : ''; points[index] = parsed[index].length; break; } // fallthrough default: parsed[index] += Utility_from(character); } } while (character = next()); return parsed; }; var getRules = function getRules(value, points) { return dealloc(toRules(alloc(value), points)); }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 var fixedElements = /* #__PURE__ */new WeakMap(); var compat = function compat(element) { if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1) { return; } var value = element.value, parent = element.parent; var isImplicitRule = element.column === parent.column && element.line === parent.line; while (parent.type !== 'rule') { parent = parent.parent; if (!parent) return; } // short-circuit for the simplest case if (element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent)) { return; } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return; } fixedElements.set(element, true); var points = []; var rules = getRules(value, points); var parentRules = parent.props; for (var i = 0, k = 0; i < rules.length; i++) { for (var j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }; var removeLabel = function removeLabel(element) { if (element.type === 'decl') { var value = element.value; if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98) { // this ignores label element["return"] = ''; element.value = ''; } } }; var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; var isIgnoringComment = function isIgnoringComment(element) { return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; }; var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { return function (element, index, children) { if (element.type !== 'rule' || cache.compat) return; var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); if (unsafePseudoClasses) { var isNested = element.parent === children[0]; // in nested rules comments become children of the "auto-inserted" rule // // considering this input: // .a { // .b /* comm */ {} // color: hotpink; // } // we get output corresponding to this: // .a { // & { // /* comm */ // color: hotpink; // } // .b {} // } var commentContainer = isNested ? children[0].children : // global rule at the root level children; for (var i = commentContainer.length - 1; i >= 0; i--) { var node = commentContainer[i]; if (node.line < element.line) { break; } // it is quite weird but comments are *usually* put at `column: element.column - 1` // so we seek *from the end* for the node that is earlier than the rule's `element` and check that // this will also match inputs like this: // .a { // /* comm */ // .b {} // } // // but that is fine // // it would be the easiest to change the placement of the comment to be the first child of the rule: // .a { // .b { /* comm */ } // } // with such inputs we wouldn't have to search for the comment at all // TODO: consider changing this comment placement in the next major version if (node.column < element.column) { if (isIgnoringComment(node)) { return; } break; } } unsafePseudoClasses.forEach(function (unsafePseudoClass) { console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); }); } }; }; var isImportRule = function isImportRule(element) { return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; }; var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { for (var i = index - 1; i >= 0; i--) { if (!isImportRule(children[i])) { return true; } } return false; }; // use this to remove incorrect elements from further processing // so they don't get handed to the `sheet` (or anything else) // as that could potentially lead to additional logs which in turn could be overhelming to the user var nullifyElement = function nullifyElement(element) { element.type = ''; element.value = ''; element["return"] = ''; element.children = ''; element.props = ''; }; var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { if (!isImportRule(element)) { return; } if (element.parent) { console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); nullifyElement(element); } else if (isPrependedWithRegularRules(index, children)) { console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); nullifyElement(element); } }; /* eslint-disable no-fallthrough */ function emotion_cache_browser_esm_prefix(value, length) { switch (hash(value, length)) { // color-adjust case 5103: return Enum_WEBKIT + 'print-' + value + value; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return Enum_WEBKIT + value + value; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return Enum_WEBKIT + value + Enum_MOZ + value + Enum_MS + value + value; // flex, flex-direction case 6828: case 4268: return Enum_WEBKIT + value + Enum_MS + value + value; // order case 6165: return Enum_WEBKIT + value + Enum_MS + 'flex-' + value + value; // align-items case 5187: return Enum_WEBKIT + value + Utility_replace(value, /(\w+).+(:[^]+)/, Enum_WEBKIT + 'box-$1$2' + Enum_MS + 'flex-$1$2') + value; // align-self case 5443: return Enum_WEBKIT + value + Enum_MS + 'flex-item-' + Utility_replace(value, /flex-|-self/, '') + value; // align-content case 4675: return Enum_WEBKIT + value + Enum_MS + 'flex-line-pack' + Utility_replace(value, /align-content|flex-|-self/, '') + value; // flex-shrink case 5548: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'shrink', 'negative') + value; // flex-basis case 5292: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'basis', 'preferred-size') + value; // flex-grow case 6060: return Enum_WEBKIT + 'box-' + Utility_replace(value, '-grow', '') + Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'grow', 'positive') + value; // transition case 4554: return Enum_WEBKIT + Utility_replace(value, /([^-])(transform)/g, '$1' + Enum_WEBKIT + '$2') + value; // cursor case 6187: return Utility_replace(Utility_replace(Utility_replace(value, /(zoom-|grab)/, Enum_WEBKIT + '$1'), /(image-set)/, Enum_WEBKIT + '$1'), value, '') + value; // background, background-image case 5495: case 3959: return Utility_replace(value, /(image-set\([^]*)/, Enum_WEBKIT + '$1' + '$`$1'); // justify-content case 4968: return Utility_replace(Utility_replace(value, /(.+:)(flex-)?(.*)/, Enum_WEBKIT + 'box-pack:$3' + Enum_MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + Enum_WEBKIT + value + value; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return Utility_replace(value, /(.+)-inline(.+)/, Enum_WEBKIT + '$1$2') + value; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (Utility_strlen(value) - 1 - length > 6) switch (Utility_charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (Utility_charat(value, length + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return Utility_replace(value, /(.+:)(.+)-([^]+)/, '$1' + Enum_WEBKIT + '$2-$3' + '$1' + Enum_MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; // (s)tretch case 115: return ~indexof(value, 'stretch') ? emotion_cache_browser_esm_prefix(Utility_replace(value, 'stretch', 'fill-available'), length) + value : value; } break; // position: sticky case 4949: // (s)ticky? if (Utility_charat(value, length + 1) !== 115) break; // display: (flex|inline-flex) case 6444: switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) { // stic(k)y case 107: return Utility_replace(value, ':', ':' + Enum_WEBKIT) + value; // (inline-)?fl(e)x case 101: return Utility_replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + Enum_WEBKIT + (Utility_charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + Enum_WEBKIT + '$2$3' + '$1' + Enum_MS + '$2box$3') + value; } break; // writing-mode case 5936: switch (Utility_charat(value, length + 11)) { // vertical-l(r) case 114: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; // vertical-r(l) case 108: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; // horizontal(-)tb case 45: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; } return Enum_WEBKIT + value + Enum_MS + value + value; } return value; } var emotion_cache_browser_esm_prefixer = function prefixer(element, index, children, callback) { if (element.length > -1) if (!element["return"]) switch (element.type) { case Enum_DECLARATION: element["return"] = emotion_cache_browser_esm_prefix(element.value, element.length); break; case Enum_KEYFRAMES: return Serializer_serialize([Tokenizer_copy(element, { value: Utility_replace(element.value, '@', '@' + Enum_WEBKIT) })], callback); case Enum_RULESET: if (element.length) return Utility_combine(element.props, function (value) { switch (Utility_match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return Serializer_serialize([Tokenizer_copy(element, { props: [Utility_replace(value, /:(read-\w+)/, ':' + Enum_MOZ + '$1')] })], callback); // :placeholder case '::placeholder': return Serializer_serialize([Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_WEBKIT + 'input-$1')] }), Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_MOZ + '$1')] }), Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, Enum_MS + 'input-$1')] })], callback); } return ''; }); } }; var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer]; var createCache = function createCache(options) { var key = options.key; if (false) {} if ( key === 'css') { var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) // note this very very intentionally targets all style elements regardless of the key to ensure // that creating a cache works inside of render of a React component Array.prototype.forEach.call(ssrStyles, function (node) { // we want to only move elements which have a space in the data-emotion attribute value // because that indicates that it is an Emotion 11 server-side rendered style elements // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles // will not result in the Emotion 10 styles being destroyed var dataEmotionAttribute = node.getAttribute('data-emotion'); if (dataEmotionAttribute.indexOf(' ') === -1) { return; } document.head.appendChild(node); node.setAttribute('data-s', ''); }); } var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; if (false) {} var inserted = {}; var container; var nodesToHydrate = []; { container = options.container || document.head; Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which // means that the style elements we're looking at are only Emotion 11 server-rendered style elements document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe for (var i = 1; i < attrib.length; i++) { inserted[attrib[i]] = true; } nodesToHydrate.push(node); }); } var _insert; var omnipresentPlugins = [compat, removeLabel]; if (false) {} { var currentSheet; var finalizingPlugins = [stringify, false ? 0 : rulesheet(function (rule) { currentSheet.insert(rule); })]; var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); var stylis = function stylis(styles) { return Serializer_serialize(compile(styles), serializer); }; _insert = function insert(selector, serialized, sheet, shouldCache) { currentSheet = sheet; if (false) {} stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); if (shouldCache) { cache.inserted[serialized.name] = true; } }; } var cache = { key: key, sheet: new StyleSheet({ key: key, container: container, nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted: inserted, registered: {}, insert: _insert }; cache.sheet.hydrate(nodesToHydrate); return cache; }; /* harmony default export */ const emotion_cache_browser_esm = (createCache); ;// ./node_modules/@emotion/hash/dist/emotion-hash.esm.js /* eslint-disable */ // Inspired by https://github.com/garycourt/murmurhash-js // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 function murmur2(str) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. // const m = 0x5bd1e995; // const r = 24; // Initialize the hash var h = 0; // Mix 4 bytes at a time into the hash var k, i = 0, len = str.length; for (; len >= 4; ++i, len -= 4) { k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; k = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); k ^= /* k >>> r: */ k >>> 24; h = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Handle the last few bytes of the input array switch (len) { case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16; case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8; case 1: h ^= str.charCodeAt(i) & 0xff; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Do a few final mixes of the hash to ensure the last few // bytes are well-incorporated. h ^= h >>> 13; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); return ((h ^ h >>> 15) >>> 0).toString(36); } /* harmony default export */ const emotion_hash_esm = (murmur2); ;// ./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js var unitlessKeys = { animationIterationCount: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1, boxOrdinalGroup: 1, columnCount: 1, columns: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1, gridRow: 1, gridRowEnd: 1, gridRowSpan: 1, gridRowStart: 1, gridColumn: 1, gridColumnEnd: 1, gridColumnSpan: 1, gridColumnStart: 1, msGridRow: 1, msGridRowSpan: 1, msGridColumn: 1, msGridColumnSpan: 1, fontWeight: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1, zIndex: 1, zoom: 1, WebkitLineClamp: 1, // SVG-related properties fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 }; /* harmony default export */ const emotion_unitless_esm = (unitlessKeys); ;// ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js function memoize(fn) { var cache = Object.create(null); return function (arg) { if (cache[arg] === undefined) cache[arg] = fn(arg); return cache[arg]; }; } ;// ./node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; var hyphenateRegex = /[A-Z]|^ms/g; var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; var isCustomProperty = function isCustomProperty(property) { return property.charCodeAt(1) === 45; }; var isProcessableValue = function isProcessableValue(value) { return value != null && typeof value !== 'boolean'; }; var processStyleName = /* #__PURE__ */memoize(function (styleName) { return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); }); var processStyleValue = function processStyleValue(key, value) { switch (key) { case 'animation': case 'animationName': { if (typeof value === 'string') { return value.replace(animationRegex, function (match, p1, p2) { cursor = { name: p1, styles: p2, next: cursor }; return p1; }); } } } if (emotion_unitless_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { return value + 'px'; } return value; }; if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; } var noComponentSelectorMessage = (/* unused pure expression or super */ null && ('Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.')); function handleInterpolation(mergedProps, registered, interpolation) { if (interpolation == null) { return ''; } if (interpolation.__emotion_styles !== undefined) { if (false) {} return interpolation; } switch (typeof interpolation) { case 'boolean': { return ''; } case 'object': { if (interpolation.anim === 1) { cursor = { name: interpolation.name, styles: interpolation.styles, next: cursor }; return interpolation.name; } if (interpolation.styles !== undefined) { var next = interpolation.next; if (next !== undefined) { // not the most efficient thing ever but this is a pretty rare case // and there will be very few iterations of this generally while (next !== undefined) { cursor = { name: next.name, styles: next.styles, next: cursor }; next = next.next; } } var styles = interpolation.styles + ";"; if (false) {} return styles; } return createStringFromObject(mergedProps, registered, interpolation); } case 'function': { if (mergedProps !== undefined) { var previousCursor = cursor; var result = interpolation(mergedProps); cursor = previousCursor; return handleInterpolation(mergedProps, registered, result); } else if (false) {} break; } case 'string': if (false) { var replaced, matched; } break; } // finalize string values (regular strings and functions interpolated into css calls) if (registered == null) { return interpolation; } var cached = registered[interpolation]; return cached !== undefined ? cached : interpolation; } function createStringFromObject(mergedProps, registered, obj) { var string = ''; if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; } } else { for (var _key in obj) { var value = obj[_key]; if (typeof value !== 'object') { if (registered != null && registered[value] !== undefined) { string += _key + "{" + registered[value] + "}"; } else if (isProcessableValue(value)) { string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";"; } } else { if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {} if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { for (var _i = 0; _i < value.length; _i++) { if (isProcessableValue(value[_i])) { string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";"; } } } else { var interpolated = handleInterpolation(mergedProps, registered, value); switch (_key) { case 'animation': case 'animationName': { string += processStyleName(_key) + ":" + interpolated + ";"; break; } default: { if (false) {} string += _key + "{" + interpolated + "}"; } } } } } } return string; } var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g; var sourceMapPattern; if (false) {} // this is the cursor for keyframes // keyframes are stored on the SerializedStyles object as a linked list var cursor; var emotion_serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) { if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { return args[0]; } var stringMode = true; var styles = ''; cursor = undefined; var strings = args[0]; if (strings == null || strings.raw === undefined) { stringMode = false; styles += handleInterpolation(mergedProps, registered, strings); } else { if (false) {} styles += strings[0]; } // we start at 1 since we've already handled the first arg for (var i = 1; i < args.length; i++) { styles += handleInterpolation(mergedProps, registered, args[i]); if (stringMode) { if (false) {} styles += strings[i]; } } var sourceMap; if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time labelPattern.lastIndex = 0; var identifierName = ''; var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 while ((match = labelPattern.exec(styles)) !== null) { identifierName += '-' + // $FlowFixMe we know it's not null match[1]; } var name = emotion_hash_esm(styles) + identifierName; if (false) {} return { name: name, styles: styles, next: cursor }; }; ;// ./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js var syncFallback = function syncFallback(create) { return create(); }; var useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : false; var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback; var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectWithLayoutFallback = (/* unused pure expression or super */ null && (useInsertionEffect || useLayoutEffect)); ;// ./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js var emotion_element_6a883da9_browser_esm_hasOwnProperty = {}.hasOwnProperty; var EmotionCacheContext = /* #__PURE__ */(0,external_React_.createContext)( // we're doing this to avoid preconstruct's dead code elimination in this one case // because this module is primarily intended for the browser and node // but it's also required in react native and similar environments sometimes // and we could have a special build just for that // but this is much easier and the native packages // might use a different theme context in the future anyway typeof HTMLElement !== 'undefined' ? /* #__PURE__ */emotion_cache_browser_esm({ key: 'css' }) : null); if (false) {} var CacheProvider = EmotionCacheContext.Provider; var __unsafe_useEmotionCache = function useEmotionCache() { return (0,external_React_.useContext)(EmotionCacheContext); }; var emotion_element_6a883da9_browser_esm_withEmotionCache = function withEmotionCache(func) { // $FlowFixMe return /*#__PURE__*/(0,external_React_.forwardRef)(function (props, ref) { // the cache will never be null in the browser var cache = (0,external_React_.useContext)(EmotionCacheContext); return func(props, cache, ref); }); }; var emotion_element_6a883da9_browser_esm_ThemeContext = /* #__PURE__ */(0,external_React_.createContext)({}); if (false) {} var useTheme = function useTheme() { return useContext(emotion_element_6a883da9_browser_esm_ThemeContext); }; var getTheme = function getTheme(outerTheme, theme) { if (typeof theme === 'function') { var mergedTheme = theme(outerTheme); if (false) {} return mergedTheme; } if (false) {} return _extends({}, outerTheme, theme); }; var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) { return weakMemoize(function (theme) { return getTheme(outerTheme, theme); }); }))); var ThemeProvider = function ThemeProvider(props) { var theme = useContext(emotion_element_6a883da9_browser_esm_ThemeContext); if (props.theme !== theme) { theme = createCacheWithTheme(theme)(props.theme); } return /*#__PURE__*/createElement(emotion_element_6a883da9_browser_esm_ThemeContext.Provider, { value: theme }, props.children); }; function withTheme(Component) { var componentName = Component.displayName || Component.name || 'Component'; var render = function render(props, ref) { var theme = useContext(emotion_element_6a883da9_browser_esm_ThemeContext); return /*#__PURE__*/createElement(Component, _extends({ theme: theme, ref: ref }, props)); }; // $FlowFixMe var WithTheme = /*#__PURE__*/forwardRef(render); WithTheme.displayName = "WithTheme(" + componentName + ")"; return hoistNonReactStatics(WithTheme, Component); } var getLastPart = function getLastPart(functionName) { // The match may be something like 'Object.createEmotionProps' or // 'Loader.prototype.render' var parts = functionName.split('.'); return parts[parts.length - 1]; }; var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) { // V8 var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line); if (match) return getLastPart(match[1]); // Safari / Firefox match = /^([A-Za-z0-9$.]+)@/.exec(line); if (match) return getLastPart(match[1]); return undefined; }; var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS // identifiers, thus we only need to replace what is a valid character for JS, // but not for CSS. var sanitizeIdentifier = function sanitizeIdentifier(identifier) { return identifier.replace(/\$/g, '-'); }; var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) { if (!stackTrace) return undefined; var lines = stackTrace.split('\n'); for (var i = 0; i < lines.length; i++) { var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error" if (!functionName) continue; // If we reach one of these, we have gone too far and should quit if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an // uppercase letter if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName); } return undefined; }; var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__'; var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__'; var emotion_element_6a883da9_browser_esm_createEmotionProps = function createEmotionProps(type, props) { if (false) {} var newProps = {}; for (var key in props) { if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key)) { newProps[key] = props[key]; } } newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when // the label hasn't already been computed if (false) { var label; } return newProps; }; var Insertion = function Insertion(_ref) { var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag; registerStyles(cache, serialized, isStringTag); var rules = useInsertionEffectAlwaysWithSyncFallback(function () { return insertStyles(cache, serialized, isStringTag); }); return null; }; var emotion_element_6a883da9_browser_esm_Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (emotion_element_6a883da9_browser_esm_withEmotionCache(function (props, cache, ref) { var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works // not passing the registered cache to serializeStyles because it would // make certain babel optimisations not possible if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) { cssProp = cache.registered[cssProp]; } var WrappedComponent = props[typePropName]; var registeredStyles = [cssProp]; var className = ''; if (typeof props.className === 'string') { className = getRegisteredStyles(cache.registered, registeredStyles, props.className); } else if (props.className != null) { className = props.className + " "; } var serialized = serializeStyles(registeredStyles, undefined, useContext(emotion_element_6a883da9_browser_esm_ThemeContext)); if (false) { var labelFromStack; } className += cache.key + "-" + serialized.name; var newProps = {}; for (var key in props) { if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) { newProps[key] = props[key]; } } newProps.ref = ref; newProps.className = className; return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, { cache: cache, serialized: serialized, isStringTag: typeof WrappedComponent === 'string' }), /*#__PURE__*/createElement(WrappedComponent, newProps)); }))); if (false) {} ;// ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js var isBrowser = "object" !== 'undefined'; function emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) { var rawClassName = ''; classNames.split(' ').forEach(function (className) { if (registered[className] !== undefined) { registeredStyles.push(registered[className] + ";"); } else { rawClassName += className + " "; } }); return rawClassName; } var emotion_utils_browser_esm_registerStyles = function registerStyles(cache, serialized, isStringTag) { var className = cache.key + "-" + serialized.name; if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser isBrowser === false ) && cache.registered[className] === undefined) { cache.registered[className] = serialized.styles; } }; var emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) { emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag); var className = cache.key + "-" + serialized.name; if (cache.inserted[serialized.name] === undefined) { var current = serialized; do { var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); current = current.next; } while (current !== undefined); } }; ;// ./node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js function insertWithoutScoping(cache, serialized) { if (cache.inserted[serialized.name] === undefined) { return cache.insert('', serialized, cache.sheet, true); } } function merge(registered, css, className) { var registeredStyles = []; var rawClassName = emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, className); if (registeredStyles.length < 2) { return className; } return rawClassName + css(registeredStyles); } var createEmotion = function createEmotion(options) { var cache = emotion_cache_browser_esm(options); // $FlowFixMe cache.sheet.speedy = function (value) { if (false) {} this.isSpeedy = value; }; cache.compat = true; var css = function css() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered, undefined); emotion_utils_browser_esm_insertStyles(cache, serialized, false); return cache.key + "-" + serialized.name; }; var keyframes = function keyframes() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered); var animation = "animation-" + serialized.name; insertWithoutScoping(cache, { name: serialized.name, styles: "@keyframes " + animation + "{" + serialized.styles + "}" }); return animation; }; var injectGlobal = function injectGlobal() { for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered); insertWithoutScoping(cache, serialized); }; var cx = function cx() { for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } return merge(cache.registered, css, classnames(args)); }; return { css: css, cx: cx, injectGlobal: injectGlobal, keyframes: keyframes, hydrate: function hydrate(ids) { ids.forEach(function (key) { cache.inserted[key] = true; }); }, flush: function flush() { cache.registered = {}; cache.inserted = {}; cache.sheet.flush(); }, // $FlowFixMe sheet: cache.sheet, cache: cache, getRegisteredStyles: emotion_utils_browser_esm_getRegisteredStyles.bind(null, cache.registered), merge: merge.bind(null, cache.registered, css) }; }; var classnames = function classnames(args) { var cls = ''; for (var i = 0; i < args.length; i++) { var arg = args[i]; if (arg == null) continue; var toAdd = void 0; switch (typeof arg) { case 'boolean': break; case 'object': { if (Array.isArray(arg)) { toAdd = classnames(arg); } else { toAdd = ''; for (var k in arg) { if (arg[k] && k) { toAdd && (toAdd += ' '); toAdd += k; } } } break; } default: { toAdd = arg; } } if (toAdd) { cls && (cls += ' '); cls += toAdd; } } return cls; }; /* harmony default export */ const emotion_css_create_instance_esm = (createEmotion); ;// ./node_modules/@emotion/css/dist/emotion-css.esm.js var _createEmotion = emotion_css_create_instance_esm({ key: 'css' }), flush = _createEmotion.flush, hydrate = _createEmotion.hydrate, emotion_css_esm_cx = _createEmotion.cx, emotion_css_esm_merge = _createEmotion.merge, emotion_css_esm_getRegisteredStyles = _createEmotion.getRegisteredStyles, injectGlobal = _createEmotion.injectGlobal, keyframes = _createEmotion.keyframes, css = _createEmotion.css, sheet = _createEmotion.sheet, cache = _createEmotion.cache; ;// ./node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js /** * External dependencies */ // eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports /** * WordPress dependencies */ const isSerializedStyles = o => typeof o !== 'undefined' && o !== null && ['name', 'styles'].every(p => typeof o[p] !== 'undefined'); /** * Retrieve a `cx` function that knows how to handle `SerializedStyles` * returned by the `@emotion/react` `css` function in addition to what * `cx` normally knows how to handle. It also hooks into the Emotion * Cache, allowing `css` calls to work inside iframes. * * ```jsx * import { css } from '@emotion/react'; * * const styles = css` * color: red * `; * * function RedText( { className, ...props } ) { * const cx = useCx(); * * const classes = cx(styles, className); * * return <span className={classes} {...props} />; * } * ``` */ const useCx = () => { const cache = __unsafe_useEmotionCache(); const cx = (0,external_wp_element_namespaceObject.useCallback)((...classNames) => { if (cache === null) { throw new Error('The `useCx` hook should be only used within a valid Emotion Cache Context'); } return emotion_css_esm_cx(...classNames.map(arg => { if (isSerializedStyles(arg)) { emotion_utils_browser_esm_insertStyles(cache, arg, false); return `${cache.key}-${arg.name}`; } return arg; })); }, [cache]); return cx; }; ;// ./node_modules/@wordpress/components/build-module/context/use-context-system.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @template TProps * @typedef {TProps & { className: string }} ConnectedProps */ /** * Custom hook that derives registered props from the Context system. * These derived props are then consolidated with incoming component props. * * @template {{ className?: string }} P * @param {P} props Incoming props from the component. * @param {string} namespace The namespace to register and to derive context props from. * @return {ConnectedProps<P>} The connected props. */ function useContextSystem(props, namespace) { const contextSystemProps = useComponentsContext(); if (typeof namespace === 'undefined') { true ? external_wp_warning_default()('useContextSystem: Please provide a namespace') : 0; } const contextProps = contextSystemProps?.[namespace] || {}; /* eslint-disable jsdoc/no-undefined-types */ /** @type {ConnectedProps<P>} */ // @ts-ignore We fill in the missing properties below const finalComponentProps = { ...getConnectedNamespace(), ...getNamespace(namespace) }; /* eslint-enable jsdoc/no-undefined-types */ const { _overrides: overrideProps, ...otherContextProps } = contextProps; const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props; const cx = useCx(); const classes = cx(getStyledClassNameFromKey(namespace), props.className); // Provides the ability to customize the render of the component. const rendered = typeof initialMergedProps.renderChildren === 'function' ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children; for (const key in initialMergedProps) { // @ts-ignore filling in missing props finalComponentProps[key] = initialMergedProps[key]; } for (const key in overrideProps) { // @ts-ignore filling in missing props finalComponentProps[key] = overrideProps[key]; } // Setting an `undefined` explicitly can cause unintended overwrites // when a `cloneElement()` is involved. if (rendered !== undefined) { // @ts-ignore finalComponentProps.children = rendered; } finalComponentProps.className = classes; return finalComponentProps; } ;// ./node_modules/@wordpress/components/build-module/context/context-connect.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Forwards ref (React.ForwardRef) and "Connects" (or registers) a component * within the Context system under a specified namespace. * * @param Component The component to register into the Context system. * @param namespace The namespace to register the component under. * @return The connected WordPressComponent */ function contextConnect(Component, namespace) { return _contextConnect(Component, namespace, { forwardsRef: true }); } /** * "Connects" (or registers) a component within the Context system under a specified namespace. * Does not forward a ref. * * @param Component The component to register into the Context system. * @param namespace The namespace to register the component under. * @return The connected WordPressComponent */ function contextConnectWithoutRef(Component, namespace) { return _contextConnect(Component, namespace); } // This is an (experimental) evolution of the initial connect() HOC. // The hope is that we can improve render performance by removing functional // component wrappers. function _contextConnect(Component, namespace, options) { const WrappedComponent = options?.forwardsRef ? (0,external_wp_element_namespaceObject.forwardRef)(Component) : Component; if (typeof namespace === 'undefined') { true ? external_wp_warning_default()('contextConnect: Please provide a namespace') : 0; } // @ts-expect-error internal property let mergedNamespace = WrappedComponent[CONNECT_STATIC_NAMESPACE] || [namespace]; /** * Consolidate (merge) namespaces before attaching it to the WrappedComponent. */ if (Array.isArray(namespace)) { mergedNamespace = [...mergedNamespace, ...namespace]; } if (typeof namespace === 'string') { mergedNamespace = [...mergedNamespace, namespace]; } // @ts-expect-error We can't rely on inferred types here because of the // `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/4f3a11243c365f94892e479bff0b922ccc4ccda3/packages/components/src/context/wordpress-component.ts#L32-L33 return Object.assign(WrappedComponent, { [CONNECT_STATIC_NAMESPACE]: [...new Set(mergedNamespace)], displayName: namespace, selector: `.${getStyledClassNameFromKey(namespace)}` }); } /** * Attempts to retrieve the connected namespace from a component. * * @param Component The component to retrieve a namespace from. * @return The connected namespaces. */ function getConnectNamespace(Component) { if (!Component) { return []; } let namespaces = []; // @ts-ignore internal property if (Component[CONNECT_STATIC_NAMESPACE]) { // @ts-ignore internal property namespaces = Component[CONNECT_STATIC_NAMESPACE]; } // @ts-ignore if (Component.type && Component.type[CONNECT_STATIC_NAMESPACE]) { // @ts-ignore namespaces = Component.type[CONNECT_STATIC_NAMESPACE]; } return namespaces; } /** * Checks to see if a component is connected within the Context system. * * @param Component The component to retrieve a namespace from. * @param match The namespace to check. */ function hasConnectNamespace(Component, match) { if (!Component) { return false; } if (typeof match === 'string') { return getConnectNamespace(Component).includes(match); } if (Array.isArray(match)) { return match.some(result => getConnectNamespace(Component).includes(result)); } return false; } ;// ./node_modules/@wordpress/components/build-module/visually-hidden/styles.js /** * External dependencies */ const visuallyHidden = { border: 0, clip: 'rect(1px, 1px, 1px, 1px)', WebkitClipPath: 'inset( 50% )', clipPath: 'inset( 50% )', height: '1px', margin: '-1px', overflow: 'hidden', padding: 0, position: 'absolute', width: '1px', wordWrap: 'normal' }; ;// ./node_modules/@babel/runtime/helpers/esm/extends.js function extends_extends() { return extends_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, extends_extends.apply(null, arguments); } ;// ./node_modules/@emotion/styled/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23 var isPropValid = /* #__PURE__ */memoize(function (prop) { return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 /* o */ && prop.charCodeAt(1) === 110 /* n */ && prop.charCodeAt(2) < 91; } /* Z+1 */ ); ;// ./node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js var testOmitPropsOnStringTag = isPropValid; var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) { return key !== 'theme'; }; var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) { return typeof tag === 'string' && // 96 is one less than the char code // for "a" so this is checking that // it's a lowercase character tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent; }; var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) { var shouldForwardProp; if (options) { var optionsShouldForwardProp = options.shouldForwardProp; shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) { return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName); } : optionsShouldForwardProp; } if (typeof shouldForwardProp !== 'function' && isReal) { shouldForwardProp = tag.__emotion_forwardProp; } return shouldForwardProp; }; var emotion_styled_base_browser_esm_ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var emotion_styled_base_browser_esm_Insertion = function Insertion(_ref) { var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag; emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag); var rules = emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback(function () { return emotion_utils_browser_esm_insertStyles(cache, serialized, isStringTag); }); return null; }; var createStyled = function createStyled(tag, options) { if (false) {} var isReal = tag.__emotion_real === tag; var baseTag = isReal && tag.__emotion_base || tag; var identifierName; var targetClassName; if (options !== undefined) { identifierName = options.label; targetClassName = options.target; } var shouldForwardProp = composeShouldForwardProps(tag, options, isReal); var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag); var shouldUseAs = !defaultShouldForwardProp('as'); return function () { var args = arguments; var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : []; if (identifierName !== undefined) { styles.push("label:" + identifierName + ";"); } if (args[0] == null || args[0].raw === undefined) { styles.push.apply(styles, args); } else { if (false) {} styles.push(args[0][0]); var len = args.length; var i = 1; for (; i < len; i++) { if (false) {} styles.push(args[i], args[0][i]); } } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class var Styled = emotion_element_6a883da9_browser_esm_withEmotionCache(function (props, cache, ref) { var FinalTag = shouldUseAs && props.as || baseTag; var className = ''; var classInterpolations = []; var mergedProps = props; if (props.theme == null) { mergedProps = {}; for (var key in props) { mergedProps[key] = props[key]; } mergedProps.theme = (0,external_React_.useContext)(emotion_element_6a883da9_browser_esm_ThemeContext); } if (typeof props.className === 'string') { className = emotion_utils_browser_esm_getRegisteredStyles(cache.registered, classInterpolations, props.className); } else if (props.className != null) { className = props.className + " "; } var serialized = emotion_serialize_browser_esm_serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps); className += cache.key + "-" + serialized.name; if (targetClassName !== undefined) { className += " " + targetClassName; } var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp; var newProps = {}; for (var _key in props) { if (shouldUseAs && _key === 'as') continue; if ( // $FlowFixMe finalShouldForwardProp(_key)) { newProps[_key] = props[_key]; } } newProps.className = className; newProps.ref = ref; return /*#__PURE__*/(0,external_React_.createElement)(external_React_.Fragment, null, /*#__PURE__*/(0,external_React_.createElement)(emotion_styled_base_browser_esm_Insertion, { cache: cache, serialized: serialized, isStringTag: typeof FinalTag === 'string' }), /*#__PURE__*/(0,external_React_.createElement)(FinalTag, newProps)); }); Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")"; Styled.defaultProps = tag.defaultProps; Styled.__emotion_real = Styled; Styled.__emotion_base = baseTag; Styled.__emotion_styles = styles; Styled.__emotion_forwardProp = shouldForwardProp; Object.defineProperty(Styled, 'toString', { value: function value() { if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string return "." + targetClassName; } }); Styled.withComponent = function (nextTag, nextOptions) { return createStyled(nextTag, extends_extends({}, options, nextOptions, { shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true) })).apply(void 0, styles); }; return Styled; }; }; /* harmony default export */ const emotion_styled_base_browser_esm = (createStyled); ;// ./node_modules/@wordpress/components/build-module/view/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const PolymorphicDiv = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e19lxcc00" } : 0)( true ? "" : 0); function UnforwardedView({ as, ...restProps }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PolymorphicDiv, { as: as, ref: ref, ...restProps }); } /** * `View` is a core component that renders everything in the library. * It is the principle component in the entire library. * * ```jsx * import { View } from `@wordpress/components`; * * function Example() { * return ( * <View> * Code is Poetry * </View> * ); * } * ``` */ const View = Object.assign((0,external_wp_element_namespaceObject.forwardRef)(UnforwardedView), { selector: '.components-view' }); /* harmony default export */ const component = (View); ;// ./node_modules/@wordpress/components/build-module/visually-hidden/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedVisuallyHidden(props, forwardedRef) { const { style: styleProp, ...contextProps } = useContextSystem(props, 'VisuallyHidden'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ref: forwardedRef, ...contextProps, style: { ...visuallyHidden, ...(styleProp || {}) } }); } /** * `VisuallyHidden` is a component used to render text intended to be visually * hidden, but will show for alternate devices, for example a screen reader. * * ```jsx * import { VisuallyHidden } from `@wordpress/components`; * * function Example() { * return ( * <VisuallyHidden> * <label>Code is Poetry</label> * </VisuallyHidden> * ); * } * ``` */ const component_VisuallyHidden = contextConnect(UnconnectedVisuallyHidden, 'VisuallyHidden'); /* harmony default export */ const visually_hidden_component = (component_VisuallyHidden); ;// ./node_modules/@wordpress/components/build-module/alignment-matrix-control/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ const GRID = [['top left', 'top center', 'top right'], ['center left', 'center center', 'center right'], ['bottom left', 'bottom center', 'bottom right']]; // Stored as map as i18n __() only accepts strings (not variables) const ALIGNMENT_LABEL = { 'top left': (0,external_wp_i18n_namespaceObject.__)('Top Left'), 'top center': (0,external_wp_i18n_namespaceObject.__)('Top Center'), 'top right': (0,external_wp_i18n_namespaceObject.__)('Top Right'), 'center left': (0,external_wp_i18n_namespaceObject.__)('Center Left'), 'center center': (0,external_wp_i18n_namespaceObject.__)('Center'), center: (0,external_wp_i18n_namespaceObject.__)('Center'), 'center right': (0,external_wp_i18n_namespaceObject.__)('Center Right'), 'bottom left': (0,external_wp_i18n_namespaceObject.__)('Bottom Left'), 'bottom center': (0,external_wp_i18n_namespaceObject.__)('Bottom Center'), 'bottom right': (0,external_wp_i18n_namespaceObject.__)('Bottom Right') }; // Transforms GRID into a flat Array of values. const ALIGNMENTS = GRID.flat(); /** * Normalizes and transforms an incoming value to better match the alignment values * * @param value An alignment value to parse. * * @return The parsed value. */ function normalize(value) { const normalized = value === 'center' ? 'center center' : value; // Strictly speaking, this could be `string | null | undefined`, // but will be validated shortly, so we're typecasting to an // `AlignmentMatrixControlValue` to keep TypeScript happy. const transformed = normalized?.replace('-', ' '); return ALIGNMENTS.includes(transformed) ? transformed : undefined; } /** * Creates an item ID based on a prefix ID and an alignment value. * * @param prefixId An ID to prefix. * @param value An alignment value. * * @return The item id. */ function getItemId(prefixId, value) { const normalized = normalize(value); if (!normalized) { return; } const id = normalized.replace(' ', '-'); return `${prefixId}-${id}`; } /** * Extracts an item value from its ID * * @param prefixId An ID prefix to remove * @param id An item ID * @return The item value */ function getItemValue(prefixId, id) { const value = id?.replace(prefixId + '-', ''); return normalize(value); } /** * Retrieves the alignment index from a value. * * @param alignment Value to check. * * @return The index of a matching alignment. */ function getAlignmentIndex(alignment = 'center') { const normalized = normalize(alignment); if (!normalized) { return undefined; } const index = ALIGNMENTS.indexOf(normalized); return index > -1 ? index : undefined; } // EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js var hoist_non_react_statics_cjs = __webpack_require__(1880); ;// ./node_modules/@emotion/react/dist/emotion-react.browser.esm.js var pkg = { name: "@emotion/react", version: "11.10.6", main: "dist/emotion-react.cjs.js", module: "dist/emotion-react.esm.js", browser: { "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js" }, exports: { ".": { module: { worker: "./dist/emotion-react.worker.esm.js", browser: "./dist/emotion-react.browser.esm.js", "default": "./dist/emotion-react.esm.js" }, "default": "./dist/emotion-react.cjs.js" }, "./jsx-runtime": { module: { worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js", browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js", "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js" }, "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js" }, "./_isolated-hnrs": { module: { worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js", browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js", "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js" }, "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js" }, "./jsx-dev-runtime": { module: { worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js", browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js", "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js" }, "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js" }, "./package.json": "./package.json", "./types/css-prop": "./types/css-prop.d.ts", "./macro": "./macro.js" }, types: "types/index.d.ts", files: [ "src", "dist", "jsx-runtime", "jsx-dev-runtime", "_isolated-hnrs", "types/*.d.ts", "macro.js", "macro.d.ts", "macro.js.flow" ], sideEffects: false, author: "Emotion Contributors", license: "MIT", scripts: { "test:typescript": "dtslint types" }, dependencies: { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.10.6", "@emotion/cache": "^11.10.5", "@emotion/serialize": "^1.1.1", "@emotion/use-insertion-effect-with-fallbacks": "^1.0.0", "@emotion/utils": "^1.2.0", "@emotion/weak-memoize": "^0.3.0", "hoist-non-react-statics": "^3.3.1" }, peerDependencies: { react: ">=16.8.0" }, peerDependenciesMeta: { "@types/react": { optional: true } }, devDependencies: { "@definitelytyped/dtslint": "0.0.112", "@emotion/css": "11.10.6", "@emotion/css-prettifier": "1.1.1", "@emotion/server": "11.10.0", "@emotion/styled": "11.10.6", "html-tag-names": "^1.1.2", react: "16.14.0", "svg-tag-names": "^1.1.1", typescript: "^4.5.5" }, repository: "https://github.com/emotion-js/emotion/tree/main/packages/react", publishConfig: { access: "public" }, "umd:main": "dist/emotion-react.umd.min.js", preconstruct: { entrypoints: [ "./index.js", "./jsx-runtime.js", "./jsx-dev-runtime.js", "./_isolated-hnrs.js" ], umdName: "emotionReact", exports: { envConditions: [ "browser", "worker" ], extra: { "./types/css-prop": "./types/css-prop.d.ts", "./macro": "./macro.js" } } } }; var jsx = function jsx(type, props) { var args = arguments; if (props == null || !hasOwnProperty.call(props, 'css')) { // $FlowFixMe return createElement.apply(undefined, args); } var argsLength = args.length; var createElementArgArray = new Array(argsLength); createElementArgArray[0] = Emotion; createElementArgArray[1] = createEmotionProps(type, props); for (var i = 2; i < argsLength; i++) { createElementArgArray[i] = args[i]; } // $FlowFixMe return createElement.apply(null, createElementArgArray); }; var warnedAboutCssPropForGlobal = false; // maintain place over rerenders. // initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild // initial client-side render from SSR, use place of hydrating tag var Global = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) { if (false) {} var styles = props.styles; var serialized = serializeStyles([styles], undefined, useContext(ThemeContext)); // but it is based on a constant that will never change at runtime // it's effectively like having two implementations and switching them out // so it's not actually breaking anything var sheetRef = useRef(); useInsertionEffectWithLayoutFallback(function () { var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675 var sheet = new cache.sheet.constructor({ key: key, nonce: cache.sheet.nonce, container: cache.sheet.container, speedy: cache.sheet.isSpeedy }); var rehydrating = false; // $FlowFixMe var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]"); if (cache.sheet.tags.length) { sheet.before = cache.sheet.tags[0]; } if (node !== null) { rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s node.setAttribute('data-emotion', key); sheet.hydrate([node]); } sheetRef.current = [sheet, rehydrating]; return function () { sheet.flush(); }; }, [cache]); useInsertionEffectWithLayoutFallback(function () { var sheetRefCurrent = sheetRef.current; var sheet = sheetRefCurrent[0], rehydrating = sheetRefCurrent[1]; if (rehydrating) { sheetRefCurrent[1] = false; return; } if (serialized.next !== undefined) { // insert keyframes insertStyles(cache, serialized.next, true); } if (sheet.tags.length) { // if this doesn't exist then it will be null so the style element will be appended var element = sheet.tags[sheet.tags.length - 1].nextElementSibling; sheet.before = element; sheet.flush(); } cache.insert("", serialized, sheet, false); }, [cache, serialized.name]); return null; }))); if (false) {} function emotion_react_browser_esm_css() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return emotion_serialize_browser_esm_serializeStyles(args); } var emotion_react_browser_esm_keyframes = function keyframes() { var insertable = emotion_react_browser_esm_css.apply(void 0, arguments); var name = "animation-" + insertable.name; // $FlowFixMe return { name: name, styles: "@keyframes " + name + "{" + insertable.styles + "}", anim: 1, toString: function toString() { return "_EMO_" + this.name + "_" + this.styles + "_EMO_"; } }; }; var emotion_react_browser_esm_classnames = function classnames(args) { var len = args.length; var i = 0; var cls = ''; for (; i < len; i++) { var arg = args[i]; if (arg == null) continue; var toAdd = void 0; switch (typeof arg) { case 'boolean': break; case 'object': { if (Array.isArray(arg)) { toAdd = classnames(arg); } else { if (false) {} toAdd = ''; for (var k in arg) { if (arg[k] && k) { toAdd && (toAdd += ' '); toAdd += k; } } } break; } default: { toAdd = arg; } } if (toAdd) { cls && (cls += ' '); cls += toAdd; } } return cls; }; function emotion_react_browser_esm_merge(registered, css, className) { var registeredStyles = []; var rawClassName = getRegisteredStyles(registered, registeredStyles, className); if (registeredStyles.length < 2) { return className; } return rawClassName + css(registeredStyles); } var emotion_react_browser_esm_Insertion = function Insertion(_ref) { var cache = _ref.cache, serializedArr = _ref.serializedArr; var rules = useInsertionEffectAlwaysWithSyncFallback(function () { for (var i = 0; i < serializedArr.length; i++) { var res = insertStyles(cache, serializedArr[i], false); } }); return null; }; var ClassNames = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) { var hasRendered = false; var serializedArr = []; var css = function css() { if (hasRendered && "production" !== 'production') {} for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var serialized = serializeStyles(args, cache.registered); serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx` registerStyles(cache, serialized, false); return cache.key + "-" + serialized.name; }; var cx = function cx() { if (hasRendered && "production" !== 'production') {} for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return emotion_react_browser_esm_merge(cache.registered, css, emotion_react_browser_esm_classnames(args)); }; var content = { css: css, cx: cx, theme: useContext(ThemeContext) }; var ele = props.children(content); hasRendered = true; return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(emotion_react_browser_esm_Insertion, { cache: cache, serializedArr: serializedArr }), ele); }))); if (false) {} if (false) { var globalKey, globalContext, isTestEnv, emotion_react_browser_esm_isBrowser; } ;// ./node_modules/@wordpress/components/build-module/utils/space.js /** * The argument value for the `space()` utility function. * * When this is a number or a numeric string, it will be interpreted as a * multiplier for the grid base value (4px). For example, `space( 2 )` will be 8px. * * Otherwise, it will be interpreted as a literal CSS length value. For example, * `space( 'auto' )` will be 'auto', and `space( '2px' )` will be 2px. */ const GRID_BASE = '4px'; /** * A function that handles numbers, numeric strings, and unit values. * * When given a number or a numeric string, it will return the grid-based * value as a factor of GRID_BASE, defined above. * * When given a unit value or one of the named CSS values like `auto`, * it will simply return the value back. * * @param value A number, numeric string, or a unit value. */ function space(value) { if (typeof value === 'undefined') { return undefined; } // Handle empty strings, if it's the number 0 this still works. if (!value) { return '0'; } const asInt = typeof value === 'number' ? value : Number(value); // Test if the input has a unit, was NaN, or was one of the named CSS values (like `auto`), in which case just use that value. if (typeof window !== 'undefined' && window.CSS?.supports?.('margin', value.toString()) || Number.isNaN(asInt)) { return value.toString(); } return `calc(${GRID_BASE} * ${value})`; } ;// ./node_modules/@wordpress/components/build-module/utils/colors-values.js /** * Internal dependencies */ const white = '#fff'; // Matches the grays in @wordpress/base-styles const GRAY = { 900: '#1e1e1e', 800: '#2f2f2f', /** Meets 4.6:1 text contrast against white. */ 700: '#757575', /** Meets 3:1 UI or large text contrast against white. */ 600: '#949494', 400: '#ccc', /** Used for most borders. */ 300: '#ddd', /** Used sparingly for light borders. */ 200: '#e0e0e0', /** Used for light gray backgrounds. */ 100: '#f0f0f0' }; // Matches @wordpress/base-styles const ALERT = { yellow: '#f0b849', red: '#d94f4f', green: '#4ab866' }; // Should match packages/components/src/utils/theme-variables.scss const THEME = { accent: `var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))`, accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`, accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`, /** Used when placing text on the accent color. */ accentInverted: `var(--wp-components-color-accent-inverted, ${white})`, background: `var(--wp-components-color-background, ${white})`, foreground: `var(--wp-components-color-foreground, ${GRAY[900]})`, /** Used when placing text on the foreground color. */ foregroundInverted: `var(--wp-components-color-foreground-inverted, ${white})`, gray: { /** @deprecated Use `COLORS.theme.foreground` instead. */ 900: `var(--wp-components-color-foreground, ${GRAY[900]})`, 800: `var(--wp-components-color-gray-800, ${GRAY[800]})`, 700: `var(--wp-components-color-gray-700, ${GRAY[700]})`, 600: `var(--wp-components-color-gray-600, ${GRAY[600]})`, 400: `var(--wp-components-color-gray-400, ${GRAY[400]})`, 300: `var(--wp-components-color-gray-300, ${GRAY[300]})`, 200: `var(--wp-components-color-gray-200, ${GRAY[200]})`, 100: `var(--wp-components-color-gray-100, ${GRAY[100]})` } }; const UI = { background: THEME.background, backgroundDisabled: THEME.gray[100], border: THEME.gray[600], borderHover: THEME.gray[700], borderFocus: THEME.accent, borderDisabled: THEME.gray[400], textDisabled: THEME.gray[600], // Matches @wordpress/base-styles darkGrayPlaceholder: `color-mix(in srgb, ${THEME.foreground}, transparent 38%)`, lightGrayPlaceholder: `color-mix(in srgb, ${THEME.background}, transparent 35%)` }; const COLORS = Object.freeze({ /** * The main gray color object. * * @deprecated Use semantic aliases in `COLORS.ui` or theme-ready variables in `COLORS.theme.gray`. */ gray: GRAY, // TODO: Stop exporting this when everything is migrated to `theme` or `ui` /** * @deprecated Prefer theme-ready variables in `COLORS.theme`. */ white, alert: ALERT, /** * Theme-ready variables with fallbacks. * * Prefer semantic aliases in `COLORS.ui` when applicable. */ theme: THEME, /** * Semantic aliases (prefer these over raw variables when applicable). */ ui: UI }); /* harmony default export */ const colors_values = ((/* unused pure expression or super */ null && (COLORS))); ;// ./node_modules/@wordpress/components/build-module/utils/config-values.js /** * Internal dependencies */ const CONTROL_HEIGHT = '36px'; const CONTROL_PROPS = { // These values should be shared with TextControl. controlPaddingX: 12, controlPaddingXSmall: 8, controlPaddingXLarge: 12 * 1.3334, // TODO: Deprecate controlBoxShadowFocus: `0 0 0 0.5px ${COLORS.theme.accent}`, controlHeight: CONTROL_HEIGHT, controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`, controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`, controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`, controlHeightXLarge: `calc( ${CONTROL_HEIGHT} * 1.4 )` }; // Using Object.assign to avoid creating circular references when emitting // TypeScript type declarations. /* harmony default export */ const config_values = (Object.assign({}, CONTROL_PROPS, { colorDivider: 'rgba(0, 0, 0, 0.1)', colorScrollbarThumb: 'rgba(0, 0, 0, 0.2)', colorScrollbarThumbHover: 'rgba(0, 0, 0, 0.5)', colorScrollbarTrack: 'rgba(0, 0, 0, 0.04)', elevationIntensity: 1, radiusXSmall: '1px', radiusSmall: '2px', radiusMedium: '4px', radiusLarge: '8px', radiusFull: '9999px', radiusRound: '50%', borderWidth: '1px', borderWidthFocus: '1.5px', borderWidthTab: '4px', spinnerSize: 16, fontSize: '13px', fontSizeH1: 'calc(2.44 * 13px)', fontSizeH2: 'calc(1.95 * 13px)', fontSizeH3: 'calc(1.56 * 13px)', fontSizeH4: 'calc(1.25 * 13px)', fontSizeH5: '13px', fontSizeH6: 'calc(0.8 * 13px)', fontSizeInputMobile: '16px', fontSizeMobile: '15px', fontSizeSmall: 'calc(0.92 * 13px)', fontSizeXSmall: 'calc(0.75 * 13px)', fontLineHeightBase: '1.4', fontWeight: 'normal', fontWeightHeading: '600', gridBase: '4px', cardPaddingXSmall: `${space(2)}`, cardPaddingSmall: `${space(4)}`, cardPaddingMedium: `${space(4)} ${space(6)}`, cardPaddingLarge: `${space(6)} ${space(8)}`, elevationXSmall: `0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01)`, elevationSmall: `0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 3px rgba(0, 0, 0, 0.04), 0 6px 6px rgba(0, 0, 0, 0.03), 0 8px 8px rgba(0, 0, 0, 0.02)`, elevationMedium: `0 2px 3px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.04), 0 12px 12px rgba(0, 0, 0, 0.03), 0 16px 16px rgba(0, 0, 0, 0.02)`, elevationLarge: `0 5px 15px rgba(0, 0, 0, 0.08), 0 15px 27px rgba(0, 0, 0, 0.07), 0 30px 36px rgba(0, 0, 0, 0.04), 0 50px 43px rgba(0, 0, 0, 0.02)`, surfaceBackgroundColor: COLORS.white, surfaceBackgroundSubtleColor: '#F3F3F3', surfaceBackgroundTintColor: '#F5F5F5', surfaceBorderColor: 'rgba(0, 0, 0, 0.1)', surfaceBorderBoldColor: 'rgba(0, 0, 0, 0.15)', surfaceBorderSubtleColor: 'rgba(0, 0, 0, 0.05)', surfaceBackgroundTertiaryColor: COLORS.white, surfaceColor: COLORS.white, transitionDuration: '200ms', transitionDurationFast: '160ms', transitionDurationFaster: '120ms', transitionDurationFastest: '100ms', transitionTimingFunction: 'cubic-bezier(0.08, 0.52, 0.52, 1)', transitionTimingFunctionControl: 'cubic-bezier(0.12, 0.8, 0.32, 1)' })); ;// ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles.js function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ // Grid structure const rootBase = ({ size = 92 }) => /*#__PURE__*/emotion_react_browser_esm_css("direction:ltr;display:grid;grid-template-columns:repeat( 3, 1fr );grid-template-rows:repeat( 3, 1fr );box-sizing:border-box;width:", size, "px;aspect-ratio:1;border-radius:", config_values.radiusMedium, ";outline:none;" + ( true ? "" : 0), true ? "" : 0); var _ref = true ? { name: "e0dnmk", styles: "cursor:pointer" } : 0; const GridContainer = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1r95csn3" } : 0)(rootBase, " border:1px solid transparent;", props => props.disablePointerEvents ? /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0) : _ref, ";" + ( true ? "" : 0)); const GridRow = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1r95csn2" } : 0)( true ? { name: "1fbxn64", styles: "grid-column:1/-1;box-sizing:border-box;display:grid;grid-template-columns:repeat( 3, 1fr )" } : 0); // Cell const Cell = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1r95csn1" } : 0)( true ? { name: "e2kws5", styles: "position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;margin:0;padding:0;appearance:none;border:none;outline:none" } : 0); const POINT_SIZE = 6; const Point = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1r95csn0" } : 0)("display:block;contain:strict;box-sizing:border-box;width:", POINT_SIZE, "px;aspect-ratio:1;margin:auto;color:", COLORS.theme.gray[400], ";border:", POINT_SIZE / 2, "px solid currentColor;", Cell, "[data-active-item] &{color:", COLORS.gray[900], ";transform:scale( calc( 5 / 3 ) );}", Cell, ":not([data-active-item]):hover &{color:", COLORS.theme.accent, ";}", Cell, "[data-focus-visible] &{outline:1px solid ", COLORS.theme.accent, ";outline-offset:1px;}@media not ( prefers-reduced-motion ){transition-property:color,transform;transition-duration:120ms;transition-timing-function:linear;}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/alignment-matrix-control/cell.js /** * Internal dependencies */ /** * Internal dependencies */ function cell_Cell({ id, value, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tooltip, { text: ALIGNMENT_LABEL[value], children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Composite.Item, { id: id, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Cell, { ...props, role: "gridcell" }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { children: value }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Point, { role: "presentation" })] }) }); } ;// ./node_modules/@wordpress/components/build-module/alignment-matrix-control/icon.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const BASE_SIZE = 24; const GRID_CELL_SIZE = 7; const GRID_PADDING = (BASE_SIZE - 3 * GRID_CELL_SIZE) / 2; const DOT_SIZE = 2; const DOT_SIZE_SELECTED = 4; function AlignmentMatrixControlIcon({ className, disablePointerEvents = true, size, width, height, style = {}, value = 'center', ...props }) { var _ref, _ref2; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${BASE_SIZE} ${BASE_SIZE}`, width: (_ref = size !== null && size !== void 0 ? size : width) !== null && _ref !== void 0 ? _ref : BASE_SIZE, height: (_ref2 = size !== null && size !== void 0 ? size : height) !== null && _ref2 !== void 0 ? _ref2 : BASE_SIZE, role: "presentation", className: dist_clsx('component-alignment-matrix-control-icon', className), style: { pointerEvents: disablePointerEvents ? 'none' : undefined, ...style }, ...props, children: ALIGNMENTS.map((align, index) => { const dotSize = getAlignmentIndex(value) === index ? DOT_SIZE_SELECTED : DOT_SIZE; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Rect, { x: GRID_PADDING + index % 3 * GRID_CELL_SIZE + (GRID_CELL_SIZE - dotSize) / 2, y: GRID_PADDING + Math.floor(index / 3) * GRID_CELL_SIZE + (GRID_CELL_SIZE - dotSize) / 2, width: dotSize, height: dotSize, fill: "currentColor" }, align); }) }); } /* harmony default export */ const icon = (AlignmentMatrixControlIcon); ;// ./node_modules/@wordpress/components/build-module/alignment-matrix-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedAlignmentMatrixControl({ className, id, label = (0,external_wp_i18n_namespaceObject.__)('Alignment Matrix Control'), defaultValue = 'center center', value, onChange, width = 92, ...props }) { const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(UnforwardedAlignmentMatrixControl, 'alignment-matrix-control', id); const setActiveId = (0,external_wp_element_namespaceObject.useCallback)(nextActiveId => { const nextValue = getItemValue(baseId, nextActiveId); if (nextValue) { onChange?.(nextValue); } }, [baseId, onChange]); const classes = dist_clsx('component-alignment-matrix-control', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Composite, { defaultActiveId: getItemId(baseId, defaultValue), activeId: getItemId(baseId, value), setActiveId: setActiveId, rtl: (0,external_wp_i18n_namespaceObject.isRTL)(), render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridContainer, { ...props, "aria-label": label, className: classes, id: baseId, role: "grid", size: width }), children: GRID.map((cells, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Composite.Row, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridRow, { role: "row" }), children: cells.map(cell => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cell_Cell, { id: getItemId(baseId, cell), value: cell }, cell)) }, index)) }); } /** * AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI. * * ```jsx * import { AlignmentMatrixControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const Example = () => { * const [ alignment, setAlignment ] = useState( 'center center' ); * * return ( * <AlignmentMatrixControl * value={ alignment } * onChange={ setAlignment } * /> * ); * }; * ``` */ const AlignmentMatrixControl = Object.assign(UnforwardedAlignmentMatrixControl, { /** * Render an alignment matrix as an icon. * * ```jsx * import { AlignmentMatrixControl } from '@wordpress/components'; * * <Icon icon={<AlignmentMatrixControl.Icon value="top left" />} /> * ``` */ Icon: Object.assign(icon, { displayName: 'AlignmentMatrixControl.Icon' }) }); /* harmony default export */ const alignment_matrix_control = (AlignmentMatrixControl); ;// ./node_modules/@wordpress/components/build-module/animate/index.js /** * External dependencies */ /** * Internal dependencies */ /** * @param type The animation type * @return Default origin */ function getDefaultOrigin(type) { return type === 'appear' ? 'top' : 'left'; } /** * @param options * * @return ClassName that applies the animations */ function getAnimateClassName(options) { if (options.type === 'loading') { return 'components-animate__loading'; } const { type, origin = getDefaultOrigin(type) } = options; if (type === 'appear') { const [yAxis, xAxis = 'center'] = origin.split(' '); return dist_clsx('components-animate__appear', { ['is-from-' + xAxis]: xAxis !== 'center', ['is-from-' + yAxis]: yAxis !== 'middle' }); } if (type === 'slide-in') { return dist_clsx('components-animate__slide-in', 'is-from-' + origin); } return undefined; } /** * Simple interface to introduce animations to components. * * ```jsx * import { Animate, Notice } from '@wordpress/components'; * * const MyAnimatedNotice = () => ( * <Animate type="slide-in" options={ { origin: 'top' } }> * { ( { className } ) => ( * <Notice className={ className } status="success"> * <p>Animation finished.</p> * </Notice> * ) } * </Animate> * ); * ``` */ function Animate({ type, options = {}, children }) { return children({ className: getAnimateClassName({ type, ...options }) }); } /* harmony default export */ const animate = (Animate); ;// ./node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs /** * @public */ const MotionConfigContext = (0,external_React_.createContext)({ transformPagePoint: (p) => p, isStatic: false, reducedMotion: "never", }); ;// ./node_modules/framer-motion/dist/es/context/MotionContext/index.mjs const MotionContext = (0,external_React_.createContext)({}); ;// ./node_modules/framer-motion/dist/es/context/PresenceContext.mjs /** * @public */ const PresenceContext_PresenceContext = (0,external_React_.createContext)(null); ;// ./node_modules/framer-motion/dist/es/utils/is-browser.mjs const is_browser_isBrowser = typeof document !== "undefined"; ;// ./node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs const useIsomorphicLayoutEffect = is_browser_isBrowser ? external_React_.useLayoutEffect : external_React_.useEffect; ;// ./node_modules/framer-motion/dist/es/context/LazyContext.mjs const LazyContext = (0,external_React_.createContext)({ strict: false }); ;// ./node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs /** * Convert camelCase to dash-case properties. */ const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(); ;// ./node_modules/framer-motion/dist/es/animation/optimized-appear/data-id.mjs const optimizedAppearDataId = "framerAppearId"; const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId); ;// ./node_modules/framer-motion/dist/es/utils/GlobalConfig.mjs const MotionGlobalConfig = { skipAnimations: false, useManualTiming: false, }; ;// ./node_modules/framer-motion/dist/es/frameloop/render-step.mjs class Queue { constructor() { this.order = []; this.scheduled = new Set(); } add(process) { if (!this.scheduled.has(process)) { this.scheduled.add(process); this.order.push(process); return true; } } remove(process) { const index = this.order.indexOf(process); if (index !== -1) { this.order.splice(index, 1); this.scheduled.delete(process); } } clear() { this.order.length = 0; this.scheduled.clear(); } } function createRenderStep(runNextFrame) { /** * We create and reuse two queues, one to queue jobs for the current frame * and one for the next. We reuse to avoid triggering GC after x frames. */ let thisFrame = new Queue(); let nextFrame = new Queue(); let numToRun = 0; /** * Track whether we're currently processing jobs in this step. This way * we can decide whether to schedule new jobs for this frame or next. */ let isProcessing = false; let flushNextFrame = false; /** * A set of processes which were marked keepAlive when scheduled. */ const toKeepAlive = new WeakSet(); const step = { /** * Schedule a process to run on the next frame. */ schedule: (callback, keepAlive = false, immediate = false) => { const addToCurrentFrame = immediate && isProcessing; const queue = addToCurrentFrame ? thisFrame : nextFrame; if (keepAlive) toKeepAlive.add(callback); if (queue.add(callback) && addToCurrentFrame && isProcessing) { // If we're adding it to the currently running queue, update its measured size numToRun = thisFrame.order.length; } return callback; }, /** * Cancel the provided callback from running on the next frame. */ cancel: (callback) => { nextFrame.remove(callback); toKeepAlive.delete(callback); }, /** * Execute all schedule callbacks. */ process: (frameData) => { /** * If we're already processing we've probably been triggered by a flushSync * inside an existing process. Instead of executing, mark flushNextFrame * as true and ensure we flush the following frame at the end of this one. */ if (isProcessing) { flushNextFrame = true; return; } isProcessing = true; [thisFrame, nextFrame] = [nextFrame, thisFrame]; // Clear the next frame queue nextFrame.clear(); // Execute this frame numToRun = thisFrame.order.length; if (numToRun) { for (let i = 0; i < numToRun; i++) { const callback = thisFrame.order[i]; if (toKeepAlive.has(callback)) { step.schedule(callback); runNextFrame(); } callback(frameData); } } isProcessing = false; if (flushNextFrame) { flushNextFrame = false; step.process(frameData); } }, }; return step; } ;// ./node_modules/framer-motion/dist/es/frameloop/batcher.mjs const stepsOrder = [ "read", // Read "resolveKeyframes", // Write/Read/Write/Read "update", // Compute "preRender", // Compute "render", // Write "postRender", // Compute ]; const maxElapsed = 40; function createRenderBatcher(scheduleNextBatch, allowKeepAlive) { let runNextFrame = false; let useDefaultElapsed = true; const state = { delta: 0, timestamp: 0, isProcessing: false, }; const steps = stepsOrder.reduce((acc, key) => { acc[key] = createRenderStep(() => (runNextFrame = true)); return acc; }, {}); const processStep = (stepId) => { steps[stepId].process(state); }; const processBatch = () => { const timestamp = MotionGlobalConfig.useManualTiming ? state.timestamp : performance.now(); runNextFrame = false; state.delta = useDefaultElapsed ? 1000 / 60 : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1); state.timestamp = timestamp; state.isProcessing = true; stepsOrder.forEach(processStep); state.isProcessing = false; if (runNextFrame && allowKeepAlive) { useDefaultElapsed = false; scheduleNextBatch(processBatch); } }; const wake = () => { runNextFrame = true; useDefaultElapsed = true; if (!state.isProcessing) { scheduleNextBatch(processBatch); } }; const schedule = stepsOrder.reduce((acc, key) => { const step = steps[key]; acc[key] = (process, keepAlive = false, immediate = false) => { if (!runNextFrame) wake(); return step.schedule(process, keepAlive, immediate); }; return acc; }, {}); const cancel = (process) => stepsOrder.forEach((key) => steps[key].cancel(process)); return { schedule, cancel, state, steps }; } ;// ./node_modules/framer-motion/dist/es/frameloop/microtask.mjs const { schedule: microtask, cancel: cancelMicrotask } = createRenderBatcher(queueMicrotask, false); ;// ./node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs function useVisualElement(Component, visualState, props, createVisualElement) { const { visualElement: parent } = (0,external_React_.useContext)(MotionContext); const lazyContext = (0,external_React_.useContext)(LazyContext); const presenceContext = (0,external_React_.useContext)(PresenceContext_PresenceContext); const reducedMotionConfig = (0,external_React_.useContext)(MotionConfigContext).reducedMotion; const visualElementRef = (0,external_React_.useRef)(); /** * If we haven't preloaded a renderer, check to see if we have one lazy-loaded */ createVisualElement = createVisualElement || lazyContext.renderer; if (!visualElementRef.current && createVisualElement) { visualElementRef.current = createVisualElement(Component, { visualState, parent, props, presenceContext, blockInitialAnimation: presenceContext ? presenceContext.initial === false : false, reducedMotionConfig, }); } const visualElement = visualElementRef.current; (0,external_React_.useInsertionEffect)(() => { visualElement && visualElement.update(props, presenceContext); }); /** * Cache this value as we want to know whether HandoffAppearAnimations * was present on initial render - it will be deleted after this. */ const wantsHandoff = (0,external_React_.useRef)(Boolean(props[optimizedAppearDataAttribute] && !window.HandoffComplete)); useIsomorphicLayoutEffect(() => { if (!visualElement) return; microtask.render(visualElement.render); /** * Ideally this function would always run in a useEffect. * * However, if we have optimised appear animations to handoff from, * it needs to happen synchronously to ensure there's no flash of * incorrect styles in the event of a hydration error. * * So if we detect a situtation where optimised appear animations * are running, we use useLayoutEffect to trigger animations. */ if (wantsHandoff.current && visualElement.animationState) { visualElement.animationState.animateChanges(); } }); (0,external_React_.useEffect)(() => { if (!visualElement) return; visualElement.updateFeatures(); if (!wantsHandoff.current && visualElement.animationState) { visualElement.animationState.animateChanges(); } if (wantsHandoff.current) { wantsHandoff.current = false; // This ensures all future calls to animateChanges() will run in useEffect window.HandoffComplete = true; } }); return visualElement; } ;// ./node_modules/framer-motion/dist/es/utils/is-ref-object.mjs function isRefObject(ref) { return (ref && typeof ref === "object" && Object.prototype.hasOwnProperty.call(ref, "current")); } ;// ./node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.mjs /** * Creates a ref function that, when called, hydrates the provided * external ref and VisualElement. */ function useMotionRef(visualState, visualElement, externalRef) { return (0,external_React_.useCallback)((instance) => { instance && visualState.mount && visualState.mount(instance); if (visualElement) { instance ? visualElement.mount(instance) : visualElement.unmount(); } if (externalRef) { if (typeof externalRef === "function") { externalRef(instance); } else if (isRefObject(externalRef)) { externalRef.current = instance; } } }, /** * Only pass a new ref callback to React if we've received a visual element * factory. Otherwise we'll be mounting/remounting every time externalRef * or other dependencies change. */ [visualElement]); } ;// ./node_modules/framer-motion/dist/es/render/utils/is-variant-label.mjs /** * Decides if the supplied variable is variant label */ function isVariantLabel(v) { return typeof v === "string" || Array.isArray(v); } ;// ./node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.mjs function isAnimationControls(v) { return (v !== null && typeof v === "object" && typeof v.start === "function"); } ;// ./node_modules/framer-motion/dist/es/render/utils/variant-props.mjs const variantPriorityOrder = [ "animate", "whileInView", "whileFocus", "whileHover", "whileTap", "whileDrag", "exit", ]; const variantProps = ["initial", ...variantPriorityOrder]; ;// ./node_modules/framer-motion/dist/es/render/utils/is-controlling-variants.mjs function isControllingVariants(props) { return (isAnimationControls(props.animate) || variantProps.some((name) => isVariantLabel(props[name]))); } function isVariantNode(props) { return Boolean(isControllingVariants(props) || props.variants); } ;// ./node_modules/framer-motion/dist/es/context/MotionContext/utils.mjs function getCurrentTreeVariants(props, context) { if (isControllingVariants(props)) { const { initial, animate } = props; return { initial: initial === false || isVariantLabel(initial) ? initial : undefined, animate: isVariantLabel(animate) ? animate : undefined, }; } return props.inherit !== false ? context : {}; } ;// ./node_modules/framer-motion/dist/es/context/MotionContext/create.mjs function useCreateMotionContext(props) { const { initial, animate } = getCurrentTreeVariants(props, (0,external_React_.useContext)(MotionContext)); return (0,external_React_.useMemo)(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]); } function variantLabelsAsDependency(prop) { return Array.isArray(prop) ? prop.join(" ") : prop; } ;// ./node_modules/framer-motion/dist/es/motion/features/definitions.mjs const featureProps = { animation: [ "animate", "variants", "whileHover", "whileTap", "exit", "whileInView", "whileFocus", "whileDrag", ], exit: ["exit"], drag: ["drag", "dragControls"], focus: ["whileFocus"], hover: ["whileHover", "onHoverStart", "onHoverEnd"], tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"], pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"], }; const featureDefinitions = {}; for (const key in featureProps) { featureDefinitions[key] = { isEnabled: (props) => featureProps[key].some((name) => !!props[name]), }; } ;// ./node_modules/framer-motion/dist/es/motion/features/load-features.mjs function loadFeatures(features) { for (const key in features) { featureDefinitions[key] = { ...featureDefinitions[key], ...features[key], }; } } ;// ./node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs const LayoutGroupContext = (0,external_React_.createContext)({}); ;// ./node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs /** * Internal, exported only for usage in Framer */ const SwitchLayoutGroupContext = (0,external_React_.createContext)({}); ;// ./node_modules/framer-motion/dist/es/motion/utils/symbol.mjs const motionComponentSymbol = Symbol.for("motionComponentSymbol"); ;// ./node_modules/framer-motion/dist/es/motion/index.mjs /** * Create a `motion` component. * * This function accepts a Component argument, which can be either a string (ie "div" * for `motion.div`), or an actual React component. * * Alongside this is a config option which provides a way of rendering the provided * component "offline", or outside the React render cycle. */ function motion_createMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) { preloadedFeatures && loadFeatures(preloadedFeatures); function MotionComponent(props, externalRef) { /** * If we need to measure the element we load this functionality in a * separate class component in order to gain access to getSnapshotBeforeUpdate. */ let MeasureLayout; const configAndProps = { ...(0,external_React_.useContext)(MotionConfigContext), ...props, layoutId: useLayoutId(props), }; const { isStatic } = configAndProps; const context = useCreateMotionContext(props); const visualState = useVisualState(props, isStatic); if (!isStatic && is_browser_isBrowser) { /** * Create a VisualElement for this component. A VisualElement provides a common * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as * providing a way of rendering to these APIs outside of the React render loop * for more performant animations and interactions */ context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement); /** * Load Motion gesture and animation features. These are rendered as renderless * components so each feature can optionally make use of React lifecycle methods. */ const initialLayoutGroupConfig = (0,external_React_.useContext)(SwitchLayoutGroupContext); const isStrict = (0,external_React_.useContext)(LazyContext).strict; if (context.visualElement) { MeasureLayout = context.visualElement.loadFeatures( // Note: Pass the full new combined props to correctly re-render dynamic feature components. configAndProps, isStrict, preloadedFeatures, initialLayoutGroupConfig); } } /** * The mount order and hierarchy is specific to ensure our element ref * is hydrated by the time features fire their effects. */ return ((0,external_ReactJSXRuntime_namespaceObject.jsxs)(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? ((0,external_ReactJSXRuntime_namespaceObject.jsx)(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] })); } const ForwardRefComponent = (0,external_React_.forwardRef)(MotionComponent); ForwardRefComponent[motionComponentSymbol] = Component; return ForwardRefComponent; } function useLayoutId({ layoutId }) { const layoutGroupId = (0,external_React_.useContext)(LayoutGroupContext).id; return layoutGroupId && layoutId !== undefined ? layoutGroupId + "-" + layoutId : layoutId; } ;// ./node_modules/framer-motion/dist/es/render/dom/motion-proxy.mjs /** * Convert any React component into a `motion` component. The provided component * **must** use `React.forwardRef` to the underlying DOM component you want to animate. * * ```jsx * const Component = React.forwardRef((props, ref) => { * return <div ref={ref} /> * }) * * const MotionComponent = motion(Component) * ``` * * @public */ function createMotionProxy(createConfig) { function custom(Component, customMotionComponentConfig = {}) { return motion_createMotionComponent(createConfig(Component, customMotionComponentConfig)); } if (typeof Proxy === "undefined") { return custom; } /** * A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc. * Rather than generating them anew every render. */ const componentCache = new Map(); return new Proxy(custom, { /** * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc. * The prop name is passed through as `key` and we can use that to generate a `motion` * DOM component with that name. */ get: (_target, key) => { /** * If this element doesn't exist in the component cache, create it and cache. */ if (!componentCache.has(key)) { componentCache.set(key, custom(key)); } return componentCache.get(key); }, }); } ;// ./node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs /** * We keep these listed seperately as we use the lowercase tag names as part * of the runtime bundle to detect SVG components */ const lowercaseSVGElements = [ "animate", "circle", "defs", "desc", "ellipse", "g", "image", "line", "filter", "marker", "mask", "metadata", "path", "pattern", "polygon", "polyline", "rect", "stop", "switch", "symbol", "svg", "text", "tspan", "use", "view", ]; ;// ./node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs function isSVGComponent(Component) { if ( /** * If it's not a string, it's a custom React component. Currently we only support * HTML custom React components. */ typeof Component !== "string" || /** * If it contains a dash, the element is a custom HTML webcomponent. */ Component.includes("-")) { return false; } else if ( /** * If it's in our list of lowercase SVG tags, it's an SVG component */ lowercaseSVGElements.indexOf(Component) > -1 || /** * If it contains a capital letter, it's an SVG component */ /[A-Z]/u.test(Component)) { return true; } return false; } ;// ./node_modules/framer-motion/dist/es/projection/styles/scale-correction.mjs const scaleCorrectors = {}; function addScaleCorrector(correctors) { Object.assign(scaleCorrectors, correctors); } ;// ./node_modules/framer-motion/dist/es/render/html/utils/transform.mjs /** * Generate a list of every possible transform key. */ const transformPropOrder = [ "transformPerspective", "x", "y", "z", "translateX", "translateY", "translateZ", "scale", "scaleX", "scaleY", "rotate", "rotateX", "rotateY", "rotateZ", "skew", "skewX", "skewY", ]; /** * A quick lookup for transform props. */ const transformProps = new Set(transformPropOrder); ;// ./node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs function isForcedMotionValue(key, { layout, layoutId }) { return (transformProps.has(key) || key.startsWith("origin") || ((layout || layoutId !== undefined) && (!!scaleCorrectors[key] || key === "opacity"))); } ;// ./node_modules/framer-motion/dist/es/value/utils/is-motion-value.mjs const isMotionValue = (value) => Boolean(value && value.getVelocity); ;// ./node_modules/framer-motion/dist/es/render/html/utils/build-transform.mjs const translateAlias = { x: "translateX", y: "translateY", z: "translateZ", transformPerspective: "perspective", }; const numTransforms = transformPropOrder.length; /** * Build a CSS transform style from individual x/y/scale etc properties. * * This outputs with a default order of transforms/scales/rotations, this can be customised by * providing a transformTemplate function. */ function buildTransform(transform, { enableHardwareAcceleration = true, allowTransformNone = true, }, transformIsDefault, transformTemplate) { // The transform string we're going to build into. let transformString = ""; /** * Loop over all possible transforms in order, adding the ones that * are present to the transform string. */ for (let i = 0; i < numTransforms; i++) { const key = transformPropOrder[i]; if (transform[key] !== undefined) { const transformName = translateAlias[key] || key; transformString += `${transformName}(${transform[key]}) `; } } if (enableHardwareAcceleration && !transform.z) { transformString += "translateZ(0)"; } transformString = transformString.trim(); // If we have a custom `transform` template, pass our transform values and // generated transformString to that before returning if (transformTemplate) { transformString = transformTemplate(transform, transformIsDefault ? "" : transformString); } else if (allowTransformNone && transformIsDefault) { transformString = "none"; } return transformString; } ;// ./node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token); const isCSSVariableName = checkStringStartsWith("--"); const startsAsVariableToken = checkStringStartsWith("var(--"); const isCSSVariableToken = (value) => { const startsWithToken = startsAsVariableToken(value); if (!startsWithToken) return false; // Ensure any comments are stripped from the value as this can harm performance of the regex. return singleCssVariableRegex.test(value.split("/*")[0].trim()); }; const singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu; ;// ./node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs /** * Provided a value and a ValueType, returns the value as that value type. */ const getValueAsType = (value, type) => { return type && typeof value === "number" ? type.transform(value) : value; }; ;// ./node_modules/framer-motion/dist/es/utils/clamp.mjs const clamp_clamp = (min, max, v) => { if (v > max) return max; if (v < min) return min; return v; }; ;// ./node_modules/framer-motion/dist/es/value/types/numbers/index.mjs const number = { test: (v) => typeof v === "number", parse: parseFloat, transform: (v) => v, }; const alpha = { ...number, transform: (v) => clamp_clamp(0, 1, v), }; const scale = { ...number, default: 1, }; ;// ./node_modules/framer-motion/dist/es/value/types/utils.mjs /** * TODO: When we move from string as a source of truth to data models * everything in this folder should probably be referred to as models vs types */ // If this number is a decimal, make it just five decimal places // to avoid exponents const sanitize = (v) => Math.round(v * 100000) / 100000; const floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu; function isString(v) { return typeof v === "string"; } ;// ./node_modules/framer-motion/dist/es/value/types/numbers/units.mjs const createUnitType = (unit) => ({ test: (v) => isString(v) && v.endsWith(unit) && v.split(" ").length === 1, parse: parseFloat, transform: (v) => `${v}${unit}`, }); const degrees = createUnitType("deg"); const percent = createUnitType("%"); const px = createUnitType("px"); const vh = createUnitType("vh"); const vw = createUnitType("vw"); const progressPercentage = { ...percent, parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100), }; ;// ./node_modules/framer-motion/dist/es/render/dom/value-types/type-int.mjs const type_int_int = { ...number, transform: Math.round, }; ;// ./node_modules/framer-motion/dist/es/render/dom/value-types/number.mjs const numberValueTypes = { // Border props borderWidth: px, borderTopWidth: px, borderRightWidth: px, borderBottomWidth: px, borderLeftWidth: px, borderRadius: px, radius: px, borderTopLeftRadius: px, borderTopRightRadius: px, borderBottomRightRadius: px, borderBottomLeftRadius: px, // Positioning props width: px, maxWidth: px, height: px, maxHeight: px, size: px, top: px, right: px, bottom: px, left: px, // Spacing props padding: px, paddingTop: px, paddingRight: px, paddingBottom: px, paddingLeft: px, margin: px, marginTop: px, marginRight: px, marginBottom: px, marginLeft: px, // Transform props rotate: degrees, rotateX: degrees, rotateY: degrees, rotateZ: degrees, scale: scale, scaleX: scale, scaleY: scale, scaleZ: scale, skew: degrees, skewX: degrees, skewY: degrees, distance: px, translateX: px, translateY: px, translateZ: px, x: px, y: px, z: px, perspective: px, transformPerspective: px, opacity: alpha, originX: progressPercentage, originY: progressPercentage, originZ: px, // Misc zIndex: type_int_int, backgroundPositionX: px, backgroundPositionY: px, // SVG fillOpacity: alpha, strokeOpacity: alpha, numOctaves: type_int_int, }; ;// ./node_modules/framer-motion/dist/es/render/html/utils/build-styles.mjs function buildHTMLStyles(state, latestValues, options, transformTemplate) { const { style, vars, transform, transformOrigin } = state; // Track whether we encounter any transform or transformOrigin values. let hasTransform = false; let hasTransformOrigin = false; // Does the calculated transform essentially equal "none"? let transformIsNone = true; /** * Loop over all our latest animated values and decide whether to handle them * as a style or CSS variable. * * Transforms and transform origins are kept seperately for further processing. */ for (const key in latestValues) { const value = latestValues[key]; /** * If this is a CSS variable we don't do any further processing. */ if (isCSSVariableName(key)) { vars[key] = value; continue; } // Convert the value to its default value type, ie 0 -> "0px" const valueType = numberValueTypes[key]; const valueAsType = getValueAsType(value, valueType); if (transformProps.has(key)) { // If this is a transform, flag to enable further transform processing hasTransform = true; transform[key] = valueAsType; // If we already know we have a non-default transform, early return if (!transformIsNone) continue; // Otherwise check to see if this is a default transform if (value !== (valueType.default || 0)) transformIsNone = false; } else if (key.startsWith("origin")) { // If this is a transform origin, flag and enable further transform-origin processing hasTransformOrigin = true; transformOrigin[key] = valueAsType; } else { style[key] = valueAsType; } } if (!latestValues.transform) { if (hasTransform || transformTemplate) { style.transform = buildTransform(state.transform, options, transformIsNone, transformTemplate); } else if (style.transform) { /** * If we have previously created a transform but currently don't have any, * reset transform style to none. */ style.transform = "none"; } } /** * Build a transformOrigin style. Uses the same defaults as the browser for * undefined origins. */ if (hasTransformOrigin) { const { originX = "50%", originY = "50%", originZ = 0, } = transformOrigin; style.transformOrigin = `${originX} ${originY} ${originZ}`; } } ;// ./node_modules/framer-motion/dist/es/render/html/utils/create-render-state.mjs const createHtmlRenderState = () => ({ style: {}, transform: {}, transformOrigin: {}, vars: {}, }); ;// ./node_modules/framer-motion/dist/es/render/html/use-props.mjs function copyRawValuesOnly(target, source, props) { for (const key in source) { if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) { target[key] = source[key]; } } } function useInitialMotionValues({ transformTemplate }, visualState, isStatic) { return (0,external_React_.useMemo)(() => { const state = createHtmlRenderState(); buildHTMLStyles(state, visualState, { enableHardwareAcceleration: !isStatic }, transformTemplate); return Object.assign({}, state.vars, state.style); }, [visualState]); } function useStyle(props, visualState, isStatic) { const styleProp = props.style || {}; const style = {}; /** * Copy non-Motion Values straight into style */ copyRawValuesOnly(style, styleProp, props); Object.assign(style, useInitialMotionValues(props, visualState, isStatic)); return style; } function useHTMLProps(props, visualState, isStatic) { // The `any` isn't ideal but it is the type of createElement props argument const htmlProps = {}; const style = useStyle(props, visualState, isStatic); if (props.drag && props.dragListener !== false) { // Disable the ghost element when a user drags htmlProps.draggable = false; // Disable text selection style.userSelect = style.WebkitUserSelect = style.WebkitTouchCallout = "none"; // Disable scrolling on the draggable direction style.touchAction = props.drag === true ? "none" : `pan-${props.drag === "x" ? "y" : "x"}`; } if (props.tabIndex === undefined && (props.onTap || props.onTapStart || props.whileTap)) { htmlProps.tabIndex = 0; } htmlProps.style = style; return htmlProps; } ;// ./node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs /** * A list of all valid MotionProps. * * @privateRemarks * This doesn't throw if a `MotionProp` name is missing - it should. */ const validMotionProps = new Set([ "animate", "exit", "variants", "initial", "style", "values", "variants", "transition", "transformTemplate", "custom", "inherit", "onBeforeLayoutMeasure", "onAnimationStart", "onAnimationComplete", "onUpdate", "onDragStart", "onDrag", "onDragEnd", "onMeasureDragConstraints", "onDirectionLock", "onDragTransitionEnd", "_dragX", "_dragY", "onHoverStart", "onHoverEnd", "onViewportEnter", "onViewportLeave", "globalTapTarget", "ignoreStrict", "viewport", ]); /** * Check whether a prop name is a valid `MotionProp` key. * * @param key - Name of the property to check * @returns `true` is key is a valid `MotionProp`. * * @public */ function isValidMotionProp(key) { return (key.startsWith("while") || (key.startsWith("drag") && key !== "draggable") || key.startsWith("layout") || key.startsWith("onTap") || key.startsWith("onPan") || key.startsWith("onLayout") || validMotionProps.has(key)); } ;// ./node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs let shouldForward = (key) => !isValidMotionProp(key); function loadExternalIsValidProp(isValidProp) { if (!isValidProp) return; // Explicitly filter our events shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key); } /** * Emotion and Styled Components both allow users to pass through arbitrary props to their components * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which * of these should be passed to the underlying DOM node. * * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of * `@emotion/is-prop-valid`, however to fix this problem we need to use it. * * By making it an optionalDependency we can offer this functionality only in the situations where it's * actually required. */ try { /** * We attempt to import this package but require won't be defined in esm environments, in that case * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed * in favour of explicit injection. */ loadExternalIsValidProp(require("@emotion/is-prop-valid").default); } catch (_a) { // We don't need to actually do anything here - the fallback is the existing `isPropValid`. } function filterProps(props, isDom, forwardMotionProps) { const filteredProps = {}; for (const key in props) { /** * values is considered a valid prop by Emotion, so if it's present * this will be rendered out to the DOM unless explicitly filtered. * * We check the type as it could be used with the `feColorMatrix` * element, which we support. */ if (key === "values" && typeof props.values === "object") continue; if (shouldForward(key) || (forwardMotionProps === true && isValidMotionProp(key)) || (!isDom && !isValidMotionProp(key)) || // If trying to use native HTML drag events, forward drag listeners (props["draggable"] && key.startsWith("onDrag"))) { filteredProps[key] = props[key]; } } return filteredProps; } ;// ./node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.mjs function calcOrigin(origin, offset, size) { return typeof origin === "string" ? origin : px.transform(offset + size * origin); } /** * The SVG transform origin defaults are different to CSS and is less intuitive, * so we use the measured dimensions of the SVG to reconcile these. */ function calcSVGTransformOrigin(dimensions, originX, originY) { const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width); const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height); return `${pxOriginX} ${pxOriginY}`; } ;// ./node_modules/framer-motion/dist/es/render/svg/utils/path.mjs const dashKeys = { offset: "stroke-dashoffset", array: "stroke-dasharray", }; const camelKeys = { offset: "strokeDashoffset", array: "strokeDasharray", }; /** * Build SVG path properties. Uses the path's measured length to convert * our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset * and stroke-dasharray attributes. * * This function is mutative to reduce per-frame GC. */ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true) { // Normalise path length by setting SVG attribute pathLength to 1 attrs.pathLength = 1; // We use dash case when setting attributes directly to the DOM node and camel case // when defining props on a React component. const keys = useDashCase ? dashKeys : camelKeys; // Build the dash offset attrs[keys.offset] = px.transform(-offset); // Build the dash array const pathLength = px.transform(length); const pathSpacing = px.transform(spacing); attrs[keys.array] = `${pathLength} ${pathSpacing}`; } ;// ./node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.mjs /** * Build SVG visual attrbutes, like cx and style.transform */ function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathLength, pathSpacing = 1, pathOffset = 0, // This is object creation, which we try to avoid per-frame. ...latest }, options, isSVGTag, transformTemplate) { buildHTMLStyles(state, latest, options, transformTemplate); /** * For svg tags we just want to make sure viewBox is animatable and treat all the styles * as normal HTML tags. */ if (isSVGTag) { if (state.style.viewBox) { state.attrs.viewBox = state.style.viewBox; } return; } state.attrs = state.style; state.style = {}; const { attrs, style, dimensions } = state; /** * However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs * and copy it into style. */ if (attrs.transform) { if (dimensions) style.transform = attrs.transform; delete attrs.transform; } // Parse transformOrigin if (dimensions && (originX !== undefined || originY !== undefined || style.transform)) { style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5); } // Render attrX/attrY/attrScale as attributes if (attrX !== undefined) attrs.x = attrX; if (attrY !== undefined) attrs.y = attrY; if (attrScale !== undefined) attrs.scale = attrScale; // Build SVG path if one has been defined if (pathLength !== undefined) { buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false); } } ;// ./node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.mjs const createSvgRenderState = () => ({ ...createHtmlRenderState(), attrs: {}, }); ;// ./node_modules/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg"; ;// ./node_modules/framer-motion/dist/es/render/svg/use-props.mjs function useSVGProps(props, visualState, _isStatic, Component) { const visualProps = (0,external_React_.useMemo)(() => { const state = createSvgRenderState(); buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, isSVGTag(Component), props.transformTemplate); return { ...state.attrs, style: { ...state.style }, }; }, [visualState]); if (props.style) { const rawStyles = {}; copyRawValuesOnly(rawStyles, props.style, props); visualProps.style = { ...rawStyles, ...visualProps.style }; } return visualProps; } ;// ./node_modules/framer-motion/dist/es/render/dom/use-render.mjs function createUseRender(forwardMotionProps = false) { const useRender = (Component, props, ref, { latestValues }, isStatic) => { const useVisualProps = isSVGComponent(Component) ? useSVGProps : useHTMLProps; const visualProps = useVisualProps(props, latestValues, isStatic, Component); const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps); const elementProps = Component !== external_React_.Fragment ? { ...filteredProps, ...visualProps, ref } : {}; /** * If component has been handed a motion value as its child, * memoise its initial value and render that. Subsequent updates * will be handled by the onChange handler */ const { children } = props; const renderedChildren = (0,external_React_.useMemo)(() => (isMotionValue(children) ? children.get() : children), [children]); return (0,external_React_.createElement)(Component, { ...elementProps, children: renderedChildren, }); }; return useRender; } ;// ./node_modules/framer-motion/dist/es/render/html/utils/render.mjs function renderHTML(element, { style, vars }, styleProp, projection) { Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp)); // Loop over any CSS variables and assign those. for (const key in vars) { element.style.setProperty(key, vars[key]); } } ;// ./node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs /** * A set of attribute names that are always read/written as camel case. */ const camelCaseAttributes = new Set([ "baseFrequency", "diffuseConstant", "kernelMatrix", "kernelUnitLength", "keySplines", "keyTimes", "limitingConeAngle", "markerHeight", "markerWidth", "numOctaves", "targetX", "targetY", "surfaceScale", "specularConstant", "specularExponent", "stdDeviation", "tableValues", "viewBox", "gradientTransform", "pathLength", "startOffset", "textLength", "lengthAdjust", ]); ;// ./node_modules/framer-motion/dist/es/render/svg/utils/render.mjs function renderSVG(element, renderState, _styleProp, projection) { renderHTML(element, renderState, undefined, projection); for (const key in renderState.attrs) { element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]); } } ;// ./node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs function scrapeMotionValuesFromProps(props, prevProps, visualElement) { var _a; const { style } = props; const newValues = {}; for (const key in style) { if (isMotionValue(style[key]) || (prevProps.style && isMotionValue(prevProps.style[key])) || isForcedMotionValue(key, props) || ((_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a === void 0 ? void 0 : _a.liveStyle) !== undefined) { newValues[key] = style[key]; } } return newValues; } ;// ./node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs function scrape_motion_values_scrapeMotionValuesFromProps(props, prevProps, visualElement) { const newValues = scrapeMotionValuesFromProps(props, prevProps, visualElement); for (const key in props) { if (isMotionValue(props[key]) || isMotionValue(prevProps[key])) { const targetKey = transformPropOrder.indexOf(key) !== -1 ? "attr" + key.charAt(0).toUpperCase() + key.substring(1) : key; newValues[targetKey] = props[key]; } } return newValues; } ;// ./node_modules/framer-motion/dist/es/render/utils/resolve-variants.mjs function getValueState(visualElement) { const state = [{}, {}]; visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => { state[0][key] = value.get(); state[1][key] = value.getVelocity(); }); return state; } function resolveVariantFromProps(props, definition, custom, visualElement) { /** * If the variant definition is a function, resolve. */ if (typeof definition === "function") { const [current, velocity] = getValueState(visualElement); definition = definition(custom !== undefined ? custom : props.custom, current, velocity); } /** * If the variant definition is a variant label, or * the function returned a variant label, resolve. */ if (typeof definition === "string") { definition = props.variants && props.variants[definition]; } /** * At this point we've resolved both functions and variant labels, * but the resolved variant label might itself have been a function. * If so, resolve. This can only have returned a valid target object. */ if (typeof definition === "function") { const [current, velocity] = getValueState(visualElement); definition = definition(custom !== undefined ? custom : props.custom, current, velocity); } return definition; } ;// ./node_modules/framer-motion/dist/es/utils/use-constant.mjs /** * Creates a constant value over the lifecycle of a component. * * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer * a guarantee that it won't re-run for performance reasons later on. By using `useConstant` * you can ensure that initialisers don't execute twice or more. */ function useConstant(init) { const ref = (0,external_React_.useRef)(null); if (ref.current === null) { ref.current = init(); } return ref.current; } ;// ./node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs const isKeyframesTarget = (v) => { return Array.isArray(v); }; ;// ./node_modules/framer-motion/dist/es/utils/resolve-value.mjs const isCustomValue = (v) => { return Boolean(v && typeof v === "object" && v.mix && v.toValue); }; const resolveFinalValueInKeyframes = (v) => { // TODO maybe throw if v.length - 1 is placeholder token? return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v; }; ;// ./node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.mjs /** * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself * * TODO: Remove and move to library */ function resolveMotionValue(value) { const unwrappedValue = isMotionValue(value) ? value.get() : value; return isCustomValue(unwrappedValue) ? unwrappedValue.toValue() : unwrappedValue; } ;// ./node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs function makeState({ scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext) { const state = { latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps), renderState: createRenderState(), }; if (onMount) { state.mount = (instance) => onMount(props, instance, state); } return state; } const makeUseVisualState = (config) => (props, isStatic) => { const context = (0,external_React_.useContext)(MotionContext); const presenceContext = (0,external_React_.useContext)(PresenceContext_PresenceContext); const make = () => makeState(config, props, context, presenceContext); return isStatic ? make() : useConstant(make); }; function makeLatestValues(props, context, presenceContext, scrapeMotionValues) { const values = {}; const motionValues = scrapeMotionValues(props, {}); for (const key in motionValues) { values[key] = resolveMotionValue(motionValues[key]); } let { initial, animate } = props; const isControllingVariants$1 = isControllingVariants(props); const isVariantNode$1 = isVariantNode(props); if (context && isVariantNode$1 && !isControllingVariants$1 && props.inherit !== false) { if (initial === undefined) initial = context.initial; if (animate === undefined) animate = context.animate; } let isInitialAnimationBlocked = presenceContext ? presenceContext.initial === false : false; isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false; const variantToSet = isInitialAnimationBlocked ? animate : initial; if (variantToSet && typeof variantToSet !== "boolean" && !isAnimationControls(variantToSet)) { const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet]; list.forEach((definition) => { const resolved = resolveVariantFromProps(props, definition); if (!resolved) return; const { transitionEnd, transition, ...target } = resolved; for (const key in target) { let valueTarget = target[key]; if (Array.isArray(valueTarget)) { /** * Take final keyframe if the initial animation is blocked because * we want to initialise at the end of that blocked animation. */ const index = isInitialAnimationBlocked ? valueTarget.length - 1 : 0; valueTarget = valueTarget[index]; } if (valueTarget !== null) { values[key] = valueTarget; } } for (const key in transitionEnd) values[key] = transitionEnd[key]; }); } return values; } ;// ./node_modules/framer-motion/dist/es/utils/noop.mjs const noop_noop = (any) => any; ;// ./node_modules/framer-motion/dist/es/frameloop/frame.mjs const { schedule: frame_frame, cancel: cancelFrame, state: frameData, steps, } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop_noop, true); ;// ./node_modules/framer-motion/dist/es/render/svg/config-motion.mjs const svgMotionConfig = { useVisualState: makeUseVisualState({ scrapeMotionValuesFromProps: scrape_motion_values_scrapeMotionValuesFromProps, createRenderState: createSvgRenderState, onMount: (props, instance, { renderState, latestValues }) => { frame_frame.read(() => { try { renderState.dimensions = typeof instance.getBBox === "function" ? instance.getBBox() : instance.getBoundingClientRect(); } catch (e) { // Most likely trying to measure an unrendered element under Firefox renderState.dimensions = { x: 0, y: 0, width: 0, height: 0, }; } }); frame_frame.render(() => { buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, isSVGTag(instance.tagName), props.transformTemplate); renderSVG(instance, renderState); }); }, }), }; ;// ./node_modules/framer-motion/dist/es/render/html/config-motion.mjs const htmlMotionConfig = { useVisualState: makeUseVisualState({ scrapeMotionValuesFromProps: scrapeMotionValuesFromProps, createRenderState: createHtmlRenderState, }), }; ;// ./node_modules/framer-motion/dist/es/render/dom/utils/create-config.mjs function create_config_createDomMotionConfig(Component, { forwardMotionProps = false }, preloadedFeatures, createVisualElement) { const baseConfig = isSVGComponent(Component) ? svgMotionConfig : htmlMotionConfig; return { ...baseConfig, preloadedFeatures, useRender: createUseRender(forwardMotionProps), createVisualElement, Component, }; } ;// ./node_modules/framer-motion/dist/es/events/add-dom-event.mjs function addDomEvent(target, eventName, handler, options = { passive: true }) { target.addEventListener(eventName, handler, options); return () => target.removeEventListener(eventName, handler); } ;// ./node_modules/framer-motion/dist/es/events/utils/is-primary-pointer.mjs const isPrimaryPointer = (event) => { if (event.pointerType === "mouse") { return typeof event.button !== "number" || event.button <= 0; } else { /** * isPrimary is true for all mice buttons, whereas every touch point * is regarded as its own input. So subsequent concurrent touch points * will be false. * * Specifically match against false here as incomplete versions of * PointerEvents in very old browser might have it set as undefined. */ return event.isPrimary !== false; } }; ;// ./node_modules/framer-motion/dist/es/events/event-info.mjs function extractEventInfo(event, pointType = "page") { return { point: { x: event[`${pointType}X`], y: event[`${pointType}Y`], }, }; } const addPointerInfo = (handler) => { return (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event)); }; ;// ./node_modules/framer-motion/dist/es/events/add-pointer-event.mjs function addPointerEvent(target, eventName, handler, options) { return addDomEvent(target, eventName, addPointerInfo(handler), options); } ;// ./node_modules/framer-motion/dist/es/utils/pipe.mjs /** * Pipe * Compose other transformers to run linearily * pipe(min(20), max(40)) * @param {...functions} transformers * @return {function} */ const combineFunctions = (a, b) => (v) => b(a(v)); const pipe = (...transformers) => transformers.reduce(combineFunctions); ;// ./node_modules/framer-motion/dist/es/gestures/drag/utils/lock.mjs function createLock(name) { let lock = null; return () => { const openLock = () => { lock = null; }; if (lock === null) { lock = name; return openLock; } return false; }; } const globalHorizontalLock = createLock("dragHorizontal"); const globalVerticalLock = createLock("dragVertical"); function getGlobalLock(drag) { let lock = false; if (drag === "y") { lock = globalVerticalLock(); } else if (drag === "x") { lock = globalHorizontalLock(); } else { const openHorizontal = globalHorizontalLock(); const openVertical = globalVerticalLock(); if (openHorizontal && openVertical) { lock = () => { openHorizontal(); openVertical(); }; } else { // Release the locks because we don't use them if (openHorizontal) openHorizontal(); if (openVertical) openVertical(); } } return lock; } function isDragActive() { // Check the gesture lock - if we get it, it means no drag gesture is active // and we can safely fire the tap gesture. const openGestureLock = getGlobalLock(true); if (!openGestureLock) return true; openGestureLock(); return false; } ;// ./node_modules/framer-motion/dist/es/motion/features/Feature.mjs class Feature { constructor(node) { this.isMounted = false; this.node = node; } update() { } } ;// ./node_modules/framer-motion/dist/es/gestures/hover.mjs function addHoverEvent(node, isActive) { const eventName = isActive ? "pointerenter" : "pointerleave"; const callbackName = isActive ? "onHoverStart" : "onHoverEnd"; const handleEvent = (event, info) => { if (event.pointerType === "touch" || isDragActive()) return; const props = node.getProps(); if (node.animationState && props.whileHover) { node.animationState.setActive("whileHover", isActive); } const callback = props[callbackName]; if (callback) { frame_frame.postRender(() => callback(event, info)); } }; return addPointerEvent(node.current, eventName, handleEvent, { passive: !node.getProps()[callbackName], }); } class HoverGesture extends Feature { mount() { this.unmount = pipe(addHoverEvent(this.node, true), addHoverEvent(this.node, false)); } unmount() { } } ;// ./node_modules/framer-motion/dist/es/gestures/focus.mjs class FocusGesture extends Feature { constructor() { super(...arguments); this.isActive = false; } onFocus() { let isFocusVisible = false; /** * If this element doesn't match focus-visible then don't * apply whileHover. But, if matches throws that focus-visible * is not a valid selector then in that browser outline styles will be applied * to the element by default and we want to match that behaviour with whileFocus. */ try { isFocusVisible = this.node.current.matches(":focus-visible"); } catch (e) { isFocusVisible = true; } if (!isFocusVisible || !this.node.animationState) return; this.node.animationState.setActive("whileFocus", true); this.isActive = true; } onBlur() { if (!this.isActive || !this.node.animationState) return; this.node.animationState.setActive("whileFocus", false); this.isActive = false; } mount() { this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur())); } unmount() { } } ;// ./node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.mjs /** * Recursively traverse up the tree to check whether the provided child node * is the parent or a descendant of it. * * @param parent - Element to find * @param child - Element to test against parent */ const isNodeOrChild = (parent, child) => { if (!child) { return false; } else if (parent === child) { return true; } else { return isNodeOrChild(parent, child.parentElement); } }; ;// ./node_modules/framer-motion/dist/es/gestures/press.mjs function fireSyntheticPointerEvent(name, handler) { if (!handler) return; const syntheticPointerEvent = new PointerEvent("pointer" + name); handler(syntheticPointerEvent, extractEventInfo(syntheticPointerEvent)); } class PressGesture extends Feature { constructor() { super(...arguments); this.removeStartListeners = noop_noop; this.removeEndListeners = noop_noop; this.removeAccessibleListeners = noop_noop; this.startPointerPress = (startEvent, startInfo) => { if (this.isPressing) return; this.removeEndListeners(); const props = this.node.getProps(); const endPointerPress = (endEvent, endInfo) => { if (!this.checkPressEnd()) return; const { onTap, onTapCancel, globalTapTarget } = this.node.getProps(); /** * We only count this as a tap gesture if the event.target is the same * as, or a child of, this component's element */ const handler = !globalTapTarget && !isNodeOrChild(this.node.current, endEvent.target) ? onTapCancel : onTap; if (handler) { frame_frame.update(() => handler(endEvent, endInfo)); } }; const removePointerUpListener = addPointerEvent(window, "pointerup", endPointerPress, { passive: !(props.onTap || props["onPointerUp"]), }); const removePointerCancelListener = addPointerEvent(window, "pointercancel", (cancelEvent, cancelInfo) => this.cancelPress(cancelEvent, cancelInfo), { passive: !(props.onTapCancel || props["onPointerCancel"]), }); this.removeEndListeners = pipe(removePointerUpListener, removePointerCancelListener); this.startPress(startEvent, startInfo); }; this.startAccessiblePress = () => { const handleKeydown = (keydownEvent) => { if (keydownEvent.key !== "Enter" || this.isPressing) return; const handleKeyup = (keyupEvent) => { if (keyupEvent.key !== "Enter" || !this.checkPressEnd()) return; fireSyntheticPointerEvent("up", (event, info) => { const { onTap } = this.node.getProps(); if (onTap) { frame_frame.postRender(() => onTap(event, info)); } }); }; this.removeEndListeners(); this.removeEndListeners = addDomEvent(this.node.current, "keyup", handleKeyup); fireSyntheticPointerEvent("down", (event, info) => { this.startPress(event, info); }); }; const removeKeydownListener = addDomEvent(this.node.current, "keydown", handleKeydown); const handleBlur = () => { if (!this.isPressing) return; fireSyntheticPointerEvent("cancel", (cancelEvent, cancelInfo) => this.cancelPress(cancelEvent, cancelInfo)); }; const removeBlurListener = addDomEvent(this.node.current, "blur", handleBlur); this.removeAccessibleListeners = pipe(removeKeydownListener, removeBlurListener); }; } startPress(event, info) { this.isPressing = true; const { onTapStart, whileTap } = this.node.getProps(); /** * Ensure we trigger animations before firing event callback */ if (whileTap && this.node.animationState) { this.node.animationState.setActive("whileTap", true); } if (onTapStart) { frame_frame.postRender(() => onTapStart(event, info)); } } checkPressEnd() { this.removeEndListeners(); this.isPressing = false; const props = this.node.getProps(); if (props.whileTap && this.node.animationState) { this.node.animationState.setActive("whileTap", false); } return !isDragActive(); } cancelPress(event, info) { if (!this.checkPressEnd()) return; const { onTapCancel } = this.node.getProps(); if (onTapCancel) { frame_frame.postRender(() => onTapCancel(event, info)); } } mount() { const props = this.node.getProps(); const removePointerListener = addPointerEvent(props.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { passive: !(props.onTapStart || props["onPointerStart"]), }); const removeFocusListener = addDomEvent(this.node.current, "focus", this.startAccessiblePress); this.removeStartListeners = pipe(removePointerListener, removeFocusListener); } unmount() { this.removeStartListeners(); this.removeEndListeners(); this.removeAccessibleListeners(); } } ;// ./node_modules/framer-motion/dist/es/motion/features/viewport/observers.mjs /** * Map an IntersectionHandler callback to an element. We only ever make one handler for one * element, so even though these handlers might all be triggered by different * observers, we can keep them in the same map. */ const observerCallbacks = new WeakMap(); /** * Multiple observers can be created for multiple element/document roots. Each with * different settings. So here we store dictionaries of observers to each root, * using serialised settings (threshold/margin) as lookup keys. */ const observers = new WeakMap(); const fireObserverCallback = (entry) => { const callback = observerCallbacks.get(entry.target); callback && callback(entry); }; const fireAllObserverCallbacks = (entries) => { entries.forEach(fireObserverCallback); }; function initIntersectionObserver({ root, ...options }) { const lookupRoot = root || document; /** * If we don't have an observer lookup map for this root, create one. */ if (!observers.has(lookupRoot)) { observers.set(lookupRoot, {}); } const rootObservers = observers.get(lookupRoot); const key = JSON.stringify(options); /** * If we don't have an observer for this combination of root and settings, * create one. */ if (!rootObservers[key]) { rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root, ...options }); } return rootObservers[key]; } function observeIntersection(element, options, callback) { const rootInteresectionObserver = initIntersectionObserver(options); observerCallbacks.set(element, callback); rootInteresectionObserver.observe(element); return () => { observerCallbacks.delete(element); rootInteresectionObserver.unobserve(element); }; } ;// ./node_modules/framer-motion/dist/es/motion/features/viewport/index.mjs const thresholdNames = { some: 0, all: 1, }; class InViewFeature extends Feature { constructor() { super(...arguments); this.hasEnteredView = false; this.isInView = false; } startObserver() { this.unmount(); const { viewport = {} } = this.node.getProps(); const { root, margin: rootMargin, amount = "some", once } = viewport; const options = { root: root ? root.current : undefined, rootMargin, threshold: typeof amount === "number" ? amount : thresholdNames[amount], }; const onIntersectionUpdate = (entry) => { const { isIntersecting } = entry; /** * If there's been no change in the viewport state, early return. */ if (this.isInView === isIntersecting) return; this.isInView = isIntersecting; /** * Handle hasEnteredView. If this is only meant to run once, and * element isn't visible, early return. Otherwise set hasEnteredView to true. */ if (once && !isIntersecting && this.hasEnteredView) { return; } else if (isIntersecting) { this.hasEnteredView = true; } if (this.node.animationState) { this.node.animationState.setActive("whileInView", isIntersecting); } /** * Use the latest committed props rather than the ones in scope * when this observer is created */ const { onViewportEnter, onViewportLeave } = this.node.getProps(); const callback = isIntersecting ? onViewportEnter : onViewportLeave; callback && callback(entry); }; return observeIntersection(this.node.current, options, onIntersectionUpdate); } mount() { this.startObserver(); } update() { if (typeof IntersectionObserver === "undefined") return; const { props, prevProps } = this.node; const hasOptionsChanged = ["amount", "margin", "root"].some(hasViewportOptionChanged(props, prevProps)); if (hasOptionsChanged) { this.startObserver(); } } unmount() { } } function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) { return (name) => viewport[name] !== prevViewport[name]; } ;// ./node_modules/framer-motion/dist/es/motion/features/gestures.mjs const gestureAnimations = { inView: { Feature: InViewFeature, }, tap: { Feature: PressGesture, }, focus: { Feature: FocusGesture, }, hover: { Feature: HoverGesture, }, }; ;// ./node_modules/framer-motion/dist/es/utils/shallow-compare.mjs function shallowCompare(next, prev) { if (!Array.isArray(prev)) return false; const prevLength = prev.length; if (prevLength !== next.length) return false; for (let i = 0; i < prevLength; i++) { if (prev[i] !== next[i]) return false; } return true; } ;// ./node_modules/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs function resolveVariant(visualElement, definition, custom) { const props = visualElement.getProps(); return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement); } ;// ./node_modules/framer-motion/dist/es/utils/time-conversion.mjs /** * Converts seconds to milliseconds * * @param seconds - Time in seconds. * @return milliseconds - Converted time in milliseconds. */ const secondsToMilliseconds = (seconds) => seconds * 1000; const millisecondsToSeconds = (milliseconds) => milliseconds / 1000; ;// ./node_modules/framer-motion/dist/es/animation/utils/default-transitions.mjs const underDampedSpring = { type: "spring", stiffness: 500, damping: 25, restSpeed: 10, }; const criticallyDampedSpring = (target) => ({ type: "spring", stiffness: 550, damping: target === 0 ? 2 * Math.sqrt(550) : 30, restSpeed: 10, }); const keyframesTransition = { type: "keyframes", duration: 0.8, }; /** * Default easing curve is a slightly shallower version of * the default browser easing curve. */ const ease = { type: "keyframes", ease: [0.25, 0.1, 0.35, 1], duration: 0.3, }; const getDefaultTransition = (valueKey, { keyframes }) => { if (keyframes.length > 2) { return keyframesTransition; } else if (transformProps.has(valueKey)) { return valueKey.startsWith("scale") ? criticallyDampedSpring(keyframes[1]) : underDampedSpring; } return ease; }; ;// ./node_modules/framer-motion/dist/es/animation/utils/transitions.mjs /** * Decide whether a transition is defined on a given Transition. * This filters out orchestration options and returns true * if any options are left. */ function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, elapsed, ...transition }) { return !!Object.keys(transition).length; } function getValueTransition(transition, key) { return (transition[key] || transition["default"] || transition); } ;// ./node_modules/framer-motion/dist/es/utils/use-instant-transition-state.mjs const instantAnimationState = { current: false, }; ;// ./node_modules/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs const isNotNull = (value) => value !== null; function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe) { const resolvedKeyframes = keyframes.filter(isNotNull); const index = repeat && repeatType !== "loop" && repeat % 2 === 1 ? 0 : resolvedKeyframes.length - 1; return !index || finalKeyframe === undefined ? resolvedKeyframes[index] : finalKeyframe; } ;// ./node_modules/framer-motion/dist/es/frameloop/sync-time.mjs let now; function clearTime() { now = undefined; } /** * An eventloop-synchronous alternative to performance.now(). * * Ensures that time measurements remain consistent within a synchronous context. * Usually calling performance.now() twice within the same synchronous context * will return different values which isn't useful for animations when we're usually * trying to sync animations to the same frame. */ const time = { now: () => { if (now === undefined) { time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming ? frameData.timestamp : performance.now()); } return now; }, set: (newTime) => { now = newTime; queueMicrotask(clearTime); }, }; ;// ./node_modules/framer-motion/dist/es/utils/is-zero-value-string.mjs /** * Check if the value is a zero value string like "0px" or "0%" */ const isZeroValueString = (v) => /^0[^.\s]+$/u.test(v); ;// ./node_modules/framer-motion/dist/es/animation/utils/is-none.mjs function isNone(value) { if (typeof value === "number") { return value === 0; } else if (value !== null) { return value === "none" || value === "0" || isZeroValueString(value); } else { return true; } } ;// ./node_modules/framer-motion/dist/es/utils/errors.mjs let warning = noop_noop; let errors_invariant = noop_noop; if (false) {} ;// ./node_modules/framer-motion/dist/es/utils/is-numerical-string.mjs /** * Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1" */ const isNumericalString = (v) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(v); ;// ./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs /** * Parse Framer's special CSS variable format into a CSS token and a fallback. * * ``` * `var(--foo, #fff)` => [`--foo`, '#fff'] * ``` * * @param current */ const splitCSSVariableRegex = // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u; function parseCSSVariable(current) { const match = splitCSSVariableRegex.exec(current); if (!match) return [,]; const [, token1, token2, fallback] = match; return [`--${token1 !== null && token1 !== void 0 ? token1 : token2}`, fallback]; } const maxDepth = 4; function getVariableValue(current, element, depth = 1) { errors_invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`); const [token, fallback] = parseCSSVariable(current); // No CSS variable detected if (!token) return; // Attempt to read this CSS variable off the element const resolved = window.getComputedStyle(element).getPropertyValue(token); if (resolved) { const trimmed = resolved.trim(); return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed; } return isCSSVariableToken(fallback) ? getVariableValue(fallback, element, depth + 1) : fallback; } ;// ./node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs const positionalKeys = new Set([ "width", "height", "top", "left", "right", "bottom", "x", "y", "translateX", "translateY", ]); const isNumOrPxType = (v) => v === number || v === px; const getPosFromMatrix = (matrix, pos) => parseFloat(matrix.split(", ")[pos]); const getTranslateFromMatrix = (pos2, pos3) => (_bbox, { transform }) => { if (transform === "none" || !transform) return 0; const matrix3d = transform.match(/^matrix3d\((.+)\)$/u); if (matrix3d) { return getPosFromMatrix(matrix3d[1], pos3); } else { const matrix = transform.match(/^matrix\((.+)\)$/u); if (matrix) { return getPosFromMatrix(matrix[1], pos2); } else { return 0; } } }; const transformKeys = new Set(["x", "y", "z"]); const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key)); function removeNonTranslationalTransform(visualElement) { const removedTransforms = []; nonTranslationalTransformKeys.forEach((key) => { const value = visualElement.getValue(key); if (value !== undefined) { removedTransforms.push([key, value.get()]); value.set(key.startsWith("scale") ? 1 : 0); } }); return removedTransforms; } const positionalValues = { // Dimensions width: ({ x }, { paddingLeft = "0", paddingRight = "0" }) => x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight), height: ({ y }, { paddingTop = "0", paddingBottom = "0" }) => y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom), top: (_bbox, { top }) => parseFloat(top), left: (_bbox, { left }) => parseFloat(left), bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min), right: ({ x }, { left }) => parseFloat(left) + (x.max - x.min), // Transform x: getTranslateFromMatrix(4, 13), y: getTranslateFromMatrix(5, 14), }; // Alias translate longform names positionalValues.translateX = positionalValues.x; positionalValues.translateY = positionalValues.y; ;// ./node_modules/framer-motion/dist/es/render/dom/value-types/test.mjs /** * Tests a provided value against a ValueType */ const testValueType = (v) => (type) => type.test(v); ;// ./node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.mjs /** * ValueType for "auto" */ const auto = { test: (v) => v === "auto", parse: (v) => v, }; ;// ./node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.mjs /** * A list of value types commonly used for dimensions */ const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto]; /** * Tests a dimensional value against the list of dimension ValueTypes */ const findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v)); ;// ./node_modules/framer-motion/dist/es/render/utils/KeyframesResolver.mjs const toResolve = new Set(); let isScheduled = false; let anyNeedsMeasurement = false; function measureAllKeyframes() { if (anyNeedsMeasurement) { const resolversToMeasure = Array.from(toResolve).filter((resolver) => resolver.needsMeasurement); const elementsToMeasure = new Set(resolversToMeasure.map((resolver) => resolver.element)); const transformsToRestore = new Map(); /** * Write pass * If we're measuring elements we want to remove bounding box-changing transforms. */ elementsToMeasure.forEach((element) => { const removedTransforms = removeNonTranslationalTransform(element); if (!removedTransforms.length) return; transformsToRestore.set(element, removedTransforms); element.render(); }); // Read resolversToMeasure.forEach((resolver) => resolver.measureInitialState()); // Write elementsToMeasure.forEach((element) => { element.render(); const restore = transformsToRestore.get(element); if (restore) { restore.forEach(([key, value]) => { var _a; (_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value); }); } }); // Read resolversToMeasure.forEach((resolver) => resolver.measureEndState()); // Write resolversToMeasure.forEach((resolver) => { if (resolver.suspendedScrollY !== undefined) { window.scrollTo(0, resolver.suspendedScrollY); } }); } anyNeedsMeasurement = false; isScheduled = false; toResolve.forEach((resolver) => resolver.complete()); toResolve.clear(); } function readAllKeyframes() { toResolve.forEach((resolver) => { resolver.readKeyframes(); if (resolver.needsMeasurement) { anyNeedsMeasurement = true; } }); } function flushKeyframeResolvers() { readAllKeyframes(); measureAllKeyframes(); } class KeyframeResolver { constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) { /** * Track whether this resolver has completed. Once complete, it never * needs to attempt keyframe resolution again. */ this.isComplete = false; /** * Track whether this resolver is async. If it is, it'll be added to the * resolver queue and flushed in the next frame. Resolvers that aren't going * to trigger read/write thrashing don't need to be async. */ this.isAsync = false; /** * Track whether this resolver needs to perform a measurement * to resolve its keyframes. */ this.needsMeasurement = false; /** * Track whether this resolver is currently scheduled to resolve * to allow it to be cancelled and resumed externally. */ this.isScheduled = false; this.unresolvedKeyframes = [...unresolvedKeyframes]; this.onComplete = onComplete; this.name = name; this.motionValue = motionValue; this.element = element; this.isAsync = isAsync; } scheduleResolve() { this.isScheduled = true; if (this.isAsync) { toResolve.add(this); if (!isScheduled) { isScheduled = true; frame_frame.read(readAllKeyframes); frame_frame.resolveKeyframes(measureAllKeyframes); } } else { this.readKeyframes(); this.complete(); } } readKeyframes() { const { unresolvedKeyframes, name, element, motionValue } = this; /** * If a keyframe is null, we hydrate it either by reading it from * the instance, or propagating from previous keyframes. */ for (let i = 0; i < unresolvedKeyframes.length; i++) { if (unresolvedKeyframes[i] === null) { /** * If the first keyframe is null, we need to find its value by sampling the element */ if (i === 0) { const currentValue = motionValue === null || motionValue === void 0 ? void 0 : motionValue.get(); const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1]; if (currentValue !== undefined) { unresolvedKeyframes[0] = currentValue; } else if (element && name) { const valueAsRead = element.readValue(name, finalKeyframe); if (valueAsRead !== undefined && valueAsRead !== null) { unresolvedKeyframes[0] = valueAsRead; } } if (unresolvedKeyframes[0] === undefined) { unresolvedKeyframes[0] = finalKeyframe; } if (motionValue && currentValue === undefined) { motionValue.set(unresolvedKeyframes[0]); } } else { unresolvedKeyframes[i] = unresolvedKeyframes[i - 1]; } } } } setFinalKeyframe() { } measureInitialState() { } renderEndStyles() { } measureEndState() { } complete() { this.isComplete = true; this.onComplete(this.unresolvedKeyframes, this.finalKeyframe); toResolve.delete(this); } cancel() { if (!this.isComplete) { this.isScheduled = false; toResolve.delete(this); } } resume() { if (!this.isComplete) this.scheduleResolve(); } } ;// ./node_modules/framer-motion/dist/es/value/types/color/utils.mjs /** * Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000, * but false if a number or multiple colors */ const isColorString = (type, testProp) => (v) => { return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) || (testProp && Object.prototype.hasOwnProperty.call(v, testProp))); }; const splitColor = (aName, bName, cName) => (v) => { if (!isString(v)) return v; const [a, b, c, alpha] = v.match(floatRegex); return { [aName]: parseFloat(a), [bName]: parseFloat(b), [cName]: parseFloat(c), alpha: alpha !== undefined ? parseFloat(alpha) : 1, }; }; ;// ./node_modules/framer-motion/dist/es/value/types/color/rgba.mjs const clampRgbUnit = (v) => clamp_clamp(0, 255, v); const rgbUnit = { ...number, transform: (v) => Math.round(clampRgbUnit(v)), }; const rgba = { test: isColorString("rgb", "red"), parse: splitColor("red", "green", "blue"), transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" + rgbUnit.transform(red) + ", " + rgbUnit.transform(green) + ", " + rgbUnit.transform(blue) + ", " + sanitize(alpha.transform(alpha$1)) + ")", }; ;// ./node_modules/framer-motion/dist/es/value/types/color/hex.mjs function parseHex(v) { let r = ""; let g = ""; let b = ""; let a = ""; // If we have 6 characters, ie #FF0000 if (v.length > 5) { r = v.substring(1, 3); g = v.substring(3, 5); b = v.substring(5, 7); a = v.substring(7, 9); // Or we have 3 characters, ie #F00 } else { r = v.substring(1, 2); g = v.substring(2, 3); b = v.substring(3, 4); a = v.substring(4, 5); r += r; g += g; b += b; a += a; } return { red: parseInt(r, 16), green: parseInt(g, 16), blue: parseInt(b, 16), alpha: a ? parseInt(a, 16) / 255 : 1, }; } const hex = { test: isColorString("#"), parse: parseHex, transform: rgba.transform, }; ;// ./node_modules/framer-motion/dist/es/value/types/color/hsla.mjs const hsla = { test: isColorString("hsl", "hue"), parse: splitColor("hue", "saturation", "lightness"), transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => { return ("hsla(" + Math.round(hue) + ", " + percent.transform(sanitize(saturation)) + ", " + percent.transform(sanitize(lightness)) + ", " + sanitize(alpha.transform(alpha$1)) + ")"); }, }; ;// ./node_modules/framer-motion/dist/es/value/types/color/index.mjs const color = { test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v), parse: (v) => { if (rgba.test(v)) { return rgba.parse(v); } else if (hsla.test(v)) { return hsla.parse(v); } else { return hex.parse(v); } }, transform: (v) => { return isString(v) ? v : v.hasOwnProperty("red") ? rgba.transform(v) : hsla.transform(v); }, }; ;// ./node_modules/framer-motion/dist/es/value/types/complex/index.mjs function test(v) { var _a, _b; return (isNaN(v) && isString(v) && (((_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) + (((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0); } const NUMBER_TOKEN = "number"; const COLOR_TOKEN = "color"; const VAR_TOKEN = "var"; const VAR_FUNCTION_TOKEN = "var("; const SPLIT_TOKEN = "${}"; // this regex consists of the `singleCssVariableRegex|rgbHSLValueRegex|digitRegex` const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function analyseComplexValue(value) { const originalValue = value.toString(); const values = []; const indexes = { color: [], number: [], var: [], }; const types = []; let i = 0; const tokenised = originalValue.replace(complexRegex, (parsedValue) => { if (color.test(parsedValue)) { indexes.color.push(i); types.push(COLOR_TOKEN); values.push(color.parse(parsedValue)); } else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) { indexes.var.push(i); types.push(VAR_TOKEN); values.push(parsedValue); } else { indexes.number.push(i); types.push(NUMBER_TOKEN); values.push(parseFloat(parsedValue)); } ++i; return SPLIT_TOKEN; }); const split = tokenised.split(SPLIT_TOKEN); return { values, split, indexes, types }; } function parseComplexValue(v) { return analyseComplexValue(v).values; } function createTransformer(source) { const { split, types } = analyseComplexValue(source); const numSections = split.length; return (v) => { let output = ""; for (let i = 0; i < numSections; i++) { output += split[i]; if (v[i] !== undefined) { const type = types[i]; if (type === NUMBER_TOKEN) { output += sanitize(v[i]); } else if (type === COLOR_TOKEN) { output += color.transform(v[i]); } else { output += v[i]; } } } return output; }; } const convertNumbersToZero = (v) => typeof v === "number" ? 0 : v; function getAnimatableNone(v) { const parsed = parseComplexValue(v); const transformer = createTransformer(v); return transformer(parsed.map(convertNumbersToZero)); } const complex = { test, parse: parseComplexValue, createTransformer, getAnimatableNone, }; ;// ./node_modules/framer-motion/dist/es/value/types/complex/filter.mjs /** * Properties that should default to 1 or 100% */ const maxDefaults = new Set(["brightness", "contrast", "saturate", "opacity"]); function applyDefaultFilter(v) { const [name, value] = v.slice(0, -1).split("("); if (name === "drop-shadow") return v; const [number] = value.match(floatRegex) || []; if (!number) return v; const unit = value.replace(number, ""); let defaultValue = maxDefaults.has(name) ? 1 : 0; if (number !== value) defaultValue *= 100; return name + "(" + defaultValue + unit + ")"; } const functionRegex = /\b([a-z-]*)\(.*?\)/gu; const filter = { ...complex, getAnimatableNone: (v) => { const functions = v.match(functionRegex); return functions ? functions.map(applyDefaultFilter).join(" ") : v; }, }; ;// ./node_modules/framer-motion/dist/es/render/dom/value-types/defaults.mjs /** * A map of default value types for common values */ const defaultValueTypes = { ...numberValueTypes, // Color props color: color, backgroundColor: color, outlineColor: color, fill: color, stroke: color, // Border props borderColor: color, borderTopColor: color, borderRightColor: color, borderBottomColor: color, borderLeftColor: color, filter: filter, WebkitFilter: filter, }; /** * Gets the default ValueType for the provided value key */ const getDefaultValueType = (key) => defaultValueTypes[key]; ;// ./node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs function animatable_none_getAnimatableNone(key, value) { let defaultValueType = getDefaultValueType(key); if (defaultValueType !== filter) defaultValueType = complex; // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target return defaultValueType.getAnimatableNone ? defaultValueType.getAnimatableNone(value) : undefined; } ;// ./node_modules/framer-motion/dist/es/render/html/utils/make-none-animatable.mjs /** * If we encounter keyframes like "none" or "0" and we also have keyframes like * "#fff" or "200px 200px" we want to find a keyframe to serve as a template for * the "none" keyframes. In this case "#fff" or "200px 200px" - then these get turned into * zero equivalents, i.e. "#fff0" or "0px 0px". */ const invalidTemplates = new Set(["auto", "none", "0"]); function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) { let i = 0; let animatableTemplate = undefined; while (i < unresolvedKeyframes.length && !animatableTemplate) { const keyframe = unresolvedKeyframes[i]; if (typeof keyframe === "string" && !invalidTemplates.has(keyframe) && analyseComplexValue(keyframe).values.length) { animatableTemplate = unresolvedKeyframes[i]; } i++; } if (animatableTemplate && name) { for (const noneIndex of noneKeyframeIndexes) { unresolvedKeyframes[noneIndex] = animatable_none_getAnimatableNone(name, animatableTemplate); } } } ;// ./node_modules/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs class DOMKeyframesResolver extends KeyframeResolver { constructor(unresolvedKeyframes, onComplete, name, motionValue) { super(unresolvedKeyframes, onComplete, name, motionValue, motionValue === null || motionValue === void 0 ? void 0 : motionValue.owner, true); } readKeyframes() { const { unresolvedKeyframes, element, name } = this; if (!element.current) return; super.readKeyframes(); /** * If any keyframe is a CSS variable, we need to find its value by sampling the element */ for (let i = 0; i < unresolvedKeyframes.length; i++) { const keyframe = unresolvedKeyframes[i]; if (typeof keyframe === "string" && isCSSVariableToken(keyframe)) { const resolved = getVariableValue(keyframe, element.current); if (resolved !== undefined) { unresolvedKeyframes[i] = resolved; } if (i === unresolvedKeyframes.length - 1) { this.finalKeyframe = keyframe; } } } /** * Resolve "none" values. We do this potentially twice - once before and once after measuring keyframes. * This could be seen as inefficient but it's a trade-off to avoid measurements in more situations, which * have a far bigger performance impact. */ this.resolveNoneKeyframes(); /** * Check to see if unit type has changed. If so schedule jobs that will * temporarily set styles to the destination keyframes. * Skip if we have more than two keyframes or this isn't a positional value. * TODO: We can throw if there are multiple keyframes and the value type changes. */ if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) { return; } const [origin, target] = unresolvedKeyframes; const originType = findDimensionValueType(origin); const targetType = findDimensionValueType(target); /** * Either we don't recognise these value types or we can animate between them. */ if (originType === targetType) return; /** * If both values are numbers or pixels, we can animate between them by * converting them to numbers. */ if (isNumOrPxType(originType) && isNumOrPxType(targetType)) { for (let i = 0; i < unresolvedKeyframes.length; i++) { const value = unresolvedKeyframes[i]; if (typeof value === "string") { unresolvedKeyframes[i] = parseFloat(value); } } } else { /** * Else, the only way to resolve this is by measuring the element. */ this.needsMeasurement = true; } } resolveNoneKeyframes() { const { unresolvedKeyframes, name } = this; const noneKeyframeIndexes = []; for (let i = 0; i < unresolvedKeyframes.length; i++) { if (isNone(unresolvedKeyframes[i])) { noneKeyframeIndexes.push(i); } } if (noneKeyframeIndexes.length) { makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name); } } measureInitialState() { const { element, unresolvedKeyframes, name } = this; if (!element.current) return; if (name === "height") { this.suspendedScrollY = window.pageYOffset; } this.measuredOrigin = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current)); unresolvedKeyframes[0] = this.measuredOrigin; // Set final key frame to measure after next render const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1]; if (measureKeyframe !== undefined) { element.getValue(name, measureKeyframe).jump(measureKeyframe, false); } } measureEndState() { var _a; const { element, name, unresolvedKeyframes } = this; if (!element.current) return; const value = element.getValue(name); value && value.jump(this.measuredOrigin, false); const finalKeyframeIndex = unresolvedKeyframes.length - 1; const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex]; unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current)); if (finalKeyframe !== null && this.finalKeyframe === undefined) { this.finalKeyframe = finalKeyframe; } // If we removed transform values, reapply them before the next render if ((_a = this.removedTransforms) === null || _a === void 0 ? void 0 : _a.length) { this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => { element .getValue(unsetTransformName) .set(unsetTransformValue); }); } this.resolveNoneKeyframes(); } } ;// ./node_modules/framer-motion/dist/es/utils/memo.mjs function memo(callback) { let result; return () => { if (result === undefined) result = callback(); return result; }; } ;// ./node_modules/framer-motion/dist/es/animation/utils/is-animatable.mjs /** * Check if a value is animatable. Examples: * * ✅: 100, "100px", "#fff" * ❌: "block", "url(2.jpg)" * @param value * * @internal */ const isAnimatable = (value, name) => { // If the list of keys tat might be non-animatable grows, replace with Set if (name === "zIndex") return false; // If it's a number or a keyframes array, we can animate it. We might at some point // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this, // but for now lets leave it like this for performance reasons if (typeof value === "number" || Array.isArray(value)) return true; if (typeof value === "string" && // It's animatable if we have a string (complex.test(value) || value === "0") && // And it contains numbers and/or colors !value.startsWith("url(") // Unless it starts with "url(" ) { return true; } return false; }; ;// ./node_modules/framer-motion/dist/es/animation/animators/utils/can-animate.mjs function hasKeyframesChanged(keyframes) { const current = keyframes[0]; if (keyframes.length === 1) return true; for (let i = 0; i < keyframes.length; i++) { if (keyframes[i] !== current) return true; } } function canAnimate(keyframes, name, type, velocity) { /** * Check if we're able to animate between the start and end keyframes, * and throw a warning if we're attempting to animate between one that's * animatable and another that isn't. */ const originKeyframe = keyframes[0]; if (originKeyframe === null) return false; /** * These aren't traditionally animatable but we do support them. * In future we could look into making this more generic or replacing * this function with mix() === mixImmediate */ if (name === "display" || name === "visibility") return true; const targetKeyframe = keyframes[keyframes.length - 1]; const isOriginAnimatable = isAnimatable(originKeyframe, name); const isTargetAnimatable = isAnimatable(targetKeyframe, name); warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`); // Always skip if any of these are true if (!isOriginAnimatable || !isTargetAnimatable) { return false; } return hasKeyframesChanged(keyframes) || (type === "spring" && velocity); } ;// ./node_modules/framer-motion/dist/es/animation/animators/BaseAnimation.mjs class BaseAnimation { constructor({ autoplay = true, delay = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", ...options }) { // Track whether the animation has been stopped. Stopped animations won't restart. this.isStopped = false; this.hasAttemptedResolve = false; this.options = { autoplay, delay, type, repeat, repeatDelay, repeatType, ...options, }; this.updateFinishedPromise(); } /** * A getter for resolved data. If keyframes are not yet resolved, accessing * this.resolved will synchronously flush all pending keyframe resolvers. * This is a deoptimisation, but at its worst still batches read/writes. */ get resolved() { if (!this._resolved && !this.hasAttemptedResolve) { flushKeyframeResolvers(); } return this._resolved; } /** * A method to be called when the keyframes resolver completes. This method * will check if its possible to run the animation and, if not, skip it. * Otherwise, it will call initPlayback on the implementing class. */ onKeyframesResolved(keyframes, finalKeyframe) { this.hasAttemptedResolve = true; const { name, type, velocity, delay, onComplete, onUpdate, isGenerator, } = this.options; /** * If we can't animate this value with the resolved keyframes * then we should complete it immediately. */ if (!isGenerator && !canAnimate(keyframes, name, type, velocity)) { // Finish immediately if (instantAnimationState.current || !delay) { onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(getFinalKeyframe(keyframes, this.options, finalKeyframe)); onComplete === null || onComplete === void 0 ? void 0 : onComplete(); this.resolveFinishedPromise(); return; } // Finish after a delay else { this.options.duration = 0; } } const resolvedAnimation = this.initPlayback(keyframes, finalKeyframe); if (resolvedAnimation === false) return; this._resolved = { keyframes, finalKeyframe, ...resolvedAnimation, }; this.onPostResolved(); } onPostResolved() { } /** * Allows the returned animation to be awaited or promise-chained. Currently * resolves when the animation finishes at all but in a future update could/should * reject if its cancels. */ then(resolve, reject) { return this.currentFinishedPromise.then(resolve, reject); } updateFinishedPromise() { this.currentFinishedPromise = new Promise((resolve) => { this.resolveFinishedPromise = resolve; }); } } ;// ./node_modules/framer-motion/dist/es/utils/velocity-per-second.mjs /* Convert velocity into velocity per second @param [number]: Unit per frame @param [number]: Frame duration in ms */ function velocityPerSecond(velocity, frameDuration) { return frameDuration ? velocity * (1000 / frameDuration) : 0; } ;// ./node_modules/framer-motion/dist/es/animation/generators/utils/velocity.mjs const velocitySampleDuration = 5; // ms function calcGeneratorVelocity(resolveValue, t, current) { const prevT = Math.max(t - velocitySampleDuration, 0); return velocityPerSecond(current - resolveValue(prevT), t - prevT); } ;// ./node_modules/framer-motion/dist/es/animation/generators/spring/find.mjs const safeMin = 0.001; const minDuration = 0.01; const maxDuration = 10.0; const minDamping = 0.05; const maxDamping = 1; function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) { let envelope; let derivative; warning(duration <= secondsToMilliseconds(maxDuration), "Spring duration must be 10 seconds or less"); let dampingRatio = 1 - bounce; /** * Restrict dampingRatio and duration to within acceptable ranges. */ dampingRatio = clamp_clamp(minDamping, maxDamping, dampingRatio); duration = clamp_clamp(minDuration, maxDuration, millisecondsToSeconds(duration)); if (dampingRatio < 1) { /** * Underdamped spring */ envelope = (undampedFreq) => { const exponentialDecay = undampedFreq * dampingRatio; const delta = exponentialDecay * duration; const a = exponentialDecay - velocity; const b = calcAngularFreq(undampedFreq, dampingRatio); const c = Math.exp(-delta); return safeMin - (a / b) * c; }; derivative = (undampedFreq) => { const exponentialDecay = undampedFreq * dampingRatio; const delta = exponentialDecay * duration; const d = delta * velocity + velocity; const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration; const f = Math.exp(-delta); const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio); const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1; return (factor * ((d - e) * f)) / g; }; } else { /** * Critically-damped spring */ envelope = (undampedFreq) => { const a = Math.exp(-undampedFreq * duration); const b = (undampedFreq - velocity) * duration + 1; return -safeMin + a * b; }; derivative = (undampedFreq) => { const a = Math.exp(-undampedFreq * duration); const b = (velocity - undampedFreq) * (duration * duration); return a * b; }; } const initialGuess = 5 / duration; const undampedFreq = approximateRoot(envelope, derivative, initialGuess); duration = secondsToMilliseconds(duration); if (isNaN(undampedFreq)) { return { stiffness: 100, damping: 10, duration, }; } else { const stiffness = Math.pow(undampedFreq, 2) * mass; return { stiffness, damping: dampingRatio * 2 * Math.sqrt(mass * stiffness), duration, }; } } const rootIterations = 12; function approximateRoot(envelope, derivative, initialGuess) { let result = initialGuess; for (let i = 1; i < rootIterations; i++) { result = result - envelope(result) / derivative(result); } return result; } function calcAngularFreq(undampedFreq, dampingRatio) { return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio); } ;// ./node_modules/framer-motion/dist/es/animation/generators/spring/index.mjs const durationKeys = ["duration", "bounce"]; const physicsKeys = ["stiffness", "damping", "mass"]; function isSpringType(options, keys) { return keys.some((key) => options[key] !== undefined); } function getSpringOptions(options) { let springOptions = { velocity: 0.0, stiffness: 100, damping: 10, mass: 1.0, isResolvedFromDuration: false, ...options, }; // stiffness/damping/mass overrides duration/bounce if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) { const derived = findSpring(options); springOptions = { ...springOptions, ...derived, mass: 1.0, }; springOptions.isResolvedFromDuration = true; } return springOptions; } function spring({ keyframes, restDelta, restSpeed, ...options }) { const origin = keyframes[0]; const target = keyframes[keyframes.length - 1]; /** * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator * to reduce GC during animation. */ const state = { done: false, value: origin }; const { stiffness, damping, mass, duration, velocity, isResolvedFromDuration, } = getSpringOptions({ ...options, velocity: -millisecondsToSeconds(options.velocity || 0), }); const initialVelocity = velocity || 0.0; const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass)); const initialDelta = target - origin; const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass)); /** * If we're working on a granular scale, use smaller defaults for determining * when the spring is finished. * * These defaults have been selected emprically based on what strikes a good * ratio between feeling good and finishing as soon as changes are imperceptible. */ const isGranularScale = Math.abs(initialDelta) < 5; restSpeed || (restSpeed = isGranularScale ? 0.01 : 2); restDelta || (restDelta = isGranularScale ? 0.005 : 0.5); let resolveSpring; if (dampingRatio < 1) { const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio); // Underdamped spring resolveSpring = (t) => { const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t); return (target - envelope * (((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq) * Math.sin(angularFreq * t) + initialDelta * Math.cos(angularFreq * t))); }; } else if (dampingRatio === 1) { // Critically damped spring resolveSpring = (t) => target - Math.exp(-undampedAngularFreq * t) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t); } else { // Overdamped spring const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1); resolveSpring = (t) => { const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t); // When performing sinh or cosh values can hit Infinity so we cap them here const freqForT = Math.min(dampedAngularFreq * t, 300); return (target - (envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT))) / dampedAngularFreq); }; } return { calculatedDuration: isResolvedFromDuration ? duration || null : null, next: (t) => { const current = resolveSpring(t); if (!isResolvedFromDuration) { let currentVelocity = initialVelocity; if (t !== 0) { /** * We only need to calculate velocity for under-damped springs * as over- and critically-damped springs can't overshoot, so * checking only for displacement is enough. */ if (dampingRatio < 1) { currentVelocity = calcGeneratorVelocity(resolveSpring, t, current); } else { currentVelocity = 0; } } const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed; const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta; state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold; } else { state.done = t >= duration; } state.value = state.done ? target : current; return state; }, }; } ;// ./node_modules/framer-motion/dist/es/animation/generators/inertia.mjs function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) { const origin = keyframes[0]; const state = { done: false, value: origin, }; const isOutOfBounds = (v) => (min !== undefined && v < min) || (max !== undefined && v > max); const nearestBoundary = (v) => { if (min === undefined) return max; if (max === undefined) return min; return Math.abs(min - v) < Math.abs(max - v) ? min : max; }; let amplitude = power * velocity; const ideal = origin + amplitude; const target = modifyTarget === undefined ? ideal : modifyTarget(ideal); /** * If the target has changed we need to re-calculate the amplitude, otherwise * the animation will start from the wrong position. */ if (target !== ideal) amplitude = target - origin; const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant); const calcLatest = (t) => target + calcDelta(t); const applyFriction = (t) => { const delta = calcDelta(t); const latest = calcLatest(t); state.done = Math.abs(delta) <= restDelta; state.value = state.done ? target : latest; }; /** * Ideally this would resolve for t in a stateless way, we could * do that by always precalculating the animation but as we know * this will be done anyway we can assume that spring will * be discovered during that. */ let timeReachedBoundary; let spring$1; const checkCatchBoundary = (t) => { if (!isOutOfBounds(state.value)) return; timeReachedBoundary = t; spring$1 = spring({ keyframes: [state.value, nearestBoundary(state.value)], velocity: calcGeneratorVelocity(calcLatest, t, state.value), // TODO: This should be passing * 1000 damping: bounceDamping, stiffness: bounceStiffness, restDelta, restSpeed, }); }; checkCatchBoundary(0); return { calculatedDuration: null, next: (t) => { /** * We need to resolve the friction to figure out if we need a * spring but we don't want to do this twice per frame. So here * we flag if we updated for this frame and later if we did * we can skip doing it again. */ let hasUpdatedFrame = false; if (!spring$1 && timeReachedBoundary === undefined) { hasUpdatedFrame = true; applyFriction(t); checkCatchBoundary(t); } /** * If we have a spring and the provided t is beyond the moment the friction * animation crossed the min/max boundary, use the spring. */ if (timeReachedBoundary !== undefined && t >= timeReachedBoundary) { return spring$1.next(t - timeReachedBoundary); } else { !hasUpdatedFrame && applyFriction(t); return state; } }, }; } ;// ./node_modules/framer-motion/dist/es/easing/cubic-bezier.mjs /* Bezier function generator This has been modified from Gaëtan Renaudeau's BezierEasing https://github.com/gre/bezier-easing/blob/master/src/index.js https://github.com/gre/bezier-easing/blob/master/LICENSE I've removed the newtonRaphsonIterate algo because in benchmarking it wasn't noticiably faster than binarySubdivision, indeed removing it usually improved times, depending on the curve. I also removed the lookup table, as for the added bundle size and loop we're only cutting ~4 or so subdivision iterations. I bumped the max iterations up to 12 to compensate and this still tended to be faster for no perceivable loss in accuracy. Usage const easeOut = cubicBezier(.17,.67,.83,.67); const x = easeOut(0.5); // returns 0.627... */ // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2. const calcBezier = (t, a1, a2) => (((1.0 - 3.0 * a2 + 3.0 * a1) * t + (3.0 * a2 - 6.0 * a1)) * t + 3.0 * a1) * t; const subdivisionPrecision = 0.0000001; const subdivisionMaxIterations = 12; function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) { let currentX; let currentT; let i = 0; do { currentT = lowerBound + (upperBound - lowerBound) / 2.0; currentX = calcBezier(currentT, mX1, mX2) - x; if (currentX > 0.0) { upperBound = currentT; } else { lowerBound = currentT; } } while (Math.abs(currentX) > subdivisionPrecision && ++i < subdivisionMaxIterations); return currentT; } function cubicBezier(mX1, mY1, mX2, mY2) { // If this is a linear gradient, return linear easing if (mX1 === mY1 && mX2 === mY2) return noop_noop; const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2); // If animation is at start/end, return t without easing return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2); } ;// ./node_modules/framer-motion/dist/es/easing/ease.mjs const easeIn = cubicBezier(0.42, 0, 1, 1); const easeOut = cubicBezier(0, 0, 0.58, 1); const easeInOut = cubicBezier(0.42, 0, 0.58, 1); ;// ./node_modules/framer-motion/dist/es/easing/utils/is-easing-array.mjs const isEasingArray = (ease) => { return Array.isArray(ease) && typeof ease[0] !== "number"; }; ;// ./node_modules/framer-motion/dist/es/easing/modifiers/mirror.mjs // Accepts an easing function and returns a new one that outputs mirrored values for // the second half of the animation. Turns easeIn into easeInOut. const mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2; ;// ./node_modules/framer-motion/dist/es/easing/modifiers/reverse.mjs // Accepts an easing function and returns a new one that outputs reversed values. // Turns easeIn into easeOut. const reverseEasing = (easing) => (p) => 1 - easing(1 - p); ;// ./node_modules/framer-motion/dist/es/easing/circ.mjs const circIn = (p) => 1 - Math.sin(Math.acos(p)); const circOut = reverseEasing(circIn); const circInOut = mirrorEasing(circIn); ;// ./node_modules/framer-motion/dist/es/easing/back.mjs const backOut = cubicBezier(0.33, 1.53, 0.69, 0.99); const backIn = reverseEasing(backOut); const backInOut = mirrorEasing(backIn); ;// ./node_modules/framer-motion/dist/es/easing/anticipate.mjs const anticipate = (p) => (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1))); ;// ./node_modules/framer-motion/dist/es/easing/utils/map.mjs const easingLookup = { linear: noop_noop, easeIn: easeIn, easeInOut: easeInOut, easeOut: easeOut, circIn: circIn, circInOut: circInOut, circOut: circOut, backIn: backIn, backInOut: backInOut, backOut: backOut, anticipate: anticipate, }; const easingDefinitionToFunction = (definition) => { if (Array.isArray(definition)) { // If cubic bezier definition, create bezier curve errors_invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`); const [x1, y1, x2, y2] = definition; return cubicBezier(x1, y1, x2, y2); } else if (typeof definition === "string") { // Else lookup from table errors_invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'`); return easingLookup[definition]; } return definition; }; ;// ./node_modules/framer-motion/dist/es/utils/progress.mjs /* Progress within given range Given a lower limit and an upper limit, we return the progress (expressed as a number 0-1) represented by the given value, and limit that progress to within 0-1. @param [number]: Lower limit @param [number]: Upper limit @param [number]: Value to find progress within given range @return [number]: Progress of value within range as expressed 0-1 */ const progress = (from, to, value) => { const toFromDifference = to - from; return toFromDifference === 0 ? 1 : (value - from) / toFromDifference; }; ;// ./node_modules/framer-motion/dist/es/utils/mix/number.mjs /* Value in range from progress Given a lower limit and an upper limit, we return the value within that range as expressed by progress (usually a number from 0 to 1) So progress = 0.5 would change from -------- to to from ---- to E.g. from = 10, to = 20, progress = 0.5 => 15 @param [number]: Lower limit of range @param [number]: Upper limit of range @param [number]: The progress between lower and upper limits expressed 0-1 @return [number]: Value as calculated from progress within range (not limited within range) */ const mixNumber = (from, to, progress) => { return from + (to - from) * progress; }; ;// ./node_modules/framer-motion/dist/es/utils/hsla-to-rgba.mjs // Adapted from https://gist.github.com/mjackson/5311256 function hueToRgb(p, q, t) { if (t < 0) t += 1; if (t > 1) t -= 1; if (t < 1 / 6) return p + (q - p) * 6 * t; if (t < 1 / 2) return q; if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; return p; } function hslaToRgba({ hue, saturation, lightness, alpha }) { hue /= 360; saturation /= 100; lightness /= 100; let red = 0; let green = 0; let blue = 0; if (!saturation) { red = green = blue = lightness; } else { const q = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation; const p = 2 * lightness - q; red = hueToRgb(p, q, hue + 1 / 3); green = hueToRgb(p, q, hue); blue = hueToRgb(p, q, hue - 1 / 3); } return { red: Math.round(red * 255), green: Math.round(green * 255), blue: Math.round(blue * 255), alpha, }; } ;// ./node_modules/framer-motion/dist/es/utils/mix/color.mjs // Linear color space blending // Explained https://www.youtube.com/watch?v=LKnqECcg6Gw // Demonstrated http://codepen.io/osublake/pen/xGVVaN const mixLinearColor = (from, to, v) => { const fromExpo = from * from; const expo = v * (to * to - fromExpo) + fromExpo; return expo < 0 ? 0 : Math.sqrt(expo); }; const colorTypes = [hex, rgba, hsla]; const getColorType = (v) => colorTypes.find((type) => type.test(v)); function asRGBA(color) { const type = getColorType(color); errors_invariant(Boolean(type), `'${color}' is not an animatable color. Use the equivalent color code instead.`); let model = type.parse(color); if (type === hsla) { // TODO Remove this cast - needed since Framer Motion's stricter typing model = hslaToRgba(model); } return model; } const mixColor = (from, to) => { const fromRGBA = asRGBA(from); const toRGBA = asRGBA(to); const blended = { ...fromRGBA }; return (v) => { blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v); blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v); blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v); blended.alpha = mixNumber(fromRGBA.alpha, toRGBA.alpha, v); return rgba.transform(blended); }; }; ;// ./node_modules/framer-motion/dist/es/utils/mix/visibility.mjs const invisibleValues = new Set(["none", "hidden"]); /** * Returns a function that, when provided a progress value between 0 and 1, * will return the "none" or "hidden" string only when the progress is that of * the origin or target. */ function mixVisibility(origin, target) { if (invisibleValues.has(origin)) { return (p) => (p <= 0 ? origin : target); } else { return (p) => (p >= 1 ? target : origin); } } ;// ./node_modules/framer-motion/dist/es/utils/mix/complex.mjs function mixImmediate(a, b) { return (p) => (p > 0 ? b : a); } function complex_mixNumber(a, b) { return (p) => mixNumber(a, b, p); } function getMixer(a) { if (typeof a === "number") { return complex_mixNumber; } else if (typeof a === "string") { return isCSSVariableToken(a) ? mixImmediate : color.test(a) ? mixColor : mixComplex; } else if (Array.isArray(a)) { return mixArray; } else if (typeof a === "object") { return color.test(a) ? mixColor : mixObject; } return mixImmediate; } function mixArray(a, b) { const output = [...a]; const numValues = output.length; const blendValue = a.map((v, i) => getMixer(v)(v, b[i])); return (p) => { for (let i = 0; i < numValues; i++) { output[i] = blendValue[i](p); } return output; }; } function mixObject(a, b) { const output = { ...a, ...b }; const blendValue = {}; for (const key in output) { if (a[key] !== undefined && b[key] !== undefined) { blendValue[key] = getMixer(a[key])(a[key], b[key]); } } return (v) => { for (const key in blendValue) { output[key] = blendValue[key](v); } return output; }; } function matchOrder(origin, target) { var _a; const orderedOrigin = []; const pointers = { color: 0, var: 0, number: 0 }; for (let i = 0; i < target.values.length; i++) { const type = target.types[i]; const originIndex = origin.indexes[type][pointers[type]]; const originValue = (_a = origin.values[originIndex]) !== null && _a !== void 0 ? _a : 0; orderedOrigin[i] = originValue; pointers[type]++; } return orderedOrigin; } const mixComplex = (origin, target) => { const template = complex.createTransformer(target); const originStats = analyseComplexValue(origin); const targetStats = analyseComplexValue(target); const canInterpolate = originStats.indexes.var.length === targetStats.indexes.var.length && originStats.indexes.color.length === targetStats.indexes.color.length && originStats.indexes.number.length >= targetStats.indexes.number.length; if (canInterpolate) { if ((invisibleValues.has(origin) && !targetStats.values.length) || (invisibleValues.has(target) && !originStats.values.length)) { return mixVisibility(origin, target); } return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template); } else { warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`); return mixImmediate(origin, target); } }; ;// ./node_modules/framer-motion/dist/es/utils/mix/index.mjs function mix(from, to, p) { if (typeof from === "number" && typeof to === "number" && typeof p === "number") { return mixNumber(from, to, p); } const mixer = getMixer(from); return mixer(from, to); } ;// ./node_modules/framer-motion/dist/es/utils/interpolate.mjs function createMixers(output, ease, customMixer) { const mixers = []; const mixerFactory = customMixer || mix; const numMixers = output.length - 1; for (let i = 0; i < numMixers; i++) { let mixer = mixerFactory(output[i], output[i + 1]); if (ease) { const easingFunction = Array.isArray(ease) ? ease[i] || noop_noop : ease; mixer = pipe(easingFunction, mixer); } mixers.push(mixer); } return mixers; } /** * Create a function that maps from a numerical input array to a generic output array. * * Accepts: * - Numbers * - Colors (hex, hsl, hsla, rgb, rgba) * - Complex (combinations of one or more numbers or strings) * * ```jsx * const mixColor = interpolate([0, 1], ['#fff', '#000']) * * mixColor(0.5) // 'rgba(128, 128, 128, 1)' * ``` * * TODO Revist this approach once we've moved to data models for values, * probably not needed to pregenerate mixer functions. * * @public */ function interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) { const inputLength = input.length; errors_invariant(inputLength === output.length, "Both input and output ranges must be the same length"); /** * If we're only provided a single input, we can just make a function * that returns the output. */ if (inputLength === 1) return () => output[0]; if (inputLength === 2 && input[0] === input[1]) return () => output[1]; // If input runs highest -> lowest, reverse both arrays if (input[0] > input[inputLength - 1]) { input = [...input].reverse(); output = [...output].reverse(); } const mixers = createMixers(output, ease, mixer); const numMixers = mixers.length; const interpolator = (v) => { let i = 0; if (numMixers > 1) { for (; i < input.length - 2; i++) { if (v < input[i + 1]) break; } } const progressInRange = progress(input[i], input[i + 1], v); return mixers[i](progressInRange); }; return isClamp ? (v) => interpolator(clamp_clamp(input[0], input[inputLength - 1], v)) : interpolator; } ;// ./node_modules/framer-motion/dist/es/utils/offsets/fill.mjs function fillOffset(offset, remaining) { const min = offset[offset.length - 1]; for (let i = 1; i <= remaining; i++) { const offsetProgress = progress(0, remaining, i); offset.push(mixNumber(min, 1, offsetProgress)); } } ;// ./node_modules/framer-motion/dist/es/utils/offsets/default.mjs function defaultOffset(arr) { const offset = [0]; fillOffset(offset, arr.length - 1); return offset; } ;// ./node_modules/framer-motion/dist/es/utils/offsets/time.mjs function convertOffsetToTimes(offset, duration) { return offset.map((o) => o * duration); } ;// ./node_modules/framer-motion/dist/es/animation/generators/keyframes.mjs function defaultEasing(values, easing) { return values.map(() => easing || easeInOut).splice(0, values.length - 1); } function keyframes_keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "easeInOut", }) { /** * Easing functions can be externally defined as strings. Here we convert them * into actual functions. */ const easingFunctions = isEasingArray(ease) ? ease.map(easingDefinitionToFunction) : easingDefinitionToFunction(ease); /** * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator * to reduce GC during animation. */ const state = { done: false, value: keyframeValues[0], }; /** * Create a times array based on the provided 0-1 offsets */ const absoluteTimes = convertOffsetToTimes( // Only use the provided offsets if they're the correct length // TODO Maybe we should warn here if there's a length mismatch times && times.length === keyframeValues.length ? times : defaultOffset(keyframeValues), duration); const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, { ease: Array.isArray(easingFunctions) ? easingFunctions : defaultEasing(keyframeValues, easingFunctions), }); return { calculatedDuration: duration, next: (t) => { state.value = mapTimeToKeyframe(t); state.done = t >= duration; return state; }, }; } ;// ./node_modules/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs /** * Implement a practical max duration for keyframe generation * to prevent infinite loops */ const maxGeneratorDuration = 20000; function calcGeneratorDuration(generator) { let duration = 0; const timeStep = 50; let state = generator.next(duration); while (!state.done && duration < maxGeneratorDuration) { duration += timeStep; state = generator.next(duration); } return duration >= maxGeneratorDuration ? Infinity : duration; } ;// ./node_modules/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs const frameloopDriver = (update) => { const passTimestamp = ({ timestamp }) => update(timestamp); return { start: () => frame_frame.update(passTimestamp, true), stop: () => cancelFrame(passTimestamp), /** * If we're processing this frame we can use the * framelocked timestamp to keep things in sync. */ now: () => (frameData.isProcessing ? frameData.timestamp : time.now()), }; }; ;// ./node_modules/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs const generators = { decay: inertia, inertia: inertia, tween: keyframes_keyframes, keyframes: keyframes_keyframes, spring: spring, }; const percentToProgress = (percent) => percent / 100; /** * Animation that runs on the main thread. Designed to be WAAPI-spec in the subset of * features we expose publically. Mostly the compatibility is to ensure visual identity * between both WAAPI and main thread animations. */ class MainThreadAnimation extends BaseAnimation { constructor({ KeyframeResolver: KeyframeResolver$1 = KeyframeResolver, ...options }) { super(options); /** * The time at which the animation was paused. */ this.holdTime = null; /** * The time at which the animation was started. */ this.startTime = null; /** * The time at which the animation was cancelled. */ this.cancelTime = null; /** * The current time of the animation. */ this.currentTime = 0; /** * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed. */ this.playbackSpeed = 1; /** * The state of the animation to apply when the animation is resolved. This * allows calls to the public API to control the animation before it is resolved, * without us having to resolve it first. */ this.pendingPlayState = "running"; this.state = "idle"; /** * This method is bound to the instance to fix a pattern where * animation.stop is returned as a reference from a useEffect. */ this.stop = () => { this.resolver.cancel(); this.isStopped = true; if (this.state === "idle") return; this.teardown(); const { onStop } = this.options; onStop && onStop(); }; const { name, motionValue, keyframes } = this.options; const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe); if (name && motionValue && motionValue.owner) { this.resolver = motionValue.owner.resolveKeyframes(keyframes, onResolved, name, motionValue); } else { this.resolver = new KeyframeResolver$1(keyframes, onResolved, name, motionValue); } this.resolver.scheduleResolve(); } initPlayback(keyframes$1) { const { type = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0, } = this.options; const generatorFactory = generators[type] || keyframes_keyframes; /** * If our generator doesn't support mixing numbers, we need to replace keyframes with * [0, 100] and then make a function that maps that to the actual keyframes. * * 100 is chosen instead of 1 as it works nicer with spring animations. */ let mapPercentToKeyframes; let mirroredGenerator; if (generatorFactory !== keyframes_keyframes && typeof keyframes$1[0] !== "number") { if (false) {} mapPercentToKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1])); keyframes$1 = [0, 100]; } const generator = generatorFactory({ ...this.options, keyframes: keyframes$1 }); /** * If we have a mirror repeat type we need to create a second generator that outputs the * mirrored (not reversed) animation and later ping pong between the two generators. */ if (repeatType === "mirror") { mirroredGenerator = generatorFactory({ ...this.options, keyframes: [...keyframes$1].reverse(), velocity: -velocity, }); } /** * If duration is undefined and we have repeat options, * we need to calculate a duration from the generator. * * We set it to the generator itself to cache the duration. * Any timeline resolver will need to have already precalculated * the duration by this step. */ if (generator.calculatedDuration === null) { generator.calculatedDuration = calcGeneratorDuration(generator); } const { calculatedDuration } = generator; const resolvedDuration = calculatedDuration + repeatDelay; const totalDuration = resolvedDuration * (repeat + 1) - repeatDelay; return { generator, mirroredGenerator, mapPercentToKeyframes, calculatedDuration, resolvedDuration, totalDuration, }; } onPostResolved() { const { autoplay = true } = this.options; this.play(); if (this.pendingPlayState === "paused" || !autoplay) { this.pause(); } else { this.state = this.pendingPlayState; } } tick(timestamp, sample = false) { const { resolved } = this; // If the animations has failed to resolve, return the final keyframe. if (!resolved) { const { keyframes } = this.options; return { done: true, value: keyframes[keyframes.length - 1] }; } const { finalKeyframe, generator, mirroredGenerator, mapPercentToKeyframes, keyframes, calculatedDuration, totalDuration, resolvedDuration, } = resolved; if (this.startTime === null) return generator.next(0); const { delay, repeat, repeatType, repeatDelay, onUpdate } = this.options; /** * requestAnimationFrame timestamps can come through as lower than * the startTime as set by performance.now(). Here we prevent this, * though in the future it could be possible to make setting startTime * a pending operation that gets resolved here. */ if (this.speed > 0) { this.startTime = Math.min(this.startTime, timestamp); } else if (this.speed < 0) { this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime); } // Update currentTime if (sample) { this.currentTime = timestamp; } else if (this.holdTime !== null) { this.currentTime = this.holdTime; } else { // Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 = // 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for // example. this.currentTime = Math.round(timestamp - this.startTime) * this.speed; } // Rebase on delay const timeWithoutDelay = this.currentTime - delay * (this.speed >= 0 ? 1 : -1); const isInDelayPhase = this.speed >= 0 ? timeWithoutDelay < 0 : timeWithoutDelay > totalDuration; this.currentTime = Math.max(timeWithoutDelay, 0); // If this animation has finished, set the current time to the total duration. if (this.state === "finished" && this.holdTime === null) { this.currentTime = totalDuration; } let elapsed = this.currentTime; let frameGenerator = generator; if (repeat) { /** * Get the current progress (0-1) of the animation. If t is > * than duration we'll get values like 2.5 (midway through the * third iteration) */ const progress = Math.min(this.currentTime, totalDuration) / resolvedDuration; /** * Get the current iteration (0 indexed). For instance the floor of * 2.5 is 2. */ let currentIteration = Math.floor(progress); /** * Get the current progress of the iteration by taking the remainder * so 2.5 is 0.5 through iteration 2 */ let iterationProgress = progress % 1.0; /** * If iteration progress is 1 we count that as the end * of the previous iteration. */ if (!iterationProgress && progress >= 1) { iterationProgress = 1; } iterationProgress === 1 && currentIteration--; currentIteration = Math.min(currentIteration, repeat + 1); /** * Reverse progress if we're not running in "normal" direction */ const isOddIteration = Boolean(currentIteration % 2); if (isOddIteration) { if (repeatType === "reverse") { iterationProgress = 1 - iterationProgress; if (repeatDelay) { iterationProgress -= repeatDelay / resolvedDuration; } } else if (repeatType === "mirror") { frameGenerator = mirroredGenerator; } } elapsed = clamp_clamp(0, 1, iterationProgress) * resolvedDuration; } /** * If we're in negative time, set state as the initial keyframe. * This prevents delay: x, duration: 0 animations from finishing * instantly. */ const state = isInDelayPhase ? { done: false, value: keyframes[0] } : frameGenerator.next(elapsed); if (mapPercentToKeyframes) { state.value = mapPercentToKeyframes(state.value); } let { done } = state; if (!isInDelayPhase && calculatedDuration !== null) { done = this.speed >= 0 ? this.currentTime >= totalDuration : this.currentTime <= 0; } const isAnimationFinished = this.holdTime === null && (this.state === "finished" || (this.state === "running" && done)); if (isAnimationFinished && finalKeyframe !== undefined) { state.value = getFinalKeyframe(keyframes, this.options, finalKeyframe); } if (onUpdate) { onUpdate(state.value); } if (isAnimationFinished) { this.finish(); } return state; } get duration() { const { resolved } = this; return resolved ? millisecondsToSeconds(resolved.calculatedDuration) : 0; } get time() { return millisecondsToSeconds(this.currentTime); } set time(newTime) { newTime = secondsToMilliseconds(newTime); this.currentTime = newTime; if (this.holdTime !== null || this.speed === 0) { this.holdTime = newTime; } else if (this.driver) { this.startTime = this.driver.now() - newTime / this.speed; } } get speed() { return this.playbackSpeed; } set speed(newSpeed) { const hasChanged = this.playbackSpeed !== newSpeed; this.playbackSpeed = newSpeed; if (hasChanged) { this.time = millisecondsToSeconds(this.currentTime); } } play() { if (!this.resolver.isScheduled) { this.resolver.resume(); } if (!this._resolved) { this.pendingPlayState = "running"; return; } if (this.isStopped) return; const { driver = frameloopDriver, onPlay } = this.options; if (!this.driver) { this.driver = driver((timestamp) => this.tick(timestamp)); } onPlay && onPlay(); const now = this.driver.now(); if (this.holdTime !== null) { this.startTime = now - this.holdTime; } else if (!this.startTime || this.state === "finished") { this.startTime = now; } if (this.state === "finished") { this.updateFinishedPromise(); } this.cancelTime = this.startTime; this.holdTime = null; /** * Set playState to running only after we've used it in * the previous logic. */ this.state = "running"; this.driver.start(); } pause() { var _a; if (!this._resolved) { this.pendingPlayState = "paused"; return; } this.state = "paused"; this.holdTime = (_a = this.currentTime) !== null && _a !== void 0 ? _a : 0; } complete() { if (this.state !== "running") { this.play(); } this.pendingPlayState = this.state = "finished"; this.holdTime = null; } finish() { this.teardown(); this.state = "finished"; const { onComplete } = this.options; onComplete && onComplete(); } cancel() { if (this.cancelTime !== null) { this.tick(this.cancelTime); } this.teardown(); this.updateFinishedPromise(); } teardown() { this.state = "idle"; this.stopDriver(); this.resolveFinishedPromise(); this.updateFinishedPromise(); this.startTime = this.cancelTime = null; this.resolver.cancel(); } stopDriver() { if (!this.driver) return; this.driver.stop(); this.driver = undefined; } sample(time) { this.startTime = 0; return this.tick(time, true); } } // Legacy interface function animateValue(options) { return new MainThreadAnimation(options); } ;// ./node_modules/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number"; ;// ./node_modules/framer-motion/dist/es/animation/animators/waapi/easing.mjs function isWaapiSupportedEasing(easing) { return Boolean(!easing || (typeof easing === "string" && easing in supportedWaapiEasing) || isBezierDefinition(easing) || (Array.isArray(easing) && easing.every(isWaapiSupportedEasing))); } const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`; const supportedWaapiEasing = { linear: "linear", ease: "ease", easeIn: "ease-in", easeOut: "ease-out", easeInOut: "ease-in-out", circIn: cubicBezierAsString([0, 0.65, 0.55, 1]), circOut: cubicBezierAsString([0.55, 0, 1, 0.45]), backIn: cubicBezierAsString([0.31, 0.01, 0.66, -0.59]), backOut: cubicBezierAsString([0.33, 1.53, 0.69, 0.99]), }; function mapEasingToNativeEasingWithDefault(easing) { return (mapEasingToNativeEasing(easing) || supportedWaapiEasing.easeOut); } function mapEasingToNativeEasing(easing) { if (!easing) { return undefined; } else if (isBezierDefinition(easing)) { return cubicBezierAsString(easing); } else if (Array.isArray(easing)) { return easing.map(mapEasingToNativeEasingWithDefault); } else { return supportedWaapiEasing[easing]; } } ;// ./node_modules/framer-motion/dist/es/animation/animators/waapi/index.mjs function animateStyle(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease, times, } = {}) { const keyframeOptions = { [valueName]: keyframes }; if (times) keyframeOptions.offset = times; const easing = mapEasingToNativeEasing(ease); /** * If this is an easing array, apply to keyframes, not animation as a whole */ if (Array.isArray(easing)) keyframeOptions.easing = easing; return element.animate(keyframeOptions, { delay, duration, easing: !Array.isArray(easing) ? easing : "linear", fill: "both", iterations: repeat + 1, direction: repeatType === "reverse" ? "alternate" : "normal", }); } ;// ./node_modules/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs const supportsWaapi = memo(() => Object.hasOwnProperty.call(Element.prototype, "animate")); /** * A list of values that can be hardware-accelerated. */ const acceleratedValues = new Set([ "opacity", "clipPath", "filter", "transform", // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved // or until we implement support for linear() easing. // "background-color" ]); /** * 10ms is chosen here as it strikes a balance between smooth * results (more than one keyframe per frame at 60fps) and * keyframe quantity. */ const sampleDelta = 10; //ms /** * Implement a practical max duration for keyframe generation * to prevent infinite loops */ const AcceleratedAnimation_maxDuration = 20000; /** * Check if an animation can run natively via WAAPI or requires pregenerated keyframes. * WAAPI doesn't support spring or function easings so we run these as JS animation before * handing off. */ function requiresPregeneratedKeyframes(options) { return (options.type === "spring" || options.name === "backgroundColor" || !isWaapiSupportedEasing(options.ease)); } function pregenerateKeyframes(keyframes, options) { /** * Create a main-thread animation to pregenerate keyframes. * We sample this at regular intervals to generate keyframes that we then * linearly interpolate between. */ const sampleAnimation = new MainThreadAnimation({ ...options, keyframes, repeat: 0, delay: 0, isGenerator: true, }); let state = { done: false, value: keyframes[0] }; const pregeneratedKeyframes = []; /** * Bail after 20 seconds of pre-generated keyframes as it's likely * we're heading for an infinite loop. */ let t = 0; while (!state.done && t < AcceleratedAnimation_maxDuration) { state = sampleAnimation.sample(t); pregeneratedKeyframes.push(state.value); t += sampleDelta; } return { times: undefined, keyframes: pregeneratedKeyframes, duration: t - sampleDelta, ease: "linear", }; } class AcceleratedAnimation extends BaseAnimation { constructor(options) { super(options); const { name, motionValue, keyframes } = this.options; this.resolver = new DOMKeyframesResolver(keyframes, (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe), name, motionValue); this.resolver.scheduleResolve(); } initPlayback(keyframes, finalKeyframe) { var _a; let { duration = 300, times, ease, type, motionValue, name, } = this.options; /** * If element has since been unmounted, return false to indicate * the animation failed to initialised. */ if (!((_a = motionValue.owner) === null || _a === void 0 ? void 0 : _a.current)) { return false; } /** * If this animation needs pre-generated keyframes then generate. */ if (requiresPregeneratedKeyframes(this.options)) { const { onComplete, onUpdate, motionValue, ...options } = this.options; const pregeneratedAnimation = pregenerateKeyframes(keyframes, options); keyframes = pregeneratedAnimation.keyframes; // If this is a very short animation, ensure we have // at least two keyframes to animate between as older browsers // can't animate between a single keyframe. if (keyframes.length === 1) { keyframes[1] = keyframes[0]; } duration = pregeneratedAnimation.duration; times = pregeneratedAnimation.times; ease = pregeneratedAnimation.ease; type = "keyframes"; } const animation = animateStyle(motionValue.owner.current, name, keyframes, { ...this.options, duration, times, ease }); // Override the browser calculated startTime with one synchronised to other JS // and WAAPI animations starting this event loop. animation.startTime = time.now(); if (this.pendingTimeline) { animation.timeline = this.pendingTimeline; this.pendingTimeline = undefined; } else { /** * Prefer the `onfinish` prop as it's more widely supported than * the `finished` promise. * * Here, we synchronously set the provided MotionValue to the end * keyframe. If we didn't, when the WAAPI animation is finished it would * be removed from the element which would then revert to its old styles. */ animation.onfinish = () => { const { onComplete } = this.options; motionValue.set(getFinalKeyframe(keyframes, this.options, finalKeyframe)); onComplete && onComplete(); this.cancel(); this.resolveFinishedPromise(); }; } return { animation, duration, times, type, ease, keyframes: keyframes, }; } get duration() { const { resolved } = this; if (!resolved) return 0; const { duration } = resolved; return millisecondsToSeconds(duration); } get time() { const { resolved } = this; if (!resolved) return 0; const { animation } = resolved; return millisecondsToSeconds(animation.currentTime || 0); } set time(newTime) { const { resolved } = this; if (!resolved) return; const { animation } = resolved; animation.currentTime = secondsToMilliseconds(newTime); } get speed() { const { resolved } = this; if (!resolved) return 1; const { animation } = resolved; return animation.playbackRate; } set speed(newSpeed) { const { resolved } = this; if (!resolved) return; const { animation } = resolved; animation.playbackRate = newSpeed; } get state() { const { resolved } = this; if (!resolved) return "idle"; const { animation } = resolved; return animation.playState; } /** * Replace the default DocumentTimeline with another AnimationTimeline. * Currently used for scroll animations. */ attachTimeline(timeline) { if (!this._resolved) { this.pendingTimeline = timeline; } else { const { resolved } = this; if (!resolved) return noop_noop; const { animation } = resolved; animation.timeline = timeline; animation.onfinish = null; } return noop_noop; } play() { if (this.isStopped) return; const { resolved } = this; if (!resolved) return; const { animation } = resolved; if (animation.playState === "finished") { this.updateFinishedPromise(); } animation.play(); } pause() { const { resolved } = this; if (!resolved) return; const { animation } = resolved; animation.pause(); } stop() { this.resolver.cancel(); this.isStopped = true; if (this.state === "idle") return; const { resolved } = this; if (!resolved) return; const { animation, keyframes, duration, type, ease, times } = resolved; if (animation.playState === "idle" || animation.playState === "finished") { return; } /** * WAAPI doesn't natively have any interruption capabilities. * * Rather than read commited styles back out of the DOM, we can * create a renderless JS animation and sample it twice to calculate * its current value, "previous" value, and therefore allow * Motion to calculate velocity for any subsequent animation. */ if (this.time) { const { motionValue, onUpdate, onComplete, ...options } = this.options; const sampleAnimation = new MainThreadAnimation({ ...options, keyframes, duration, type, ease, times, isGenerator: true, }); const sampleTime = secondsToMilliseconds(this.time); motionValue.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta); } this.cancel(); } complete() { const { resolved } = this; if (!resolved) return; resolved.animation.finish(); } cancel() { const { resolved } = this; if (!resolved) return; resolved.animation.cancel(); } static supports(options) { const { motionValue, name, repeatDelay, repeatType, damping, type } = options; return (supportsWaapi() && name && acceleratedValues.has(name) && motionValue && motionValue.owner && motionValue.owner.current instanceof HTMLElement && /** * If we're outputting values to onUpdate then we can't use WAAPI as there's * no way to read the value from WAAPI every frame. */ !motionValue.owner.getProps().onUpdate && !repeatDelay && repeatType !== "mirror" && damping !== 0 && type !== "inertia"); } } ;// ./node_modules/framer-motion/dist/es/animation/interfaces/motion-value.mjs const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => { const valueTransition = getValueTransition(transition, name) || {}; /** * Most transition values are currently completely overwritten by value-specific * transitions. In the future it'd be nicer to blend these transitions. But for now * delay actually does inherit from the root transition if not value-specific. */ const delay = valueTransition.delay || transition.delay || 0; /** * Elapsed isn't a public transition option but can be passed through from * optimized appear effects in milliseconds. */ let { elapsed = 0 } = transition; elapsed = elapsed - secondsToMilliseconds(delay); let options = { keyframes: Array.isArray(target) ? target : [null, target], ease: "easeOut", velocity: value.getVelocity(), ...valueTransition, delay: -elapsed, onUpdate: (v) => { value.set(v); valueTransition.onUpdate && valueTransition.onUpdate(v); }, onComplete: () => { onComplete(); valueTransition.onComplete && valueTransition.onComplete(); }, name, motionValue: value, element: isHandoff ? undefined : element, }; /** * If there's no transition defined for this value, we can generate * unqiue transition settings for this value. */ if (!isTransitionDefined(valueTransition)) { options = { ...options, ...getDefaultTransition(name, options), }; } /** * Both WAAPI and our internal animation functions use durations * as defined by milliseconds, while our external API defines them * as seconds. */ if (options.duration) { options.duration = secondsToMilliseconds(options.duration); } if (options.repeatDelay) { options.repeatDelay = secondsToMilliseconds(options.repeatDelay); } if (options.from !== undefined) { options.keyframes[0] = options.from; } let shouldSkip = false; if (options.type === false || (options.duration === 0 && !options.repeatDelay)) { options.duration = 0; if (options.delay === 0) { shouldSkip = true; } } if (instantAnimationState.current || MotionGlobalConfig.skipAnimations) { shouldSkip = true; options.duration = 0; options.delay = 0; } /** * If we can or must skip creating the animation, and apply only * the final keyframe, do so. We also check once keyframes are resolved but * this early check prevents the need to create an animation at all. */ if (shouldSkip && !isHandoff && value.get() !== undefined) { const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition); if (finalKeyframe !== undefined) { frame_frame.update(() => { options.onUpdate(finalKeyframe); options.onComplete(); }); return; } } /** * Animate via WAAPI if possible. If this is a handoff animation, the optimised animation will be running via * WAAPI. Therefore, this animation must be JS to ensure it runs "under" the * optimised animation. */ if (!isHandoff && AcceleratedAnimation.supports(options)) { return new AcceleratedAnimation(options); } else { return new MainThreadAnimation(options); } }; ;// ./node_modules/framer-motion/dist/es/value/use-will-change/is.mjs function isWillChangeMotionValue(value) { return Boolean(isMotionValue(value) && value.add); } ;// ./node_modules/framer-motion/dist/es/utils/array.mjs function addUniqueItem(arr, item) { if (arr.indexOf(item) === -1) arr.push(item); } function removeItem(arr, item) { const index = arr.indexOf(item); if (index > -1) arr.splice(index, 1); } // Adapted from array-move function moveItem([...arr], fromIndex, toIndex) { const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex; if (startIndex >= 0 && startIndex < arr.length) { const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex; const [item] = arr.splice(fromIndex, 1); arr.splice(endIndex, 0, item); } return arr; } ;// ./node_modules/framer-motion/dist/es/utils/subscription-manager.mjs class SubscriptionManager { constructor() { this.subscriptions = []; } add(handler) { addUniqueItem(this.subscriptions, handler); return () => removeItem(this.subscriptions, handler); } notify(a, b, c) { const numSubscriptions = this.subscriptions.length; if (!numSubscriptions) return; if (numSubscriptions === 1) { /** * If there's only a single handler we can just call it without invoking a loop. */ this.subscriptions[0](a, b, c); } else { for (let i = 0; i < numSubscriptions; i++) { /** * Check whether the handler exists before firing as it's possible * the subscriptions were modified during this loop running. */ const handler = this.subscriptions[i]; handler && handler(a, b, c); } } } getSize() { return this.subscriptions.length; } clear() { this.subscriptions.length = 0; } } ;// ./node_modules/framer-motion/dist/es/value/index.mjs /** * Maximum time between the value of two frames, beyond which we * assume the velocity has since been 0. */ const MAX_VELOCITY_DELTA = 30; const isFloat = (value) => { return !isNaN(parseFloat(value)); }; const collectMotionValues = { current: undefined, }; /** * `MotionValue` is used to track the state and velocity of motion values. * * @public */ class MotionValue { /** * @param init - The initiating value * @param config - Optional configuration options * * - `transformer`: A function to transform incoming values with. * * @internal */ constructor(init, options = {}) { /** * This will be replaced by the build step with the latest version number. * When MotionValues are provided to motion components, warn if versions are mixed. */ this.version = "11.2.6"; /** * Tracks whether this value can output a velocity. Currently this is only true * if the value is numerical, but we might be able to widen the scope here and support * other value types. * * @internal */ this.canTrackVelocity = null; /** * An object containing a SubscriptionManager for each active event. */ this.events = {}; this.updateAndNotify = (v, render = true) => { const currentTime = time.now(); /** * If we're updating the value during another frame or eventloop * than the previous frame, then the we set the previous frame value * to current. */ if (this.updatedAt !== currentTime) { this.setPrevFrameValue(); } this.prev = this.current; this.setCurrent(v); // Update update subscribers if (this.current !== this.prev && this.events.change) { this.events.change.notify(this.current); } // Update render subscribers if (render && this.events.renderRequest) { this.events.renderRequest.notify(this.current); } }; this.hasAnimated = false; this.setCurrent(init); this.owner = options.owner; } setCurrent(current) { this.current = current; this.updatedAt = time.now(); if (this.canTrackVelocity === null && current !== undefined) { this.canTrackVelocity = isFloat(this.current); } } setPrevFrameValue(prevFrameValue = this.current) { this.prevFrameValue = prevFrameValue; this.prevUpdatedAt = this.updatedAt; } /** * Adds a function that will be notified when the `MotionValue` is updated. * * It returns a function that, when called, will cancel the subscription. * * When calling `onChange` inside a React component, it should be wrapped with the * `useEffect` hook. As it returns an unsubscribe function, this should be returned * from the `useEffect` function to ensure you don't add duplicate subscribers.. * * ```jsx * export const MyComponent = () => { * const x = useMotionValue(0) * const y = useMotionValue(0) * const opacity = useMotionValue(1) * * useEffect(() => { * function updateOpacity() { * const maxXY = Math.max(x.get(), y.get()) * const newOpacity = transform(maxXY, [0, 100], [1, 0]) * opacity.set(newOpacity) * } * * const unsubscribeX = x.on("change", updateOpacity) * const unsubscribeY = y.on("change", updateOpacity) * * return () => { * unsubscribeX() * unsubscribeY() * } * }, []) * * return <motion.div style={{ x }} /> * } * ``` * * @param subscriber - A function that receives the latest value. * @returns A function that, when called, will cancel this subscription. * * @deprecated */ onChange(subscription) { if (false) {} return this.on("change", subscription); } on(eventName, callback) { if (!this.events[eventName]) { this.events[eventName] = new SubscriptionManager(); } const unsubscribe = this.events[eventName].add(callback); if (eventName === "change") { return () => { unsubscribe(); /** * If we have no more change listeners by the start * of the next frame, stop active animations. */ frame_frame.read(() => { if (!this.events.change.getSize()) { this.stop(); } }); }; } return unsubscribe; } clearListeners() { for (const eventManagers in this.events) { this.events[eventManagers].clear(); } } /** * Attaches a passive effect to the `MotionValue`. * * @internal */ attach(passiveEffect, stopPassiveEffect) { this.passiveEffect = passiveEffect; this.stopPassiveEffect = stopPassiveEffect; } /** * Sets the state of the `MotionValue`. * * @remarks * * ```jsx * const x = useMotionValue(0) * x.set(10) * ``` * * @param latest - Latest value to set. * @param render - Whether to notify render subscribers. Defaults to `true` * * @public */ set(v, render = true) { if (!render || !this.passiveEffect) { this.updateAndNotify(v, render); } else { this.passiveEffect(v, this.updateAndNotify); } } setWithVelocity(prev, current, delta) { this.set(current); this.prev = undefined; this.prevFrameValue = prev; this.prevUpdatedAt = this.updatedAt - delta; } /** * Set the state of the `MotionValue`, stopping any active animations, * effects, and resets velocity to `0`. */ jump(v, endAnimation = true) { this.updateAndNotify(v); this.prev = v; this.prevUpdatedAt = this.prevFrameValue = undefined; endAnimation && this.stop(); if (this.stopPassiveEffect) this.stopPassiveEffect(); } /** * Returns the latest state of `MotionValue` * * @returns - The latest state of `MotionValue` * * @public */ get() { if (collectMotionValues.current) { collectMotionValues.current.push(this); } return this.current; } /** * @public */ getPrevious() { return this.prev; } /** * Returns the latest velocity of `MotionValue` * * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical. * * @public */ getVelocity() { const currentTime = time.now(); if (!this.canTrackVelocity || this.prevFrameValue === undefined || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) { return 0; } const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA); // Casts because of parseFloat's poor typing return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta); } /** * Registers a new animation to control this `MotionValue`. Only one * animation can drive a `MotionValue` at one time. * * ```jsx * value.start() * ``` * * @param animation - A function that starts the provided animation * * @internal */ start(startAnimation) { this.stop(); return new Promise((resolve) => { this.hasAnimated = true; this.animation = startAnimation(resolve); if (this.events.animationStart) { this.events.animationStart.notify(); } }).then(() => { if (this.events.animationComplete) { this.events.animationComplete.notify(); } this.clearAnimation(); }); } /** * Stop the currently active animation. * * @public */ stop() { if (this.animation) { this.animation.stop(); if (this.events.animationCancel) { this.events.animationCancel.notify(); } } this.clearAnimation(); } /** * Returns `true` if this value is currently animating. * * @public */ isAnimating() { return !!this.animation; } clearAnimation() { delete this.animation; } /** * Destroy and clean up subscribers to this `MotionValue`. * * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually * created a `MotionValue` via the `motionValue` function. * * @public */ destroy() { this.clearListeners(); this.stop(); if (this.stopPassiveEffect) { this.stopPassiveEffect(); } } } function motionValue(init, options) { return new MotionValue(init, options); } ;// ./node_modules/framer-motion/dist/es/render/utils/setters.mjs /** * Set VisualElement's MotionValue, creating a new MotionValue for it if * it doesn't exist. */ function setMotionValue(visualElement, key, value) { if (visualElement.hasValue(key)) { visualElement.getValue(key).set(value); } else { visualElement.addValue(key, motionValue(value)); } } function setTarget(visualElement, definition) { const resolved = resolveVariant(visualElement, definition); let { transitionEnd = {}, transition = {}, ...target } = resolved || {}; target = { ...target, ...transitionEnd }; for (const key in target) { const value = resolveFinalValueInKeyframes(target[key]); setMotionValue(visualElement, key, value); } } ;// ./node_modules/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs /** * Decide whether we should block this animation. Previously, we achieved this * just by checking whether the key was listed in protectedKeys, but this * posed problems if an animation was triggered by afterChildren and protectedKeys * had been set to true in the meantime. */ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) { const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true; needsAnimating[key] = false; return shouldBlock; } function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) { var _a; let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition; const willChange = visualElement.getValue("willChange"); if (transitionOverride) transition = transitionOverride; const animations = []; const animationTypeState = type && visualElement.animationState && visualElement.animationState.getState()[type]; for (const key in target) { const value = visualElement.getValue(key, (_a = visualElement.latestValues[key]) !== null && _a !== void 0 ? _a : null); const valueTarget = target[key]; if (valueTarget === undefined || (animationTypeState && shouldBlockAnimation(animationTypeState, key))) { continue; } const valueTransition = { delay, elapsed: 0, ...getValueTransition(transition || {}, key), }; /** * If this is the first time a value is being animated, check * to see if we're handling off from an existing animation. */ let isHandoff = false; if (window.HandoffAppearAnimations) { const props = visualElement.getProps(); const appearId = props[optimizedAppearDataAttribute]; if (appearId) { const elapsed = window.HandoffAppearAnimations(appearId, key, value, frame_frame); if (elapsed !== null) { valueTransition.elapsed = elapsed; isHandoff = true; } } } value.start(animateMotionValue(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key) ? { type: false } : valueTransition, visualElement, isHandoff)); const animation = value.animation; if (animation) { if (isWillChangeMotionValue(willChange)) { willChange.add(key); animation.then(() => willChange.remove(key)); } animations.push(animation); } } if (transitionEnd) { Promise.all(animations).then(() => { frame_frame.update(() => { transitionEnd && setTarget(visualElement, transitionEnd); }); }); } return animations; } ;// ./node_modules/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs function animateVariant(visualElement, variant, options = {}) { var _a; const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom : undefined); let { transition = visualElement.getDefaultTransition() || {} } = resolved || {}; if (options.transitionOverride) { transition = options.transitionOverride; } /** * If we have a variant, create a callback that runs it as an animation. * Otherwise, we resolve a Promise immediately for a composable no-op. */ const getAnimation = resolved ? () => Promise.all(animateTarget(visualElement, resolved, options)) : () => Promise.resolve(); /** * If we have children, create a callback that runs all their animations. * Otherwise, we resolve a Promise immediately for a composable no-op. */ const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size ? (forwardDelay = 0) => { const { delayChildren = 0, staggerChildren, staggerDirection, } = transition; return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options); } : () => Promise.resolve(); /** * If the transition explicitly defines a "when" option, we need to resolve either * this animation or all children animations before playing the other. */ const { when } = transition; if (when) { const [first, last] = when === "beforeChildren" ? [getAnimation, getChildAnimations] : [getChildAnimations, getAnimation]; return first().then(() => last()); } else { return Promise.all([getAnimation(), getChildAnimations(options.delay)]); } } function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) { const animations = []; const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren; const generateStaggerDuration = staggerDirection === 1 ? (i = 0) => i * staggerChildren : (i = 0) => maxStaggerDuration - i * staggerChildren; Array.from(visualElement.variantChildren) .sort(sortByTreeOrder) .forEach((child, i) => { child.notify("AnimationStart", variant); animations.push(animateVariant(child, variant, { ...options, delay: delayChildren + generateStaggerDuration(i), }).then(() => child.notify("AnimationComplete", variant))); }); return Promise.all(animations); } function sortByTreeOrder(a, b) { return a.sortNodePosition(b); } ;// ./node_modules/framer-motion/dist/es/animation/interfaces/visual-element.mjs function animateVisualElement(visualElement, definition, options = {}) { visualElement.notify("AnimationStart", definition); let animation; if (Array.isArray(definition)) { const animations = definition.map((variant) => animateVariant(visualElement, variant, options)); animation = Promise.all(animations); } else if (typeof definition === "string") { animation = animateVariant(visualElement, definition, options); } else { const resolvedDefinition = typeof definition === "function" ? resolveVariant(visualElement, definition, options.custom) : definition; animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options)); } return animation.then(() => { frame_frame.postRender(() => { visualElement.notify("AnimationComplete", definition); }); }); } ;// ./node_modules/framer-motion/dist/es/render/utils/animation-state.mjs const reversePriorityOrder = [...variantPriorityOrder].reverse(); const numAnimationTypes = variantPriorityOrder.length; function animateList(visualElement) { return (animations) => Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options))); } function createAnimationState(visualElement) { let animate = animateList(visualElement); const state = createState(); let isInitialRender = true; /** * This function will be used to reduce the animation definitions for * each active animation type into an object of resolved values for it. */ const buildResolvedTypeValues = (type) => (acc, definition) => { var _a; const resolved = resolveVariant(visualElement, definition, type === "exit" ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom : undefined); if (resolved) { const { transition, transitionEnd, ...target } = resolved; acc = { ...acc, ...target, ...transitionEnd }; } return acc; }; /** * This just allows us to inject mocked animation functions * @internal */ function setAnimateFunction(makeAnimator) { animate = makeAnimator(visualElement); } /** * When we receive new props, we need to: * 1. Create a list of protected keys for each type. This is a directory of * value keys that are currently being "handled" by types of a higher priority * so that whenever an animation is played of a given type, these values are * protected from being animated. * 2. Determine if an animation type needs animating. * 3. Determine if any values have been removed from a type and figure out * what to animate those to. */ function animateChanges(changedActiveType) { const props = visualElement.getProps(); const context = visualElement.getVariantContext(true) || {}; /** * A list of animations that we'll build into as we iterate through the animation * types. This will get executed at the end of the function. */ const animations = []; /** * Keep track of which values have been removed. Then, as we hit lower priority * animation types, we can check if they contain removed values and animate to that. */ const removedKeys = new Set(); /** * A dictionary of all encountered keys. This is an object to let us build into and * copy it without iteration. Each time we hit an animation type we set its protected * keys - the keys its not allowed to animate - to the latest version of this object. */ let encounteredKeys = {}; /** * If a variant has been removed at a given index, and this component is controlling * variant animations, we want to ensure lower-priority variants are forced to animate. */ let removedVariantIndex = Infinity; /** * Iterate through all animation types in reverse priority order. For each, we want to * detect which values it's handling and whether or not they've changed (and therefore * need to be animated). If any values have been removed, we want to detect those in * lower priority props and flag for animation. */ for (let i = 0; i < numAnimationTypes; i++) { const type = reversePriorityOrder[i]; const typeState = state[type]; const prop = props[type] !== undefined ? props[type] : context[type]; const propIsVariant = isVariantLabel(prop); /** * If this type has *just* changed isActive status, set activeDelta * to that status. Otherwise set to null. */ const activeDelta = type === changedActiveType ? typeState.isActive : null; if (activeDelta === false) removedVariantIndex = i; /** * If this prop is an inherited variant, rather than been set directly on the * component itself, we want to make sure we allow the parent to trigger animations. * * TODO: Can probably change this to a !isControllingVariants check */ let isInherited = prop === context[type] && prop !== props[type] && propIsVariant; /** * */ if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount) { isInherited = false; } /** * Set all encountered keys so far as the protected keys for this type. This will * be any key that has been animated or otherwise handled by active, higher-priortiy types. */ typeState.protectedKeys = { ...encounteredKeys }; // Check if we can skip analysing this prop early if ( // If it isn't active and hasn't *just* been set as inactive (!typeState.isActive && activeDelta === null) || // If we didn't and don't have any defined prop for this animation type (!prop && !typeState.prevProp) || // Or if the prop doesn't define an animation isAnimationControls(prop) || typeof prop === "boolean") { continue; } /** * As we go look through the values defined on this type, if we detect * a changed value or a value that was removed in a higher priority, we set * this to true and add this prop to the animation list. */ const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop); let shouldAnimateType = variantDidChange || // If we're making this variant active, we want to always make it active (type === changedActiveType && typeState.isActive && !isInherited && propIsVariant) || // If we removed a higher-priority variant (i is in reverse order) (i > removedVariantIndex && propIsVariant); let handledRemovedValues = false; /** * As animations can be set as variant lists, variants or target objects, we * coerce everything to an array if it isn't one already */ const definitionList = Array.isArray(prop) ? prop : [prop]; /** * Build an object of all the resolved values. We'll use this in the subsequent * animateChanges calls to determine whether a value has changed. */ let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {}); if (activeDelta === false) resolvedValues = {}; /** * Now we need to loop through all the keys in the prev prop and this prop, * and decide: * 1. If the value has changed, and needs animating * 2. If it has been removed, and needs adding to the removedKeys set * 3. If it has been removed in a higher priority type and needs animating * 4. If it hasn't been removed in a higher priority but hasn't changed, and * needs adding to the type's protectedKeys list. */ const { prevResolvedValues = {} } = typeState; const allKeys = { ...prevResolvedValues, ...resolvedValues, }; const markToAnimate = (key) => { shouldAnimateType = true; if (removedKeys.has(key)) { handledRemovedValues = true; removedKeys.delete(key); } typeState.needsAnimating[key] = true; const motionValue = visualElement.getValue(key); if (motionValue) motionValue.liveStyle = false; }; for (const key in allKeys) { const next = resolvedValues[key]; const prev = prevResolvedValues[key]; // If we've already handled this we can just skip ahead if (encounteredKeys.hasOwnProperty(key)) continue; /** * If the value has changed, we probably want to animate it. */ let valueHasChanged = false; if (isKeyframesTarget(next) && isKeyframesTarget(prev)) { valueHasChanged = !shallowCompare(next, prev); } else { valueHasChanged = next !== prev; } if (valueHasChanged) { if (next !== undefined && next !== null) { // If next is defined and doesn't equal prev, it needs animating markToAnimate(key); } else { // If it's undefined, it's been removed. removedKeys.add(key); } } else if (next !== undefined && removedKeys.has(key)) { /** * If next hasn't changed and it isn't undefined, we want to check if it's * been removed by a higher priority */ markToAnimate(key); } else { /** * If it hasn't changed, we add it to the list of protected values * to ensure it doesn't get animated. */ typeState.protectedKeys[key] = true; } } /** * Update the typeState so next time animateChanges is called we can compare the * latest prop and resolvedValues to these. */ typeState.prevProp = prop; typeState.prevResolvedValues = resolvedValues; /** * */ if (typeState.isActive) { encounteredKeys = { ...encounteredKeys, ...resolvedValues }; } if (isInitialRender && visualElement.blockInitialAnimation) { shouldAnimateType = false; } /** * If this is an inherited prop we want to hard-block animations */ if (shouldAnimateType && (!isInherited || handledRemovedValues)) { animations.push(...definitionList.map((animation) => ({ animation: animation, options: { type }, }))); } } /** * If there are some removed value that haven't been dealt with, * we need to create a new animation that falls back either to the value * defined in the style prop, or the last read value. */ if (removedKeys.size) { const fallbackAnimation = {}; removedKeys.forEach((key) => { const fallbackTarget = visualElement.getBaseTarget(key); const motionValue = visualElement.getValue(key); if (motionValue) motionValue.liveStyle = true; // @ts-expect-error - @mattgperry to figure if we should do something here fallbackAnimation[key] = fallbackTarget !== null && fallbackTarget !== void 0 ? fallbackTarget : null; }); animations.push({ animation: fallbackAnimation }); } let shouldAnimate = Boolean(animations.length); if (isInitialRender && (props.initial === false || props.initial === props.animate) && !visualElement.manuallyAnimateOnMount) { shouldAnimate = false; } isInitialRender = false; return shouldAnimate ? animate(animations) : Promise.resolve(); } /** * Change whether a certain animation type is active. */ function setActive(type, isActive) { var _a; // If the active state hasn't changed, we can safely do nothing here if (state[type].isActive === isActive) return Promise.resolve(); // Propagate active change to children (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach((child) => { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); }); state[type].isActive = isActive; const animations = animateChanges(type); for (const key in state) { state[key].protectedKeys = {}; } return animations; } return { animateChanges, setActive, setAnimateFunction, getState: () => state, }; } function checkVariantsDidChange(prev, next) { if (typeof next === "string") { return next !== prev; } else if (Array.isArray(next)) { return !shallowCompare(next, prev); } return false; } function createTypeState(isActive = false) { return { isActive, protectedKeys: {}, needsAnimating: {}, prevResolvedValues: {}, }; } function createState() { return { animate: createTypeState(true), whileInView: createTypeState(), whileHover: createTypeState(), whileTap: createTypeState(), whileDrag: createTypeState(), whileFocus: createTypeState(), exit: createTypeState(), }; } ;// ./node_modules/framer-motion/dist/es/motion/features/animation/index.mjs class AnimationFeature extends Feature { /** * We dynamically generate the AnimationState manager as it contains a reference * to the underlying animation library. We only want to load that if we load this, * so people can optionally code split it out using the `m` component. */ constructor(node) { super(node); node.animationState || (node.animationState = createAnimationState(node)); } updateAnimationControlsSubscription() { const { animate } = this.node.getProps(); this.unmount(); if (isAnimationControls(animate)) { this.unmount = animate.subscribe(this.node); } } /** * Subscribe any provided AnimationControls to the component's VisualElement */ mount() { this.updateAnimationControlsSubscription(); } update() { const { animate } = this.node.getProps(); const { animate: prevAnimate } = this.node.prevProps || {}; if (animate !== prevAnimate) { this.updateAnimationControlsSubscription(); } } unmount() { } } ;// ./node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs let id = 0; class ExitAnimationFeature extends Feature { constructor() { super(...arguments); this.id = id++; } update() { if (!this.node.presenceContext) return; const { isPresent, onExitComplete } = this.node.presenceContext; const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}; if (!this.node.animationState || isPresent === prevIsPresent) { return; } const exitAnimation = this.node.animationState.setActive("exit", !isPresent); if (onExitComplete && !isPresent) { exitAnimation.then(() => onExitComplete(this.id)); } } mount() { const { register } = this.node.presenceContext || {}; if (register) { this.unmount = register(this.id); } } unmount() { } } ;// ./node_modules/framer-motion/dist/es/motion/features/animations.mjs const animations = { animation: { Feature: AnimationFeature, }, exit: { Feature: ExitAnimationFeature, }, }; ;// ./node_modules/framer-motion/dist/es/utils/distance.mjs const distance = (a, b) => Math.abs(a - b); function distance2D(a, b) { // Multi-dimensional const xDelta = distance(a.x, b.x); const yDelta = distance(a.y, b.y); return Math.sqrt(xDelta ** 2 + yDelta ** 2); } ;// ./node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs /** * @internal */ class PanSession { constructor(event, handlers, { transformPagePoint, contextWindow, dragSnapToOrigin = false } = {}) { /** * @internal */ this.startEvent = null; /** * @internal */ this.lastMoveEvent = null; /** * @internal */ this.lastMoveEventInfo = null; /** * @internal */ this.handlers = {}; /** * @internal */ this.contextWindow = window; this.updatePoint = () => { if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return; const info = getPanInfo(this.lastMoveEventInfo, this.history); const isPanStarted = this.startEvent !== null; // Only start panning if the offset is larger than 3 pixels. If we make it // any larger than this we'll want to reset the pointer history // on the first update to avoid visual snapping to the cursoe. const isDistancePastThreshold = distance2D(info.offset, { x: 0, y: 0 }) >= 3; if (!isPanStarted && !isDistancePastThreshold) return; const { point } = info; const { timestamp } = frameData; this.history.push({ ...point, timestamp }); const { onStart, onMove } = this.handlers; if (!isPanStarted) { onStart && onStart(this.lastMoveEvent, info); this.startEvent = this.lastMoveEvent; } onMove && onMove(this.lastMoveEvent, info); }; this.handlePointerMove = (event, info) => { this.lastMoveEvent = event; this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint); // Throttle mouse move event to once per frame frame_frame.update(this.updatePoint, true); }; this.handlePointerUp = (event, info) => { this.end(); const { onEnd, onSessionEnd, resumeAnimation } = this.handlers; if (this.dragSnapToOrigin) resumeAnimation && resumeAnimation(); if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return; const panInfo = getPanInfo(event.type === "pointercancel" ? this.lastMoveEventInfo : transformPoint(info, this.transformPagePoint), this.history); if (this.startEvent && onEnd) { onEnd(event, panInfo); } onSessionEnd && onSessionEnd(event, panInfo); }; // If we have more than one touch, don't start detecting this gesture if (!isPrimaryPointer(event)) return; this.dragSnapToOrigin = dragSnapToOrigin; this.handlers = handlers; this.transformPagePoint = transformPagePoint; this.contextWindow = contextWindow || window; const info = extractEventInfo(event); const initialInfo = transformPoint(info, this.transformPagePoint); const { point } = initialInfo; const { timestamp } = frameData; this.history = [{ ...point, timestamp }]; const { onSessionStart } = handlers; onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history)); this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp)); } updateHandlers(handlers) { this.handlers = handlers; } end() { this.removeListeners && this.removeListeners(); cancelFrame(this.updatePoint); } } function transformPoint(info, transformPagePoint) { return transformPagePoint ? { point: transformPagePoint(info.point) } : info; } function subtractPoint(a, b) { return { x: a.x - b.x, y: a.y - b.y }; } function getPanInfo({ point }, history) { return { point, delta: subtractPoint(point, lastDevicePoint(history)), offset: subtractPoint(point, startDevicePoint(history)), velocity: getVelocity(history, 0.1), }; } function startDevicePoint(history) { return history[0]; } function lastDevicePoint(history) { return history[history.length - 1]; } function getVelocity(history, timeDelta) { if (history.length < 2) { return { x: 0, y: 0 }; } let i = history.length - 1; let timestampedPoint = null; const lastPoint = lastDevicePoint(history); while (i >= 0) { timestampedPoint = history[i]; if (lastPoint.timestamp - timestampedPoint.timestamp > secondsToMilliseconds(timeDelta)) { break; } i--; } if (!timestampedPoint) { return { x: 0, y: 0 }; } const time = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp); if (time === 0) { return { x: 0, y: 0 }; } const currentVelocity = { x: (lastPoint.x - timestampedPoint.x) / time, y: (lastPoint.y - timestampedPoint.y) / time, }; if (currentVelocity.x === Infinity) { currentVelocity.x = 0; } if (currentVelocity.y === Infinity) { currentVelocity.y = 0; } return currentVelocity; } ;// ./node_modules/framer-motion/dist/es/projection/geometry/delta-calc.mjs function calcLength(axis) { return axis.max - axis.min; } function isNear(value, target = 0, maxDistance = 0.01) { return Math.abs(value - target) <= maxDistance; } function calcAxisDelta(delta, source, target, origin = 0.5) { delta.origin = origin; delta.originPoint = mixNumber(source.min, source.max, delta.origin); delta.scale = calcLength(target) / calcLength(source); if (isNear(delta.scale, 1, 0.0001) || isNaN(delta.scale)) delta.scale = 1; delta.translate = mixNumber(target.min, target.max, delta.origin) - delta.originPoint; if (isNear(delta.translate) || isNaN(delta.translate)) delta.translate = 0; } function calcBoxDelta(delta, source, target, origin) { calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : undefined); calcAxisDelta(delta.y, source.y, target.y, origin ? origin.originY : undefined); } function calcRelativeAxis(target, relative, parent) { target.min = parent.min + relative.min; target.max = target.min + calcLength(relative); } function calcRelativeBox(target, relative, parent) { calcRelativeAxis(target.x, relative.x, parent.x); calcRelativeAxis(target.y, relative.y, parent.y); } function calcRelativeAxisPosition(target, layout, parent) { target.min = layout.min - parent.min; target.max = target.min + calcLength(layout); } function calcRelativePosition(target, layout, parent) { calcRelativeAxisPosition(target.x, layout.x, parent.x); calcRelativeAxisPosition(target.y, layout.y, parent.y); } ;// ./node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.mjs /** * Apply constraints to a point. These constraints are both physical along an * axis, and an elastic factor that determines how much to constrain the point * by if it does lie outside the defined parameters. */ function applyConstraints(point, { min, max }, elastic) { if (min !== undefined && point < min) { // If we have a min point defined, and this is outside of that, constrain point = elastic ? mixNumber(min, point, elastic.min) : Math.max(point, min); } else if (max !== undefined && point > max) { // If we have a max point defined, and this is outside of that, constrain point = elastic ? mixNumber(max, point, elastic.max) : Math.min(point, max); } return point; } /** * Calculate constraints in terms of the viewport when defined relatively to the * measured axis. This is measured from the nearest edge, so a max constraint of 200 * on an axis with a max value of 300 would return a constraint of 500 - axis length */ function calcRelativeAxisConstraints(axis, min, max) { return { min: min !== undefined ? axis.min + min : undefined, max: max !== undefined ? axis.max + max - (axis.max - axis.min) : undefined, }; } /** * Calculate constraints in terms of the viewport when * defined relatively to the measured bounding box. */ function calcRelativeConstraints(layoutBox, { top, left, bottom, right }) { return { x: calcRelativeAxisConstraints(layoutBox.x, left, right), y: calcRelativeAxisConstraints(layoutBox.y, top, bottom), }; } /** * Calculate viewport constraints when defined as another viewport-relative axis */ function calcViewportAxisConstraints(layoutAxis, constraintsAxis) { let min = constraintsAxis.min - layoutAxis.min; let max = constraintsAxis.max - layoutAxis.max; // If the constraints axis is actually smaller than the layout axis then we can // flip the constraints if (constraintsAxis.max - constraintsAxis.min < layoutAxis.max - layoutAxis.min) { [min, max] = [max, min]; } return { min, max }; } /** * Calculate viewport constraints when defined as another viewport-relative box */ function calcViewportConstraints(layoutBox, constraintsBox) { return { x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x), y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y), }; } /** * Calculate a transform origin relative to the source axis, between 0-1, that results * in an asthetically pleasing scale/transform needed to project from source to target. */ function constraints_calcOrigin(source, target) { let origin = 0.5; const sourceLength = calcLength(source); const targetLength = calcLength(target); if (targetLength > sourceLength) { origin = progress(target.min, target.max - sourceLength, source.min); } else if (sourceLength > targetLength) { origin = progress(source.min, source.max - targetLength, target.min); } return clamp_clamp(0, 1, origin); } /** * Rebase the calculated viewport constraints relative to the layout.min point. */ function rebaseAxisConstraints(layout, constraints) { const relativeConstraints = {}; if (constraints.min !== undefined) { relativeConstraints.min = constraints.min - layout.min; } if (constraints.max !== undefined) { relativeConstraints.max = constraints.max - layout.min; } return relativeConstraints; } const defaultElastic = 0.35; /** * Accepts a dragElastic prop and returns resolved elastic values for each axis. */ function resolveDragElastic(dragElastic = defaultElastic) { if (dragElastic === false) { dragElastic = 0; } else if (dragElastic === true) { dragElastic = defaultElastic; } return { x: resolveAxisElastic(dragElastic, "left", "right"), y: resolveAxisElastic(dragElastic, "top", "bottom"), }; } function resolveAxisElastic(dragElastic, minLabel, maxLabel) { return { min: resolvePointElastic(dragElastic, minLabel), max: resolvePointElastic(dragElastic, maxLabel), }; } function resolvePointElastic(dragElastic, label) { return typeof dragElastic === "number" ? dragElastic : dragElastic[label] || 0; } ;// ./node_modules/framer-motion/dist/es/projection/geometry/models.mjs const createAxisDelta = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0, }); const createDelta = () => ({ x: createAxisDelta(), y: createAxisDelta(), }); const createAxis = () => ({ min: 0, max: 0 }); const createBox = () => ({ x: createAxis(), y: createAxis(), }); ;// ./node_modules/framer-motion/dist/es/projection/utils/each-axis.mjs function eachAxis(callback) { return [callback("x"), callback("y")]; } ;// ./node_modules/framer-motion/dist/es/projection/geometry/conversion.mjs /** * Bounding boxes tend to be defined as top, left, right, bottom. For various operations * it's easier to consider each axis individually. This function returns a bounding box * as a map of single-axis min/max values. */ function convertBoundingBoxToBox({ top, left, right, bottom, }) { return { x: { min: left, max: right }, y: { min: top, max: bottom }, }; } function convertBoxToBoundingBox({ x, y }) { return { top: y.min, right: x.max, bottom: y.max, left: x.min }; } /** * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function * provided by Framer to allow measured points to be corrected for device scaling. This is used * when measuring DOM elements and DOM event points. */ function transformBoxPoints(point, transformPoint) { if (!transformPoint) return point; const topLeft = transformPoint({ x: point.left, y: point.top }); const bottomRight = transformPoint({ x: point.right, y: point.bottom }); return { top: topLeft.y, left: topLeft.x, bottom: bottomRight.y, right: bottomRight.x, }; } ;// ./node_modules/framer-motion/dist/es/projection/utils/has-transform.mjs function isIdentityScale(scale) { return scale === undefined || scale === 1; } function hasScale({ scale, scaleX, scaleY }) { return (!isIdentityScale(scale) || !isIdentityScale(scaleX) || !isIdentityScale(scaleY)); } function hasTransform(values) { return (hasScale(values) || has2DTranslate(values) || values.z || values.rotate || values.rotateX || values.rotateY || values.skewX || values.skewY); } function has2DTranslate(values) { return is2DTranslate(values.x) || is2DTranslate(values.y); } function is2DTranslate(value) { return value && value !== "0%"; } ;// ./node_modules/framer-motion/dist/es/projection/geometry/delta-apply.mjs /** * Scales a point based on a factor and an originPoint */ function scalePoint(point, scale, originPoint) { const distanceFromOrigin = point - originPoint; const scaled = scale * distanceFromOrigin; return originPoint + scaled; } /** * Applies a translate/scale delta to a point */ function applyPointDelta(point, translate, scale, originPoint, boxScale) { if (boxScale !== undefined) { point = scalePoint(point, boxScale, originPoint); } return scalePoint(point, scale, originPoint) + translate; } /** * Applies a translate/scale delta to an axis */ function applyAxisDelta(axis, translate = 0, scale = 1, originPoint, boxScale) { axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale); axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale); } /** * Applies a translate/scale delta to a box */ function applyBoxDelta(box, { x, y }) { applyAxisDelta(box.x, x.translate, x.scale, x.originPoint); applyAxisDelta(box.y, y.translate, y.scale, y.originPoint); } /** * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms * in a tree upon our box before then calculating how to project it into our desired viewport-relative box * * This is the final nested loop within updateLayoutDelta for future refactoring */ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) { const treeLength = treePath.length; if (!treeLength) return; // Reset the treeScale treeScale.x = treeScale.y = 1; let node; let delta; for (let i = 0; i < treeLength; i++) { node = treePath[i]; delta = node.projectionDelta; /** * TODO: Prefer to remove this, but currently we have motion components with * display: contents in Framer. */ const instance = node.instance; if (instance && instance.style && instance.style.display === "contents") { continue; } if (isSharedTransition && node.options.layoutScroll && node.scroll && node !== node.root) { transformBox(box, { x: -node.scroll.offset.x, y: -node.scroll.offset.y, }); } if (delta) { // Incoporate each ancestor's scale into a culmulative treeScale for this component treeScale.x *= delta.x.scale; treeScale.y *= delta.y.scale; // Apply each ancestor's calculated delta into this component's recorded layout box applyBoxDelta(box, delta); } if (isSharedTransition && hasTransform(node.latestValues)) { transformBox(box, node.latestValues); } } /** * Snap tree scale back to 1 if it's within a non-perceivable threshold. * This will help reduce useless scales getting rendered. */ treeScale.x = snapToDefault(treeScale.x); treeScale.y = snapToDefault(treeScale.y); } function snapToDefault(scale) { if (Number.isInteger(scale)) return scale; return scale > 1.0000000000001 || scale < 0.999999999999 ? scale : 1; } function translateAxis(axis, distance) { axis.min = axis.min + distance; axis.max = axis.max + distance; } /** * Apply a transform to an axis from the latest resolved motion values. * This function basically acts as a bridge between a flat motion value map * and applyAxisDelta */ function transformAxis(axis, transforms, [key, scaleKey, originKey]) { const axisOrigin = transforms[originKey] !== undefined ? transforms[originKey] : 0.5; const originPoint = mixNumber(axis.min, axis.max, axisOrigin); // Apply the axis delta to the final axis applyAxisDelta(axis, transforms[key], transforms[scaleKey], originPoint, transforms.scale); } /** * The names of the motion values we want to apply as translation, scale and origin. */ const xKeys = ["x", "scaleX", "originX"]; const yKeys = ["y", "scaleY", "originY"]; /** * Apply a transform to a box from the latest resolved motion values. */ function transformBox(box, transform) { transformAxis(box.x, transform, xKeys); transformAxis(box.y, transform, yKeys); } ;// ./node_modules/framer-motion/dist/es/projection/utils/measure.mjs function measureViewportBox(instance, transformPoint) { return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint)); } function measurePageBox(element, rootProjectionNode, transformPagePoint) { const viewportBox = measureViewportBox(element, transformPagePoint); const { scroll } = rootProjectionNode; if (scroll) { translateAxis(viewportBox.x, scroll.offset.x); translateAxis(viewportBox.y, scroll.offset.y); } return viewportBox; } ;// ./node_modules/framer-motion/dist/es/utils/get-context-window.mjs // Fixes https://github.com/framer/motion/issues/2270 const getContextWindow = ({ current }) => { return current ? current.ownerDocument.defaultView : null; }; ;// ./node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs const elementDragControls = new WeakMap(); /** * */ // let latestPointerEvent: PointerEvent class VisualElementDragControls { constructor(visualElement) { // This is a reference to the global drag gesture lock, ensuring only one component // can "capture" the drag of one or both axes. // TODO: Look into moving this into pansession? this.openGlobalLock = null; this.isDragging = false; this.currentDirection = null; this.originPoint = { x: 0, y: 0 }; /** * The permitted boundaries of travel, in pixels. */ this.constraints = false; this.hasMutatedConstraints = false; /** * The per-axis resolved elastic values. */ this.elastic = createBox(); this.visualElement = visualElement; } start(originEvent, { snapToCursor = false } = {}) { /** * Don't start dragging if this component is exiting */ const { presenceContext } = this.visualElement; if (presenceContext && presenceContext.isPresent === false) return; const onSessionStart = (event) => { const { dragSnapToOrigin } = this.getProps(); // Stop or pause any animations on both axis values immediately. This allows the user to throw and catch // the component. dragSnapToOrigin ? this.pauseAnimation() : this.stopAnimation(); if (snapToCursor) { this.snapToCursor(extractEventInfo(event, "page").point); } }; const onStart = (event, info) => { // Attempt to grab the global drag gesture lock - maybe make this part of PanSession const { drag, dragPropagation, onDragStart } = this.getProps(); if (drag && !dragPropagation) { if (this.openGlobalLock) this.openGlobalLock(); this.openGlobalLock = getGlobalLock(drag); // If we don 't have the lock, don't start dragging if (!this.openGlobalLock) return; } this.isDragging = true; this.currentDirection = null; this.resolveConstraints(); if (this.visualElement.projection) { this.visualElement.projection.isAnimationBlocked = true; this.visualElement.projection.target = undefined; } /** * Record gesture origin */ eachAxis((axis) => { let current = this.getAxisMotionValue(axis).get() || 0; /** * If the MotionValue is a percentage value convert to px */ if (percent.test(current)) { const { projection } = this.visualElement; if (projection && projection.layout) { const measuredAxis = projection.layout.layoutBox[axis]; if (measuredAxis) { const length = calcLength(measuredAxis); current = length * (parseFloat(current) / 100); } } } this.originPoint[axis] = current; }); // Fire onDragStart event if (onDragStart) { frame_frame.postRender(() => onDragStart(event, info)); } const { animationState } = this.visualElement; animationState && animationState.setActive("whileDrag", true); }; const onMove = (event, info) => { // latestPointerEvent = event const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps(); // If we didn't successfully receive the gesture lock, early return. if (!dragPropagation && !this.openGlobalLock) return; const { offset } = info; // Attempt to detect drag direction if directionLock is true if (dragDirectionLock && this.currentDirection === null) { this.currentDirection = getCurrentDirection(offset); // If we've successfully set a direction, notify listener if (this.currentDirection !== null) { onDirectionLock && onDirectionLock(this.currentDirection); } return; } // Update each point with the latest position this.updateAxis("x", info.point, offset); this.updateAxis("y", info.point, offset); /** * Ideally we would leave the renderer to fire naturally at the end of * this frame but if the element is about to change layout as the result * of a re-render we want to ensure the browser can read the latest * bounding box to ensure the pointer and element don't fall out of sync. */ this.visualElement.render(); /** * This must fire after the render call as it might trigger a state * change which itself might trigger a layout update. */ onDrag && onDrag(event, info); }; const onSessionEnd = (event, info) => this.stop(event, info); const resumeAnimation = () => eachAxis((axis) => { var _a; return this.getAnimationState(axis) === "paused" && ((_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.play()); }); const { dragSnapToOrigin } = this.getProps(); this.panSession = new PanSession(originEvent, { onSessionStart, onStart, onMove, onSessionEnd, resumeAnimation, }, { transformPagePoint: this.visualElement.getTransformPagePoint(), dragSnapToOrigin, contextWindow: getContextWindow(this.visualElement), }); } stop(event, info) { const isDragging = this.isDragging; this.cancel(); if (!isDragging) return; const { velocity } = info; this.startAnimation(velocity); const { onDragEnd } = this.getProps(); if (onDragEnd) { frame_frame.postRender(() => onDragEnd(event, info)); } } cancel() { this.isDragging = false; const { projection, animationState } = this.visualElement; if (projection) { projection.isAnimationBlocked = false; } this.panSession && this.panSession.end(); this.panSession = undefined; const { dragPropagation } = this.getProps(); if (!dragPropagation && this.openGlobalLock) { this.openGlobalLock(); this.openGlobalLock = null; } animationState && animationState.setActive("whileDrag", false); } updateAxis(axis, _point, offset) { const { drag } = this.getProps(); // If we're not dragging this axis, do an early return. if (!offset || !shouldDrag(axis, drag, this.currentDirection)) return; const axisValue = this.getAxisMotionValue(axis); let next = this.originPoint[axis] + offset[axis]; // Apply constraints if (this.constraints && this.constraints[axis]) { next = applyConstraints(next, this.constraints[axis], this.elastic[axis]); } axisValue.set(next); } resolveConstraints() { var _a; const { dragConstraints, dragElastic } = this.getProps(); const layout = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(false) : (_a = this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout; const prevConstraints = this.constraints; if (dragConstraints && isRefObject(dragConstraints)) { if (!this.constraints) { this.constraints = this.resolveRefConstraints(); } } else { if (dragConstraints && layout) { this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints); } else { this.constraints = false; } } this.elastic = resolveDragElastic(dragElastic); /** * If we're outputting to external MotionValues, we want to rebase the measured constraints * from viewport-relative to component-relative. */ if (prevConstraints !== this.constraints && layout && this.constraints && !this.hasMutatedConstraints) { eachAxis((axis) => { if (this.constraints !== false && this.getAxisMotionValue(axis)) { this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]); } }); } } resolveRefConstraints() { const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps(); if (!constraints || !isRefObject(constraints)) return false; const constraintsElement = constraints.current; errors_invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."); const { projection } = this.visualElement; // TODO if (!projection || !projection.layout) return false; const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint()); let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox); /** * If there's an onMeasureDragConstraints listener we call it and * if different constraints are returned, set constraints to that */ if (onMeasureDragConstraints) { const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints)); this.hasMutatedConstraints = !!userConstraints; if (userConstraints) { measuredConstraints = convertBoundingBoxToBox(userConstraints); } } return measuredConstraints; } startAnimation(velocity) { const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps(); const constraints = this.constraints || {}; const momentumAnimations = eachAxis((axis) => { if (!shouldDrag(axis, drag, this.currentDirection)) { return; } let transition = (constraints && constraints[axis]) || {}; if (dragSnapToOrigin) transition = { min: 0, max: 0 }; /** * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame * of spring animations so we should look into adding a disable spring option to `inertia`. * We could do something here where we affect the `bounceStiffness` and `bounceDamping` * using the value of `dragElastic`. */ const bounceStiffness = dragElastic ? 200 : 1000000; const bounceDamping = dragElastic ? 40 : 10000000; const inertia = { type: "inertia", velocity: dragMomentum ? velocity[axis] : 0, bounceStiffness, bounceDamping, timeConstant: 750, restDelta: 1, restSpeed: 10, ...dragTransition, ...transition, }; // If we're not animating on an externally-provided `MotionValue` we can use the // component's animation controls which will handle interactions with whileHover (etc), // otherwise we just have to animate the `MotionValue` itself. return this.startAxisValueAnimation(axis, inertia); }); // Run all animations and then resolve the new drag constraints. return Promise.all(momentumAnimations).then(onDragTransitionEnd); } startAxisValueAnimation(axis, transition) { const axisValue = this.getAxisMotionValue(axis); return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement)); } stopAnimation() { eachAxis((axis) => this.getAxisMotionValue(axis).stop()); } pauseAnimation() { eachAxis((axis) => { var _a; return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.pause(); }); } getAnimationState(axis) { var _a; return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.state; } /** * Drag works differently depending on which props are provided. * * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values. * - Otherwise, we apply the delta to the x/y motion values. */ getAxisMotionValue(axis) { const dragKey = `_drag${axis.toUpperCase()}`; const props = this.visualElement.getProps(); const externalMotionValue = props[dragKey]; return externalMotionValue ? externalMotionValue : this.visualElement.getValue(axis, (props.initial ? props.initial[axis] : undefined) || 0); } snapToCursor(point) { eachAxis((axis) => { const { drag } = this.getProps(); // If we're not dragging this axis, do an early return. if (!shouldDrag(axis, drag, this.currentDirection)) return; const { projection } = this.visualElement; const axisValue = this.getAxisMotionValue(axis); if (projection && projection.layout) { const { min, max } = projection.layout.layoutBox[axis]; axisValue.set(point[axis] - mixNumber(min, max, 0.5)); } }); } /** * When the viewport resizes we want to check if the measured constraints * have changed and, if so, reposition the element within those new constraints * relative to where it was before the resize. */ scalePositionWithinConstraints() { if (!this.visualElement.current) return; const { drag, dragConstraints } = this.getProps(); const { projection } = this.visualElement; if (!isRefObject(dragConstraints) || !projection || !this.constraints) return; /** * Stop current animations as there can be visual glitching if we try to do * this mid-animation */ this.stopAnimation(); /** * Record the relative position of the dragged element relative to the * constraints box and save as a progress value. */ const boxProgress = { x: 0, y: 0 }; eachAxis((axis) => { const axisValue = this.getAxisMotionValue(axis); if (axisValue && this.constraints !== false) { const latest = axisValue.get(); boxProgress[axis] = constraints_calcOrigin({ min: latest, max: latest }, this.constraints[axis]); } }); /** * Update the layout of this element and resolve the latest drag constraints */ const { transformTemplate } = this.visualElement.getProps(); this.visualElement.current.style.transform = transformTemplate ? transformTemplate({}, "") : "none"; projection.root && projection.root.updateScroll(); projection.updateLayout(); this.resolveConstraints(); /** * For each axis, calculate the current progress of the layout axis * within the new constraints. */ eachAxis((axis) => { if (!shouldDrag(axis, drag, null)) return; /** * Calculate a new transform based on the previous box progress */ const axisValue = this.getAxisMotionValue(axis); const { min, max } = this.constraints[axis]; axisValue.set(mixNumber(min, max, boxProgress[axis])); }); } addListeners() { if (!this.visualElement.current) return; elementDragControls.set(this.visualElement, this); const element = this.visualElement.current; /** * Attach a pointerdown event listener on this DOM element to initiate drag tracking. */ const stopPointerListener = addPointerEvent(element, "pointerdown", (event) => { const { drag, dragListener = true } = this.getProps(); drag && dragListener && this.start(event); }); const measureDragConstraints = () => { const { dragConstraints } = this.getProps(); if (isRefObject(dragConstraints)) { this.constraints = this.resolveRefConstraints(); } }; const { projection } = this.visualElement; const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints); if (projection && !projection.layout) { projection.root && projection.root.updateScroll(); projection.updateLayout(); } measureDragConstraints(); /** * Attach a window resize listener to scale the draggable target within its defined * constraints as the window resizes. */ const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints()); /** * If the element's layout changes, calculate the delta and apply that to * the drag gesture's origin point. */ const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => { if (this.isDragging && hasLayoutChanged) { eachAxis((axis) => { const motionValue = this.getAxisMotionValue(axis); if (!motionValue) return; this.originPoint[axis] += delta[axis].translate; motionValue.set(motionValue.get() + delta[axis].translate); }); this.visualElement.render(); } })); return () => { stopResizeListener(); stopPointerListener(); stopMeasureLayoutListener(); stopLayoutUpdateListener && stopLayoutUpdateListener(); }; } getProps() { const props = this.visualElement.getProps(); const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, } = props; return { ...props, drag, dragDirectionLock, dragPropagation, dragConstraints, dragElastic, dragMomentum, }; } } function shouldDrag(direction, drag, currentDirection) { return ((drag === true || drag === direction) && (currentDirection === null || currentDirection === direction)); } /** * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower * than the provided threshold, return `null`. * * @param offset - The x/y offset from origin. * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction. */ function getCurrentDirection(offset, lockThreshold = 10) { let direction = null; if (Math.abs(offset.y) > lockThreshold) { direction = "y"; } else if (Math.abs(offset.x) > lockThreshold) { direction = "x"; } return direction; } ;// ./node_modules/framer-motion/dist/es/gestures/drag/index.mjs class DragGesture extends Feature { constructor(node) { super(node); this.removeGroupControls = noop_noop; this.removeListeners = noop_noop; this.controls = new VisualElementDragControls(node); } mount() { // If we've been provided a DragControls for manual control over the drag gesture, // subscribe this component to it on mount. const { dragControls } = this.node.getProps(); if (dragControls) { this.removeGroupControls = dragControls.subscribe(this.controls); } this.removeListeners = this.controls.addListeners() || noop_noop; } unmount() { this.removeGroupControls(); this.removeListeners(); } } ;// ./node_modules/framer-motion/dist/es/gestures/pan/index.mjs const asyncHandler = (handler) => (event, info) => { if (handler) { frame_frame.postRender(() => handler(event, info)); } }; class PanGesture extends Feature { constructor() { super(...arguments); this.removePointerDownListener = noop_noop; } onPointerDown(pointerDownEvent) { this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), { transformPagePoint: this.node.getTransformPagePoint(), contextWindow: getContextWindow(this.node), }); } createPanHandlers() { const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps(); return { onSessionStart: asyncHandler(onPanSessionStart), onStart: asyncHandler(onPanStart), onMove: onPan, onEnd: (event, info) => { delete this.session; if (onPanEnd) { frame_frame.postRender(() => onPanEnd(event, info)); } }, }; } mount() { this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event)); } update() { this.session && this.session.updateHandlers(this.createPanHandlers()); } unmount() { this.removePointerDownListener(); this.session && this.session.end(); } } ;// ./node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs /** * When a component is the child of `AnimatePresence`, it can use `usePresence` * to access information about whether it's still present in the React tree. * * ```jsx * import { usePresence } from "framer-motion" * * export const Component = () => { * const [isPresent, safeToRemove] = usePresence() * * useEffect(() => { * !isPresent && setTimeout(safeToRemove, 1000) * }, [isPresent]) * * return <div /> * } * ``` * * If `isPresent` is `false`, it means that a component has been removed the tree, but * `AnimatePresence` won't really remove it until `safeToRemove` has been called. * * @public */ function usePresence() { const context = (0,external_React_.useContext)(PresenceContext_PresenceContext); if (context === null) return [true, null]; const { isPresent, onExitComplete, register } = context; // It's safe to call the following hooks conditionally (after an early return) because the context will always // either be null or non-null for the lifespan of the component. const id = (0,external_React_.useId)(); (0,external_React_.useEffect)(() => register(id), []); const safeToRemove = () => onExitComplete && onExitComplete(id); return !isPresent && onExitComplete ? [false, safeToRemove] : [true]; } /** * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present. * There is no `safeToRemove` function. * * ```jsx * import { useIsPresent } from "framer-motion" * * export const Component = () => { * const isPresent = useIsPresent() * * useEffect(() => { * !isPresent && console.log("I've been removed!") * }, [isPresent]) * * return <div /> * } * ``` * * @public */ function useIsPresent() { return isPresent(useContext(PresenceContext)); } function isPresent(context) { return context === null ? true : context.isPresent; } ;// ./node_modules/framer-motion/dist/es/projection/node/state.mjs /** * This should only ever be modified on the client otherwise it'll * persist through server requests. If we need instanced states we * could lazy-init via root. */ const globalProjectionState = { /** * Global flag as to whether the tree has animated since the last time * we resized the window */ hasAnimatedSinceResize: true, /** * We set this to true once, on the first update. Any nodes added to the tree beyond that * update will be given a `data-projection-id` attribute. */ hasEverUpdated: false, }; ;// ./node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.mjs function pixelsToPercent(pixels, axis) { if (axis.max === axis.min) return 0; return (pixels / (axis.max - axis.min)) * 100; } /** * We always correct borderRadius as a percentage rather than pixels to reduce paints. * For example, if you are projecting a box that is 100px wide with a 10px borderRadius * into a box that is 200px wide with a 20px borderRadius, that is actually a 10% * borderRadius in both states. If we animate between the two in pixels that will trigger * a paint each time. If we animate between the two in percentage we'll avoid a paint. */ const correctBorderRadius = { correct: (latest, node) => { if (!node.target) return latest; /** * If latest is a string, if it's a percentage we can return immediately as it's * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number. */ if (typeof latest === "string") { if (px.test(latest)) { latest = parseFloat(latest); } else { return latest; } } /** * If latest is a number, it's a pixel value. We use the current viewportBox to calculate that * pixel value as a percentage of each axis */ const x = pixelsToPercent(latest, node.target.x); const y = pixelsToPercent(latest, node.target.y); return `${x}% ${y}%`; }, }; ;// ./node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs const correctBoxShadow = { correct: (latest, { treeScale, projectionDelta }) => { const original = latest; const shadow = complex.parse(latest); // TODO: Doesn't support multiple shadows if (shadow.length > 5) return original; const template = complex.createTransformer(latest); const offset = typeof shadow[0] !== "number" ? 1 : 0; // Calculate the overall context scale const xScale = projectionDelta.x.scale * treeScale.x; const yScale = projectionDelta.y.scale * treeScale.y; shadow[0 + offset] /= xScale; shadow[1 + offset] /= yScale; /** * Ideally we'd correct x and y scales individually, but because blur and * spread apply to both we have to take a scale average and apply that instead. * We could potentially improve the outcome of this by incorporating the ratio between * the two scales. */ const averageScale = mixNumber(xScale, yScale, 0.5); // Blur if (typeof shadow[2 + offset] === "number") shadow[2 + offset] /= averageScale; // Spread if (typeof shadow[3 + offset] === "number") shadow[3 + offset] /= averageScale; return template(shadow); }, }; ;// ./node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs class MeasureLayoutWithContext extends external_React_.Component { /** * This only mounts projection nodes for components that * need measuring, we might want to do it for all components * in order to incorporate transforms */ componentDidMount() { const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props; const { projection } = visualElement; addScaleCorrector(defaultScaleCorrectors); if (projection) { if (layoutGroup.group) layoutGroup.group.add(projection); if (switchLayoutGroup && switchLayoutGroup.register && layoutId) { switchLayoutGroup.register(projection); } projection.root.didUpdate(); projection.addEventListener("animationComplete", () => { this.safeToRemove(); }); projection.setOptions({ ...projection.options, onExitComplete: () => this.safeToRemove(), }); } globalProjectionState.hasEverUpdated = true; } getSnapshotBeforeUpdate(prevProps) { const { layoutDependency, visualElement, drag, isPresent } = this.props; const projection = visualElement.projection; if (!projection) return null; /** * TODO: We use this data in relegate to determine whether to * promote a previous element. There's no guarantee its presence data * will have updated by this point - if a bug like this arises it will * have to be that we markForRelegation and then find a new lead some other way, * perhaps in didUpdate */ projection.isPresent = isPresent; if (drag || prevProps.layoutDependency !== layoutDependency || layoutDependency === undefined) { projection.willUpdate(); } else { this.safeToRemove(); } if (prevProps.isPresent !== isPresent) { if (isPresent) { projection.promote(); } else if (!projection.relegate()) { /** * If there's another stack member taking over from this one, * it's in charge of the exit animation and therefore should * be in charge of the safe to remove. Otherwise we call it here. */ frame_frame.postRender(() => { const stack = projection.getStack(); if (!stack || !stack.members.length) { this.safeToRemove(); } }); } } return null; } componentDidUpdate() { const { projection } = this.props.visualElement; if (projection) { projection.root.didUpdate(); microtask.postRender(() => { if (!projection.currentAnimation && projection.isLead()) { this.safeToRemove(); } }); } } componentWillUnmount() { const { visualElement, layoutGroup, switchLayoutGroup: promoteContext, } = this.props; const { projection } = visualElement; if (projection) { projection.scheduleCheckAfterUnmount(); if (layoutGroup && layoutGroup.group) layoutGroup.group.remove(projection); if (promoteContext && promoteContext.deregister) promoteContext.deregister(projection); } } safeToRemove() { const { safeToRemove } = this.props; safeToRemove && safeToRemove(); } render() { return null; } } function MeasureLayout(props) { const [isPresent, safeToRemove] = usePresence(); const layoutGroup = (0,external_React_.useContext)(LayoutGroupContext); return ((0,external_ReactJSXRuntime_namespaceObject.jsx)(MeasureLayoutWithContext, { ...props, layoutGroup: layoutGroup, switchLayoutGroup: (0,external_React_.useContext)(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })); } const defaultScaleCorrectors = { borderRadius: { ...correctBorderRadius, applyTo: [ "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", ], }, borderTopLeftRadius: correctBorderRadius, borderTopRightRadius: correctBorderRadius, borderBottomLeftRadius: correctBorderRadius, borderBottomRightRadius: correctBorderRadius, boxShadow: correctBoxShadow, }; ;// ./node_modules/framer-motion/dist/es/projection/animation/mix-values.mjs const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"]; const numBorders = borders.length; const asNumber = (value) => typeof value === "string" ? parseFloat(value) : value; const isPx = (value) => typeof value === "number" || px.test(value); function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) { if (shouldCrossfadeOpacity) { target.opacity = mixNumber(0, // TODO Reinstate this if only child lead.opacity !== undefined ? lead.opacity : 1, easeCrossfadeIn(progress)); target.opacityExit = mixNumber(follow.opacity !== undefined ? follow.opacity : 1, 0, easeCrossfadeOut(progress)); } else if (isOnlyMember) { target.opacity = mixNumber(follow.opacity !== undefined ? follow.opacity : 1, lead.opacity !== undefined ? lead.opacity : 1, progress); } /** * Mix border radius */ for (let i = 0; i < numBorders; i++) { const borderLabel = `border${borders[i]}Radius`; let followRadius = getRadius(follow, borderLabel); let leadRadius = getRadius(lead, borderLabel); if (followRadius === undefined && leadRadius === undefined) continue; followRadius || (followRadius = 0); leadRadius || (leadRadius = 0); const canMix = followRadius === 0 || leadRadius === 0 || isPx(followRadius) === isPx(leadRadius); if (canMix) { target[borderLabel] = Math.max(mixNumber(asNumber(followRadius), asNumber(leadRadius), progress), 0); if (percent.test(leadRadius) || percent.test(followRadius)) { target[borderLabel] += "%"; } } else { target[borderLabel] = leadRadius; } } /** * Mix rotation */ if (follow.rotate || lead.rotate) { target.rotate = mixNumber(follow.rotate || 0, lead.rotate || 0, progress); } } function getRadius(values, radiusName) { return values[radiusName] !== undefined ? values[radiusName] : values.borderRadius; } // /** // * We only want to mix the background color if there's a follow element // * that we're not crossfading opacity between. For instance with switch // * AnimateSharedLayout animations, this helps the illusion of a continuous // * element being animated but also cuts down on the number of paints triggered // * for elements where opacity is doing that work for us. // */ // if ( // !hasFollowElement && // latestLeadValues.backgroundColor && // latestFollowValues.backgroundColor // ) { // /** // * This isn't ideal performance-wise as mixColor is creating a new function every frame. // * We could probably create a mixer that runs at the start of the animation but // * the idea behind the crossfader is that it runs dynamically between two potentially // * changing targets (ie opacity or borderRadius may be animating independently via variants) // */ // leadState.backgroundColor = followState.backgroundColor = mixColor( // latestFollowValues.backgroundColor as string, // latestLeadValues.backgroundColor as string // )(p) // } const easeCrossfadeIn = compress(0, 0.5, circOut); const easeCrossfadeOut = compress(0.5, 0.95, noop_noop); function compress(min, max, easing) { return (p) => { // Could replace ifs with clamp if (p < min) return 0; if (p > max) return 1; return easing(progress(min, max, p)); }; } ;// ./node_modules/framer-motion/dist/es/projection/geometry/copy.mjs /** * Reset an axis to the provided origin box. * * This is a mutative operation. */ function copyAxisInto(axis, originAxis) { axis.min = originAxis.min; axis.max = originAxis.max; } /** * Reset a box to the provided origin box. * * This is a mutative operation. */ function copyBoxInto(box, originBox) { copyAxisInto(box.x, originBox.x); copyAxisInto(box.y, originBox.y); } ;// ./node_modules/framer-motion/dist/es/projection/geometry/delta-remove.mjs /** * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse */ function removePointDelta(point, translate, scale, originPoint, boxScale) { point -= translate; point = scalePoint(point, 1 / scale, originPoint); if (boxScale !== undefined) { point = scalePoint(point, 1 / boxScale, originPoint); } return point; } /** * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse */ function removeAxisDelta(axis, translate = 0, scale = 1, origin = 0.5, boxScale, originAxis = axis, sourceAxis = axis) { if (percent.test(translate)) { translate = parseFloat(translate); const relativeProgress = mixNumber(sourceAxis.min, sourceAxis.max, translate / 100); translate = relativeProgress - sourceAxis.min; } if (typeof translate !== "number") return; let originPoint = mixNumber(originAxis.min, originAxis.max, origin); if (axis === originAxis) originPoint -= translate; axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale); axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale); } /** * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse * and acts as a bridge between motion values and removeAxisDelta */ function removeAxisTransforms(axis, transforms, [key, scaleKey, originKey], origin, sourceAxis) { removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis); } /** * The names of the motion values we want to apply as translation, scale and origin. */ const delta_remove_xKeys = ["x", "scaleX", "originX"]; const delta_remove_yKeys = ["y", "scaleY", "originY"]; /** * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse * and acts as a bridge between motion values and removeAxisDelta */ function removeBoxTransforms(box, transforms, originBox, sourceBox) { removeAxisTransforms(box.x, transforms, delta_remove_xKeys, originBox ? originBox.x : undefined, sourceBox ? sourceBox.x : undefined); removeAxisTransforms(box.y, transforms, delta_remove_yKeys, originBox ? originBox.y : undefined, sourceBox ? sourceBox.y : undefined); } ;// ./node_modules/framer-motion/dist/es/projection/geometry/utils.mjs function isAxisDeltaZero(delta) { return delta.translate === 0 && delta.scale === 1; } function isDeltaZero(delta) { return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y); } function boxEquals(a, b) { return (a.x.min === b.x.min && a.x.max === b.x.max && a.y.min === b.y.min && a.y.max === b.y.max); } function boxEqualsRounded(a, b) { return (Math.round(a.x.min) === Math.round(b.x.min) && Math.round(a.x.max) === Math.round(b.x.max) && Math.round(a.y.min) === Math.round(b.y.min) && Math.round(a.y.max) === Math.round(b.y.max)); } function aspectRatio(box) { return calcLength(box.x) / calcLength(box.y); } ;// ./node_modules/framer-motion/dist/es/projection/shared/stack.mjs class NodeStack { constructor() { this.members = []; } add(node) { addUniqueItem(this.members, node); node.scheduleRender(); } remove(node) { removeItem(this.members, node); if (node === this.prevLead) { this.prevLead = undefined; } if (node === this.lead) { const prevLead = this.members[this.members.length - 1]; if (prevLead) { this.promote(prevLead); } } } relegate(node) { const indexOfNode = this.members.findIndex((member) => node === member); if (indexOfNode === 0) return false; /** * Find the next projection node that is present */ let prevLead; for (let i = indexOfNode; i >= 0; i--) { const member = this.members[i]; if (member.isPresent !== false) { prevLead = member; break; } } if (prevLead) { this.promote(prevLead); return true; } else { return false; } } promote(node, preserveFollowOpacity) { const prevLead = this.lead; if (node === prevLead) return; this.prevLead = prevLead; this.lead = node; node.show(); if (prevLead) { prevLead.instance && prevLead.scheduleRender(); node.scheduleRender(); node.resumeFrom = prevLead; if (preserveFollowOpacity) { node.resumeFrom.preserveOpacity = true; } if (prevLead.snapshot) { node.snapshot = prevLead.snapshot; node.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues; } if (node.root && node.root.isUpdating) { node.isLayoutDirty = true; } const { crossfade } = node.options; if (crossfade === false) { prevLead.hide(); } /** * TODO: * - Test border radius when previous node was deleted * - boxShadow mixing * - Shared between element A in scrolled container and element B (scroll stays the same or changes) * - Shared between element A in transformed container and element B (transform stays the same or changes) * - Shared between element A in scrolled page and element B (scroll stays the same or changes) * --- * - Crossfade opacity of root nodes * - layoutId changes after animation * - layoutId changes mid animation */ } } exitAnimationComplete() { this.members.forEach((node) => { const { options, resumingFrom } = node; options.onExitComplete && options.onExitComplete(); if (resumingFrom) { resumingFrom.options.onExitComplete && resumingFrom.options.onExitComplete(); } }); } scheduleRender() { this.members.forEach((node) => { node.instance && node.scheduleRender(false); }); } /** * Clear any leads that have been removed this render to prevent them from being * used in future animations and to prevent memory leaks */ removeLeadSnapshot() { if (this.lead && this.lead.snapshot) { this.lead.snapshot = undefined; } } } ;// ./node_modules/framer-motion/dist/es/projection/styles/transform.mjs function buildProjectionTransform(delta, treeScale, latestTransform) { let transform = ""; /** * The translations we use to calculate are always relative to the viewport coordinate space. * But when we apply scales, we also scale the coordinate space of an element and its children. * For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need * to move an element 100 pixels, we actually need to move it 200 in within that scaled space. */ const xTranslate = delta.x.translate / treeScale.x; const yTranslate = delta.y.translate / treeScale.y; const zTranslate = (latestTransform === null || latestTransform === void 0 ? void 0 : latestTransform.z) || 0; if (xTranslate || yTranslate || zTranslate) { transform = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `; } /** * Apply scale correction for the tree transform. * This will apply scale to the screen-orientated axes. */ if (treeScale.x !== 1 || treeScale.y !== 1) { transform += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `; } if (latestTransform) { const { transformPerspective, rotate, rotateX, rotateY, skewX, skewY } = latestTransform; if (transformPerspective) transform = `perspective(${transformPerspective}px) ${transform}`; if (rotate) transform += `rotate(${rotate}deg) `; if (rotateX) transform += `rotateX(${rotateX}deg) `; if (rotateY) transform += `rotateY(${rotateY}deg) `; if (skewX) transform += `skewX(${skewX}deg) `; if (skewY) transform += `skewY(${skewY}deg) `; } /** * Apply scale to match the size of the element to the size we want it. * This will apply scale to the element-orientated axes. */ const elementScaleX = delta.x.scale * treeScale.x; const elementScaleY = delta.y.scale * treeScale.y; if (elementScaleX !== 1 || elementScaleY !== 1) { transform += `scale(${elementScaleX}, ${elementScaleY})`; } return transform || "none"; } ;// ./node_modules/framer-motion/dist/es/render/utils/compare-by-depth.mjs const compareByDepth = (a, b) => a.depth - b.depth; ;// ./node_modules/framer-motion/dist/es/render/utils/flat-tree.mjs class FlatTree { constructor() { this.children = []; this.isDirty = false; } add(child) { addUniqueItem(this.children, child); this.isDirty = true; } remove(child) { removeItem(this.children, child); this.isDirty = true; } forEach(callback) { this.isDirty && this.children.sort(compareByDepth); this.isDirty = false; this.children.forEach(callback); } } ;// ./node_modules/framer-motion/dist/es/utils/delay.mjs /** * Timeout defined in ms */ function delay(callback, timeout) { const start = time.now(); const checkElapsed = ({ timestamp }) => { const elapsed = timestamp - start; if (elapsed >= timeout) { cancelFrame(checkElapsed); callback(elapsed - timeout); } }; frame_frame.read(checkElapsed, true); return () => cancelFrame(checkElapsed); } ;// ./node_modules/framer-motion/dist/es/debug/record.mjs function record(data) { if (window.MotionDebug) { window.MotionDebug.record(data); } } ;// ./node_modules/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs function isSVGElement(element) { return element instanceof SVGElement && element.tagName !== "svg"; } ;// ./node_modules/framer-motion/dist/es/animation/interfaces/single-value.mjs function animateSingleValue(value, keyframes, options) { const motionValue$1 = isMotionValue(value) ? value : motionValue(value); motionValue$1.start(animateMotionValue("", motionValue$1, keyframes, options)); return motionValue$1.animation; } ;// ./node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs const transformAxes = ["", "X", "Y", "Z"]; const hiddenVisibility = { visibility: "hidden" }; /** * We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1 * which has a noticeable difference in spring animations */ const animationTarget = 1000; let create_projection_node_id = 0; /** * Use a mutable data object for debug data so as to not create a new * object every frame. */ const projectionFrameData = { type: "projectionFrame", totalNodes: 0, resolvedTargetDeltas: 0, recalculatedProjection: 0, }; function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) { const { latestValues } = visualElement; // Record the distorting transform and then temporarily set it to 0 if (latestValues[key]) { values[key] = latestValues[key]; visualElement.setStaticValue(key, 0); if (sharedAnimationValues) { sharedAnimationValues[key] = 0; } } } function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) { return class ProjectionNode { constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) { /** * A unique ID generated for every projection node. */ this.id = create_projection_node_id++; /** * An id that represents a unique session instigated by startUpdate. */ this.animationId = 0; /** * A Set containing all this component's children. This is used to iterate * through the children. * * TODO: This could be faster to iterate as a flat array stored on the root node. */ this.children = new Set(); /** * Options for the node. We use this to configure what kind of layout animations * we should perform (if any). */ this.options = {}; /** * We use this to detect when its safe to shut down part of a projection tree. * We have to keep projecting children for scale correction and relative projection * until all their parents stop performing layout animations. */ this.isTreeAnimating = false; this.isAnimationBlocked = false; /** * Flag to true if we think this layout has been changed. We can't always know this, * currently we set it to true every time a component renders, or if it has a layoutDependency * if that has changed between renders. Additionally, components can be grouped by LayoutGroup * and if one node is dirtied, they all are. */ this.isLayoutDirty = false; /** * Flag to true if we think the projection calculations for this node needs * recalculating as a result of an updated transform or layout animation. */ this.isProjectionDirty = false; /** * Flag to true if the layout *or* transform has changed. This then gets propagated * throughout the projection tree, forcing any element below to recalculate on the next frame. */ this.isSharedProjectionDirty = false; /** * Flag transform dirty. This gets propagated throughout the whole tree but is only * respected by shared nodes. */ this.isTransformDirty = false; /** * Block layout updates for instant layout transitions throughout the tree. */ this.updateManuallyBlocked = false; this.updateBlockedByResize = false; /** * Set to true between the start of the first `willUpdate` call and the end of the `didUpdate` * call. */ this.isUpdating = false; /** * If this is an SVG element we currently disable projection transforms */ this.isSVG = false; /** * Flag to true (during promotion) if a node doing an instant layout transition needs to reset * its projection styles. */ this.needsReset = false; /** * Flags whether this node should have its transform reset prior to measuring. */ this.shouldResetTransform = false; /** * An object representing the calculated contextual/accumulated/tree scale. * This will be used to scale calculcated projection transforms, as these are * calculated in screen-space but need to be scaled for elements to layoutly * make it to their calculated destinations. * * TODO: Lazy-init */ this.treeScale = { x: 1, y: 1 }; /** * */ this.eventHandlers = new Map(); this.hasTreeAnimated = false; // Note: Currently only running on root node this.updateScheduled = false; this.projectionUpdateScheduled = false; this.checkUpdateFailed = () => { if (this.isUpdating) { this.isUpdating = false; this.clearAllSnapshots(); } }; /** * This is a multi-step process as shared nodes might be of different depths. Nodes * are sorted by depth order, so we need to resolve the entire tree before moving to * the next step. */ this.updateProjection = () => { this.projectionUpdateScheduled = false; /** * Reset debug counts. Manually resetting rather than creating a new * object each frame. */ projectionFrameData.totalNodes = projectionFrameData.resolvedTargetDeltas = projectionFrameData.recalculatedProjection = 0; this.nodes.forEach(propagateDirtyNodes); this.nodes.forEach(resolveTargetDelta); this.nodes.forEach(calcProjection); this.nodes.forEach(cleanDirtyNodes); record(projectionFrameData); }; this.hasProjected = false; this.isVisible = true; this.animationProgress = 0; /** * Shared layout */ // TODO Only running on root node this.sharedNodes = new Map(); this.latestValues = latestValues; this.root = parent ? parent.root || parent : this; this.path = parent ? [...parent.path, parent] : []; this.parent = parent; this.depth = parent ? parent.depth + 1 : 0; for (let i = 0; i < this.path.length; i++) { this.path[i].shouldResetTransform = true; } if (this.root === this) this.nodes = new FlatTree(); } addEventListener(name, handler) { if (!this.eventHandlers.has(name)) { this.eventHandlers.set(name, new SubscriptionManager()); } return this.eventHandlers.get(name).add(handler); } notifyListeners(name, ...args) { const subscriptionManager = this.eventHandlers.get(name); subscriptionManager && subscriptionManager.notify(...args); } hasListeners(name) { return this.eventHandlers.has(name); } /** * Lifecycles */ mount(instance, isLayoutDirty = this.root.hasTreeAnimated) { if (this.instance) return; this.isSVG = isSVGElement(instance); this.instance = instance; const { layoutId, layout, visualElement } = this.options; if (visualElement && !visualElement.current) { visualElement.mount(instance); } this.root.nodes.add(this); this.parent && this.parent.children.add(this); if (isLayoutDirty && (layout || layoutId)) { this.isLayoutDirty = true; } if (attachResizeListener) { let cancelDelay; const resizeUnblockUpdate = () => (this.root.updateBlockedByResize = false); attachResizeListener(instance, () => { this.root.updateBlockedByResize = true; cancelDelay && cancelDelay(); cancelDelay = delay(resizeUnblockUpdate, 250); if (globalProjectionState.hasAnimatedSinceResize) { globalProjectionState.hasAnimatedSinceResize = false; this.nodes.forEach(finishAnimation); } }); } if (layoutId) { this.root.registerSharedNode(layoutId, this); } // Only register the handler if it requires layout animation if (this.options.animate !== false && visualElement && (layoutId || layout)) { this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeTargetChanged, layout: newLayout, }) => { if (this.isTreeAnimationBlocked()) { this.target = undefined; this.relativeTarget = undefined; return; } // TODO: Check here if an animation exists const layoutTransition = this.options.transition || visualElement.getDefaultTransition() || defaultLayoutTransition; const { onLayoutAnimationStart, onLayoutAnimationComplete, } = visualElement.getProps(); /** * The target layout of the element might stay the same, * but its position relative to its parent has changed. */ const targetChanged = !this.targetLayout || !boxEqualsRounded(this.targetLayout, newLayout) || hasRelativeTargetChanged; /** * If the layout hasn't seemed to have changed, it might be that the * element is visually in the same place in the document but its position * relative to its parent has indeed changed. So here we check for that. */ const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged; if (this.options.layoutRoot || (this.resumeFrom && this.resumeFrom.instance) || hasOnlyRelativeTargetChanged || (hasLayoutChanged && (targetChanged || !this.currentAnimation))) { if (this.resumeFrom) { this.resumingFrom = this.resumeFrom; this.resumingFrom.resumingFrom = undefined; } this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged); const animationOptions = { ...getValueTransition(layoutTransition, "layout"), onPlay: onLayoutAnimationStart, onComplete: onLayoutAnimationComplete, }; if (visualElement.shouldReduceMotion || this.options.layoutRoot) { animationOptions.delay = 0; animationOptions.type = false; } this.startAnimation(animationOptions); } else { /** * If the layout hasn't changed and we have an animation that hasn't started yet, * finish it immediately. Otherwise it will be animating from a location * that was probably never commited to screen and look like a jumpy box. */ if (!hasLayoutChanged) { finishAnimation(this); } if (this.isLead() && this.options.onExitComplete) { this.options.onExitComplete(); } } this.targetLayout = newLayout; }); } } unmount() { this.options.layoutId && this.willUpdate(); this.root.nodes.remove(this); const stack = this.getStack(); stack && stack.remove(this); this.parent && this.parent.children.delete(this); this.instance = undefined; cancelFrame(this.updateProjection); } // only on the root blockUpdate() { this.updateManuallyBlocked = true; } unblockUpdate() { this.updateManuallyBlocked = false; } isUpdateBlocked() { return this.updateManuallyBlocked || this.updateBlockedByResize; } isTreeAnimationBlocked() { return (this.isAnimationBlocked || (this.parent && this.parent.isTreeAnimationBlocked()) || false); } // Note: currently only running on root node startUpdate() { if (this.isUpdateBlocked()) return; this.isUpdating = true; /** * If we're running optimised appear animations then these must be * cancelled before measuring the DOM. This is so we can measure * the true layout of the element rather than the WAAPI animation * which will be unaffected by the resetSkewAndRotate step. */ if (window.HandoffCancelAllAnimations) { window.HandoffCancelAllAnimations(); } this.nodes && this.nodes.forEach(resetSkewAndRotation); this.animationId++; } getTransformTemplate() { const { visualElement } = this.options; return visualElement && visualElement.getProps().transformTemplate; } willUpdate(shouldNotifyListeners = true) { this.root.hasTreeAnimated = true; if (this.root.isUpdateBlocked()) { this.options.onExitComplete && this.options.onExitComplete(); return; } !this.root.isUpdating && this.root.startUpdate(); if (this.isLayoutDirty) return; this.isLayoutDirty = true; for (let i = 0; i < this.path.length; i++) { const node = this.path[i]; node.shouldResetTransform = true; node.updateScroll("snapshot"); if (node.options.layoutRoot) { node.willUpdate(false); } } const { layoutId, layout } = this.options; if (layoutId === undefined && !layout) return; const transformTemplate = this.getTransformTemplate(); this.prevTransformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : undefined; this.updateSnapshot(); shouldNotifyListeners && this.notifyListeners("willUpdate"); } update() { this.updateScheduled = false; const updateWasBlocked = this.isUpdateBlocked(); // When doing an instant transition, we skip the layout update, // but should still clean up the measurements so that the next // snapshot could be taken correctly. if (updateWasBlocked) { this.unblockUpdate(); this.clearAllSnapshots(); this.nodes.forEach(clearMeasurements); return; } if (!this.isUpdating) { this.nodes.forEach(clearIsLayoutDirty); } this.isUpdating = false; /** * Write */ this.nodes.forEach(resetTransformStyle); /** * Read ================== */ // Update layout measurements of updated children this.nodes.forEach(updateLayout); /** * Write */ // Notify listeners that the layout is updated this.nodes.forEach(notifyLayoutUpdate); this.clearAllSnapshots(); /** * Manually flush any pending updates. Ideally * we could leave this to the following requestAnimationFrame but this seems * to leave a flash of incorrectly styled content. */ const now = time.now(); frameData.delta = clamp_clamp(0, 1000 / 60, now - frameData.timestamp); frameData.timestamp = now; frameData.isProcessing = true; steps.update.process(frameData); steps.preRender.process(frameData); steps.render.process(frameData); frameData.isProcessing = false; } didUpdate() { if (!this.updateScheduled) { this.updateScheduled = true; microtask.read(() => this.update()); } } clearAllSnapshots() { this.nodes.forEach(clearSnapshot); this.sharedNodes.forEach(removeLeadSnapshots); } scheduleUpdateProjection() { if (!this.projectionUpdateScheduled) { this.projectionUpdateScheduled = true; frame_frame.preRender(this.updateProjection, false, true); } } scheduleCheckAfterUnmount() { /** * If the unmounting node is in a layoutGroup and did trigger a willUpdate, * we manually call didUpdate to give a chance to the siblings to animate. * Otherwise, cleanup all snapshots to prevents future nodes from reusing them. */ frame_frame.postRender(() => { if (this.isLayoutDirty) { this.root.didUpdate(); } else { this.root.checkUpdateFailed(); } }); } /** * Update measurements */ updateSnapshot() { if (this.snapshot || !this.instance) return; this.snapshot = this.measure(); } updateLayout() { if (!this.instance) return; // TODO: Incorporate into a forwarded scroll offset this.updateScroll(); if (!(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty) { return; } /** * When a node is mounted, it simply resumes from the prevLead's * snapshot instead of taking a new one, but the ancestors scroll * might have updated while the prevLead is unmounted. We need to * update the scroll again to make sure the layout we measure is * up to date. */ if (this.resumeFrom && !this.resumeFrom.instance) { for (let i = 0; i < this.path.length; i++) { const node = this.path[i]; node.updateScroll(); } } const prevLayout = this.layout; this.layout = this.measure(false); this.layoutCorrected = createBox(); this.isLayoutDirty = false; this.projectionDelta = undefined; this.notifyListeners("measure", this.layout.layoutBox); const { visualElement } = this.options; visualElement && visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : undefined); } updateScroll(phase = "measure") { let needsMeasurement = Boolean(this.options.layoutScroll && this.instance); if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === phase) { needsMeasurement = false; } if (needsMeasurement) { this.scroll = { animationId: this.root.animationId, phase, isRoot: checkIsScrollRoot(this.instance), offset: measureScroll(this.instance), }; } } resetTransform() { if (!resetTransform) return; const isResetRequested = this.isLayoutDirty || this.shouldResetTransform; const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta); const transformTemplate = this.getTransformTemplate(); const transformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : undefined; const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue; if (isResetRequested && (hasProjection || hasTransform(this.latestValues) || transformTemplateHasChanged)) { resetTransform(this.instance, transformTemplateValue); this.shouldResetTransform = false; this.scheduleRender(); } } measure(removeTransform = true) { const pageBox = this.measurePageBox(); let layoutBox = this.removeElementScroll(pageBox); /** * Measurements taken during the pre-render stage * still have transforms applied so we remove them * via calculation. */ if (removeTransform) { layoutBox = this.removeTransform(layoutBox); } roundBox(layoutBox); return { animationId: this.root.animationId, measuredBox: pageBox, layoutBox, latestValues: {}, source: this.id, }; } measurePageBox() { const { visualElement } = this.options; if (!visualElement) return createBox(); const box = visualElement.measureViewportBox(); // Remove viewport scroll to give page-relative coordinates const { scroll } = this.root; if (scroll) { translateAxis(box.x, scroll.offset.x); translateAxis(box.y, scroll.offset.y); } return box; } removeElementScroll(box) { const boxWithoutScroll = createBox(); copyBoxInto(boxWithoutScroll, box); /** * Performance TODO: Keep a cumulative scroll offset down the tree * rather than loop back up the path. */ for (let i = 0; i < this.path.length; i++) { const node = this.path[i]; const { scroll, options } = node; if (node !== this.root && scroll && options.layoutScroll) { /** * If this is a new scroll root, we want to remove all previous scrolls * from the viewport box. */ if (scroll.isRoot) { copyBoxInto(boxWithoutScroll, box); const { scroll: rootScroll } = this.root; /** * Undo the application of page scroll that was originally added * to the measured bounding box. */ if (rootScroll) { translateAxis(boxWithoutScroll.x, -rootScroll.offset.x); translateAxis(boxWithoutScroll.y, -rootScroll.offset.y); } } translateAxis(boxWithoutScroll.x, scroll.offset.x); translateAxis(boxWithoutScroll.y, scroll.offset.y); } } return boxWithoutScroll; } applyTransform(box, transformOnly = false) { const withTransforms = createBox(); copyBoxInto(withTransforms, box); for (let i = 0; i < this.path.length; i++) { const node = this.path[i]; if (!transformOnly && node.options.layoutScroll && node.scroll && node !== node.root) { transformBox(withTransforms, { x: -node.scroll.offset.x, y: -node.scroll.offset.y, }); } if (!hasTransform(node.latestValues)) continue; transformBox(withTransforms, node.latestValues); } if (hasTransform(this.latestValues)) { transformBox(withTransforms, this.latestValues); } return withTransforms; } removeTransform(box) { const boxWithoutTransform = createBox(); copyBoxInto(boxWithoutTransform, box); for (let i = 0; i < this.path.length; i++) { const node = this.path[i]; if (!node.instance) continue; if (!hasTransform(node.latestValues)) continue; hasScale(node.latestValues) && node.updateSnapshot(); const sourceBox = createBox(); const nodeBox = node.measurePageBox(); copyBoxInto(sourceBox, nodeBox); removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot ? node.snapshot.layoutBox : undefined, sourceBox); } if (hasTransform(this.latestValues)) { removeBoxTransforms(boxWithoutTransform, this.latestValues); } return boxWithoutTransform; } setTargetDelta(delta) { this.targetDelta = delta; this.root.scheduleUpdateProjection(); this.isProjectionDirty = true; } setOptions(options) { this.options = { ...this.options, ...options, crossfade: options.crossfade !== undefined ? options.crossfade : true, }; } clearMeasurements() { this.scroll = undefined; this.layout = undefined; this.snapshot = undefined; this.prevTransformTemplateValue = undefined; this.targetDelta = undefined; this.target = undefined; this.isLayoutDirty = false; } forceRelativeParentToResolveTarget() { if (!this.relativeParent) return; /** * If the parent target isn't up-to-date, force it to update. * This is an unfortunate de-optimisation as it means any updating relative * projection will cause all the relative parents to recalculate back * up the tree. */ if (this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp) { this.relativeParent.resolveTargetDelta(true); } } resolveTargetDelta(forceRecalculation = false) { var _a; /** * Once the dirty status of nodes has been spread through the tree, we also * need to check if we have a shared node of a different depth that has itself * been dirtied. */ const lead = this.getLead(); this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty); this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty); this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty); const isShared = Boolean(this.resumingFrom) || this !== lead; /** * We don't use transform for this step of processing so we don't * need to check whether any nodes have changed transform. */ const canSkip = !(forceRecalculation || (isShared && this.isSharedProjectionDirty) || this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) || this.attemptToResolveRelativeTarget); if (canSkip) return; const { layout, layoutId } = this.options; /** * If we have no layout, we can't perform projection, so early return */ if (!this.layout || !(layout || layoutId)) return; this.resolvedRelativeTargetAt = frameData.timestamp; /** * If we don't have a targetDelta but do have a layout, we can attempt to resolve * a relativeParent. This will allow a component to perform scale correction * even if no animation has started. */ if (!this.targetDelta && !this.relativeTarget) { const relativeParent = this.getClosestProjectingParent(); if (relativeParent && relativeParent.layout && this.animationProgress !== 1) { this.relativeParent = relativeParent; this.forceRelativeParentToResolveTarget(); this.relativeTarget = createBox(); this.relativeTargetOrigin = createBox(); calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox); copyBoxInto(this.relativeTarget, this.relativeTargetOrigin); } else { this.relativeParent = this.relativeTarget = undefined; } } /** * If we have no relative target or no target delta our target isn't valid * for this frame. */ if (!this.relativeTarget && !this.targetDelta) return; /** * Lazy-init target data structure */ if (!this.target) { this.target = createBox(); this.targetWithTransforms = createBox(); } /** * If we've got a relative box for this component, resolve it into a target relative to the parent. */ if (this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target) { this.forceRelativeParentToResolveTarget(); calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target); /** * If we've only got a targetDelta, resolve it into a target */ } else if (this.targetDelta) { if (Boolean(this.resumingFrom)) { // TODO: This is creating a new object every frame this.target = this.applyTransform(this.layout.layoutBox); } else { copyBoxInto(this.target, this.layout.layoutBox); } applyBoxDelta(this.target, this.targetDelta); } else { /** * If no target, use own layout as target */ copyBoxInto(this.target, this.layout.layoutBox); } /** * If we've been told to attempt to resolve a relative target, do so. */ if (this.attemptToResolveRelativeTarget) { this.attemptToResolveRelativeTarget = false; const relativeParent = this.getClosestProjectingParent(); if (relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) { this.relativeParent = relativeParent; this.forceRelativeParentToResolveTarget(); this.relativeTarget = createBox(); this.relativeTargetOrigin = createBox(); calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target); copyBoxInto(this.relativeTarget, this.relativeTargetOrigin); } else { this.relativeParent = this.relativeTarget = undefined; } } /** * Increase debug counter for resolved target deltas */ projectionFrameData.resolvedTargetDeltas++; } getClosestProjectingParent() { if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) { return undefined; } if (this.parent.isProjecting()) { return this.parent; } else { return this.parent.getClosestProjectingParent(); } } isProjecting() { return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout); } calcProjection() { var _a; const lead = this.getLead(); const isShared = Boolean(this.resumingFrom) || this !== lead; let canSkip = true; /** * If this is a normal layout animation and neither this node nor its nearest projecting * is dirty then we can't skip. */ if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) { canSkip = false; } /** * If this is a shared layout animation and this node's shared projection is dirty then * we can't skip. */ if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) { canSkip = false; } /** * If we have resolved the target this frame we must recalculate the * projection to ensure it visually represents the internal calculations. */ if (this.resolvedRelativeTargetAt === frameData.timestamp) { canSkip = false; } if (canSkip) return; const { layout, layoutId } = this.options; /** * If this section of the tree isn't animating we can * delete our target sources for the following frame. */ this.isTreeAnimating = Boolean((this.parent && this.parent.isTreeAnimating) || this.currentAnimation || this.pendingAnimation); if (!this.isTreeAnimating) { this.targetDelta = this.relativeTarget = undefined; } if (!this.layout || !(layout || layoutId)) return; /** * Reset the corrected box with the latest values from box, as we're then going * to perform mutative operations on it. */ copyBoxInto(this.layoutCorrected, this.layout.layoutBox); /** * Record previous tree scales before updating. */ const prevTreeScaleX = this.treeScale.x; const prevTreeScaleY = this.treeScale.y; /** * Apply all the parent deltas to this box to produce the corrected box. This * is the layout box, as it will appear on screen as a result of the transforms of its parents. */ applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared); /** * If this layer needs to perform scale correction but doesn't have a target, * use the layout as the target. */ if (lead.layout && !lead.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1)) { lead.target = lead.layout.layoutBox; lead.targetWithTransforms = createBox(); } const { target } = lead; if (!target) { /** * If we don't have a target to project into, but we were previously * projecting, we want to remove the stored transform and schedule * a render to ensure the elements reflect the removed transform. */ if (this.projectionTransform) { this.projectionDelta = createDelta(); this.projectionTransform = "none"; this.scheduleRender(); } return; } if (!this.projectionDelta) { this.projectionDelta = createDelta(); this.projectionDeltaWithTransform = createDelta(); } const prevProjectionTransform = this.projectionTransform; /** * Update the delta between the corrected box and the target box before user-set transforms were applied. * This will allow us to calculate the corrected borderRadius and boxShadow to compensate * for our layout reprojection, but still allow them to be scaled correctly by the user. * It might be that to simplify this we may want to accept that user-set scale is also corrected * and we wouldn't have to keep and calc both deltas, OR we could support a user setting * to allow people to choose whether these styles are corrected based on just the * layout reprojection or the final bounding box. */ calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues); this.projectionTransform = buildProjectionTransform(this.projectionDelta, this.treeScale); if (this.projectionTransform !== prevProjectionTransform || this.treeScale.x !== prevTreeScaleX || this.treeScale.y !== prevTreeScaleY) { this.hasProjected = true; this.scheduleRender(); this.notifyListeners("projectionUpdate", target); } /** * Increase debug counter for recalculated projections */ projectionFrameData.recalculatedProjection++; } hide() { this.isVisible = false; // TODO: Schedule render } show() { this.isVisible = true; // TODO: Schedule render } scheduleRender(notifyAll = true) { this.options.scheduleRender && this.options.scheduleRender(); if (notifyAll) { const stack = this.getStack(); stack && stack.scheduleRender(); } if (this.resumingFrom && !this.resumingFrom.instance) { this.resumingFrom = undefined; } } setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) { const snapshot = this.snapshot; const snapshotLatestValues = snapshot ? snapshot.latestValues : {}; const mixedValues = { ...this.latestValues }; const targetDelta = createDelta(); if (!this.relativeParent || !this.relativeParent.options.layoutRoot) { this.relativeTarget = this.relativeTargetOrigin = undefined; } this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged; const relativeLayout = createBox(); const snapshotSource = snapshot ? snapshot.source : undefined; const layoutSource = this.layout ? this.layout.source : undefined; const isSharedLayoutAnimation = snapshotSource !== layoutSource; const stack = this.getStack(); const isOnlyMember = !stack || stack.members.length <= 1; const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation && !isOnlyMember && this.options.crossfade === true && !this.path.some(hasOpacityCrossfade)); this.animationProgress = 0; let prevRelativeTarget; this.mixTargetDelta = (latest) => { const progress = latest / 1000; mixAxisDelta(targetDelta.x, delta.x, progress); mixAxisDelta(targetDelta.y, delta.y, progress); this.setTargetDelta(targetDelta); if (this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout) { calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox); mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress); /** * If this is an unchanged relative target we can consider the * projection not dirty. */ if (prevRelativeTarget && boxEquals(this.relativeTarget, prevRelativeTarget)) { this.isProjectionDirty = false; } if (!prevRelativeTarget) prevRelativeTarget = createBox(); copyBoxInto(prevRelativeTarget, this.relativeTarget); } if (isSharedLayoutAnimation) { this.animationValues = mixedValues; mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember); } this.root.scheduleUpdateProjection(); this.scheduleRender(); this.animationProgress = progress; }; this.mixTargetDelta(this.options.layoutRoot ? 1000 : 0); } startAnimation(options) { this.notifyListeners("animationStart"); this.currentAnimation && this.currentAnimation.stop(); if (this.resumingFrom && this.resumingFrom.currentAnimation) { this.resumingFrom.currentAnimation.stop(); } if (this.pendingAnimation) { cancelFrame(this.pendingAnimation); this.pendingAnimation = undefined; } /** * Start the animation in the next frame to have a frame with progress 0, * where the target is the same as when the animation started, so we can * calculate the relative positions correctly for instant transitions. */ this.pendingAnimation = frame_frame.update(() => { globalProjectionState.hasAnimatedSinceResize = true; this.currentAnimation = animateSingleValue(0, animationTarget, { ...options, onUpdate: (latest) => { this.mixTargetDelta(latest); options.onUpdate && options.onUpdate(latest); }, onComplete: () => { options.onComplete && options.onComplete(); this.completeAnimation(); }, }); if (this.resumingFrom) { this.resumingFrom.currentAnimation = this.currentAnimation; } this.pendingAnimation = undefined; }); } completeAnimation() { if (this.resumingFrom) { this.resumingFrom.currentAnimation = undefined; this.resumingFrom.preserveOpacity = undefined; } const stack = this.getStack(); stack && stack.exitAnimationComplete(); this.resumingFrom = this.currentAnimation = this.animationValues = undefined; this.notifyListeners("animationComplete"); } finishAnimation() { if (this.currentAnimation) { this.mixTargetDelta && this.mixTargetDelta(animationTarget); this.currentAnimation.stop(); } this.completeAnimation(); } applyTransformsToTarget() { const lead = this.getLead(); let { targetWithTransforms, target, layout, latestValues } = lead; if (!targetWithTransforms || !target || !layout) return; /** * If we're only animating position, and this element isn't the lead element, * then instead of projecting into the lead box we instead want to calculate * a new target that aligns the two boxes but maintains the layout shape. */ if (this !== lead && this.layout && layout && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) { target = this.target || createBox(); const xLength = calcLength(this.layout.layoutBox.x); target.x.min = lead.target.x.min; target.x.max = target.x.min + xLength; const yLength = calcLength(this.layout.layoutBox.y); target.y.min = lead.target.y.min; target.y.max = target.y.min + yLength; } copyBoxInto(targetWithTransforms, target); /** * Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal. * This is the final box that we will then project into by calculating a transform delta and * applying it to the corrected box. */ transformBox(targetWithTransforms, latestValues); /** * Update the delta between the corrected box and the final target box, after * user-set transforms are applied to it. This will be used by the renderer to * create a transform style that will reproject the element from its layout layout * into the desired bounding box. */ calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues); } registerSharedNode(layoutId, node) { if (!this.sharedNodes.has(layoutId)) { this.sharedNodes.set(layoutId, new NodeStack()); } const stack = this.sharedNodes.get(layoutId); stack.add(node); const config = node.options.initialPromotionConfig; node.promote({ transition: config ? config.transition : undefined, preserveFollowOpacity: config && config.shouldPreserveFollowOpacity ? config.shouldPreserveFollowOpacity(node) : undefined, }); } isLead() { const stack = this.getStack(); return stack ? stack.lead === this : true; } getLead() { var _a; const { layoutId } = this.options; return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this; } getPrevLead() { var _a; const { layoutId } = this.options; return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : undefined; } getStack() { const { layoutId } = this.options; if (layoutId) return this.root.sharedNodes.get(layoutId); } promote({ needsReset, transition, preserveFollowOpacity, } = {}) { const stack = this.getStack(); if (stack) stack.promote(this, preserveFollowOpacity); if (needsReset) { this.projectionDelta = undefined; this.needsReset = true; } if (transition) this.setOptions({ transition }); } relegate() { const stack = this.getStack(); if (stack) { return stack.relegate(this); } else { return false; } } resetSkewAndRotation() { const { visualElement } = this.options; if (!visualElement) return; // If there's no detected skew or rotation values, we can early return without a forced render. let hasDistortingTransform = false; /** * An unrolled check for rotation values. Most elements don't have any rotation and * skipping the nested loop and new object creation is 50% faster. */ const { latestValues } = visualElement; if (latestValues.z || latestValues.rotate || latestValues.rotateX || latestValues.rotateY || latestValues.rotateZ || latestValues.skewX || latestValues.skewY) { hasDistortingTransform = true; } // If there's no distorting values, we don't need to do any more. if (!hasDistortingTransform) return; const resetValues = {}; if (latestValues.z) { resetDistortingTransform("z", visualElement, resetValues, this.animationValues); } // Check the skew and rotate value of all axes and reset to 0 for (let i = 0; i < transformAxes.length; i++) { resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues); resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues); } // Force a render of this element to apply the transform with all skews and rotations // set to 0. visualElement.render(); // Put back all the values we reset for (const key in resetValues) { visualElement.setStaticValue(key, resetValues[key]); if (this.animationValues) { this.animationValues[key] = resetValues[key]; } } // Schedule a render for the next frame. This ensures we won't visually // see the element with the reset rotate value applied. visualElement.scheduleRender(); } getProjectionStyles(styleProp) { var _a, _b; if (!this.instance || this.isSVG) return undefined; if (!this.isVisible) { return hiddenVisibility; } const styles = { visibility: "", }; const transformTemplate = this.getTransformTemplate(); if (this.needsReset) { this.needsReset = false; styles.opacity = ""; styles.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || ""; styles.transform = transformTemplate ? transformTemplate(this.latestValues, "") : "none"; return styles; } const lead = this.getLead(); if (!this.projectionDelta || !this.layout || !lead.target) { const emptyStyles = {}; if (this.options.layoutId) { emptyStyles.opacity = this.latestValues.opacity !== undefined ? this.latestValues.opacity : 1; emptyStyles.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || ""; } if (this.hasProjected && !hasTransform(this.latestValues)) { emptyStyles.transform = transformTemplate ? transformTemplate({}, "") : "none"; this.hasProjected = false; } return emptyStyles; } const valuesToRender = lead.animationValues || lead.latestValues; this.applyTransformsToTarget(); styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender); if (transformTemplate) { styles.transform = transformTemplate(valuesToRender, styles.transform); } const { x, y } = this.projectionDelta; styles.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`; if (lead.animationValues) { /** * If the lead component is animating, assign this either the entering/leaving * opacity */ styles.opacity = lead === this ? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit; } else { /** * Or we're not animating at all, set the lead component to its layout * opacity and other components to hidden. */ styles.opacity = lead === this ? valuesToRender.opacity !== undefined ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== undefined ? valuesToRender.opacityExit : 0; } /** * Apply scale correction */ for (const key in scaleCorrectors) { if (valuesToRender[key] === undefined) continue; const { correct, applyTo } = scaleCorrectors[key]; /** * Only apply scale correction to the value if we have an * active projection transform. Otherwise these values become * vulnerable to distortion if the element changes size without * a corresponding layout animation. */ const corrected = styles.transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead); if (applyTo) { const num = applyTo.length; for (let i = 0; i < num; i++) { styles[applyTo[i]] = corrected; } } else { styles[key] = corrected; } } /** * Disable pointer events on follow components. This is to ensure * that if a follow component covers a lead component it doesn't block * pointer events on the lead. */ if (this.options.layoutId) { styles.pointerEvents = lead === this ? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "" : "none"; } return styles; } clearSnapshot() { this.resumeFrom = this.snapshot = undefined; } // Only run on root resetTree() { this.root.nodes.forEach((node) => { var _a; return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop(); }); this.root.nodes.forEach(clearMeasurements); this.root.sharedNodes.clear(); } }; } function updateLayout(node) { node.updateLayout(); } function notifyLayoutUpdate(node) { var _a; const snapshot = ((_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node.snapshot; if (node.isLead() && node.layout && snapshot && node.hasListeners("didUpdate")) { const { layoutBox: layout, measuredBox: measuredLayout } = node.layout; const { animationType } = node.options; const isShared = snapshot.source !== node.layout.source; // TODO Maybe we want to also resize the layout snapshot so we don't trigger // animations for instance if layout="size" and an element has only changed position if (animationType === "size") { eachAxis((axis) => { const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis]; const length = calcLength(axisSnapshot); axisSnapshot.min = layout[axis].min; axisSnapshot.max = axisSnapshot.min + length; }); } else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) { eachAxis((axis) => { const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis]; const length = calcLength(layout[axis]); axisSnapshot.max = axisSnapshot.min + length; /** * Ensure relative target gets resized and rerendererd */ if (node.relativeTarget && !node.currentAnimation) { node.isProjectionDirty = true; node.relativeTarget[axis].max = node.relativeTarget[axis].min + length; } }); } const layoutDelta = createDelta(); calcBoxDelta(layoutDelta, layout, snapshot.layoutBox); const visualDelta = createDelta(); if (isShared) { calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox); } else { calcBoxDelta(visualDelta, layout, snapshot.layoutBox); } const hasLayoutChanged = !isDeltaZero(layoutDelta); let hasRelativeTargetChanged = false; if (!node.resumeFrom) { const relativeParent = node.getClosestProjectingParent(); /** * If the relativeParent is itself resuming from a different element then * the relative snapshot is not relavent */ if (relativeParent && !relativeParent.resumeFrom) { const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent; if (parentSnapshot && parentLayout) { const relativeSnapshot = createBox(); calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox); const relativeLayout = createBox(); calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox); if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) { hasRelativeTargetChanged = true; } if (relativeParent.options.layoutRoot) { node.relativeTarget = relativeLayout; node.relativeTargetOrigin = relativeSnapshot; node.relativeParent = relativeParent; } } } } node.notifyListeners("didUpdate", { layout, snapshot, delta: visualDelta, layoutDelta, hasLayoutChanged, hasRelativeTargetChanged, }); } else if (node.isLead()) { const { onExitComplete } = node.options; onExitComplete && onExitComplete(); } /** * Clearing transition * TODO: Investigate why this transition is being passed in as {type: false } from Framer * and why we need it at all */ node.options.transition = undefined; } function propagateDirtyNodes(node) { /** * Increase debug counter for nodes encountered this frame */ projectionFrameData.totalNodes++; if (!node.parent) return; /** * If this node isn't projecting, propagate isProjectionDirty. It will have * no performance impact but it will allow the next child that *is* projecting * but *isn't* dirty to just check its parent to see if *any* ancestor needs * correcting. */ if (!node.isProjecting()) { node.isProjectionDirty = node.parent.isProjectionDirty; } /** * Propagate isSharedProjectionDirty and isTransformDirty * throughout the whole tree. A future revision can take another look at * this but for safety we still recalcualte shared nodes. */ node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty || node.parent.isProjectionDirty || node.parent.isSharedProjectionDirty)); node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty); } function cleanDirtyNodes(node) { node.isProjectionDirty = node.isSharedProjectionDirty = node.isTransformDirty = false; } function clearSnapshot(node) { node.clearSnapshot(); } function clearMeasurements(node) { node.clearMeasurements(); } function clearIsLayoutDirty(node) { node.isLayoutDirty = false; } function resetTransformStyle(node) { const { visualElement } = node.options; if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) { visualElement.notify("BeforeLayoutMeasure"); } node.resetTransform(); } function finishAnimation(node) { node.finishAnimation(); node.targetDelta = node.relativeTarget = node.target = undefined; node.isProjectionDirty = true; } function resolveTargetDelta(node) { node.resolveTargetDelta(); } function calcProjection(node) { node.calcProjection(); } function resetSkewAndRotation(node) { node.resetSkewAndRotation(); } function removeLeadSnapshots(stack) { stack.removeLeadSnapshot(); } function mixAxisDelta(output, delta, p) { output.translate = mixNumber(delta.translate, 0, p); output.scale = mixNumber(delta.scale, 1, p); output.origin = delta.origin; output.originPoint = delta.originPoint; } function mixAxis(output, from, to, p) { output.min = mixNumber(from.min, to.min, p); output.max = mixNumber(from.max, to.max, p); } function mixBox(output, from, to, p) { mixAxis(output.x, from.x, to.x, p); mixAxis(output.y, from.y, to.y, p); } function hasOpacityCrossfade(node) { return (node.animationValues && node.animationValues.opacityExit !== undefined); } const defaultLayoutTransition = { duration: 0.45, ease: [0.4, 0, 0.1, 1], }; const userAgentContains = (string) => typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(string); /** * Measured bounding boxes must be rounded in Safari and * left untouched in Chrome, otherwise non-integer layouts within scaled-up elements * can appear to jump. */ const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop_noop; function roundAxis(axis) { // Round to the nearest .5 pixels to support subpixel layouts axis.min = roundPoint(axis.min); axis.max = roundPoint(axis.max); } function roundBox(box) { roundAxis(box.x); roundAxis(box.y); } function shouldAnimatePositionOnly(animationType, snapshot, layout) { return (animationType === "position" || (animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2))); } ;// ./node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs const DocumentProjectionNode = createProjectionNode({ attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify), measureScroll: () => ({ x: document.documentElement.scrollLeft || document.body.scrollLeft, y: document.documentElement.scrollTop || document.body.scrollTop, }), checkIsScrollRoot: () => true, }); ;// ./node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs const rootProjectionNode = { current: undefined, }; const HTMLProjectionNode = createProjectionNode({ measureScroll: (instance) => ({ x: instance.scrollLeft, y: instance.scrollTop, }), defaultParent: () => { if (!rootProjectionNode.current) { const documentNode = new DocumentProjectionNode({}); documentNode.mount(window); documentNode.setOptions({ layoutScroll: true }); rootProjectionNode.current = documentNode; } return rootProjectionNode.current; }, resetTransform: (instance, value) => { instance.style.transform = value !== undefined ? value : "none"; }, checkIsScrollRoot: (instance) => Boolean(window.getComputedStyle(instance).position === "fixed"), }); ;// ./node_modules/framer-motion/dist/es/motion/features/drag.mjs const drag = { pan: { Feature: PanGesture, }, drag: { Feature: DragGesture, ProjectionNode: HTMLProjectionNode, MeasureLayout: MeasureLayout, }, }; ;// ./node_modules/framer-motion/dist/es/utils/reduced-motion/state.mjs // Does this device prefer reduced motion? Returns `null` server-side. const prefersReducedMotion = { current: null }; const hasReducedMotionListener = { current: false }; ;// ./node_modules/framer-motion/dist/es/utils/reduced-motion/index.mjs function initPrefersReducedMotion() { hasReducedMotionListener.current = true; if (!is_browser_isBrowser) return; if (window.matchMedia) { const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)"); const setReducedMotionPreferences = () => (prefersReducedMotion.current = motionMediaQuery.matches); motionMediaQuery.addListener(setReducedMotionPreferences); setReducedMotionPreferences(); } else { prefersReducedMotion.current = false; } } ;// ./node_modules/framer-motion/dist/es/render/utils/motion-values.mjs function updateMotionValuesFromProps(element, next, prev) { const { willChange } = next; for (const key in next) { const nextValue = next[key]; const prevValue = prev[key]; if (isMotionValue(nextValue)) { /** * If this is a motion value found in props or style, we want to add it * to our visual element's motion value map. */ element.addValue(key, nextValue); if (isWillChangeMotionValue(willChange)) { willChange.add(key); } /** * Check the version of the incoming motion value with this version * and warn against mismatches. */ if (false) {} } else if (isMotionValue(prevValue)) { /** * If we're swapping from a motion value to a static value, * create a new motion value from that */ element.addValue(key, motionValue(nextValue, { owner: element })); if (isWillChangeMotionValue(willChange)) { willChange.remove(key); } } else if (prevValue !== nextValue) { /** * If this is a flat value that has changed, update the motion value * or create one if it doesn't exist. We only want to do this if we're * not handling the value with our animation state. */ if (element.hasValue(key)) { const existingValue = element.getValue(key); if (existingValue.liveStyle === true) { existingValue.jump(nextValue); } else if (!existingValue.hasAnimated) { existingValue.set(nextValue); } } else { const latestValue = element.getStaticValue(key); element.addValue(key, motionValue(latestValue !== undefined ? latestValue : nextValue, { owner: element })); } } } // Handle removed values for (const key in prev) { if (next[key] === undefined) element.removeValue(key); } return next; } ;// ./node_modules/framer-motion/dist/es/render/store.mjs const visualElementStore = new WeakMap(); ;// ./node_modules/framer-motion/dist/es/render/dom/value-types/find.mjs /** * A list of all ValueTypes */ const valueTypes = [...dimensionValueTypes, color, complex]; /** * Tests a value against the list of ValueTypes */ const findValueType = (v) => valueTypes.find(testValueType(v)); ;// ./node_modules/framer-motion/dist/es/render/VisualElement.mjs const featureNames = Object.keys(featureDefinitions); const numFeatures = featureNames.length; const propEventHandlers = [ "AnimationStart", "AnimationComplete", "Update", "BeforeLayoutMeasure", "LayoutMeasure", "LayoutAnimationStart", "LayoutAnimationComplete", ]; const numVariantProps = variantProps.length; function getClosestProjectingNode(visualElement) { if (!visualElement) return undefined; return visualElement.options.allowProjection !== false ? visualElement.projection : getClosestProjectingNode(visualElement.parent); } /** * A VisualElement is an imperative abstraction around UI elements such as * HTMLElement, SVGElement, Three.Object3D etc. */ class VisualElement { /** * This method takes React props and returns found MotionValues. For example, HTML * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays. * * This isn't an abstract method as it needs calling in the constructor, but it is * intended to be one. */ scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) { return {}; } constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }, options = {}) { this.resolveKeyframes = (keyframes, // We use an onComplete callback here rather than a Promise as a Promise // resolution is a microtask and we want to retain the ability to force // the resolution of keyframes synchronously. onComplete, name, value) => { return new this.KeyframeResolver(keyframes, onComplete, name, value, this); }; /** * A reference to the current underlying Instance, e.g. a HTMLElement * or Three.Mesh etc. */ this.current = null; /** * A set containing references to this VisualElement's children. */ this.children = new Set(); /** * Determine what role this visual element should take in the variant tree. */ this.isVariantNode = false; this.isControllingVariants = false; /** * Decides whether this VisualElement should animate in reduced motion * mode. * * TODO: This is currently set on every individual VisualElement but feels * like it could be set globally. */ this.shouldReduceMotion = null; /** * A map of all motion values attached to this visual element. Motion * values are source of truth for any given animated value. A motion * value might be provided externally by the component via props. */ this.values = new Map(); this.KeyframeResolver = KeyframeResolver; /** * Cleanup functions for active features (hover/tap/exit etc) */ this.features = {}; /** * A map of every subscription that binds the provided or generated * motion values onChange listeners to this visual element. */ this.valueSubscriptions = new Map(); /** * A reference to the previously-provided motion values as returned * from scrapeMotionValuesFromProps. We use the keys in here to determine * if any motion values need to be removed after props are updated. */ this.prevMotionValues = {}; /** * An object containing a SubscriptionManager for each active event. */ this.events = {}; /** * An object containing an unsubscribe function for each prop event subscription. * For example, every "Update" event can have multiple subscribers via * VisualElement.on(), but only one of those can be defined via the onUpdate prop. */ this.propEventSubscriptions = {}; this.notifyUpdate = () => this.notify("Update", this.latestValues); this.render = () => { if (!this.current) return; this.triggerBuild(); this.renderInstance(this.current, this.renderState, this.props.style, this.projection); }; this.scheduleRender = () => frame_frame.render(this.render, false, true); const { latestValues, renderState } = visualState; this.latestValues = latestValues; this.baseTarget = { ...latestValues }; this.initialValues = props.initial ? { ...latestValues } : {}; this.renderState = renderState; this.parent = parent; this.props = props; this.presenceContext = presenceContext; this.depth = parent ? parent.depth + 1 : 0; this.reducedMotionConfig = reducedMotionConfig; this.options = options; this.blockInitialAnimation = Boolean(blockInitialAnimation); this.isControllingVariants = isControllingVariants(props); this.isVariantNode = isVariantNode(props); if (this.isVariantNode) { this.variantChildren = new Set(); } this.manuallyAnimateOnMount = Boolean(parent && parent.current); /** * Any motion values that are provided to the element when created * aren't yet bound to the element, as this would technically be impure. * However, we iterate through the motion values and set them to the * initial values for this component. * * TODO: This is impure and we should look at changing this to run on mount. * Doing so will break some tests but this isn't neccessarily a breaking change, * more a reflection of the test. */ const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this); for (const key in initialMotionValues) { const value = initialMotionValues[key]; if (latestValues[key] !== undefined && isMotionValue(value)) { value.set(latestValues[key], false); if (isWillChangeMotionValue(willChange)) { willChange.add(key); } } } } mount(instance) { this.current = instance; visualElementStore.set(instance, this); if (this.projection && !this.projection.instance) { this.projection.mount(instance); } if (this.parent && this.isVariantNode && !this.isControllingVariants) { this.removeFromVariantTree = this.parent.addVariantChild(this); } this.values.forEach((value, key) => this.bindToMotionValue(key, value)); if (!hasReducedMotionListener.current) { initPrefersReducedMotion(); } this.shouldReduceMotion = this.reducedMotionConfig === "never" ? false : this.reducedMotionConfig === "always" ? true : prefersReducedMotion.current; if (false) {} if (this.parent) this.parent.children.add(this); this.update(this.props, this.presenceContext); } unmount() { var _a; visualElementStore.delete(this.current); this.projection && this.projection.unmount(); cancelFrame(this.notifyUpdate); cancelFrame(this.render); this.valueSubscriptions.forEach((remove) => remove()); this.removeFromVariantTree && this.removeFromVariantTree(); this.parent && this.parent.children.delete(this); for (const key in this.events) { this.events[key].clear(); } for (const key in this.features) { (_a = this.features[key]) === null || _a === void 0 ? void 0 : _a.unmount(); } this.current = null; } bindToMotionValue(key, value) { const valueIsTransform = transformProps.has(key); const removeOnChange = value.on("change", (latestValue) => { this.latestValues[key] = latestValue; this.props.onUpdate && frame_frame.preRender(this.notifyUpdate); if (valueIsTransform && this.projection) { this.projection.isTransformDirty = true; } }); const removeOnRenderRequest = value.on("renderRequest", this.scheduleRender); this.valueSubscriptions.set(key, () => { removeOnChange(); removeOnRenderRequest(); if (value.owner) value.stop(); }); } sortNodePosition(other) { /** * If these nodes aren't even of the same type we can't compare their depth. */ if (!this.current || !this.sortInstanceNodePosition || this.type !== other.type) { return 0; } return this.sortInstanceNodePosition(this.current, other.current); } loadFeatures({ children, ...renderedProps }, isStrict, preloadedFeatures, initialLayoutGroupConfig) { let ProjectionNodeConstructor; let MeasureLayout; /** * If we're in development mode, check to make sure we're not rendering a motion component * as a child of LazyMotion, as this will break the file-size benefits of using it. */ if (false) {} for (let i = 0; i < numFeatures; i++) { const name = featureNames[i]; const { isEnabled, Feature: FeatureConstructor, ProjectionNode, MeasureLayout: MeasureLayoutComponent, } = featureDefinitions[name]; if (ProjectionNode) ProjectionNodeConstructor = ProjectionNode; if (isEnabled(renderedProps)) { if (!this.features[name] && FeatureConstructor) { this.features[name] = new FeatureConstructor(this); } if (MeasureLayoutComponent) { MeasureLayout = MeasureLayoutComponent; } } } if ((this.type === "html" || this.type === "svg") && !this.projection && ProjectionNodeConstructor) { const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, } = renderedProps; this.projection = new ProjectionNodeConstructor(this.latestValues, renderedProps["data-framer-portal-id"] ? undefined : getClosestProjectingNode(this.parent)); this.projection.setOptions({ layoutId, layout, alwaysMeasureLayout: Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)), visualElement: this, scheduleRender: () => this.scheduleRender(), /** * TODO: Update options in an effect. This could be tricky as it'll be too late * to update by the time layout animations run. * We also need to fix this safeToRemove by linking it up to the one returned by usePresence, * ensuring it gets called if there's no potential layout animations. * */ animationType: typeof layout === "string" ? layout : "both", initialPromotionConfig: initialLayoutGroupConfig, layoutScroll, layoutRoot, }); } return MeasureLayout; } updateFeatures() { for (const key in this.features) { const feature = this.features[key]; if (feature.isMounted) { feature.update(); } else { feature.mount(); feature.isMounted = true; } } } triggerBuild() { this.build(this.renderState, this.latestValues, this.options, this.props); } /** * Measure the current viewport box with or without transforms. * Only measures axis-aligned boxes, rotate and skew must be manually * removed with a re-render to work. */ measureViewportBox() { return this.current ? this.measureInstanceViewportBox(this.current, this.props) : createBox(); } getStaticValue(key) { return this.latestValues[key]; } setStaticValue(key, value) { this.latestValues[key] = value; } /** * Update the provided props. Ensure any newly-added motion values are * added to our map, old ones removed, and listeners updated. */ update(props, presenceContext) { if (props.transformTemplate || this.props.transformTemplate) { this.scheduleRender(); } this.prevProps = this.props; this.props = props; this.prevPresenceContext = this.presenceContext; this.presenceContext = presenceContext; /** * Update prop event handlers ie onAnimationStart, onAnimationComplete */ for (let i = 0; i < propEventHandlers.length; i++) { const key = propEventHandlers[i]; if (this.propEventSubscriptions[key]) { this.propEventSubscriptions[key](); delete this.propEventSubscriptions[key]; } const listenerName = ("on" + key); const listener = props[listenerName]; if (listener) { this.propEventSubscriptions[key] = this.on(key, listener); } } this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps, this), this.prevMotionValues); if (this.handleChildMotionValue) { this.handleChildMotionValue(); } } getProps() { return this.props; } /** * Returns the variant definition with a given name. */ getVariant(name) { return this.props.variants ? this.props.variants[name] : undefined; } /** * Returns the defined default transition on this component. */ getDefaultTransition() { return this.props.transition; } getTransformPagePoint() { return this.props.transformPagePoint; } getClosestVariantNode() { return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : undefined; } getVariantContext(startAtParent = false) { if (startAtParent) { return this.parent ? this.parent.getVariantContext() : undefined; } if (!this.isControllingVariants) { const context = this.parent ? this.parent.getVariantContext() || {} : {}; if (this.props.initial !== undefined) { context.initial = this.props.initial; } return context; } const context = {}; for (let i = 0; i < numVariantProps; i++) { const name = variantProps[i]; const prop = this.props[name]; if (isVariantLabel(prop) || prop === false) { context[name] = prop; } } return context; } /** * Add a child visual element to our set of children. */ addVariantChild(child) { const closestVariantNode = this.getClosestVariantNode(); if (closestVariantNode) { closestVariantNode.variantChildren && closestVariantNode.variantChildren.add(child); return () => closestVariantNode.variantChildren.delete(child); } } /** * Add a motion value and bind it to this visual element. */ addValue(key, value) { // Remove existing value if it exists const existingValue = this.values.get(key); if (value !== existingValue) { if (existingValue) this.removeValue(key); this.bindToMotionValue(key, value); this.values.set(key, value); this.latestValues[key] = value.get(); } } /** * Remove a motion value and unbind any active subscriptions. */ removeValue(key) { this.values.delete(key); const unsubscribe = this.valueSubscriptions.get(key); if (unsubscribe) { unsubscribe(); this.valueSubscriptions.delete(key); } delete this.latestValues[key]; this.removeValueFromRenderState(key, this.renderState); } /** * Check whether we have a motion value for this key */ hasValue(key) { return this.values.has(key); } getValue(key, defaultValue) { if (this.props.values && this.props.values[key]) { return this.props.values[key]; } let value = this.values.get(key); if (value === undefined && defaultValue !== undefined) { value = motionValue(defaultValue === null ? undefined : defaultValue, { owner: this }); this.addValue(key, value); } return value; } /** * If we're trying to animate to a previously unencountered value, * we need to check for it in our state and as a last resort read it * directly from the instance (which might have performance implications). */ readValue(key, target) { var _a; let value = this.latestValues[key] !== undefined || !this.current ? this.latestValues[key] : (_a = this.getBaseTargetFromProps(this.props, key)) !== null && _a !== void 0 ? _a : this.readValueFromInstance(this.current, key, this.options); if (value !== undefined && value !== null) { if (typeof value === "string" && (isNumericalString(value) || isZeroValueString(value))) { // If this is a number read as a string, ie "0" or "200", convert it to a number value = parseFloat(value); } else if (!findValueType(value) && complex.test(target)) { value = animatable_none_getAnimatableNone(key, target); } this.setBaseTarget(key, isMotionValue(value) ? value.get() : value); } return isMotionValue(value) ? value.get() : value; } /** * Set the base target to later animate back to. This is currently * only hydrated on creation and when we first read a value. */ setBaseTarget(key, value) { this.baseTarget[key] = value; } /** * Find the base target for a value thats been removed from all animation * props. */ getBaseTarget(key) { var _a; const { initial } = this.props; let valueFromInitial; if (typeof initial === "string" || typeof initial === "object") { const variant = resolveVariantFromProps(this.props, initial, (_a = this.presenceContext) === null || _a === void 0 ? void 0 : _a.custom); if (variant) { valueFromInitial = variant[key]; } } /** * If this value still exists in the current initial variant, read that. */ if (initial && valueFromInitial !== undefined) { return valueFromInitial; } /** * Alternatively, if this VisualElement config has defined a getBaseTarget * so we can read the value from an alternative source, try that. */ const target = this.getBaseTargetFromProps(this.props, key); if (target !== undefined && !isMotionValue(target)) return target; /** * If the value was initially defined on initial, but it doesn't any more, * return undefined. Otherwise return the value as initially read from the DOM. */ return this.initialValues[key] !== undefined && valueFromInitial === undefined ? undefined : this.baseTarget[key]; } on(eventName, callback) { if (!this.events[eventName]) { this.events[eventName] = new SubscriptionManager(); } return this.events[eventName].add(callback); } notify(eventName, ...args) { if (this.events[eventName]) { this.events[eventName].notify(...args); } } } ;// ./node_modules/framer-motion/dist/es/render/dom/DOMVisualElement.mjs class DOMVisualElement extends VisualElement { constructor() { super(...arguments); this.KeyframeResolver = DOMKeyframesResolver; } sortInstanceNodePosition(a, b) { /** * compareDocumentPosition returns a bitmask, by using the bitwise & * we're returning true if 2 in that bitmask is set to true. 2 is set * to true if b preceeds a. */ return a.compareDocumentPosition(b) & 2 ? 1 : -1; } getBaseTargetFromProps(props, key) { return props.style ? props.style[key] : undefined; } removeValueFromRenderState(key, { vars, style }) { delete vars[key]; delete style[key]; } } ;// ./node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.mjs function HTMLVisualElement_getComputedStyle(element) { return window.getComputedStyle(element); } class HTMLVisualElement extends DOMVisualElement { constructor() { super(...arguments); this.type = "html"; } readValueFromInstance(instance, key) { if (transformProps.has(key)) { const defaultType = getDefaultValueType(key); return defaultType ? defaultType.default || 0 : 0; } else { const computedStyle = HTMLVisualElement_getComputedStyle(instance); const value = (isCSSVariableName(key) ? computedStyle.getPropertyValue(key) : computedStyle[key]) || 0; return typeof value === "string" ? value.trim() : value; } } measureInstanceViewportBox(instance, { transformPagePoint }) { return measureViewportBox(instance, transformPagePoint); } build(renderState, latestValues, options, props) { buildHTMLStyles(renderState, latestValues, options, props.transformTemplate); } scrapeMotionValuesFromProps(props, prevProps, visualElement) { return scrapeMotionValuesFromProps(props, prevProps, visualElement); } handleChildMotionValue() { if (this.childSubscription) { this.childSubscription(); delete this.childSubscription; } const { children } = this.props; if (isMotionValue(children)) { this.childSubscription = children.on("change", (latest) => { if (this.current) this.current.textContent = `${latest}`; }); } } renderInstance(instance, renderState, styleProp, projection) { renderHTML(instance, renderState, styleProp, projection); } } ;// ./node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.mjs class SVGVisualElement extends DOMVisualElement { constructor() { super(...arguments); this.type = "svg"; this.isSVGTag = false; } getBaseTargetFromProps(props, key) { return props[key]; } readValueFromInstance(instance, key) { if (transformProps.has(key)) { const defaultType = getDefaultValueType(key); return defaultType ? defaultType.default || 0 : 0; } key = !camelCaseAttributes.has(key) ? camelToDash(key) : key; return instance.getAttribute(key); } measureInstanceViewportBox() { return createBox(); } scrapeMotionValuesFromProps(props, prevProps, visualElement) { return scrape_motion_values_scrapeMotionValuesFromProps(props, prevProps, visualElement); } build(renderState, latestValues, options, props) { buildSVGAttrs(renderState, latestValues, options, this.isSVGTag, props.transformTemplate); } renderInstance(instance, renderState, styleProp, projection) { renderSVG(instance, renderState, styleProp, projection); } mount(instance) { this.isSVGTag = isSVGTag(instance.tagName); super.mount(instance); } } ;// ./node_modules/framer-motion/dist/es/render/dom/create-visual-element.mjs const create_visual_element_createDomVisualElement = (Component, options) => { return isSVGComponent(Component) ? new SVGVisualElement(options, { enableHardwareAcceleration: false }) : new HTMLVisualElement(options, { allowProjection: Component !== external_React_.Fragment, enableHardwareAcceleration: true, }); }; ;// ./node_modules/framer-motion/dist/es/motion/features/layout.mjs const layout = { layout: { ProjectionNode: HTMLProjectionNode, MeasureLayout: MeasureLayout, }, }; ;// ./node_modules/framer-motion/dist/es/render/dom/motion.mjs const preloadedFeatures = { ...animations, ...gestureAnimations, ...drag, ...layout, }; /** * HTML & SVG components, optimised for use with gestures and animation. These can be used as * drop-in replacements for any HTML & SVG component, all CSS & SVG properties are supported. * * @public */ const motion = /*@__PURE__*/ createMotionProxy((Component, config) => create_config_createDomMotionConfig(Component, config, preloadedFeatures, create_visual_element_createDomVisualElement)); /** * Create a DOM `motion` component with the provided string. This is primarily intended * as a full alternative to `motion` for consumers who have to support environments that don't * support `Proxy`. * * ```javascript * import { createDomMotionComponent } from "framer-motion" * * const motion = { * div: createDomMotionComponent('div') * } * ``` * * @public */ function createDomMotionComponent(key) { return createMotionComponent(createDomMotionConfig(key, { forwardMotionProps: false }, preloadedFeatures, createDomVisualElement)); } ;// ./node_modules/framer-motion/dist/es/utils/use-is-mounted.mjs function useIsMounted() { const isMounted = (0,external_React_.useRef)(false); useIsomorphicLayoutEffect(() => { isMounted.current = true; return () => { isMounted.current = false; }; }, []); return isMounted; } ;// ./node_modules/framer-motion/dist/es/utils/use-force-update.mjs function use_force_update_useForceUpdate() { const isMounted = useIsMounted(); const [forcedRenderCount, setForcedRenderCount] = (0,external_React_.useState)(0); const forceRender = (0,external_React_.useCallback)(() => { isMounted.current && setForcedRenderCount(forcedRenderCount + 1); }, [forcedRenderCount]); /** * Defer this to the end of the next animation frame in case there are multiple * synchronous calls. */ const deferredForceRender = (0,external_React_.useCallback)(() => frame_frame.postRender(forceRender), [forceRender]); return [deferredForceRender, forcedRenderCount]; } ;// ./node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs /** * Measurement functionality has to be within a separate component * to leverage snapshot lifecycle. */ class PopChildMeasure extends external_React_.Component { getSnapshotBeforeUpdate(prevProps) { const element = this.props.childRef.current; if (element && prevProps.isPresent && !this.props.isPresent) { const size = this.props.sizeRef.current; size.height = element.offsetHeight || 0; size.width = element.offsetWidth || 0; size.top = element.offsetTop; size.left = element.offsetLeft; } return null; } /** * Required with getSnapshotBeforeUpdate to stop React complaining. */ componentDidUpdate() { } render() { return this.props.children; } } function PopChild({ children, isPresent }) { const id = (0,external_React_.useId)(); const ref = (0,external_React_.useRef)(null); const size = (0,external_React_.useRef)({ width: 0, height: 0, top: 0, left: 0, }); const { nonce } = (0,external_React_.useContext)(MotionConfigContext); /** * We create and inject a style block so we can apply this explicit * sizing in a non-destructive manner by just deleting the style block. * * We can't apply size via render as the measurement happens * in getSnapshotBeforeUpdate (post-render), likewise if we apply the * styles directly on the DOM node, we might be overwriting * styles set via the style prop. */ (0,external_React_.useInsertionEffect)(() => { const { width, height, top, left } = size.current; if (isPresent || !ref.current || !width || !height) return; ref.current.dataset.motionPopId = id; const style = document.createElement("style"); if (nonce) style.nonce = nonce; document.head.appendChild(style); if (style.sheet) { style.sheet.insertRule(` [data-motion-pop-id="${id}"] { position: absolute !important; width: ${width}px !important; height: ${height}px !important; top: ${top}px !important; left: ${left}px !important; } `); } return () => { document.head.removeChild(style); }; }, [isPresent]); return ((0,external_ReactJSXRuntime_namespaceObject.jsx)(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, children: external_React_.cloneElement(children, { ref }) })); } ;// ./node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, }) => { const presenceChildren = useConstant(newChildrenMap); const id = (0,external_React_.useId)(); const context = (0,external_React_.useMemo)(() => ({ id, initial, isPresent, custom, onExitComplete: (childId) => { presenceChildren.set(childId, true); for (const isComplete of presenceChildren.values()) { if (!isComplete) return; // can stop searching when any is incomplete } onExitComplete && onExitComplete(); }, register: (childId) => { presenceChildren.set(childId, false); return () => presenceChildren.delete(childId); }, }), /** * If the presence of a child affects the layout of the components around it, * we want to make a new context value to ensure they get re-rendered * so they can detect that layout change. */ presenceAffectsLayout ? [Math.random()] : [isPresent]); (0,external_React_.useMemo)(() => { presenceChildren.forEach((_, key) => presenceChildren.set(key, false)); }, [isPresent]); /** * If there's no `motion` components to fire exit animations, we want to remove this * component immediately. */ external_React_.useEffect(() => { !isPresent && !presenceChildren.size && onExitComplete && onExitComplete(); }, [isPresent]); if (mode === "popLayout") { children = (0,external_ReactJSXRuntime_namespaceObject.jsx)(PopChild, { isPresent: isPresent, children: children }); } return ((0,external_ReactJSXRuntime_namespaceObject.jsx)(PresenceContext_PresenceContext.Provider, { value: context, children: children })); }; function newChildrenMap() { return new Map(); } ;// ./node_modules/framer-motion/dist/es/utils/use-unmount-effect.mjs function useUnmountEffect(callback) { return (0,external_React_.useEffect)(() => () => callback(), []); } ;// ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs const getChildKey = (child) => child.key || ""; function updateChildLookup(children, allChildren) { children.forEach((child) => { const key = getChildKey(child); allChildren.set(key, child); }); } function onlyElements(children) { const filtered = []; // We use forEach here instead of map as map mutates the component key by preprending `.$` external_React_.Children.forEach(children, (child) => { if ((0,external_React_.isValidElement)(child)) filtered.push(child); }); return filtered; } /** * `AnimatePresence` enables the animation of components that have been removed from the tree. * * When adding/removing more than a single child, every child **must** be given a unique `key` prop. * * Any `motion` components that have an `exit` property defined will animate out when removed from * the tree. * * ```jsx * import { motion, AnimatePresence } from 'framer-motion' * * export const Items = ({ items }) => ( * <AnimatePresence> * {items.map(item => ( * <motion.div * key={item.id} * initial={{ opacity: 0 }} * animate={{ opacity: 1 }} * exit={{ opacity: 0 }} * /> * ))} * </AnimatePresence> * ) * ``` * * You can sequence exit animations throughout a tree using variants. * * If a child contains multiple `motion` components with `exit` props, it will only unmount the child * once all `motion` components have finished animating out. Likewise, any components using * `usePresence` all need to call `safeToRemove`. * * @public */ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, exitBeforeEnter, presenceAffectsLayout = true, mode = "sync", }) => { errors_invariant(!exitBeforeEnter, "Replace exitBeforeEnter with mode='wait'"); // We want to force a re-render once all exiting animations have finished. We // either use a local forceRender function, or one from a parent context if it exists. const forceRender = (0,external_React_.useContext)(LayoutGroupContext).forceRender || use_force_update_useForceUpdate()[0]; const isMounted = useIsMounted(); // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key const filteredChildren = onlyElements(children); let childrenToRender = filteredChildren; const exitingChildren = (0,external_React_.useRef)(new Map()).current; // Keep a living record of the children we're actually rendering so we // can diff to figure out which are entering and exiting const presentChildren = (0,external_React_.useRef)(childrenToRender); // A lookup table to quickly reference components by key const allChildren = (0,external_React_.useRef)(new Map()).current; // If this is the initial component render, just deal with logic surrounding whether // we play onMount animations or not. const isInitialRender = (0,external_React_.useRef)(true); useIsomorphicLayoutEffect(() => { isInitialRender.current = false; updateChildLookup(filteredChildren, allChildren); presentChildren.current = childrenToRender; }); useUnmountEffect(() => { isInitialRender.current = true; allChildren.clear(); exitingChildren.clear(); }); if (isInitialRender.current) { return ((0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: childrenToRender.map((child) => ((0,external_ReactJSXRuntime_namespaceObject.jsx)(PresenceChild, { isPresent: true, initial: initial ? undefined : false, presenceAffectsLayout: presenceAffectsLayout, mode: mode, children: child }, getChildKey(child)))) })); } // If this is a subsequent render, deal with entering and exiting children childrenToRender = [...childrenToRender]; // Diff the keys of the currently-present and target children to update our // exiting list. const presentKeys = presentChildren.current.map(getChildKey); const targetKeys = filteredChildren.map(getChildKey); // Diff the present children with our target children and mark those that are exiting const numPresent = presentKeys.length; for (let i = 0; i < numPresent; i++) { const key = presentKeys[i]; if (targetKeys.indexOf(key) === -1 && !exitingChildren.has(key)) { exitingChildren.set(key, undefined); } } // If we currently have exiting children, and we're deferring rendering incoming children // until after all current children have exiting, empty the childrenToRender array if (mode === "wait" && exitingChildren.size) { childrenToRender = []; } // Loop through all currently exiting components and clone them to overwrite `animate` // with any `exit` prop they might have defined. exitingChildren.forEach((component, key) => { // If this component is actually entering again, early return if (targetKeys.indexOf(key) !== -1) return; const child = allChildren.get(key); if (!child) return; const insertionIndex = presentKeys.indexOf(key); let exitingComponent = component; if (!exitingComponent) { const onExit = () => { // clean up the exiting children map exitingChildren.delete(key); // compute the keys of children that were rendered once but are no longer present // this could happen in case of too many fast consequent renderings // @link https://github.com/framer/motion/issues/2023 const leftOverKeys = Array.from(allChildren.keys()).filter((childKey) => !targetKeys.includes(childKey)); // clean up the all children map leftOverKeys.forEach((leftOverKey) => allChildren.delete(leftOverKey)); // make sure to render only the children that are actually visible presentChildren.current = filteredChildren.filter((presentChild) => { const presentChildKey = getChildKey(presentChild); return ( // filter out the node exiting presentChildKey === key || // filter out the leftover children leftOverKeys.includes(presentChildKey)); }); // Defer re-rendering until all exiting children have indeed left if (!exitingChildren.size) { if (isMounted.current === false) return; forceRender(); onExitComplete && onExitComplete(); } }; exitingComponent = ((0,external_ReactJSXRuntime_namespaceObject.jsx)(PresenceChild, { isPresent: false, onExitComplete: onExit, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, children: child }, getChildKey(child))); exitingChildren.set(key, exitingComponent); } childrenToRender.splice(insertionIndex, 0, exitingComponent); }); // Add `MotionContext` even to children that don't need it to ensure we're rendering // the same tree between renders childrenToRender = childrenToRender.map((child) => { const key = child.key; return exitingChildren.has(key) ? (child) : ((0,external_ReactJSXRuntime_namespaceObject.jsx)(PresenceChild, { isPresent: true, presenceAffectsLayout: presenceAffectsLayout, mode: mode, children: child }, getChildKey(child))); }); if (false) {} return ((0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: exitingChildren.size ? childrenToRender : childrenToRender.map((child) => (0,external_React_.cloneElement)(child)) })); }; ;// ./node_modules/@wordpress/components/build-module/utils/use-responsive-value.js /** * WordPress dependencies */ const breakpoints = ['40em', '52em', '64em']; const useBreakpointIndex = (options = {}) => { const { defaultIndex = 0 } = options; if (typeof defaultIndex !== 'number') { throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`); } else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) { throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`); } const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(defaultIndex); (0,external_wp_element_namespaceObject.useEffect)(() => { const getIndex = () => breakpoints.filter(bp => { return typeof window !== 'undefined' ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false; }).length; const onResize = () => { const newValue = getIndex(); if (value !== newValue) { setValue(newValue); } }; onResize(); if (typeof window !== 'undefined') { window.addEventListener('resize', onResize); } return () => { if (typeof window !== 'undefined') { window.removeEventListener('resize', onResize); } }; }, [value]); return value; }; function useResponsiveValue(values, options = {}) { const index = useBreakpointIndex(options); // Allow calling the function with a "normal" value without having to check on the outside. if (!Array.isArray(values) && typeof values !== 'function') { return values; } const array = values || []; /* eslint-disable jsdoc/no-undefined-types */ return /** @type {T[]} */array[/* eslint-enable jsdoc/no-undefined-types */ index >= array.length ? array.length - 1 : index]; } ;// ./node_modules/@wordpress/components/build-module/flex/styles.js function styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ const Flex = true ? { name: "zjik7", styles: "display:flex" } : 0; const Item = true ? { name: "qgaee5", styles: "display:block;max-height:100%;max-width:100%;min-height:0;min-width:0" } : 0; const block = true ? { name: "82a6rk", styles: "flex:1" } : 0; /** * Workaround to optimize DOM rendering. * We'll enhance alignment with naive parent flex assumptions. * * Trade-off: * Far less DOM less. However, UI rendering is not as reliable. */ /** * Improves stability of width/height rendering. * https://github.com/ItsJonQ/g2/pull/149 */ const ItemsColumn = true ? { name: "13nosa1", styles: ">*{min-height:0;}" } : 0; const ItemsRow = true ? { name: "1pwxzk4", styles: ">*{min-width:0;}" } : 0; ;// ./node_modules/@wordpress/components/build-module/flex/flex/hook.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function useDeprecatedProps(props) { const { isReversed, ...otherProps } = props; if (typeof isReversed !== 'undefined') { external_wp_deprecated_default()('Flex isReversed', { alternative: 'Flex direction="row-reverse" or "column-reverse"', since: '5.9' }); return { ...otherProps, direction: isReversed ? 'row-reverse' : 'row' }; } return otherProps; } function useFlex(props) { const { align, className, direction: directionProp = 'row', expanded = true, gap = 2, justify = 'space-between', wrap = false, ...otherProps } = useContextSystem(useDeprecatedProps(props), 'Flex'); const directionAsArray = Array.isArray(directionProp) ? directionProp : [directionProp]; const direction = useResponsiveValue(directionAsArray); const isColumn = typeof direction === 'string' && !!direction.includes('column'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { const base = /*#__PURE__*/emotion_react_browser_esm_css({ alignItems: align !== null && align !== void 0 ? align : isColumn ? 'normal' : 'center', flexDirection: direction, flexWrap: wrap ? 'wrap' : undefined, gap: space(gap), justifyContent: justify, height: isColumn && expanded ? '100%' : undefined, width: !isColumn && expanded ? '100%' : undefined }, true ? "" : 0, true ? "" : 0); return cx(Flex, base, isColumn ? ItemsColumn : ItemsRow, className); }, [align, className, cx, direction, expanded, gap, isColumn, justify, wrap]); return { ...otherProps, className: classes, isColumn }; } ;// ./node_modules/@wordpress/components/build-module/flex/context.js /** * WordPress dependencies */ const FlexContext = (0,external_wp_element_namespaceObject.createContext)({ flexItemDisplay: undefined }); const useFlexContext = () => (0,external_wp_element_namespaceObject.useContext)(FlexContext); ;// ./node_modules/@wordpress/components/build-module/flex/flex/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedFlex(props, forwardedRef) { const { children, isColumn, ...otherProps } = useFlex(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexContext.Provider, { value: { flexItemDisplay: isColumn ? 'block' : undefined }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...otherProps, ref: forwardedRef, children: children }) }); } /** * `Flex` is a primitive layout component that adaptively aligns child content * horizontally or vertically. `Flex` powers components like `HStack` and * `VStack`. * * `Flex` is used with any of its two sub-components, `FlexItem` and * `FlexBlock`. * * ```jsx * import { Flex, FlexBlock, FlexItem } from '@wordpress/components'; * * function Example() { * return ( * <Flex> * <FlexItem> * <p>Code</p> * </FlexItem> * <FlexBlock> * <p>Poetry</p> * </FlexBlock> * </Flex> * ); * } * ``` */ const component_Flex = contextConnect(UnconnectedFlex, 'Flex'); /* harmony default export */ const flex_component = (component_Flex); ;// ./node_modules/@wordpress/components/build-module/flex/flex-item/hook.js /** * External dependencies */ /** * Internal dependencies */ function useFlexItem(props) { const { className, display: displayProp, isBlock = false, ...otherProps } = useContextSystem(props, 'FlexItem'); const sx = {}; const contextDisplay = useFlexContext().flexItemDisplay; sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({ display: displayProp || contextDisplay }, true ? "" : 0, true ? "" : 0); const cx = useCx(); const classes = cx(Item, sx.Base, isBlock && block, className); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/flex/flex-block/hook.js /** * Internal dependencies */ function useFlexBlock(props) { const otherProps = useContextSystem(props, 'FlexBlock'); const flexItemProps = useFlexItem({ isBlock: true, ...otherProps }); return flexItemProps; } ;// ./node_modules/@wordpress/components/build-module/flex/flex-block/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedFlexBlock(props, forwardedRef) { const flexBlockProps = useFlexBlock(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...flexBlockProps, ref: forwardedRef }); } /** * `FlexBlock` is a primitive layout component that adaptively resizes content * within layout containers like `Flex`. * * ```jsx * import { Flex, FlexBlock } from '@wordpress/components'; * * function Example() { * return ( * <Flex> * <FlexBlock>...</FlexBlock> * </Flex> * ); * } * ``` */ const FlexBlock = contextConnect(UnconnectedFlexBlock, 'FlexBlock'); /* harmony default export */ const flex_block_component = (FlexBlock); ;// ./node_modules/@wordpress/components/build-module/utils/rtl.js /** * External dependencies */ /** * WordPress dependencies */ const LOWER_LEFT_REGEXP = new RegExp(/-left/g); const LOWER_RIGHT_REGEXP = new RegExp(/-right/g); const UPPER_LEFT_REGEXP = new RegExp(/Left/g); const UPPER_RIGHT_REGEXP = new RegExp(/Right/g); /** * Flips a CSS property from left <-> right. * * @param {string} key The CSS property name. * * @return {string} The flipped CSS property name, if applicable. */ function getConvertedKey(key) { if (key === 'left') { return 'right'; } if (key === 'right') { return 'left'; } if (LOWER_LEFT_REGEXP.test(key)) { return key.replace(LOWER_LEFT_REGEXP, '-right'); } if (LOWER_RIGHT_REGEXP.test(key)) { return key.replace(LOWER_RIGHT_REGEXP, '-left'); } if (UPPER_LEFT_REGEXP.test(key)) { return key.replace(UPPER_LEFT_REGEXP, 'Right'); } if (UPPER_RIGHT_REGEXP.test(key)) { return key.replace(UPPER_RIGHT_REGEXP, 'Left'); } return key; } /** * An incredibly basic ltr -> rtl converter for style properties * * @param {import('react').CSSProperties} ltrStyles * * @return {import('react').CSSProperties} Converted ltr -> rtl styles */ const convertLTRToRTL = (ltrStyles = {}) => { return Object.fromEntries(Object.entries(ltrStyles).map(([key, value]) => [getConvertedKey(key), value])); }; /** * A higher-order function that create an incredibly basic ltr -> rtl style converter for CSS objects. * * @param {import('react').CSSProperties} ltrStyles Ltr styles. Converts and renders from ltr -> rtl styles, if applicable. * @param {import('react').CSSProperties} [rtlStyles] Rtl styles. Renders if provided. * * @return {() => import('@emotion/react').SerializedStyles} A function to output CSS styles for Emotion's renderer */ function rtl(ltrStyles = {}, rtlStyles) { return () => { if (rtlStyles) { // @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css return (0,external_wp_i18n_namespaceObject.isRTL)() ? /*#__PURE__*/emotion_react_browser_esm_css(rtlStyles, true ? "" : 0, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css(ltrStyles, true ? "" : 0, true ? "" : 0); } // @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css return (0,external_wp_i18n_namespaceObject.isRTL)() ? /*#__PURE__*/emotion_react_browser_esm_css(convertLTRToRTL(ltrStyles), true ? "" : 0, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css(ltrStyles, true ? "" : 0, true ? "" : 0); }; } /** * Call this in the `useMemo` dependency array to ensure that subsequent renders will * cause rtl styles to update based on the `isRTL` return value even if all other dependencies * remain the same. * * @example * const styles = useMemo( () => { * return css` * ${ rtl( { marginRight: '10px' } ) } * `; * }, [ rtl.watch() ] ); */ rtl.watch = () => (0,external_wp_i18n_namespaceObject.isRTL)(); ;// ./node_modules/@wordpress/components/build-module/spacer/hook.js /** * External dependencies */ /** * Internal dependencies */ function isDefined(o) { return typeof o !== 'undefined' && o !== null; } function useSpacer(props) { const { className, margin, marginBottom = 2, marginLeft, marginRight, marginTop, marginX, marginY, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, ...otherProps } = useContextSystem(props, 'Spacer'); const cx = useCx(); const classes = cx(isDefined(margin) && /*#__PURE__*/emotion_react_browser_esm_css("margin:", space(margin), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginY) && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(marginY), ";margin-top:", space(marginY), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginX) && /*#__PURE__*/emotion_react_browser_esm_css("margin-left:", space(marginX), ";margin-right:", space(marginX), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginTop) && /*#__PURE__*/emotion_react_browser_esm_css("margin-top:", space(marginTop), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginBottom) && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(marginBottom), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginLeft) && rtl({ marginLeft: space(marginLeft) })(), isDefined(marginRight) && rtl({ marginRight: space(marginRight) })(), isDefined(padding) && /*#__PURE__*/emotion_react_browser_esm_css("padding:", space(padding), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingY) && /*#__PURE__*/emotion_react_browser_esm_css("padding-bottom:", space(paddingY), ";padding-top:", space(paddingY), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingX) && /*#__PURE__*/emotion_react_browser_esm_css("padding-left:", space(paddingX), ";padding-right:", space(paddingX), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingTop) && /*#__PURE__*/emotion_react_browser_esm_css("padding-top:", space(paddingTop), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingBottom) && /*#__PURE__*/emotion_react_browser_esm_css("padding-bottom:", space(paddingBottom), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingLeft) && rtl({ paddingLeft: space(paddingLeft) })(), isDefined(paddingRight) && rtl({ paddingRight: space(paddingRight) })(), className); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/spacer/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedSpacer(props, forwardedRef) { const spacerProps = useSpacer(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...spacerProps, ref: forwardedRef }); } /** * `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`. * * `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props * can either be a number (which will act as a multiplier to the library's grid system base of 4px), * or a literal CSS value string. * * ```jsx * import { Spacer } from `@wordpress/components` * * function Example() { * return ( * <View> * <Spacer> * <Heading>WordPress.org</Heading> * </Spacer> * <Text> * Code is Poetry * </Text> * </View> * ); * } * ``` */ const Spacer = contextConnect(UnconnectedSpacer, 'Spacer'); /* harmony default export */ const spacer_component = (Spacer); ;// ./node_modules/@wordpress/icons/build-module/library/plus.js /** * WordPress dependencies */ const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); /* harmony default export */ const library_plus = (plus); ;// ./node_modules/@wordpress/icons/build-module/library/reset.js /** * WordPress dependencies */ const reset_reset = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 11.5h10V13H7z" }) }); /* harmony default export */ const library_reset = (reset_reset); ;// ./node_modules/@wordpress/components/build-module/flex/flex-item/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedFlexItem(props, forwardedRef) { const flexItemProps = useFlexItem(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...flexItemProps, ref: forwardedRef }); } /** * `FlexItem` is a primitive layout component that aligns content within layout * containers like `Flex`. * * ```jsx * import { Flex, FlexItem } from '@wordpress/components'; * * function Example() { * return ( * <Flex> * <FlexItem>...</FlexItem> * </Flex> * ); * } * ``` */ const FlexItem = contextConnect(UnconnectedFlexItem, 'FlexItem'); /* harmony default export */ const flex_item_component = (FlexItem); ;// ./node_modules/@wordpress/components/build-module/truncate/styles.js function truncate_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ const Truncate = true ? { name: "hdknak", styles: "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap" } : 0; ;// ./node_modules/@wordpress/components/build-module/utils/values.js /* eslint-disable jsdoc/valid-types */ /** * Determines if a value is null or undefined. * * @template T * * @param {T} value The value to check. * @return {value is Exclude<T, null | undefined>} Whether value is not null or undefined. */ function isValueDefined(value) { return value !== undefined && value !== null; } /* eslint-enable jsdoc/valid-types */ /* eslint-disable jsdoc/valid-types */ /** * Determines if a value is empty, null, or undefined. * * @param {string | number | null | undefined} value The value to check. * @return {value is ("" | null | undefined)} Whether value is empty. */ function isValueEmpty(value) { const isEmptyString = value === ''; return !isValueDefined(value) || isEmptyString; } /* eslint-enable jsdoc/valid-types */ /** * Get the first defined/non-null value from an array. * * @template T * * @param {Array<T | null | undefined>} values Values to derive from. * @param {T} fallbackValue Fallback value if there are no defined values. * @return {T} A defined value or the fallback value. */ function getDefinedValue(values = [], fallbackValue) { var _values$find; return (_values$find = values.find(isValueDefined)) !== null && _values$find !== void 0 ? _values$find : fallbackValue; } /** * Converts a string to a number. * * @param {string} value * @return {number} String as a number. */ const stringToNumber = value => { return parseFloat(value); }; /** * Regardless of the input being a string or a number, returns a number. * * Returns `undefined` in case the string is `undefined` or not a valid numeric value. * * @param {string | number} value * @return {number} The parsed number. */ const ensureNumber = value => { return typeof value === 'string' ? stringToNumber(value) : value; }; ;// ./node_modules/@wordpress/components/build-module/truncate/utils.js /** * Internal dependencies */ const TRUNCATE_ELLIPSIS = '…'; const TRUNCATE_TYPE = { auto: 'auto', head: 'head', middle: 'middle', tail: 'tail', none: 'none' }; const TRUNCATE_DEFAULT_PROPS = { ellipsis: TRUNCATE_ELLIPSIS, ellipsizeMode: TRUNCATE_TYPE.auto, limit: 0, numberOfLines: 0 }; // Source // https://github.com/kahwee/truncate-middle function truncateMiddle(word, headLength, tailLength, ellipsis) { if (typeof word !== 'string') { return ''; } const wordLength = word.length; // Setting default values // eslint-disable-next-line no-bitwise const frontLength = ~~headLength; // Will cast to integer // eslint-disable-next-line no-bitwise const backLength = ~~tailLength; /* istanbul ignore next */ const truncateStr = isValueDefined(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS; if (frontLength === 0 && backLength === 0 || frontLength >= wordLength || backLength >= wordLength || frontLength + backLength >= wordLength) { return word; } else if (backLength === 0) { return word.slice(0, frontLength) + truncateStr; } return word.slice(0, frontLength) + truncateStr + word.slice(wordLength - backLength); } function truncateContent(words = '', props) { const mergedProps = { ...TRUNCATE_DEFAULT_PROPS, ...props }; const { ellipsis, ellipsizeMode, limit } = mergedProps; if (ellipsizeMode === TRUNCATE_TYPE.none) { return words; } let truncateHead; let truncateTail; switch (ellipsizeMode) { case TRUNCATE_TYPE.head: truncateHead = 0; truncateTail = limit; break; case TRUNCATE_TYPE.middle: truncateHead = Math.floor(limit / 2); truncateTail = Math.floor(limit / 2); break; default: truncateHead = limit; truncateTail = 0; } const truncatedContent = ellipsizeMode !== TRUNCATE_TYPE.auto ? truncateMiddle(words, truncateHead, truncateTail, ellipsis) : words; return truncatedContent; } ;// ./node_modules/@wordpress/components/build-module/truncate/hook.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function useTruncate(props) { const { className, children, ellipsis = TRUNCATE_ELLIPSIS, ellipsizeMode = TRUNCATE_TYPE.auto, limit = 0, numberOfLines = 0, ...otherProps } = useContextSystem(props, 'Truncate'); const cx = useCx(); let childrenAsText; if (typeof children === 'string') { childrenAsText = children; } else if (typeof children === 'number') { childrenAsText = children.toString(); } const truncatedContent = childrenAsText ? truncateContent(childrenAsText, { ellipsis, ellipsizeMode, limit, numberOfLines }) : children; const shouldTruncate = !!childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto; const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { // The `word-break: break-all` property first makes sure a text line // breaks even when it contains 'unbreakable' content such as long URLs. // See https://github.com/WordPress/gutenberg/issues/60860. const truncateLines = /*#__PURE__*/emotion_react_browser_esm_css(numberOfLines === 1 ? 'word-break: break-all;' : '', " -webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + ( true ? "" : 0), true ? "" : 0); return cx(shouldTruncate && !numberOfLines && Truncate, shouldTruncate && !!numberOfLines && truncateLines, className); }, [className, cx, numberOfLines, shouldTruncate]); return { ...otherProps, className: classes, children: truncatedContent }; } ;// ./node_modules/colord/index.mjs var colord_r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},colord_n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},colord_e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},colord_a=function(r){return{r:colord_e(r.r,0,255),g:colord_e(r.g,0,255),b:colord_e(r.b,0,255),a:colord_e(r.a)}},colord_o=function(r){return{r:colord_n(r.r),g:colord_n(r.g),b:colord_n(r.b),a:colord_n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:colord_e(r.s,0,100),l:colord_e(r.l,0,100),a:colord_e(r.a)}},d=function(r){return{h:colord_n(r.h),s:colord_n(r.s),l:colord_n(r.l),a:colord_n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?colord_n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?colord_n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:colord_a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(colord_r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?colord_a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:colord_e(r.s,0,100),v:colord_e(r.v,0,100),a:colord_e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:colord_e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:colord_e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return colord_n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=colord_o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(colord_n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return colord_o(this.rgba)},r.prototype.toRgbString=function(){return r=colord_o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:colord_n(r.h),s:colord_n(r.s),v:colord_n(r.v),a:colord_n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):colord_n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):colord_n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; ;// ./node_modules/colord/plugins/names.mjs /* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])} ;// ./node_modules/@wordpress/components/build-module/utils/colors.js /** * External dependencies */ /** @type {HTMLDivElement} */ let colorComputationNode; k([names]); /** * Generating a CSS compliant rgba() color value. * * @param {string} hexValue The hex value to convert to rgba(). * @param {number} alpha The alpha value for opacity. * @return {string} The converted rgba() color value. * * @example * rgba( '#000000', 0.5 ) * // rgba(0, 0, 0, 0.5) */ function colors_rgba(hexValue = '', alpha = 1) { return colord(hexValue).alpha(alpha).toRgbString(); } /** * @return {HTMLDivElement | undefined} The HTML element for color computation. */ function getColorComputationNode() { if (typeof document === 'undefined') { return; } if (!colorComputationNode) { // Create a temporary element for style computation. const el = document.createElement('div'); el.setAttribute('data-g2-color-computation-node', ''); // Inject for window computed style. document.body.appendChild(el); colorComputationNode = el; } return colorComputationNode; } /** * @param {string | unknown} value * * @return {boolean} Whether the value is a valid color. */ function isColor(value) { if (typeof value !== 'string') { return false; } const test = w(value); return test.isValid(); } /** * Retrieves the computed background color. This is useful for getting the * value of a CSS variable color. * * @param {string | unknown} backgroundColor The background color to compute. * * @return {string} The computed background color. */ function _getComputedBackgroundColor(backgroundColor) { if (typeof backgroundColor !== 'string') { return ''; } if (isColor(backgroundColor)) { return backgroundColor; } if (!backgroundColor.includes('var(')) { return ''; } if (typeof document === 'undefined') { return ''; } // Attempts to gracefully handle CSS variables color values. const el = getColorComputationNode(); if (!el) { return ''; } el.style.background = backgroundColor; // Grab the style. const computedColor = window?.getComputedStyle(el).background; // Reset. el.style.background = ''; return computedColor || ''; } const getComputedBackgroundColor = memize(_getComputedBackgroundColor); /** * Get the text shade optimized for readability, based on a background color. * * @param {string | unknown} backgroundColor The background color. * * @return {string} The optimized text color (black or white). */ function getOptimalTextColor(backgroundColor) { const background = getComputedBackgroundColor(backgroundColor); return w(background).isLight() ? '#000000' : '#ffffff'; } /** * Get the text shade optimized for readability, based on a background color. * * @param {string | unknown} backgroundColor The background color. * * @return {string} The optimized text shade (dark or light). */ function getOptimalTextShade(backgroundColor) { const result = getOptimalTextColor(backgroundColor); return result === '#000000' ? 'dark' : 'light'; } ;// ./node_modules/@wordpress/components/build-module/text/styles.js function text_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const Text = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.theme.foreground, ";line-height:", config_values.fontLineHeightBase, ";margin:0;text-wrap:balance;text-wrap:pretty;" + ( true ? "" : 0), true ? "" : 0); const styles_block = true ? { name: "4zleql", styles: "display:block" } : 0; const positive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.alert.green, ";" + ( true ? "" : 0), true ? "" : 0); const destructive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.alert.red, ";" + ( true ? "" : 0), true ? "" : 0); const muted = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[700], ";" + ( true ? "" : 0), true ? "" : 0); const highlighterText = /*#__PURE__*/emotion_react_browser_esm_css("mark{background:", COLORS.alert.yellow, ";border-radius:", config_values.radiusSmall, ";box-shadow:0 0 0 1px rgba( 0, 0, 0, 0.05 ) inset,0 -1px 0 rgba( 0, 0, 0, 0.1 ) inset;}" + ( true ? "" : 0), true ? "" : 0); const upperCase = true ? { name: "50zrmy", styles: "text-transform:uppercase" } : 0; // EXTERNAL MODULE: ./node_modules/highlight-words-core/dist/index.js var dist = __webpack_require__(9664); ;// ./node_modules/@wordpress/components/build-module/text/utils.js /** * External dependencies */ /** * WordPress dependencies */ /** * Source: * https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js */ /** * @typedef Options * @property {string} [activeClassName=''] Classname for active highlighted areas. * @property {number} [activeIndex=-1] The index of the active highlighted area. * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [activeStyle] Styles to apply to the active highlighted area. * @property {boolean} [autoEscape] Whether to automatically escape text. * @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner. * @property {string} children Children to highlight. * @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`. * @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key). * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text. * @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text. * @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `sanitize` function to pass to `highlight-words-core`. * @property {string[]} [searchWords=[]] Words to search for and highlight. * @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text. * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text. */ /** * Maps props to lowercase names. * * @param object Props to map. * @return The mapped props. */ const lowercaseProps = object => { const mapped = {}; for (const key in object) { mapped[key.toLowerCase()] = object[key]; } return mapped; }; const memoizedLowercaseProps = memize(lowercaseProps); /** * @param options * @param options.activeClassName * @param options.activeIndex * @param options.activeStyle * @param options.autoEscape * @param options.caseSensitive * @param options.children * @param options.findChunks * @param options.highlightClassName * @param options.highlightStyle * @param options.highlightTag * @param options.sanitize * @param options.searchWords * @param options.unhighlightClassName * @param options.unhighlightStyle */ function createHighlighterText({ activeClassName = '', activeIndex = -1, activeStyle, autoEscape, caseSensitive = false, children, findChunks, highlightClassName = '', highlightStyle = {}, highlightTag = 'mark', sanitize, searchWords = [], unhighlightClassName = '', unhighlightStyle }) { if (!children) { return null; } if (typeof children !== 'string') { return children; } const textToHighlight = children; const chunks = (0,dist.findAll)({ autoEscape, caseSensitive, findChunks, sanitize, searchWords, textToHighlight }); const HighlightTag = highlightTag; let highlightIndex = -1; let highlightClassNames = ''; let highlightStyles; const textContent = chunks.map((chunk, index) => { const text = textToHighlight.substr(chunk.start, chunk.end - chunk.start); if (chunk.highlight) { highlightIndex++; let highlightClass; if (typeof highlightClassName === 'object') { if (!caseSensitive) { highlightClassName = memoizedLowercaseProps(highlightClassName); highlightClass = highlightClassName[text.toLowerCase()]; } else { highlightClass = highlightClassName[text]; } } else { highlightClass = highlightClassName; } const isActive = highlightIndex === +activeIndex; highlightClassNames = `${highlightClass} ${isActive ? activeClassName : ''}`; highlightStyles = isActive === true && activeStyle !== null ? Object.assign({}, highlightStyle, activeStyle) : highlightStyle; const props = { children: text, className: highlightClassNames, key: index, style: highlightStyles }; // Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop) // Only pass through the highlightIndex attribute for custom components. if (typeof HighlightTag !== 'string') { props.highlightIndex = highlightIndex; } return (0,external_wp_element_namespaceObject.createElement)(HighlightTag, props); } return (0,external_wp_element_namespaceObject.createElement)('span', { children: text, className: unhighlightClassName, key: index, style: unhighlightStyle }); }); return textContent; } ;// ./node_modules/@wordpress/components/build-module/utils/font-size.js /** * External dependencies */ /** * Internal dependencies */ const BASE_FONT_SIZE = 13; const PRESET_FONT_SIZES = { body: BASE_FONT_SIZE, caption: 10, footnote: 11, largeTitle: 28, subheadline: 12, title: 20 }; const HEADING_FONT_SIZES = [1, 2, 3, 4, 5, 6].flatMap(n => [n, n.toString()]); function getFontSize(size = BASE_FONT_SIZE) { if (size in PRESET_FONT_SIZES) { return getFontSize(PRESET_FONT_SIZES[size]); } if (typeof size !== 'number') { const parsed = parseFloat(size); if (Number.isNaN(parsed)) { return size; } size = parsed; } const ratio = `(${size} / ${BASE_FONT_SIZE})`; return `calc(${ratio} * ${config_values.fontSize})`; } function getHeadingFontSize(size = 3) { if (!HEADING_FONT_SIZES.includes(size)) { return getFontSize(size); } const headingSize = `fontSizeH${size}`; return config_values[headingSize]; } ;// ./node_modules/@wordpress/components/build-module/text/get-line-height.js /** * External dependencies */ /** * Internal dependencies */ function getLineHeight(adjustLineHeightForInnerControls, lineHeight) { if (lineHeight) { return lineHeight; } if (!adjustLineHeightForInnerControls) { return; } let value = `calc(${config_values.controlHeight} + ${space(2)})`; switch (adjustLineHeightForInnerControls) { case 'large': value = `calc(${config_values.controlHeightLarge} + ${space(2)})`; break; case 'small': value = `calc(${config_values.controlHeightSmall} + ${space(2)})`; break; case 'xSmall': value = `calc(${config_values.controlHeightXSmall} + ${space(2)})`; break; default: break; } return value; } ;// ./node_modules/@wordpress/components/build-module/text/hook.js function hook_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var hook_ref = true ? { name: "50zrmy", styles: "text-transform:uppercase" } : 0; /** * @param {import('../context').WordPressComponentProps<import('./types').Props, 'span'>} props */ function useText(props) { const { adjustLineHeightForInnerControls, align, children, className, color, ellipsizeMode, isDestructive = false, display, highlightEscape = false, highlightCaseSensitive = false, highlightWords, highlightSanitize, isBlock = false, letterSpacing, lineHeight: lineHeightProp, optimizeReadabilityFor, size, truncate = false, upperCase = false, variant, weight = config_values.fontWeight, ...otherProps } = useContextSystem(props, 'Text'); let content = children; const isHighlighter = Array.isArray(highlightWords); const isCaption = size === 'caption'; if (isHighlighter) { if (typeof children !== 'string') { throw new TypeError('`children` of `Text` must only be `string` types when `highlightWords` is defined'); } content = createHighlighterText({ autoEscape: highlightEscape, children, caseSensitive: highlightCaseSensitive, searchWords: highlightWords, sanitize: highlightSanitize }); } const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { const sx = {}; const lineHeight = getLineHeight(adjustLineHeightForInnerControls, lineHeightProp); sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({ color, display, fontSize: getFontSize(size), fontWeight: weight, lineHeight, letterSpacing, textAlign: align }, true ? "" : 0, true ? "" : 0); sx.upperCase = hook_ref; sx.optimalTextColor = null; if (optimizeReadabilityFor) { const isOptimalTextColorDark = getOptimalTextShade(optimizeReadabilityFor) === 'dark'; // Should not use theme colors sx.optimalTextColor = isOptimalTextColorDark ? /*#__PURE__*/emotion_react_browser_esm_css({ color: COLORS.gray[900] }, true ? "" : 0, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css({ color: COLORS.white }, true ? "" : 0, true ? "" : 0); } return cx(Text, sx.Base, sx.optimalTextColor, isDestructive && destructive, !!isHighlighter && highlighterText, isBlock && styles_block, isCaption && muted, variant && text_styles_namespaceObject[variant], upperCase && sx.upperCase, className); }, [adjustLineHeightForInnerControls, align, className, color, cx, display, isBlock, isCaption, isDestructive, isHighlighter, letterSpacing, lineHeightProp, optimizeReadabilityFor, size, upperCase, variant, weight]); let finalEllipsizeMode; if (truncate === true) { finalEllipsizeMode = 'auto'; } if (truncate === false) { finalEllipsizeMode = 'none'; } const finalComponentProps = { ...otherProps, className: classes, children, ellipsizeMode: ellipsizeMode || finalEllipsizeMode }; const truncateProps = useTruncate(finalComponentProps); /** * Enhance child `<Link />` components to inherit font size. */ if (!truncate && Array.isArray(children)) { content = external_wp_element_namespaceObject.Children.map(children, child => { if (typeof child !== 'object' || child === null || !('props' in child)) { return child; } const isLink = hasConnectNamespace(child, ['Link']); if (isLink) { return (0,external_wp_element_namespaceObject.cloneElement)(child, { size: child.props.size || 'inherit' }); } return child; }); } return { ...truncateProps, children: truncate ? truncateProps.children : content }; } ;// ./node_modules/@wordpress/components/build-module/text/component.js /** * Internal dependencies */ /** * @param props * @param forwardedRef */ function UnconnectedText(props, forwardedRef) { const textProps = useText(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { as: "span", ...textProps, ref: forwardedRef }); } /** * `Text` is a core component that renders text in the library, using the * library's typography system. * * `Text` can be used to render any text-content, like an HTML `p` or `span`. * * @example * * ```jsx * import { __experimentalText as Text } from `@wordpress/components`; * * function Example() { * return <Text>Code is Poetry</Text>; * } * ``` */ const component_Text = contextConnect(UnconnectedText, 'Text'); /* harmony default export */ const text_component = (component_Text); ;// ./node_modules/@wordpress/components/build-module/utils/base-label.js function base_label_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ // This is a very low-level mixin which you shouldn't have to use directly. // Try to use BaseControl's StyledLabel or BaseControl.VisualLabel if you can. const baseLabelTypography = true ? { name: "9amh4a", styles: "font-size:11px;font-weight:500;line-height:1.4;text-transform:uppercase" } : 0; ;// ./node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js function input_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const Prefix = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "em5sgkm8" } : 0)( true ? { name: "pvvbxf", styles: "box-sizing:border-box;display:block" } : 0); const Suffix = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "em5sgkm7" } : 0)( true ? { name: "jgf79h", styles: "align-items:center;align-self:stretch;box-sizing:border-box;display:flex" } : 0); const backdropBorderColor = ({ disabled, isBorderless }) => { if (isBorderless) { return 'transparent'; } if (disabled) { return COLORS.ui.borderDisabled; } return COLORS.ui.border; }; const BackdropUI = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "em5sgkm6" } : 0)("&&&{box-sizing:border-box;border-color:", backdropBorderColor, ";border-radius:inherit;border-style:solid;border-width:1px;bottom:0;left:0;margin:0;padding:0;pointer-events:none;position:absolute;right:0;top:0;", rtl({ paddingLeft: 2 }), ";}" + ( true ? "" : 0)); const Root = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? { target: "em5sgkm5" } : 0)("box-sizing:border-box;position:relative;border-radius:", config_values.radiusSmall, ";padding-top:0;&:focus-within:not( :has( :is( ", Prefix, ", ", Suffix, " ):focus-within ) ){", BackdropUI, "{border-color:", COLORS.ui.borderFocus, ";box-shadow:", config_values.controlBoxShadowFocus, ";outline:2px solid transparent;outline-offset:-2px;}}" + ( true ? "" : 0)); const containerDisabledStyles = ({ disabled }) => { const backgroundColor = disabled ? COLORS.ui.backgroundDisabled : COLORS.ui.background; return /*#__PURE__*/emotion_react_browser_esm_css({ backgroundColor }, true ? "" : 0, true ? "" : 0); }; var input_control_styles_ref = true ? { name: "1d3w5wq", styles: "width:100%" } : 0; const containerWidthStyles = ({ __unstableInputWidth, labelPosition }) => { if (!__unstableInputWidth) { return input_control_styles_ref; } if (labelPosition === 'side') { return ''; } if (labelPosition === 'edge') { return /*#__PURE__*/emotion_react_browser_esm_css({ flex: `0 0 ${__unstableInputWidth}` }, true ? "" : 0, true ? "" : 0); } return /*#__PURE__*/emotion_react_browser_esm_css({ width: __unstableInputWidth }, true ? "" : 0, true ? "" : 0); }; const Container = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "em5sgkm4" } : 0)("align-items:center;box-sizing:border-box;border-radius:inherit;display:flex;flex:1;position:relative;", containerDisabledStyles, " ", containerWidthStyles, ";" + ( true ? "" : 0)); const disabledStyles = ({ disabled }) => { if (!disabled) { return ''; } return /*#__PURE__*/emotion_react_browser_esm_css({ color: COLORS.ui.textDisabled }, true ? "" : 0, true ? "" : 0); }; const fontSizeStyles = ({ inputSize: size }) => { const sizes = { default: '13px', small: '11px', compact: '13px', '__unstable-large': '13px' }; const fontSize = sizes[size] || sizes.default; const fontSizeMobile = '16px'; if (!fontSize) { return ''; } return /*#__PURE__*/emotion_react_browser_esm_css("font-size:", fontSizeMobile, ";@media ( min-width: 600px ){font-size:", fontSize, ";}" + ( true ? "" : 0), true ? "" : 0); }; const getSizeConfig = ({ inputSize: size, __next40pxDefaultSize }) => { // Paddings may be overridden by the custom paddings props. const sizes = { default: { height: 40, lineHeight: 1, minHeight: 40, paddingLeft: config_values.controlPaddingX, paddingRight: config_values.controlPaddingX }, small: { height: 24, lineHeight: 1, minHeight: 24, paddingLeft: config_values.controlPaddingXSmall, paddingRight: config_values.controlPaddingXSmall }, compact: { height: 32, lineHeight: 1, minHeight: 32, paddingLeft: config_values.controlPaddingXSmall, paddingRight: config_values.controlPaddingXSmall }, '__unstable-large': { height: 40, lineHeight: 1, minHeight: 40, paddingLeft: config_values.controlPaddingX, paddingRight: config_values.controlPaddingX } }; if (!__next40pxDefaultSize) { sizes.default = sizes.compact; } return sizes[size] || sizes.default; }; const sizeStyles = props => { return /*#__PURE__*/emotion_react_browser_esm_css(getSizeConfig(props), true ? "" : 0, true ? "" : 0); }; const customPaddings = ({ paddingInlineStart, paddingInlineEnd }) => { return /*#__PURE__*/emotion_react_browser_esm_css({ paddingInlineStart, paddingInlineEnd }, true ? "" : 0, true ? "" : 0); }; const dragStyles = ({ isDragging, dragCursor }) => { let defaultArrowStyles; let activeDragCursorStyles; if (isDragging) { defaultArrowStyles = /*#__PURE__*/emotion_react_browser_esm_css("cursor:", dragCursor, ";user-select:none;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}" + ( true ? "" : 0), true ? "" : 0); } if (isDragging && dragCursor) { activeDragCursorStyles = /*#__PURE__*/emotion_react_browser_esm_css("&:active{cursor:", dragCursor, ";}" + ( true ? "" : 0), true ? "" : 0); } return /*#__PURE__*/emotion_react_browser_esm_css(defaultArrowStyles, " ", activeDragCursorStyles, ";" + ( true ? "" : 0), true ? "" : 0); }; // TODO: Resolve need to use &&& to increase specificity // https://github.com/WordPress/gutenberg/issues/18483 const Input = /*#__PURE__*/emotion_styled_base_browser_esm("input", true ? { target: "em5sgkm3" } : 0)("&&&{background-color:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:", COLORS.theme.foreground, ";display:block;font-family:inherit;margin:0;outline:none;width:100%;", dragStyles, " ", disabledStyles, " ", fontSizeStyles, " ", sizeStyles, " ", customPaddings, " &::-webkit-input-placeholder{color:", COLORS.ui.darkGrayPlaceholder, ";}&::-moz-placeholder{color:", COLORS.ui.darkGrayPlaceholder, ";}&:-ms-input-placeholder{color:", COLORS.ui.darkGrayPlaceholder, ";}&[type='email'],&[type='url']{direction:ltr;}}" + ( true ? "" : 0)); const BaseLabel = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? { target: "em5sgkm2" } : 0)("&&&{", baseLabelTypography, ";box-sizing:border-box;display:block;padding-top:0;padding-bottom:0;max-width:100%;z-index:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}" + ( true ? "" : 0)); const Label = props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseLabel, { ...props, as: "label" }); const LabelWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_item_component, true ? { target: "em5sgkm1" } : 0)( true ? { name: "1b6uupn", styles: "max-width:calc( 100% - 10px )" } : 0); const prefixSuffixWrapperStyles = ({ variant = 'default', size, __next40pxDefaultSize, isPrefix }) => { const { paddingLeft: padding } = getSizeConfig({ inputSize: size, __next40pxDefaultSize }); const paddingProperty = isPrefix ? 'paddingInlineStart' : 'paddingInlineEnd'; if (variant === 'default') { return /*#__PURE__*/emotion_react_browser_esm_css({ [paddingProperty]: padding }, true ? "" : 0, true ? "" : 0); } // If variant is 'icon' or 'control' return /*#__PURE__*/emotion_react_browser_esm_css({ display: 'flex', [paddingProperty]: padding - 4 }, true ? "" : 0, true ? "" : 0); }; const PrefixSuffixWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "em5sgkm0" } : 0)(prefixSuffixWrapperStyles, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/input-control/backdrop.js /** * WordPress dependencies */ /** * Internal dependencies */ function Backdrop({ disabled = false, isBorderless = false }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackdropUI, { "aria-hidden": "true", className: "components-input-control__backdrop", disabled: disabled, isBorderless: isBorderless }); } const MemoizedBackdrop = (0,external_wp_element_namespaceObject.memo)(Backdrop); /* harmony default export */ const backdrop = (MemoizedBackdrop); ;// ./node_modules/@wordpress/components/build-module/input-control/label.js /** * Internal dependencies */ function label_Label({ children, hideLabelFromVision, htmlFor, ...props }) { if (!children) { return null; } if (hideLabelFromVision) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "label", htmlFor: htmlFor, children: children }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LabelWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Label, { htmlFor: htmlFor, ...props, children: children }) }); } ;// ./node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js function useDeprecated36pxDefaultSizeProp(props) { const { __next36pxDefaultSize, __next40pxDefaultSize, ...otherProps } = props; return { ...otherProps, __next40pxDefaultSize: __next40pxDefaultSize !== null && __next40pxDefaultSize !== void 0 ? __next40pxDefaultSize : __next36pxDefaultSize }; } ;// ./node_modules/@wordpress/components/build-module/input-control/input-base.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function useUniqueId(idProp) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(InputBase); const id = `input-base-control-${instanceId}`; return idProp || id; } // Adapter to map props for the new ui/flex component. function getUIFlexProps(labelPosition) { const props = {}; switch (labelPosition) { case 'top': props.direction = 'column'; props.expanded = false; props.gap = 0; break; case 'bottom': props.direction = 'column-reverse'; props.expanded = false; props.gap = 0; break; case 'edge': props.justify = 'space-between'; break; } return props; } function InputBase(props, ref) { const { __next40pxDefaultSize, __unstableInputWidth, children, className, disabled = false, hideLabelFromVision = false, labelPosition, id: idProp, isBorderless = false, label, prefix, size = 'default', suffix, ...restProps } = useDeprecated36pxDefaultSizeProp(useContextSystem(props, 'InputBase')); const id = useUniqueId(idProp); const hideLabel = hideLabelFromVision || !label; const prefixSuffixContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => { return { InputControlPrefixWrapper: { __next40pxDefaultSize, size }, InputControlSuffixWrapper: { __next40pxDefaultSize, size } }; }, [__next40pxDefaultSize, size]); return ( /*#__PURE__*/ // @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions. (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Root, { ...restProps, ...getUIFlexProps(labelPosition), className: className, gap: 2, ref: ref, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(label_Label, { className: "components-input-control__label", hideLabelFromVision: hideLabelFromVision, labelPosition: labelPosition, htmlFor: id, children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Container, { __unstableInputWidth: __unstableInputWidth, className: "components-input-control__container", disabled: disabled, hideLabel: hideLabel, labelPosition: labelPosition, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ContextSystemProvider, { value: prefixSuffixContextValue, children: [prefix && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Prefix, { className: "components-input-control__prefix", children: prefix }), children, suffix && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Suffix, { className: "components-input-control__suffix", children: suffix })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(backdrop, { disabled: disabled, isBorderless: isBorderless })] })] }) ); } /** * `InputBase` is an internal component used to style the standard borders for an input, * as well as handle the layout for prefix/suffix elements. */ /* harmony default export */ const input_base = (contextConnect(InputBase, 'InputBase')); ;// ./node_modules/@use-gesture/core/dist/maths-0ab39ae9.esm.js function maths_0ab39ae9_esm_clamp(v, min, max) { return Math.max(min, Math.min(v, max)); } const V = { toVector(v, fallback) { if (v === undefined) v = fallback; return Array.isArray(v) ? v : [v, v]; }, add(v1, v2) { return [v1[0] + v2[0], v1[1] + v2[1]]; }, sub(v1, v2) { return [v1[0] - v2[0], v1[1] - v2[1]]; }, addTo(v1, v2) { v1[0] += v2[0]; v1[1] += v2[1]; }, subTo(v1, v2) { v1[0] -= v2[0]; v1[1] -= v2[1]; } }; function rubberband(distance, dimension, constant) { if (dimension === 0 || Math.abs(dimension) === Infinity) return Math.pow(distance, constant * 5); return distance * dimension * constant / (dimension + constant * distance); } function rubberbandIfOutOfBounds(position, min, max, constant = 0.15) { if (constant === 0) return maths_0ab39ae9_esm_clamp(position, min, max); if (position < min) return -rubberband(min - position, max - min, constant) + min; if (position > max) return +rubberband(position - max, max - min, constant) + max; return position; } function computeRubberband(bounds, [Vx, Vy], [Rx, Ry]) { const [[X0, X1], [Y0, Y1]] = bounds; return [rubberbandIfOutOfBounds(Vx, X0, X1, Rx), rubberbandIfOutOfBounds(Vy, Y0, Y1, Ry)]; } ;// ./node_modules/@use-gesture/core/dist/actions-fe213e88.esm.js function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function actions_fe213e88_esm_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? actions_fe213e88_esm_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : actions_fe213e88_esm_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } const EVENT_TYPE_MAP = { pointer: { start: 'down', change: 'move', end: 'up' }, mouse: { start: 'down', change: 'move', end: 'up' }, touch: { start: 'start', change: 'move', end: 'end' }, gesture: { start: 'start', change: 'change', end: 'end' } }; function capitalize(string) { if (!string) return ''; return string[0].toUpperCase() + string.slice(1); } const actionsWithoutCaptureSupported = ['enter', 'leave']; function hasCapture(capture = false, actionKey) { return capture && !actionsWithoutCaptureSupported.includes(actionKey); } function toHandlerProp(device, action = '', capture = false) { const deviceProps = EVENT_TYPE_MAP[device]; const actionKey = deviceProps ? deviceProps[action] || action : action; return 'on' + capitalize(device) + capitalize(actionKey) + (hasCapture(capture, actionKey) ? 'Capture' : ''); } const pointerCaptureEvents = ['gotpointercapture', 'lostpointercapture']; function parseProp(prop) { let eventKey = prop.substring(2).toLowerCase(); const passive = !!~eventKey.indexOf('passive'); if (passive) eventKey = eventKey.replace('passive', ''); const captureKey = pointerCaptureEvents.includes(eventKey) ? 'capturecapture' : 'capture'; const capture = !!~eventKey.indexOf(captureKey); if (capture) eventKey = eventKey.replace('capture', ''); return { device: eventKey, capture, passive }; } function toDomEventType(device, action = '') { const deviceProps = EVENT_TYPE_MAP[device]; const actionKey = deviceProps ? deviceProps[action] || action : action; return device + actionKey; } function isTouch(event) { return 'touches' in event; } function getPointerType(event) { if (isTouch(event)) return 'touch'; if ('pointerType' in event) return event.pointerType; return 'mouse'; } function getCurrentTargetTouchList(event) { return Array.from(event.touches).filter(e => { var _event$currentTarget, _event$currentTarget$; return e.target === event.currentTarget || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || (_event$currentTarget$ = _event$currentTarget.contains) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.call(_event$currentTarget, e.target)); }); } function getTouchList(event) { return event.type === 'touchend' || event.type === 'touchcancel' ? event.changedTouches : event.targetTouches; } function getValueEvent(event) { return isTouch(event) ? getTouchList(event)[0] : event; } function distanceAngle(P1, P2) { try { const dx = P2.clientX - P1.clientX; const dy = P2.clientY - P1.clientY; const cx = (P2.clientX + P1.clientX) / 2; const cy = (P2.clientY + P1.clientY) / 2; const distance = Math.hypot(dx, dy); const angle = -(Math.atan2(dx, dy) * 180) / Math.PI; const origin = [cx, cy]; return { angle, distance, origin }; } catch (_unused) {} return null; } function touchIds(event) { return getCurrentTargetTouchList(event).map(touch => touch.identifier); } function touchDistanceAngle(event, ids) { const [P1, P2] = Array.from(event.touches).filter(touch => ids.includes(touch.identifier)); return distanceAngle(P1, P2); } function pointerId(event) { const valueEvent = getValueEvent(event); return isTouch(event) ? valueEvent.identifier : valueEvent.pointerId; } function pointerValues(event) { const valueEvent = getValueEvent(event); return [valueEvent.clientX, valueEvent.clientY]; } const LINE_HEIGHT = 40; const PAGE_HEIGHT = 800; function wheelValues(event) { let { deltaX, deltaY, deltaMode } = event; if (deltaMode === 1) { deltaX *= LINE_HEIGHT; deltaY *= LINE_HEIGHT; } else if (deltaMode === 2) { deltaX *= PAGE_HEIGHT; deltaY *= PAGE_HEIGHT; } return [deltaX, deltaY]; } function scrollValues(event) { var _ref, _ref2; const { scrollX, scrollY, scrollLeft, scrollTop } = event.currentTarget; return [(_ref = scrollX !== null && scrollX !== void 0 ? scrollX : scrollLeft) !== null && _ref !== void 0 ? _ref : 0, (_ref2 = scrollY !== null && scrollY !== void 0 ? scrollY : scrollTop) !== null && _ref2 !== void 0 ? _ref2 : 0]; } function getEventDetails(event) { const payload = {}; if ('buttons' in event) payload.buttons = event.buttons; if ('shiftKey' in event) { const { shiftKey, altKey, metaKey, ctrlKey } = event; Object.assign(payload, { shiftKey, altKey, metaKey, ctrlKey }); } return payload; } function call(v, ...args) { if (typeof v === 'function') { return v(...args); } else { return v; } } function actions_fe213e88_esm_noop() {} function actions_fe213e88_esm_chain(...fns) { if (fns.length === 0) return actions_fe213e88_esm_noop; if (fns.length === 1) return fns[0]; return function () { let result; for (const fn of fns) { result = fn.apply(this, arguments) || result; } return result; }; } function assignDefault(value, fallback) { return Object.assign({}, fallback, value || {}); } const BEFORE_LAST_KINEMATICS_DELAY = 32; class Engine { constructor(ctrl, args, key) { this.ctrl = ctrl; this.args = args; this.key = key; if (!this.state) { this.state = {}; this.computeValues([0, 0]); this.computeInitial(); if (this.init) this.init(); this.reset(); } } get state() { return this.ctrl.state[this.key]; } set state(state) { this.ctrl.state[this.key] = state; } get shared() { return this.ctrl.state.shared; } get eventStore() { return this.ctrl.gestureEventStores[this.key]; } get timeoutStore() { return this.ctrl.gestureTimeoutStores[this.key]; } get config() { return this.ctrl.config[this.key]; } get sharedConfig() { return this.ctrl.config.shared; } get handler() { return this.ctrl.handlers[this.key]; } reset() { const { state, shared, ingKey, args } = this; shared[ingKey] = state._active = state.active = state._blocked = state._force = false; state._step = [false, false]; state.intentional = false; state._movement = [0, 0]; state._distance = [0, 0]; state._direction = [0, 0]; state._delta = [0, 0]; state._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]]; state.args = args; state.axis = undefined; state.memo = undefined; state.elapsedTime = state.timeDelta = 0; state.direction = [0, 0]; state.distance = [0, 0]; state.overflow = [0, 0]; state._movementBound = [false, false]; state.velocity = [0, 0]; state.movement = [0, 0]; state.delta = [0, 0]; state.timeStamp = 0; } start(event) { const state = this.state; const config = this.config; if (!state._active) { this.reset(); this.computeInitial(); state._active = true; state.target = event.target; state.currentTarget = event.currentTarget; state.lastOffset = config.from ? call(config.from, state) : state.offset; state.offset = state.lastOffset; state.startTime = state.timeStamp = event.timeStamp; } } computeValues(values) { const state = this.state; state._values = values; state.values = this.config.transform(values); } computeInitial() { const state = this.state; state._initial = state._values; state.initial = state.values; } compute(event) { const { state, config, shared } = this; state.args = this.args; let dt = 0; if (event) { state.event = event; if (config.preventDefault && event.cancelable) state.event.preventDefault(); state.type = event.type; shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size; shared.locked = !!document.pointerLockElement; Object.assign(shared, getEventDetails(event)); shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0; dt = event.timeStamp - state.timeStamp; state.timeStamp = event.timeStamp; state.elapsedTime = state.timeStamp - state.startTime; } if (state._active) { const _absoluteDelta = state._delta.map(Math.abs); V.addTo(state._distance, _absoluteDelta); } if (this.axisIntent) this.axisIntent(event); const [_m0, _m1] = state._movement; const [t0, t1] = config.threshold; const { _step, values } = state; if (config.hasCustomTransform) { if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && values[0]; if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && values[1]; } else { if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && Math.sign(_m0) * t0; if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && Math.sign(_m1) * t1; } state.intentional = _step[0] !== false || _step[1] !== false; if (!state.intentional) return; const movement = [0, 0]; if (config.hasCustomTransform) { const [v0, v1] = values; movement[0] = _step[0] !== false ? v0 - _step[0] : 0; movement[1] = _step[1] !== false ? v1 - _step[1] : 0; } else { movement[0] = _step[0] !== false ? _m0 - _step[0] : 0; movement[1] = _step[1] !== false ? _m1 - _step[1] : 0; } if (this.restrictToAxis && !state._blocked) this.restrictToAxis(movement); const previousOffset = state.offset; const gestureIsActive = state._active && !state._blocked || state.active; if (gestureIsActive) { state.first = state._active && !state.active; state.last = !state._active && state.active; state.active = shared[this.ingKey] = state._active; if (event) { if (state.first) { if ('bounds' in config) state._bounds = call(config.bounds, state); if (this.setup) this.setup(); } state.movement = movement; this.computeOffset(); } } const [ox, oy] = state.offset; const [[x0, x1], [y0, y1]] = state._bounds; state.overflow = [ox < x0 ? -1 : ox > x1 ? 1 : 0, oy < y0 ? -1 : oy > y1 ? 1 : 0]; state._movementBound[0] = state.overflow[0] ? state._movementBound[0] === false ? state._movement[0] : state._movementBound[0] : false; state._movementBound[1] = state.overflow[1] ? state._movementBound[1] === false ? state._movement[1] : state._movementBound[1] : false; const rubberband = state._active ? config.rubberband || [0, 0] : [0, 0]; state.offset = computeRubberband(state._bounds, state.offset, rubberband); state.delta = V.sub(state.offset, previousOffset); this.computeMovement(); if (gestureIsActive && (!state.last || dt > BEFORE_LAST_KINEMATICS_DELAY)) { state.delta = V.sub(state.offset, previousOffset); const absoluteDelta = state.delta.map(Math.abs); V.addTo(state.distance, absoluteDelta); state.direction = state.delta.map(Math.sign); state._direction = state._delta.map(Math.sign); if (!state.first && dt > 0) { state.velocity = [absoluteDelta[0] / dt, absoluteDelta[1] / dt]; state.timeDelta = dt; } } } emit() { const state = this.state; const shared = this.shared; const config = this.config; if (!state._active) this.clean(); if ((state._blocked || !state.intentional) && !state._force && !config.triggerAllEvents) return; const memo = this.handler(_objectSpread2(_objectSpread2(_objectSpread2({}, shared), state), {}, { [this.aliasKey]: state.values })); if (memo !== undefined) state.memo = memo; } clean() { this.eventStore.clean(); this.timeoutStore.clean(); } } function selectAxis([dx, dy], threshold) { const absDx = Math.abs(dx); const absDy = Math.abs(dy); if (absDx > absDy && absDx > threshold) { return 'x'; } if (absDy > absDx && absDy > threshold) { return 'y'; } return undefined; } class CoordinatesEngine extends Engine { constructor(...args) { super(...args); _defineProperty(this, "aliasKey", 'xy'); } reset() { super.reset(); this.state.axis = undefined; } init() { this.state.offset = [0, 0]; this.state.lastOffset = [0, 0]; } computeOffset() { this.state.offset = V.add(this.state.lastOffset, this.state.movement); } computeMovement() { this.state.movement = V.sub(this.state.offset, this.state.lastOffset); } axisIntent(event) { const state = this.state; const config = this.config; if (!state.axis && event) { const threshold = typeof config.axisThreshold === 'object' ? config.axisThreshold[getPointerType(event)] : config.axisThreshold; state.axis = selectAxis(state._movement, threshold); } state._blocked = (config.lockDirection || !!config.axis) && !state.axis || !!config.axis && config.axis !== state.axis; } restrictToAxis(v) { if (this.config.axis || this.config.lockDirection) { switch (this.state.axis) { case 'x': v[1] = 0; break; case 'y': v[0] = 0; break; } } } } const actions_fe213e88_esm_identity = v => v; const DEFAULT_RUBBERBAND = 0.15; const commonConfigResolver = { enabled(value = true) { return value; }, eventOptions(value, _k, config) { return _objectSpread2(_objectSpread2({}, config.shared.eventOptions), value); }, preventDefault(value = false) { return value; }, triggerAllEvents(value = false) { return value; }, rubberband(value = 0) { switch (value) { case true: return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND]; case false: return [0, 0]; default: return V.toVector(value); } }, from(value) { if (typeof value === 'function') return value; if (value != null) return V.toVector(value); }, transform(value, _k, config) { const transform = value || config.shared.transform; this.hasCustomTransform = !!transform; if (false) {} return transform || actions_fe213e88_esm_identity; }, threshold(value) { return V.toVector(value, 0); } }; if (false) {} const DEFAULT_AXIS_THRESHOLD = 0; const coordinatesConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, { axis(_v, _k, { axis }) { this.lockDirection = axis === 'lock'; if (!this.lockDirection) return axis; }, axisThreshold(value = DEFAULT_AXIS_THRESHOLD) { return value; }, bounds(value = {}) { if (typeof value === 'function') { return state => coordinatesConfigResolver.bounds(value(state)); } if ('current' in value) { return () => value.current; } if (typeof HTMLElement === 'function' && value instanceof HTMLElement) { return value; } const { left = -Infinity, right = Infinity, top = -Infinity, bottom = Infinity } = value; return [[left, right], [top, bottom]]; } }); const KEYS_DELTA_MAP = { ArrowRight: (displacement, factor = 1) => [displacement * factor, 0], ArrowLeft: (displacement, factor = 1) => [-1 * displacement * factor, 0], ArrowUp: (displacement, factor = 1) => [0, -1 * displacement * factor], ArrowDown: (displacement, factor = 1) => [0, displacement * factor] }; class DragEngine extends CoordinatesEngine { constructor(...args) { super(...args); _defineProperty(this, "ingKey", 'dragging'); } reset() { super.reset(); const state = this.state; state._pointerId = undefined; state._pointerActive = false; state._keyboardActive = false; state._preventScroll = false; state._delayed = false; state.swipe = [0, 0]; state.tap = false; state.canceled = false; state.cancel = this.cancel.bind(this); } setup() { const state = this.state; if (state._bounds instanceof HTMLElement) { const boundRect = state._bounds.getBoundingClientRect(); const targetRect = state.currentTarget.getBoundingClientRect(); const _bounds = { left: boundRect.left - targetRect.left + state.offset[0], right: boundRect.right - targetRect.right + state.offset[0], top: boundRect.top - targetRect.top + state.offset[1], bottom: boundRect.bottom - targetRect.bottom + state.offset[1] }; state._bounds = coordinatesConfigResolver.bounds(_bounds); } } cancel() { const state = this.state; if (state.canceled) return; state.canceled = true; state._active = false; setTimeout(() => { this.compute(); this.emit(); }, 0); } setActive() { this.state._active = this.state._pointerActive || this.state._keyboardActive; } clean() { this.pointerClean(); this.state._pointerActive = false; this.state._keyboardActive = false; super.clean(); } pointerDown(event) { const config = this.config; const state = this.state; if (event.buttons != null && (Array.isArray(config.pointerButtons) ? !config.pointerButtons.includes(event.buttons) : config.pointerButtons !== -1 && config.pointerButtons !== event.buttons)) return; const ctrlIds = this.ctrl.setEventIds(event); if (config.pointerCapture) { event.target.setPointerCapture(event.pointerId); } if (ctrlIds && ctrlIds.size > 1 && state._pointerActive) return; this.start(event); this.setupPointer(event); state._pointerId = pointerId(event); state._pointerActive = true; this.computeValues(pointerValues(event)); this.computeInitial(); if (config.preventScrollAxis && getPointerType(event) !== 'mouse') { state._active = false; this.setupScrollPrevention(event); } else if (config.delay > 0) { this.setupDelayTrigger(event); if (config.triggerAllEvents) { this.compute(event); this.emit(); } } else { this.startPointerDrag(event); } } startPointerDrag(event) { const state = this.state; state._active = true; state._preventScroll = true; state._delayed = false; this.compute(event); this.emit(); } pointerMove(event) { const state = this.state; const config = this.config; if (!state._pointerActive) return; const id = pointerId(event); if (state._pointerId !== undefined && id !== state._pointerId) return; const _values = pointerValues(event); if (document.pointerLockElement === event.target) { state._delta = [event.movementX, event.movementY]; } else { state._delta = V.sub(_values, state._values); this.computeValues(_values); } V.addTo(state._movement, state._delta); this.compute(event); if (state._delayed && state.intentional) { this.timeoutStore.remove('dragDelay'); state.active = false; this.startPointerDrag(event); return; } if (config.preventScrollAxis && !state._preventScroll) { if (state.axis) { if (state.axis === config.preventScrollAxis || config.preventScrollAxis === 'xy') { state._active = false; this.clean(); return; } else { this.timeoutStore.remove('startPointerDrag'); this.startPointerDrag(event); return; } } else { return; } } this.emit(); } pointerUp(event) { this.ctrl.setEventIds(event); try { if (this.config.pointerCapture && event.target.hasPointerCapture(event.pointerId)) { ; event.target.releasePointerCapture(event.pointerId); } } catch (_unused) { if (false) {} } const state = this.state; const config = this.config; if (!state._active || !state._pointerActive) return; const id = pointerId(event); if (state._pointerId !== undefined && id !== state._pointerId) return; this.state._pointerActive = false; this.setActive(); this.compute(event); const [dx, dy] = state._distance; state.tap = dx <= config.tapsThreshold && dy <= config.tapsThreshold; if (state.tap && config.filterTaps) { state._force = true; } else { const [_dx, _dy] = state._delta; const [_mx, _my] = state._movement; const [svx, svy] = config.swipe.velocity; const [sx, sy] = config.swipe.distance; const sdt = config.swipe.duration; if (state.elapsedTime < sdt) { const _vx = Math.abs(_dx / state.timeDelta); const _vy = Math.abs(_dy / state.timeDelta); if (_vx > svx && Math.abs(_mx) > sx) state.swipe[0] = Math.sign(_dx); if (_vy > svy && Math.abs(_my) > sy) state.swipe[1] = Math.sign(_dy); } } this.emit(); } pointerClick(event) { if (!this.state.tap && event.detail > 0) { event.preventDefault(); event.stopPropagation(); } } setupPointer(event) { const config = this.config; const device = config.device; if (false) {} if (config.pointerLock) { event.currentTarget.requestPointerLock(); } if (!config.pointerCapture) { this.eventStore.add(this.sharedConfig.window, device, 'change', this.pointerMove.bind(this)); this.eventStore.add(this.sharedConfig.window, device, 'end', this.pointerUp.bind(this)); this.eventStore.add(this.sharedConfig.window, device, 'cancel', this.pointerUp.bind(this)); } } pointerClean() { if (this.config.pointerLock && document.pointerLockElement === this.state.currentTarget) { document.exitPointerLock(); } } preventScroll(event) { if (this.state._preventScroll && event.cancelable) { event.preventDefault(); } } setupScrollPrevention(event) { this.state._preventScroll = false; persistEvent(event); const remove = this.eventStore.add(this.sharedConfig.window, 'touch', 'change', this.preventScroll.bind(this), { passive: false }); this.eventStore.add(this.sharedConfig.window, 'touch', 'end', remove); this.eventStore.add(this.sharedConfig.window, 'touch', 'cancel', remove); this.timeoutStore.add('startPointerDrag', this.startPointerDrag.bind(this), this.config.preventScrollDelay, event); } setupDelayTrigger(event) { this.state._delayed = true; this.timeoutStore.add('dragDelay', () => { this.state._step = [0, 0]; this.startPointerDrag(event); }, this.config.delay); } keyDown(event) { const deltaFn = KEYS_DELTA_MAP[event.key]; if (deltaFn) { const state = this.state; const factor = event.shiftKey ? 10 : event.altKey ? 0.1 : 1; this.start(event); state._delta = deltaFn(this.config.keyboardDisplacement, factor); state._keyboardActive = true; V.addTo(state._movement, state._delta); this.compute(event); this.emit(); } } keyUp(event) { if (!(event.key in KEYS_DELTA_MAP)) return; this.state._keyboardActive = false; this.setActive(); this.compute(event); this.emit(); } bind(bindFunction) { const device = this.config.device; bindFunction(device, 'start', this.pointerDown.bind(this)); if (this.config.pointerCapture) { bindFunction(device, 'change', this.pointerMove.bind(this)); bindFunction(device, 'end', this.pointerUp.bind(this)); bindFunction(device, 'cancel', this.pointerUp.bind(this)); bindFunction('lostPointerCapture', '', this.pointerUp.bind(this)); } if (this.config.keys) { bindFunction('key', 'down', this.keyDown.bind(this)); bindFunction('key', 'up', this.keyUp.bind(this)); } if (this.config.filterTaps) { bindFunction('click', '', this.pointerClick.bind(this), { capture: true, passive: false }); } } } function persistEvent(event) { 'persist' in event && typeof event.persist === 'function' && event.persist(); } const actions_fe213e88_esm_isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement; function supportsTouchEvents() { return actions_fe213e88_esm_isBrowser && 'ontouchstart' in window; } function isTouchScreen() { return supportsTouchEvents() || actions_fe213e88_esm_isBrowser && window.navigator.maxTouchPoints > 1; } function supportsPointerEvents() { return actions_fe213e88_esm_isBrowser && 'onpointerdown' in window; } function supportsPointerLock() { return actions_fe213e88_esm_isBrowser && 'exitPointerLock' in window.document; } function supportsGestureEvents() { try { return 'constructor' in GestureEvent; } catch (e) { return false; } } const SUPPORT = { isBrowser: actions_fe213e88_esm_isBrowser, gesture: supportsGestureEvents(), touch: supportsTouchEvents(), touchscreen: isTouchScreen(), pointer: supportsPointerEvents(), pointerLock: supportsPointerLock() }; const DEFAULT_PREVENT_SCROLL_DELAY = 250; const DEFAULT_DRAG_DELAY = 180; const DEFAULT_SWIPE_VELOCITY = 0.5; const DEFAULT_SWIPE_DISTANCE = 50; const DEFAULT_SWIPE_DURATION = 250; const DEFAULT_KEYBOARD_DISPLACEMENT = 10; const DEFAULT_DRAG_AXIS_THRESHOLD = { mouse: 0, touch: 0, pen: 8 }; const dragConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, { device(_v, _k, { pointer: { touch = false, lock = false, mouse = false } = {} }) { this.pointerLock = lock && SUPPORT.pointerLock; if (SUPPORT.touch && touch) return 'touch'; if (this.pointerLock) return 'mouse'; if (SUPPORT.pointer && !mouse) return 'pointer'; if (SUPPORT.touch) return 'touch'; return 'mouse'; }, preventScrollAxis(value, _k, { preventScroll }) { this.preventScrollDelay = typeof preventScroll === 'number' ? preventScroll : preventScroll || preventScroll === undefined && value ? DEFAULT_PREVENT_SCROLL_DELAY : undefined; if (!SUPPORT.touchscreen || preventScroll === false) return undefined; return value ? value : preventScroll !== undefined ? 'y' : undefined; }, pointerCapture(_v, _k, { pointer: { capture = true, buttons = 1, keys = true } = {} }) { this.pointerButtons = buttons; this.keys = keys; return !this.pointerLock && this.device === 'pointer' && capture; }, threshold(value, _k, { filterTaps = false, tapsThreshold = 3, axis = undefined }) { const threshold = V.toVector(value, filterTaps ? tapsThreshold : axis ? 1 : 0); this.filterTaps = filterTaps; this.tapsThreshold = tapsThreshold; return threshold; }, swipe({ velocity = DEFAULT_SWIPE_VELOCITY, distance = DEFAULT_SWIPE_DISTANCE, duration = DEFAULT_SWIPE_DURATION } = {}) { return { velocity: this.transform(V.toVector(velocity)), distance: this.transform(V.toVector(distance)), duration }; }, delay(value = 0) { switch (value) { case true: return DEFAULT_DRAG_DELAY; case false: return 0; default: return value; } }, axisThreshold(value) { if (!value) return DEFAULT_DRAG_AXIS_THRESHOLD; return _objectSpread2(_objectSpread2({}, DEFAULT_DRAG_AXIS_THRESHOLD), value); }, keyboardDisplacement(value = DEFAULT_KEYBOARD_DISPLACEMENT) { return value; } }); if (false) {} function clampStateInternalMovementToBounds(state) { const [ox, oy] = state.overflow; const [dx, dy] = state._delta; const [dirx, diry] = state._direction; if (ox < 0 && dx > 0 && dirx < 0 || ox > 0 && dx < 0 && dirx > 0) { state._movement[0] = state._movementBound[0]; } if (oy < 0 && dy > 0 && diry < 0 || oy > 0 && dy < 0 && diry > 0) { state._movement[1] = state._movementBound[1]; } } const SCALE_ANGLE_RATIO_INTENT_DEG = 30; const PINCH_WHEEL_RATIO = 100; class PinchEngine extends Engine { constructor(...args) { super(...args); _defineProperty(this, "ingKey", 'pinching'); _defineProperty(this, "aliasKey", 'da'); } init() { this.state.offset = [1, 0]; this.state.lastOffset = [1, 0]; this.state._pointerEvents = new Map(); } reset() { super.reset(); const state = this.state; state._touchIds = []; state.canceled = false; state.cancel = this.cancel.bind(this); state.turns = 0; } computeOffset() { const { type, movement, lastOffset } = this.state; if (type === 'wheel') { this.state.offset = V.add(movement, lastOffset); } else { this.state.offset = [(1 + movement[0]) * lastOffset[0], movement[1] + lastOffset[1]]; } } computeMovement() { const { offset, lastOffset } = this.state; this.state.movement = [offset[0] / lastOffset[0], offset[1] - lastOffset[1]]; } axisIntent() { const state = this.state; const [_m0, _m1] = state._movement; if (!state.axis) { const axisMovementDifference = Math.abs(_m0) * SCALE_ANGLE_RATIO_INTENT_DEG - Math.abs(_m1); if (axisMovementDifference < 0) state.axis = 'angle';else if (axisMovementDifference > 0) state.axis = 'scale'; } } restrictToAxis(v) { if (this.config.lockDirection) { if (this.state.axis === 'scale') v[1] = 0;else if (this.state.axis === 'angle') v[0] = 0; } } cancel() { const state = this.state; if (state.canceled) return; setTimeout(() => { state.canceled = true; state._active = false; this.compute(); this.emit(); }, 0); } touchStart(event) { this.ctrl.setEventIds(event); const state = this.state; const ctrlTouchIds = this.ctrl.touchIds; if (state._active) { if (state._touchIds.every(id => ctrlTouchIds.has(id))) return; } if (ctrlTouchIds.size < 2) return; this.start(event); state._touchIds = Array.from(ctrlTouchIds).slice(0, 2); const payload = touchDistanceAngle(event, state._touchIds); if (!payload) return; this.pinchStart(event, payload); } pointerStart(event) { if (event.buttons != null && event.buttons % 2 !== 1) return; this.ctrl.setEventIds(event); event.target.setPointerCapture(event.pointerId); const state = this.state; const _pointerEvents = state._pointerEvents; const ctrlPointerIds = this.ctrl.pointerIds; if (state._active) { if (Array.from(_pointerEvents.keys()).every(id => ctrlPointerIds.has(id))) return; } if (_pointerEvents.size < 2) { _pointerEvents.set(event.pointerId, event); } if (state._pointerEvents.size < 2) return; this.start(event); const payload = distanceAngle(...Array.from(_pointerEvents.values())); if (!payload) return; this.pinchStart(event, payload); } pinchStart(event, payload) { const state = this.state; state.origin = payload.origin; this.computeValues([payload.distance, payload.angle]); this.computeInitial(); this.compute(event); this.emit(); } touchMove(event) { if (!this.state._active) return; const payload = touchDistanceAngle(event, this.state._touchIds); if (!payload) return; this.pinchMove(event, payload); } pointerMove(event) { const _pointerEvents = this.state._pointerEvents; if (_pointerEvents.has(event.pointerId)) { _pointerEvents.set(event.pointerId, event); } if (!this.state._active) return; const payload = distanceAngle(...Array.from(_pointerEvents.values())); if (!payload) return; this.pinchMove(event, payload); } pinchMove(event, payload) { const state = this.state; const prev_a = state._values[1]; const delta_a = payload.angle - prev_a; let delta_turns = 0; if (Math.abs(delta_a) > 270) delta_turns += Math.sign(delta_a); this.computeValues([payload.distance, payload.angle - 360 * delta_turns]); state.origin = payload.origin; state.turns = delta_turns; state._movement = [state._values[0] / state._initial[0] - 1, state._values[1] - state._initial[1]]; this.compute(event); this.emit(); } touchEnd(event) { this.ctrl.setEventIds(event); if (!this.state._active) return; if (this.state._touchIds.some(id => !this.ctrl.touchIds.has(id))) { this.state._active = false; this.compute(event); this.emit(); } } pointerEnd(event) { const state = this.state; this.ctrl.setEventIds(event); try { event.target.releasePointerCapture(event.pointerId); } catch (_unused) {} if (state._pointerEvents.has(event.pointerId)) { state._pointerEvents.delete(event.pointerId); } if (!state._active) return; if (state._pointerEvents.size < 2) { state._active = false; this.compute(event); this.emit(); } } gestureStart(event) { if (event.cancelable) event.preventDefault(); const state = this.state; if (state._active) return; this.start(event); this.computeValues([event.scale, event.rotation]); state.origin = [event.clientX, event.clientY]; this.compute(event); this.emit(); } gestureMove(event) { if (event.cancelable) event.preventDefault(); if (!this.state._active) return; const state = this.state; this.computeValues([event.scale, event.rotation]); state.origin = [event.clientX, event.clientY]; const _previousMovement = state._movement; state._movement = [event.scale - 1, event.rotation]; state._delta = V.sub(state._movement, _previousMovement); this.compute(event); this.emit(); } gestureEnd(event) { if (!this.state._active) return; this.state._active = false; this.compute(event); this.emit(); } wheel(event) { const modifierKey = this.config.modifierKey; if (modifierKey && (Array.isArray(modifierKey) ? !modifierKey.find(k => event[k]) : !event[modifierKey])) return; if (!this.state._active) this.wheelStart(event);else this.wheelChange(event); this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this)); } wheelStart(event) { this.start(event); this.wheelChange(event); } wheelChange(event) { const isR3f = ('uv' in event); if (!isR3f) { if (event.cancelable) { event.preventDefault(); } if (false) {} } const state = this.state; state._delta = [-wheelValues(event)[1] / PINCH_WHEEL_RATIO * state.offset[0], 0]; V.addTo(state._movement, state._delta); clampStateInternalMovementToBounds(state); this.state.origin = [event.clientX, event.clientY]; this.compute(event); this.emit(); } wheelEnd() { if (!this.state._active) return; this.state._active = false; this.compute(); this.emit(); } bind(bindFunction) { const device = this.config.device; if (!!device) { bindFunction(device, 'start', this[device + 'Start'].bind(this)); bindFunction(device, 'change', this[device + 'Move'].bind(this)); bindFunction(device, 'end', this[device + 'End'].bind(this)); bindFunction(device, 'cancel', this[device + 'End'].bind(this)); bindFunction('lostPointerCapture', '', this[device + 'End'].bind(this)); } if (this.config.pinchOnWheel) { bindFunction('wheel', '', this.wheel.bind(this), { passive: false }); } } } const pinchConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, { device(_v, _k, { shared, pointer: { touch = false } = {} }) { const sharedConfig = shared; if (sharedConfig.target && !SUPPORT.touch && SUPPORT.gesture) return 'gesture'; if (SUPPORT.touch && touch) return 'touch'; if (SUPPORT.touchscreen) { if (SUPPORT.pointer) return 'pointer'; if (SUPPORT.touch) return 'touch'; } }, bounds(_v, _k, { scaleBounds = {}, angleBounds = {} }) { const _scaleBounds = state => { const D = assignDefault(call(scaleBounds, state), { min: -Infinity, max: Infinity }); return [D.min, D.max]; }; const _angleBounds = state => { const A = assignDefault(call(angleBounds, state), { min: -Infinity, max: Infinity }); return [A.min, A.max]; }; if (typeof scaleBounds !== 'function' && typeof angleBounds !== 'function') return [_scaleBounds(), _angleBounds()]; return state => [_scaleBounds(state), _angleBounds(state)]; }, threshold(value, _k, config) { this.lockDirection = config.axis === 'lock'; const threshold = V.toVector(value, this.lockDirection ? [0.1, 3] : 0); return threshold; }, modifierKey(value) { if (value === undefined) return 'ctrlKey'; return value; }, pinchOnWheel(value = true) { return value; } }); class MoveEngine extends CoordinatesEngine { constructor(...args) { super(...args); _defineProperty(this, "ingKey", 'moving'); } move(event) { if (this.config.mouseOnly && event.pointerType !== 'mouse') return; if (!this.state._active) this.moveStart(event);else this.moveChange(event); this.timeoutStore.add('moveEnd', this.moveEnd.bind(this)); } moveStart(event) { this.start(event); this.computeValues(pointerValues(event)); this.compute(event); this.computeInitial(); this.emit(); } moveChange(event) { if (!this.state._active) return; const values = pointerValues(event); const state = this.state; state._delta = V.sub(values, state._values); V.addTo(state._movement, state._delta); this.computeValues(values); this.compute(event); this.emit(); } moveEnd(event) { if (!this.state._active) return; this.state._active = false; this.compute(event); this.emit(); } bind(bindFunction) { bindFunction('pointer', 'change', this.move.bind(this)); bindFunction('pointer', 'leave', this.moveEnd.bind(this)); } } const moveConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, { mouseOnly: (value = true) => value }); class ScrollEngine extends CoordinatesEngine { constructor(...args) { super(...args); _defineProperty(this, "ingKey", 'scrolling'); } scroll(event) { if (!this.state._active) this.start(event); this.scrollChange(event); this.timeoutStore.add('scrollEnd', this.scrollEnd.bind(this)); } scrollChange(event) { if (event.cancelable) event.preventDefault(); const state = this.state; const values = scrollValues(event); state._delta = V.sub(values, state._values); V.addTo(state._movement, state._delta); this.computeValues(values); this.compute(event); this.emit(); } scrollEnd() { if (!this.state._active) return; this.state._active = false; this.compute(); this.emit(); } bind(bindFunction) { bindFunction('scroll', '', this.scroll.bind(this)); } } const scrollConfigResolver = coordinatesConfigResolver; class WheelEngine extends CoordinatesEngine { constructor(...args) { super(...args); _defineProperty(this, "ingKey", 'wheeling'); } wheel(event) { if (!this.state._active) this.start(event); this.wheelChange(event); this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this)); } wheelChange(event) { const state = this.state; state._delta = wheelValues(event); V.addTo(state._movement, state._delta); clampStateInternalMovementToBounds(state); this.compute(event); this.emit(); } wheelEnd() { if (!this.state._active) return; this.state._active = false; this.compute(); this.emit(); } bind(bindFunction) { bindFunction('wheel', '', this.wheel.bind(this)); } } const wheelConfigResolver = coordinatesConfigResolver; class HoverEngine extends CoordinatesEngine { constructor(...args) { super(...args); _defineProperty(this, "ingKey", 'hovering'); } enter(event) { if (this.config.mouseOnly && event.pointerType !== 'mouse') return; this.start(event); this.computeValues(pointerValues(event)); this.compute(event); this.emit(); } leave(event) { if (this.config.mouseOnly && event.pointerType !== 'mouse') return; const state = this.state; if (!state._active) return; state._active = false; const values = pointerValues(event); state._movement = state._delta = V.sub(values, state._values); this.computeValues(values); this.compute(event); state.delta = state.movement; this.emit(); } bind(bindFunction) { bindFunction('pointer', 'enter', this.enter.bind(this)); bindFunction('pointer', 'leave', this.leave.bind(this)); } } const hoverConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, { mouseOnly: (value = true) => value }); const actions_fe213e88_esm_EngineMap = new Map(); const ConfigResolverMap = new Map(); function actions_fe213e88_esm_registerAction(action) { actions_fe213e88_esm_EngineMap.set(action.key, action.engine); ConfigResolverMap.set(action.key, action.resolver); } const actions_fe213e88_esm_dragAction = { key: 'drag', engine: DragEngine, resolver: dragConfigResolver }; const actions_fe213e88_esm_hoverAction = { key: 'hover', engine: HoverEngine, resolver: hoverConfigResolver }; const actions_fe213e88_esm_moveAction = { key: 'move', engine: MoveEngine, resolver: moveConfigResolver }; const actions_fe213e88_esm_pinchAction = { key: 'pinch', engine: PinchEngine, resolver: pinchConfigResolver }; const actions_fe213e88_esm_scrollAction = { key: 'scroll', engine: ScrollEngine, resolver: scrollConfigResolver }; const actions_fe213e88_esm_wheelAction = { key: 'wheel', engine: WheelEngine, resolver: wheelConfigResolver }; ;// ./node_modules/@use-gesture/core/dist/use-gesture-core.esm.js function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } const sharedConfigResolver = { target(value) { if (value) { return () => 'current' in value ? value.current : value; } return undefined; }, enabled(value = true) { return value; }, window(value = SUPPORT.isBrowser ? window : undefined) { return value; }, eventOptions({ passive = true, capture = false } = {}) { return { passive, capture }; }, transform(value) { return value; } }; const _excluded = ["target", "eventOptions", "window", "enabled", "transform"]; function resolveWith(config = {}, resolvers) { const result = {}; for (const [key, resolver] of Object.entries(resolvers)) { switch (typeof resolver) { case 'function': if (false) {} else { result[key] = resolver.call(result, config[key], key, config); } break; case 'object': result[key] = resolveWith(config[key], resolver); break; case 'boolean': if (resolver) result[key] = config[key]; break; } } return result; } function use_gesture_core_esm_parse(newConfig, gestureKey, _config = {}) { const _ref = newConfig, { target, eventOptions, window, enabled, transform } = _ref, rest = _objectWithoutProperties(_ref, _excluded); _config.shared = resolveWith({ target, eventOptions, window, enabled, transform }, sharedConfigResolver); if (gestureKey) { const resolver = ConfigResolverMap.get(gestureKey); _config[gestureKey] = resolveWith(_objectSpread2({ shared: _config.shared }, rest), resolver); } else { for (const key in rest) { const resolver = ConfigResolverMap.get(key); if (resolver) { _config[key] = resolveWith(_objectSpread2({ shared: _config.shared }, rest[key]), resolver); } else if (false) {} } } return _config; } class EventStore { constructor(ctrl, gestureKey) { _defineProperty(this, "_listeners", new Set()); this._ctrl = ctrl; this._gestureKey = gestureKey; } add(element, device, action, handler, options) { const listeners = this._listeners; const type = toDomEventType(device, action); const _options = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}; const eventOptions = _objectSpread2(_objectSpread2({}, _options), options); element.addEventListener(type, handler, eventOptions); const remove = () => { element.removeEventListener(type, handler, eventOptions); listeners.delete(remove); }; listeners.add(remove); return remove; } clean() { this._listeners.forEach(remove => remove()); this._listeners.clear(); } } class TimeoutStore { constructor() { _defineProperty(this, "_timeouts", new Map()); } add(key, callback, ms = 140, ...args) { this.remove(key); this._timeouts.set(key, window.setTimeout(callback, ms, ...args)); } remove(key) { const timeout = this._timeouts.get(key); if (timeout) window.clearTimeout(timeout); } clean() { this._timeouts.forEach(timeout => void window.clearTimeout(timeout)); this._timeouts.clear(); } } class Controller { constructor(handlers) { _defineProperty(this, "gestures", new Set()); _defineProperty(this, "_targetEventStore", new EventStore(this)); _defineProperty(this, "gestureEventStores", {}); _defineProperty(this, "gestureTimeoutStores", {}); _defineProperty(this, "handlers", {}); _defineProperty(this, "config", {}); _defineProperty(this, "pointerIds", new Set()); _defineProperty(this, "touchIds", new Set()); _defineProperty(this, "state", { shared: { shiftKey: false, metaKey: false, ctrlKey: false, altKey: false } }); resolveGestures(this, handlers); } setEventIds(event) { if (isTouch(event)) { this.touchIds = new Set(touchIds(event)); return this.touchIds; } else if ('pointerId' in event) { if (event.type === 'pointerup' || event.type === 'pointercancel') this.pointerIds.delete(event.pointerId);else if (event.type === 'pointerdown') this.pointerIds.add(event.pointerId); return this.pointerIds; } } applyHandlers(handlers, nativeHandlers) { this.handlers = handlers; this.nativeHandlers = nativeHandlers; } applyConfig(config, gestureKey) { this.config = use_gesture_core_esm_parse(config, gestureKey, this.config); } clean() { this._targetEventStore.clean(); for (const key of this.gestures) { this.gestureEventStores[key].clean(); this.gestureTimeoutStores[key].clean(); } } effect() { if (this.config.shared.target) this.bind(); return () => this._targetEventStore.clean(); } bind(...args) { const sharedConfig = this.config.shared; const props = {}; let target; if (sharedConfig.target) { target = sharedConfig.target(); if (!target) return; } if (sharedConfig.enabled) { for (const gestureKey of this.gestures) { const gestureConfig = this.config[gestureKey]; const bindFunction = bindToProps(props, gestureConfig.eventOptions, !!target); if (gestureConfig.enabled) { const Engine = actions_fe213e88_esm_EngineMap.get(gestureKey); new Engine(this, args, gestureKey).bind(bindFunction); } } const nativeBindFunction = bindToProps(props, sharedConfig.eventOptions, !!target); for (const eventKey in this.nativeHandlers) { nativeBindFunction(eventKey, '', event => this.nativeHandlers[eventKey](_objectSpread2(_objectSpread2({}, this.state.shared), {}, { event, args })), undefined, true); } } for (const handlerProp in props) { props[handlerProp] = actions_fe213e88_esm_chain(...props[handlerProp]); } if (!target) return props; for (const handlerProp in props) { const { device, capture, passive } = parseProp(handlerProp); this._targetEventStore.add(target, device, '', props[handlerProp], { capture, passive }); } } } function setupGesture(ctrl, gestureKey) { ctrl.gestures.add(gestureKey); ctrl.gestureEventStores[gestureKey] = new EventStore(ctrl, gestureKey); ctrl.gestureTimeoutStores[gestureKey] = new TimeoutStore(); } function resolveGestures(ctrl, internalHandlers) { if (internalHandlers.drag) setupGesture(ctrl, 'drag'); if (internalHandlers.wheel) setupGesture(ctrl, 'wheel'); if (internalHandlers.scroll) setupGesture(ctrl, 'scroll'); if (internalHandlers.move) setupGesture(ctrl, 'move'); if (internalHandlers.pinch) setupGesture(ctrl, 'pinch'); if (internalHandlers.hover) setupGesture(ctrl, 'hover'); } const bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative = false) => { var _options$capture, _options$passive; const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture; const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive; let handlerProp = isNative ? device : toHandlerProp(device, action, capture); if (withPassiveOption && passive) handlerProp += 'Passive'; props[handlerProp] = props[handlerProp] || []; props[handlerProp].push(handler); }; const RE_NOT_NATIVE = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/; function sortHandlers(_handlers) { const native = {}; const handlers = {}; const actions = new Set(); for (let key in _handlers) { if (RE_NOT_NATIVE.test(key)) { actions.add(RegExp.lastMatch); handlers[key] = _handlers[key]; } else { native[key] = _handlers[key]; } } return [handlers, native, actions]; } function registerGesture(actions, handlers, handlerKey, key, internalHandlers, config) { if (!actions.has(handlerKey)) return; if (!EngineMap.has(key)) { if (false) {} return; } const startKey = handlerKey + 'Start'; const endKey = handlerKey + 'End'; const fn = state => { let memo = undefined; if (state.first && startKey in handlers) handlers[startKey](state); if (handlerKey in handlers) memo = handlers[handlerKey](state); if (state.last && endKey in handlers) handlers[endKey](state); return memo; }; internalHandlers[key] = fn; config[key] = config[key] || {}; } function use_gesture_core_esm_parseMergedHandlers(mergedHandlers, mergedConfig) { const [handlers, nativeHandlers, actions] = sortHandlers(mergedHandlers); const internalHandlers = {}; registerGesture(actions, handlers, 'onDrag', 'drag', internalHandlers, mergedConfig); registerGesture(actions, handlers, 'onWheel', 'wheel', internalHandlers, mergedConfig); registerGesture(actions, handlers, 'onScroll', 'scroll', internalHandlers, mergedConfig); registerGesture(actions, handlers, 'onPinch', 'pinch', internalHandlers, mergedConfig); registerGesture(actions, handlers, 'onMove', 'move', internalHandlers, mergedConfig); registerGesture(actions, handlers, 'onHover', 'hover', internalHandlers, mergedConfig); return { handlers: internalHandlers, config: mergedConfig, nativeHandlers }; } ;// ./node_modules/@use-gesture/react/dist/use-gesture-react.esm.js function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) { const ctrl = external_React_default().useMemo(() => new Controller(handlers), []); ctrl.applyHandlers(handlers, nativeHandlers); ctrl.applyConfig(config, gestureKey); external_React_default().useEffect(ctrl.effect.bind(ctrl)); external_React_default().useEffect(() => { return ctrl.clean.bind(ctrl); }, []); if (config.target === undefined) { return ctrl.bind.bind(ctrl); } return undefined; } function useDrag(handler, config) { actions_fe213e88_esm_registerAction(actions_fe213e88_esm_dragAction); return useRecognizers({ drag: handler }, config || {}, 'drag'); } function usePinch(handler, config) { registerAction(pinchAction); return useRecognizers({ pinch: handler }, config || {}, 'pinch'); } function useWheel(handler, config) { registerAction(wheelAction); return useRecognizers({ wheel: handler }, config || {}, 'wheel'); } function useScroll(handler, config) { registerAction(scrollAction); return useRecognizers({ scroll: handler }, config || {}, 'scroll'); } function useMove(handler, config) { registerAction(moveAction); return useRecognizers({ move: handler }, config || {}, 'move'); } function useHover(handler, config) { registerAction(hoverAction); return useRecognizers({ hover: handler }, config || {}, 'hover'); } function createUseGesture(actions) { actions.forEach(registerAction); return function useGesture(_handlers, _config) { const { handlers, nativeHandlers, config } = parseMergedHandlers(_handlers, _config || {}); return useRecognizers(handlers, config, undefined, nativeHandlers); }; } function useGesture(handlers, config) { const hook = createUseGesture([dragAction, pinchAction, scrollAction, wheelAction, moveAction, hoverAction]); return hook(handlers, config || {}); } ;// ./node_modules/@wordpress/components/build-module/input-control/utils.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Gets a CSS cursor value based on a drag direction. * * @param dragDirection The drag direction. * @return The CSS cursor value. */ function getDragCursor(dragDirection) { let dragCursor = 'ns-resize'; switch (dragDirection) { case 'n': case 's': dragCursor = 'ns-resize'; break; case 'e': case 'w': dragCursor = 'ew-resize'; break; } return dragCursor; } /** * Custom hook that renders a drag cursor when dragging. * * @param {boolean} isDragging The dragging state. * @param {string} dragDirection The drag direction. * * @return {string} The CSS cursor value. */ function useDragCursor(isDragging, dragDirection) { const dragCursor = getDragCursor(dragDirection); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isDragging) { document.documentElement.style.cursor = dragCursor; } else { // @ts-expect-error document.documentElement.style.cursor = null; } }, [isDragging, dragCursor]); return dragCursor; } function useDraft(props) { const previousValueRef = (0,external_wp_element_namespaceObject.useRef)(props.value); const [draft, setDraft] = (0,external_wp_element_namespaceObject.useState)({}); const value = draft.value !== undefined ? draft.value : props.value; // Determines when to discard the draft value to restore controlled status. // To do so, it tracks the previous value and marks the draft value as stale // after each render. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const { current: previousValue } = previousValueRef; previousValueRef.current = props.value; if (draft.value !== undefined && !draft.isStale) { setDraft({ ...draft, isStale: true }); } else if (draft.isStale && props.value !== previousValue) { setDraft({}); } }, [props.value, draft]); const onChange = (nextValue, extra) => { // Mutates the draft value to avoid an extra effect run. setDraft(current => Object.assign(current, { value: nextValue, isStale: false })); props.onChange(nextValue, extra); }; const onBlur = event => { setDraft({}); props.onBlur?.(event); }; return { value, onBlur, onChange }; } ;// ./node_modules/@wordpress/components/build-module/input-control/reducer/state.js /** * External dependencies */ /** * Internal dependencies */ const initialStateReducer = state => state; const initialInputControlState = { error: null, initialValue: '', isDirty: false, isDragEnabled: false, isDragging: false, isPressEnterToChange: false, value: '' }; ;// ./node_modules/@wordpress/components/build-module/input-control/reducer/actions.js /** * External dependencies */ /** * Internal dependencies */ const CHANGE = 'CHANGE'; const COMMIT = 'COMMIT'; const CONTROL = 'CONTROL'; const DRAG_END = 'DRAG_END'; const DRAG_START = 'DRAG_START'; const DRAG = 'DRAG'; const INVALIDATE = 'INVALIDATE'; const PRESS_DOWN = 'PRESS_DOWN'; const PRESS_ENTER = 'PRESS_ENTER'; const PRESS_UP = 'PRESS_UP'; const RESET = 'RESET'; ;// ./node_modules/@wordpress/components/build-module/input-control/reducer/reducer.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Prepares initialState for the reducer. * * @param initialState The initial state. * @return Prepared initialState for the reducer */ function mergeInitialState(initialState = initialInputControlState) { const { value } = initialState; return { ...initialInputControlState, ...initialState, initialValue: value }; } /** * Creates the base reducer which may be coupled to a specializing reducer. * As its final step, for all actions other than CONTROL, the base reducer * passes the state and action on through the specializing reducer. The * exception for CONTROL actions is because they represent controlled updates * from props and no case has yet presented for their specialization. * * @param composedStateReducers A reducer to specialize state changes. * @return The reducer. */ function inputControlStateReducer(composedStateReducers) { return (state, action) => { const nextState = { ...state }; switch (action.type) { /* * Controlled updates */ case CONTROL: nextState.value = action.payload.value; nextState.isDirty = false; nextState._event = undefined; // Returns immediately to avoid invoking additional reducers. return nextState; /** * Keyboard events */ case PRESS_UP: nextState.isDirty = false; break; case PRESS_DOWN: nextState.isDirty = false; break; /** * Drag events */ case DRAG_START: nextState.isDragging = true; break; case DRAG_END: nextState.isDragging = false; break; /** * Input events */ case CHANGE: nextState.error = null; nextState.value = action.payload.value; if (state.isPressEnterToChange) { nextState.isDirty = true; } break; case COMMIT: nextState.value = action.payload.value; nextState.isDirty = false; break; case RESET: nextState.error = null; nextState.isDirty = false; nextState.value = action.payload.value || state.initialValue; break; /** * Validation */ case INVALIDATE: nextState.error = action.payload.error; break; } nextState._event = action.payload.event; /** * Send the nextState + action to the composedReducers via * this "bridge" mechanism. This allows external stateReducers * to hook into actions, and modify state if needed. */ return composedStateReducers(nextState, action); }; } /** * A custom hook that connects and external stateReducer with an internal * reducer. This hook manages the internal state of InputControl. * However, by connecting an external stateReducer function, other * components can react to actions as well as modify state before it is * applied. * * This technique uses the "stateReducer" design pattern: * https://kentcdodds.com/blog/the-state-reducer-pattern/ * * @param stateReducer An external state reducer. * @param initialState The initial state for the reducer. * @param onChangeHandler A handler for the onChange event. * @return State, dispatch, and a collection of actions. */ function useInputControlStateReducer(stateReducer = initialStateReducer, initialState = initialInputControlState, onChangeHandler) { const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(inputControlStateReducer(stateReducer), mergeInitialState(initialState)); const createChangeEvent = type => (nextValue, event) => { dispatch({ type, payload: { value: nextValue, event } }); }; const createKeyEvent = type => event => { dispatch({ type, payload: { event } }); }; const createDragEvent = type => payload => { dispatch({ type, payload }); }; /** * Actions for the reducer */ const change = createChangeEvent(CHANGE); const invalidate = (error, event) => dispatch({ type: INVALIDATE, payload: { error, event } }); const reset = createChangeEvent(RESET); const commit = createChangeEvent(COMMIT); const dragStart = createDragEvent(DRAG_START); const drag = createDragEvent(DRAG); const dragEnd = createDragEvent(DRAG_END); const pressUp = createKeyEvent(PRESS_UP); const pressDown = createKeyEvent(PRESS_DOWN); const pressEnter = createKeyEvent(PRESS_ENTER); const currentStateRef = (0,external_wp_element_namespaceObject.useRef)(state); const refPropsRef = (0,external_wp_element_namespaceObject.useRef)({ value: initialState.value, onChangeHandler }); // Freshens refs to props and state so that subsequent effects have access // to their latest values without their changes causing effect runs. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { currentStateRef.current = state; refPropsRef.current = { value: initialState.value, onChangeHandler }; }); // Propagates the latest state through onChange. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (currentStateRef.current._event !== undefined && state.value !== refPropsRef.current.value && !state.isDirty) { var _state$value; refPropsRef.current.onChangeHandler((_state$value = state.value) !== null && _state$value !== void 0 ? _state$value : '', { event: currentStateRef.current._event }); } }, [state.value, state.isDirty]); // Updates the state from props. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (initialState.value !== currentStateRef.current.value && !currentStateRef.current.isDirty) { var _initialState$value; dispatch({ type: CONTROL, payload: { value: (_initialState$value = initialState.value) !== null && _initialState$value !== void 0 ? _initialState$value : '' } }); } }, [initialState.value]); return { change, commit, dispatch, drag, dragEnd, dragStart, invalidate, pressDown, pressEnter, pressUp, reset, state }; } ;// ./node_modules/@wordpress/components/build-module/utils/with-ignore-ime-events.js /** * A higher-order function that wraps a keydown event handler to ensure it is not an IME event. * * In CJK languages, an IME (Input Method Editor) is used to input complex characters. * During an IME composition, keydown events (e.g. Enter or Escape) can be fired * which are intended to control the IME and not the application. * These events should be ignored by any application logic. * * @param keydownHandler The keydown event handler to execute after ensuring it was not an IME event. * * @return A wrapped version of the given event handler that ignores IME events. */ function withIgnoreIMEEvents(keydownHandler) { return event => { const { isComposing } = 'nativeEvent' in event ? event.nativeEvent : event; if (isComposing || // Workaround for Mac Safari where the final Enter/Backspace of an IME composition // is `isComposing=false`, even though it's technically still part of the composition. // These can only be detected by keyCode. event.keyCode === 229) { return; } keydownHandler(event); }; } ;// ./node_modules/@wordpress/components/build-module/input-control/input-field.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const input_field_noop = () => {}; function InputField({ disabled = false, dragDirection = 'n', dragThreshold = 10, id, isDragEnabled = false, isPressEnterToChange = false, onBlur = input_field_noop, onChange = input_field_noop, onDrag = input_field_noop, onDragEnd = input_field_noop, onDragStart = input_field_noop, onKeyDown = input_field_noop, onValidate = input_field_noop, size = 'default', stateReducer = state => state, value: valueProp, type, ...props }, ref) { const { // State. state, // Actions. change, commit, drag, dragEnd, dragStart, invalidate, pressDown, pressEnter, pressUp, reset } = useInputControlStateReducer(stateReducer, { isDragEnabled, value: valueProp, isPressEnterToChange }, onChange); const { value, isDragging, isDirty } = state; const wasDirtyOnBlur = (0,external_wp_element_namespaceObject.useRef)(false); const dragCursor = useDragCursor(isDragging, dragDirection); const handleOnBlur = event => { onBlur(event); /** * If isPressEnterToChange is set, this commits the value to * the onChange callback. */ if (isDirty || !event.target.validity.valid) { wasDirtyOnBlur.current = true; handleOnCommit(event); } }; const handleOnChange = event => { const nextValue = event.target.value; change(nextValue, event); }; const handleOnCommit = event => { const nextValue = event.currentTarget.value; try { onValidate(nextValue); commit(nextValue, event); } catch (err) { invalidate(err, event); } }; const handleOnKeyDown = event => { const { key } = event; onKeyDown(event); switch (key) { case 'ArrowUp': pressUp(event); break; case 'ArrowDown': pressDown(event); break; case 'Enter': pressEnter(event); if (isPressEnterToChange) { event.preventDefault(); handleOnCommit(event); } break; case 'Escape': if (isPressEnterToChange && isDirty) { event.preventDefault(); reset(valueProp, event); } break; } }; const dragGestureProps = useDrag(dragProps => { const { distance, dragging, event, target } = dragProps; // The `target` prop always references the `input` element while, by // default, the `dragProps.event.target` property would reference the real // event target (i.e. any DOM element that the pointer is hovering while // dragging). Ensuring that the `target` is always the `input` element // allows consumers of `InputControl` (or any higher-level control) to // check the input's validity by accessing `event.target.validity.valid`. dragProps.event = { ...dragProps.event, target }; if (!distance) { return; } event.stopPropagation(); /** * Quick return if no longer dragging. * This prevents unnecessary value calculations. */ if (!dragging) { onDragEnd(dragProps); dragEnd(dragProps); return; } onDrag(dragProps); drag(dragProps); if (!isDragging) { onDragStart(dragProps); dragStart(dragProps); } }, { axis: dragDirection === 'e' || dragDirection === 'w' ? 'x' : 'y', threshold: dragThreshold, enabled: isDragEnabled, pointer: { capture: false } }); const dragProps = isDragEnabled ? dragGestureProps() : {}; /* * Works around the odd UA (e.g. Firefox) that does not focus inputs of * type=number when their spinner arrows are pressed. */ let handleOnMouseDown; if (type === 'number') { handleOnMouseDown = event => { props.onMouseDown?.(event); if (event.currentTarget !== event.currentTarget.ownerDocument.activeElement) { event.currentTarget.focus(); } }; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Input, { ...props, ...dragProps, className: "components-input-control__input", disabled: disabled, dragCursor: dragCursor, isDragging: isDragging, id: id, onBlur: handleOnBlur, onChange: handleOnChange, onKeyDown: withIgnoreIMEEvents(handleOnKeyDown), onMouseDown: handleOnMouseDown, ref: ref, inputSize: size // Fallback to `''` to avoid "uncontrolled to controlled" warning. // See https://github.com/WordPress/gutenberg/pull/47250 for details. , value: value !== null && value !== void 0 ? value : '', type: type }); } const ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(InputField); /* harmony default export */ const input_field = (ForwardedComponent); ;// ./node_modules/@wordpress/components/build-module/utils/font-values.js /* harmony default export */ const font_values = ({ 'default.fontFamily': "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif", 'default.fontSize': '13px', 'helpText.fontSize': '12px', mobileTextMinFontSize: '16px' }); ;// ./node_modules/@wordpress/components/build-module/utils/font.js /** * Internal dependencies */ /** * * @param {keyof FONT} value Path of value from `FONT` * @return {string} Font rule value */ function font(value) { var _FONT$value; return (_FONT$value = font_values[value]) !== null && _FONT$value !== void 0 ? _FONT$value : ''; } ;// ./node_modules/@wordpress/components/build-module/utils/box-sizing.js function box_sizing_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ const boxSizingReset = true ? { name: "kv6lnz", styles: "box-sizing:border-box;*,*::before,*::after{box-sizing:inherit;}" } : 0; ;// ./node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js function base_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const Wrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "ej5x27r4" } : 0)("font-family:", font('default.fontFamily'), ";font-size:", font('default.fontSize'), ";", boxSizingReset, ";" + ( true ? "" : 0)); const deprecatedMarginField = ({ __nextHasNoMarginBottom = false }) => { return !__nextHasNoMarginBottom && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(2), ";" + ( true ? "" : 0), true ? "" : 0); }; const StyledField = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "ej5x27r3" } : 0)(deprecatedMarginField, " .components-panel__row &{margin-bottom:inherit;}" + ( true ? "" : 0)); const labelStyles = /*#__PURE__*/emotion_react_browser_esm_css(baseLabelTypography, ";display:block;margin-bottom:", space(2), ";padding:0;" + ( true ? "" : 0), true ? "" : 0); const StyledLabel = /*#__PURE__*/emotion_styled_base_browser_esm("label", true ? { target: "ej5x27r2" } : 0)(labelStyles, ";" + ( true ? "" : 0)); var base_control_styles_ref = true ? { name: "11yad0w", styles: "margin-bottom:revert" } : 0; const deprecatedMarginHelp = ({ __nextHasNoMarginBottom = false }) => { return !__nextHasNoMarginBottom && base_control_styles_ref; }; const StyledHelp = /*#__PURE__*/emotion_styled_base_browser_esm("p", true ? { target: "ej5x27r1" } : 0)("margin-top:", space(2), ";margin-bottom:0;font-size:", font('helpText.fontSize'), ";font-style:normal;color:", COLORS.gray[700], ";", deprecatedMarginHelp, ";" + ( true ? "" : 0)); const StyledVisualLabel = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "ej5x27r0" } : 0)(labelStyles, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/base-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const UnconnectedBaseControl = props => { const { __nextHasNoMarginBottom = false, __associatedWPComponentName = 'BaseControl', id, label, hideLabelFromVision = false, help, className, children } = useContextSystem(props, 'BaseControl'); if (!__nextHasNoMarginBottom) { external_wp_deprecated_default()(`Bottom margin styles for wp.components.${__associatedWPComponentName}`, { since: '6.7', version: '7.0', hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.' }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { className: className, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(StyledField, { className: "components-base-control__field" // TODO: Official deprecation for this should start after all internal usages have been migrated , __nextHasNoMarginBottom: __nextHasNoMarginBottom, children: [label && id && (hideLabelFromVision ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "label", htmlFor: id, children: label }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledLabel, { className: "components-base-control__label", htmlFor: id, children: label })), label && !id && (hideLabelFromVision ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "label", children: label }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(VisualLabel, { children: label })), children] }), !!help && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledHelp, { id: id ? id + '__help' : undefined, className: "components-base-control__help", __nextHasNoMarginBottom: __nextHasNoMarginBottom, children: help })] }); }; const UnforwardedVisualLabel = (props, ref) => { const { className, children, ...restProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledVisualLabel, { ref: ref, ...restProps, className: dist_clsx('components-base-control__label', className), children: children }); }; const VisualLabel = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedVisualLabel); /** * `BaseControl` is a component used to generate labels and help text for components handling user inputs. * * ```jsx * import { BaseControl, useBaseControlProps } from '@wordpress/components'; * * // Render a `BaseControl` for a textarea input * const MyCustomTextareaControl = ({ children, ...baseProps }) => ( * // `useBaseControlProps` is a convenience hook to get the props for the `BaseControl` * // and the inner control itself. Namely, it takes care of generating a unique `id`, * // properly associating it with the `label` and `help` elements. * const { baseControlProps, controlProps } = useBaseControlProps( baseProps ); * * return ( * <BaseControl { ...baseControlProps } __nextHasNoMarginBottom> * <textarea { ...controlProps }> * { children } * </textarea> * </BaseControl> * ); * ); * ``` */ const BaseControl = Object.assign(contextConnectWithoutRef(UnconnectedBaseControl, 'BaseControl'), { /** * `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component. * * It should only be used in cases where the children being rendered inside `BaseControl` are already accessibly labeled, * e.g., a button, but we want an additional visual label for that section equivalent to the labels `BaseControl` would * otherwise use if the `label` prop was passed. * * ```jsx * import { BaseControl } from '@wordpress/components'; * * const MyBaseControl = () => ( * <BaseControl * __nextHasNoMarginBottom * help="This button is already accessibly labeled." * > * <BaseControl.VisualLabel>Author</BaseControl.VisualLabel> * <Button>Select an author</Button> * </BaseControl> * ); * ``` */ VisualLabel }); /* harmony default export */ const base_control = (BaseControl); ;// ./node_modules/@wordpress/components/build-module/utils/deprecated-36px-size.js /** * WordPress dependencies */ function maybeWarnDeprecated36pxSize({ componentName, __next40pxDefaultSize, size, __shouldNotWarnDeprecated36pxSize }) { if (__shouldNotWarnDeprecated36pxSize || __next40pxDefaultSize || size !== undefined && size !== 'default') { return; } external_wp_deprecated_default()(`36px default size for wp.components.${componentName}`, { since: '6.8', version: '7.1', hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.' }); } ;// ./node_modules/@wordpress/components/build-module/input-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const input_control_noop = () => {}; function input_control_useUniqueId(idProp) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(InputControl); const id = `inspector-input-control-${instanceId}`; return idProp || id; } function UnforwardedInputControl(props, ref) { const { __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize, __unstableStateReducer: stateReducer = state => state, __unstableInputWidth, className, disabled = false, help, hideLabelFromVision = false, id: idProp, isPressEnterToChange = false, label, labelPosition = 'top', onChange = input_control_noop, onValidate = input_control_noop, onKeyDown = input_control_noop, prefix, size = 'default', style, suffix, value, ...restProps } = useDeprecated36pxDefaultSizeProp(props); const id = input_control_useUniqueId(idProp); const classes = dist_clsx('components-input-control', className); const draftHookProps = useDraft({ value, onBlur: restProps.onBlur, onChange }); const helpProp = !!help ? { 'aria-describedby': `${id}__help` } : {}; maybeWarnDeprecated36pxSize({ componentName: 'InputControl', __next40pxDefaultSize, size, __shouldNotWarnDeprecated36pxSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { className: classes, help: help, id: id, __nextHasNoMarginBottom: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(input_base, { __next40pxDefaultSize: __next40pxDefaultSize, __unstableInputWidth: __unstableInputWidth, disabled: disabled, gap: 3, hideLabelFromVision: hideLabelFromVision, id: id, justify: "left", label: label, labelPosition: labelPosition, prefix: prefix, size: size, style: style, suffix: suffix, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(input_field, { ...restProps, ...helpProp, __next40pxDefaultSize: __next40pxDefaultSize, className: "components-input-control__input", disabled: disabled, id: id, isPressEnterToChange: isPressEnterToChange, onKeyDown: onKeyDown, onValidate: onValidate, paddingInlineStart: prefix ? space(1) : undefined, paddingInlineEnd: suffix ? space(1) : undefined, ref: ref, size: size, stateReducer: stateReducer, ...draftHookProps }) }) }); } /** * InputControl components let users enter and edit text. This is an experimental component * intended to (in time) merge with or replace `TextControl`. * * ```jsx * import { __experimentalInputControl as InputControl } from '@wordpress/components'; * import { useState } from 'react'; * * const Example = () => { * const [ value, setValue ] = useState( '' ); * * return ( * <InputControl * __next40pxDefaultSize * value={ value } * onChange={ ( nextValue ) => setValue( nextValue ?? '' ) } * /> * ); * }; * ``` */ const InputControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedInputControl); /* harmony default export */ const input_control = (InputControl); ;// ./node_modules/@wordpress/components/build-module/dashicon/index.js /** * @typedef OwnProps * * @property {import('./types').IconKey} icon Icon name * @property {string} [className] Class name * @property {number} [size] Size of the icon */ /** * Internal dependencies */ function Dashicon({ icon, className, size = 20, style = {}, ...extraProps }) { const iconClass = ['dashicon', 'dashicons', 'dashicons-' + icon, className].filter(Boolean).join(' '); // For retro-compatibility reasons (for example if people are overriding icon size with CSS), we add inline styles just if the size is different to the default const sizeStyles = // using `!=` to catch both 20 and "20" // eslint-disable-next-line eqeqeq 20 != size ? { fontSize: `${size}px`, width: `${size}px`, height: `${size}px` } : {}; const styles = { ...sizeStyles, ...style }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: iconClass, style: styles, ...extraProps }); } /* harmony default export */ const dashicon = (Dashicon); ;// ./node_modules/@wordpress/components/build-module/icon/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders a raw icon without any initial styling or wrappers. * * ```jsx * import { wordpress } from '@wordpress/icons'; * * <Icon icon={ wordpress } /> * ``` */ function Icon({ icon = null, size = 'string' === typeof icon ? 20 : 24, ...additionalProps }) { if ('string' === typeof icon) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dashicon, { icon: icon, size: size, ...additionalProps }); } if ((0,external_wp_element_namespaceObject.isValidElement)(icon) && dashicon === icon.type) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { ...additionalProps }); } if ('function' === typeof icon) { return (0,external_wp_element_namespaceObject.createElement)(icon, { size, ...additionalProps }); } if (icon && (icon.type === 'svg' || icon.type === external_wp_primitives_namespaceObject.SVG)) { const appliedProps = { ...icon.props, width: size, height: size, ...additionalProps }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { ...appliedProps }); } if ((0,external_wp_element_namespaceObject.isValidElement)(icon)) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { // @ts-ignore Just forwarding the size prop along size, ...additionalProps }); } return icon; } /* harmony default export */ const build_module_icon = (Icon); ;// ./node_modules/@wordpress/components/build-module/button/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const disabledEventsOnDisabledButton = ['onMouseDown', 'onClick']; function button_useDeprecatedProps({ __experimentalIsFocusable, isDefault, isPrimary, isSecondary, isTertiary, isLink, isPressed, isSmall, size, variant, describedBy, ...otherProps }) { let computedSize = size; let computedVariant = variant; const newProps = { accessibleWhenDisabled: __experimentalIsFocusable, // @todo Mark `isPressed` as deprecated 'aria-pressed': isPressed, description: describedBy }; if (isSmall) { var _computedSize; (_computedSize = computedSize) !== null && _computedSize !== void 0 ? _computedSize : computedSize = 'small'; } if (isPrimary) { var _computedVariant; (_computedVariant = computedVariant) !== null && _computedVariant !== void 0 ? _computedVariant : computedVariant = 'primary'; } if (isTertiary) { var _computedVariant2; (_computedVariant2 = computedVariant) !== null && _computedVariant2 !== void 0 ? _computedVariant2 : computedVariant = 'tertiary'; } if (isSecondary) { var _computedVariant3; (_computedVariant3 = computedVariant) !== null && _computedVariant3 !== void 0 ? _computedVariant3 : computedVariant = 'secondary'; } if (isDefault) { var _computedVariant4; external_wp_deprecated_default()('wp.components.Button `isDefault` prop', { since: '5.4', alternative: 'variant="secondary"' }); (_computedVariant4 = computedVariant) !== null && _computedVariant4 !== void 0 ? _computedVariant4 : computedVariant = 'secondary'; } if (isLink) { var _computedVariant5; (_computedVariant5 = computedVariant) !== null && _computedVariant5 !== void 0 ? _computedVariant5 : computedVariant = 'link'; } return { ...newProps, ...otherProps, size: computedSize, variant: computedVariant }; } function UnforwardedButton(props, ref) { const { __next40pxDefaultSize, accessibleWhenDisabled, isBusy, isDestructive, className, disabled, icon, iconPosition = 'left', iconSize, showTooltip, tooltipPosition, shortcut, label, children, size = 'default', text, variant, description, ...buttonOrAnchorProps } = button_useDeprecatedProps(props); const { href, target, 'aria-checked': ariaChecked, 'aria-pressed': ariaPressed, 'aria-selected': ariaSelected, ...additionalProps } = 'href' in buttonOrAnchorProps ? buttonOrAnchorProps : { href: undefined, target: undefined, ...buttonOrAnchorProps }; const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Button, 'components-button__description'); const hasChildren = 'string' === typeof children && !!children || Array.isArray(children) && children?.[0] && children[0] !== null && // Tooltip should not considered as a child children?.[0]?.props?.className !== 'components-tooltip'; const truthyAriaPressedValues = [true, 'true', 'mixed']; const classes = dist_clsx('components-button', className, { 'is-next-40px-default-size': __next40pxDefaultSize, 'is-secondary': variant === 'secondary', 'is-primary': variant === 'primary', 'is-small': size === 'small', 'is-compact': size === 'compact', 'is-tertiary': variant === 'tertiary', 'is-pressed': truthyAriaPressedValues.includes(ariaPressed), 'is-pressed-mixed': ariaPressed === 'mixed', 'is-busy': isBusy, 'is-link': variant === 'link', 'is-destructive': isDestructive, 'has-text': !!icon && (hasChildren || text), 'has-icon': !!icon }); const trulyDisabled = disabled && !accessibleWhenDisabled; const Tag = href !== undefined && !disabled ? 'a' : 'button'; const buttonProps = Tag === 'button' ? { type: 'button', disabled: trulyDisabled, 'aria-checked': ariaChecked, 'aria-pressed': ariaPressed, 'aria-selected': ariaSelected } : {}; const anchorProps = Tag === 'a' ? { href, target } : {}; const disableEventProps = {}; if (disabled && accessibleWhenDisabled) { // In this case, the button will be disabled, but still focusable and // perceivable by screen reader users. buttonProps['aria-disabled'] = true; anchorProps['aria-disabled'] = true; for (const disabledEvent of disabledEventsOnDisabledButton) { disableEventProps[disabledEvent] = event => { if (event) { event.stopPropagation(); event.preventDefault(); } }; } } // Should show the tooltip if... const shouldShowTooltip = !trulyDisabled && ( // An explicit tooltip is passed or... showTooltip && !!label || // There's a shortcut or... !!shortcut || // There's a label and... !!label && // The children are empty and... !children?.length && // The tooltip is not explicitly disabled. false !== showTooltip); const descriptionId = description ? instanceId : undefined; const describedById = additionalProps['aria-describedby'] || descriptionId; const commonProps = { className: classes, 'aria-label': additionalProps['aria-label'] || label, 'aria-describedby': describedById, ref }; const elementChildren = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [icon && iconPosition === 'left' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon, size: iconSize }), text && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: text }), children, icon && iconPosition === 'right' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon, size: iconSize })] }); const element = Tag === 'a' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { ...anchorProps, ...additionalProps, ...disableEventProps, ...commonProps, children: elementChildren }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { ...buttonProps, ...additionalProps, ...disableEventProps, ...commonProps, children: elementChildren }); // In order to avoid some React reconciliation issues, we are always rendering // the `Tooltip` component even when `shouldShowTooltip` is `false`. // In order to make sure that the tooltip doesn't show when it shouldn't, // we don't pass the props to the `Tooltip` component. const tooltipProps = shouldShowTooltip ? { text: children?.length && description ? description : label, shortcut, placement: tooltipPosition && // Convert legacy `position` values to be used with the new `placement` prop positionToPlacement(tooltipPosition) } : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tooltip, { ...tooltipProps, children: element }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: descriptionId, children: description }) })] }); } /** * Lets users take actions and make choices with a single click or tap. * * ```jsx * import { Button } from '@wordpress/components'; * const Mybutton = () => ( * <Button * variant="primary" * onClick={ handleClick } * > * Click here * </Button> * ); * ``` */ const Button = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedButton); /* harmony default export */ const build_module_button = (Button); ;// ./node_modules/@wordpress/components/build-module/number-control/styles/number-control-styles.js function number_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ var number_control_styles_ref = true ? { name: "euqsgg", styles: "input[type='number']::-webkit-outer-spin-button,input[type='number']::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}input[type='number']{-moz-appearance:textfield;}" } : 0; const htmlArrowStyles = ({ hideHTMLArrows }) => { if (!hideHTMLArrows) { return ``; } return number_control_styles_ref; }; const number_control_styles_Input = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? { target: "ep09it41" } : 0)(htmlArrowStyles, ";" + ( true ? "" : 0)); const SpinButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? { target: "ep09it40" } : 0)("&&&&&{color:", COLORS.theme.accent, ";}" + ( true ? "" : 0)); const smallSpinButtons = /*#__PURE__*/emotion_react_browser_esm_css("width:", space(5), ";min-width:", space(5), ";height:", space(5), ";" + ( true ? "" : 0), true ? "" : 0); const styles = { smallSpinButtons }; ;// ./node_modules/@wordpress/components/build-module/utils/math.js /** * Parses and retrieves a number value. * * @param {unknown} value The incoming value. * * @return {number} The parsed number value. */ function getNumber(value) { const number = Number(value); return isNaN(number) ? 0 : number; } /** * Safely adds 2 values. * * @param {Array<number|string>} args Values to add together. * * @return {number} The sum of values. */ function add(...args) { return args.reduce(/** @type {(sum:number, arg: number|string) => number} */ (sum, arg) => sum + getNumber(arg), 0); } /** * Safely subtracts 2 values. * * @param {Array<number|string>} args Values to subtract together. * * @return {number} The difference of the values. */ function subtract(...args) { return args.reduce(/** @type {(diff:number, arg: number|string, index:number) => number} */ (diff, arg, index) => { const value = getNumber(arg); return index === 0 ? value : diff - value; }, 0); } /** * Determines the decimal position of a number value. * * @param {number} value The number to evaluate. * * @return {number} The number of decimal places. */ function getPrecision(value) { const split = (value + '').split('.'); return split[1] !== undefined ? split[1].length : 0; } /** * Clamps a value based on a min/max range. * * @param {number} value The value. * @param {number} min The minimum range. * @param {number} max The maximum range. * * @return {number} The clamped value. */ function math_clamp(value, min, max) { const baseValue = getNumber(value); return Math.max(min, Math.min(baseValue, max)); } /** * Clamps a value based on a min/max range with rounding * * @param {number | string} value The value. * @param {number} min The minimum range. * @param {number} max The maximum range. * @param {number} step A multiplier for the value. * * @return {number} The rounded and clamped value. */ function roundClamp(value = 0, min = Infinity, max = Infinity, step = 1) { const baseValue = getNumber(value); const stepValue = getNumber(step); const precision = getPrecision(step); const rounded = Math.round(baseValue / stepValue) * stepValue; const clampedValue = math_clamp(rounded, min, max); return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue; } ;// ./node_modules/@wordpress/components/build-module/h-stack/utils.js /** * External dependencies */ /** * Internal dependencies */ const H_ALIGNMENTS = { bottom: { align: 'flex-end', justify: 'center' }, bottomLeft: { align: 'flex-end', justify: 'flex-start' }, bottomRight: { align: 'flex-end', justify: 'flex-end' }, center: { align: 'center', justify: 'center' }, edge: { align: 'center', justify: 'space-between' }, left: { align: 'center', justify: 'flex-start' }, right: { align: 'center', justify: 'flex-end' }, stretch: { align: 'stretch' }, top: { align: 'flex-start', justify: 'center' }, topLeft: { align: 'flex-start', justify: 'flex-start' }, topRight: { align: 'flex-start', justify: 'flex-end' } }; const V_ALIGNMENTS = { bottom: { justify: 'flex-end', align: 'center' }, bottomLeft: { justify: 'flex-end', align: 'flex-start' }, bottomRight: { justify: 'flex-end', align: 'flex-end' }, center: { justify: 'center', align: 'center' }, edge: { justify: 'space-between', align: 'center' }, left: { justify: 'center', align: 'flex-start' }, right: { justify: 'center', align: 'flex-end' }, stretch: { align: 'stretch' }, top: { justify: 'flex-start', align: 'center' }, topLeft: { justify: 'flex-start', align: 'flex-start' }, topRight: { justify: 'flex-start', align: 'flex-end' } }; function getAlignmentProps(alignment, direction = 'row') { if (!isValueDefined(alignment)) { return {}; } const isVertical = direction === 'column'; const props = isVertical ? V_ALIGNMENTS : H_ALIGNMENTS; const alignmentProps = alignment in props ? props[alignment] : { align: alignment }; return alignmentProps; } ;// ./node_modules/@wordpress/components/build-module/utils/get-valid-children.js /** * External dependencies */ /** * WordPress dependencies */ /** * Gets a collection of available children elements from a React component's children prop. * * @param children * * @return An array of available children. */ function getValidChildren(children) { if (typeof children === 'string') { return [children]; } return external_wp_element_namespaceObject.Children.toArray(children).filter(child => (0,external_wp_element_namespaceObject.isValidElement)(child)); } ;// ./node_modules/@wordpress/components/build-module/h-stack/hook.js /** * External dependencies */ /** * Internal dependencies */ function useHStack(props) { const { alignment = 'edge', children, direction, spacing = 2, ...otherProps } = useContextSystem(props, 'HStack'); const align = getAlignmentProps(alignment, direction); const validChildren = getValidChildren(children); const clonedChildren = validChildren.map((child, index) => { const _isSpacer = hasConnectNamespace(child, ['Spacer']); if (_isSpacer) { const childElement = child; const _key = childElement.key || `hstack-${index}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_item_component, { isBlock: true, ...childElement.props }, _key); } return child; }); const propsForFlex = { children: clonedChildren, direction, justify: 'center', ...align, ...otherProps, gap: spacing }; // Omit `isColumn` because it's not used in HStack. const { isColumn, ...flexProps } = useFlex(propsForFlex); return flexProps; } ;// ./node_modules/@wordpress/components/build-module/h-stack/component.js /** * Internal dependencies */ function UnconnectedHStack(props, forwardedRef) { const hStackProps = useHStack(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...hStackProps, ref: forwardedRef }); } /** * `HStack` (Horizontal Stack) arranges child elements in a horizontal line. * * `HStack` can render anything inside. * * ```jsx * import { * __experimentalHStack as HStack, * __experimentalText as Text, * } from `@wordpress/components`; * * function Example() { * return ( * <HStack> * <Text>Code</Text> * <Text>is</Text> * <Text>Poetry</Text> * </HStack> * ); * } * ``` */ const HStack = contextConnect(UnconnectedHStack, 'HStack'); /* harmony default export */ const h_stack_component = (HStack); ;// ./node_modules/@wordpress/components/build-module/number-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const number_control_noop = () => {}; function UnforwardedNumberControl(props, forwardedRef) { const { __unstableStateReducer: stateReducerProp, className, dragDirection = 'n', hideHTMLArrows = false, spinControls = hideHTMLArrows ? 'none' : 'native', isDragEnabled = true, isShiftStepEnabled = true, label, max = Infinity, min = -Infinity, required = false, shiftStep = 10, step = 1, spinFactor = 1, type: typeProp = 'number', value: valueProp, size = 'default', suffix, onChange = number_control_noop, __shouldNotWarnDeprecated36pxSize, ...restProps } = useDeprecated36pxDefaultSizeProp(props); maybeWarnDeprecated36pxSize({ componentName: 'NumberControl', size, __next40pxDefaultSize: restProps.__next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize }); if (hideHTMLArrows) { external_wp_deprecated_default()('wp.components.NumberControl hideHTMLArrows prop ', { alternative: 'spinControls="none"', since: '6.2', version: '6.3' }); } const inputRef = (0,external_wp_element_namespaceObject.useRef)(); const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([inputRef, forwardedRef]); const isStepAny = step === 'any'; const baseStep = isStepAny ? 1 : ensureNumber(step); const baseSpin = ensureNumber(spinFactor) * baseStep; const baseValue = roundClamp(0, min, max, baseStep); const constrainValue = (value, stepOverride) => { // When step is "any" clamp the value, otherwise round and clamp it. // Use '' + to convert to string for use in input value attribute. return isStepAny ? '' + Math.min(max, Math.max(min, ensureNumber(value))) : '' + roundClamp(value, min, max, stepOverride !== null && stepOverride !== void 0 ? stepOverride : baseStep); }; const autoComplete = typeProp === 'number' ? 'off' : undefined; const classes = dist_clsx('components-number-control', className); const cx = useCx(); const spinButtonClasses = cx(size === 'small' && styles.smallSpinButtons); const spinValue = (value, direction, event) => { event?.preventDefault(); const shift = event?.shiftKey && isShiftStepEnabled; const delta = shift ? ensureNumber(shiftStep) * baseSpin : baseSpin; let nextValue = isValueEmpty(value) ? baseValue : value; if (direction === 'up') { nextValue = add(nextValue, delta); } else if (direction === 'down') { nextValue = subtract(nextValue, delta); } return constrainValue(nextValue, shift ? delta : undefined); }; /** * "Middleware" function that intercepts updates from InputControl. * This allows us to tap into actions to transform the (next) state for * InputControl. * * @return The updated state to apply to InputControl */ const numberControlStateReducer = (state, action) => { const nextState = { ...state }; const { type, payload } = action; const event = payload.event; const currentValue = nextState.value; /** * Handles custom UP and DOWN Keyboard events */ if (type === PRESS_UP || type === PRESS_DOWN) { nextState.value = spinValue(currentValue, type === PRESS_UP ? 'up' : 'down', event); } /** * Handles drag to update events */ if (type === DRAG && isDragEnabled) { const [x, y] = payload.delta; const enableShift = payload.shiftKey && isShiftStepEnabled; const modifier = enableShift ? ensureNumber(shiftStep) * baseSpin : baseSpin; let directionModifier; let delta; switch (dragDirection) { case 'n': delta = y; directionModifier = -1; break; case 'e': delta = x; directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1; break; case 's': delta = y; directionModifier = 1; break; case 'w': delta = x; directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? 1 : -1; break; } if (delta !== 0) { delta = Math.ceil(Math.abs(delta)) * Math.sign(delta); const distance = delta * modifier * directionModifier; nextState.value = constrainValue( // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined add(currentValue, distance), enableShift ? modifier : undefined); } } /** * Handles commit (ENTER key press or blur) */ if (type === PRESS_ENTER || type === COMMIT) { const applyEmptyValue = required === false && currentValue === ''; nextState.value = applyEmptyValue ? currentValue : // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined constrainValue(currentValue); } return nextState; }; const buildSpinButtonClickHandler = direction => event => onChange(String(spinValue(valueProp, direction, event)), { // Set event.target to the <input> so that consumers can use // e.g. event.target.validity. event: { ...event, target: inputRef.current } }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(number_control_styles_Input, { autoComplete: autoComplete, inputMode: "numeric", ...restProps, className: classes, dragDirection: dragDirection, hideHTMLArrows: spinControls !== 'native', isDragEnabled: isDragEnabled, label: label, max: max === Infinity ? undefined : max, min: min === -Infinity ? undefined : min, ref: mergedRef, required: required, step: step, type: typeProp // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components , value: valueProp, __unstableStateReducer: (state, action) => { var _stateReducerProp; const baseState = numberControlStateReducer(state, action); return (_stateReducerProp = stateReducerProp?.(baseState, action)) !== null && _stateReducerProp !== void 0 ? _stateReducerProp : baseState; }, size: size, __shouldNotWarnDeprecated36pxSize: true, suffix: spinControls === 'custom' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [suffix, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { marginBottom: 0, marginRight: 2, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpinButton, { className: spinButtonClasses, icon: library_plus, size: "small", label: (0,external_wp_i18n_namespaceObject.__)('Increment'), onClick: buildSpinButtonClickHandler('up') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpinButton, { className: spinButtonClasses, icon: library_reset, size: "small", label: (0,external_wp_i18n_namespaceObject.__)('Decrement'), onClick: buildSpinButtonClickHandler('down') })] }) })] }) : suffix, onChange: onChange }); } const NumberControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedNumberControl); /* harmony default export */ const number_control = (NumberControl); ;// ./node_modules/@wordpress/components/build-module/angle-picker-control/styles/angle-picker-control-styles.js function angle_picker_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const CIRCLE_SIZE = 32; const INNER_CIRCLE_SIZE = 6; const CircleRoot = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eln3bjz3" } : 0)("border-radius:", config_values.radiusRound, ";border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";box-sizing:border-box;cursor:grab;height:", CIRCLE_SIZE, "px;overflow:hidden;width:", CIRCLE_SIZE, "px;:active{cursor:grabbing;}" + ( true ? "" : 0)); const CircleIndicatorWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eln3bjz2" } : 0)( true ? { name: "1r307gh", styles: "box-sizing:border-box;position:relative;width:100%;height:100%;:focus-visible{outline:none;}" } : 0); const CircleIndicator = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eln3bjz1" } : 0)("background:", COLORS.theme.accent, ";border-radius:", config_values.radiusRound, ";box-sizing:border-box;display:block;left:50%;top:4px;transform:translateX( -50% );position:absolute;width:", INNER_CIRCLE_SIZE, "px;height:", INNER_CIRCLE_SIZE, "px;" + ( true ? "" : 0)); const UnitText = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? { target: "eln3bjz0" } : 0)("color:", COLORS.theme.accent, ";margin-right:", space(3), ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/angle-picker-control/angle-circle.js /** * WordPress dependencies */ /** * Internal dependencies */ function AngleCircle({ value, onChange, ...props }) { const angleCircleRef = (0,external_wp_element_namespaceObject.useRef)(null); const angleCircleCenterRef = (0,external_wp_element_namespaceObject.useRef)(); const previousCursorValueRef = (0,external_wp_element_namespaceObject.useRef)(); const setAngleCircleCenter = () => { if (angleCircleRef.current === null) { return; } const rect = angleCircleRef.current.getBoundingClientRect(); angleCircleCenterRef.current = { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 }; }; const changeAngleToPosition = event => { if (event === undefined) { return; } // Prevent (drag) mouse events from selecting and accidentally // triggering actions from other elements. event.preventDefault(); // Input control needs to lose focus and by preventDefault above, it doesn't. event.target?.focus(); if (angleCircleCenterRef.current !== undefined && onChange !== undefined) { const { x: centerX, y: centerY } = angleCircleCenterRef.current; onChange(getAngle(centerX, centerY, event.clientX, event.clientY)); } }; const { startDrag, isDragging } = (0,external_wp_compose_namespaceObject.__experimentalUseDragging)({ onDragStart: event => { setAngleCircleCenter(); changeAngleToPosition(event); }, onDragMove: changeAngleToPosition, onDragEnd: changeAngleToPosition }); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isDragging) { if (previousCursorValueRef.current === undefined) { previousCursorValueRef.current = document.body.style.cursor; } document.body.style.cursor = 'grabbing'; } else { document.body.style.cursor = previousCursorValueRef.current || ''; previousCursorValueRef.current = undefined; } }, [isDragging]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CircleRoot, { ref: angleCircleRef, onMouseDown: startDrag, className: "components-angle-picker-control__angle-circle", ...props, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CircleIndicatorWrapper, { style: value ? { transform: `rotate(${value}deg)` } : undefined, className: "components-angle-picker-control__angle-circle-indicator-wrapper", tabIndex: -1, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CircleIndicator, { className: "components-angle-picker-control__angle-circle-indicator" }) }) }); } function getAngle(centerX, centerY, pointX, pointY) { const y = pointY - centerY; const x = pointX - centerX; const angleInRadians = Math.atan2(y, x); const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90; if (angleInDeg < 0) { return 360 + angleInDeg; } return angleInDeg; } /* harmony default export */ const angle_circle = (AngleCircle); ;// ./node_modules/@wordpress/components/build-module/angle-picker-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedAnglePickerControl(props, ref) { const { className, label = (0,external_wp_i18n_namespaceObject.__)('Angle'), onChange, value, ...restProps } = props; const handleOnNumberChange = unprocessedValue => { if (onChange === undefined) { return; } const inputValue = unprocessedValue !== undefined && unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0; onChange(inputValue); }; const classes = dist_clsx('components-angle-picker-control', className); const unitText = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UnitText, { children: "\xB0" }); const [prefixedUnitText, suffixedUnitText] = (0,external_wp_i18n_namespaceObject.isRTL)() ? [unitText, null] : [null, unitText]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(flex_component, { ...restProps, ref: ref, className: classes, gap: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_block_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(number_control, { __next40pxDefaultSize: true, label: label, className: "components-angle-picker-control__input-field", max: 360, min: 0, onChange: handleOnNumberChange, step: "1", value: value, spinControls: "none", prefix: prefixedUnitText, suffix: suffixedUnitText }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { marginBottom: "1", marginTop: "auto", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(angle_circle, { "aria-hidden": "true", value: value, onChange: onChange }) })] }); } /** * `AnglePickerControl` is a React component to render a UI that allows users to * pick an angle. Users can choose an angle in a visual UI with the mouse by * dragging an angle indicator inside a circle or by directly inserting the * desired angle in a text field. * * ```jsx * import { useState } from '@wordpress/element'; * import { AnglePickerControl } from '@wordpress/components'; * * function Example() { * const [ angle, setAngle ] = useState( 0 ); * return ( * <AnglePickerControl * value={ angle } * onChange={ setAngle } * </> * ); * } * ``` */ const AnglePickerControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedAnglePickerControl); /* harmony default export */ const angle_picker_control = (AnglePickerControl); // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/components/build-module/utils/strings.js /** * External dependencies */ /** * All unicode characters that we consider "dash-like": * - `\u007e`: ~ (tilde) * - `\u00ad`: (soft hyphen) * - `\u2053`: ⁓ (swung dash) * - `\u207b`: ⁻ (superscript minus) * - `\u208b`: ₋ (subscript minus) * - `\u2212`: − (minus sign) * - `\\p{Pd}`: any other Unicode dash character */ const ALL_UNICODE_DASH_CHARACTERS = new RegExp(/[\u007e\u00ad\u2053\u207b\u208b\u2212\p{Pd}]/gu); const normalizeTextString = value => { return remove_accents_default()(value).toLocaleLowerCase().replace(ALL_UNICODE_DASH_CHARACTERS, '-'); }; /** * Converts any string to kebab case. * Backwards compatible with Lodash's `_.kebabCase()`. * Backwards compatible with `_wp_to_kebab_case()`. * * @see https://lodash.com/docs/4.17.15#kebabCase * @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/ * * @param str String to convert. * @return Kebab-cased string */ function kebabCase(str) { var _str$toString; let input = (_str$toString = str?.toString?.()) !== null && _str$toString !== void 0 ? _str$toString : ''; // See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970 input = input.replace(/['\u2019]/, ''); return paramCase(input, { splitRegexp: [/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g, // fooBar => foo-bar, 3Bar => 3-bar /(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g, // 3bar => 3-bar /([A-Za-z])([0-9])/g, // Foo3 => foo-3, foo3 => foo-3 /([A-Z])([A-Z][a-z])/g // FOOBar => foo-bar ] }); } /** * Escapes the RegExp special characters. * * @param string Input string. * * @return Regex-escaped string. */ function escapeRegExp(string) { return string.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&'); } ;// ./node_modules/@wordpress/components/build-module/autocomplete/get-default-use-items.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function filterOptions(search, options = [], maxResults = 10) { const filtered = []; for (let i = 0; i < options.length; i++) { const option = options[i]; // Merge label into keywords. let { keywords = [] } = option; if ('string' === typeof option.label) { keywords = [...keywords, option.label]; } const isMatch = keywords.some(keyword => search.test(remove_accents_default()(keyword))); if (!isMatch) { continue; } filtered.push(option); // Abort early if max reached. if (filtered.length === maxResults) { break; } } return filtered; } function getDefaultUseItems(autocompleter) { return filterValue => { const [items, setItems] = (0,external_wp_element_namespaceObject.useState)([]); /* * We support both synchronous and asynchronous retrieval of completer options * but internally treat all as async so we maintain a single, consistent code path. * * Because networks can be slow, and the internet is wonderfully unpredictable, * we don't want two promises updating the state at once. This ensures that only * the most recent promise will act on `optionsData`. This doesn't use the state * because `setState` is batched, and so there's no guarantee that setting * `activePromise` in the state would result in it actually being in `this.state` * before the promise resolves and we check to see if this is the active promise or not. */ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const { options, isDebounced } = autocompleter; const loadOptions = (0,external_wp_compose_namespaceObject.debounce)(() => { const promise = Promise.resolve(typeof options === 'function' ? options(filterValue) : options).then(optionsData => { if (promise.canceled) { return; } const keyedOptions = optionsData.map((optionData, optionIndex) => ({ key: `${autocompleter.name}-${optionIndex}`, value: optionData, label: autocompleter.getOptionLabel(optionData), keywords: autocompleter.getOptionKeywords ? autocompleter.getOptionKeywords(optionData) : [], isDisabled: autocompleter.isOptionDisabled ? autocompleter.isOptionDisabled(optionData) : false })); // Create a regular expression to filter the options. const search = new RegExp('(?:\\b|\\s|^)' + escapeRegExp(filterValue), 'i'); setItems(filterOptions(search, keyedOptions)); }); return promise; }, isDebounced ? 250 : 0); const promise = loadOptions(); return () => { loadOptions.cancel(); if (promise) { promise.canceled = true; } }; }, [filterValue]); return [items]; }; } ;// ./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs /** * Provides data to position an inner element of the floating element so that it * appears centered to the reference element. * This wraps the core `arrow` middleware to allow React refs as the element. * @see https://floating-ui.com/docs/arrow */ const floating_ui_react_dom_arrow = options => { function isRef(value) { return {}.hasOwnProperty.call(value, 'current'); } return { name: 'arrow', options, fn(state) { const { element, padding } = typeof options === 'function' ? options(state) : options; if (element && isRef(element)) { if (element.current != null) { return floating_ui_dom_arrow({ element: element.current, padding }).fn(state); } return {}; } if (element) { return floating_ui_dom_arrow({ element, padding }).fn(state); } return {}; } }; }; var index = typeof document !== 'undefined' ? external_React_.useLayoutEffect : external_React_.useEffect; // Fork of `fast-deep-equal` that only does the comparisons we need and compares // functions function deepEqual(a, b) { if (a === b) { return true; } if (typeof a !== typeof b) { return false; } if (typeof a === 'function' && a.toString() === b.toString()) { return true; } let length; let i; let keys; if (a && b && typeof a === 'object') { if (Array.isArray(a)) { length = a.length; if (length !== b.length) return false; for (i = length; i-- !== 0;) { if (!deepEqual(a[i], b[i])) { return false; } } return true; } keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) { return false; } for (i = length; i-- !== 0;) { if (!{}.hasOwnProperty.call(b, keys[i])) { return false; } } for (i = length; i-- !== 0;) { const key = keys[i]; if (key === '_owner' && a.$$typeof) { continue; } if (!deepEqual(a[key], b[key])) { return false; } } return true; } // biome-ignore lint/suspicious/noSelfCompare: in source return a !== a && b !== b; } function getDPR(element) { if (typeof window === 'undefined') { return 1; } const win = element.ownerDocument.defaultView || window; return win.devicePixelRatio || 1; } function floating_ui_react_dom_roundByDPR(element, value) { const dpr = getDPR(element); return Math.round(value * dpr) / dpr; } function useLatestRef(value) { const ref = external_React_.useRef(value); index(() => { ref.current = value; }); return ref; } /** * Provides data to position a floating element. * @see https://floating-ui.com/docs/useFloating */ function useFloating(options) { if (options === void 0) { options = {}; } const { placement = 'bottom', strategy = 'absolute', middleware = [], platform, elements: { reference: externalReference, floating: externalFloating } = {}, transform = true, whileElementsMounted, open } = options; const [data, setData] = external_React_.useState({ x: 0, y: 0, strategy, placement, middlewareData: {}, isPositioned: false }); const [latestMiddleware, setLatestMiddleware] = external_React_.useState(middleware); if (!deepEqual(latestMiddleware, middleware)) { setLatestMiddleware(middleware); } const [_reference, _setReference] = external_React_.useState(null); const [_floating, _setFloating] = external_React_.useState(null); const setReference = external_React_.useCallback(node => { if (node !== referenceRef.current) { referenceRef.current = node; _setReference(node); } }, []); const setFloating = external_React_.useCallback(node => { if (node !== floatingRef.current) { floatingRef.current = node; _setFloating(node); } }, []); const referenceEl = externalReference || _reference; const floatingEl = externalFloating || _floating; const referenceRef = external_React_.useRef(null); const floatingRef = external_React_.useRef(null); const dataRef = external_React_.useRef(data); const hasWhileElementsMounted = whileElementsMounted != null; const whileElementsMountedRef = useLatestRef(whileElementsMounted); const platformRef = useLatestRef(platform); const update = external_React_.useCallback(() => { if (!referenceRef.current || !floatingRef.current) { return; } const config = { placement, strategy, middleware: latestMiddleware }; if (platformRef.current) { config.platform = platformRef.current; } floating_ui_dom_computePosition(referenceRef.current, floatingRef.current, config).then(data => { const fullData = { ...data, isPositioned: true }; if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { dataRef.current = fullData; external_ReactDOM_namespaceObject.flushSync(() => { setData(fullData); }); } }); }, [latestMiddleware, placement, strategy, platformRef]); index(() => { if (open === false && dataRef.current.isPositioned) { dataRef.current.isPositioned = false; setData(data => ({ ...data, isPositioned: false })); } }, [open]); const isMountedRef = external_React_.useRef(false); index(() => { isMountedRef.current = true; return () => { isMountedRef.current = false; }; }, []); // biome-ignore lint/correctness/useExhaustiveDependencies: `hasWhileElementsMounted` is intentionally included. index(() => { if (referenceEl) referenceRef.current = referenceEl; if (floatingEl) floatingRef.current = floatingEl; if (referenceEl && floatingEl) { if (whileElementsMountedRef.current) { return whileElementsMountedRef.current(referenceEl, floatingEl, update); } update(); } }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]); const refs = external_React_.useMemo(() => ({ reference: referenceRef, floating: floatingRef, setReference, setFloating }), [setReference, setFloating]); const elements = external_React_.useMemo(() => ({ reference: referenceEl, floating: floatingEl }), [referenceEl, floatingEl]); const floatingStyles = external_React_.useMemo(() => { const initialStyles = { position: strategy, left: 0, top: 0 }; if (!elements.floating) { return initialStyles; } const x = floating_ui_react_dom_roundByDPR(elements.floating, data.x); const y = floating_ui_react_dom_roundByDPR(elements.floating, data.y); if (transform) { return { ...initialStyles, transform: "translate(" + x + "px, " + y + "px)", ...(getDPR(elements.floating) >= 1.5 && { willChange: 'transform' }) }; } return { position: strategy, left: x, top: y }; }, [strategy, transform, elements.floating, data.x, data.y]); return external_React_.useMemo(() => ({ ...data, update, refs, elements, floatingStyles }), [data, update, refs, elements, floatingStyles]); } ;// ./node_modules/@wordpress/icons/build-module/library/close.js /** * WordPress dependencies */ const close_close = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" }) }); /* harmony default export */ const library_close = (close_close); ;// ./node_modules/@wordpress/components/build-module/scroll-lock/index.js /** * WordPress dependencies */ /* * Setting `overflow: hidden` on html and body elements resets body scroll in iOS. * Save scroll top so we can restore it after locking scroll. * * NOTE: It would be cleaner and possibly safer to find a localized solution such * as preventing default on certain touchmove events. */ let previousScrollTop = 0; function setLocked(locked) { const scrollingElement = document.scrollingElement || document.body; if (locked) { previousScrollTop = scrollingElement.scrollTop; } const methodName = locked ? 'add' : 'remove'; scrollingElement.classList[methodName]('lockscroll'); // Adding the class to the document element seems to be necessary in iOS. document.documentElement.classList[methodName]('lockscroll'); if (!locked) { scrollingElement.scrollTop = previousScrollTop; } } let lockCounter = 0; /** * ScrollLock is a content-free React component for declaratively preventing * scroll bleed from modal UI to the page body. This component applies a * `lockscroll` class to the `document.documentElement` and * `document.scrollingElement` elements to stop the body from scrolling. When it * is present, the lock is applied. * * ```jsx * import { ScrollLock, Button } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyScrollLock = () => { * const [ isScrollLocked, setIsScrollLocked ] = useState( false ); * * const toggleLock = () => { * setIsScrollLocked( ( locked ) => ! locked ) ); * }; * * return ( * <div> * <Button variant="secondary" onClick={ toggleLock }> * Toggle scroll lock * </Button> * { isScrollLocked && <ScrollLock /> } * <p> * Scroll locked: * <strong>{ isScrollLocked ? 'Yes' : 'No' }</strong> * </p> * </div> * ); * }; * ``` */ function ScrollLock() { (0,external_wp_element_namespaceObject.useEffect)(() => { if (lockCounter === 0) { setLocked(true); } ++lockCounter; return () => { if (lockCounter === 1) { setLocked(false); } --lockCounter; }; }, []); return null; } /* harmony default export */ const scroll_lock = (ScrollLock); ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js /** * WordPress dependencies */ /** * Internal dependencies */ const initialContextValue = { slots: (0,external_wp_compose_namespaceObject.observableMap)(), fills: (0,external_wp_compose_namespaceObject.observableMap)(), registerSlot: () => { true ? external_wp_warning_default()('Components must be wrapped within `SlotFillProvider`. ' + 'See https://developer.wordpress.org/block-editor/components/slot-fill/') : 0; }, updateSlot: () => {}, unregisterSlot: () => {}, registerFill: () => {}, unregisterFill: () => {}, // This helps the provider know if it's using the default context value or not. isDefault: true }; const SlotFillContext = (0,external_wp_element_namespaceObject.createContext)(initialContextValue); /* harmony default export */ const slot_fill_context = (SlotFillContext); ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js /** * WordPress dependencies */ /** * Internal dependencies */ function useSlot(name) { const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context); const slot = (0,external_wp_compose_namespaceObject.useObservableValue)(registry.slots, name); return { ...slot }; } ;// ./node_modules/@wordpress/components/build-module/slot-fill/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const initialValue = { slots: (0,external_wp_compose_namespaceObject.observableMap)(), fills: (0,external_wp_compose_namespaceObject.observableMap)(), registerSlot: () => {}, unregisterSlot: () => {}, registerFill: () => {}, unregisterFill: () => {}, updateFill: () => {} }; const context_SlotFillContext = (0,external_wp_element_namespaceObject.createContext)(initialValue); /* harmony default export */ const context = (context_SlotFillContext); ;// ./node_modules/@wordpress/components/build-module/slot-fill/fill.js /** * WordPress dependencies */ /** * Internal dependencies */ function Fill({ name, children }) { const registry = (0,external_wp_element_namespaceObject.useContext)(context); const instanceRef = (0,external_wp_element_namespaceObject.useRef)({}); const childrenRef = (0,external_wp_element_namespaceObject.useRef)(children); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { childrenRef.current = children; }, [children]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const instance = instanceRef.current; registry.registerFill(name, instance, childrenRef.current); return () => registry.unregisterFill(name, instance); }, [registry, name]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { registry.updateFill(name, instanceRef.current, childrenRef.current); }); return null; } ;// ./node_modules/@wordpress/components/build-module/slot-fill/slot.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Whether the argument is a function. * * @param maybeFunc The argument to check. * @return True if the argument is a function, false otherwise. */ function isFunction(maybeFunc) { return typeof maybeFunc === 'function'; } function addKeysToChildren(children) { return external_wp_element_namespaceObject.Children.map(children, (child, childIndex) => { if (!child || typeof child === 'string') { return child; } let childKey = childIndex; if (typeof child === 'object' && 'key' in child && child?.key) { childKey = child.key; } return (0,external_wp_element_namespaceObject.cloneElement)(child, { key: childKey }); }); } function Slot(props) { var _useObservableValue; const registry = (0,external_wp_element_namespaceObject.useContext)(context); const instanceRef = (0,external_wp_element_namespaceObject.useRef)({}); const { name, children, fillProps = {} } = props; (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const instance = instanceRef.current; registry.registerSlot(name, instance); return () => registry.unregisterSlot(name, instance); }, [registry, name]); let fills = (_useObservableValue = (0,external_wp_compose_namespaceObject.useObservableValue)(registry.fills, name)) !== null && _useObservableValue !== void 0 ? _useObservableValue : []; const currentSlot = (0,external_wp_compose_namespaceObject.useObservableValue)(registry.slots, name); // Fills should only be rendered in the currently registered instance of the slot. if (currentSlot !== instanceRef.current) { fills = []; } const renderedFills = fills.map(fill => { const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children; return addKeysToChildren(fillChildren); }).filter( // In some cases fills are rendered only when some conditions apply. // This ensures that we only use non-empty fills when rendering, i.e., // it allows us to render wrappers only when the fills are actually present. element => !(0,external_wp_element_namespaceObject.isEmptyElement)(element)); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: isFunction(children) ? children(renderedFills) : renderedFills }); } /* harmony default export */ const slot = (Slot); ;// ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } ;// ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } function stringify_stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify_stringify))); ;// ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// ./node_modules/@wordpress/components/build-module/style-provider/index.js /** * External dependencies */ /** * Internal dependencies */ const uuidCache = new Set(); // Use a weak map so that when the container is detached it's automatically // dereferenced to avoid memory leak. const containerCacheMap = new WeakMap(); const memoizedCreateCacheWithContainer = container => { if (containerCacheMap.has(container)) { return containerCacheMap.get(container); } // Emotion only accepts alphabetical and hyphenated keys so we just // strip the numbers from the UUID. It _should_ be fine. let key = esm_browser_v4().replace(/[0-9]/g, ''); while (uuidCache.has(key)) { key = esm_browser_v4().replace(/[0-9]/g, ''); } uuidCache.add(key); const cache = emotion_cache_browser_esm({ container, key }); containerCacheMap.set(container, cache); return cache; }; function StyleProvider(props) { const { children, document } = props; if (!document) { return null; } const cache = memoizedCreateCacheWithContainer(document.head); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CacheProvider, { value: cache, children: children }); } /* harmony default export */ const style_provider = (StyleProvider); ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/fill.js /** * WordPress dependencies */ /** * Internal dependencies */ function fill_Fill({ name, children }) { var _slot$fillProps; const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context); const slot = (0,external_wp_compose_namespaceObject.useObservableValue)(registry.slots, name); const instanceRef = (0,external_wp_element_namespaceObject.useRef)({}); // We register fills so we can keep track of their existence. // Slots can use the `useSlotFills` hook to know if there're already fills // registered so they can choose to render themselves or not. (0,external_wp_element_namespaceObject.useEffect)(() => { const instance = instanceRef.current; registry.registerFill(name, instance); return () => registry.unregisterFill(name, instance); }, [registry, name]); if (!slot || !slot.ref.current) { return null; } // When using a `Fill`, the `children` will be rendered in the document of the // `Slot`. This means that we need to wrap the `children` in a `StyleProvider` // to make sure we're referencing the right document/iframe (instead of the // context of the `Fill`'s parent). const wrappedChildren = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_provider, { document: slot.ref.current.ownerDocument, children: typeof children === 'function' ? children((_slot$fillProps = slot.fillProps) !== null && _slot$fillProps !== void 0 ? _slot$fillProps : {}) : children }); return (0,external_wp_element_namespaceObject.createPortal)(wrappedChildren, slot.ref.current); } ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function slot_Slot(props, forwardedRef) { const { name, fillProps = {}, as, // `children` is not allowed. However, if it is passed, // it will be displayed as is, so remove `children`. children, ...restProps } = props; const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context); const ref = (0,external_wp_element_namespaceObject.useRef)(null); // We don't want to unregister and register the slot whenever // `fillProps` change, which would cause the fill to be re-mounted. Instead, // we can just update the slot (see hook below). // For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973 const fillPropsRef = (0,external_wp_element_namespaceObject.useRef)(fillProps); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { fillPropsRef.current = fillProps; }, [fillProps]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { registry.registerSlot(name, ref, fillPropsRef.current); return () => registry.unregisterSlot(name, ref); }, [registry, name]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { registry.updateSlot(name, ref, fillPropsRef.current); }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { as: as, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, ref]), ...restProps }); } /* harmony default export */ const bubbles_virtually_slot = ((0,external_wp_element_namespaceObject.forwardRef)(slot_Slot)); ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js /** * WordPress dependencies */ /** * Internal dependencies */ function createSlotRegistry() { const slots = (0,external_wp_compose_namespaceObject.observableMap)(); const fills = (0,external_wp_compose_namespaceObject.observableMap)(); const registerSlot = (name, ref, fillProps) => { slots.set(name, { ref, fillProps }); }; const unregisterSlot = (name, ref) => { const slot = slots.get(name); if (!slot) { return; } // Make sure we're not unregistering a slot registered by another element // See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412 if (slot.ref !== ref) { return; } slots.delete(name); }; const updateSlot = (name, ref, fillProps) => { const slot = slots.get(name); if (!slot) { return; } if (slot.ref !== ref) { return; } if (external_wp_isShallowEqual_default()(slot.fillProps, fillProps)) { return; } slots.set(name, { ref, fillProps }); }; const registerFill = (name, ref) => { fills.set(name, [...(fills.get(name) || []), ref]); }; const unregisterFill = (name, ref) => { const fillsForName = fills.get(name); if (!fillsForName) { return; } fills.set(name, fillsForName.filter(fillRef => fillRef !== ref)); }; return { slots, fills, registerSlot, updateSlot, unregisterSlot, registerFill, unregisterFill }; } function SlotFillProvider({ children }) { const [registry] = (0,external_wp_element_namespaceObject.useState)(createSlotRegistry); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_context.Provider, { value: registry, children: children }); } ;// ./node_modules/@wordpress/components/build-module/slot-fill/provider.js /** * WordPress dependencies */ /** * Internal dependencies */ function provider_createSlotRegistry() { const slots = (0,external_wp_compose_namespaceObject.observableMap)(); const fills = (0,external_wp_compose_namespaceObject.observableMap)(); function registerSlot(name, instance) { slots.set(name, instance); } function unregisterSlot(name, instance) { // If a previous instance of a Slot by this name unmounts, do nothing, // as the slot and its fills should only be removed for the current // known instance. if (slots.get(name) !== instance) { return; } slots.delete(name); } function registerFill(name, instance, children) { fills.set(name, [...(fills.get(name) || []), { instance, children }]); } function unregisterFill(name, instance) { const fillsForName = fills.get(name); if (!fillsForName) { return; } fills.set(name, fillsForName.filter(fill => fill.instance !== instance)); } function updateFill(name, instance, children) { const fillsForName = fills.get(name); if (!fillsForName) { return; } const fillForInstance = fillsForName.find(f => f.instance === instance); if (!fillForInstance) { return; } if (fillForInstance.children === children) { return; } fills.set(name, fillsForName.map(f => { if (f.instance === instance) { // Replace with new record with updated `children`. return { instance, children }; } return f; })); } return { slots, fills, registerSlot, unregisterSlot, registerFill, unregisterFill, updateFill }; } function provider_SlotFillProvider({ children }) { const [contextValue] = (0,external_wp_element_namespaceObject.useState)(provider_createSlotRegistry); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, { value: contextValue, children: children }); } /* harmony default export */ const provider = (provider_SlotFillProvider); ;// ./node_modules/@wordpress/components/build-module/slot-fill/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function slot_fill_Fill(props) { // We're adding both Fills here so they can register themselves before // their respective slot has been registered. Only the Fill that has a slot // will render. The other one will return null. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { ...props }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fill_Fill, { ...props })] }); } function UnforwardedSlot(props, ref) { const { bubblesVirtually, ...restProps } = props; if (bubblesVirtually) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(bubbles_virtually_slot, { ...restProps, ref: ref }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot, { ...restProps }); } const slot_fill_Slot = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSlot); function Provider({ children, passthrough = false }) { const parent = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context); if (!parent.isDefault && passthrough) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: children }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(provider, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SlotFillProvider, { children: children }) }); } Provider.displayName = 'SlotFillProvider'; function createSlotFill(key) { const baseName = typeof key === 'symbol' ? key.description : key; const FillComponent = props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_Fill, { name: key, ...props }); FillComponent.displayName = `${baseName}Fill`; const SlotComponent = props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_Slot, { name: key, ...props }); SlotComponent.displayName = `${baseName}Slot`; /** * @deprecated 6.8.0 * Please use `slotFill.name` instead of `slotFill.Slot.__unstableName`. */ SlotComponent.__unstableName = key; return { name: key, Fill: FillComponent, Slot: SlotComponent }; } ;// ./node_modules/@wordpress/components/build-module/popover/overlay-middlewares.js /** * External dependencies */ function overlayMiddlewares() { return [{ name: 'overlay', fn({ rects }) { return rects.reference; } }, floating_ui_dom_size({ apply({ rects, elements }) { var _elements$floating; const { firstElementChild } = (_elements$floating = elements.floating) !== null && _elements$floating !== void 0 ? _elements$floating : {}; // Only HTMLElement instances have the `style` property. if (!(firstElementChild instanceof HTMLElement)) { return; } // Reduce the height of the popover to the available space. Object.assign(firstElementChild.style, { width: `${rects.reference.width}px`, height: `${rects.reference.height}px` }); } })]; } ;// ./node_modules/@wordpress/components/build-module/popover/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Name of slot in which popover should fill. * * @type {string} */ const SLOT_NAME = 'Popover'; // An SVG displaying a triangle facing down, filled with a solid // color and bordered in such a way to create an arrow-like effect. // Keeping the SVG's viewbox squared simplify the arrow positioning // calculations. const ArrowTriangle = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 100 100", className: "components-popover__triangle", role: "presentation", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { className: "components-popover__triangle-bg", d: "M 0 0 L 50 50 L 100 0" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { className: "components-popover__triangle-border", d: "M 0 0 L 50 50 L 100 0", vectorEffect: "non-scaling-stroke" })] }); const slotNameContext = (0,external_wp_element_namespaceObject.createContext)(undefined); const fallbackContainerClassname = 'components-popover__fallback-container'; const getPopoverFallbackContainer = () => { let container = document.body.querySelector('.' + fallbackContainerClassname); if (!container) { container = document.createElement('div'); container.className = fallbackContainerClassname; document.body.append(container); } return container; }; const UnforwardedPopover = (props, forwardedRef) => { const { animate = true, headerTitle, constrainTabbing, onClose, children, className, noArrow = true, position, placement: placementProp = 'bottom-start', offset: offsetProp = 0, focusOnMount = 'firstElement', anchor, expandOnMobile, onFocusOutside, __unstableSlotName = SLOT_NAME, flip = true, resize = true, shift = false, inline = false, variant, style: contentStyle, // Deprecated props __unstableForcePosition, anchorRef, anchorRect, getAnchorRect, isAlternate, // Rest ...contentProps } = useContextSystem(props, 'Popover'); let computedFlipProp = flip; let computedResizeProp = resize; if (__unstableForcePosition !== undefined) { external_wp_deprecated_default()('`__unstableForcePosition` prop in wp.components.Popover', { since: '6.1', version: '6.3', alternative: '`flip={ false }` and `resize={ false }`' }); // Back-compat, set the `flip` and `resize` props // to `false` to replicate `__unstableForcePosition`. computedFlipProp = !__unstableForcePosition; computedResizeProp = !__unstableForcePosition; } if (anchorRef !== undefined) { external_wp_deprecated_default()('`anchorRef` prop in wp.components.Popover', { since: '6.1', alternative: '`anchor` prop' }); } if (anchorRect !== undefined) { external_wp_deprecated_default()('`anchorRect` prop in wp.components.Popover', { since: '6.1', alternative: '`anchor` prop' }); } if (getAnchorRect !== undefined) { external_wp_deprecated_default()('`getAnchorRect` prop in wp.components.Popover', { since: '6.1', alternative: '`anchor` prop' }); } const computedVariant = isAlternate ? 'toolbar' : variant; if (isAlternate !== undefined) { external_wp_deprecated_default()('`isAlternate` prop in wp.components.Popover', { since: '6.2', alternative: "`variant` prop with the `'toolbar'` value" }); } const arrowRef = (0,external_wp_element_namespaceObject.useRef)(null); const [fallbackReferenceElement, setFallbackReferenceElement] = (0,external_wp_element_namespaceObject.useState)(null); const anchorRefFallback = (0,external_wp_element_namespaceObject.useCallback)(node => { setFallbackReferenceElement(node); }, []); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const isExpanded = expandOnMobile && isMobileViewport; const hasArrow = !isExpanded && !noArrow; const normalizedPlacementFromProps = position ? positionToPlacement(position) : placementProp; const middleware = [...(placementProp === 'overlay' ? overlayMiddlewares() : []), offset(offsetProp), computedFlipProp && floating_ui_dom_flip(), computedResizeProp && floating_ui_dom_size({ apply(sizeProps) { var _refs$floating$curren; const { firstElementChild } = (_refs$floating$curren = refs.floating.current) !== null && _refs$floating$curren !== void 0 ? _refs$floating$curren : {}; // Only HTMLElement instances have the `style` property. if (!(firstElementChild instanceof HTMLElement)) { return; } // Reduce the height of the popover to the available space. Object.assign(firstElementChild.style, { maxHeight: `${sizeProps.availableHeight}px`, overflow: 'auto' }); } }), shift && floating_ui_dom_shift({ crossAxis: true, limiter: floating_ui_dom_limitShift(), padding: 1 // Necessary to avoid flickering at the edge of the viewport. }), floating_ui_react_dom_arrow({ element: arrowRef })]; const slotName = (0,external_wp_element_namespaceObject.useContext)(slotNameContext) || __unstableSlotName; const slot = useSlot(slotName); let onDialogClose; if (onClose || onFocusOutside) { onDialogClose = (type, event) => { // Ideally the popover should have just a single onClose prop and // not three props that potentially do the same thing. if (type === 'focus-outside' && onFocusOutside) { onFocusOutside(event); } else if (onClose) { onClose(); } }; } const [dialogRef, dialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ constrainTabbing, focusOnMount, __unstableOnClose: onDialogClose, // @ts-expect-error The __unstableOnClose property needs to be deprecated first (see https://github.com/WordPress/gutenberg/pull/27675) onClose: onDialogClose }); const { // Positioning coordinates x, y, // Object with "regular" refs to both "reference" and "floating" refs, // Type of CSS position property to use (absolute or fixed) strategy, update, placement: computedPlacement, middlewareData: { arrow: arrowData } } = useFloating({ placement: normalizedPlacementFromProps === 'overlay' ? undefined : normalizedPlacementFromProps, middleware, whileElementsMounted: (referenceParam, floatingParam, updateParam) => autoUpdate(referenceParam, floatingParam, updateParam, { layoutShift: false, animationFrame: true }) }); const arrowCallbackRef = (0,external_wp_element_namespaceObject.useCallback)(node => { arrowRef.current = node; update(); }, [update]); // When any of the possible anchor "sources" change, // recompute the reference element (real or virtual) and its owner document. const anchorRefTop = anchorRef?.top; const anchorRefBottom = anchorRef?.bottom; const anchorRefStartContainer = anchorRef?.startContainer; const anchorRefCurrent = anchorRef?.current; (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const resultingReferenceElement = getReferenceElement({ anchor, anchorRef, anchorRect, getAnchorRect, fallbackReferenceElement }); refs.setReference(resultingReferenceElement); }, [anchor, anchorRef, anchorRefTop, anchorRefBottom, anchorRefStartContainer, anchorRefCurrent, anchorRect, getAnchorRect, fallbackReferenceElement, refs]); const mergedFloatingRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([refs.setFloating, dialogRef, forwardedRef]); const style = isExpanded ? undefined : { position: strategy, top: 0, left: 0, // `x` and `y` are framer-motion specific props and are shorthands // for `translateX` and `translateY`. Currently it is not possible // to use `translateX` and `translateY` because those values would // be overridden by the return value of the // `placementToMotionAnimationProps` function. x: computePopoverPosition(x), y: computePopoverPosition(y) }; const shouldReduceMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const shouldAnimate = animate && !isExpanded && !shouldReduceMotion; const [animationFinished, setAnimationFinished] = (0,external_wp_element_namespaceObject.useState)(false); const { style: motionInlineStyles, ...otherMotionProps } = (0,external_wp_element_namespaceObject.useMemo)(() => placementToMotionAnimationProps(computedPlacement), [computedPlacement]); const animationProps = shouldAnimate ? { style: { ...contentStyle, ...motionInlineStyles, ...style }, onAnimationComplete: () => setAnimationFinished(true), ...otherMotionProps } : { animate: false, style: { ...contentStyle, ...style } }; // When Floating UI has finished positioning and Framer Motion has finished animating // the popover, add the `is-positioned` class to signal that all transitions have finished. const isPositioned = (!shouldAnimate || animationFinished) && x !== null && y !== null; let content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(motion.div, { className: dist_clsx(className, { 'is-expanded': isExpanded, 'is-positioned': isPositioned, // Use the 'alternate' classname for 'toolbar' variant for back compat. [`is-${computedVariant === 'toolbar' ? 'alternate' : computedVariant}`]: computedVariant }), ...animationProps, ...contentProps, ref: mergedFloatingRef, ...dialogProps, tabIndex: -1, children: [isExpanded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(scroll_lock, {}), isExpanded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-popover__header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-popover__header-title", children: headerTitle }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { className: "components-popover__close", size: "small", icon: library_close, onClick: onClose, label: (0,external_wp_i18n_namespaceObject.__)('Close') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-popover__content", children: children }), hasArrow && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: arrowCallbackRef, className: ['components-popover__arrow', `is-${computedPlacement.split('-')[0]}`].join(' '), style: { left: typeof arrowData?.x !== 'undefined' && Number.isFinite(arrowData.x) ? `${arrowData.x}px` : '', top: typeof arrowData?.y !== 'undefined' && Number.isFinite(arrowData.y) ? `${arrowData.y}px` : '' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ArrowTriangle, {}) })] }); const shouldRenderWithinSlot = slot.ref && !inline; const hasAnchor = anchorRef || anchorRect || anchor; if (shouldRenderWithinSlot) { content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_Fill, { name: slotName, children: content }); } else if (!inline) { content = (0,external_wp_element_namespaceObject.createPortal)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleProvider, { document: document, children: content }), getPopoverFallbackContainer()); } if (hasAnchor) { return content; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { ref: anchorRefFallback }), content] }); }; /** * `Popover` renders its content in a floating modal. If no explicit anchor is passed via props, it anchors to its parent element by default. * * ```jsx * import { Button, Popover } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyPopover = () => { * const [ isVisible, setIsVisible ] = useState( false ); * const toggleVisible = () => { * setIsVisible( ( state ) => ! state ); * }; * * return ( * <Button variant="secondary" onClick={ toggleVisible }> * Toggle Popover! * { isVisible && <Popover>Popover is toggled!</Popover> } * </Button> * ); * }; * ``` * */ const popover_Popover = contextConnect(UnforwardedPopover, 'Popover'); function PopoverSlot({ name = SLOT_NAME }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_Slot, { bubblesVirtually: true, name: name, className: "popover-slot", ref: ref }); } // @ts-expect-error For Legacy Reasons popover_Popover.Slot = (0,external_wp_element_namespaceObject.forwardRef)(PopoverSlot); // @ts-expect-error For Legacy Reasons popover_Popover.__unstableSlotNameProvider = slotNameContext.Provider; /* harmony default export */ const popover = (popover_Popover); ;// ./node_modules/@wordpress/components/build-module/autocomplete/autocompleter-ui.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ListBox({ items, onSelect, selectedIndex, instanceId, listBoxId, className, Component = 'div' }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { id: listBoxId, role: "listbox", className: "components-autocomplete__results", children: items.map((option, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { id: `components-autocomplete-item-${instanceId}-${option.key}`, role: "option", __next40pxDefaultSize: true, "aria-selected": index === selectedIndex, accessibleWhenDisabled: true, disabled: option.isDisabled, className: dist_clsx('components-autocomplete__result', className, { // Unused, for backwards compatibility. 'is-selected': index === selectedIndex }), variant: index === selectedIndex ? 'primary' : undefined, onClick: () => onSelect(option), children: option.label }, option.key)) }); } function getAutoCompleterUI(autocompleter) { var _autocompleter$useIte; const useItems = (_autocompleter$useIte = autocompleter.useItems) !== null && _autocompleter$useIte !== void 0 ? _autocompleter$useIte : getDefaultUseItems(autocompleter); function AutocompleterUI({ filterValue, instanceId, listBoxId, className, selectedIndex, onChangeOptions, onSelect, onReset, reset, contentRef }) { const [items] = useItems(filterValue); const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({ editableContentElement: contentRef.current }); const [needsA11yCompat, setNeedsA11yCompat] = (0,external_wp_element_namespaceObject.useState)(false); const popoverRef = (0,external_wp_element_namespaceObject.useRef)(null); const popoverRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([popoverRef, (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!contentRef.current) { return; } // If the popover is rendered in a different document than // the content, we need to duplicate the options list in the // content document so that it's available to the screen // readers, which check the DOM ID based aria-* attributes. setNeedsA11yCompat(node.ownerDocument !== contentRef.current.ownerDocument); }, [contentRef])]); useOnClickOutside(popoverRef, reset); const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); function announce(options) { if (!debouncedSpeak) { return; } if (!!options.length) { if (filterValue) { debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', options.length), options.length), 'assertive'); } else { debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('Initial %d result loaded. Type to filter all available results. Use up and down arrow keys to navigate.', 'Initial %d results loaded. Type to filter all available results. Use up and down arrow keys to navigate.', options.length), options.length), 'assertive'); } } else { debouncedSpeak((0,external_wp_i18n_namespaceObject.__)('No results.'), 'assertive'); } } (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { onChangeOptions(items); announce(items); // We want to avoid introducing unexpected side effects. // See https://github.com/WordPress/gutenberg/pull/41820 }, [items]); if (items.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(popover, { focusOnMount: false, onClose: onReset, placement: "top-start", className: "components-autocomplete__popover", anchor: popoverAnchor, ref: popoverRefs, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListBox, { items: items, onSelect: onSelect, selectedIndex: selectedIndex, instanceId: instanceId, listBoxId: listBoxId, className: className }) }), contentRef.current && needsA11yCompat && (0,external_ReactDOM_namespaceObject.createPortal)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListBox, { items: items, onSelect: onSelect, selectedIndex: selectedIndex, instanceId: instanceId, listBoxId: listBoxId, className: className, Component: visually_hidden_component }), contentRef.current.ownerDocument.body)] }); } return AutocompleterUI; } function useOnClickOutside(ref, handler) { (0,external_wp_element_namespaceObject.useEffect)(() => { const listener = event => { // Do nothing if clicking ref's element or descendent elements, or if the ref is not referencing an element if (!ref.current || ref.current.contains(event.target)) { return; } handler(event); }; document.addEventListener('mousedown', listener); document.addEventListener('touchstart', listener); return () => { document.removeEventListener('mousedown', listener); document.removeEventListener('touchstart', listener); }; }, [handler, ref]); } ;// ./node_modules/@wordpress/components/build-module/autocomplete/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const getNodeText = node => { if (node === null) { return ''; } switch (typeof node) { case 'string': case 'number': return node.toString(); break; case 'boolean': return ''; break; case 'object': { if (node instanceof Array) { return node.map(getNodeText).join(''); } if ('props' in node) { return getNodeText(node.props.children); } break; } default: return ''; } return ''; }; const EMPTY_FILTERED_OPTIONS = []; // Used for generating the instance ID const AUTOCOMPLETE_HOOK_REFERENCE = {}; function useAutocomplete({ record, onChange, onReplace, completers, contentRef }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(AUTOCOMPLETE_HOOK_REFERENCE); const [selectedIndex, setSelectedIndex] = (0,external_wp_element_namespaceObject.useState)(0); const [filteredOptions, setFilteredOptions] = (0,external_wp_element_namespaceObject.useState)(EMPTY_FILTERED_OPTIONS); const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); const [autocompleter, setAutocompleter] = (0,external_wp_element_namespaceObject.useState)(null); const [AutocompleterUI, setAutocompleterUI] = (0,external_wp_element_namespaceObject.useState)(null); const backspacingRef = (0,external_wp_element_namespaceObject.useRef)(false); function insertCompletion(replacement) { if (autocompleter === null) { return; } const end = record.start; const start = end - autocompleter.triggerPrefix.length - filterValue.length; const toInsert = (0,external_wp_richText_namespaceObject.create)({ html: (0,external_wp_element_namespaceObject.renderToString)(replacement) }); onChange((0,external_wp_richText_namespaceObject.insert)(record, toInsert, start, end)); } function select(option) { const { getOptionCompletion } = autocompleter || {}; if (option.isDisabled) { return; } if (getOptionCompletion) { const completion = getOptionCompletion(option.value, filterValue); const isCompletionObject = obj => { return obj !== null && typeof obj === 'object' && 'action' in obj && obj.action !== undefined && 'value' in obj && obj.value !== undefined; }; const completionObject = isCompletionObject(completion) ? completion : { action: 'insert-at-caret', value: completion }; if ('replace' === completionObject.action) { onReplace([completionObject.value]); // When replacing, the component will unmount, so don't reset // state (below) on an unmounted component. return; } else if ('insert-at-caret' === completionObject.action) { insertCompletion(completionObject.value); } } // Reset autocomplete state after insertion rather than before // so insertion events don't cause the completion menu to redisplay. reset(); } function reset() { setSelectedIndex(0); setFilteredOptions(EMPTY_FILTERED_OPTIONS); setFilterValue(''); setAutocompleter(null); setAutocompleterUI(null); } /** * Load options for an autocompleter. * * @param {Array} options */ function onChangeOptions(options) { setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0); setFilteredOptions(options); } function handleKeyDown(event) { backspacingRef.current = event.key === 'Backspace'; if (!autocompleter) { return; } if (filteredOptions.length === 0) { return; } if (event.defaultPrevented) { return; } switch (event.key) { case 'ArrowUp': { const newIndex = (selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1; setSelectedIndex(newIndex); // See the related PR as to why this is necessary: https://github.com/WordPress/gutenberg/pull/54902. if ((0,external_wp_keycodes_namespaceObject.isAppleOS)()) { (0,external_wp_a11y_namespaceObject.speak)(getNodeText(filteredOptions[newIndex].label), 'assertive'); } break; } case 'ArrowDown': { const newIndex = (selectedIndex + 1) % filteredOptions.length; setSelectedIndex(newIndex); if ((0,external_wp_keycodes_namespaceObject.isAppleOS)()) { (0,external_wp_a11y_namespaceObject.speak)(getNodeText(filteredOptions[newIndex].label), 'assertive'); } break; } case 'Escape': setAutocompleter(null); setAutocompleterUI(null); event.preventDefault(); break; case 'Enter': select(filteredOptions[selectedIndex]); break; case 'ArrowLeft': case 'ArrowRight': reset(); return; default: return; } // Any handled key should prevent original behavior. This relies on // the early return in the default case. event.preventDefault(); } // textContent is a primitive (string), memoizing is not strictly necessary // but this is a preemptive performance improvement, since the autocompleter // is a potential bottleneck for the editor type metric. const textContent = (0,external_wp_element_namespaceObject.useMemo)(() => { if ((0,external_wp_richText_namespaceObject.isCollapsed)(record)) { return (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, 0)); } return ''; }, [record]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!textContent) { if (autocompleter) { reset(); } return; } // Find the completer with the highest triggerPrefix index in the // textContent. const completer = completers.reduce((lastTrigger, currentCompleter) => { const triggerIndex = textContent.lastIndexOf(currentCompleter.triggerPrefix); const lastTriggerIndex = lastTrigger !== null ? textContent.lastIndexOf(lastTrigger.triggerPrefix) : -1; return triggerIndex > lastTriggerIndex ? currentCompleter : lastTrigger; }, null); if (!completer) { if (autocompleter) { reset(); } return; } const { allowContext, triggerPrefix } = completer; const triggerIndex = textContent.lastIndexOf(triggerPrefix); const textWithoutTrigger = textContent.slice(triggerIndex + triggerPrefix.length); const tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit. // This is a final barrier to prevent the effect from completing with // an extremely long string, which causes the editor to slow-down // significantly. This could happen, for example, if `matchingWhileBackspacing` // is true and one of the "words" end up being too long. If that's the case, // it will be caught by this guard. if (tooDistantFromTrigger) { return; } const mismatch = filteredOptions.length === 0; const wordsFromTrigger = textWithoutTrigger.split(/\s/); // We need to allow the effect to run when not backspacing and if there // was a mismatch. i.e when typing a trigger + the match string or when // clicking in an existing trigger word on the page. We do that if we // detect that we have one word from trigger in the current textual context. // // Ex.: "Some text @a" <-- "@a" will be detected as the trigger word and // allow the effect to run. It will run until there's a mismatch. const hasOneTriggerWord = wordsFromTrigger.length === 1; // This is used to allow the effect to run when backspacing and if // "touching" a word that "belongs" to a trigger. We consider a "trigger // word" any word up to the limit of 3 from the trigger character. // Anything beyond that is ignored if there's a mismatch. This allows // us to "escape" a mismatch when backspacing, but still imposing some // sane limits. // // Ex: "Some text @marcelo sekkkk" <--- "kkkk" caused a mismatch, but // if the user presses backspace here, it will show the completion popup again. const matchingWhileBackspacing = backspacingRef.current && wordsFromTrigger.length <= 3; if (mismatch && !(matchingWhileBackspacing || hasOneTriggerWord)) { if (autocompleter) { reset(); } return; } const textAfterSelection = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, undefined, (0,external_wp_richText_namespaceObject.getTextContent)(record).length)); if (allowContext && !allowContext(textContent.slice(0, triggerIndex), textAfterSelection)) { if (autocompleter) { reset(); } return; } if (/^\s/.test(textWithoutTrigger) || /\s\s+$/.test(textWithoutTrigger)) { if (autocompleter) { reset(); } return; } if (!/[\u0000-\uFFFF]*$/.test(textWithoutTrigger)) { if (autocompleter) { reset(); } return; } const safeTrigger = escapeRegExp(completer.triggerPrefix); const text = remove_accents_default()(textContent); const match = text.slice(text.lastIndexOf(completer.triggerPrefix)).match(new RegExp(`${safeTrigger}([\u0000-\uFFFF]*)$`)); const query = match && match[1]; setAutocompleter(completer); setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI); setFilterValue(query === null ? '' : query); // We want to avoid introducing unexpected side effects. // See https://github.com/WordPress/gutenberg/pull/41820 }, [textContent]); const { key: selectedKey = '' } = filteredOptions[selectedIndex] || {}; const { className } = autocompleter || {}; const isExpanded = !!autocompleter && filteredOptions.length > 0; const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : undefined; const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null; const hasSelection = record.start !== undefined; return { listBoxId, activeId, onKeyDown: withIgnoreIMEEvents(handleKeyDown), popover: hasSelection && AutocompleterUI && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AutocompleterUI, { className: className, filterValue: filterValue, instanceId: instanceId, listBoxId: listBoxId, selectedIndex: selectedIndex, onChangeOptions: onChangeOptions, onSelect: select, value: record, contentRef: contentRef, reset: reset }) }; } function useLastDifferentValue(value) { const history = (0,external_wp_element_namespaceObject.useRef)(new Set()); history.current.add(value); // Keep the history size to 2. if (history.current.size > 2) { history.current.delete(Array.from(history.current)[0]); } return Array.from(history.current)[0]; } function useAutocompleteProps(options) { const ref = (0,external_wp_element_namespaceObject.useRef)(null); const onKeyDownRef = (0,external_wp_element_namespaceObject.useRef)(); const { record } = options; const previousRecord = useLastDifferentValue(record); const { popover, listBoxId, activeId, onKeyDown } = useAutocomplete({ ...options, contentRef: ref }); onKeyDownRef.current = onKeyDown; const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useRefEffect)(element => { function _onKeyDown(event) { onKeyDownRef.current?.(event); } element.addEventListener('keydown', _onKeyDown); return () => { element.removeEventListener('keydown', _onKeyDown); }; }, [])]); // We only want to show the popover if the user has typed something. const didUserInput = record.text !== previousRecord?.text; if (!didUserInput) { return { ref: mergedRefs }; } return { ref: mergedRefs, children: popover, 'aria-autocomplete': listBoxId ? 'list' : undefined, 'aria-owns': listBoxId, 'aria-activedescendant': activeId }; } function Autocomplete({ children, isSelected, ...options }) { const { popover, ...props } = useAutocomplete(options); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [children(props), isSelected && popover] }); } ;// ./node_modules/@wordpress/components/build-module/base-control/hooks.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Generate props for the `BaseControl` and the inner control itself. * * Namely, it takes care of generating a unique `id`, properly associating it with the `label` and `help` elements. * * @param props */ function useBaseControlProps(props) { const { help, id: preferredId, ...restProps } = props; const uniqueId = (0,external_wp_compose_namespaceObject.useInstanceId)(base_control, 'wp-components-base-control', preferredId); return { baseControlProps: { id: uniqueId, help, ...restProps }, controlProps: { id: uniqueId, ...(!!help ? { 'aria-describedby': `${uniqueId}__help` } : {}) } }; } ;// ./node_modules/@wordpress/icons/build-module/library/link.js /** * WordPress dependencies */ const link_link = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); /* harmony default export */ const library_link = (link_link); ;// ./node_modules/@wordpress/icons/build-module/library/link-off.js /** * WordPress dependencies */ const linkOff = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z" }) }); /* harmony default export */ const link_off = (linkOff); ;// ./node_modules/@wordpress/components/build-module/border-box-control/styles.js function border_box_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const borderBoxControl = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0); const linkedBorderControl = () => /*#__PURE__*/emotion_react_browser_esm_css("flex:1;", rtl({ marginRight: '24px' })(), ";" + ( true ? "" : 0), true ? "" : 0); const wrapper = true ? { name: "bjn8wh", styles: "position:relative" } : 0; const borderBoxControlLinkedButton = size => { return /*#__PURE__*/emotion_react_browser_esm_css("position:absolute;top:", size === '__unstable-large' ? '8px' : '3px', ";", rtl({ right: 0 })(), " line-height:0;" + ( true ? "" : 0), true ? "" : 0); }; const borderBoxStyleWithFallback = border => { const { color = COLORS.gray[200], style = 'solid', width = config_values.borderWidth } = border || {}; const clampedWidth = width !== config_values.borderWidth ? `clamp(1px, ${width}, 10px)` : width; const hasVisibleBorder = !!width && width !== '0' || !!color; const borderStyle = hasVisibleBorder ? style || 'solid' : style; return `${color} ${borderStyle} ${clampedWidth}`; }; const borderBoxControlVisualizer = (borders, size) => { return /*#__PURE__*/emotion_react_browser_esm_css("position:absolute;top:", size === '__unstable-large' ? '20px' : '15px', ";right:", size === '__unstable-large' ? '39px' : '29px', ";bottom:", size === '__unstable-large' ? '20px' : '15px', ";left:", size === '__unstable-large' ? '39px' : '29px', ";border-top:", borderBoxStyleWithFallback(borders?.top), ";border-bottom:", borderBoxStyleWithFallback(borders?.bottom), ";", rtl({ borderLeft: borderBoxStyleWithFallback(borders?.left) })(), " ", rtl({ borderRight: borderBoxStyleWithFallback(borders?.right) })(), ";" + ( true ? "" : 0), true ? "" : 0); }; const borderBoxControlSplitControls = size => /*#__PURE__*/emotion_react_browser_esm_css("position:relative;flex:1;width:", size === '__unstable-large' ? undefined : '80%', ";" + ( true ? "" : 0), true ? "" : 0); const centeredBorderControl = true ? { name: "1nwbfnf", styles: "grid-column:span 2;margin:0 auto" } : 0; const rightBorderControl = () => /*#__PURE__*/emotion_react_browser_esm_css(rtl({ marginLeft: 'auto' })(), ";" + ( true ? "" : 0), true ? "" : 0); ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBorderBoxControlLinkedButton(props) { const { className, size = 'default', ...otherProps } = useContextSystem(props, 'BorderBoxControlLinkedButton'); // Generate class names. const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderBoxControlLinkedButton(size), className); }, [className, cx, size]); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/component.js /** * WordPress dependencies */ /** * Internal dependencies */ const BorderBoxControlLinkedButton = (props, forwardedRef) => { const { className, isLinked, ...buttonProps } = useBorderBoxControlLinkedButton(props); const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink sides') : (0,external_wp_i18n_namespaceObject.__)('Link sides'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { ...buttonProps, size: "small", icon: isLinked ? library_link : link_off, iconSize: 24, label: label, ref: forwardedRef, className: className }); }; const ConnectedBorderBoxControlLinkedButton = contextConnect(BorderBoxControlLinkedButton, 'BorderBoxControlLinkedButton'); /* harmony default export */ const border_box_control_linked_button_component = (ConnectedBorderBoxControlLinkedButton); ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBorderBoxControlVisualizer(props) { const { className, value, size = 'default', ...otherProps } = useContextSystem(props, 'BorderBoxControlVisualizer'); // Generate class names. const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderBoxControlVisualizer(value, size), className); }, [cx, className, value, size]); return { ...otherProps, className: classes, value }; } ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/component.js /** * Internal dependencies */ const BorderBoxControlVisualizer = (props, forwardedRef) => { const { value, ...otherProps } = useBorderBoxControlVisualizer(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...otherProps, ref: forwardedRef }); }; const ConnectedBorderBoxControlVisualizer = contextConnect(BorderBoxControlVisualizer, 'BorderBoxControlVisualizer'); /* harmony default export */ const border_box_control_visualizer_component = (ConnectedBorderBoxControlVisualizer); ;// ./node_modules/@wordpress/icons/build-module/library/line-solid.js /** * WordPress dependencies */ const lineSolid = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 11.25h14v1.5H5z" }) }); /* harmony default export */ const line_solid = (lineSolid); ;// ./node_modules/@wordpress/icons/build-module/library/line-dashed.js /** * WordPress dependencies */ const lineDashed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M5 11.25h3v1.5H5v-1.5zm5.5 0h3v1.5h-3v-1.5zm8.5 0h-3v1.5h3v-1.5z", clipRule: "evenodd" }) }); /* harmony default export */ const line_dashed = (lineDashed); ;// ./node_modules/@wordpress/icons/build-module/library/line-dotted.js /** * WordPress dependencies */ const lineDotted = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M5.25 11.25h1.5v1.5h-1.5v-1.5zm3 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5zm1.5 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5z", clipRule: "evenodd" }) }); /* harmony default export */ const line_dotted = (lineDotted); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/styles.js function toggle_group_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const toggleGroupControl = ({ isBlock, isDeselectable, size }) => /*#__PURE__*/emotion_react_browser_esm_css("background:", COLORS.ui.background, ";border:1px solid transparent;border-radius:", config_values.radiusSmall, ";display:inline-flex;min-width:0;position:relative;", toggleGroupControlSize(size), " ", !isDeselectable && enclosingBorders(isBlock), "@media not ( prefers-reduced-motion ){&[data-indicator-animated]::before{transition-property:transform,border-radius;transition-duration:0.2s;transition-timing-function:ease-out;}}&::before{content:'';position:absolute;pointer-events:none;background:", COLORS.theme.foreground, ";outline:2px solid transparent;outline-offset:-3px;--antialiasing-factor:100;border-radius:calc(\n\t\t\t\t", config_values.radiusXSmall, " /\n\t\t\t\t\t(\n\t\t\t\t\t\tvar( --selected-width, 0 ) /\n\t\t\t\t\t\t\tvar( --antialiasing-factor )\n\t\t\t\t\t)\n\t\t\t)/", config_values.radiusXSmall, ";left:-1px;width:calc( var( --antialiasing-factor ) * 1px );height:calc( var( --selected-height, 0 ) * 1px );transform-origin:left top;transform:translateX( calc( var( --selected-left, 0 ) * 1px ) ) scaleX(\n\t\t\t\tcalc(\n\t\t\t\t\tvar( --selected-width, 0 ) / var( --antialiasing-factor )\n\t\t\t\t)\n\t\t\t);}" + ( true ? "" : 0), true ? "" : 0); const enclosingBorders = isBlock => { const enclosingBorder = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", COLORS.ui.border, ";" + ( true ? "" : 0), true ? "" : 0); return /*#__PURE__*/emotion_react_browser_esm_css(isBlock && enclosingBorder, " &:hover{border-color:", COLORS.ui.borderHover, ";}&:focus-within{border-color:", COLORS.ui.borderFocus, ";box-shadow:", config_values.controlBoxShadowFocus, ";z-index:1;outline:2px solid transparent;outline-offset:-2px;}" + ( true ? "" : 0), true ? "" : 0); }; var styles_ref = true ? { name: "1aqh2c7", styles: "min-height:40px;padding:3px" } : 0; var _ref2 = true ? { name: "1ndywgm", styles: "min-height:36px;padding:2px" } : 0; const toggleGroupControlSize = size => { const styles = { default: _ref2, '__unstable-large': styles_ref }; return styles[size]; }; const toggle_group_control_styles_block = true ? { name: "7whenc", styles: "display:flex;width:100%" } : 0; const VisualLabelWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eakva830" } : 0)( true ? { name: "zjik7", styles: "display:flex" } : 0); ;// ./node_modules/@ariakit/core/esm/radio/radio-store.js "use client"; // src/radio/radio-store.ts function createRadioStore(_a = {}) { var props = _3YLGPPWQ_objRest(_a, []); var _a2; const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState(); const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true) })); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), { value: defaultValue( props.value, syncState == null ? void 0 : syncState.value, props.defaultValue, null ) }); const radio = createStore(initialState, composite, props.store); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite), radio), { setValue: (value) => radio.setState("value", value) }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/4BXJGRNH.js "use client"; // src/radio/radio-store.ts function useRadioStoreProps(store, update, props) { store = useCompositeStoreProps(store, update, props); useStoreProps(store, props, "value", "setValue"); return store; } function useRadioStore(props = {}) { const [store, update] = YV4JVR4I_useStore(createRadioStore, props); return useRadioStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/UVUMR3WP.js "use client"; // src/radio/radio-context.tsx var UVUMR3WP_ctx = createStoreContext( [CompositeContextProvider], [CompositeScopedContextProvider] ); var useRadioContext = UVUMR3WP_ctx.useContext; var useRadioScopedContext = UVUMR3WP_ctx.useScopedContext; var useRadioProviderContext = UVUMR3WP_ctx.useProviderContext; var RadioContextProvider = UVUMR3WP_ctx.ContextProvider; var RadioScopedContextProvider = UVUMR3WP_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/radio/radio-group.js "use client"; // src/radio/radio-group.tsx var radio_group_TagName = "div"; var useRadioGroup = createHook( function useRadioGroup2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useRadioProviderContext(); store = store || context; invariant( store, false && 0 ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RadioScopedContextProvider, { value: store, children: element }), [store] ); props = _3YLGPPWQ_spreadValues({ role: "radiogroup" }, props); props = useComposite(_3YLGPPWQ_spreadValues({ store }, props)); return props; } ); var RadioGroup = forwardRef2(function RadioGroup2(props) { const htmlProps = useRadioGroup(props); return LMDWO4NN_createElement(radio_group_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const ToggleGroupControlContext = (0,external_wp_element_namespaceObject.createContext)({}); const useToggleGroupControlContext = () => (0,external_wp_element_namespaceObject.useContext)(ToggleGroupControlContext); /* harmony default export */ const toggle_group_control_context = (ToggleGroupControlContext); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Used to determine, via an internal heuristics, whether an `undefined` value * received for the `value` prop should be interpreted as the component being * used in uncontrolled mode, or as an "empty" value for controlled mode. * * @param valueProp The received `value` */ function useComputeControlledOrUncontrolledValue(valueProp) { const isInitialRenderRef = (0,external_wp_element_namespaceObject.useRef)(true); const prevValueProp = (0,external_wp_compose_namespaceObject.usePrevious)(valueProp); const prevIsControlledRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isInitialRenderRef.current) { isInitialRenderRef.current = false; } }, []); // Assume the component is being used in controlled mode on the first re-render // that has a different `valueProp` from the previous render. const isControlled = prevIsControlledRef.current || !isInitialRenderRef.current && prevValueProp !== valueProp; (0,external_wp_element_namespaceObject.useEffect)(() => { prevIsControlledRef.current = isControlled; }, [isControlled]); if (isControlled) { // When in controlled mode, use `''` instead of `undefined` return { value: valueProp !== null && valueProp !== void 0 ? valueProp : '', defaultValue: undefined }; } // When in uncontrolled mode, the `value` should be intended as the initial value return { value: undefined, defaultValue: valueProp }; } ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/as-radio-group.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToggleGroupControlAsRadioGroup({ children, isAdaptiveWidth, label, onChange: onChangeProp, size, value: valueProp, id: idProp, setSelectedElement, ...otherProps }, forwardedRef) { const generatedId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlAsRadioGroup, 'toggle-group-control-as-radio-group'); const baseId = idProp || generatedId; // Use a heuristic to understand if the component is being used in controlled // or uncontrolled mode, and consequently: // - when controlled, convert `undefined` values to `''` (ie. "no value") // - use the `value` prop as the `defaultValue` when uncontrolled const { value, defaultValue } = useComputeControlledOrUncontrolledValue(valueProp); // `useRadioStore`'s `setValue` prop can be called with `null`, while // the component's `onChange` prop only expects `undefined` const wrappedOnChangeProp = onChangeProp ? v => { onChangeProp(v !== null && v !== void 0 ? v : undefined); } : undefined; const radio = useRadioStore({ defaultValue, value, setValue: wrappedOnChangeProp, rtl: (0,external_wp_i18n_namespaceObject.isRTL)() }); const selectedValue = useStoreState(radio, 'value'); const setValue = radio.setValue; // Ensures that the active id is also reset after the value is "reset" by the consumer. (0,external_wp_element_namespaceObject.useEffect)(() => { if (selectedValue === '') { radio.setActiveId(undefined); } }, [radio, selectedValue]); const groupContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ activeItemIsNotFirstItem: () => radio.getState().activeId !== radio.first(), baseId, isBlock: !isAdaptiveWidth, size, // @ts-expect-error - This is wrong and we should fix it. value: selectedValue, // @ts-expect-error - This is wrong and we should fix it. setValue, setSelectedElement }), [baseId, isAdaptiveWidth, radio, selectedValue, setSelectedElement, setValue, size]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_context.Provider, { value: groupContextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RadioGroup, { store: radio, "aria-label": label, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, {}), ...otherProps, id: baseId, ref: forwardedRef, children: children }) }); } const ToggleGroupControlAsRadioGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlAsRadioGroup); ;// ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js /** * WordPress dependencies */ /** * Simplified and improved implementation of useControlledState. * * @param props * @param props.defaultValue * @param props.value * @param props.onChange * @return The controlled value and the value setter. */ function useControlledValue({ defaultValue, onChange, value: valueProp }) { const hasValue = typeof valueProp !== 'undefined'; const initialValue = hasValue ? valueProp : defaultValue; const [state, setState] = (0,external_wp_element_namespaceObject.useState)(initialValue); const value = hasValue ? valueProp : state; let setValue; if (hasValue && typeof onChange === 'function') { setValue = onChange; } else if (!hasValue && typeof onChange === 'function') { setValue = nextValue => { onChange(nextValue); setState(nextValue); }; } else { setValue = setState; } return [value, setValue]; } ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/as-button-group.js /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToggleGroupControlAsButtonGroup({ children, isAdaptiveWidth, label, onChange, size, value: valueProp, id: idProp, setSelectedElement, ...otherProps }, forwardedRef) { const generatedId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlAsButtonGroup, 'toggle-group-control-as-button-group'); const baseId = idProp || generatedId; // Use a heuristic to understand if the component is being used in controlled // or uncontrolled mode, and consequently: // - when controlled, convert `undefined` values to `''` (ie. "no value") // - use the `value` prop as the `defaultValue` when uncontrolled const { value, defaultValue } = useComputeControlledOrUncontrolledValue(valueProp); const [selectedValue, setSelectedValue] = useControlledValue({ defaultValue, value, onChange }); const groupContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ baseId, value: selectedValue, setValue: setSelectedValue, isBlock: !isAdaptiveWidth, isDeselectable: true, size, setSelectedElement }), [baseId, selectedValue, setSelectedValue, isAdaptiveWidth, size, setSelectedElement]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_context.Provider, { value: groupContextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { "aria-label": label, ...otherProps, ref: forwardedRef, role: "group", children: children }) }); } const ToggleGroupControlAsButtonGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlAsButtonGroup); ;// ./node_modules/@wordpress/components/build-module/utils/element-rect.js /* eslint-disable jsdoc/require-param */ /** * WordPress dependencies */ /** * The position and dimensions of an element, relative to its offset parent. */ /** * An `ElementOffsetRect` object with all values set to zero. */ const NULL_ELEMENT_OFFSET_RECT = { element: undefined, top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; /** * Returns the position and dimensions of an element, relative to its offset * parent, with subpixel precision. Values reflect the real measures before any * potential scaling distortions along the X and Y axes. * * Useful in contexts where plain `getBoundingClientRect` calls or `ResizeObserver` * entries are not suitable, such as when the element is transformed, and when * `element.offset<Top|Left|Width|Height>` methods are not precise enough. * * **Note:** in some contexts, like when the scale is 0, this method will fail * because it's impossible to calculate a scaling ratio. When that happens, it * will return `undefined`. */ function getElementOffsetRect(element) { var _offsetParent$getBoun, _offsetParent$scrollL, _offsetParent$scrollT; // Position and dimension values computed with `getBoundingClientRect` have // subpixel precision, but are affected by distortions since they represent // the "real" measures, or in other words, the actual final values as rendered // by the browser. const rect = element.getBoundingClientRect(); if (rect.width === 0 || rect.height === 0) { return; } const offsetParent = element.offsetParent; const offsetParentRect = (_offsetParent$getBoun = offsetParent?.getBoundingClientRect()) !== null && _offsetParent$getBoun !== void 0 ? _offsetParent$getBoun : NULL_ELEMENT_OFFSET_RECT; const offsetParentScrollX = (_offsetParent$scrollL = offsetParent?.scrollLeft) !== null && _offsetParent$scrollL !== void 0 ? _offsetParent$scrollL : 0; const offsetParentScrollY = (_offsetParent$scrollT = offsetParent?.scrollTop) !== null && _offsetParent$scrollT !== void 0 ? _offsetParent$scrollT : 0; // Computed widths and heights have subpixel precision, and are not affected // by distortions. const computedWidth = parseFloat(getComputedStyle(element).width); const computedHeight = parseFloat(getComputedStyle(element).height); // We can obtain the current scale factor for the element by comparing "computed" // dimensions with the "real" ones. const scaleX = computedWidth / rect.width; const scaleY = computedHeight / rect.height; return { element, // To obtain the adjusted values for the position: // 1. Compute the element's position relative to the offset parent. // 2. Correct for the scale factor. // 3. Adjust for the scroll position of the offset parent. top: (rect.top - offsetParentRect?.top) * scaleY + offsetParentScrollY, right: (offsetParentRect?.right - rect.right) * scaleX - offsetParentScrollX, bottom: (offsetParentRect?.bottom - rect.bottom) * scaleY - offsetParentScrollY, left: (rect.left - offsetParentRect?.left) * scaleX + offsetParentScrollX, // Computed dimensions don't need any adjustments. width: computedWidth, height: computedHeight }; } const POLL_RATE = 100; /** * Tracks the position and dimensions of an element, relative to its offset * parent. The element can be changed dynamically. * * When no element is provided (`null` or `undefined`), the hook will return * a "null" rect, in which all values are `0` and `element` is `undefined`. * * **Note:** sometimes, the measurement will fail (see `getElementOffsetRect`'s * documentation for more details). When that happens, this hook will attempt * to measure again after a frame, and if that fails, it will poll every 100 * milliseconds until it succeeds. */ function useTrackElementOffsetRect(targetElement, deps = []) { const [indicatorPosition, setIndicatorPosition] = (0,external_wp_element_namespaceObject.useState)(NULL_ELEMENT_OFFSET_RECT); const intervalRef = (0,external_wp_element_namespaceObject.useRef)(); const measure = (0,external_wp_compose_namespaceObject.useEvent)(() => { // Check that the targetElement is still attached to the DOM, in case // it was removed since the last `measure` call. if (targetElement && targetElement.isConnected) { const elementOffsetRect = getElementOffsetRect(targetElement); if (elementOffsetRect) { setIndicatorPosition(elementOffsetRect); clearInterval(intervalRef.current); return true; } } else { clearInterval(intervalRef.current); } return false; }); const setElement = (0,external_wp_compose_namespaceObject.useResizeObserver)(() => { if (!measure()) { requestAnimationFrame(() => { if (!measure()) { intervalRef.current = setInterval(measure, POLL_RATE); } }); } }); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { setElement(targetElement); if (!targetElement) { setIndicatorPosition(NULL_ELEMENT_OFFSET_RECT); } }, [setElement, targetElement]); // Escape hatch to force a remeasurement when something else changes rather // than the target elements' ref or size (for example, the target element // can change its position within the tablist). (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { measure(); // `measure` is a stable function, so it's safe to omit it from the deps array. // deps can't be statically analyzed by ESLint }, deps); return indicatorPosition; } /* eslint-enable jsdoc/require-param */ ;// ./node_modules/@wordpress/components/build-module/utils/hooks/use-on-value-update.js /* eslint-disable jsdoc/require-param */ /** * WordPress dependencies */ /** * Context object for the `onUpdate` callback of `useOnValueUpdate`. */ /** * Calls the `onUpdate` callback when the `value` changes. */ function useOnValueUpdate( /** * The value to watch for changes. */ value, /** * Callback to fire when the value changes. */ onUpdate) { const previousValueRef = (0,external_wp_element_namespaceObject.useRef)(value); const updateCallbackEvent = (0,external_wp_compose_namespaceObject.useEvent)(onUpdate); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (previousValueRef.current !== value) { updateCallbackEvent({ previousValue: previousValueRef.current }); previousValueRef.current = value; } }, [updateCallbackEvent, value]); } /* eslint-enable jsdoc/require-param */ ;// ./node_modules/@wordpress/components/build-module/utils/hooks/use-animated-offset-rect.js /* eslint-disable jsdoc/require-param */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * A utility used to animate something in a container component based on the "offset * rect" (position relative to the container and size) of a subelement. For example, * this is useful to render an indicator for the selected option of a component, and * to animate it when the selected option changes. * * Takes in a container element and the up-to-date "offset rect" of the target * subelement, obtained with `useTrackElementOffsetRect`. Then it does the following: * * - Adds CSS variables with rect information to the container, so that the indicator * can be rendered and animated with them. These are kept up-to-date, enabling CSS * transitions on change. * - Sets an attribute (`data-subelement-animated` by default) when the tracked * element changes, so that the target (e.g. the indicator) can be animated to its * new size and position. * - Removes the attribute when the animation is done. * * The need for the attribute is due to the fact that the rect might update in * situations other than when the tracked element changes, e.g. the tracked element * might be resized. In such cases, there is no need to animate the indicator, and * the change in size or position of the indicator needs to be reflected immediately. */ function useAnimatedOffsetRect( /** * The container element. */ container, /** * The rect of the tracked element. */ rect, { prefix = 'subelement', dataAttribute = `${prefix}-animated`, transitionEndFilter = () => true, roundRect = false } = {}) { const setProperties = (0,external_wp_compose_namespaceObject.useEvent)(() => { Object.keys(rect).forEach(property => property !== 'element' && container?.style.setProperty(`--${prefix}-${property}`, String(roundRect ? Math.floor(rect[property]) : rect[property]))); }); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { setProperties(); }, [rect, setProperties]); useOnValueUpdate(rect.element, ({ previousValue }) => { // Only enable the animation when moving from one element to another. if (rect.element && previousValue) { container?.setAttribute(`data-${dataAttribute}`, ''); } }); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { function onTransitionEnd(event) { if (transitionEndFilter(event)) { container?.removeAttribute(`data-${dataAttribute}`); } } container?.addEventListener('transitionend', onTransitionEnd); return () => container?.removeEventListener('transitionend', onTransitionEnd); }, [dataAttribute, container, transitionEndFilter]); } /* eslint-enable jsdoc/require-param */ ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnconnectedToggleGroupControl(props, forwardedRef) { const { __nextHasNoMarginBottom = false, __next40pxDefaultSize = false, __shouldNotWarnDeprecated36pxSize, className, isAdaptiveWidth = false, isBlock = false, isDeselectable = false, label, hideLabelFromVision = false, help, onChange, size = 'default', value, children, ...otherProps } = useContextSystem(props, 'ToggleGroupControl'); const normalizedSize = __next40pxDefaultSize && size === 'default' ? '__unstable-large' : size; const [selectedElement, setSelectedElement] = (0,external_wp_element_namespaceObject.useState)(); const [controlElement, setControlElement] = (0,external_wp_element_namespaceObject.useState)(); const refs = (0,external_wp_compose_namespaceObject.useMergeRefs)([setControlElement, forwardedRef]); const selectedRect = useTrackElementOffsetRect(value !== null && value !== undefined ? selectedElement : undefined); useAnimatedOffsetRect(controlElement, selectedRect, { prefix: 'selected', dataAttribute: 'indicator-animated', transitionEndFilter: event => event.pseudoElement === '::before', roundRect: true }); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(toggleGroupControl({ isBlock, isDeselectable, size: normalizedSize }), isBlock && toggle_group_control_styles_block, className), [className, cx, isBlock, isDeselectable, normalizedSize]); const MainControl = isDeselectable ? ToggleGroupControlAsButtonGroup : ToggleGroupControlAsRadioGroup; maybeWarnDeprecated36pxSize({ componentName: 'ToggleGroupControl', size, __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(base_control, { help: help, __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "ToggleGroupControl", children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(VisualLabelWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control.VisualLabel, { children: label }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MainControl, { ...otherProps, setSelectedElement: setSelectedElement, className: classes, isAdaptiveWidth: isAdaptiveWidth, label: label, onChange: onChange, ref: refs, size: normalizedSize, value: value, children: children })] }); } /** * `ToggleGroupControl` is a form component that lets users choose options * represented in horizontal segments. To render options for this control use * `ToggleGroupControlOption` component. * * This component is intended for selecting a single persistent value from a set of options, * similar to a how a radio button group would work. If you simply want a toggle to switch between views, * use a `TabPanel` instead. * * Only use this control when you know for sure the labels of items inside won't * wrap. For items with longer labels, you can consider a `SelectControl` or a * `CustomSelectControl` component instead. * * ```jsx * import { * __experimentalToggleGroupControl as ToggleGroupControl, * __experimentalToggleGroupControlOption as ToggleGroupControlOption, * } from '@wordpress/components'; * * function Example() { * return ( * <ToggleGroupControl * label="my label" * value="vertical" * isBlock * __nextHasNoMarginBottom * __next40pxDefaultSize * > * <ToggleGroupControlOption value="horizontal" label="Horizontal" /> * <ToggleGroupControlOption value="vertical" label="Vertical" /> * </ToggleGroupControl> * ); * } * ``` */ const ToggleGroupControl = contextConnect(UnconnectedToggleGroupControl, 'ToggleGroupControl'); /* harmony default export */ const toggle_group_control_component = (ToggleGroupControl); ;// ./node_modules/@ariakit/react-core/esm/__chunks/NLEBE274.js "use client"; // src/radio/radio.tsx var NLEBE274_TagName = "input"; function getIsChecked(value, storeValue) { if (storeValue === void 0) return; if (value != null && storeValue != null) { return storeValue === value; } return !!storeValue; } function isNativeRadio(tagName, type) { return tagName === "input" && (!type || type === "radio"); } var useRadio = createHook(function useRadio2(_a) { var _b = _a, { store, name, value, checked } = _b, props = __objRest(_b, [ "store", "name", "value", "checked" ]); const context = useRadioContext(); store = store || context; const id = useId(props.id); const ref = (0,external_React_.useRef)(null); const isChecked = useStoreState( store, (state) => checked != null ? checked : getIsChecked(value, state == null ? void 0 : state.value) ); (0,external_React_.useEffect)(() => { if (!id) return; if (!isChecked) return; const isActiveItem = (store == null ? void 0 : store.getState().activeId) === id; if (isActiveItem) return; store == null ? void 0 : store.setActiveId(id); }, [store, isChecked, id]); const onChangeProp = props.onChange; const tagName = useTagName(ref, NLEBE274_TagName); const nativeRadio = isNativeRadio(tagName, props.type); const disabled = disabledFromProps(props); const [propertyUpdated, schedulePropertyUpdate] = useForceUpdate(); (0,external_React_.useEffect)(() => { const element = ref.current; if (!element) return; if (nativeRadio) return; if (isChecked !== void 0) { element.checked = isChecked; } if (name !== void 0) { element.name = name; } if (value !== void 0) { element.value = `${value}`; } }, [propertyUpdated, nativeRadio, isChecked, name, value]); const onChange = useEvent((event) => { if (disabled) { event.preventDefault(); event.stopPropagation(); return; } if ((store == null ? void 0 : store.getState().value) === value) return; if (!nativeRadio) { event.currentTarget.checked = true; schedulePropertyUpdate(); } onChangeProp == null ? void 0 : onChangeProp(event); if (event.defaultPrevented) return; store == null ? void 0 : store.setValue(value); }); const onClickProp = props.onClick; const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; if (nativeRadio) return; onChange(event); }); const onFocusProp = props.onFocus; const onFocus = useEvent((event) => { onFocusProp == null ? void 0 : onFocusProp(event); if (event.defaultPrevented) return; if (!nativeRadio) return; if (!store) return; const { moves, activeId } = store.getState(); if (!moves) return; if (id && activeId !== id) return; onChange(event); }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, role: !nativeRadio ? "radio" : void 0, type: nativeRadio ? "radio" : void 0, "aria-checked": isChecked }, props), { ref: useMergeRefs(ref, props.ref), onChange, onClick, onFocus }); props = useCompositeItem(_3YLGPPWQ_spreadValues({ store, clickOnEnter: !nativeRadio }, props)); return removeUndefinedValues(_3YLGPPWQ_spreadValues({ name: nativeRadio ? name : void 0, value: nativeRadio ? value : void 0, checked: isChecked }, props)); }); var Radio = memo2( forwardRef2(function Radio2(props) { const htmlProps = useRadio(props); return LMDWO4NN_createElement(NLEBE274_TagName, htmlProps); }) ); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js function toggle_group_control_option_base_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const LabelView = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "et6ln9s1" } : 0)( true ? { name: "sln1fl", styles: "display:inline-flex;max-width:100%;min-width:0;position:relative" } : 0); const labelBlock = true ? { name: "82a6rk", styles: "flex:1" } : 0; const buttonView = ({ isDeselectable, isIcon, isPressed, size }) => /*#__PURE__*/emotion_react_browser_esm_css("align-items:center;appearance:none;background:transparent;border:none;border-radius:", config_values.radiusXSmall, ";color:", COLORS.theme.gray[700], ";fill:currentColor;cursor:pointer;display:flex;font-family:inherit;height:100%;justify-content:center;line-height:100%;outline:none;padding:0 12px;position:relative;text-align:center;@media not ( prefers-reduced-motion ){transition:background ", config_values.transitionDurationFast, " linear,color ", config_values.transitionDurationFast, " linear,font-weight 60ms linear;}user-select:none;width:100%;z-index:2;&::-moz-focus-inner{border:0;}&[disabled]{opacity:0.4;cursor:default;}&:active{background:", COLORS.ui.background, ";}", isDeselectable && deselectable, " ", isIcon && isIconStyles({ size }), " ", isPressed && pressed, ";" + ( true ? "" : 0), true ? "" : 0); const pressed = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.theme.foregroundInverted, ";&:active{background:transparent;}" + ( true ? "" : 0), true ? "" : 0); const deselectable = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.theme.foreground, ";&:focus{box-shadow:inset 0 0 0 1px ", COLORS.ui.background, ",0 0 0 ", config_values.borderWidthFocus, " ", COLORS.theme.accent, ";outline:2px solid transparent;}" + ( true ? "" : 0), true ? "" : 0); const ButtonContentView = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "et6ln9s0" } : 0)("display:flex;font-size:", config_values.fontSize, ";line-height:1;" + ( true ? "" : 0)); const isIconStyles = ({ size = 'default' }) => { const iconButtonSizes = { default: '30px', '__unstable-large': '32px' }; return /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.theme.foreground, ";height:", iconButtonSizes[size], ";aspect-ratio:1;padding-left:0;padding-right:0;" + ( true ? "" : 0), true ? "" : 0); }; ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { /* ButtonContentView */ "Rp": component_ButtonContentView, /* LabelView */ "y0": component_LabelView } = toggle_group_control_option_base_styles_namespaceObject; const WithToolTip = ({ showTooltip, text, children }) => { if (showTooltip && text) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tooltip, { text: text, placement: "top", children: children }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: children }); }; function ToggleGroupControlOptionBase(props, forwardedRef) { const toggleGroupControlContext = useToggleGroupControlContext(); const id = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlOptionBase, toggleGroupControlContext.baseId || 'toggle-group-control-option-base'); const buttonProps = useContextSystem({ ...props, id }, 'ToggleGroupControlOptionBase'); const { isBlock = false, isDeselectable = false, size = 'default' } = toggleGroupControlContext; const { className, isIcon = false, value, children, showTooltip = false, disabled, ...otherButtonProps } = buttonProps; const isPressed = toggleGroupControlContext.value === value; const cx = useCx(); const labelViewClasses = (0,external_wp_element_namespaceObject.useMemo)(() => cx(isBlock && labelBlock), [cx, isBlock]); const itemClasses = (0,external_wp_element_namespaceObject.useMemo)(() => cx(buttonView({ isDeselectable, isIcon, isPressed, size }), className), [cx, isDeselectable, isIcon, isPressed, size, className]); const buttonOnClick = () => { if (isDeselectable && isPressed) { toggleGroupControlContext.setValue(undefined); } else { toggleGroupControlContext.setValue(value); } }; const commonProps = { ...otherButtonProps, className: itemClasses, 'data-value': value, ref: forwardedRef }; const labelRef = (0,external_wp_element_namespaceObject.useRef)(null); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (isPressed && labelRef.current) { toggleGroupControlContext.setSelectedElement(labelRef.current); } }, [isPressed, toggleGroupControlContext]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component_LabelView, { ref: labelRef, className: labelViewClasses, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WithToolTip, { showTooltip: showTooltip, text: otherButtonProps['aria-label'], children: isDeselectable ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { ...commonProps, disabled: disabled, "aria-pressed": isPressed, type: "button", onClick: buttonOnClick, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component_ButtonContentView, { children: children }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Radio, { disabled: disabled, onFocusVisible: () => { const selectedValueIsEmpty = toggleGroupControlContext.value === null || toggleGroupControlContext.value === ''; // Conditions ensure that the first visible focus to a radio group // without a selected option will not automatically select the option. if (!selectedValueIsEmpty || toggleGroupControlContext.activeItemIsNotFirstItem?.()) { toggleGroupControlContext.setValue(value); } }, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { type: "button", ...commonProps }), value: value, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component_ButtonContentView, { children: children }) }) }) }); } /** * `ToggleGroupControlOptionBase` is a form component and is meant to be used as an internal, * generic component for any children of `ToggleGroupControl`. * * @example * ```jsx * import { * __experimentalToggleGroupControl as ToggleGroupControl, * __experimentalToggleGroupControlOptionBase as ToggleGroupControlOptionBase, * } from '@wordpress/components'; * * function Example() { * return ( * <ToggleGroupControl label="my label" value="vertical" isBlock> * <ToggleGroupControlOption value="horizontal" label="Horizontal" /> * <ToggleGroupControlOption value="vertical" label="Vertical" /> * </ToggleGroupControl> * ); * } * ``` */ const ConnectedToggleGroupControlOptionBase = contextConnect(ToggleGroupControlOptionBase, 'ToggleGroupControlOptionBase'); /* harmony default export */ const toggle_group_control_option_base_component = (ConnectedToggleGroupControlOptionBase); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-icon/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToggleGroupControlOptionIcon(props, ref) { const { icon, label, ...restProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_option_base_component, { ...restProps, isIcon: true, "aria-label": label, showTooltip: true, ref: ref, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon }) }); } /** * `ToggleGroupControlOptionIcon` is a form component which is meant to be used as a * child of `ToggleGroupControl` and displays an icon. * * ```jsx * * import { * __experimentalToggleGroupControl as ToggleGroupControl, * __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, * from '@wordpress/components'; * import { formatLowercase, formatUppercase } from '@wordpress/icons'; * * function Example() { * return ( * <ToggleGroupControl __nextHasNoMarginBottom __next40pxDefaultSize> * <ToggleGroupControlOptionIcon * value="uppercase" * label="Uppercase" * icon={ formatUppercase } * /> * <ToggleGroupControlOptionIcon * value="lowercase" * label="Lowercase" * icon={ formatLowercase } * /> * </ToggleGroupControl> * ); * } * ``` */ const ToggleGroupControlOptionIcon = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlOptionIcon); /* harmony default export */ const toggle_group_control_option_icon_component = (ToggleGroupControlOptionIcon); ;// ./node_modules/@wordpress/components/build-module/border-control/border-control-style-picker/component.js /** * WordPress dependencies */ /** * Internal dependencies */ const BORDER_STYLES = [{ label: (0,external_wp_i18n_namespaceObject.__)('Solid'), icon: line_solid, value: 'solid' }, { label: (0,external_wp_i18n_namespaceObject.__)('Dashed'), icon: line_dashed, value: 'dashed' }, { label: (0,external_wp_i18n_namespaceObject.__)('Dotted'), icon: line_dotted, value: 'dotted' }]; function UnconnectedBorderControlStylePicker({ onChange, ...restProps }, forwardedRef) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_component, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, ref: forwardedRef, isDeselectable: true, onChange: value => { onChange?.(value); }, ...restProps, children: BORDER_STYLES.map(borderStyle => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_option_icon_component, { value: borderStyle.value, icon: borderStyle.icon, label: borderStyle.label }, borderStyle.value)) }); } const BorderControlStylePicker = contextConnect(UnconnectedBorderControlStylePicker, 'BorderControlStylePicker'); /* harmony default export */ const border_control_style_picker_component = (BorderControlStylePicker); ;// ./node_modules/@wordpress/components/build-module/color-indicator/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedColorIndicator(props, forwardedRef) { const { className, colorValue, ...additionalProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: dist_clsx('component-color-indicator', className), style: { background: colorValue }, ref: forwardedRef, ...additionalProps }); } /** * ColorIndicator is a React component that renders a specific color in a * circle. It's often used to summarize a collection of used colors in a child * component. * * ```jsx * import { ColorIndicator } from '@wordpress/components'; * * const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />; * ``` */ const ColorIndicator = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedColorIndicator); /* harmony default export */ const color_indicator = (ColorIndicator); ;// ./node_modules/colord/plugins/a11y.mjs var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} ;// ./node_modules/@wordpress/components/build-module/dropdown/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const UnconnectedDropdown = (props, forwardedRef) => { const { renderContent, renderToggle, className, contentClassName, expandOnMobile, headerTitle, focusOnMount, popoverProps, onClose, onToggle, style, open, defaultOpen, // Deprecated props position, // From context system variant } = useContextSystem(props, 'Dropdown'); if (position !== undefined) { external_wp_deprecated_default()('`position` prop in wp.components.Dropdown', { since: '6.2', alternative: '`popoverProps.placement` prop', hint: 'Note that the `position` prop will override any values passed through the `popoverProps.placement` prop.' }); } // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [fallbackPopoverAnchor, setFallbackPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const containerRef = (0,external_wp_element_namespaceObject.useRef)(); const [isOpen, setIsOpen] = useControlledValue({ defaultValue: defaultOpen, value: open, onChange: onToggle }); /** * Closes the popover when focus leaves it unless the toggle was pressed or * focus has moved to a separate dialog. The former is to let the toggle * handle closing the popover and the latter is to preserve presence in * case a dialog has opened, allowing focus to return when it's dismissed. */ function closeIfFocusOutside() { if (!containerRef.current) { return; } const { ownerDocument } = containerRef.current; const dialog = ownerDocument?.activeElement?.closest('[role="dialog"]'); if (!containerRef.current.contains(ownerDocument.activeElement) && (!dialog || dialog.contains(containerRef.current))) { close(); } } function close() { onClose?.(); setIsOpen(false); } const args = { isOpen: !!isOpen, onToggle: () => setIsOpen(!isOpen), onClose: close }; const popoverPropsHaveAnchor = !!popoverProps?.anchor || // Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and // be removed from `Popover` from WordPress 6.3 !!popoverProps?.anchorRef || !!popoverProps?.getAnchorRect || !!popoverProps?.anchorRect; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, forwardedRef, setFallbackPopoverAnchor]) // Some UAs focus the closest focusable parent when the toggle is // clicked. Making this div focusable ensures such UAs will focus // it and `closeIfFocusOutside` can tell if the toggle was clicked. , tabIndex: -1, style: style, children: [renderToggle(args), isOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(popover, { position: position, onClose: close, onFocusOutside: closeIfFocusOutside, expandOnMobile: expandOnMobile, headerTitle: headerTitle, focusOnMount: focusOnMount // This value is used to ensure that the dropdowns // align with the editor header by default. , offset: 13, anchor: !popoverPropsHaveAnchor ? fallbackPopoverAnchor : undefined, variant: variant, ...popoverProps, className: dist_clsx('components-dropdown__content', popoverProps?.className, contentClassName), children: renderContent(args) })] }); }; /** * Renders a button that opens a floating content modal when clicked. * * ```jsx * import { Button, Dropdown } from '@wordpress/components'; * * const MyDropdown = () => ( * <Dropdown * className="my-container-class-name" * contentClassName="my-dropdown-content-classname" * popoverProps={ { placement: 'bottom-start' } } * renderToggle={ ( { isOpen, onToggle } ) => ( * <Button * variant="primary" * onClick={ onToggle } * aria-expanded={ isOpen } * > * Toggle Dropdown! * </Button> * ) } * renderContent={ () => <div>This is the content of the dropdown.</div> } * /> * ); * ``` */ const Dropdown = contextConnect(UnconnectedDropdown, 'Dropdown'); /* harmony default export */ const dropdown = (Dropdown); ;// ./node_modules/@wordpress/components/build-module/input-control/input-suffix-wrapper.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedInputControlSuffixWrapper(props, forwardedRef) { const derivedProps = useContextSystem(props, 'InputControlSuffixWrapper'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrefixSuffixWrapper, { ...derivedProps, ref: forwardedRef }); } /** * A convenience wrapper for the `suffix` when you want to apply * standard padding in accordance with the size variant. * * ```jsx * import { * __experimentalInputControl as InputControl, * __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper, * } from '@wordpress/components'; * * <InputControl * suffix={<InputControlSuffixWrapper>%</InputControlSuffixWrapper>} * /> * ``` */ const InputControlSuffixWrapper = contextConnect(UnconnectedInputControlSuffixWrapper, 'InputControlSuffixWrapper'); /* harmony default export */ const input_suffix_wrapper = (InputControlSuffixWrapper); ;// ./node_modules/@wordpress/components/build-module/select-control/styles/select-control-styles.js function select_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const select_control_styles_disabledStyles = ({ disabled }) => { if (!disabled) { return ''; } return /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.ui.textDisabled, ";cursor:default;" + ( true ? "" : 0), true ? "" : 0); }; var select_control_styles_ref2 = true ? { name: "1lv1yo7", styles: "display:inline-flex" } : 0; const inputBaseVariantStyles = ({ variant }) => { if (variant === 'minimal') { return select_control_styles_ref2; } return ''; }; const StyledInputBase = /*#__PURE__*/emotion_styled_base_browser_esm(input_base, true ? { target: "e1mv6sxx3" } : 0)("color:", COLORS.theme.foreground, ";cursor:pointer;", select_control_styles_disabledStyles, " ", inputBaseVariantStyles, ";" + ( true ? "" : 0)); const select_control_styles_sizeStyles = ({ __next40pxDefaultSize, multiple, selectSize = 'default' }) => { if (multiple) { // When `multiple`, just use the native browser styles // without setting explicit height. return; } const sizes = { default: { height: 40, minHeight: 40, paddingTop: 0, paddingBottom: 0 }, small: { height: 24, minHeight: 24, paddingTop: 0, paddingBottom: 0 }, compact: { height: 32, minHeight: 32, paddingTop: 0, paddingBottom: 0 }, '__unstable-large': { height: 40, minHeight: 40, paddingTop: 0, paddingBottom: 0 } }; if (!__next40pxDefaultSize) { sizes.default = sizes.compact; } const style = sizes[selectSize] || sizes.default; return /*#__PURE__*/emotion_react_browser_esm_css(style, true ? "" : 0, true ? "" : 0); }; const chevronIconSize = 18; const sizePaddings = ({ __next40pxDefaultSize, multiple, selectSize = 'default' }) => { const padding = { default: config_values.controlPaddingX, small: config_values.controlPaddingXSmall, compact: config_values.controlPaddingXSmall, '__unstable-large': config_values.controlPaddingX }; if (!__next40pxDefaultSize) { padding.default = padding.compact; } const selectedPadding = padding[selectSize] || padding.default; return rtl({ paddingLeft: selectedPadding, paddingRight: selectedPadding + chevronIconSize, ...(multiple ? { paddingTop: selectedPadding, paddingBottom: selectedPadding } : {}) }); }; const overflowStyles = ({ multiple }) => { return { overflow: multiple ? 'auto' : 'hidden' }; }; var select_control_styles_ref = true ? { name: "n1jncc", styles: "field-sizing:content" } : 0; const variantStyles = ({ variant }) => { if (variant === 'minimal') { return select_control_styles_ref; } return ''; }; // TODO: Resolve need to use &&& to increase specificity // https://github.com/WordPress/gutenberg/issues/18483 const Select = /*#__PURE__*/emotion_styled_base_browser_esm("select", true ? { target: "e1mv6sxx2" } : 0)("&&&{appearance:none;background:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:currentColor;cursor:inherit;display:block;font-family:inherit;margin:0;width:100%;max-width:none;white-space:nowrap;text-overflow:ellipsis;", fontSizeStyles, ";", select_control_styles_sizeStyles, ";", sizePaddings, ";", overflowStyles, " ", variantStyles, ";}" + ( true ? "" : 0)); const DownArrowWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1mv6sxx1" } : 0)("margin-inline-end:", space(-1), ";line-height:0;path{fill:currentColor;}" + ( true ? "" : 0)); const InputControlSuffixWrapperWithClickThrough = /*#__PURE__*/emotion_styled_base_browser_esm(input_suffix_wrapper, true ? { target: "e1mv6sxx0" } : 0)("position:absolute;pointer-events:none;", rtl({ right: 0 }), ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/icons/build-module/icon/index.js /** * WordPress dependencies */ /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ /** * Return an SVG icon. * * @param {IconProps} props icon is the SVG component to render * size is a number specifying the icon size in pixels * Other props will be passed to wrapped SVG component * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. * * @return {JSX.Element} Icon component */ function icon_Icon({ icon, size = 24, ...props }, ref) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } /* harmony default export */ const icons_build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(icon_Icon)); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js /** * WordPress dependencies */ const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); /* harmony default export */ const chevron_down = (chevronDown); ;// ./node_modules/@wordpress/components/build-module/select-control/chevron-down.js /** * WordPress dependencies */ /** * Internal dependencies */ const SelectControlChevronDown = () => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputControlSuffixWrapperWithClickThrough, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DownArrowWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: chevron_down, size: chevronIconSize }) }) }); }; /* harmony default export */ const select_control_chevron_down = (SelectControlChevronDown); ;// ./node_modules/@wordpress/components/build-module/select-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function select_control_useUniqueId(idProp) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(SelectControl); const id = `inspector-select-control-${instanceId}`; return idProp || id; } function SelectOptions({ options }) { return options.map(({ id, label, value, ...optionProps }, index) => { const key = id || `${label}-${value}-${index}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("option", { value: value, ...optionProps, children: label }, key); }); } function UnforwardedSelectControl(props, ref) { const { className, disabled = false, help, hideLabelFromVision, id: idProp, label, multiple = false, onChange, options = [], size = 'default', value: valueProp, labelPosition = 'top', children, prefix, suffix, variant = 'default', __next40pxDefaultSize = false, __nextHasNoMarginBottom = false, __shouldNotWarnDeprecated36pxSize, ...restProps } = useDeprecated36pxDefaultSizeProp(props); const id = select_control_useUniqueId(idProp); const helpId = help ? `${id}__help` : undefined; // Disable reason: A select with an onchange throws a warning. if (!options?.length && !children) { return null; } const handleOnChange = event => { if (props.multiple) { const selectedOptions = Array.from(event.target.options).filter(({ selected }) => selected); const newValues = selectedOptions.map(({ value }) => value); props.onChange?.(newValues, { event }); return; } props.onChange?.(event.target.value, { event }); }; const classes = dist_clsx('components-select-control', className); maybeWarnDeprecated36pxSize({ componentName: 'SelectControl', __next40pxDefaultSize, size, __shouldNotWarnDeprecated36pxSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { help: help, id: id, __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "SelectControl", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledInputBase, { className: classes, disabled: disabled, hideLabelFromVision: hideLabelFromVision, id: id, isBorderless: variant === 'minimal', label: label, size: size, suffix: suffix || !multiple && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(select_control_chevron_down, {}), prefix: prefix, labelPosition: labelPosition, __unstableInputWidth: variant === 'minimal' ? 'auto' : undefined, variant: variant, __next40pxDefaultSize: __next40pxDefaultSize, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Select, { ...restProps, __next40pxDefaultSize: __next40pxDefaultSize, "aria-describedby": helpId, className: "components-select-control__input", disabled: disabled, id: id, multiple: multiple, onChange: handleOnChange, ref: ref, selectSize: size, value: valueProp, variant: variant, children: children || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectOptions, { options: options }) }) }) }); } /** * `SelectControl` allows users to select from a single or multiple option menu. * It functions as a wrapper around the browser's native `<select>` element. * * ```jsx * import { SelectControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MySelectControl = () => { * const [ size, setSize ] = useState( '50%' ); * * return ( * <SelectControl * __next40pxDefaultSize * __nextHasNoMarginBottom * label="Size" * value={ size } * options={ [ * { label: 'Big', value: '100%' }, * { label: 'Medium', value: '50%' }, * { label: 'Small', value: '25%' }, * ] } * onChange={ setSize } * /> * ); * }; * ``` */ const SelectControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSelectControl); /* harmony default export */ const select_control = (SelectControl); ;// ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-state.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @template T * @typedef Options * @property {T} [initial] Initial value * @property {T | ""} fallback Fallback value */ /** @type {Readonly<{ initial: undefined, fallback: '' }>} */ const defaultOptions = { initial: undefined, /** * Defaults to empty string, as that is preferred for usage with * <input />, <textarea />, and <select /> form elements. */ fallback: '' }; /** * Custom hooks for "controlled" components to track and consolidate internal * state and incoming values. This is useful for components that render * `input`, `textarea`, or `select` HTML elements. * * https://reactjs.org/docs/forms.html#controlled-components * * At first, a component using useControlledState receives an initial prop * value, which is used as initial internal state. * * This internal state can be maintained and updated without * relying on new incoming prop values. * * Unlike the basic useState hook, useControlledState's state can * be updated if a new incoming prop value is changed. * * @template T * * @param {T | undefined} currentState The current value. * @param {Options<T>} [options=defaultOptions] Additional options for the hook. * * @return {[T | "", (nextState: T) => void]} The controlled value and the value setter. */ function useControlledState(currentState, options = defaultOptions) { const { initial, fallback } = { ...defaultOptions, ...options }; const [internalState, setInternalState] = (0,external_wp_element_namespaceObject.useState)(currentState); const hasCurrentState = isValueDefined(currentState); /* * Resets internal state if value every changes from uncontrolled <-> controlled. */ (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasCurrentState && internalState) { setInternalState(undefined); } }, [hasCurrentState, internalState]); const state = getDefinedValue([currentState, internalState, initial], fallback); /* eslint-disable jsdoc/no-undefined-types */ /** @type {(nextState: T) => void} */ const setState = (0,external_wp_element_namespaceObject.useCallback)(nextState => { if (!hasCurrentState) { setInternalState(nextState); } }, [hasCurrentState]); /* eslint-enable jsdoc/no-undefined-types */ return [state, setState]; } /* harmony default export */ const use_controlled_state = (useControlledState); ;// ./node_modules/@wordpress/components/build-module/range-control/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A float supported clamp function for a specific value. * * @param value The value to clamp. * @param min The minimum value. * @param max The maximum value. * * @return A (float) number */ function floatClamp(value, min, max) { if (typeof value !== 'number') { return null; } return parseFloat(`${math_clamp(value, min, max)}`); } /** * Hook to store a clamped value, derived from props. * * @param settings * @return The controlled value and the value setter. */ function useControlledRangeValue(settings) { const { min, max, value: valueProp, initial } = settings; const [state, setInternalState] = use_controlled_state(floatClamp(valueProp, min, max), { initial: floatClamp(initial !== null && initial !== void 0 ? initial : null, min, max), fallback: null }); const setState = (0,external_wp_element_namespaceObject.useCallback)(nextValue => { if (nextValue === null) { setInternalState(null); } else { setInternalState(floatClamp(nextValue, min, max)); } }, [min, max, setInternalState]); // `state` can't be an empty string because we specified a fallback value of // `null` in `useControlledState` return [state, setState]; } ;// ./node_modules/@wordpress/components/build-module/range-control/styles/range-control-styles.js function range_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const rangeHeightValue = 30; const railHeight = 4; const rangeHeight = () => /*#__PURE__*/emotion_react_browser_esm_css({ height: rangeHeightValue, minHeight: rangeHeightValue }, true ? "" : 0, true ? "" : 0); const thumbSize = 12; const deprecatedHeight = ({ __next40pxDefaultSize }) => !__next40pxDefaultSize && /*#__PURE__*/emotion_react_browser_esm_css({ minHeight: rangeHeightValue }, true ? "" : 0, true ? "" : 0); const range_control_styles_Root = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1epgpqk14" } : 0)("-webkit-tap-highlight-color:transparent;align-items:center;display:flex;justify-content:flex-start;padding:0;position:relative;touch-action:none;width:100%;min-height:40px;", deprecatedHeight, ";" + ( true ? "" : 0)); const wrapperColor = ({ color = COLORS.ui.borderFocus }) => /*#__PURE__*/emotion_react_browser_esm_css({ color }, true ? "" : 0, true ? "" : 0); const wrapperMargin = ({ marks, __nextHasNoMarginBottom }) => { if (!__nextHasNoMarginBottom) { return /*#__PURE__*/emotion_react_browser_esm_css({ marginBottom: marks ? 16 : undefined }, true ? "" : 0, true ? "" : 0); } return ''; }; const range_control_styles_Wrapper = /*#__PURE__*/emotion_styled_base_browser_esm('div', true ? { shouldForwardProp: prop => !['color', '__nextHasNoMarginBottom', 'marks'].includes(prop), target: "e1epgpqk13" } : 0)("display:block;flex:1;position:relative;width:100%;", wrapperColor, ";", rangeHeight, ";", wrapperMargin, ";" + ( true ? "" : 0)); const BeforeIconWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk12" } : 0)("display:flex;margin-top:", railHeight, "px;", rtl({ marginRight: 6 }), ";" + ( true ? "" : 0)); const AfterIconWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk11" } : 0)("display:flex;margin-top:", railHeight, "px;", rtl({ marginLeft: 6 }), ";" + ( true ? "" : 0)); const railBackgroundColor = ({ disabled, railColor }) => { let background = railColor || ''; if (disabled) { background = COLORS.ui.backgroundDisabled; } return /*#__PURE__*/emotion_react_browser_esm_css({ background }, true ? "" : 0, true ? "" : 0); }; const Rail = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk10" } : 0)("background-color:", COLORS.gray[300], ";left:0;pointer-events:none;right:0;display:block;height:", railHeight, "px;position:absolute;margin-top:", (rangeHeightValue - railHeight) / 2, "px;top:0;border-radius:", config_values.radiusFull, ";", railBackgroundColor, ";" + ( true ? "" : 0)); const trackBackgroundColor = ({ disabled, trackColor }) => { let background = trackColor || 'currentColor'; if (disabled) { background = COLORS.gray[400]; } return /*#__PURE__*/emotion_react_browser_esm_css({ background }, true ? "" : 0, true ? "" : 0); }; const Track = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk9" } : 0)("background-color:currentColor;border-radius:", config_values.radiusFull, ";height:", railHeight, "px;pointer-events:none;display:block;position:absolute;margin-top:", (rangeHeightValue - railHeight) / 2, "px;top:0;.is-marked &{@media not ( prefers-reduced-motion ){transition:width ease 0.1s;}}", trackBackgroundColor, ";" + ( true ? "" : 0)); const MarksWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk8" } : 0)( true ? { name: "g5kg28", styles: "display:block;pointer-events:none;position:relative;width:100%;user-select:none;margin-top:17px" } : 0); const Mark = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk7" } : 0)("position:absolute;left:0;top:-4px;height:4px;width:2px;transform:translateX( -50% );background-color:", COLORS.ui.background, ";z-index:1;" + ( true ? "" : 0)); const markLabelFill = ({ isFilled }) => { return /*#__PURE__*/emotion_react_browser_esm_css({ color: isFilled ? COLORS.gray[700] : COLORS.gray[300] }, true ? "" : 0, true ? "" : 0); }; const MarkLabel = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk6" } : 0)("color:", COLORS.gray[300], ";font-size:11px;position:absolute;top:8px;white-space:nowrap;", rtl({ left: 0 }), ";", rtl({ transform: 'translateX( -50% )' }, { transform: 'translateX( 50% )' }), ";", markLabelFill, ";" + ( true ? "" : 0)); const thumbColor = ({ disabled }) => disabled ? /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.gray[400], ";" + ( true ? "" : 0), true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.theme.accent, ";" + ( true ? "" : 0), true ? "" : 0); const ThumbWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk5" } : 0)("align-items:center;display:flex;height:", thumbSize, "px;justify-content:center;margin-top:", (rangeHeightValue - thumbSize) / 2, "px;outline:0;pointer-events:none;position:absolute;top:0;user-select:none;width:", thumbSize, "px;border-radius:", config_values.radiusRound, ";z-index:3;.is-marked &{@media not ( prefers-reduced-motion ){transition:left ease 0.1s;}}", thumbColor, ";", rtl({ marginLeft: -10 }), ";", rtl({ transform: 'translateX( 4.5px )' }, { transform: 'translateX( -4.5px )' }), ";" + ( true ? "" : 0)); const thumbFocus = ({ isFocused }) => { return isFocused ? /*#__PURE__*/emotion_react_browser_esm_css("&::before{content:' ';position:absolute;background-color:", COLORS.theme.accent, ";opacity:0.4;border-radius:", config_values.radiusRound, ";height:", thumbSize + 8, "px;width:", thumbSize + 8, "px;top:-4px;left:-4px;}" + ( true ? "" : 0), true ? "" : 0) : ''; }; const Thumb = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk4" } : 0)("align-items:center;border-radius:", config_values.radiusRound, ";height:100%;outline:0;position:absolute;user-select:none;width:100%;box-shadow:", config_values.elevationXSmall, ";", thumbColor, ";", thumbFocus, ";" + ( true ? "" : 0)); const InputRange = /*#__PURE__*/emotion_styled_base_browser_esm("input", true ? { target: "e1epgpqk3" } : 0)("box-sizing:border-box;cursor:pointer;display:block;height:100%;left:0;margin:0 -", thumbSize / 2, "px;opacity:0;outline:none;position:absolute;right:0;top:0;width:calc( 100% + ", thumbSize, "px );" + ( true ? "" : 0)); const tooltipShow = ({ show }) => { return /*#__PURE__*/emotion_react_browser_esm_css("display:", show ? 'inline-block' : 'none', ";opacity:", show ? 1 : 0, ";@media not ( prefers-reduced-motion ){transition:opacity 120ms ease,display 120ms ease allow-discrete;}@starting-style{opacity:0;}" + ( true ? "" : 0), true ? "" : 0); }; var range_control_styles_ref = true ? { name: "1cypxip", styles: "top:-80%" } : 0; var range_control_styles_ref2 = true ? { name: "1lr98c4", styles: "bottom:-80%" } : 0; const tooltipPosition = ({ position }) => { const isBottom = position === 'bottom'; if (isBottom) { return range_control_styles_ref2; } return range_control_styles_ref; }; const range_control_styles_Tooltip = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk2" } : 0)("background:rgba( 0, 0, 0, 0.8 );border-radius:", config_values.radiusSmall, ";color:white;font-size:12px;min-width:32px;padding:4px 8px;pointer-events:none;position:absolute;text-align:center;user-select:none;line-height:1.4;", tooltipShow, ";", tooltipPosition, ";", rtl({ transform: 'translateX(-50%)' }, { transform: 'translateX(50%)' }), ";" + ( true ? "" : 0)); // @todo Refactor RangeControl with latest HStack configuration // @see: packages/components/src/h-stack const InputNumber = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? { target: "e1epgpqk1" } : 0)("display:inline-block;font-size:13px;margin-top:0;input[type='number']&{", rangeHeight, ";}", rtl({ marginLeft: `${space(4)} !important` }), ";" + ( true ? "" : 0)); const ActionRightWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1epgpqk0" } : 0)("display:block;margin-top:0;button,button.is-small{margin-left:0;", rangeHeight, ";}", rtl({ marginLeft: 8 }), ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/range-control/input-range.js /** * WordPress dependencies */ /** * Internal dependencies */ function input_range_InputRange(props, ref) { const { describedBy, label, value, ...otherProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputRange, { ...otherProps, "aria-describedby": describedBy, "aria-label": label, "aria-hidden": false, ref: ref, tabIndex: 0, type: "range", value: value }); } const input_range_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(input_range_InputRange); /* harmony default export */ const input_range = (input_range_ForwardedComponent); ;// ./node_modules/@wordpress/components/build-module/range-control/mark.js /** * External dependencies */ /** * Internal dependencies */ function RangeMark(props) { const { className, isFilled = false, label, style = {}, ...otherProps } = props; const classes = dist_clsx('components-range-control__mark', isFilled && 'is-filled', className); const labelClasses = dist_clsx('components-range-control__mark-label', isFilled && 'is-filled'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Mark, { ...otherProps, "aria-hidden": "true", className: classes, style: style }), label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MarkLabel, { "aria-hidden": "true", className: labelClasses, isFilled: isFilled, style: style, children: label })] }); } ;// ./node_modules/@wordpress/components/build-module/range-control/rail.js /** * WordPress dependencies */ /** * Internal dependencies */ function RangeRail(props) { const { disabled = false, marks = false, min = 0, max = 100, step = 1, value = 0, ...restProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Rail, { disabled: disabled, ...restProps }), marks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Marks, { disabled: disabled, marks: marks, min: min, max: max, step: step, value: value })] }); } function Marks(props) { const { disabled = false, marks = false, min = 0, max = 100, step: stepProp = 1, value = 0 } = props; const step = stepProp === 'any' ? 1 : stepProp; const marksData = useMarks({ marks, min, max, step, value }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MarksWrapper, { "aria-hidden": "true", className: "components-range-control__marks", children: marksData.map(mark => /*#__PURE__*/(0,external_React_.createElement)(RangeMark, { ...mark, key: mark.key, "aria-hidden": "true", disabled: disabled })) }); } function useMarks({ marks, min = 0, max = 100, step = 1, value = 0 }) { if (!marks) { return []; } const range = max - min; if (!Array.isArray(marks)) { marks = []; const count = 1 + Math.round(range / step); while (count > marks.push({ value: step * marks.length + min })) {} } const placedMarks = []; marks.forEach((mark, index) => { if (mark.value < min || mark.value > max) { return; } const key = `mark-${index}`; const isFilled = mark.value <= value; const offset = `${(mark.value - min) / range * 100}%`; const offsetStyle = { [(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: offset }; placedMarks.push({ ...mark, isFilled, key, style: offsetStyle }); }); return placedMarks; } ;// ./node_modules/@wordpress/components/build-module/range-control/tooltip.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function SimpleTooltip(props) { const { className, inputRef, tooltipPosition, show = false, style = {}, value = 0, renderTooltipContent = v => v, zIndex = 100, ...restProps } = props; const position = useTooltipPosition({ inputRef, tooltipPosition }); const classes = dist_clsx('components-simple-tooltip', className); const styles = { ...style, zIndex }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(range_control_styles_Tooltip, { ...restProps, "aria-hidden": "false", className: classes, position: position, show: show, role: "tooltip", style: styles, children: renderTooltipContent(value) }); } function useTooltipPosition({ inputRef, tooltipPosition }) { const [position, setPosition] = (0,external_wp_element_namespaceObject.useState)(); const setTooltipPosition = (0,external_wp_element_namespaceObject.useCallback)(() => { if (inputRef && inputRef.current) { setPosition(tooltipPosition); } }, [tooltipPosition, inputRef]); (0,external_wp_element_namespaceObject.useEffect)(() => { setTooltipPosition(); }, [setTooltipPosition]); (0,external_wp_element_namespaceObject.useEffect)(() => { window.addEventListener('resize', setTooltipPosition); return () => { window.removeEventListener('resize', setTooltipPosition); }; }); return position; } ;// ./node_modules/@wordpress/components/build-module/range-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const range_control_noop = () => {}; /** * Computes the value that `RangeControl` should reset to when pressing * the reset button. */ function computeResetValue({ resetFallbackValue, initialPosition }) { if (resetFallbackValue !== undefined) { return !Number.isNaN(resetFallbackValue) ? resetFallbackValue : null; } if (initialPosition !== undefined) { return !Number.isNaN(initialPosition) ? initialPosition : null; } return null; } function UnforwardedRangeControl(props, forwardedRef) { const { __nextHasNoMarginBottom = false, afterIcon, allowReset = false, beforeIcon, className, color: colorProp = COLORS.theme.accent, currentInput, disabled = false, help, hideLabelFromVision = false, initialPosition, isShiftStepEnabled = true, label, marks = false, max = 100, min = 0, onBlur = range_control_noop, onChange = range_control_noop, onFocus = range_control_noop, onMouseLeave = range_control_noop, onMouseMove = range_control_noop, railColor, renderTooltipContent = v => v, resetFallbackValue, __next40pxDefaultSize = false, shiftStep = 10, showTooltip: showTooltipProp, step = 1, trackColor, value: valueProp, withInputField = true, __shouldNotWarnDeprecated36pxSize, ...otherProps } = props; const [value, setValue] = useControlledRangeValue({ min, max, value: valueProp !== null && valueProp !== void 0 ? valueProp : null, initial: initialPosition }); const isResetPendent = (0,external_wp_element_namespaceObject.useRef)(false); let hasTooltip = showTooltipProp; let hasInputField = withInputField; if (step === 'any') { // The tooltip and number input field are hidden when the step is "any" // because the decimals get too lengthy to fit well. hasTooltip = false; hasInputField = false; } const [showTooltip, setShowTooltip] = (0,external_wp_element_namespaceObject.useState)(hasTooltip); const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); const inputRef = (0,external_wp_element_namespaceObject.useRef)(); const isCurrentlyFocused = inputRef.current?.matches(':focus'); const isThumbFocused = !disabled && isFocused; const isValueReset = value === null; const currentValue = value !== undefined ? value : currentInput; const inputSliderValue = isValueReset ? '' : currentValue; const rangeFillValue = isValueReset ? (max - min) / 2 + min : value; const fillValue = isValueReset ? 50 : (value - min) / (max - min) * 100; const fillValueOffset = `${math_clamp(fillValue, 0, 100)}%`; const classes = dist_clsx('components-range-control', className); const wrapperClasses = dist_clsx('components-range-control__wrapper', !!marks && 'is-marked'); const id = (0,external_wp_compose_namespaceObject.useInstanceId)(UnforwardedRangeControl, 'inspector-range-control'); const describedBy = !!help ? `${id}__help` : undefined; const enableTooltip = hasTooltip !== false && Number.isFinite(value); const handleOnRangeChange = event => { const nextValue = parseFloat(event.target.value); setValue(nextValue); onChange(nextValue); }; const handleOnChange = next => { // @ts-expect-error TODO: Investigate if it's problematic for setValue() to // potentially receive a NaN when next is undefined. let nextValue = parseFloat(next); setValue(nextValue); /* * Calls onChange only when nextValue is numeric * otherwise may queue a reset for the blur event. */ if (!isNaN(nextValue)) { if (nextValue < min || nextValue > max) { nextValue = floatClamp(nextValue, min, max); } onChange(nextValue); isResetPendent.current = false; } else if (allowReset) { isResetPendent.current = true; } }; const handleOnInputNumberBlur = () => { if (isResetPendent.current) { handleOnReset(); isResetPendent.current = false; } }; const handleOnReset = () => { // Reset to `resetFallbackValue` if defined, otherwise set internal value // to `null` — which, if propagated to the `value` prop, will cause // the value to be reset to the `initialPosition` prop if defined. const resetValue = Number.isNaN(resetFallbackValue) ? null : resetFallbackValue !== null && resetFallbackValue !== void 0 ? resetFallbackValue : null; setValue(resetValue); /** * Previously, this callback would always receive undefined as * an argument. This behavior is unexpected, specifically * when resetFallbackValue is defined. * * The value of undefined is not ideal. Passing it through * to internal <input /> elements would change it from a * controlled component to an uncontrolled component. * * For now, to minimize unexpected regressions, we're going to * preserve the undefined callback argument, except when a * resetFallbackValue is defined. */ onChange(resetValue !== null && resetValue !== void 0 ? resetValue : undefined); }; const handleShowTooltip = () => setShowTooltip(true); const handleHideTooltip = () => setShowTooltip(false); const handleOnBlur = event => { onBlur(event); setIsFocused(false); handleHideTooltip(); }; const handleOnFocus = event => { onFocus(event); setIsFocused(true); handleShowTooltip(); }; const offsetStyle = { [(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: fillValueOffset }; // Add default size deprecation warning. maybeWarnDeprecated36pxSize({ componentName: 'RangeControl', __next40pxDefaultSize, size: undefined, __shouldNotWarnDeprecated36pxSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "RangeControl", className: classes, label: label, hideLabelFromVision: hideLabelFromVision, id: `${id}`, help: help, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(range_control_styles_Root, { className: "components-range-control__root", __next40pxDefaultSize: __next40pxDefaultSize, children: [beforeIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BeforeIconWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: beforeIcon }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(range_control_styles_Wrapper, { __nextHasNoMarginBottom: __nextHasNoMarginBottom, className: wrapperClasses, color: colorProp, marks: !!marks, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(input_range, { ...otherProps, className: "components-range-control__slider", describedBy: describedBy, disabled: disabled, id: `${id}`, label: label, max: max, min: min, onBlur: handleOnBlur, onChange: handleOnRangeChange, onFocus: handleOnFocus, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([inputRef, forwardedRef]), step: step, value: inputSliderValue !== null && inputSliderValue !== void 0 ? inputSliderValue : undefined }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RangeRail, { "aria-hidden": true, disabled: disabled, marks: marks, max: max, min: min, railColor: railColor, step: step, value: rangeFillValue }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Track, { "aria-hidden": true, className: "components-range-control__track", disabled: disabled, style: { width: fillValueOffset }, trackColor: trackColor }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ThumbWrapper, { className: "components-range-control__thumb-wrapper", style: offsetStyle, disabled: disabled, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Thumb, { "aria-hidden": true, isFocused: isThumbFocused, disabled: disabled }) }), enableTooltip && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SimpleTooltip, { className: "components-range-control__tooltip", inputRef: inputRef, tooltipPosition: "bottom", renderTooltipContent: renderTooltipContent, show: isCurrentlyFocused || showTooltip, style: offsetStyle, value: value })] }), afterIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AfterIconWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: afterIcon }) }), hasInputField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputNumber, { "aria-label": label, className: "components-range-control__number", disabled: disabled, inputMode: "decimal", isShiftStepEnabled: isShiftStepEnabled, max: max, min: min, onBlur: handleOnInputNumberBlur, onChange: handleOnChange, shiftStep: shiftStep, size: __next40pxDefaultSize ? '__unstable-large' : 'default', __unstableInputWidth: __next40pxDefaultSize ? space(20) : space(16), step: step // @ts-expect-error TODO: Investigate if the `null` value is necessary , value: inputSliderValue, __shouldNotWarnDeprecated36pxSize: true }), allowReset && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionRightWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { className: "components-range-control__reset" // If the RangeControl itself is disabled, the reset button shouldn't be in the tab sequence. , accessibleWhenDisabled: !disabled // The reset button should be disabled if RangeControl itself is disabled, // or if the current `value` is equal to the value that would be currently // assigned when clicking the button. , disabled: disabled || value === computeResetValue({ resetFallbackValue, initialPosition }), variant: "secondary", size: "small", onClick: handleOnReset, children: (0,external_wp_i18n_namespaceObject.__)('Reset') }) })] }) }); } /** * RangeControls are used to make selections from a range of incremental values. * * ```jsx * import { RangeControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyRangeControl = () => { * const [ isChecked, setChecked ] = useState( true ); * return ( * <RangeControl * __nextHasNoMarginBottom * __next40pxDefaultSize * help="Please select how transparent you would like this." * initialPosition={50} * label="Opacity" * max={100} * min={0} * onChange={() => {}} * /> * ); * }; * ``` */ const RangeControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedRangeControl); /* harmony default export */ const range_control = (RangeControl); ;// ./node_modules/@wordpress/components/build-module/color-picker/styles.js /** * External dependencies */ /** * Internal dependencies */ const NumberControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? { target: "ez9hsf46" } : 0)("width:", space(24), ";" + ( true ? "" : 0)); const styles_SelectControl = /*#__PURE__*/emotion_styled_base_browser_esm(select_control, true ? { target: "ez9hsf45" } : 0)("margin-left:", space(-2), ";" + ( true ? "" : 0)); const styles_RangeControl = /*#__PURE__*/emotion_styled_base_browser_esm(range_control, true ? { target: "ez9hsf44" } : 0)("flex:1;margin-right:", space(2), ";" + ( true ? "" : 0)); // Make the Hue circle picker not go out of the bar. const interactiveHueStyles = ` .react-colorful__interactive { width: calc( 100% - ${space(2)} ); margin-left: ${space(1)}; }`; const AuxiliaryColorArtefactWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "ez9hsf43" } : 0)("padding-top:", space(2), ";padding-right:0;padding-left:0;padding-bottom:0;" + ( true ? "" : 0)); const AuxiliaryColorArtefactHStackHeader = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? { target: "ez9hsf42" } : 0)("padding-left:", space(4), ";padding-right:", space(4), ";" + ( true ? "" : 0)); const ColorInputWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? { target: "ez9hsf41" } : 0)("padding-top:", space(4), ";padding-left:", space(4), ";padding-right:", space(3), ";padding-bottom:", space(5), ";" + ( true ? "" : 0)); const ColorfulWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "ez9hsf40" } : 0)(boxSizingReset, ";width:216px;.react-colorful{display:flex;flex-direction:column;align-items:center;width:216px;height:auto;}.react-colorful__saturation{width:100%;border-radius:0;height:216px;margin-bottom:", space(4), ";border-bottom:none;}.react-colorful__hue,.react-colorful__alpha{width:184px;height:16px;border-radius:", config_values.radiusFull, ";margin-bottom:", space(2), ";}.react-colorful__pointer{height:16px;width:16px;border:none;box-shadow:0 0 2px 0 rgba( 0, 0, 0, 0.25 );outline:2px solid transparent;}.react-colorful__pointer-fill{box-shadow:inset 0 0 0 ", config_values.borderWidthFocus, " #fff;}", interactiveHueStyles, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/icons/build-module/library/copy.js /** * WordPress dependencies */ const copy_copy = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z" }) }); /* harmony default export */ const library_copy = (copy_copy); ;// ./node_modules/@wordpress/components/build-module/color-picker/color-copy-button.js /** * WordPress dependencies */ /** * Internal dependencies */ const ColorCopyButton = props => { const { color, colorType } = props; const [copiedColor, setCopiedColor] = (0,external_wp_element_namespaceObject.useState)(null); const copyTimerRef = (0,external_wp_element_namespaceObject.useRef)(); const copyRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => { switch (colorType) { case 'hsl': { return color.toHslString(); } case 'rgb': { return color.toRgbString(); } default: case 'hex': { return color.toHex(); } } }, () => { if (copyTimerRef.current) { clearTimeout(copyTimerRef.current); } setCopiedColor(color.toHex()); copyTimerRef.current = setTimeout(() => { setCopiedColor(null); copyTimerRef.current = undefined; }, 3000); }); (0,external_wp_element_namespaceObject.useEffect)(() => { // Clear copyTimerRef on component unmount. return () => { if (copyTimerRef.current) { clearTimeout(copyTimerRef.current); } }; }, []); const label = copiedColor === color.toHex() ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tooltip, { delay: 0, hideOnClick: false, text: label, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Button, { size: "compact", "aria-label": label, ref: copyRef, icon: library_copy, showTooltip: false }) }); }; ;// ./node_modules/@wordpress/components/build-module/input-control/input-prefix-wrapper.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedInputControlPrefixWrapper(props, forwardedRef) { const derivedProps = useContextSystem(props, 'InputControlPrefixWrapper'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrefixSuffixWrapper, { ...derivedProps, isPrefix: true, ref: forwardedRef }); } /** * A convenience wrapper for the `prefix` when you want to apply * standard padding in accordance with the size variant. * * ```jsx * import { * __experimentalInputControl as InputControl, * __experimentalInputControlPrefixWrapper as InputControlPrefixWrapper, * } from '@wordpress/components'; * * <InputControl * prefix={<InputControlPrefixWrapper>@</InputControlPrefixWrapper>} * /> * ``` */ const InputControlPrefixWrapper = contextConnect(UnconnectedInputControlPrefixWrapper, 'InputControlPrefixWrapper'); /* harmony default export */ const input_prefix_wrapper = (InputControlPrefixWrapper); ;// ./node_modules/@wordpress/components/build-module/color-picker/input-with-slider.js /** * Internal dependencies */ const InputWithSlider = ({ min, max, label, abbreviation, onChange, value }) => { const onNumberControlChange = newValue => { if (!newValue) { onChange(0); return; } if (typeof newValue === 'string') { onChange(parseInt(newValue, 10)); return; } onChange(newValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NumberControlWrapper, { __next40pxDefaultSize: true, min: min, max: max, label: label, hideLabelFromVision: true, value: value, onChange: onNumberControlChange, prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(input_prefix_wrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(text_component, { color: COLORS.theme.accent, lineHeight: 1, children: abbreviation }) }), spinControls: "none" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_RangeControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: label, hideLabelFromVision: true, min: min, max: max, value: value // @ts-expect-error // See: https://github.com/WordPress/gutenberg/pull/40535#issuecomment-1172418185 , onChange: onChange, withInputField: false })] }); }; ;// ./node_modules/@wordpress/components/build-module/color-picker/rgb-input.js /** * External dependencies */ /** * Internal dependencies */ const RgbInput = ({ color, onChange, enableAlpha }) => { const { r, g, b, a } = color.toRgb(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWithSlider, { min: 0, max: 255, label: "Red", abbreviation: "R", value: r, onChange: nextR => onChange(w({ r: nextR, g, b, a })) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWithSlider, { min: 0, max: 255, label: "Green", abbreviation: "G", value: g, onChange: nextG => onChange(w({ r, g: nextG, b, a })) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWithSlider, { min: 0, max: 255, label: "Blue", abbreviation: "B", value: b, onChange: nextB => onChange(w({ r, g, b: nextB, a })) }), enableAlpha && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWithSlider, { min: 0, max: 100, label: "Alpha", abbreviation: "A", value: Math.trunc(a * 100), onChange: nextA => onChange(w({ r, g, b, a: nextA / 100 })) })] }); }; ;// ./node_modules/@wordpress/components/build-module/color-picker/hsl-input.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const HslInput = ({ color, onChange, enableAlpha }) => { const colorPropHSLA = (0,external_wp_element_namespaceObject.useMemo)(() => color.toHsl(), [color]); const [internalHSLA, setInternalHSLA] = (0,external_wp_element_namespaceObject.useState)({ ...colorPropHSLA }); const isInternalColorSameAsReceivedColor = color.isEqual(w(internalHSLA)); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isInternalColorSameAsReceivedColor) { // Keep internal HSLA color up to date with the received color prop setInternalHSLA(colorPropHSLA); } }, [colorPropHSLA, isInternalColorSameAsReceivedColor]); // If the internal color is equal to the received color prop, we can use the // HSLA values from the local state which, compared to the received color prop, // retain more details about the actual H and S values that the user selected, // and thus allow for better UX when interacting with the H and S sliders. const colorValue = isInternalColorSameAsReceivedColor ? internalHSLA : colorPropHSLA; const updateHSLAValue = partialNewValue => { const nextOnChangeValue = w({ ...colorValue, ...partialNewValue }); // Fire `onChange` only if the resulting color is different from the // current one. // Otherwise, update the internal HSLA color to cause a re-render. if (!color.isEqual(nextOnChangeValue)) { onChange(nextOnChangeValue); } else { setInternalHSLA(prevHSLA => ({ ...prevHSLA, ...partialNewValue })); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWithSlider, { min: 0, max: 359, label: "Hue", abbreviation: "H", value: colorValue.h, onChange: nextH => { updateHSLAValue({ h: nextH }); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWithSlider, { min: 0, max: 100, label: "Saturation", abbreviation: "S", value: colorValue.s, onChange: nextS => { updateHSLAValue({ s: nextS }); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWithSlider, { min: 0, max: 100, label: "Lightness", abbreviation: "L", value: colorValue.l, onChange: nextL => { updateHSLAValue({ l: nextL }); } }), enableAlpha && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWithSlider, { min: 0, max: 100, label: "Alpha", abbreviation: "A", value: Math.trunc(100 * colorValue.a), onChange: nextA => { updateHSLAValue({ a: nextA / 100 }); } })] }); }; ;// ./node_modules/@wordpress/components/build-module/color-picker/hex-input.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const HexInput = ({ color, onChange, enableAlpha }) => { const handleChange = nextValue => { if (!nextValue) { return; } const hexValue = nextValue.startsWith('#') ? nextValue : '#' + nextValue; onChange(w(hexValue)); }; const stateReducer = (state, action) => { const nativeEvent = action.payload?.event?.nativeEvent; if ('insertFromPaste' !== nativeEvent?.inputType) { return { ...state }; } const value = state.value?.startsWith('#') ? state.value.slice(1).toUpperCase() : state.value?.toUpperCase(); return { ...state, value }; }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputControl, { prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(input_prefix_wrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(text_component, { color: COLORS.theme.accent, lineHeight: 1, children: "#" }) }), value: color.toHex().slice(1).toUpperCase(), onChange: handleChange, maxLength: enableAlpha ? 9 : 7, label: (0,external_wp_i18n_namespaceObject.__)('Hex color'), hideLabelFromVision: true, size: "__unstable-large", __unstableStateReducer: stateReducer, __unstableInputWidth: "9em" }); }; ;// ./node_modules/@wordpress/components/build-module/color-picker/color-input.js /** * Internal dependencies */ const ColorInput = ({ colorType, color, onChange, enableAlpha }) => { const props = { color, onChange, enableAlpha }; switch (colorType) { case 'hsl': return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HslInput, { ...props }); case 'rgb': return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RgbInput, { ...props }); default: case 'hex': return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HexInput, { ...props }); } }; ;// ./node_modules/react-colorful/dist/index.mjs function dist_u(){return(dist_u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function dist_c(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}function dist_i(e){var t=(0,external_React_.useRef)(e),n=(0,external_React_.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var dist_s=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},dist_f=function(e){return"touches"in e},dist_v=function(e){return e&&e.ownerDocument.defaultView||self},dist_d=function(e,r,t){var n=e.getBoundingClientRect(),o=dist_f(r)?function(e,r){for(var t=0;t<e.length;t++)if(e[t].identifier===r)return e[t];return e[0]}(r.touches,t):r;return{left:dist_s((o.pageX-(n.left+dist_v(e).pageXOffset))/n.width),top:dist_s((o.pageY-(n.top+dist_v(e).pageYOffset))/n.height)}},dist_h=function(e){!dist_f(e)&&e.preventDefault()},dist_m=external_React_.memo(function(o){var a=o.onMove,l=o.onKey,s=dist_c(o,["onMove","onKey"]),m=(0,external_React_.useRef)(null),g=dist_i(a),p=dist_i(l),b=(0,external_React_.useRef)(null),_=(0,external_React_.useRef)(!1),x=(0,external_React_.useMemo)(function(){var e=function(e){dist_h(e),(dist_f(e)?e.touches.length>0:e.buttons>0)&&m.current?g(dist_d(m.current,e,b.current)):t(!1)},r=function(){return t(!1)};function t(t){var n=_.current,o=dist_v(m.current),a=t?o.addEventListener:o.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",r)}return[function(e){var r=e.nativeEvent,n=m.current;if(n&&(dist_h(r),!function(e,r){return r&&!dist_f(e)}(r,_.current)&&n)){if(dist_f(r)){_.current=!0;var o=r.changedTouches||[];o.length&&(b.current=o[0].identifier)}n.focus(),g(dist_d(n,r,b.current)),t(!0)}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),p({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}))},t]},[p,g]),C=x[0],E=x[1],H=x[2];return (0,external_React_.useEffect)(function(){return H},[H]),external_React_.createElement("div",dist_u({},s,{onTouchStart:C,onMouseDown:C,className:"react-colorful__interactive",ref:m,onKeyDown:E,tabIndex:0,role:"slider"}))}),dist_g=function(e){return e.filter(Boolean).join(" ")},dist_p=function(r){var t=r.color,n=r.left,o=r.top,a=void 0===o?.5:o,l=dist_g(["react-colorful__pointer",r.className]);return external_React_.createElement("div",{className:l,style:{top:100*a+"%",left:100*n+"%"}},external_React_.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},dist_b=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=Math.pow(10,r)),Math.round(t*e)/t},_={grad:.9,turn:360,rad:360/(2*Math.PI)},dist_x=function(e){return L(C(e))},C=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?dist_b(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?dist_b(parseInt(e.substring(6,8),16)/255,2):1}},dist_E=function(e,r){return void 0===r&&(r="deg"),Number(e)*(_[r]||1)},dist_H=function(e){var r=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?dist_N({h:dist_E(r[1],r[2]),s:Number(r[3]),l:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},dist_M=dist_H,dist_N=function(e){var r=e.s,t=e.l;return{h:e.h,s:(r*=(t<50?t:100-t)/100)>0?2*r/(t+r)*100:0,v:t+r,a:e.a}},dist_w=function(e){return K(dist_I(e))},dist_y=function(e){var r=e.s,t=e.v,n=e.a,o=(200-r)*t/100;return{h:dist_b(e.h),s:dist_b(o>0&&o<200?r*t/100/(o<=100?o:200-o)*100:0),l:dist_b(o/2),a:dist_b(n,2)}},q=function(e){var r=dist_y(e);return"hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},dist_k=function(e){var r=dist_y(e);return"hsla("+r.h+", "+r.s+"%, "+r.l+"%, "+r.a+")"},dist_I=function(e){var r=e.h,t=e.s,n=e.v,o=e.a;r=r/360*6,t/=100,n/=100;var a=Math.floor(r),l=n*(1-t),u=n*(1-(r-a)*t),c=n*(1-(1-r+a)*t),i=a%6;return{r:dist_b(255*[n,u,l,l,c,n][i]),g:dist_b(255*[c,n,n,u,l,l][i]),b:dist_b(255*[l,l,c,n,n,u][i]),a:dist_b(o,2)}},O=function(e){var r=/hsva?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?A({h:dist_E(r[1],r[2]),s:Number(r[3]),v:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},dist_j=O,z=function(e){var r=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?L({r:Number(r[1])/(r[2]?100/255:1),g:Number(r[3])/(r[4]?100/255:1),b:Number(r[5])/(r[6]?100/255:1),a:void 0===r[7]?1:Number(r[7])/(r[8]?100:1)}):{h:0,s:0,v:0,a:1}},B=z,D=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},K=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=o<1?D(dist_b(255*o)):"";return"#"+D(r)+D(t)+D(n)+a},L=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=Math.max(r,t,n),l=a-Math.min(r,t,n),u=l?a===r?(t-n)/l:a===t?2+(n-r)/l:4+(r-t)/l:0;return{h:dist_b(60*(u<0?u+6:u)),s:dist_b(a?l/a*100:0),v:dist_b(a/255*100),a:o}},A=function(e){return{h:dist_b(e.h),s:dist_b(e.s),v:dist_b(e.v),a:dist_b(e.a,2)}},dist_S=external_React_.memo(function(r){var t=r.hue,n=r.onChange,o=dist_g(["react-colorful__hue",r.className]);return external_React_.createElement("div",{className:o},external_React_.createElement(dist_m,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:dist_s(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":dist_b(t),"aria-valuemax":"360","aria-valuemin":"0"},external_React_.createElement(dist_p,{className:"react-colorful__hue-pointer",left:t/360,color:q({h:t,s:100,v:100,a:1})})))}),T=external_React_.memo(function(r){var t=r.hsva,n=r.onChange,o={backgroundColor:q({h:t.h,s:100,v:100,a:1})};return external_React_.createElement("div",{className:"react-colorful__saturation",style:o},external_React_.createElement(dist_m,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:dist_s(t.s+100*e.left,0,100),v:dist_s(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+dist_b(t.s)+"%, Brightness "+dist_b(t.v)+"%"},external_React_.createElement(dist_p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:q(t)})))}),F=function(e,r){if(e===r)return!0;for(var t in e)if(e[t]!==r[t])return!1;return!0},P=function(e,r){return e.replace(/\s/g,"")===r.replace(/\s/g,"")},X=function(e,r){return e.toLowerCase()===r.toLowerCase()||F(C(e),C(r))};function Y(e,t,l){var u=dist_i(l),c=(0,external_React_.useState)(function(){return e.toHsva(t)}),s=c[0],f=c[1],v=(0,external_React_.useRef)({color:t,hsva:s});(0,external_React_.useEffect)(function(){if(!e.equal(t,v.current.color)){var r=e.toHsva(t);v.current={hsva:r,color:t},f(r)}},[t,e]),(0,external_React_.useEffect)(function(){var r;F(s,v.current.hsva)||e.equal(r=e.fromHsva(s),v.current.color)||(v.current={hsva:s,color:r},u(r))},[s,e,u]);var d=(0,external_React_.useCallback)(function(e){f(function(r){return Object.assign({},r,e)})},[]);return[s,d]}var R,dist_V="undefined"!=typeof window?external_React_.useLayoutEffect:external_React_.useEffect,dist_$=function(){return R||( true?__webpack_require__.nc:0)},G=function(e){R=e},J=new Map,Q=function(e){dist_V(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!J.has(r)){var t=r.createElement("style");t.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',J.set(r,t);var n=dist_$();n&&t.setAttribute("nonce",n),r.head.appendChild(t)}},[])},U=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=dist_c(t,["className","colorModel","color","onChange"]),f=(0,external_React_.useRef)(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=dist_g(["react-colorful",n]);return external_React_.createElement("div",dist_u({},s,{ref:f,className:m}),external_React_.createElement(T,{hsva:d,onChange:h}),external_React_.createElement(dist_S,{hue:d.h,onChange:h,className:"react-colorful__last-control"}))},W={defaultColor:"000",toHsva:dist_x,fromHsva:function(e){return dist_w({h:e.h,s:e.s,v:e.v,a:1})},equal:X},Z=function(r){return e.createElement(U,dist_u({},r,{colorModel:W}))},ee=function(r){var t=r.className,n=r.hsva,o=r.onChange,a={backgroundImage:"linear-gradient(90deg, "+dist_k(Object.assign({},n,{a:0}))+", "+dist_k(Object.assign({},n,{a:1}))+")"},l=dist_g(["react-colorful__alpha",t]),u=dist_b(100*n.a);return external_React_.createElement("div",{className:l},external_React_.createElement("div",{className:"react-colorful__alpha-gradient",style:a}),external_React_.createElement(dist_m,{onMove:function(e){o({a:e.left})},onKey:function(e){o({a:dist_s(n.a+e.left)})},"aria-label":"Alpha","aria-valuetext":u+"%","aria-valuenow":u,"aria-valuemin":"0","aria-valuemax":"100"},external_React_.createElement(dist_p,{className:"react-colorful__alpha-pointer",left:n.a,color:dist_k(n)})))},re=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=dist_c(t,["className","colorModel","color","onChange"]),f=(0,external_React_.useRef)(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=dist_g(["react-colorful",n]);return external_React_.createElement("div",dist_u({},s,{ref:f,className:m}),external_React_.createElement(T,{hsva:d,onChange:h}),external_React_.createElement(dist_S,{hue:d.h,onChange:h}),external_React_.createElement(ee,{hsva:d,onChange:h,className:"react-colorful__last-control"}))},te={defaultColor:"0001",toHsva:dist_x,fromHsva:dist_w,equal:X},ne=function(r){return e.createElement(re,dist_u({},r,{colorModel:te}))},oe={defaultColor:{h:0,s:0,l:0,a:1},toHsva:dist_N,fromHsva:dist_y,equal:F},ae=function(r){return e.createElement(re,dist_u({},r,{colorModel:oe}))},le={defaultColor:"hsla(0, 0%, 0%, 1)",toHsva:dist_H,fromHsva:dist_k,equal:P},ue=function(r){return e.createElement(re,dist_u({},r,{colorModel:le}))},ce={defaultColor:{h:0,s:0,l:0},toHsva:function(e){return dist_N({h:e.h,s:e.s,l:e.l,a:1})},fromHsva:function(e){return{h:(r=dist_y(e)).h,s:r.s,l:r.l};var r},equal:F},ie=function(r){return e.createElement(U,dist_u({},r,{colorModel:ce}))},se={defaultColor:"hsl(0, 0%, 0%)",toHsva:dist_M,fromHsva:q,equal:P},fe=function(r){return e.createElement(U,dist_u({},r,{colorModel:se}))},ve={defaultColor:{h:0,s:0,v:0,a:1},toHsva:function(e){return e},fromHsva:A,equal:F},de=function(r){return e.createElement(re,dist_u({},r,{colorModel:ve}))},he={defaultColor:"hsva(0, 0%, 0%, 1)",toHsva:O,fromHsva:function(e){var r=A(e);return"hsva("+r.h+", "+r.s+"%, "+r.v+"%, "+r.a+")"},equal:P},me=function(r){return e.createElement(re,dist_u({},r,{colorModel:he}))},ge={defaultColor:{h:0,s:0,v:0},toHsva:function(e){return{h:e.h,s:e.s,v:e.v,a:1}},fromHsva:function(e){var r=A(e);return{h:r.h,s:r.s,v:r.v}},equal:F},pe=function(r){return e.createElement(U,dist_u({},r,{colorModel:ge}))},be={defaultColor:"hsv(0, 0%, 0%)",toHsva:dist_j,fromHsva:function(e){var r=A(e);return"hsv("+r.h+", "+r.s+"%, "+r.v+"%)"},equal:P},_e=function(r){return e.createElement(U,dist_u({},r,{colorModel:be}))},xe={defaultColor:{r:0,g:0,b:0,a:1},toHsva:L,fromHsva:dist_I,equal:F},Ce=function(r){return e.createElement(re,dist_u({},r,{colorModel:xe}))},Ee={defaultColor:"rgba(0, 0, 0, 1)",toHsva:z,fromHsva:function(e){var r=dist_I(e);return"rgba("+r.r+", "+r.g+", "+r.b+", "+r.a+")"},equal:P},He=function(r){return external_React_.createElement(re,dist_u({},r,{colorModel:Ee}))},Me={defaultColor:{r:0,g:0,b:0},toHsva:function(e){return L({r:e.r,g:e.g,b:e.b,a:1})},fromHsva:function(e){return{r:(r=dist_I(e)).r,g:r.g,b:r.b};var r},equal:F},Ne=function(r){return e.createElement(U,dist_u({},r,{colorModel:Me}))},we={defaultColor:"rgb(0, 0, 0)",toHsva:B,fromHsva:function(e){var r=dist_I(e);return"rgb("+r.r+", "+r.g+", "+r.b+")"},equal:P},ye=function(r){return external_React_.createElement(U,dist_u({},r,{colorModel:we}))},qe=/^#?([0-9A-F]{3,8})$/i,ke=function(r){var t=r.color,l=void 0===t?"":t,s=r.onChange,f=r.onBlur,v=r.escape,d=r.validate,h=r.format,m=r.process,g=dist_c(r,["color","onChange","onBlur","escape","validate","format","process"]),p=o(function(){return v(l)}),b=p[0],_=p[1],x=dist_i(s),C=dist_i(f),E=a(function(e){var r=v(e.target.value);_(r),d(r)&&x(m?m(r):r)},[v,m,d,x]),H=a(function(e){d(e.target.value)||_(v(l)),C(e)},[l,v,d,C]);return n(function(){_(v(l))},[l,v]),e.createElement("input",dist_u({},g,{value:h?h(b):b,spellCheck:"false",onChange:E,onBlur:H}))},Ie=function(e){return"#"+e},Oe=function(r){var t=r.prefixed,n=r.alpha,o=dist_c(r,["prefixed","alpha"]),l=a(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),i=a(function(e){return function(e,r){var t=qe.exec(e),n=t?t[1].length:0;return 3===n||6===n||!!r&&4===n||!!r&&8===n}(e,n)},[n]);return e.createElement(ke,dist_u({},o,{escape:l,format:t?Ie:void 0,process:Ie,validate:i}))}; //# sourceMappingURL=index.module.js.map ;// ./node_modules/@wordpress/components/build-module/color-picker/picker.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const Picker = ({ color, enableAlpha, onChange }) => { const Component = enableAlpha ? He : ye; const rgbColor = (0,external_wp_element_namespaceObject.useMemo)(() => color.toRgbString(), [color]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { color: rgbColor, onChange: nextColor => { onChange(w(nextColor)); } // Pointer capture fortifies drag gestures so that they continue to // work while dragging outside the component over objects like // iframes. If a newer version of react-colorful begins to employ // pointer capture this will be redundant and should be removed. , onPointerDown: ({ currentTarget, pointerId }) => { currentTarget.setPointerCapture(pointerId); }, onPointerUp: ({ currentTarget, pointerId }) => { currentTarget.releasePointerCapture(pointerId); } }); }; ;// ./node_modules/@wordpress/components/build-module/color-picker/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ k([names]); const options = [{ label: 'RGB', value: 'rgb' }, { label: 'HSL', value: 'hsl' }, { label: 'Hex', value: 'hex' }]; const UnconnectedColorPicker = (props, forwardedRef) => { const { enableAlpha = false, color: colorProp, onChange, defaultValue = '#fff', copyFormat, ...divProps } = useContextSystem(props, 'ColorPicker'); // Use a safe default value for the color and remove the possibility of `undefined`. const [color, setColor] = useControlledValue({ onChange, value: colorProp, defaultValue }); const safeColordColor = (0,external_wp_element_namespaceObject.useMemo)(() => { return w(color || ''); }, [color]); const debouncedSetColor = (0,external_wp_compose_namespaceObject.useDebounce)(setColor); const handleChange = (0,external_wp_element_namespaceObject.useCallback)(nextValue => { debouncedSetColor(nextValue.toHex()); }, [debouncedSetColor]); const [colorType, setColorType] = (0,external_wp_element_namespaceObject.useState)(copyFormat || 'hex'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ColorfulWrapper, { ref: forwardedRef, ...divProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Picker, { onChange: handleChange, color: safeColordColor, enableAlpha: enableAlpha }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(AuxiliaryColorArtefactWrapper, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(AuxiliaryColorArtefactHStackHeader, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_SelectControl, { __nextHasNoMarginBottom: true, size: "compact", options: options, value: colorType, onChange: nextColorType => setColorType(nextColorType), label: (0,external_wp_i18n_namespaceObject.__)('Color format'), hideLabelFromVision: true, variant: "minimal" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorCopyButton, { color: safeColordColor, colorType: copyFormat || colorType })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorInputWrapper, { direction: "column", gap: 2, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorInput, { colorType: colorType, color: safeColordColor, onChange: handleChange, enableAlpha: enableAlpha }) })] })] }); }; const ColorPicker = contextConnect(UnconnectedColorPicker, 'ColorPicker'); /* harmony default export */ const color_picker_component = (ColorPicker); ;// ./node_modules/@wordpress/components/build-module/color-picker/use-deprecated-props.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function isLegacyProps(props) { return typeof props.onChangeComplete !== 'undefined' || typeof props.disableAlpha !== 'undefined' || typeof props.color?.hex === 'string'; } function getColorFromLegacyProps(color) { if (color === undefined) { return; } if (typeof color === 'string') { return color; } if (color.hex) { return color.hex; } return undefined; } const transformColorStringToLegacyColor = memize(color => { const colordColor = w(color); const hex = colordColor.toHex(); const rgb = colordColor.toRgb(); const hsv = colordColor.toHsv(); const hsl = colordColor.toHsl(); return { hex, rgb, hsv, hsl, source: 'hex', oldHue: hsl.h }; }); function use_deprecated_props_useDeprecatedProps(props) { const { onChangeComplete } = props; const legacyChangeHandler = (0,external_wp_element_namespaceObject.useCallback)(color => { onChangeComplete(transformColorStringToLegacyColor(color)); }, [onChangeComplete]); if (isLegacyProps(props)) { return { color: getColorFromLegacyProps(props.color), enableAlpha: !props.disableAlpha, onChange: legacyChangeHandler }; } return { ...props, color: props.color, enableAlpha: props.enableAlpha, onChange: props.onChange }; } ;// ./node_modules/@wordpress/components/build-module/color-picker/legacy-adapter.js /** * Internal dependencies */ const LegacyAdapter = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_picker_component, { ...use_deprecated_props_useDeprecatedProps(props) }); }; ;// ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker-context.js /** * WordPress dependencies */ /** * Internal dependencies */ const CircularOptionPickerContext = (0,external_wp_element_namespaceObject.createContext)({}); ;// ./node_modules/@wordpress/icons/build-module/library/check.js /** * WordPress dependencies */ const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" }) }); /* harmony default export */ const library_check = (check); ;// ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker-option.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedOptionAsButton(props, forwardedRef) { const { isPressed, label, ...additionalProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { ...additionalProps, "aria-pressed": isPressed, ref: forwardedRef, label: label }); } const OptionAsButton = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedOptionAsButton); function UnforwardedOptionAsOption(props, forwardedRef) { const { id, isSelected, label, ...additionalProps } = props; const { setActiveId, activeId } = (0,external_wp_element_namespaceObject.useContext)(CircularOptionPickerContext); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isSelected && !activeId) { // The setTimeout call is necessary to make sure that this update // doesn't get overridden by `Composite`'s internal logic, which picks // an initial active item if one is not specifically set. window.setTimeout(() => setActiveId?.(id), 0); } }, [isSelected, setActiveId, activeId, id]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Composite.Item, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { ...additionalProps, role: "option", "aria-selected": !!isSelected, ref: forwardedRef, label: label }), id: id }); } const OptionAsOption = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedOptionAsOption); function Option({ className, isSelected, selectedIconProps = {}, tooltipText, ...additionalProps }) { const { baseId, setActiveId } = (0,external_wp_element_namespaceObject.useContext)(CircularOptionPickerContext); const id = (0,external_wp_compose_namespaceObject.useInstanceId)(Option, baseId || 'components-circular-option-picker__option'); const commonProps = { id, className: 'components-circular-option-picker__option', __next40pxDefaultSize: true, ...additionalProps }; const isListbox = setActiveId !== undefined; const optionControl = isListbox ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OptionAsOption, { ...commonProps, label: tooltipText, isSelected: isSelected }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OptionAsButton, { ...commonProps, label: tooltipText, isPressed: isSelected }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx(className, 'components-circular-option-picker__option-wrapper'), children: [optionControl, isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: library_check, ...selectedIconProps })] }); } ;// ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker-option-group.js /** * External dependencies */ /** * Internal dependencies */ function OptionGroup({ className, options, ...additionalProps }) { const role = 'aria-label' in additionalProps || 'aria-labelledby' in additionalProps ? 'group' : undefined; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...additionalProps, role: role, className: dist_clsx('components-circular-option-picker__option-group', 'components-circular-option-picker__swatches', className), children: options }); } ;// ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker-actions.js /** * External dependencies */ /** * Internal dependencies */ function DropdownLinkAction({ buttonProps, className, dropdownProps, linkText }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown, { className: dist_clsx('components-circular-option-picker__dropdown-link-action', className), renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { "aria-expanded": isOpen, "aria-haspopup": "true", onClick: onToggle, variant: "link", ...buttonProps, children: linkText }), ...dropdownProps }); } function ButtonAction({ className, children, ...additionalProps }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, className: dist_clsx('components-circular-option-picker__clear', className), variant: "tertiary", ...additionalProps, children: children }); } ;// ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** *`CircularOptionPicker` is a component that displays a set of options as circular buttons. * * ```jsx * import { CircularOptionPicker } from '../circular-option-picker'; * import { useState } from '@wordpress/element'; * * const Example = () => { * const [ currentColor, setCurrentColor ] = useState(); * const colors = [ * { color: '#f00', name: 'Red' }, * { color: '#0f0', name: 'Green' }, * { color: '#00f', name: 'Blue' }, * ]; * const colorOptions = ( * <> * { colors.map( ( { color, name }, index ) => { * return ( * <CircularOptionPicker.Option * key={ `${ color }-${ index }` } * tooltipText={ name } * style={ { backgroundColor: color, color } } * isSelected={ index === currentColor } * onClick={ () => setCurrentColor( index ) } * /> * ); * } ) } * </> * ); * return ( * <CircularOptionPicker * options={ colorOptions } * actions={ * <CircularOptionPicker.ButtonAction * onClick={ () => setCurrentColor( undefined ) } * > * { 'Clear' } * </CircularOptionPicker.ButtonAction> * } * /> * ); * }; * ``` */ function ListboxCircularOptionPicker(props) { const { actions, options, baseId, className, loop = true, children, ...additionalProps } = props; const [activeId, setActiveId] = (0,external_wp_element_namespaceObject.useState)(undefined); const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ baseId, activeId, setActiveId }), [baseId, activeId, setActiveId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: className, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(CircularOptionPickerContext.Provider, { value: contextValue, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Composite, { ...additionalProps, id: baseId, focusLoop: loop, rtl: (0,external_wp_i18n_namespaceObject.isRTL)(), role: "listbox", activeId: activeId, setActiveId: setActiveId, children: options }), children, actions] }) }); } function ButtonsCircularOptionPicker(props) { const { actions, options, children, baseId, ...additionalProps } = props; const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ baseId }), [baseId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...additionalProps, role: "group", id: baseId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(CircularOptionPickerContext.Provider, { value: contextValue, children: [options, children, actions] }) }); } function CircularOptionPicker(props) { const { asButtons, actions: actionsProp, options: optionsProp, children, className, ...additionalProps } = props; const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(CircularOptionPicker, 'components-circular-option-picker', additionalProps.id); const OptionPickerImplementation = asButtons ? ButtonsCircularOptionPicker : ListboxCircularOptionPicker; const actions = actionsProp ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-circular-option-picker__custom-clear-wrapper", children: actionsProp }) : undefined; const options = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-circular-option-picker__swatches", children: optionsProp }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OptionPickerImplementation, { ...additionalProps, baseId: baseId, className: dist_clsx('components-circular-option-picker', className), actions: actions, options: options, children: children }); } CircularOptionPicker.Option = Option; CircularOptionPicker.OptionGroup = OptionGroup; CircularOptionPicker.ButtonAction = ButtonAction; CircularOptionPicker.DropdownLinkAction = DropdownLinkAction; /* harmony default export */ const circular_option_picker = (CircularOptionPicker); ;// ./node_modules/@wordpress/components/build-module/circular-option-picker/index.js /** * Internal dependencies */ /* harmony default export */ const build_module_circular_option_picker = (circular_option_picker); ;// ./node_modules/@wordpress/components/build-module/circular-option-picker/utils.js /** * WordPress dependencies */ /** * Computes the common props for the CircularOptionPicker. */ function getComputeCircularOptionPickerCommonProps(asButtons, loop, ariaLabel, ariaLabelledby) { const metaProps = asButtons ? { asButtons: true } : { asButtons: false, loop }; const labelProps = { 'aria-labelledby': ariaLabelledby, 'aria-label': ariaLabelledby ? undefined : ariaLabel || (0,external_wp_i18n_namespaceObject.__)('Custom color picker') }; return { metaProps, labelProps }; } ;// ./node_modules/@wordpress/components/build-module/v-stack/hook.js /** * Internal dependencies */ function useVStack(props) { const { expanded = false, alignment = 'stretch', ...otherProps } = useContextSystem(props, 'VStack'); const hStackProps = useHStack({ direction: 'column', expanded, alignment, ...otherProps }); return hStackProps; } ;// ./node_modules/@wordpress/components/build-module/v-stack/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedVStack(props, forwardedRef) { const vStackProps = useVStack(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...vStackProps, ref: forwardedRef }); } /** * `VStack` (or Vertical Stack) is a layout component that arranges child * elements in a vertical line. * * `VStack` can render anything inside. * * ```jsx * import { * __experimentalText as Text, * __experimentalVStack as VStack, * } from `@wordpress/components`; * * function Example() { * return ( * <VStack> * <Text>Code</Text> * <Text>is</Text> * <Text>Poetry</Text> * </VStack> * ); * } * ``` */ const VStack = contextConnect(UnconnectedVStack, 'VStack'); /* harmony default export */ const v_stack_component = (VStack); ;// ./node_modules/@wordpress/components/build-module/truncate/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedTruncate(props, forwardedRef) { const truncateProps = useTruncate(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { as: "span", ...truncateProps, ref: forwardedRef }); } /** * `Truncate` is a typography primitive that trims text content. * For almost all cases, it is recommended that `Text`, `Heading`, or * `Subheading` is used to render text content. However,`Truncate` is * available for custom implementations. * * ```jsx * import { __experimentalTruncate as Truncate } from `@wordpress/components`; * * function Example() { * return ( * <Truncate> * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex * neque, vulputate a diam et, luctus convallis lacus. Vestibulum ac * mollis mi. Morbi id elementum massa. * </Truncate> * ); * } * ``` */ const component_Truncate = contextConnect(UnconnectedTruncate, 'Truncate'); /* harmony default export */ const truncate_component = (component_Truncate); ;// ./node_modules/@wordpress/components/build-module/heading/hook.js /** * Internal dependencies */ function useHeading(props) { const { as: asProp, level = 2, color = COLORS.theme.foreground, isBlock = true, weight = config_values.fontWeightHeading, ...otherProps } = useContextSystem(props, 'Heading'); const as = asProp || `h${level}`; const a11yProps = {}; if (typeof as === 'string' && as[0] !== 'h') { // If not a semantic `h` element, add a11y props: a11yProps.role = 'heading'; a11yProps['aria-level'] = typeof level === 'string' ? parseInt(level) : level; } const textProps = useText({ color, isBlock, weight, size: getHeadingFontSize(level), ...otherProps }); return { ...textProps, ...a11yProps, as }; } ;// ./node_modules/@wordpress/components/build-module/heading/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedHeading(props, forwardedRef) { const headerProps = useHeading(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...headerProps, ref: forwardedRef }); } /** * `Heading` renders headings and titles using the library's typography system. * * ```jsx * import { __experimentalHeading as Heading } from "@wordpress/components"; * * function Example() { * return <Heading>Code is Poetry</Heading>; * } * ``` */ const Heading = contextConnect(UnconnectedHeading, 'Heading'); /* harmony default export */ const heading_component = (Heading); ;// ./node_modules/@wordpress/components/build-module/color-palette/styles.js function color_palette_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const ColorHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? { target: "ev9wop70" } : 0)( true ? { name: "13lxv2o", styles: "text-transform:uppercase;line-height:24px;font-weight:500;&&&{font-size:11px;margin-bottom:0;}" } : 0); ;// ./node_modules/@wordpress/components/build-module/dropdown/styles.js /** * External dependencies */ /** * Internal dependencies */ const padding = ({ paddingSize = 'small' }) => { if (paddingSize === 'none') { return; } const paddingValues = { small: space(2), medium: space(4) }; return /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingValues[paddingSize] || paddingValues.small, ";" + ( true ? "" : 0), true ? "" : 0); }; const DropdownContentWrapperDiv = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eovvns30" } : 0)("margin-left:", space(-2), ";margin-right:", space(-2), ";&:first-of-type{margin-top:", space(-2), ";}&:last-of-type{margin-bottom:", space(-2), ";}", padding, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/dropdown/dropdown-content-wrapper.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedDropdownContentWrapper(props, forwardedRef) { const { paddingSize = 'small', ...derivedProps } = useContextSystem(props, 'DropdownContentWrapper'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownContentWrapperDiv, { ...derivedProps, paddingSize: paddingSize, ref: forwardedRef }); } /** * A convenience wrapper for the `renderContent` when you want to apply * different padding. (Default is `paddingSize="small"`). * * ```jsx * import { * Dropdown, * __experimentalDropdownContentWrapper as DropdownContentWrapper, * } from '@wordpress/components'; * * <Dropdown * renderContent={ () => ( * <DropdownContentWrapper paddingSize="medium"> * My dropdown content * </DropdownContentWrapper> * ) } * /> * ``` */ const DropdownContentWrapper = contextConnect(UnconnectedDropdownContentWrapper, 'DropdownContentWrapper'); /* harmony default export */ const dropdown_content_wrapper = (DropdownContentWrapper); ;// ./node_modules/@wordpress/components/build-module/color-palette/utils.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ k([names, a11y]); /** * Checks if a color value is a simple CSS color. * * @param value The color value to check. * @return A boolean indicating whether the color value is a simple CSS color. */ const isSimpleCSSColor = value => { const valueIsCssVariable = /var\(/.test(value !== null && value !== void 0 ? value : ''); const valueIsColorMix = /color-mix\(/.test(value !== null && value !== void 0 ? value : ''); return !valueIsCssVariable && !valueIsColorMix; }; const extractColorNameFromCurrentValue = (currentValue, colors = [], showMultiplePalettes = false) => { if (!currentValue) { return ''; } const currentValueIsSimpleColor = currentValue ? isSimpleCSSColor(currentValue) : false; const normalizedCurrentValue = currentValueIsSimpleColor ? w(currentValue).toHex() : currentValue; // Normalize format of `colors` to simplify the following loop const colorPalettes = showMultiplePalettes ? colors : [{ colors: colors }]; for (const { colors: paletteColors } of colorPalettes) { for (const { name: colorName, color: colorValue } of paletteColors) { const normalizedColorValue = currentValueIsSimpleColor ? w(colorValue).toHex() : colorValue; if (normalizedCurrentValue === normalizedColorValue) { return colorName; } } } // translators: shown when the user has picked a custom color (i.e not in the palette of colors). return (0,external_wp_i18n_namespaceObject.__)('Custom'); }; // The PaletteObject type has a `colors` property (an array of ColorObject), // while the ColorObject type has a `color` property (the CSS color value). const isMultiplePaletteObject = obj => Array.isArray(obj.colors) && !('color' in obj); const isMultiplePaletteArray = arr => { return arr.length > 0 && arr.every(colorObj => isMultiplePaletteObject(colorObj)); }; /** * Transform a CSS variable used as background color into the color value itself. * * @param value The color value that may be a CSS variable. * @param element The element for which to get the computed style. * @return The background color value computed from a element. */ const normalizeColorValue = (value, element) => { if (!value || !element || isSimpleCSSColor(value)) { return value; } const { ownerDocument } = element; const { defaultView } = ownerDocument; const computedBackgroundColor = defaultView?.getComputedStyle(element).backgroundColor; return computedBackgroundColor ? w(computedBackgroundColor).toHex() : value; }; ;// ./node_modules/@wordpress/components/build-module/color-palette/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ k([names, a11y]); function SinglePalette({ className, clearColor, colors, onChange, value, ...additionalProps }) { const colorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { return colors.map(({ color, name }, index) => { const colordColor = w(color); const isSelected = value === color; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.Option, { isSelected: isSelected, selectedIconProps: isSelected ? { fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000' } : {}, tooltipText: name || // translators: %s: color hex code e.g: "#f00". (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color code: %s'), color), style: { backgroundColor: color, color }, onClick: isSelected ? clearColor : () => onChange(color, index) }, `${color}-${index}`); }); }, [colors, value, onChange, clearColor]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.OptionGroup, { className: className, options: colorOptions, ...additionalProps }); } function MultiplePalettes({ className, clearColor, colors, onChange, value, headingLevel }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(MultiplePalettes, 'color-palette'); if (colors.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(v_stack_component, { spacing: 3, className: className, children: colors.map(({ name, colors: colorPalette }, index) => { const id = `${instanceId}-${index}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { spacing: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorHeading, { id: id, level: headingLevel, children: name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SinglePalette, { clearColor: clearColor, colors: colorPalette, onChange: newColor => onChange(newColor, index), value: value, "aria-labelledby": id })] }, index); }) }); } function CustomColorPickerDropdown({ isRenderedInSidebar, popoverProps: receivedPopoverProps, ...props }) { const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ shift: true, // Disabling resize as it would otherwise cause the popover to show // scrollbars while dragging the color picker's handle close to the // popover edge. resize: false, ...(isRenderedInSidebar ? { // When in the sidebar: open to the left (stacking), // leaving the same gap as the parent popover. placement: 'left-start', offset: 34 } : { // Default behavior: open below the anchor placement: 'bottom', offset: 8 }), ...receivedPopoverProps }), [isRenderedInSidebar, receivedPopoverProps]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown, { contentClassName: "components-color-palette__custom-color-dropdown-content", popoverProps: popoverProps, ...props }); } function UnforwardedColorPalette(props, forwardedRef) { const { asButtons, loop, clearable = true, colors = [], disableCustomColors = false, enableAlpha = false, onChange, value, __experimentalIsRenderedInSidebar = false, headingLevel = 2, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, ...additionalProps } = props; const [normalizedColorValue, setNormalizedColorValue] = (0,external_wp_element_namespaceObject.useState)(value); const clearColor = (0,external_wp_element_namespaceObject.useCallback)(() => onChange(undefined), [onChange]); const customColorPaletteCallbackRef = (0,external_wp_element_namespaceObject.useCallback)(node => { setNormalizedColorValue(normalizeColorValue(value, node)); }, [value]); const hasMultipleColorOrigins = isMultiplePaletteArray(colors); const buttonLabelName = (0,external_wp_element_namespaceObject.useMemo)(() => extractColorNameFromCurrentValue(value, colors, hasMultipleColorOrigins), [value, colors, hasMultipleColorOrigins]); const renderCustomColorPicker = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_content_wrapper, { paddingSize: "none", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LegacyAdapter, { color: normalizedColorValue, onChange: color => onChange(color), enableAlpha: enableAlpha }) }); const isHex = value?.startsWith('#'); // Leave hex values as-is. Remove the `var()` wrapper from CSS vars. const displayValue = value?.replace(/^var\((.+)\)$/, '$1'); const customColorAccessibleLabel = !!displayValue ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The name of the color e.g: "vivid red". 2: The color's hex code e.g: "#f00". (0,external_wp_i18n_namespaceObject.__)('Custom color picker. The currently selected color is called "%1$s" and has a value of "%2$s".'), buttonLabelName, displayValue) : (0,external_wp_i18n_namespaceObject.__)('Custom color picker'); const paletteCommonProps = { clearColor, onChange, value }; const actions = !!clearable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.ButtonAction, { onClick: clearColor, accessibleWhenDisabled: true, disabled: !value, children: (0,external_wp_i18n_namespaceObject.__)('Clear') }); const { metaProps, labelProps } = getComputeCircularOptionPickerCommonProps(asButtons, loop, ariaLabel, ariaLabelledby); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { spacing: 3, ref: forwardedRef, ...additionalProps, children: [!disableCustomColors && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomColorPickerDropdown, { isRenderedInSidebar: __experimentalIsRenderedInSidebar, renderContent: renderCustomColorPicker, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { className: "components-color-palette__custom-color-wrapper", spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { ref: customColorPaletteCallbackRef, className: "components-color-palette__custom-color-button", "aria-expanded": isOpen, "aria-haspopup": "true", onClick: onToggle, "aria-label": customColorAccessibleLabel, style: { background: value }, type: "button" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { className: "components-color-palette__custom-color-text-wrapper", spacing: 0.5, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(truncate_component, { className: "components-color-palette__custom-color-name", children: value ? buttonLabelName : (0,external_wp_i18n_namespaceObject.__)('No color selected') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(truncate_component, { className: dist_clsx('components-color-palette__custom-color-value', { 'components-color-palette__custom-color-value--is-hex': isHex }), children: displayValue })] })] }) }), (colors.length > 0 || actions) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker, { ...metaProps, ...labelProps, actions: actions, options: hasMultipleColorOrigins ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MultiplePalettes, { ...paletteCommonProps, headingLevel: headingLevel, colors: colors, value: value }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SinglePalette, { ...paletteCommonProps, colors: colors, value: value }) })] }); } /** * Allows the user to pick a color from a list of pre-defined color entries. * * ```jsx * import { ColorPalette } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyColorPalette = () => { * const [ color, setColor ] = useState ( '#f00' ) * const colors = [ * { name: 'red', color: '#f00' }, * { name: 'white', color: '#fff' }, * { name: 'blue', color: '#00f' }, * ]; * return ( * <ColorPalette * colors={ colors } * value={ color } * onChange={ ( color ) => setColor( color ) } * /> * ); * } ); * ``` */ const ColorPalette = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedColorPalette); /* harmony default export */ const color_palette = (ColorPalette); ;// ./node_modules/@wordpress/components/build-module/unit-control/styles/unit-control-styles.js /** * External dependencies */ /** * Internal dependencies */ // Using `selectSize` instead of `size` to avoid a type conflict with the // `size` HTML attribute of the `select` element. // TODO: Resolve need to use &&& to increase specificity // https://github.com/WordPress/gutenberg/issues/18483 const ValueInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? { target: "e1bagdl32" } : 0)("&&&{input{display:block;width:100%;}", BackdropUI, "{transition:box-shadow 0.1s linear;}}" + ( true ? "" : 0)); const baseUnitLabelStyles = ({ selectSize }) => { const sizes = { small: /*#__PURE__*/emotion_react_browser_esm_css("box-sizing:border-box;padding:2px 1px;width:20px;font-size:8px;line-height:1;letter-spacing:-0.5px;text-transform:uppercase;text-align-last:center;&:not( :disabled ){color:", COLORS.gray[800], ";}" + ( true ? "" : 0), true ? "" : 0), default: /*#__PURE__*/emotion_react_browser_esm_css("box-sizing:border-box;min-width:24px;max-width:48px;height:24px;margin-inline-end:", space(2), ";padding:", space(1), ";font-size:13px;line-height:1;text-align-last:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;field-sizing:content;&:not( :disabled ){color:", COLORS.theme.accent, ";}" + ( true ? "" : 0), true ? "" : 0) }; return sizes[selectSize]; }; const UnitLabel = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1bagdl31" } : 0)("&&&{pointer-events:none;", baseUnitLabelStyles, ";color:", COLORS.gray[900], ";}" + ( true ? "" : 0)); const unitSelectSizes = ({ selectSize = 'default' }) => { const sizes = { small: /*#__PURE__*/emotion_react_browser_esm_css("height:100%;border:1px solid transparent;transition:box-shadow 0.1s linear,border 0.1s linear;", rtl({ borderTopLeftRadius: 0, borderBottomLeftRadius: 0 })(), " &:not(:disabled):hover{background-color:", COLORS.gray[100], ";}&:focus{border:1px solid ", COLORS.ui.borderFocus, ";box-shadow:inset 0 0 0 ", config_values.borderWidth + ' ' + COLORS.ui.borderFocus, ";outline-offset:0;outline:2px solid transparent;z-index:1;}" + ( true ? "" : 0), true ? "" : 0), default: /*#__PURE__*/emotion_react_browser_esm_css("display:flex;justify-content:center;align-items:center;&:where( :not( :disabled ) ):hover{box-shadow:0 0 0 ", config_values.borderWidth + ' ' + COLORS.ui.borderFocus, ";outline:", config_values.borderWidth, " solid transparent;}&:focus{box-shadow:0 0 0 ", config_values.borderWidthFocus + ' ' + COLORS.ui.borderFocus, ";outline:", config_values.borderWidthFocus, " solid transparent;}" + ( true ? "" : 0), true ? "" : 0) }; return sizes[selectSize]; }; const UnitSelect = /*#__PURE__*/emotion_styled_base_browser_esm("select", true ? { target: "e1bagdl30" } : 0)("&&&{appearance:none;background:transparent;border-radius:", config_values.radiusXSmall, ";border:none;display:block;outline:none;margin:0;min-height:auto;font-family:inherit;", baseUnitLabelStyles, ";", unitSelectSizes, ";&:not( :disabled ){cursor:pointer;}}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/border-control/styles.js function border_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const focusBoxShadow = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:inset ", config_values.controlBoxShadowFocus, ";" + ( true ? "" : 0), true ? "" : 0); const borderControl = /*#__PURE__*/emotion_react_browser_esm_css("border:0;padding:0;margin:0;", boxSizingReset, ";" + ( true ? "" : 0), true ? "" : 0); const innerWrapper = () => /*#__PURE__*/emotion_react_browser_esm_css(ValueInput, "{flex:1 1 40%;}&& ", UnitSelect, "{min-height:0;}" + ( true ? "" : 0), true ? "" : 0); /* * This style is only applied to the UnitControl wrapper when the border width * field should be a set width. Omitting this allows the UnitControl & * RangeControl to share the available width in a 40/60 split respectively. */ const styles_wrapperWidth = /*#__PURE__*/emotion_react_browser_esm_css(ValueInput, "{flex:0 0 auto;}" + ( true ? "" : 0), true ? "" : 0); const wrapperHeight = size => { return /*#__PURE__*/emotion_react_browser_esm_css("height:", size === '__unstable-large' ? '40px' : '30px', ";" + ( true ? "" : 0), true ? "" : 0); }; const borderControlDropdown = /*#__PURE__*/emotion_react_browser_esm_css("background:#fff;&&>button{aspect-ratio:1;padding:0;display:flex;align-items:center;justify-content:center;", rtl({ borderRadius: `2px 0 0 2px` }, { borderRadius: `0 2px 2px 0` })(), " border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";&:focus,&:hover:not( :disabled ){", focusBoxShadow, " border-color:", COLORS.ui.borderFocus, ";z-index:1;position:relative;}}" + ( true ? "" : 0), true ? "" : 0); const colorIndicatorBorder = border => { const { color, style } = border || {}; const fallbackColor = !!style && style !== 'none' ? COLORS.gray[300] : undefined; return /*#__PURE__*/emotion_react_browser_esm_css("border-style:", style === 'none' ? 'solid' : style, ";border-color:", color || fallbackColor, ";" + ( true ? "" : 0), true ? "" : 0); }; const colorIndicatorWrapper = (border, size) => { const { style } = border || {}; return /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", config_values.radiusFull, ";border:2px solid transparent;", style ? colorIndicatorBorder(border) : undefined, " width:", size === '__unstable-large' ? '24px' : '22px', ";height:", size === '__unstable-large' ? '24px' : '22px', ";padding:", size === '__unstable-large' ? '2px' : '1px', ";&>span{height:", space(4), ";width:", space(4), ";background:linear-gradient(\n\t\t\t\t-45deg,\n\t\t\t\ttransparent 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 52%,\n\t\t\t\ttransparent 52%\n\t\t\t);}" + ( true ? "" : 0), true ? "" : 0); }; // Must equal $color-palette-circle-size from: // @wordpress/components/src/circular-option-picker/style.scss const swatchSize = 28; const swatchGap = 12; const borderControlPopoverControls = /*#__PURE__*/emotion_react_browser_esm_css("width:", swatchSize * 6 + swatchGap * 5, "px;>div:first-of-type>", StyledLabel, "{margin-bottom:0;}&& ", StyledLabel, "+button:not( .has-text ){min-width:24px;padding:0;}" + ( true ? "" : 0), true ? "" : 0); const borderControlPopoverContent = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0); const borderColorIndicator = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0); const resetButtonWrapper = true ? { name: "1ghe26v", styles: "display:flex;justify-content:flex-end;margin-top:12px" } : 0; const borderSlider = () => /*#__PURE__*/emotion_react_browser_esm_css("flex:1 1 60%;", rtl({ marginRight: space(3) })(), ";" + ( true ? "" : 0), true ? "" : 0); ;// ./node_modules/@wordpress/components/build-module/unit-control/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; const allUnits = { px: { value: 'px', label: isWeb ? 'px' : (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'), step: 1 }, '%': { value: '%', label: isWeb ? '%' : (0,external_wp_i18n_namespaceObject.__)('Percentage (%)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Percent (%)'), step: 0.1 }, em: { value: 'em', label: isWeb ? 'em' : (0,external_wp_i18n_namespaceObject.__)('Relative to parent font size (em)'), a11yLabel: (0,external_wp_i18n_namespaceObject._x)('ems', 'Relative to parent font size (em)'), step: 0.01 }, rem: { value: 'rem', label: isWeb ? 'rem' : (0,external_wp_i18n_namespaceObject.__)('Relative to root font size (rem)'), a11yLabel: (0,external_wp_i18n_namespaceObject._x)('rems', 'Relative to root font size (rem)'), step: 0.01 }, vw: { value: 'vw', label: isWeb ? 'vw' : (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'), step: 0.1 }, vh: { value: 'vh', label: isWeb ? 'vh' : (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'), step: 0.1 }, vmin: { value: 'vmin', label: isWeb ? 'vmin' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'), step: 0.1 }, vmax: { value: 'vmax', label: isWeb ? 'vmax' : (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'), step: 0.1 }, ch: { value: 'ch', label: isWeb ? 'ch' : (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'), step: 0.01 }, ex: { value: 'ex', label: isWeb ? 'ex' : (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'), step: 0.01 }, cm: { value: 'cm', label: isWeb ? 'cm' : (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'), step: 0.001 }, mm: { value: 'mm', label: isWeb ? 'mm' : (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'), step: 0.1 }, in: { value: 'in', label: isWeb ? 'in' : (0,external_wp_i18n_namespaceObject.__)('Inches (in)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Inches (in)'), step: 0.001 }, pc: { value: 'pc', label: isWeb ? 'pc' : (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'), step: 1 }, pt: { value: 'pt', label: isWeb ? 'pt' : (0,external_wp_i18n_namespaceObject.__)('Points (pt)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Points (pt)'), step: 1 }, svw: { value: 'svw', label: isWeb ? 'svw' : (0,external_wp_i18n_namespaceObject.__)('Small viewport width (svw)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport width (svw)'), step: 0.1 }, svh: { value: 'svh', label: isWeb ? 'svh' : (0,external_wp_i18n_namespaceObject.__)('Small viewport height (svh)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport height (svh)'), step: 0.1 }, svi: { value: 'svi', label: isWeb ? 'svi' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest size in the inline direction (svi)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport width or height (svi)'), step: 0.1 }, svb: { value: 'svb', label: isWeb ? 'svb' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest size in the block direction (svb)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport width or height (svb)'), step: 0.1 }, svmin: { value: 'svmin', label: isWeb ? 'svmin' : (0,external_wp_i18n_namespaceObject.__)('Small viewport smallest dimension (svmin)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport smallest dimension (svmin)'), step: 0.1 }, lvw: { value: 'lvw', label: isWeb ? 'lvw' : (0,external_wp_i18n_namespaceObject.__)('Large viewport width (lvw)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport width (lvw)'), step: 0.1 }, lvh: { value: 'lvh', label: isWeb ? 'lvh' : (0,external_wp_i18n_namespaceObject.__)('Large viewport height (lvh)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport height (lvh)'), step: 0.1 }, lvi: { value: 'lvi', label: isWeb ? 'lvi' : (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvi)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvi)'), step: 0.1 }, lvb: { value: 'lvb', label: isWeb ? 'lvb' : (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvb)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvb)'), step: 0.1 }, lvmin: { value: 'lvmin', label: isWeb ? 'lvmin' : (0,external_wp_i18n_namespaceObject.__)('Large viewport smallest dimension (lvmin)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport smallest dimension (lvmin)'), step: 0.1 }, dvw: { value: 'dvw', label: isWeb ? 'dvw' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width (dvw)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width (dvw)'), step: 0.1 }, dvh: { value: 'dvh', label: isWeb ? 'dvh' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport height (dvh)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport height (dvh)'), step: 0.1 }, dvi: { value: 'dvi', label: isWeb ? 'dvi' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvi)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvi)'), step: 0.1 }, dvb: { value: 'dvb', label: isWeb ? 'dvb' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvb)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvb)'), step: 0.1 }, dvmin: { value: 'dvmin', label: isWeb ? 'dvmin' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport smallest dimension (dvmin)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport smallest dimension (dvmin)'), step: 0.1 }, dvmax: { value: 'dvmax', label: isWeb ? 'dvmax' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport largest dimension (dvmax)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport largest dimension (dvmax)'), step: 0.1 }, svmax: { value: 'svmax', label: isWeb ? 'svmax' : (0,external_wp_i18n_namespaceObject.__)('Small viewport largest dimension (svmax)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport largest dimension (svmax)'), step: 0.1 }, lvmax: { value: 'lvmax', label: isWeb ? 'lvmax' : (0,external_wp_i18n_namespaceObject.__)('Large viewport largest dimension (lvmax)'), a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport largest dimension (lvmax)'), step: 0.1 } }; /** * An array of all available CSS length units. */ const ALL_CSS_UNITS = Object.values(allUnits); /** * Units of measurements. `a11yLabel` is used by screenreaders. */ const CSS_UNITS = [allUnits.px, allUnits['%'], allUnits.em, allUnits.rem, allUnits.vw, allUnits.vh]; const DEFAULT_UNIT = allUnits.px; /** * Handles legacy value + unit handling. * This component use to manage both incoming value and units separately. * * Moving forward, ideally the value should be a string that contains both * the value and unit, example: '10px' * * @param rawValue The raw value as a string (may or may not contain the unit) * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value` * @param allowedUnits Units to derive from. * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse * from the raw value could not be matched against the list of allowed units. */ function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) { const initialValue = fallbackUnit ? `${rawValue !== null && rawValue !== void 0 ? rawValue : ''}${fallbackUnit}` : rawValue; return parseQuantityAndUnitFromRawValue(initialValue, allowedUnits); } /** * Checks if units are defined. * * @param units List of units. * @return Whether the list actually contains any units. */ function hasUnits(units) { // Although the `isArray` check shouldn't be necessary (given the signature of // this typed function), it's better to stay on the side of caution, since // this function may be called from un-typed environments. return Array.isArray(units) && !!units.length; } /** * Parses a quantity and unit from a raw string value, given a list of allowed * units and otherwise falling back to the default unit. * * @param rawValue The raw value as a string (may or may not contain the unit) * @param allowedUnits Units to derive from. * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed * from the raw value could not be matched against the list of allowed units. */ function parseQuantityAndUnitFromRawValue(rawValue, allowedUnits = ALL_CSS_UNITS) { let trimmedValue; let quantityToReturn; if (typeof rawValue !== 'undefined' || rawValue === null) { trimmedValue = `${rawValue}`.trim(); const parsedQuantity = parseFloat(trimmedValue); quantityToReturn = !isFinite(parsedQuantity) ? undefined : parsedQuantity; } const unitMatch = trimmedValue?.match(/[\d.\-\+]*\s*(.*)/); const matchedUnit = unitMatch?.[1]?.toLowerCase(); let unitToReturn; if (hasUnits(allowedUnits)) { const match = allowedUnits.find(item => item.value === matchedUnit); unitToReturn = match?.value; } else { unitToReturn = DEFAULT_UNIT.value; } return [quantityToReturn, unitToReturn]; } /** * Parses quantity and unit from a raw value. Validates parsed value, using fallback * value if invalid. * * @param rawValue The next value. * @param allowedUnits Units to derive from. * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value. * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value. * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The * unit can be `undefined` only if the unit parsed from the raw value could not be matched against * the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of * `allowedUnits` is passed empty. */ function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity, fallbackUnit) { const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(rawValue, allowedUnits); // The parsed value from `parseQuantityAndUnitFromRawValue` should now be // either a real number or undefined. If undefined, use the fallback value. const quantityToReturn = parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : fallbackQuantity; // If no unit is parsed from the raw value, or if the fallback unit is not // defined, use the first value from the list of allowed units as fallback. let unitToReturn = parsedUnit || fallbackUnit; if (!unitToReturn && hasUnits(allowedUnits)) { unitToReturn = allowedUnits[0].value; } return [quantityToReturn, unitToReturn]; } /** * Takes a unit value and finds the matching accessibility label for the * unit abbreviation. * * @param unit Unit value (example: `px`) * @return a11y label for the unit abbreviation */ function getAccessibleLabelForUnit(unit) { const match = ALL_CSS_UNITS.find(item => item.value === unit); return match?.a11yLabel ? match?.a11yLabel : match?.value; } /** * Filters available units based on values defined a list of allowed unit values. * * @param allowedUnitValues Collection of allowed unit value strings. * @param availableUnits Collection of available unit objects. * @return Filtered units. */ function filterUnitsWithSettings(allowedUnitValues = [], availableUnits) { // Although the `isArray` check shouldn't be necessary (given the signature of // this typed function), it's better to stay on the side of caution, since // this function may be called from un-typed environments. return Array.isArray(availableUnits) ? availableUnits.filter(unit => allowedUnitValues.includes(unit.value)) : []; } /** * Custom hook to retrieve and consolidate units setting from add_theme_support(). * TODO: ideally this hook shouldn't be needed * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823 * * @param args An object containing units, settingPath & defaultUnits. * @param args.units Collection of all potentially available units. * @param args.availableUnits Collection of unit value strings for filtering available units. * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`. * * @return Filtered list of units, with their default values updated following the `defaultValues` * argument's property. */ const useCustomUnits = ({ units = ALL_CSS_UNITS, availableUnits = [], defaultValues }) => { const customUnitsToReturn = filterUnitsWithSettings(availableUnits, units); if (defaultValues) { customUnitsToReturn.forEach((unit, i) => { if (defaultValues[unit.value]) { const [parsedDefaultValue] = parseQuantityAndUnitFromRawValue(defaultValues[unit.value]); customUnitsToReturn[i].default = parsedDefaultValue; } }); } return customUnitsToReturn; }; /** * Get available units with the unit for the currently selected value * prepended if it is not available in the list of units. * * This is useful to ensure that the current value's unit is always * accurately displayed in the UI, even if the intention is to hide * the availability of that unit. * * @param rawValue Selected value to parse. * @param legacyUnit Legacy unit value, if rawValue needs it appended. * @param units List of available units. * * @return A collection of units containing the unit for the current value. */ function getUnitsWithCurrentUnit(rawValue, legacyUnit, units = ALL_CSS_UNITS) { const unitsToReturn = Array.isArray(units) ? [...units] : []; const [, currentUnit] = getParsedQuantityAndUnit(rawValue, legacyUnit, ALL_CSS_UNITS); if (currentUnit && !unitsToReturn.some(unit => unit.value === currentUnit)) { if (allUnits[currentUnit]) { unitsToReturn.unshift(allUnits[currentUnit]); } } return unitsToReturn; } ;// ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBorderControlDropdown(props) { const { border, className, colors = [], enableAlpha = false, enableStyle = true, onChange, previousStyleSelection, size = 'default', __experimentalIsRenderedInSidebar = false, ...otherProps } = useContextSystem(props, 'BorderControlDropdown'); const [widthValue] = parseQuantityAndUnitFromRawValue(border?.width); const hasZeroWidth = widthValue === 0; const onColorChange = color => { const style = border?.style === 'none' ? previousStyleSelection : border?.style; const width = hasZeroWidth && !!color ? '1px' : border?.width; onChange({ color, style, width }); }; const onStyleChange = style => { const width = hasZeroWidth && !!style ? '1px' : border?.width; onChange({ ...border, style, width }); }; const onReset = () => { onChange({ ...border, color: undefined, style: undefined }); }; // Generate class names. const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderControlDropdown, className); }, [className, cx]); const indicatorClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderColorIndicator); }, [cx]); const indicatorWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(colorIndicatorWrapper(border, size)); }, [border, cx, size]); const popoverControlsClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderControlPopoverControls); }, [cx]); const popoverContentClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderControlPopoverContent); }, [cx]); const resetButtonWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(resetButtonWrapper); }, [cx]); return { ...otherProps, border, className: classes, colors, enableAlpha, enableStyle, indicatorClassName, indicatorWrapperClassName, onColorChange, onStyleChange, onReset, popoverContentClassName, popoverControlsClassName, resetButtonWrapperClassName, size, __experimentalIsRenderedInSidebar }; } ;// ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const getAriaLabelColorValue = colorValue => { // Leave hex values as-is. Remove the `var()` wrapper from CSS vars. return colorValue.replace(/^var\((.+)\)$/, '$1'); }; const getColorObject = (colorValue, colors) => { if (!colorValue || !colors) { return; } if (isMultiplePaletteArray(colors)) { // Multiple origins let matchedColor; colors.some(origin => origin.colors.some(color => { if (color.color === colorValue) { matchedColor = color; return true; } return false; })); return matchedColor; } // Single origin return colors.find(color => color.color === colorValue); }; const getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => { if (isStyleEnabled) { if (colorObject) { const ariaLabelValue = getAriaLabelColorValue(colorObject.color); return style ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The name of the color e.g. "vivid red". 2: The color's hex code e.g.: "#f00:". 3: The current border style selection e.g. "solid". (0,external_wp_i18n_namespaceObject.__)('Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s". The currently selected style is "%3$s".'), colorObject.name, ariaLabelValue, style) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The name of the color e.g. "vivid red". 2: The color's hex code e.g.: "#f00:". (0,external_wp_i18n_namespaceObject.__)('Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s".'), colorObject.name, ariaLabelValue); } if (colorValue) { const ariaLabelValue = getAriaLabelColorValue(colorValue); return style ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The color's hex code e.g.: "#f00:". 2: The current border style selection e.g. "solid". (0,external_wp_i18n_namespaceObject.__)('Border color and style picker. The currently selected color has a value of "%1$s". The currently selected style is "%2$s".'), ariaLabelValue, style) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The color's hex code e.g: "#f00". (0,external_wp_i18n_namespaceObject.__)('Border color and style picker. The currently selected color has a value of "%s".'), ariaLabelValue); } return (0,external_wp_i18n_namespaceObject.__)('Border color and style picker.'); } if (colorObject) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The name of the color e.g. "vivid red". 2: The color's hex code e.g: "#f00". (0,external_wp_i18n_namespaceObject.__)('Border color picker. The currently selected color is called "%1$s" and has a value of "%2$s".'), colorObject.name, getAriaLabelColorValue(colorObject.color)); } if (colorValue) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The color's hex code e.g: "#f00". (0,external_wp_i18n_namespaceObject.__)('Border color picker. The currently selected color has a value of "%s".'), getAriaLabelColorValue(colorValue)); } return (0,external_wp_i18n_namespaceObject.__)('Border color picker.'); }; const BorderControlDropdown = (props, forwardedRef) => { const { __experimentalIsRenderedInSidebar, border, colors, disableCustomColors, enableAlpha, enableStyle, indicatorClassName, indicatorWrapperClassName, isStyleSettable, onReset, onColorChange, onStyleChange, popoverContentClassName, popoverControlsClassName, resetButtonWrapperClassName, size, __unstablePopoverProps, ...otherProps } = useBorderControlDropdown(props); const { color, style } = border || {}; const colorObject = getColorObject(color, colors); const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle); const enableResetButton = color || style && style !== 'none'; const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined; const renderToggle = ({ onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { onClick: onToggle, variant: "tertiary", "aria-label": toggleAriaLabel, tooltipPosition: dropdownPosition, label: (0,external_wp_i18n_namespaceObject.__)('Border color and style picker'), showTooltip: true, __next40pxDefaultSize: size === '__unstable-large', children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: indicatorWrapperClassName, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_indicator, { className: indicatorClassName, colorValue: color }) }) }); const renderContent = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dropdown_content_wrapper, { paddingSize: "medium", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { className: popoverControlsClassName, spacing: 6, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_palette, { className: popoverContentClassName, value: color, onChange: onColorChange, colors, disableCustomColors, __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, clearable: false, enableAlpha: enableAlpha }), enableStyle && isStyleSettable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_control_style_picker_component, { label: (0,external_wp_i18n_namespaceObject.__)('Style'), value: style, onChange: onStyleChange })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: resetButtonWrapperClassName, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { variant: "tertiary", onClick: () => { onReset(); }, disabled: !enableResetButton, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Reset') }) })] }) }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown, { renderToggle: renderToggle, renderContent: renderContent, popoverProps: { ...__unstablePopoverProps }, ...otherProps, ref: forwardedRef }); }; const ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown'); /* harmony default export */ const border_control_dropdown_component = (ConnectedBorderControlDropdown); ;// ./node_modules/@wordpress/components/build-module/unit-control/unit-select-control.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnitSelectControl({ className, isUnitSelectTabbable: isTabbable = true, onChange, size = 'default', unit = 'px', units = CSS_UNITS, ...props }, ref) { if (!hasUnits(units) || units?.length === 1) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UnitLabel, { className: "components-unit-control__unit-label", selectSize: size, children: unit }); } const handleOnChange = event => { const { value: unitValue } = event.target; const data = units.find(option => option.value === unitValue); onChange?.(unitValue, { event, data }); }; const classes = dist_clsx('components-unit-control__select', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UnitSelect, { ref: ref, className: classes, onChange: handleOnChange, selectSize: size, tabIndex: isTabbable ? undefined : -1, value: unit, ...props, children: units.map(option => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("option", { value: option.value, children: option.label }, option.value)) }); } /* harmony default export */ const unit_select_control = ((0,external_wp_element_namespaceObject.forwardRef)(UnitSelectControl)); ;// ./node_modules/@wordpress/components/build-module/unit-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedUnitControl(unitControlProps, forwardedRef) { const { __unstableStateReducer, autoComplete = 'off', // @ts-expect-error Ensure that children is omitted from restProps children, className, disabled = false, disableUnits = false, isPressEnterToChange = false, isResetValueOnUnitChange = false, isUnitSelectTabbable = true, label, onChange: onChangeProp, onUnitChange, size = 'default', unit: unitProp, units: unitsProp = CSS_UNITS, value: valueProp, onFocus: onFocusProp, __shouldNotWarnDeprecated36pxSize, ...props } = useDeprecated36pxDefaultSizeProp(unitControlProps); maybeWarnDeprecated36pxSize({ componentName: 'UnitControl', __next40pxDefaultSize: props.__next40pxDefaultSize, size, __shouldNotWarnDeprecated36pxSize }); if ('unit' in unitControlProps) { external_wp_deprecated_default()('UnitControl unit prop', { since: '5.6', hint: 'The unit should be provided within the `value` prop.', version: '6.2' }); } // The `value` prop, in theory, should not be `null`, but the following line // ensures it fallback to `undefined` in case a consumer of `UnitControl` // still passes `null` as a `value`. const nonNullValueProp = valueProp !== null && valueProp !== void 0 ? valueProp : undefined; const [units, reFirstCharacterOfUnits] = (0,external_wp_element_namespaceObject.useMemo)(() => { const list = getUnitsWithCurrentUnit(nonNullValueProp, unitProp, unitsProp); const [{ value: firstUnitValue = '' } = {}, ...rest] = list; const firstCharacters = rest.reduce((carry, { value }) => { const first = escapeRegExp(value?.substring(0, 1) || ''); return carry.includes(first) ? carry : `${carry}|${first}`; }, escapeRegExp(firstUnitValue.substring(0, 1))); return [list, new RegExp(`^(?:${firstCharacters})$`, 'i')]; }, [nonNullValueProp, unitProp, unitsProp]); const [parsedQuantity, parsedUnit] = getParsedQuantityAndUnit(nonNullValueProp, unitProp, units); const [unit, setUnit] = use_controlled_state(units.length === 1 ? units[0].value : unitProp, { initial: parsedUnit, fallback: '' }); (0,external_wp_element_namespaceObject.useEffect)(() => { if (parsedUnit !== undefined) { setUnit(parsedUnit); } }, [parsedUnit, setUnit]); const classes = dist_clsx('components-unit-control', // This class is added for legacy purposes to maintain it on the outer // wrapper. See: https://github.com/WordPress/gutenberg/pull/45139 'components-unit-control-wrapper', className); const handleOnQuantityChange = (nextQuantityValue, changeProps) => { if (nextQuantityValue === '' || typeof nextQuantityValue === 'undefined' || nextQuantityValue === null) { onChangeProp?.('', changeProps); return; } /* * Customizing the onChange callback. * This allows as to broadcast a combined value+unit to onChange. */ const onChangeValue = getValidParsedQuantityAndUnit(nextQuantityValue, units, parsedQuantity, unit).join(''); onChangeProp?.(onChangeValue, changeProps); }; const handleOnUnitChange = (nextUnitValue, changeProps) => { const { data } = changeProps; let nextValue = `${parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : ''}${nextUnitValue}`; if (isResetValueOnUnitChange && data?.default !== undefined) { nextValue = `${data.default}${nextUnitValue}`; } onChangeProp?.(nextValue, changeProps); onUnitChange?.(nextUnitValue, changeProps); setUnit(nextUnitValue); }; let handleOnKeyDown; if (!disableUnits && isUnitSelectTabbable && units.length) { handleOnKeyDown = event => { props.onKeyDown?.(event); // Unless the meta or ctrl key was pressed (to avoid interfering with // shortcuts, e.g. pastes), move focus to the unit select if a key // matches the first character of a unit. if (!event.metaKey && !event.ctrlKey && reFirstCharacterOfUnits.test(event.key)) { refInputSuffix.current?.focus(); } }; } const refInputSuffix = (0,external_wp_element_namespaceObject.useRef)(null); const inputSuffix = !disableUnits ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(unit_select_control, { ref: refInputSuffix, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Select unit'), disabled: disabled, isUnitSelectTabbable: isUnitSelectTabbable, onChange: handleOnUnitChange, size: ['small', 'compact'].includes(size) || size === 'default' && !props.__next40pxDefaultSize ? 'small' : 'default', unit: unit, units: units, onFocus: onFocusProp, onBlur: unitControlProps.onBlur }) : null; let step = props.step; /* * If no step prop has been passed, lookup the active unit and * try to get step from `units`, or default to a value of `1` */ if (!step && units) { var _activeUnit$step; const activeUnit = units.find(option => option.value === unit); step = (_activeUnit$step = activeUnit?.step) !== null && _activeUnit$step !== void 0 ? _activeUnit$step : 1; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ValueInput, { ...props, __shouldNotWarnDeprecated36pxSize: true, autoComplete: autoComplete, className: classes, disabled: disabled, spinControls: "none", isPressEnterToChange: isPressEnterToChange, label: label, onKeyDown: handleOnKeyDown, onChange: handleOnQuantityChange, ref: forwardedRef, size: size, suffix: inputSuffix, type: isPressEnterToChange ? 'text' : 'number', value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : '', step: step, onFocus: onFocusProp, __unstableStateReducer: __unstableStateReducer }); } /** * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`). * * * ```jsx * import { __experimentalUnitControl as UnitControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const Example = () => { * const [ value, setValue ] = useState( '10px' ); * * return <UnitControl __next40pxDefaultSize onChange={ setValue } value={ value } />; * }; * ``` */ const UnitControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedUnitControl); /* harmony default export */ const unit_control = (UnitControl); ;// ./node_modules/@wordpress/components/build-module/border-control/border-control/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ // If either width or color are defined, the border is considered valid // and a border style can be set as well. const isValidBorder = border => { const hasWidth = border?.width !== undefined && border.width !== ''; const hasColor = border?.color !== undefined; return hasWidth || hasColor; }; function useBorderControl(props) { const { className, colors = [], isCompact, onChange, enableAlpha = true, enableStyle = true, shouldSanitizeBorder = true, size = 'default', value: border, width, __experimentalIsRenderedInSidebar = false, __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize, ...otherProps } = useContextSystem(props, 'BorderControl'); maybeWarnDeprecated36pxSize({ componentName: 'BorderControl', __next40pxDefaultSize, size, __shouldNotWarnDeprecated36pxSize }); const computedSize = size === 'default' && __next40pxDefaultSize ? '__unstable-large' : size; const [widthValue, originalWidthUnit] = parseQuantityAndUnitFromRawValue(border?.width); const widthUnit = originalWidthUnit || 'px'; const hadPreviousZeroWidth = widthValue === 0; const [colorSelection, setColorSelection] = (0,external_wp_element_namespaceObject.useState)(); const [styleSelection, setStyleSelection] = (0,external_wp_element_namespaceObject.useState)(); const isStyleSettable = shouldSanitizeBorder ? isValidBorder(border) : true; const onBorderChange = (0,external_wp_element_namespaceObject.useCallback)(newBorder => { if (shouldSanitizeBorder && !isValidBorder(newBorder)) { onChange(undefined); return; } onChange(newBorder); }, [onChange, shouldSanitizeBorder]); const onWidthChange = (0,external_wp_element_namespaceObject.useCallback)(newWidth => { const newWidthValue = newWidth === '' ? undefined : newWidth; const [parsedValue] = parseQuantityAndUnitFromRawValue(newWidth); const hasZeroWidth = parsedValue === 0; const updatedBorder = { ...border, width: newWidthValue }; // Setting the border width explicitly to zero will also set the // border style to `none` and clear the border color. if (hasZeroWidth && !hadPreviousZeroWidth) { // Before clearing the color and style selections, keep track of // the current selections so they can be restored when the width // changes to a non-zero value. setColorSelection(border?.color); setStyleSelection(border?.style); // Clear the color and style border properties. updatedBorder.color = undefined; updatedBorder.style = 'none'; } // Selection has changed from zero border width to non-zero width. if (!hasZeroWidth && hadPreviousZeroWidth) { // Restore previous border color and style selections if width // is now not zero. if (updatedBorder.color === undefined) { updatedBorder.color = colorSelection; } if (updatedBorder.style === 'none') { updatedBorder.style = styleSelection; } } onBorderChange(updatedBorder); }, [border, hadPreviousZeroWidth, colorSelection, styleSelection, onBorderChange]); const onSliderChange = (0,external_wp_element_namespaceObject.useCallback)(value => { onWidthChange(`${value}${widthUnit}`); }, [onWidthChange, widthUnit]); // Generate class names. const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderControl, className); }, [className, cx]); let wrapperWidth = width; if (isCompact) { // Widths below represent the minimum usable width for compact controls. // Taller controls contain greater internal padding, thus greater width. wrapperWidth = size === '__unstable-large' ? '116px' : '90px'; } const innerWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { const widthStyle = !!wrapperWidth && styles_wrapperWidth; const heightStyle = wrapperHeight(computedSize); return cx(innerWrapper(), widthStyle, heightStyle); }, [wrapperWidth, cx, computedSize]); const sliderClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderSlider()); }, [cx]); return { ...otherProps, className: classes, colors, enableAlpha, enableStyle, innerWrapperClassName, inputWidth: wrapperWidth, isStyleSettable, onBorderChange, onSliderChange, onWidthChange, previousStyleSelection: styleSelection, sliderClassName, value: border, widthUnit, widthValue, size: computedSize, __experimentalIsRenderedInSidebar, __next40pxDefaultSize }; } ;// ./node_modules/@wordpress/components/build-module/border-control/border-control/component.js /** * WordPress dependencies */ /** * Internal dependencies */ const BorderLabel = props => { const { label, hideLabelFromVision } = props; if (!label) { return null; } return hideLabelFromVision ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "legend", children: label }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledLabel, { as: "legend", children: label }); }; const UnconnectedBorderControl = (props, forwardedRef) => { const { __next40pxDefaultSize = false, colors, disableCustomColors, disableUnits, enableAlpha, enableStyle, hideLabelFromVision, innerWrapperClassName, inputWidth, isStyleSettable, label, onBorderChange, onSliderChange, onWidthChange, placeholder, __unstablePopoverProps, previousStyleSelection, showDropdownHeader, size, sliderClassName, value: border, widthUnit, widthValue, withSlider, __experimentalIsRenderedInSidebar, ...otherProps } = useBorderControl(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(component, { as: "fieldset", ...otherProps, ref: forwardedRef, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BorderLabel, { label: label, hideLabelFromVision: hideLabelFromVision }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { spacing: 4, className: innerWrapperClassName, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(unit_control, { __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { marginRight: 1, marginBottom: 0, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_control_dropdown_component, { border: border, colors: colors, __unstablePopoverProps: __unstablePopoverProps, disableCustomColors: disableCustomColors, enableAlpha: enableAlpha, enableStyle: enableStyle, isStyleSettable: isStyleSettable, onChange: onBorderChange, previousStyleSelection: previousStyleSelection, __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, size: size }) }), label: (0,external_wp_i18n_namespaceObject.__)('Border width'), hideLabelFromVision: true, min: 0, onChange: onWidthChange, value: border?.width || '', placeholder: placeholder, disableUnits: disableUnits, __unstableInputWidth: inputWidth, size: size }), withSlider && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(range_control, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Border width'), hideLabelFromVision: true, className: sliderClassName, initialPosition: 0, max: 100, min: 0, onChange: onSliderChange, step: ['px', '%'].includes(widthUnit) ? 1 : 0.1, value: widthValue || undefined, withInputField: false, __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true })] })] }); }; /** * The `BorderControl` brings together internal sub-components which allow users to * set the various properties of a border. The first sub-component, a * `BorderDropdown` contains options representing border color and style. The * border width is controlled via a `UnitControl` and an optional `RangeControl`. * * Border radius is not covered by this control as it may be desired separate to * color, style, and width. For example, the border radius may be absorbed under * a "shape" abstraction. * * ```jsx * import { BorderControl } from '@wordpress/components'; * import { __ } from '@wordpress/i18n'; * * const colors = [ * { name: 'Blue 20', color: '#72aee6' }, * // ... * ]; * * const MyBorderControl = () => { * const [ border, setBorder ] = useState(); * const onChange = ( newBorder ) => setBorder( newBorder ); * * return ( * <BorderControl * __next40pxDefaultSize * colors={ colors } * label={ __( 'Border' ) } * onChange={ onChange } * value={ border } * /> * ); * }; * ``` */ const BorderControl = contextConnect(UnconnectedBorderControl, 'BorderControl'); /* harmony default export */ const border_control_component = (BorderControl); ;// ./node_modules/@wordpress/components/build-module/grid/utils.js /** * External dependencies */ const utils_ALIGNMENTS = { bottom: { alignItems: 'flex-end', justifyContent: 'center' }, bottomLeft: { alignItems: 'flex-start', justifyContent: 'flex-end' }, bottomRight: { alignItems: 'flex-end', justifyContent: 'flex-end' }, center: { alignItems: 'center', justifyContent: 'center' }, spaced: { alignItems: 'center', justifyContent: 'space-between' }, left: { alignItems: 'center', justifyContent: 'flex-start' }, right: { alignItems: 'center', justifyContent: 'flex-end' }, stretch: { alignItems: 'stretch' }, top: { alignItems: 'flex-start', justifyContent: 'center' }, topLeft: { alignItems: 'flex-start', justifyContent: 'flex-start' }, topRight: { alignItems: 'flex-start', justifyContent: 'flex-end' } }; function utils_getAlignmentProps(alignment) { const alignmentProps = alignment ? utils_ALIGNMENTS[alignment] : {}; return alignmentProps; } ;// ./node_modules/@wordpress/components/build-module/grid/hook.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function useGrid(props) { const { align, alignment, className, columnGap, columns = 2, gap = 3, isInline = false, justify, rowGap, rows, templateColumns, templateRows, ...otherProps } = useContextSystem(props, 'Grid'); const columnsAsArray = Array.isArray(columns) ? columns : [columns]; const column = useResponsiveValue(columnsAsArray); const rowsAsArray = Array.isArray(rows) ? rows : [rows]; const row = useResponsiveValue(rowsAsArray); const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column}, 1fr )`; const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`; const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { const alignmentProps = utils_getAlignmentProps(alignment); const gridClasses = /*#__PURE__*/emotion_react_browser_esm_css({ alignItems: align, display: isInline ? 'inline-grid' : 'grid', gap: `calc( ${config_values.gridBase} * ${gap} )`, gridTemplateColumns: gridTemplateColumns || undefined, gridTemplateRows: gridTemplateRows || undefined, gridRowGap: rowGap, gridColumnGap: columnGap, justifyContent: justify, verticalAlign: isInline ? 'middle' : undefined, ...alignmentProps }, true ? "" : 0, true ? "" : 0); return cx(gridClasses, className); }, [align, alignment, className, columnGap, cx, gap, gridTemplateColumns, gridTemplateRows, isInline, justify, rowGap]); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/grid/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedGrid(props, forwardedRef) { const gridProps = useGrid(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...gridProps, ref: forwardedRef }); } /** * `Grid` is a primitive layout component that can arrange content in a grid configuration. * * ```jsx * import { * __experimentalGrid as Grid, * __experimentalText as Text * } from `@wordpress/components`; * * function Example() { * return ( * <Grid columns={ 3 }> * <Text>Code</Text> * <Text>is</Text> * <Text>Poetry</Text> * </Grid> * ); * } * ``` */ const Grid = contextConnect(UnconnectedGrid, 'Grid'); /* harmony default export */ const grid_component = (Grid); ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-split-controls/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBorderBoxControlSplitControls(props) { const { className, colors = [], enableAlpha = false, enableStyle = true, size = 'default', __experimentalIsRenderedInSidebar = false, ...otherProps } = useContextSystem(props, 'BorderBoxControlSplitControls'); // Generate class names. const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderBoxControlSplitControls(size), className); }, [cx, className, size]); const centeredClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(centeredBorderControl, className); }, [cx, className]); const rightAlignedClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(rightBorderControl(), className); }, [cx, className]); return { ...otherProps, centeredClassName, className: classes, colors, enableAlpha, enableStyle, rightAlignedClassName, size, __experimentalIsRenderedInSidebar }; } ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-split-controls/component.js /** * WordPress dependencies */ /** * Internal dependencies */ const BorderBoxControlSplitControls = (props, forwardedRef) => { const { centeredClassName, colors, disableCustomColors, enableAlpha, enableStyle, onChange, popoverPlacement, popoverOffset, rightAlignedClassName, size = 'default', value, __experimentalIsRenderedInSidebar, ...otherProps } = useBorderBoxControlSplitControls(props); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => popoverPlacement ? { placement: popoverPlacement, offset: popoverOffset, anchor: popoverAnchor, shift: true } : undefined, [popoverPlacement, popoverOffset, popoverAnchor]); const sharedBorderControlProps = { colors, disableCustomColors, enableAlpha, enableStyle, isCompact: true, __experimentalIsRenderedInSidebar, size, __shouldNotWarnDeprecated36pxSize: true }; const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, forwardedRef]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(grid_component, { ...otherProps, ref: mergedRef, gap: 3, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_box_control_visualizer_component, { value: value, size: size }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_control_component, { className: centeredClassName, hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)('Top border'), onChange: newBorder => onChange(newBorder, 'top'), __unstablePopoverProps: popoverProps, value: value?.top, ...sharedBorderControlProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_control_component, { hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)('Left border'), onChange: newBorder => onChange(newBorder, 'left'), __unstablePopoverProps: popoverProps, value: value?.left, ...sharedBorderControlProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_control_component, { className: rightAlignedClassName, hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)('Right border'), onChange: newBorder => onChange(newBorder, 'right'), __unstablePopoverProps: popoverProps, value: value?.right, ...sharedBorderControlProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_control_component, { className: centeredClassName, hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)('Bottom border'), onChange: newBorder => onChange(newBorder, 'bottom'), __unstablePopoverProps: popoverProps, value: value?.bottom, ...sharedBorderControlProps })] }); }; const ConnectedBorderBoxControlSplitControls = contextConnect(BorderBoxControlSplitControls, 'BorderBoxControlSplitControls'); /* harmony default export */ const border_box_control_split_controls_component = (ConnectedBorderBoxControlSplitControls); ;// ./node_modules/@wordpress/components/build-module/utils/unit-values.js const UNITED_VALUE_REGEX = /^([\d.\-+]*)\s*(fr|cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%|cap|ic|rlh|vi|vb|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx|svw|lvw|dvw|svh|lvh|dvh|svi|lvi|dvi|svb|lvb|dvb|svmin|lvmin|dvmin|svmax|lvmax|dvmax)?$/; /** * Parses a number and unit from a value. * * @param toParse Value to parse * * @return The extracted number and unit. */ function parseCSSUnitValue(toParse) { const value = toParse.trim(); const matched = value.match(UNITED_VALUE_REGEX); if (!matched) { return [undefined, undefined]; } const [, num, unit] = matched; let numParsed = parseFloat(num); numParsed = Number.isNaN(numParsed) ? undefined : numParsed; return [numParsed, unit]; } /** * Combines a value and a unit into a unit value. * * @param value * @param unit * * @return The unit value. */ function createCSSUnitValue(value, unit) { return `${value}${unit}`; } ;// ./node_modules/@wordpress/components/build-module/border-box-control/utils.js /** * External dependencies */ /** * Internal dependencies */ const utils_sides = ['top', 'right', 'bottom', 'left']; const borderProps = ['color', 'style', 'width']; const isEmptyBorder = border => { if (!border) { return true; } return !borderProps.some(prop => border[prop] !== undefined); }; const isDefinedBorder = border => { // No border, no worries :) if (!border) { return false; } // If we have individual borders per side within the border object we // need to check whether any of those side borders have been set. if (hasSplitBorders(border)) { const allSidesEmpty = utils_sides.every(side => isEmptyBorder(border[side])); return !allSidesEmpty; } // If we have a top-level border only, check if that is empty. e.g. // { color: undefined, style: undefined, width: undefined } // Border radius can still be set within the border object as it is // handled separately. return !isEmptyBorder(border); }; const isCompleteBorder = border => { if (!border) { return false; } return borderProps.every(prop => border[prop] !== undefined); }; const hasSplitBorders = (border = {}) => { return Object.keys(border).some(side => utils_sides.indexOf(side) !== -1); }; const hasMixedBorders = borders => { if (!hasSplitBorders(borders)) { return false; } const shorthandBorders = utils_sides.map(side => getShorthandBorderStyle(borders?.[side])); return !shorthandBorders.every(border => border === shorthandBorders[0]); }; const getSplitBorders = border => { if (!border || isEmptyBorder(border)) { return undefined; } return { top: border, right: border, bottom: border, left: border }; }; const getBorderDiff = (original, updated) => { const diff = {}; if (original.color !== updated.color) { diff.color = updated.color; } if (original.style !== updated.style) { diff.style = updated.style; } if (original.width !== updated.width) { diff.width = updated.width; } return diff; }; const getCommonBorder = borders => { if (!borders) { return undefined; } const colors = []; const styles = []; const widths = []; utils_sides.forEach(side => { colors.push(borders[side]?.color); styles.push(borders[side]?.style); widths.push(borders[side]?.width); }); const allColorsMatch = colors.every(value => value === colors[0]); const allStylesMatch = styles.every(value => value === styles[0]); const allWidthsMatch = widths.every(value => value === widths[0]); return { color: allColorsMatch ? colors[0] : undefined, style: allStylesMatch ? styles[0] : undefined, width: allWidthsMatch ? widths[0] : getMostCommonUnit(widths) }; }; const getShorthandBorderStyle = (border, fallbackBorder) => { if (isEmptyBorder(border)) { return fallbackBorder; } const { color: fallbackColor, style: fallbackStyle, width: fallbackWidth } = fallbackBorder || {}; const { color = fallbackColor, style = fallbackStyle, width = fallbackWidth } = border; const hasVisibleBorder = !!width && width !== '0' || !!color; const borderStyle = hasVisibleBorder ? style || 'solid' : style; return [width, borderStyle, color].filter(Boolean).join(' '); }; const getMostCommonUnit = values => { // Collect all the CSS units. const units = values.map(value => value === undefined ? undefined : parseCSSUnitValue(`${value}`)[1]); // Return the most common unit out of only the defined CSS units. const filteredUnits = units.filter(value => value !== undefined); return mode(filteredUnits); }; /** * Finds the mode value out of the array passed favouring the first value * as a tiebreaker. * * @param values Values to determine the mode from. * * @return The mode value. */ function mode(values) { if (values.length === 0) { return undefined; } const map = {}; let maxCount = 0; let currentMode; values.forEach(value => { map[value] = map[value] === undefined ? 1 : map[value] + 1; if (map[value] > maxCount) { currentMode = value; maxCount = map[value]; } }); return currentMode; } ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBorderBoxControl(props) { const { className, colors = [], onChange, enableAlpha = false, enableStyle = true, size = 'default', value, __experimentalIsRenderedInSidebar = false, __next40pxDefaultSize, ...otherProps } = useContextSystem(props, 'BorderBoxControl'); maybeWarnDeprecated36pxSize({ componentName: 'BorderBoxControl', __next40pxDefaultSize, size }); const computedSize = size === 'default' && __next40pxDefaultSize ? '__unstable-large' : size; const mixedBorders = hasMixedBorders(value); const splitBorders = hasSplitBorders(value); const linkedValue = splitBorders ? getCommonBorder(value) : value; const splitValue = splitBorders ? value : getSplitBorders(value); // If no numeric width value is set, the unit select will be disabled. const hasWidthValue = !isNaN(parseFloat(`${linkedValue?.width}`)); const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!mixedBorders); const toggleLinked = () => setIsLinked(!isLinked); const onLinkedChange = newBorder => { if (!newBorder) { return onChange(undefined); } // If we have all props defined on the new border apply it. if (!mixedBorders || isCompleteBorder(newBorder)) { return onChange(isEmptyBorder(newBorder) ? undefined : newBorder); } // If we had mixed borders we might have had some shared border props // that we need to maintain. For example; we could have mixed borders // with all the same color but different widths. Then from the linked // control we change the color. We should keep the separate widths. const changes = getBorderDiff(linkedValue, newBorder); const updatedBorders = { top: { ...value?.top, ...changes }, right: { ...value?.right, ...changes }, bottom: { ...value?.bottom, ...changes }, left: { ...value?.left, ...changes } }; if (hasMixedBorders(updatedBorders)) { return onChange(updatedBorders); } const filteredResult = isEmptyBorder(updatedBorders.top) ? undefined : updatedBorders.top; onChange(filteredResult); }; const onSplitChange = (newBorder, side) => { const updatedBorders = { ...splitValue, [side]: newBorder }; if (hasMixedBorders(updatedBorders)) { onChange(updatedBorders); } else { onChange(newBorder); } }; const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderBoxControl, className); }, [cx, className]); const linkedControlClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(linkedBorderControl()); }, [cx]); const wrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(wrapper); }, [cx]); return { ...otherProps, className: classes, colors, disableUnits: mixedBorders && !hasWidthValue, enableAlpha, enableStyle, hasMixedBorders: mixedBorders, isLinked, linkedControlClassName, onLinkedChange, onSplitChange, toggleLinked, linkedValue, size: computedSize, splitValue, wrapperClassName, __experimentalIsRenderedInSidebar }; } ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control/component.js /** * WordPress dependencies */ /** * Internal dependencies */ const component_BorderLabel = props => { const { label, hideLabelFromVision } = props; if (!label) { return null; } return hideLabelFromVision ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "label", children: label }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledLabel, { children: label }); }; const UnconnectedBorderBoxControl = (props, forwardedRef) => { const { className, colors, disableCustomColors, disableUnits, enableAlpha, enableStyle, hasMixedBorders, hideLabelFromVision, isLinked, label, linkedControlClassName, linkedValue, onLinkedChange, onSplitChange, popoverPlacement, popoverOffset, size, splitValue, toggleLinked, wrapperClassName, __experimentalIsRenderedInSidebar, ...otherProps } = useBorderBoxControl(props); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => popoverPlacement ? { placement: popoverPlacement, offset: popoverOffset, anchor: popoverAnchor, shift: true } : undefined, [popoverPlacement, popoverOffset, popoverAnchor]); const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, forwardedRef]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(component, { className: className, ...otherProps, ref: mergedRef, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component_BorderLabel, { label: label, hideLabelFromVision: hideLabelFromVision }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(component, { className: wrapperClassName, children: [isLinked ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_control_component, { className: linkedControlClassName, colors: colors, disableUnits: disableUnits, disableCustomColors: disableCustomColors, enableAlpha: enableAlpha, enableStyle: enableStyle, onChange: onLinkedChange, placeholder: hasMixedBorders ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : undefined, __unstablePopoverProps: popoverProps, shouldSanitizeBorder: false // This component will handle that. , value: linkedValue, withSlider: true, width: size === '__unstable-large' ? '116px' : '110px', __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, __shouldNotWarnDeprecated36pxSize: true, size: size }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_box_control_split_controls_component, { colors: colors, disableCustomColors: disableCustomColors, enableAlpha: enableAlpha, enableStyle: enableStyle, onChange: onSplitChange, popoverPlacement: popoverPlacement, popoverOffset: popoverOffset, value: splitValue, __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, size: size }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_box_control_linked_button_component, { onClick: toggleLinked, isLinked: isLinked, size: size })] })] }); }; /** * An input control for the color, style, and width of the border of a box. The * border can be customized as a whole, or individually for each side of the box. * * ```jsx * import { BorderBoxControl } from '@wordpress/components'; * import { __ } from '@wordpress/i18n'; * * const colors = [ * { name: 'Blue 20', color: '#72aee6' }, * // ... * ]; * * const MyBorderBoxControl = () => { * const defaultBorder = { * color: '#72aee6', * style: 'dashed', * width: '1px', * }; * const [ borders, setBorders ] = useState( { * top: defaultBorder, * right: defaultBorder, * bottom: defaultBorder, * left: defaultBorder, * } ); * const onChange = ( newBorders ) => setBorders( newBorders ); * * return ( * <BorderBoxControl * __next40pxDefaultSize * colors={ colors } * label={ __( 'Borders' ) } * onChange={ onChange } * value={ borders } * /> * ); * }; * ``` */ const BorderBoxControl = contextConnect(UnconnectedBorderBoxControl, 'BorderBoxControl'); /* harmony default export */ const border_box_control_component = (BorderBoxControl); ;// ./node_modules/@wordpress/icons/build-module/library/settings.js /** * WordPress dependencies */ const settings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" })] }); /* harmony default export */ const library_settings = (settings); ;// ./node_modules/@wordpress/components/build-module/box-control/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ const CUSTOM_VALUE_SETTINGS = { px: { max: 300, step: 1 }, '%': { max: 100, step: 1 }, vw: { max: 100, step: 1 }, vh: { max: 100, step: 1 }, em: { max: 10, step: 0.1 }, rm: { max: 10, step: 0.1 }, svw: { max: 100, step: 1 }, lvw: { max: 100, step: 1 }, dvw: { max: 100, step: 1 }, svh: { max: 100, step: 1 }, lvh: { max: 100, step: 1 }, dvh: { max: 100, step: 1 }, vi: { max: 100, step: 1 }, svi: { max: 100, step: 1 }, lvi: { max: 100, step: 1 }, dvi: { max: 100, step: 1 }, vb: { max: 100, step: 1 }, svb: { max: 100, step: 1 }, lvb: { max: 100, step: 1 }, dvb: { max: 100, step: 1 }, vmin: { max: 100, step: 1 }, svmin: { max: 100, step: 1 }, lvmin: { max: 100, step: 1 }, dvmin: { max: 100, step: 1 }, vmax: { max: 100, step: 1 }, svmax: { max: 100, step: 1 }, lvmax: { max: 100, step: 1 }, dvmax: { max: 100, step: 1 } }; const LABELS = { all: (0,external_wp_i18n_namespaceObject.__)('All sides'), top: (0,external_wp_i18n_namespaceObject.__)('Top side'), bottom: (0,external_wp_i18n_namespaceObject.__)('Bottom side'), left: (0,external_wp_i18n_namespaceObject.__)('Left side'), right: (0,external_wp_i18n_namespaceObject.__)('Right side'), vertical: (0,external_wp_i18n_namespaceObject.__)('Top and bottom sides'), horizontal: (0,external_wp_i18n_namespaceObject.__)('Left and right sides') }; const DEFAULT_VALUES = { top: undefined, right: undefined, bottom: undefined, left: undefined }; const ALL_SIDES = ['top', 'right', 'bottom', 'left']; /** * Gets an items with the most occurrence within an array * https://stackoverflow.com/a/20762713 * * @param arr Array of items to check. * @return The item with the most occurrences. */ function utils_mode(arr) { return arr.sort((a, b) => arr.filter(v => v === a).length - arr.filter(v => v === b).length).pop(); } /** * Gets the merged input value and unit from values data. * * @param values Box values. * @param availableSides Available box sides to evaluate. * * @return A value + unit for the 'all' input. */ function getMergedValue(values = {}, availableSides = ALL_SIDES) { const sides = normalizeSides(availableSides); if (sides.every(side => values[side] === values[sides[0]])) { return values[sides[0]]; } return undefined; } /** * Checks if the values are mixed. * * @param values Box values. * @param availableSides Available box sides to evaluate. * @return Whether the values are mixed. */ function isValueMixed(values = {}, availableSides = ALL_SIDES) { const sides = normalizeSides(availableSides); return sides.some(side => values[side] !== values[sides[0]]); } /** * Determine the most common unit selection to use as a fallback option. * * @param selectedUnits Current unit selections for individual sides. * @return Most common unit selection. */ function getAllUnitFallback(selectedUnits) { if (!selectedUnits || typeof selectedUnits !== 'object') { return undefined; } const filteredUnits = Object.values(selectedUnits).filter(Boolean); return utils_mode(filteredUnits); } /** * Checks to determine if values are defined. * * @param values Box values. * * @return Whether values are mixed. */ function isValuesDefined(values) { return values && Object.values(values).filter( // Switching units when input is empty causes values only // containing units. This gives false positive on mixed values // unless filtered. value => !!value && /\d/.test(value)).length > 0; } /** * Get initial selected side, factoring in whether the sides are linked, * and whether the vertical / horizontal directions are grouped via splitOnAxis. * * @param isLinked Whether the box control's fields are linked. * @param splitOnAxis Whether splitting by horizontal or vertical axis. * @return The initial side. */ function getInitialSide(isLinked, splitOnAxis) { let initialSide = 'all'; if (!isLinked) { initialSide = splitOnAxis ? 'vertical' : 'top'; } return initialSide; } /** * Normalizes provided sides configuration to an array containing only top, * right, bottom and left. This essentially just maps `horizontal` or `vertical` * to their appropriate sides to facilitate correctly determining value for * all input control. * * @param sides Available sides for box control. * @return Normalized sides configuration. */ function normalizeSides(sides) { const filteredSides = []; if (!sides?.length) { return ALL_SIDES; } if (sides.includes('vertical')) { filteredSides.push(...['top', 'bottom']); } else if (sides.includes('horizontal')) { filteredSides.push(...['left', 'right']); } else { const newSides = ALL_SIDES.filter(side => sides.includes(side)); filteredSides.push(...newSides); } return filteredSides; } /** * Applies a value to an object representing top, right, bottom and left sides * while taking into account any custom side configuration. * * @deprecated * * @param currentValues The current values for each side. * @param newValue The value to apply to the sides object. * @param sides Array defining valid sides. * * @return Object containing the updated values for each side. */ function applyValueToSides(currentValues, newValue, sides) { external_wp_deprecated_default()('applyValueToSides', { since: '6.8', version: '7.0' }); const newValues = { ...currentValues }; if (sides?.length) { sides.forEach(side => { if (side === 'vertical') { newValues.top = newValue; newValues.bottom = newValue; } else if (side === 'horizontal') { newValues.left = newValue; newValues.right = newValue; } else { newValues[side] = newValue; } }); } else { ALL_SIDES.forEach(side => newValues[side] = newValue); } return newValues; } /** * Return the allowed sides based on the sides configuration. * * @param sides Sides configuration. * @return Allowed sides. */ function getAllowedSides(sides) { const allowedSides = new Set(!sides ? ALL_SIDES : []); sides?.forEach(allowedSide => { if (allowedSide === 'vertical') { allowedSides.add('top'); allowedSides.add('bottom'); } else if (allowedSide === 'horizontal') { allowedSides.add('right'); allowedSides.add('left'); } else { allowedSides.add(allowedSide); } }); return allowedSides; } /** * Checks if a value is a preset value. * * @param value The value to check. * @param presetKey The preset key to check against. * @return Whether the value is a preset value. */ function isValuePreset(value, presetKey) { return value.startsWith(`var:preset|${presetKey}|`); } /** * Returns the index of the preset value in the presets array. * * @param value The value to check. * @param presetKey The preset key to check against. * @param presets The array of presets to search. * @return The index of the preset value in the presets array. */ function getPresetIndexFromValue(value, presetKey, presets) { if (!isValuePreset(value, presetKey)) { return undefined; } const match = value.match(new RegExp(`^var:preset\\|${presetKey}\\|(.+)$`)); if (!match) { return undefined; } const slug = match[1]; const index = presets.findIndex(preset => { return preset.slug === slug; }); return index !== -1 ? index : undefined; } /** * Returns the preset value from the index. * * @param index The index of the preset value in the presets array. * @param presetKey The preset key to check against. * @param presets The array of presets to search. * @return The preset value from the index. */ function getPresetValueFromIndex(index, presetKey, presets) { const preset = presets[index]; return `var:preset|${presetKey}|${preset.slug}`; } ;// ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-icon-styles.js function box_control_icon_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ const box_control_icon_styles_Root = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1j5nr4z8" } : 0)( true ? { name: "1w884gc", styles: "box-sizing:border-box;display:block;width:24px;height:24px;position:relative;padding:4px" } : 0); const Viewbox = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1j5nr4z7" } : 0)( true ? { name: "i6vjox", styles: "box-sizing:border-box;display:block;position:relative;width:100%;height:100%" } : 0); const strokeFocus = ({ isFocused }) => { return /*#__PURE__*/emotion_react_browser_esm_css({ backgroundColor: 'currentColor', opacity: isFocused ? 1 : 0.3 }, true ? "" : 0, true ? "" : 0); }; const Stroke = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1j5nr4z6" } : 0)("box-sizing:border-box;display:block;pointer-events:none;position:absolute;", strokeFocus, ";" + ( true ? "" : 0)); const VerticalStroke = /*#__PURE__*/emotion_styled_base_browser_esm(Stroke, true ? { target: "e1j5nr4z5" } : 0)( true ? { name: "1k2w39q", styles: "bottom:3px;top:3px;width:2px" } : 0); const HorizontalStroke = /*#__PURE__*/emotion_styled_base_browser_esm(Stroke, true ? { target: "e1j5nr4z4" } : 0)( true ? { name: "1q9b07k", styles: "height:2px;left:3px;right:3px" } : 0); const TopStroke = /*#__PURE__*/emotion_styled_base_browser_esm(HorizontalStroke, true ? { target: "e1j5nr4z3" } : 0)( true ? { name: "abcix4", styles: "top:0" } : 0); const RightStroke = /*#__PURE__*/emotion_styled_base_browser_esm(VerticalStroke, true ? { target: "e1j5nr4z2" } : 0)( true ? { name: "1wf8jf", styles: "right:0" } : 0); const BottomStroke = /*#__PURE__*/emotion_styled_base_browser_esm(HorizontalStroke, true ? { target: "e1j5nr4z1" } : 0)( true ? { name: "8tapst", styles: "bottom:0" } : 0); const LeftStroke = /*#__PURE__*/emotion_styled_base_browser_esm(VerticalStroke, true ? { target: "e1j5nr4z0" } : 0)( true ? { name: "1ode3cm", styles: "left:0" } : 0); ;// ./node_modules/@wordpress/components/build-module/box-control/icon.js /** * Internal dependencies */ const BASE_ICON_SIZE = 24; function BoxControlIcon({ size = 24, side = 'all', sides, ...props }) { const isSideDisabled = value => sides?.length && !sides.includes(value); const hasSide = value => { if (isSideDisabled(value)) { return false; } return side === 'all' || side === value; }; const top = hasSide('top') || hasSide('vertical'); const right = hasSide('right') || hasSide('horizontal'); const bottom = hasSide('bottom') || hasSide('vertical'); const left = hasSide('left') || hasSide('horizontal'); // Simulates SVG Icon scaling. const scale = size / BASE_ICON_SIZE; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(box_control_icon_styles_Root, { style: { transform: `scale(${scale})` }, ...props, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Viewbox, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TopStroke, { isFocused: top }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RightStroke, { isFocused: right }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BottomStroke, { isFocused: bottom }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LeftStroke, { isFocused: left })] }) }); } ;// ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-styles.js function box_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const StyledUnitControl = /*#__PURE__*/emotion_styled_base_browser_esm(unit_control, true ? { target: "e1jovhle5" } : 0)( true ? { name: "1ejyr19", styles: "max-width:90px" } : 0); const InputWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? { target: "e1jovhle4" } : 0)( true ? { name: "1j1lmoi", styles: "grid-column:1/span 3" } : 0); const ResetButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? { target: "e1jovhle3" } : 0)( true ? { name: "tkya7b", styles: "grid-area:1/2;justify-self:end" } : 0); const LinkedButtonWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1jovhle2" } : 0)( true ? { name: "1dfa8al", styles: "grid-area:1/3;justify-self:end" } : 0); const FlexedBoxControlIcon = /*#__PURE__*/emotion_styled_base_browser_esm(BoxControlIcon, true ? { target: "e1jovhle1" } : 0)( true ? { name: "ou8xsw", styles: "flex:0 0 auto" } : 0); const FlexedRangeControl = /*#__PURE__*/emotion_styled_base_browser_esm(range_control, true ? { target: "e1jovhle0" } : 0)("width:100%;margin-inline-end:", space(2), ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/box-control/input-control.js /** * WordPress dependencies */ /** * Internal dependencies */ const box_control_input_control_noop = () => {}; function getSidesToModify(side, sides, isAlt) { const allowedSides = getAllowedSides(sides); let modifiedSides = []; switch (side) { case 'all': modifiedSides = ['top', 'bottom', 'left', 'right']; break; case 'horizontal': modifiedSides = ['left', 'right']; break; case 'vertical': modifiedSides = ['top', 'bottom']; break; default: modifiedSides = [side]; } if (isAlt) { switch (side) { case 'top': modifiedSides.push('bottom'); break; case 'bottom': modifiedSides.push('top'); break; case 'left': modifiedSides.push('left'); break; case 'right': modifiedSides.push('right'); break; } } return modifiedSides.filter(s => allowedSides.has(s)); } function BoxInputControl({ __next40pxDefaultSize, onChange = box_control_input_control_noop, onFocus = box_control_input_control_noop, values, selectedUnits, setSelectedUnits, sides, side, min = 0, presets, presetKey, ...props }) { var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2; const defaultValuesToModify = getSidesToModify(side, sides); const handleOnFocus = event => { onFocus(event, { side }); }; const handleOnChange = nextValues => { onChange(nextValues); }; const handleRawOnValueChange = next => { const nextValues = { ...values }; defaultValuesToModify.forEach(modifiedSide => { nextValues[modifiedSide] = next; }); handleOnChange(nextValues); }; const handleOnValueChange = (next, extra) => { const nextValues = { ...values }; const isNumeric = next !== undefined && !isNaN(parseFloat(next)); const nextValue = isNumeric ? next : undefined; const modifiedSides = getSidesToModify(side, sides, /** * Supports changing pair sides. For example, holding the ALT key * when changing the TOP will also update BOTTOM. */ // @ts-expect-error - TODO: event.altKey is only present when the change event was // triggered by a keyboard event. Should this feature be implemented differently so // it also works with drag events? !!extra?.event.altKey); modifiedSides.forEach(modifiedSide => { nextValues[modifiedSide] = nextValue; }); handleOnChange(nextValues); }; const handleOnUnitChange = next => { const newUnits = { ...selectedUnits }; defaultValuesToModify.forEach(modifiedSide => { newUnits[modifiedSide] = next; }); setSelectedUnits(newUnits); }; const mergedValue = getMergedValue(values, defaultValuesToModify); const hasValues = isValuesDefined(values); const isMixed = hasValues && defaultValuesToModify.length > 1 && isValueMixed(values, defaultValuesToModify); const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(mergedValue); const computedUnit = hasValues ? parsedUnit : selectedUnits[defaultValuesToModify[0]]; const generatedId = (0,external_wp_compose_namespaceObject.useInstanceId)(BoxInputControl, 'box-control-input'); const inputId = [generatedId, side].join('-'); const isMixedUnit = defaultValuesToModify.length > 1 && mergedValue === undefined && defaultValuesToModify.some(s => selectedUnits[s] !== computedUnit); const usedValue = mergedValue === undefined && computedUnit ? computedUnit : mergedValue; const mixedPlaceholder = isMixed || isMixedUnit ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : undefined; const hasPresets = presets && presets.length > 0 && presetKey; const hasPresetValue = hasPresets && mergedValue !== undefined && !isMixed && isValuePreset(mergedValue, presetKey); const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(!hasPresets || !hasPresetValue && !isMixed && mergedValue !== undefined); const presetIndex = hasPresetValue ? getPresetIndexFromValue(mergedValue, presetKey, presets) : undefined; const marks = hasPresets ? [{ value: 0, label: '', tooltip: (0,external_wp_i18n_namespaceObject.__)('None') }].concat(presets.map((preset, index) => { var _preset$name; return { value: index + 1, label: '', tooltip: (_preset$name = preset.name) !== null && _preset$name !== void 0 ? _preset$name : preset.slug }; })) : []; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(InputWrapper, { expanded: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexedBoxControlIcon, { side: side, sides: sides }), showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tooltip, { placement: "top-end", text: LABELS[side], children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledUnitControl, { ...props, min: min, __shouldNotWarnDeprecated36pxSize: true, __next40pxDefaultSize: __next40pxDefaultSize, className: "component-box-control__unit-control", id: inputId, isPressEnterToChange: true, disableUnits: isMixed || isMixedUnit, value: usedValue, onChange: handleOnValueChange, onUnitChange: handleOnUnitChange, onFocus: handleOnFocus, label: LABELS[side], placeholder: mixedPlaceholder, hideLabelFromVision: true }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexedRangeControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, "aria-controls": inputId, label: LABELS[side], hideLabelFromVision: true, onChange: newValue => { handleOnValueChange(newValue !== undefined ? [newValue, computedUnit].join('') : undefined); }, min: isFinite(min) ? min : 0, max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[computedUnit !== null && computedUnit !== void 0 ? computedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10, step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[computedUnit !== null && computedUnit !== void 0 ? computedUnit : 'px']?.step) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1, value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : 0, withInputField: false })] }), hasPresets && !showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexedRangeControl, { __next40pxDefaultSize: true, className: "spacing-sizes-control__range-control", value: presetIndex !== undefined ? presetIndex + 1 : 0, onChange: newIndex => { const newValue = newIndex === 0 || newIndex === undefined ? undefined : getPresetValueFromIndex(newIndex - 1, presetKey, presets); handleRawOnValueChange(newValue); }, withInputField: false, "aria-valuenow": presetIndex !== undefined ? presetIndex + 1 : 0, "aria-valuetext": marks[presetIndex !== undefined ? presetIndex + 1 : 0].tooltip, renderTooltipContent: index => marks[!index ? 0 : index].tooltip, min: 0, max: marks.length - 1, marks: marks, label: LABELS[side], hideLabelFromVision: true, __nextHasNoMarginBottom: true }), hasPresets && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'), icon: library_settings, onClick: () => { setShowCustomValueControl(!showCustomValueControl); }, isPressed: showCustomValueControl, size: "small", iconSize: 24 })] }, `box-control-${side}`); } ;// ./node_modules/@wordpress/components/build-module/box-control/linked-button.js /** * WordPress dependencies */ /** * Internal dependencies */ function LinkedButton({ isLinked, ...props }) { const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink sides') : (0,external_wp_i18n_namespaceObject.__)('Link sides'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { ...props, className: "component-box-control__linked-button", size: "small", icon: isLinked ? library_link : link_off, iconSize: 24, label: label }); } ;// ./node_modules/@wordpress/components/build-module/box-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const defaultInputProps = { min: 0 }; const box_control_noop = () => {}; function box_control_useUniqueId(idProp) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BoxControl, 'inspector-box-control'); return idProp || instanceId; } /** * A control that lets users set values for top, right, bottom, and left. Can be * used as an input control for values like `padding` or `margin`. * * ```jsx * import { useState } from 'react'; * import { BoxControl } from '@wordpress/components'; * * function Example() { * const [ values, setValues ] = useState( { * top: '50px', * left: '10%', * right: '10%', * bottom: '50px', * } ); * * return ( * <BoxControl * __next40pxDefaultSize * values={ values } * onChange={ setValues } * /> * ); * }; * ``` */ function BoxControl({ __next40pxDefaultSize = false, id: idProp, inputProps = defaultInputProps, onChange = box_control_noop, label = (0,external_wp_i18n_namespaceObject.__)('Box Control'), values: valuesProp, units, sides, splitOnAxis = false, allowReset = true, resetValues = DEFAULT_VALUES, presets, presetKey, onMouseOver, onMouseOut }) { const [values, setValues] = use_controlled_state(valuesProp, { fallback: DEFAULT_VALUES }); const inputValues = values || DEFAULT_VALUES; const hasInitialValue = isValuesDefined(valuesProp); const hasOneSide = sides?.length === 1; const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(hasInitialValue); const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!hasInitialValue || !isValueMixed(inputValues) || hasOneSide); const [side, setSide] = (0,external_wp_element_namespaceObject.useState)(getInitialSide(isLinked, splitOnAxis)); // Tracking selected units via internal state allows filtering of CSS unit // only values from being saved while maintaining preexisting unit selection // behaviour. Filtering CSS only values prevents invalid style values. const [selectedUnits, setSelectedUnits] = (0,external_wp_element_namespaceObject.useState)({ top: parseQuantityAndUnitFromRawValue(valuesProp?.top)[1], right: parseQuantityAndUnitFromRawValue(valuesProp?.right)[1], bottom: parseQuantityAndUnitFromRawValue(valuesProp?.bottom)[1], left: parseQuantityAndUnitFromRawValue(valuesProp?.left)[1] }); const id = box_control_useUniqueId(idProp); const headingId = `${id}-heading`; const toggleLinked = () => { setIsLinked(!isLinked); setSide(getInitialSide(!isLinked, splitOnAxis)); }; const handleOnFocus = (_event, { side: nextSide }) => { setSide(nextSide); }; const handleOnChange = nextValues => { onChange(nextValues); setValues(nextValues); setIsDirty(true); }; const handleOnReset = () => { onChange(resetValues); setValues(resetValues); setSelectedUnits(resetValues); setIsDirty(false); }; const inputControlProps = { onMouseOver, onMouseOut, ...inputProps, onChange: handleOnChange, onFocus: handleOnFocus, isLinked, units, selectedUnits, setSelectedUnits, sides, values: inputValues, __next40pxDefaultSize, presets, presetKey }; maybeWarnDeprecated36pxSize({ componentName: 'BoxControl', __next40pxDefaultSize, size: undefined }); const sidesToRender = getAllowedSides(sides); if (presets && !presetKey || !presets && presetKey) { const definedProp = presets ? 'presets' : 'presetKey'; const missingProp = presets ? 'presetKey' : 'presets'; true ? external_wp_warning_default()(`wp.components.BoxControl: the '${missingProp}' prop is required when the '${definedProp}' prop is defined.`) : 0; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(grid_component, { id: id, columns: 3, templateColumns: "1fr min-content min-content", role: "group", "aria-labelledby": headingId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseControl.VisualLabel, { id: headingId, children: label }), isLinked && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BoxInputControl, { side: "all", ...inputControlProps }) }), !hasOneSide && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkedButtonWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkedButton, { onClick: toggleLinked, isLinked: isLinked }) }), !isLinked && splitOnAxis && ['vertical', 'horizontal'].map(axis => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BoxInputControl, { side: axis, ...inputControlProps }, axis)), !isLinked && !splitOnAxis && Array.from(sidesToRender).map(axis => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BoxInputControl, { side: axis, ...inputControlProps }, axis)), allowReset && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetButton, { className: "component-box-control__reset-button", variant: "secondary", size: "small", onClick: handleOnReset, disabled: !isDirty, children: (0,external_wp_i18n_namespaceObject.__)('Reset') })] }); } /* harmony default export */ const box_control = (BoxControl); ;// ./node_modules/@wordpress/components/build-module/button-group/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedButtonGroup(props, ref) { const { className, __shouldNotWarnDeprecated, ...restProps } = props; const classes = dist_clsx('components-button-group', className); if (!__shouldNotWarnDeprecated) { external_wp_deprecated_default()('wp.components.ButtonGroup', { since: '6.8', alternative: 'wp.components.__experimentalToggleGroupControl' }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, role: "group", className: classes, ...restProps }); } /** * ButtonGroup can be used to group any related buttons together. To emphasize * related buttons, a group should share a common container. * * @deprecated Use `ToggleGroupControl` instead. * * ```jsx * import { Button, ButtonGroup } from '@wordpress/components'; * * const MyButtonGroup = () => ( * <ButtonGroup> * <Button variant="primary">Button 1</Button> * <Button variant="primary">Button 2</Button> * </ButtonGroup> * ); * ``` */ const ButtonGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedButtonGroup); /* harmony default export */ const button_group = (ButtonGroup); ;// ./node_modules/@wordpress/components/build-module/elevation/styles.js function elevation_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ const Elevation = true ? { name: "12ip69d", styles: "background:transparent;display:block;margin:0!important;pointer-events:none;position:absolute;will-change:box-shadow" } : 0; ;// ./node_modules/@wordpress/components/build-module/elevation/hook.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function getBoxShadow(value) { const boxShadowColor = `rgba(0, 0, 0, ${value / 20})`; const boxShadow = `0 ${value}px ${value * 2}px 0 ${boxShadowColor}`; return boxShadow; } function useElevation(props) { const { active, borderRadius = 'inherit', className, focus, hover, isInteractive = false, offset = 0, value = 0, ...otherProps } = useContextSystem(props, 'Elevation'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { let hoverValue = isValueDefined(hover) ? hover : value * 2; let activeValue = isValueDefined(active) ? active : value / 2; if (!isInteractive) { hoverValue = isValueDefined(hover) ? hover : undefined; activeValue = isValueDefined(active) ? active : undefined; } const transition = `box-shadow ${config_values.transitionDuration} ${config_values.transitionTimingFunction}`; const sx = {}; sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({ borderRadius, bottom: offset, boxShadow: getBoxShadow(value), opacity: config_values.elevationIntensity, left: offset, right: offset, top: offset }, /*#__PURE__*/emotion_react_browser_esm_css("@media not ( prefers-reduced-motion ){transition:", transition, ";}" + ( true ? "" : 0), true ? "" : 0), true ? "" : 0, true ? "" : 0); if (isValueDefined(hoverValue)) { sx.hover = /*#__PURE__*/emotion_react_browser_esm_css("*:hover>&{box-shadow:", getBoxShadow(hoverValue), ";}" + ( true ? "" : 0), true ? "" : 0); } if (isValueDefined(activeValue)) { sx.active = /*#__PURE__*/emotion_react_browser_esm_css("*:active>&{box-shadow:", getBoxShadow(activeValue), ";}" + ( true ? "" : 0), true ? "" : 0); } if (isValueDefined(focus)) { sx.focus = /*#__PURE__*/emotion_react_browser_esm_css("*:focus>&{box-shadow:", getBoxShadow(focus), ";}" + ( true ? "" : 0), true ? "" : 0); } return cx(Elevation, sx.Base, sx.hover, sx.focus, sx.active, className); }, [active, borderRadius, className, cx, focus, hover, isInteractive, offset, value]); return { ...otherProps, className: classes, 'aria-hidden': true }; } ;// ./node_modules/@wordpress/components/build-module/elevation/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedElevation(props, forwardedRef) { const elevationProps = useElevation(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...elevationProps, ref: forwardedRef }); } /** * `Elevation` is a core component that renders shadow, using the component * system's shadow system. * * The shadow effect is generated using the `value` prop. * * ```jsx * import { * __experimentalElevation as Elevation, * __experimentalSurface as Surface, * __experimentalText as Text, * } from '@wordpress/components'; * * function Example() { * return ( * <Surface> * <Text>Code is Poetry</Text> * <Elevation value={ 5 } /> * </Surface> * ); * } * ``` */ const component_Elevation = contextConnect(UnconnectedElevation, 'Elevation'); /* harmony default export */ const elevation_component = (component_Elevation); ;// ./node_modules/@wordpress/components/build-module/card/styles.js function card_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ // Since the border for `Card` is rendered via the `box-shadow` property // (as opposed to the `border` property), the value of the border radius needs // to be adjusted by removing 1px (this is because the `box-shadow` renders // as an "outer radius"). const adjustedBorderRadius = `calc(${config_values.radiusLarge} - 1px)`; const Card = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:0 0 0 1px ", config_values.surfaceBorderColor, ";outline:none;" + ( true ? "" : 0), true ? "" : 0); const Header = true ? { name: "1showjb", styles: "border-bottom:1px solid;box-sizing:border-box;&:last-child{border-bottom:none;}" } : 0; const Footer = true ? { name: "14n5oej", styles: "border-top:1px solid;box-sizing:border-box;&:first-of-type{border-top:none;}" } : 0; const Content = true ? { name: "13udsys", styles: "height:100%" } : 0; const Body = true ? { name: "6ywzd", styles: "box-sizing:border-box;height:auto;max-height:100%" } : 0; const Media = true ? { name: "dq805e", styles: "box-sizing:border-box;overflow:hidden;&>img,&>iframe{display:block;height:auto;max-width:100%;width:100%;}" } : 0; const Divider = true ? { name: "c990dr", styles: "box-sizing:border-box;display:block;width:100%" } : 0; const borderRadius = /*#__PURE__*/emotion_react_browser_esm_css("&:first-of-type{border-top-left-radius:", adjustedBorderRadius, ";border-top-right-radius:", adjustedBorderRadius, ";}&:last-of-type{border-bottom-left-radius:", adjustedBorderRadius, ";border-bottom-right-radius:", adjustedBorderRadius, ";}" + ( true ? "" : 0), true ? "" : 0); const borderColor = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", config_values.colorDivider, ";" + ( true ? "" : 0), true ? "" : 0); const boxShadowless = true ? { name: "1t90u8d", styles: "box-shadow:none" } : 0; const borderless = true ? { name: "1e1ncky", styles: "border:none" } : 0; const rounded = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", adjustedBorderRadius, ";" + ( true ? "" : 0), true ? "" : 0); const xSmallCardPadding = /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingXSmall, ";" + ( true ? "" : 0), true ? "" : 0); const cardPaddings = { large: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingLarge, ";" + ( true ? "" : 0), true ? "" : 0), medium: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingMedium, ";" + ( true ? "" : 0), true ? "" : 0), small: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingSmall, ";" + ( true ? "" : 0), true ? "" : 0), xSmall: xSmallCardPadding, // The `extraSmall` size is not officially documented, but the following styles // are kept for legacy reasons to support older values of the `size` prop. extraSmall: xSmallCardPadding }; const shady = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.ui.backgroundDisabled, ";" + ( true ? "" : 0), true ? "" : 0); ;// ./node_modules/@wordpress/components/build-module/surface/styles.js /** * External dependencies */ /** * Internal dependencies */ const Surface = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", config_values.surfaceColor, ";color:", COLORS.gray[900], ";position:relative;" + ( true ? "" : 0), true ? "" : 0); const background = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", config_values.surfaceBackgroundColor, ";" + ( true ? "" : 0), true ? "" : 0); function getBorders({ borderBottom, borderLeft, borderRight, borderTop }) { const borderStyle = `1px solid ${config_values.surfaceBorderColor}`; return /*#__PURE__*/emotion_react_browser_esm_css({ borderBottom: borderBottom ? borderStyle : undefined, borderLeft: borderLeft ? borderStyle : undefined, borderRight: borderRight ? borderStyle : undefined, borderTop: borderTop ? borderStyle : undefined }, true ? "" : 0, true ? "" : 0); } const primary = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0); const secondary = /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundTintColor, ";" + ( true ? "" : 0), true ? "" : 0); const tertiary = /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundTertiaryColor, ";" + ( true ? "" : 0), true ? "" : 0); const customBackgroundSize = surfaceBackgroundSize => [surfaceBackgroundSize, surfaceBackgroundSize].join(' '); const dottedBackground1 = surfaceBackgroundSizeDotted => ['90deg', [config_values.surfaceBackgroundColor, surfaceBackgroundSizeDotted].join(' '), 'transparent 1%'].join(','); const dottedBackground2 = surfaceBackgroundSizeDotted => [[config_values.surfaceBackgroundColor, surfaceBackgroundSizeDotted].join(' '), 'transparent 1%'].join(','); const dottedBackgroundCombined = surfaceBackgroundSizeDotted => [`linear-gradient( ${dottedBackground1(surfaceBackgroundSizeDotted)} ) center`, `linear-gradient( ${dottedBackground2(surfaceBackgroundSizeDotted)} ) center`, config_values.surfaceBorderBoldColor].join(','); const getDotted = (surfaceBackgroundSize, surfaceBackgroundSizeDotted) => /*#__PURE__*/emotion_react_browser_esm_css("background:", dottedBackgroundCombined(surfaceBackgroundSizeDotted), ";background-size:", customBackgroundSize(surfaceBackgroundSize), ";" + ( true ? "" : 0), true ? "" : 0); const gridBackground1 = [`${config_values.surfaceBorderSubtleColor} 1px`, 'transparent 1px'].join(','); const gridBackground2 = ['90deg', `${config_values.surfaceBorderSubtleColor} 1px`, 'transparent 1px'].join(','); const gridBackgroundCombined = [`linear-gradient( ${gridBackground1} )`, `linear-gradient( ${gridBackground2} )`].join(','); const getGrid = surfaceBackgroundSize => { return /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundColor, ";background-image:", gridBackgroundCombined, ";background-size:", customBackgroundSize(surfaceBackgroundSize), ";" + ( true ? "" : 0), true ? "" : 0); }; const getVariant = (variant, surfaceBackgroundSize, surfaceBackgroundSizeDotted) => { switch (variant) { case 'dotted': { return getDotted(surfaceBackgroundSize, surfaceBackgroundSizeDotted); } case 'grid': { return getGrid(surfaceBackgroundSize); } case 'primary': { return primary; } case 'secondary': { return secondary; } case 'tertiary': { return tertiary; } } }; ;// ./node_modules/@wordpress/components/build-module/surface/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useSurface(props) { const { backgroundSize = 12, borderBottom = false, borderLeft = false, borderRight = false, borderTop = false, className, variant = 'primary', ...otherProps } = useContextSystem(props, 'Surface'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { const sx = { borders: getBorders({ borderBottom, borderLeft, borderRight, borderTop }) }; return cx(Surface, sx.borders, getVariant(variant, `${backgroundSize}px`, `${backgroundSize - 1}px`), className); }, [backgroundSize, borderBottom, borderLeft, borderRight, borderTop, className, cx, variant]); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/card/card/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function hook_useDeprecatedProps({ elevation, isElevated, ...otherProps }) { const propsToReturn = { ...otherProps }; let computedElevation = elevation; if (isElevated) { var _computedElevation; external_wp_deprecated_default()('Card isElevated prop', { since: '5.9', alternative: 'elevation' }); (_computedElevation = computedElevation) !== null && _computedElevation !== void 0 ? _computedElevation : computedElevation = 2; } // The `elevation` prop should only be passed when it's not `undefined`, // otherwise it will override the value that gets derived from `useContextSystem`. if (typeof computedElevation !== 'undefined') { propsToReturn.elevation = computedElevation; } return propsToReturn; } function useCard(props) { const { className, elevation = 0, isBorderless = false, isRounded = true, size = 'medium', ...otherProps } = useContextSystem(hook_useDeprecatedProps(props), 'Card'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(Card, isBorderless && boxShadowless, isRounded && rounded, className); }, [className, cx, isBorderless, isRounded]); const surfaceProps = useSurface({ ...otherProps, className: classes }); return { ...surfaceProps, elevation, isBorderless, isRounded, size }; } ;// ./node_modules/@wordpress/components/build-module/card/card/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnconnectedCard(props, forwardedRef) { const { children, elevation, isBorderless, isRounded, size, ...otherProps } = useCard(props); const elevationBorderRadius = isRounded ? config_values.radiusLarge : 0; const cx = useCx(); const elevationClassName = (0,external_wp_element_namespaceObject.useMemo)(() => cx(/*#__PURE__*/emotion_react_browser_esm_css({ borderRadius: elevationBorderRadius }, true ? "" : 0, true ? "" : 0)), [cx, elevationBorderRadius]); const contextProviderValue = (0,external_wp_element_namespaceObject.useMemo)(() => { const contextProps = { size, isBorderless }; return { CardBody: contextProps, CardHeader: contextProps, CardFooter: contextProps }; }, [isBorderless, size]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextSystemProvider, { value: contextProviderValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(component, { ...otherProps, ref: forwardedRef, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { className: cx(Content), children: children }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(elevation_component, { className: elevationClassName, isInteractive: false, value: elevation ? 1 : 0 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(elevation_component, { className: elevationClassName, isInteractive: false, value: elevation })] }) }); } /** * `Card` provides a flexible and extensible content container. * `Card` also provides a convenient set of sub-components such as `CardBody`, * `CardHeader`, `CardFooter`, and more. * * ```jsx * import { * Card, * CardHeader, * CardBody, * CardFooter, * __experimentalText as Text, * __experimentalHeading as Heading, * } from `@wordpress/components`; * * function Example() { * return ( * <Card> * <CardHeader> * <Heading level={ 4 }>Card Title</Heading> * </CardHeader> * <CardBody> * <Text>Card Content</Text> * </CardBody> * <CardFooter> * <Text>Card Footer</Text> * </CardFooter> * </Card> * ); * } * ``` */ const component_Card = contextConnect(UnconnectedCard, 'Card'); /* harmony default export */ const card_component = (component_Card); ;// ./node_modules/@wordpress/components/build-module/scrollable/styles.js function scrollable_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const scrollableScrollbar = /*#__PURE__*/emotion_react_browser_esm_css("@media only screen and ( min-device-width: 40em ){&::-webkit-scrollbar{height:12px;width:12px;}&::-webkit-scrollbar-track{background-color:transparent;}&::-webkit-scrollbar-track{background:", config_values.colorScrollbarTrack, ";border-radius:8px;}&::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:", config_values.colorScrollbarThumb, ";border:2px solid rgba( 0, 0, 0, 0 );border-radius:7px;}&:hover::-webkit-scrollbar-thumb{background-color:", config_values.colorScrollbarThumbHover, ";}}" + ( true ? "" : 0), true ? "" : 0); const Scrollable = true ? { name: "13udsys", styles: "height:100%" } : 0; const styles_Content = true ? { name: "bjn8wh", styles: "position:relative" } : 0; const styles_smoothScroll = true ? { name: "7zq9w", styles: "scroll-behavior:smooth" } : 0; const scrollX = true ? { name: "q33xhg", styles: "overflow-x:auto;overflow-y:hidden" } : 0; const scrollY = true ? { name: "103x71s", styles: "overflow-x:hidden;overflow-y:auto" } : 0; const scrollAuto = true ? { name: "umwchj", styles: "overflow-y:auto" } : 0; ;// ./node_modules/@wordpress/components/build-module/scrollable/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useScrollable(props) { const { className, scrollDirection = 'y', smoothScroll = false, ...otherProps } = useContextSystem(props, 'Scrollable'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Scrollable, scrollableScrollbar, smoothScroll && styles_smoothScroll, scrollDirection === 'x' && scrollX, scrollDirection === 'y' && scrollY, scrollDirection === 'auto' && scrollAuto, className), [className, cx, scrollDirection, smoothScroll]); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/scrollable/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedScrollable(props, forwardedRef) { const scrollableProps = useScrollable(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...scrollableProps, ref: forwardedRef }); } /** * `Scrollable` is a layout component that content in a scrollable container. * * ```jsx * import { __experimentalScrollable as Scrollable } from `@wordpress/components`; * * function Example() { * return ( * <Scrollable style={ { maxHeight: 200 } }> * <div style={ { height: 500 } }>...</div> * </Scrollable> * ); * } * ``` */ const component_Scrollable = contextConnect(UnconnectedScrollable, 'Scrollable'); /* harmony default export */ const scrollable_component = (component_Scrollable); ;// ./node_modules/@wordpress/components/build-module/card/card-body/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useCardBody(props) { const { className, isScrollable = false, isShady = false, size = 'medium', ...otherProps } = useContextSystem(props, 'CardBody'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Body, borderRadius, cardPaddings[size], isShady && shady, // This classname is added for legacy compatibility reasons. 'components-card__body', className), [className, cx, isShady, size]); return { ...otherProps, className: classes, isScrollable }; } ;// ./node_modules/@wordpress/components/build-module/card/card-body/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedCardBody(props, forwardedRef) { const { isScrollable, ...otherProps } = useCardBody(props); if (isScrollable) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(scrollable_component, { ...otherProps, ref: forwardedRef }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...otherProps, ref: forwardedRef }); } /** * `CardBody` renders an optional content area for a `Card`. * Multiple `CardBody` components can be used within `Card` if needed. * * ```jsx * import { Card, CardBody } from `@wordpress/components`; * * <Card> * <CardBody> * ... * </CardBody> * </Card> * ``` */ const CardBody = contextConnect(UnconnectedCardBody, 'CardBody'); /* harmony default export */ const card_body_component = (CardBody); ;// ./node_modules/@ariakit/react-core/esm/__chunks/A3CZKICO.js "use client"; // src/separator/separator.tsx var A3CZKICO_TagName = "hr"; var useSeparator = createHook( function useSeparator2(_a) { var _b = _a, { orientation = "horizontal" } = _b, props = __objRest(_b, ["orientation"]); props = _3YLGPPWQ_spreadValues({ role: "separator", "aria-orientation": orientation }, props); return props; } ); var Separator = forwardRef2(function Separator2(props) { const htmlProps = useSeparator(props); return LMDWO4NN_createElement(A3CZKICO_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/divider/styles.js function divider_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const MARGIN_DIRECTIONS = { vertical: { start: 'marginLeft', end: 'marginRight' }, horizontal: { start: 'marginTop', end: 'marginBottom' } }; // Renders the correct margins given the Divider's `orientation` and the writing direction. // When both the generic `margin` and the specific `marginStart|marginEnd` props are defined, // the latter will take priority. const renderMargin = ({ 'aria-orientation': orientation = 'horizontal', margin, marginStart, marginEnd }) => /*#__PURE__*/emotion_react_browser_esm_css(rtl({ [MARGIN_DIRECTIONS[orientation].start]: space(marginStart !== null && marginStart !== void 0 ? marginStart : margin), [MARGIN_DIRECTIONS[orientation].end]: space(marginEnd !== null && marginEnd !== void 0 ? marginEnd : margin) })(), true ? "" : 0, true ? "" : 0); var divider_styles_ref = true ? { name: "1u4hpl4", styles: "display:inline" } : 0; const renderDisplay = ({ 'aria-orientation': orientation = 'horizontal' }) => { return orientation === 'vertical' ? divider_styles_ref : undefined; }; const renderBorder = ({ 'aria-orientation': orientation = 'horizontal' }) => { return /*#__PURE__*/emotion_react_browser_esm_css({ [orientation === 'vertical' ? 'borderRight' : 'borderBottom']: '1px solid currentColor' }, true ? "" : 0, true ? "" : 0); }; const renderSize = ({ 'aria-orientation': orientation = 'horizontal' }) => /*#__PURE__*/emotion_react_browser_esm_css({ height: orientation === 'vertical' ? 'auto' : 0, width: orientation === 'vertical' ? 0 : 'auto' }, true ? "" : 0, true ? "" : 0); const DividerView = /*#__PURE__*/emotion_styled_base_browser_esm("hr", true ? { target: "e19on6iw0" } : 0)("border:0;margin:0;", renderDisplay, " ", renderBorder, " ", renderSize, " ", renderMargin, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/divider/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedDivider(props, forwardedRef) { const contextProps = useContextSystem(props, 'Divider'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Separator, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DividerView, {}), ...contextProps, ref: forwardedRef }); } /** * `Divider` is a layout component that separates groups of related content. * * ```js * import { * __experimentalDivider as Divider, * __experimentalText as Text, * __experimentalVStack as VStack, * } from `@wordpress/components`; * * function Example() { * return ( * <VStack spacing={4}> * <Text>Some text here</Text> * <Divider /> * <Text>Some more text here</Text> * </VStack> * ); * } * ``` */ const component_Divider = contextConnect(UnconnectedDivider, 'Divider'); /* harmony default export */ const divider_component = (component_Divider); ;// ./node_modules/@wordpress/components/build-module/card/card-divider/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useCardDivider(props) { const { className, ...otherProps } = useContextSystem(props, 'CardDivider'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Divider, borderColor, // This classname is added for legacy compatibility reasons. 'components-card__divider', className), [className, cx]); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/card/card-divider/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedCardDivider(props, forwardedRef) { const dividerProps = useCardDivider(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(divider_component, { ...dividerProps, ref: forwardedRef }); } /** * `CardDivider` renders an optional divider within a `Card`. * It is typically used to divide multiple `CardBody` components from each other. * * ```jsx * import { Card, CardBody, CardDivider } from `@wordpress/components`; * * <Card> * <CardBody>...</CardBody> * <CardDivider /> * <CardBody>...</CardBody> * </Card> * ``` */ const CardDivider = contextConnect(UnconnectedCardDivider, 'CardDivider'); /* harmony default export */ const card_divider_component = (CardDivider); ;// ./node_modules/@wordpress/components/build-module/card/card-footer/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useCardFooter(props) { const { className, justify, isBorderless = false, isShady = false, size = 'medium', ...otherProps } = useContextSystem(props, 'CardFooter'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Footer, borderRadius, borderColor, cardPaddings[size], isBorderless && borderless, isShady && shady, // This classname is added for legacy compatibility reasons. 'components-card__footer', className), [className, cx, isBorderless, isShady, size]); return { ...otherProps, className: classes, justify }; } ;// ./node_modules/@wordpress/components/build-module/card/card-footer/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedCardFooter(props, forwardedRef) { const footerProps = useCardFooter(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_component, { ...footerProps, ref: forwardedRef }); } /** * `CardFooter` renders an optional footer within a `Card`. * * ```jsx * import { Card, CardBody, CardFooter } from `@wordpress/components`; * * <Card> * <CardBody>...</CardBody> * <CardFooter>...</CardFooter> * </Card> * ``` */ const CardFooter = contextConnect(UnconnectedCardFooter, 'CardFooter'); /* harmony default export */ const card_footer_component = (CardFooter); ;// ./node_modules/@wordpress/components/build-module/card/card-header/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useCardHeader(props) { const { className, isBorderless = false, isShady = false, size = 'medium', ...otherProps } = useContextSystem(props, 'CardHeader'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Header, borderRadius, borderColor, cardPaddings[size], isBorderless && borderless, isShady && shady, // This classname is added for legacy compatibility reasons. 'components-card__header', className), [className, cx, isBorderless, isShady, size]); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/card/card-header/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedCardHeader(props, forwardedRef) { const headerProps = useCardHeader(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_component, { ...headerProps, ref: forwardedRef }); } /** * `CardHeader` renders an optional header within a `Card`. * * ```jsx * import { Card, CardBody, CardHeader } from `@wordpress/components`; * * <Card> * <CardHeader>...</CardHeader> * <CardBody>...</CardBody> * </Card> * ``` */ const CardHeader = contextConnect(UnconnectedCardHeader, 'CardHeader'); /* harmony default export */ const card_header_component = (CardHeader); ;// ./node_modules/@wordpress/components/build-module/card/card-media/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useCardMedia(props) { const { className, ...otherProps } = useContextSystem(props, 'CardMedia'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Media, borderRadius, // This classname is added for legacy compatibility reasons. 'components-card__media', className), [className, cx]); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/card/card-media/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedCardMedia(props, forwardedRef) { const cardMediaProps = useCardMedia(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...cardMediaProps, ref: forwardedRef }); } /** * `CardMedia` provides a container for full-bleed content within a `Card`, * such as images, video, or even just a background color. * * @example * ```jsx * import { Card, CardBody, CardMedia } from '@wordpress/components'; * * const Example = () => ( * <Card> * <CardMedia> * <img src="..." /> * </CardMedia> * <CardBody>...</CardBody> * </Card> * ); * ``` */ const CardMedia = contextConnect(UnconnectedCardMedia, 'CardMedia'); /* harmony default export */ const card_media_component = (CardMedia); ;// ./node_modules/@wordpress/components/build-module/checkbox-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Checkboxes allow the user to select one or more items from a set. * * ```jsx * import { CheckboxControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyCheckboxControl = () => { * const [ isChecked, setChecked ] = useState( true ); * return ( * <CheckboxControl * __nextHasNoMarginBottom * label="Is author" * help="Is the user a author or not?" * checked={ isChecked } * onChange={ setChecked } * /> * ); * }; * ``` */ function CheckboxControl(props) { const { __nextHasNoMarginBottom, label, className, heading, checked, indeterminate, help, id: idProp, onChange, ...additionalProps } = props; if (heading) { external_wp_deprecated_default()('`heading` prop in `CheckboxControl`', { alternative: 'a separate element to implement a heading', since: '5.8' }); } const [showCheckedIcon, setShowCheckedIcon] = (0,external_wp_element_namespaceObject.useState)(false); const [showIndeterminateIcon, setShowIndeterminateIcon] = (0,external_wp_element_namespaceObject.useState)(false); // Run the following callback every time the `ref` (and the additional // dependencies) change. const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!node) { return; } // It cannot be set using an HTML attribute. node.indeterminate = !!indeterminate; setShowCheckedIcon(node.matches(':checked')); setShowIndeterminateIcon(node.matches(':indeterminate')); }, [checked, indeterminate]); const id = (0,external_wp_compose_namespaceObject.useInstanceId)(CheckboxControl, 'inspector-checkbox-control', idProp); const onChangeValue = event => onChange(event.target.checked); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "CheckboxControl", label: heading, id: id, help: help && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-checkbox-control__help", children: help }), className: dist_clsx('components-checkbox-control', className), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { spacing: 0, justify: "start", alignment: "top", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "components-checkbox-control__input-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { ref: ref, id: id, className: "components-checkbox-control__input", type: "checkbox", value: "1", onChange: onChangeValue, checked: checked, "aria-describedby": !!help ? id + '__help' : undefined, ...additionalProps }), showIndeterminateIcon ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: library_reset, className: "components-checkbox-control__indeterminate", role: "presentation" }) : null, showCheckedIcon ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: library_check, className: "components-checkbox-control__checked", role: "presentation" }) : null] }), label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { className: "components-checkbox-control__label", htmlFor: id, children: label })] }) }); } /* harmony default export */ const checkbox_control = (CheckboxControl); ;// ./node_modules/@wordpress/components/build-module/clipboard-button/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const TIMEOUT = 4000; function ClipboardButton({ className, children, onCopy, onFinishCopy, text, ...buttonProps }) { external_wp_deprecated_default()('wp.components.ClipboardButton', { since: '5.8', alternative: 'wp.compose.useCopyToClipboard' }); const timeoutIdRef = (0,external_wp_element_namespaceObject.useRef)(); const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, () => { onCopy(); if (timeoutIdRef.current) { clearTimeout(timeoutIdRef.current); } if (onFinishCopy) { timeoutIdRef.current = setTimeout(() => onFinishCopy(), TIMEOUT); } }); (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { if (timeoutIdRef.current) { clearTimeout(timeoutIdRef.current); } }; }, []); const classes = dist_clsx('components-clipboard-button', className); // Workaround for inconsistent behavior in Safari, where <textarea> is not // the document.activeElement at the moment when the copy event fires. // This causes documentHasSelection() in the copy-handler component to // mistakenly override the ClipboardButton, and copy a serialized string // of the current block instead. const focusOnCopyEventTarget = event => { // @ts-expect-error: Should be currentTarget, but not changing because this component is deprecated. event.target.focus(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { ...buttonProps, className: classes, ref: ref, onCopy: focusOnCopyEventTarget, children: children }); } ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js /** * WordPress dependencies */ const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); /* harmony default export */ const more_vertical = (moreVertical); ;// ./node_modules/@wordpress/components/build-module/item-group/styles.js function item_group_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const unstyledButton = as => { return /*#__PURE__*/emotion_react_browser_esm_css("font-size:", font('default.fontSize'), ";font-family:inherit;appearance:none;border:1px solid transparent;cursor:pointer;background:none;text-align:start;text-decoration:", as === 'a' ? 'none' : undefined, ";svg,path{fill:currentColor;}&:hover{color:", COLORS.theme.accent, ";}&:focus{box-shadow:none;outline:none;}&:focus-visible{box-shadow:0 0 0 var( --wp-admin-border-width-focus ) ", COLORS.theme.accent, ";outline:2px solid transparent;outline-offset:0;}" + ( true ? "" : 0), true ? "" : 0); }; const itemWrapper = true ? { name: "1bcj5ek", styles: "width:100%;display:block" } : 0; const item = true ? { name: "150ruhm", styles: "box-sizing:border-box;width:100%;display:block;margin:0;color:inherit" } : 0; const bordered = /*#__PURE__*/emotion_react_browser_esm_css("border:1px solid ", config_values.surfaceBorderColor, ";" + ( true ? "" : 0), true ? "" : 0); const separated = /*#__PURE__*/emotion_react_browser_esm_css(">*:not( marquee )>*{border-bottom:1px solid ", config_values.surfaceBorderColor, ";}>*:last-of-type>*:not( :focus ){border-bottom-color:transparent;}" + ( true ? "" : 0), true ? "" : 0); const styles_borderRadius = config_values.radiusSmall; const styles_spacedAround = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", styles_borderRadius, ";" + ( true ? "" : 0), true ? "" : 0); const styles_rounded = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", styles_borderRadius, ";>*:first-of-type>*{border-top-left-radius:", styles_borderRadius, ";border-top-right-radius:", styles_borderRadius, ";}>*:last-of-type>*{border-bottom-left-radius:", styles_borderRadius, ";border-bottom-right-radius:", styles_borderRadius, ";}" + ( true ? "" : 0), true ? "" : 0); const baseFontHeight = `calc(${config_values.fontSize} * ${config_values.fontLineHeightBase})`; /* * Math: * - Use the desired height as the base value * - Subtract the computed height of (default) text * - Subtract the effects of border * - Divide the calculated number by 2, in order to get an individual top/bottom padding */ const paddingY = `calc((${config_values.controlHeight} - ${baseFontHeight} - 2px) / 2)`; const paddingYSmall = `calc((${config_values.controlHeightSmall} - ${baseFontHeight} - 2px) / 2)`; const paddingYLarge = `calc((${config_values.controlHeightLarge} - ${baseFontHeight} - 2px) / 2)`; const itemSizes = { small: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingYSmall, " ", config_values.controlPaddingXSmall, "px;" + ( true ? "" : 0), true ? "" : 0), medium: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingY, " ", config_values.controlPaddingX, "px;" + ( true ? "" : 0), true ? "" : 0), large: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingYLarge, " ", config_values.controlPaddingXLarge, "px;" + ( true ? "" : 0), true ? "" : 0) }; ;// ./node_modules/@wordpress/components/build-module/item-group/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const ItemGroupContext = (0,external_wp_element_namespaceObject.createContext)({ size: 'medium' }); const useItemGroupContext = () => (0,external_wp_element_namespaceObject.useContext)(ItemGroupContext); ;// ./node_modules/@wordpress/components/build-module/item-group/item/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useItem(props) { const { as: asProp, className, onClick, role = 'listitem', size: sizeProp, ...otherProps } = useContextSystem(props, 'Item'); const { spacedAround, size: contextSize } = useItemGroupContext(); const size = sizeProp || contextSize; const as = asProp || (typeof onClick !== 'undefined' ? 'button' : 'div'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx((as === 'button' || as === 'a') && unstyledButton(as), itemSizes[size] || itemSizes.medium, item, spacedAround && styles_spacedAround, className), [as, className, cx, size, spacedAround]); const wrapperClassName = cx(itemWrapper); return { as, className: classes, onClick, wrapperClassName, role, ...otherProps }; } ;// ./node_modules/@wordpress/components/build-module/item-group/item/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedItem(props, forwardedRef) { const { role, wrapperClassName, ...otherProps } = useItem(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: role, className: wrapperClassName, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...otherProps, ref: forwardedRef }) }); } /** * `Item` is used in combination with `ItemGroup` to display a list of items * grouped and styled together. * * ```jsx * import { * __experimentalItemGroup as ItemGroup, * __experimentalItem as Item, * } from '@wordpress/components'; * * function Example() { * return ( * <ItemGroup> * <Item>Code</Item> * <Item>is</Item> * <Item>Poetry</Item> * </ItemGroup> * ); * } * ``` */ const component_Item = contextConnect(UnconnectedItem, 'Item'); /* harmony default export */ const item_component = (component_Item); ;// ./node_modules/@wordpress/components/build-module/item-group/item-group/hook.js /** * Internal dependencies */ /** * Internal dependencies */ function useItemGroup(props) { const { className, isBordered = false, isRounded = true, isSeparated = false, role = 'list', ...otherProps } = useContextSystem(props, 'ItemGroup'); const cx = useCx(); const classes = cx(isBordered && bordered, isSeparated && separated, isRounded && styles_rounded, className); return { isBordered, className: classes, role, isSeparated, ...otherProps }; } ;// ./node_modules/@wordpress/components/build-module/item-group/item-group/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedItemGroup(props, forwardedRef) { const { isBordered, isSeparated, size: sizeProp, ...otherProps } = useItemGroup(props); const { size: contextSize } = useItemGroupContext(); const spacedAround = !isBordered && !isSeparated; const size = sizeProp || contextSize; const contextValue = { spacedAround, size }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemGroupContext.Provider, { value: contextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...otherProps, ref: forwardedRef }) }); } /** * `ItemGroup` displays a list of `Item`s grouped and styled together. * * ```jsx * import { * __experimentalItemGroup as ItemGroup, * __experimentalItem as Item, * } from '@wordpress/components'; * * function Example() { * return ( * <ItemGroup> * <Item>Code</Item> * <Item>is</Item> * <Item>Poetry</Item> * </ItemGroup> * ); * } * ``` */ const ItemGroup = contextConnect(UnconnectedItemGroup, 'ItemGroup'); /* harmony default export */ const item_group_component = (ItemGroup); ;// ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/constants.js const GRADIENT_MARKERS_WIDTH = 16; const INSERT_POINT_WIDTH = 16; const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10; const MINIMUM_DISTANCE_BETWEEN_POINTS = 0; const MINIMUM_SIGNIFICANT_MOVE = 5; const KEYBOARD_CONTROL_POINT_VARIATION = MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT; const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER = (INSERT_POINT_WIDTH + GRADIENT_MARKERS_WIDTH) / 2; ;// ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/utils.js /** * Internal dependencies */ /** * Clamps a number between 0 and 100. * * @param value Value to clamp. * * @return Value clamped between 0 and 100. */ function clampPercent(value) { return Math.max(0, Math.min(100, value)); } /** * Check if a control point is overlapping with another. * * @param value Array of control points. * @param initialIndex Index of the position to test. * @param newPosition New position of the control point. * @param minDistance Distance considered to be overlapping. * * @return True if the point is overlapping. */ function isOverlapping(value, initialIndex, newPosition, minDistance = MINIMUM_DISTANCE_BETWEEN_POINTS) { const initialPosition = value[initialIndex].position; const minPosition = Math.min(initialPosition, newPosition); const maxPosition = Math.max(initialPosition, newPosition); return value.some(({ position }, index) => { return index !== initialIndex && (Math.abs(position - newPosition) < minDistance || minPosition < position && position < maxPosition); }); } /** * Adds a control point from an array and returns the new array. * * @param points Array of control points. * @param position Position to insert the new point. * @param color Color to update the control point at index. * * @return New array of control points. */ function addControlPoint(points, position, color) { const nextIndex = points.findIndex(point => point.position > position); const newPoint = { color, position }; const newPoints = points.slice(); newPoints.splice(nextIndex - 1, 0, newPoint); return newPoints; } /** * Removes a control point from an array and returns the new array. * * @param points Array of control points. * @param index Index to remove. * * @return New array of control points. */ function removeControlPoint(points, index) { return points.filter((_point, pointIndex) => { return pointIndex !== index; }); } /** * Updates a control point from an array and returns the new array. * * @param points Array of control points. * @param index Index to update. * @param newPoint New control point to replace the index. * * @return New array of control points. */ function updateControlPoint(points, index, newPoint) { const newValue = points.slice(); newValue[index] = newPoint; return newValue; } /** * Updates the position of a control point from an array and returns the new array. * * @param points Array of control points. * @param index Index to update. * @param newPosition Position to move the control point at index. * * @return New array of control points. */ function updateControlPointPosition(points, index, newPosition) { if (isOverlapping(points, index, newPosition)) { return points; } const newPoint = { ...points[index], position: newPosition }; return updateControlPoint(points, index, newPoint); } /** * Updates the position of a control point from an array and returns the new array. * * @param points Array of control points. * @param index Index to update. * @param newColor Color to update the control point at index. * * @return New array of control points. */ function updateControlPointColor(points, index, newColor) { const newPoint = { ...points[index], color: newColor }; return updateControlPoint(points, index, newPoint); } /** * Updates the position of a control point from an array and returns the new array. * * @param points Array of control points. * @param position Position of the color stop. * @param newColor Color to update the control point at index. * * @return New array of control points. */ function updateControlPointColorByPosition(points, position, newColor) { const index = points.findIndex(point => point.position === position); return updateControlPointColor(points, index, newColor); } /** * Gets the horizontal coordinate when dragging a control point with the mouse. * * @param mouseXcoordinate Horizontal coordinate of the mouse position. * @param containerElement Container for the gradient picker. * * @return Whole number percentage from the left. */ function getHorizontalRelativeGradientPosition(mouseXCoordinate, containerElement) { if (!containerElement) { return; } const { x, width } = containerElement.getBoundingClientRect(); const absolutePositionValue = mouseXCoordinate - x; return Math.round(clampPercent(absolutePositionValue * 100 / width)); } ;// ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/control-points.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ControlPointButton({ isOpen, position, color, ...additionalProps }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ControlPointButton); const descriptionId = `components-custom-gradient-picker__control-point-button-description-${instanceId}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: gradient position e.g: 70. 2: gradient color code e.g: rgb(52,121,151). (0,external_wp_i18n_namespaceObject.__)('Gradient control point at position %1$s%% with color code %2$s.'), position, color), "aria-describedby": descriptionId, "aria-haspopup": "true", "aria-expanded": isOpen, __next40pxDefaultSize: true, className: dist_clsx('components-custom-gradient-picker__control-point-button', { 'is-active': isOpen }), ...additionalProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { id: descriptionId, children: (0,external_wp_i18n_namespaceObject.__)('Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.') })] }); } function GradientColorPickerDropdown({ isRenderedInSidebar, className, ...props }) { // Open the popover below the gradient control/insertion point const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ placement: 'bottom', offset: 8, // Disabling resize as it would otherwise cause the popover to show // scrollbars while dragging the color picker's handle close to the // popover edge. resize: false }), []); const mergedClassName = dist_clsx('components-custom-gradient-picker__control-point-dropdown', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomColorPickerDropdown, { isRenderedInSidebar: isRenderedInSidebar, popoverProps: popoverProps, className: mergedClassName, ...props }); } function ControlPoints({ disableRemove, disableAlpha, gradientPickerDomRef, ignoreMarkerPosition, value: controlPoints, onChange, onStartControlPointChange, onStopControlPointChange, __experimentalIsRenderedInSidebar }) { const controlPointMoveStateRef = (0,external_wp_element_namespaceObject.useRef)(); const onMouseMove = event => { if (controlPointMoveStateRef.current === undefined || gradientPickerDomRef.current === null) { return; } const relativePosition = getHorizontalRelativeGradientPosition(event.clientX, gradientPickerDomRef.current); const { initialPosition, index, significantMoveHappened } = controlPointMoveStateRef.current; if (!significantMoveHappened && Math.abs(initialPosition - relativePosition) >= MINIMUM_SIGNIFICANT_MOVE) { controlPointMoveStateRef.current.significantMoveHappened = true; } onChange(updateControlPointPosition(controlPoints, index, relativePosition)); }; const cleanEventListeners = () => { if (window && window.removeEventListener && controlPointMoveStateRef.current && controlPointMoveStateRef.current.listenersActivated) { window.removeEventListener('mousemove', onMouseMove); window.removeEventListener('mouseup', cleanEventListeners); onStopControlPointChange(); controlPointMoveStateRef.current.listenersActivated = false; } }; // Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback` // This memoization would prevent the event listeners from being properly cleaned. // Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency. const cleanEventListenersRef = (0,external_wp_element_namespaceObject.useRef)(); cleanEventListenersRef.current = cleanEventListeners; (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { cleanEventListenersRef.current?.(); }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: controlPoints.map((point, index) => { const initialPosition = point?.position; return ignoreMarkerPosition !== initialPosition && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientColorPickerDropdown, { isRenderedInSidebar: __experimentalIsRenderedInSidebar, onClose: onStopControlPointChange, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ControlPointButton, { onClick: () => { if (controlPointMoveStateRef.current && controlPointMoveStateRef.current.significantMoveHappened) { return; } if (isOpen) { onStopControlPointChange(); } else { onStartControlPointChange(); } onToggle(); }, onMouseDown: () => { if (window && window.addEventListener) { controlPointMoveStateRef.current = { initialPosition, index, significantMoveHappened: false, listenersActivated: true }; onStartControlPointChange(); window.addEventListener('mousemove', onMouseMove); window.addEventListener('mouseup', cleanEventListeners); } }, onKeyDown: event => { if (event.code === 'ArrowLeft') { // Stop propagation of the key press event to avoid focus moving // to another editor area. event.stopPropagation(); onChange(updateControlPointPosition(controlPoints, index, clampPercent(point.position - KEYBOARD_CONTROL_POINT_VARIATION))); } else if (event.code === 'ArrowRight') { // Stop propagation of the key press event to avoid focus moving // to another editor area. event.stopPropagation(); onChange(updateControlPointPosition(controlPoints, index, clampPercent(point.position + KEYBOARD_CONTROL_POINT_VARIATION))); } }, isOpen: isOpen, position: point.position, color: point.color }, index), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dropdown_content_wrapper, { paddingSize: "none", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LegacyAdapter, { enableAlpha: !disableAlpha, color: point.color, onChange: color => { onChange(updateControlPointColor(controlPoints, index, w(color).toRgbString())); } }), !disableRemove && controlPoints.length > 2 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(h_stack_component, { className: "components-custom-gradient-picker__remove-control-point-wrapper", alignment: "center", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { onClick: () => { onChange(removeControlPoint(controlPoints, index)); onClose(); }, variant: "link", children: (0,external_wp_i18n_namespaceObject.__)('Remove Control Point') }) })] }), style: { left: `${point.position}%`, transform: 'translateX( -50% )' } }, index); }) }); } function InsertPoint({ value: controlPoints, onChange, onOpenInserter, onCloseInserter, insertPosition, disableAlpha, __experimentalIsRenderedInSidebar }) { const [alreadyInsertedPoint, setAlreadyInsertedPoint] = (0,external_wp_element_namespaceObject.useState)(false); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientColorPickerDropdown, { isRenderedInSidebar: __experimentalIsRenderedInSidebar, className: "components-custom-gradient-picker__inserter", onClose: () => { onCloseInserter(); }, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, "aria-expanded": isOpen, "aria-haspopup": "true", onClick: () => { if (isOpen) { onCloseInserter(); } else { setAlreadyInsertedPoint(false); onOpenInserter(); } onToggle(); }, className: "components-custom-gradient-picker__insert-point-dropdown", icon: library_plus }), renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_content_wrapper, { paddingSize: "none", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LegacyAdapter, { enableAlpha: !disableAlpha, onChange: color => { if (!alreadyInsertedPoint) { onChange(addControlPoint(controlPoints, insertPosition, w(color).toRgbString())); setAlreadyInsertedPoint(true); } else { onChange(updateControlPointColorByPosition(controlPoints, insertPosition, w(color).toRgbString())); } } }) }), style: insertPosition !== null ? { left: `${insertPosition}%`, transform: 'translateX( -50% )' } : undefined }); } ControlPoints.InsertPoint = InsertPoint; /* harmony default export */ const control_points = (ControlPoints); ;// ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const customGradientBarReducer = (state, action) => { switch (action.type) { case 'MOVE_INSERTER': if (state.id === 'IDLE' || state.id === 'MOVING_INSERTER') { return { id: 'MOVING_INSERTER', insertPosition: action.insertPosition }; } break; case 'STOP_INSERTER_MOVE': if (state.id === 'MOVING_INSERTER') { return { id: 'IDLE' }; } break; case 'OPEN_INSERTER': if (state.id === 'MOVING_INSERTER') { return { id: 'INSERTING_CONTROL_POINT', insertPosition: state.insertPosition }; } break; case 'CLOSE_INSERTER': if (state.id === 'INSERTING_CONTROL_POINT') { return { id: 'IDLE' }; } break; case 'START_CONTROL_CHANGE': if (state.id === 'IDLE') { return { id: 'MOVING_CONTROL_POINT' }; } break; case 'STOP_CONTROL_CHANGE': if (state.id === 'MOVING_CONTROL_POINT') { return { id: 'IDLE' }; } break; } return state; }; const customGradientBarReducerInitialState = { id: 'IDLE' }; function CustomGradientBar({ background, hasGradient, value: controlPoints, onChange, disableInserter = false, disableAlpha = false, __experimentalIsRenderedInSidebar = false }) { const gradientMarkersContainerDomRef = (0,external_wp_element_namespaceObject.useRef)(null); const [gradientBarState, gradientBarStateDispatch] = (0,external_wp_element_namespaceObject.useReducer)(customGradientBarReducer, customGradientBarReducerInitialState); const onMouseEnterAndMove = event => { if (!gradientMarkersContainerDomRef.current) { return; } const insertPosition = getHorizontalRelativeGradientPosition(event.clientX, gradientMarkersContainerDomRef.current); // If the insert point is close to an existing control point don't show it. if (controlPoints.some(({ position }) => { return Math.abs(insertPosition - position) < MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT; })) { if (gradientBarState.id === 'MOVING_INSERTER') { gradientBarStateDispatch({ type: 'STOP_INSERTER_MOVE' }); } return; } gradientBarStateDispatch({ type: 'MOVE_INSERTER', insertPosition }); }; const onMouseLeave = () => { gradientBarStateDispatch({ type: 'STOP_INSERTER_MOVE' }); }; const isMovingInserter = gradientBarState.id === 'MOVING_INSERTER'; const isInsertingControlPoint = gradientBarState.id === 'INSERTING_CONTROL_POINT'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('components-custom-gradient-picker__gradient-bar', { 'has-gradient': hasGradient }), onMouseEnter: onMouseEnterAndMove, onMouseMove: onMouseEnterAndMove, onMouseLeave: onMouseLeave, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-custom-gradient-picker__gradient-bar-background", style: { background, opacity: hasGradient ? 1 : 0.4 } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: gradientMarkersContainerDomRef, className: "components-custom-gradient-picker__markers-container", children: [!disableInserter && (isMovingInserter || isInsertingControlPoint) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(control_points.InsertPoint, { __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, disableAlpha: disableAlpha, insertPosition: gradientBarState.insertPosition, value: controlPoints, onChange: onChange, onOpenInserter: () => { gradientBarStateDispatch({ type: 'OPEN_INSERTER' }); }, onCloseInserter: () => { gradientBarStateDispatch({ type: 'CLOSE_INSERTER' }); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(control_points, { __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, disableAlpha: disableAlpha, disableRemove: disableInserter, gradientPickerDomRef: gradientMarkersContainerDomRef, ignoreMarkerPosition: isInsertingControlPoint ? gradientBarState.insertPosition : undefined, value: controlPoints, onChange: onChange, onStartControlPointChange: () => { gradientBarStateDispatch({ type: 'START_CONTROL_CHANGE' }); }, onStopControlPointChange: () => { gradientBarStateDispatch({ type: 'STOP_CONTROL_CHANGE' }); } })] })] }); } // EXTERNAL MODULE: ./node_modules/gradient-parser/build/node.js var build_node = __webpack_require__(8924); ;// ./node_modules/@wordpress/components/build-module/custom-gradient-picker/constants.js /** * WordPress dependencies */ const DEFAULT_GRADIENT = 'linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)'; const DEFAULT_LINEAR_GRADIENT_ANGLE = 180; const HORIZONTAL_GRADIENT_ORIENTATION = { type: 'angular', value: '90' }; const GRADIENT_OPTIONS = [{ value: 'linear-gradient', label: (0,external_wp_i18n_namespaceObject.__)('Linear') }, { value: 'radial-gradient', label: (0,external_wp_i18n_namespaceObject.__)('Radial') }]; const DIRECTIONAL_ORIENTATION_ANGLE_MAP = { top: 0, 'top right': 45, 'right top': 45, right: 90, 'right bottom': 135, 'bottom right': 135, bottom: 180, 'bottom left': 225, 'left bottom': 225, left: 270, 'top left': 315, 'left top': 315 }; ;// ./node_modules/@wordpress/components/build-module/custom-gradient-picker/serializer.js /** * External dependencies */ function serializeGradientColor({ type, value }) { if (type === 'literal') { return value; } if (type === 'hex') { return `#${value}`; } return `${type}(${value.join(',')})`; } function serializeGradientPosition(position) { if (!position) { return ''; } const { value, type } = position; return `${value}${type}`; } function serializeGradientColorStop({ type, value, length }) { return `${serializeGradientColor({ type, value })} ${serializeGradientPosition(length)}`; } function serializeGradientOrientation(orientation) { if (Array.isArray(orientation) || !orientation || orientation.type !== 'angular') { return; } return `${orientation.value}deg`; } function serializeGradient({ type, orientation, colorStops }) { const serializedOrientation = serializeGradientOrientation(orientation); const serializedColorStops = colorStops.sort((colorStop1, colorStop2) => { const getNumericStopValue = colorStop => { return colorStop?.length?.value === undefined ? 0 : parseInt(colorStop.length.value); }; return getNumericStopValue(colorStop1) - getNumericStopValue(colorStop2); }).map(serializeGradientColorStop); return `${type}(${[serializedOrientation, ...serializedColorStops].filter(Boolean).join(',')})`; } ;// ./node_modules/@wordpress/components/build-module/custom-gradient-picker/utils.js /** * External dependencies */ /** * Internal dependencies */ k([names]); function getLinearGradientRepresentation(gradientAST) { return serializeGradient({ type: 'linear-gradient', orientation: HORIZONTAL_GRADIENT_ORIENTATION, colorStops: gradientAST.colorStops }); } function hasUnsupportedLength(item) { return item.length === undefined || item.length.type !== '%'; } function getGradientAstWithDefault(value) { // gradientAST will contain the gradient AST as parsed by gradient-parser npm module. // More information of its structure available at https://www.npmjs.com/package/gradient-parser#ast. let gradientAST; let hasGradient = !!value; const valueToParse = value !== null && value !== void 0 ? value : DEFAULT_GRADIENT; try { gradientAST = build_node.parse(valueToParse)[0]; } catch (error) { // eslint-disable-next-line no-console console.warn('wp.components.CustomGradientPicker failed to parse the gradient with error', error); gradientAST = build_node.parse(DEFAULT_GRADIENT)[0]; hasGradient = false; } if (!Array.isArray(gradientAST.orientation) && gradientAST.orientation?.type === 'directional') { gradientAST.orientation = { type: 'angular', value: DIRECTIONAL_ORIENTATION_ANGLE_MAP[gradientAST.orientation.value].toString() }; } if (gradientAST.colorStops.some(hasUnsupportedLength)) { const { colorStops } = gradientAST; const step = 100 / (colorStops.length - 1); colorStops.forEach((stop, index) => { stop.length = { value: `${step * index}`, type: '%' }; }); } return { gradientAST, hasGradient }; } function getGradientAstWithControlPoints(gradientAST, newControlPoints) { return { ...gradientAST, colorStops: newControlPoints.map(({ position, color }) => { const { r, g, b, a } = w(color).toRgb(); return { length: { type: '%', value: position?.toString() }, type: a < 1 ? 'rgba' : 'rgb', value: a < 1 ? [`${r}`, `${g}`, `${b}`, `${a}`] : [`${r}`, `${g}`, `${b}`] }; }) }; } function getStopCssColor(colorStop) { switch (colorStop.type) { case 'hex': return `#${colorStop.value}`; case 'literal': return colorStop.value; case 'rgb': case 'rgba': return `${colorStop.type}(${colorStop.value.join(',')})`; default: // Should be unreachable if passing an AST from gradient-parser. // See https://github.com/rafaelcaricio/gradient-parser#ast. return 'transparent'; } } ;// ./node_modules/@wordpress/components/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js function custom_gradient_picker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const SelectWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_block_component, true ? { target: "e10bzpgi1" } : 0)( true ? { name: "1gvx10y", styles: "flex-grow:5" } : 0); const AccessoryWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_block_component, true ? { target: "e10bzpgi0" } : 0)( true ? { name: "1gvx10y", styles: "flex-grow:5" } : 0); ;// ./node_modules/@wordpress/components/build-module/custom-gradient-picker/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const GradientAnglePicker = ({ gradientAST, hasGradient, onChange }) => { var _gradientAST$orientat; const angle = (_gradientAST$orientat = gradientAST?.orientation?.value) !== null && _gradientAST$orientat !== void 0 ? _gradientAST$orientat : DEFAULT_LINEAR_GRADIENT_ANGLE; const onAngleChange = newAngle => { onChange(serializeGradient({ ...gradientAST, orientation: { type: 'angular', value: `${newAngle}` } })); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(angle_picker_control, { onChange: onAngleChange, value: hasGradient ? angle : '' }); }; const GradientTypePicker = ({ gradientAST, hasGradient, onChange }) => { const { type } = gradientAST; const onSetLinearGradient = () => { onChange(serializeGradient({ ...gradientAST, orientation: gradientAST.orientation ? undefined : HORIZONTAL_GRADIENT_ORIENTATION, type: 'linear-gradient' })); }; const onSetRadialGradient = () => { const { orientation, ...restGradientAST } = gradientAST; onChange(serializeGradient({ ...restGradientAST, type: 'radial-gradient' })); }; const handleOnChange = next => { if (next === 'linear-gradient') { onSetLinearGradient(); } if (next === 'radial-gradient') { onSetRadialGradient(); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(select_control, { __nextHasNoMarginBottom: true, className: "components-custom-gradient-picker__type-picker", label: (0,external_wp_i18n_namespaceObject.__)('Type'), labelPosition: "top", onChange: handleOnChange, options: GRADIENT_OPTIONS, size: "__unstable-large", value: hasGradient ? type : undefined }); }; /** * CustomGradientPicker is a React component that renders a UI for specifying * linear or radial gradients. Radial gradients are displayed in the picker as * a slice of the gradient from the center to the outside. * * ```jsx * import { CustomGradientPicker } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyCustomGradientPicker = () => { * const [ gradient, setGradient ] = useState(); * * return ( * <CustomGradientPicker * value={ gradient } * onChange={ setGradient } * /> * ); * }; * ``` */ function CustomGradientPicker({ value, onChange, enableAlpha = true, __experimentalIsRenderedInSidebar = false }) { const { gradientAST, hasGradient } = getGradientAstWithDefault(value); // On radial gradients the bar should display a linear gradient. // On radial gradients the bar represents a slice of the gradient from the center until the outside. // On liner gradients the bar represents the color stops from left to right independently of the angle. const background = getLinearGradientRepresentation(gradientAST); // Control points color option may be hex from presets, custom colors will be rgb. // The position should always be a percentage. const controlPoints = gradientAST.colorStops.map(colorStop => { return { color: getStopCssColor(colorStop), // Although it's already been checked by `hasUnsupportedLength` in `getGradientAstWithDefault`, // TypeScript doesn't know that `colorStop.length` is not undefined here. // @ts-expect-error position: parseInt(colorStop.length.value) }; }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { spacing: 4, className: "components-custom-gradient-picker", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomGradientBar, { __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, disableAlpha: !enableAlpha, background: background, hasGradient: hasGradient, value: controlPoints, onChange: newControlPoints => { onChange(serializeGradient(getGradientAstWithControlPoints(gradientAST, newControlPoints))); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(flex_component, { gap: 3, className: "components-custom-gradient-picker__ui-line", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientTypePicker, { gradientAST: gradientAST, hasGradient: hasGradient, onChange: onChange }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AccessoryWrapper, { children: gradientAST.type === 'linear-gradient' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientAnglePicker, { gradientAST: gradientAST, hasGradient: hasGradient, onChange: onChange }) })] })] }); } /* harmony default export */ const custom_gradient_picker = (CustomGradientPicker); ;// ./node_modules/@wordpress/components/build-module/gradient-picker/index.js /** * WordPress dependencies */ /** * Internal dependencies */ // The Multiple Origin Gradients have a `gradients` property (an array of // gradient objects), while Single Origin ones have a `gradient` property. const isMultipleOriginObject = obj => Array.isArray(obj.gradients) && !('gradient' in obj); const isMultipleOriginArray = arr => { return arr.length > 0 && arr.every(gradientObj => isMultipleOriginObject(gradientObj)); }; function SingleOrigin({ className, clearGradient, gradients, onChange, value, ...additionalProps }) { const gradientOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { return gradients.map(({ gradient, name, slug }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.Option, { value: gradient, isSelected: value === gradient, tooltipText: name || // translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);". (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient code: %s'), gradient), style: { color: 'rgba( 0,0,0,0 )', background: gradient }, onClick: value === gradient ? clearGradient : () => onChange(gradient, index), "aria-label": name ? // translators: %s: The name of the gradient e.g: "Angular red to blue". (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient: %s'), name) : // translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);". (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient code: %s'), gradient) }, slug)); }, [gradients, value, onChange, clearGradient]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.OptionGroup, { className: className, options: gradientOptions, ...additionalProps }); } function MultipleOrigin({ className, clearGradient, gradients, onChange, value, headingLevel }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(MultipleOrigin); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(v_stack_component, { spacing: 3, className: className, children: gradients.map(({ name, gradients: gradientSet }, index) => { const id = `color-palette-${instanceId}-${index}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { spacing: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorHeading, { level: headingLevel, id: id, children: name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleOrigin, { clearGradient: clearGradient, gradients: gradientSet, onChange: gradient => onChange(gradient, index), value: value, "aria-labelledby": id })] }, index); }) }); } function Component(props) { const { asButtons, loop, actions, headingLevel, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, ...additionalProps } = props; const options = isMultipleOriginArray(props.gradients) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MultipleOrigin, { headingLevel: headingLevel, ...additionalProps }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleOrigin, { ...additionalProps }); const { metaProps, labelProps } = getComputeCircularOptionPickerCommonProps(asButtons, loop, ariaLabel, ariaLabelledby); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker, { ...metaProps, ...labelProps, actions: actions, options: options }); } /** * GradientPicker is a React component that renders a color gradient picker to * define a multi step gradient. There's either a _linear_ or a _radial_ type * available. * * ```jsx * import { useState } from 'react'; * import { GradientPicker } from '@wordpress/components'; * * const MyGradientPicker = () => { * const [ gradient, setGradient ] = useState( null ); * * return ( * <GradientPicker * value={ gradient } * onChange={ ( currentGradient ) => setGradient( currentGradient ) } * gradients={ [ * { * name: 'JShine', * gradient: * 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)', * slug: 'jshine', * }, * { * name: 'Moonlit Asteroid', * gradient: * 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)', * slug: 'moonlit-asteroid', * }, * { * name: 'Rastafarie', * gradient: * 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)', * slug: 'rastafari', * }, * ] } * /> * ); * }; *``` * */ function GradientPicker({ className, gradients = [], onChange, value, clearable = true, enableAlpha = true, disableCustomGradients = false, __experimentalIsRenderedInSidebar, headingLevel = 2, ...additionalProps }) { const clearGradient = (0,external_wp_element_namespaceObject.useCallback)(() => onChange(undefined), [onChange]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { spacing: gradients.length ? 4 : 0, children: [!disableCustomGradients && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(custom_gradient_picker, { __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, enableAlpha: enableAlpha, value: value, onChange: onChange }), (gradients.length > 0 || clearable) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...additionalProps, className: className, clearGradient: clearGradient, gradients: gradients, onChange: onChange, value: value, actions: clearable && !disableCustomGradients && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.ButtonAction, { onClick: clearGradient, accessibleWhenDisabled: true, disabled: !value, children: (0,external_wp_i18n_namespaceObject.__)('Clear') }), headingLevel: headingLevel })] }); } /* harmony default export */ const gradient_picker = (GradientPicker); ;// ./node_modules/@wordpress/icons/build-module/library/menu.js /** * WordPress dependencies */ const menu = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z" }) }); /* harmony default export */ const library_menu = (menu); ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/components/build-module/navigable-container/container.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const container_noop = () => {}; const MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox']; function cycleValue(value, total, offset) { const nextValue = value + offset; if (nextValue < 0) { return total + nextValue; } else if (nextValue >= total) { return nextValue - total; } return nextValue; } class NavigableContainer extends external_wp_element_namespaceObject.Component { constructor(args) { super(args); this.onKeyDown = this.onKeyDown.bind(this); this.bindContainer = this.bindContainer.bind(this); this.getFocusableContext = this.getFocusableContext.bind(this); this.getFocusableIndex = this.getFocusableIndex.bind(this); } componentDidMount() { if (!this.container) { return; } // We use DOM event listeners instead of React event listeners // because we want to catch events from the underlying DOM tree // The React Tree can be different from the DOM tree when using // portals. Block Toolbars for instance are rendered in a separate // React Trees. this.container.addEventListener('keydown', this.onKeyDown); } componentWillUnmount() { if (!this.container) { return; } this.container.removeEventListener('keydown', this.onKeyDown); } bindContainer(ref) { const { forwardedRef } = this.props; this.container = ref; if (typeof forwardedRef === 'function') { forwardedRef(ref); } else if (forwardedRef && 'current' in forwardedRef) { forwardedRef.current = ref; } } getFocusableContext(target) { if (!this.container) { return null; } const { onlyBrowserTabstops } = this.props; const finder = onlyBrowserTabstops ? external_wp_dom_namespaceObject.focus.tabbable : external_wp_dom_namespaceObject.focus.focusable; const focusables = finder.find(this.container); const index = this.getFocusableIndex(focusables, target); if (index > -1 && target) { return { index, target, focusables }; } return null; } getFocusableIndex(focusables, target) { return focusables.indexOf(target); } onKeyDown(event) { if (this.props.onKeyDown) { this.props.onKeyDown(event); } const { getFocusableContext } = this; const { cycle = true, eventToOffset, onNavigate = container_noop, stopNavigationEvents } = this.props; const offset = eventToOffset(event); // eventToOffset returns undefined if the event is not handled by the component. if (offset !== undefined && stopNavigationEvents) { // Prevents arrow key handlers bound to the document directly interfering. event.stopImmediatePropagation(); // When navigating a collection of items, prevent scroll containers // from scrolling. The preventDefault also prevents Voiceover from // 'handling' the event, as voiceover will try to use arrow keys // for highlighting text. const targetRole = event.target?.getAttribute('role'); const targetHasMenuItemRole = !!targetRole && MENU_ITEM_ROLES.includes(targetRole); if (targetHasMenuItemRole) { event.preventDefault(); } } if (!offset) { return; } const activeElement = event.target?.ownerDocument?.activeElement; if (!activeElement) { return; } const context = getFocusableContext(activeElement); if (!context) { return; } const { index, focusables } = context; const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset; if (nextIndex >= 0 && nextIndex < focusables.length) { focusables[nextIndex].focus(); onNavigate(nextIndex, focusables[nextIndex]); // `preventDefault()` on tab to avoid having the browser move the focus // after this component has already moved it. if (event.code === 'Tab') { event.preventDefault(); } } } render() { const { children, stopNavigationEvents, eventToOffset, onNavigate, onKeyDown, cycle, onlyBrowserTabstops, forwardedRef, ...restProps } = this.props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: this.bindContainer, ...restProps, children: children }); } } const forwardedNavigableContainer = (props, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableContainer, { ...props, forwardedRef: ref }); }; forwardedNavigableContainer.displayName = 'NavigableContainer'; /* harmony default export */ const container = ((0,external_wp_element_namespaceObject.forwardRef)(forwardedNavigableContainer)); ;// ./node_modules/@wordpress/components/build-module/navigable-container/menu.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedNavigableMenu({ role = 'menu', orientation = 'vertical', ...rest }, ref) { const eventToOffset = evt => { const { code } = evt; let next = ['ArrowDown']; let previous = ['ArrowUp']; if (orientation === 'horizontal') { next = ['ArrowRight']; previous = ['ArrowLeft']; } if (orientation === 'both') { next = ['ArrowRight', 'ArrowDown']; previous = ['ArrowLeft', 'ArrowUp']; } if (next.includes(code)) { return 1; } else if (previous.includes(code)) { return -1; } else if (['ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'].includes(code)) { // Key press should be handled, e.g. have event propagation and // default behavior handled by NavigableContainer but not result // in an offset. return 0; } return undefined; }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(container, { ref: ref, stopNavigationEvents: true, onlyBrowserTabstops: false, role: role, "aria-orientation": role !== 'presentation' && (orientation === 'vertical' || orientation === 'horizontal') ? orientation : undefined, eventToOffset: eventToOffset, ...rest }); } /** * A container for a navigable menu. * * ```jsx * import { * NavigableMenu, * Button, * } from '@wordpress/components'; * * function onNavigate( index, target ) { * console.log( `Navigates to ${ index }`, target ); * } * * const MyNavigableContainer = () => ( * <div> * <span>Navigable Menu:</span> * <NavigableMenu onNavigate={ onNavigate } orientation="horizontal"> * <Button variant="secondary">Item 1</Button> * <Button variant="secondary">Item 2</Button> * <Button variant="secondary">Item 3</Button> * </NavigableMenu> * </div> * ); * ``` */ const NavigableMenu = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedNavigableMenu); /* harmony default export */ const navigable_container_menu = (NavigableMenu); ;// ./node_modules/@wordpress/components/build-module/dropdown-menu/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function dropdown_menu_mergeProps(defaultProps = {}, props = {}) { const mergedProps = { ...defaultProps, ...props }; if (props.className && defaultProps.className) { mergedProps.className = dist_clsx(props.className, defaultProps.className); } return mergedProps; } function dropdown_menu_isFunction(maybeFunc) { return typeof maybeFunc === 'function'; } function UnconnectedDropdownMenu(dropdownMenuProps) { const { children, className, controls, icon = library_menu, label, popoverProps, toggleProps, menuProps, disableOpenOnArrowDown = false, text, noIcons, open, defaultOpen, onToggle: onToggleProp, // Context variant } = useContextSystem(dropdownMenuProps, 'DropdownMenu'); if (!controls?.length && !dropdown_menu_isFunction(children)) { return null; } // Normalize controls to nested array of objects (sets of controls) let controlSets; if (controls?.length) { // @ts-expect-error The check below is needed because `DropdownMenus` // rendered by `ToolBarGroup` receive controls as a nested array. controlSets = controls; if (!Array.isArray(controlSets[0])) { // This is not ideal, but at this point we know that `controls` is // not a nested array, even if TypeScript doesn't. controlSets = [controls]; } } const mergedPopoverProps = dropdown_menu_mergeProps({ className: 'components-dropdown-menu__popover', variant }, popoverProps); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown, { className: className, popoverProps: mergedPopoverProps, renderToggle: ({ isOpen, onToggle }) => { var _toggleProps$showTool; const openOnArrowDown = event => { if (disableOpenOnArrowDown) { return; } if (!isOpen && event.code === 'ArrowDown') { event.preventDefault(); onToggle(); } }; const { as: Toggle = build_module_button, ...restToggleProps } = toggleProps !== null && toggleProps !== void 0 ? toggleProps : {}; const mergedToggleProps = dropdown_menu_mergeProps({ className: dist_clsx('components-dropdown-menu__toggle', { 'is-opened': isOpen }) }, restToggleProps); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Toggle, { ...mergedToggleProps, icon: icon, onClick: event => { onToggle(); if (mergedToggleProps.onClick) { mergedToggleProps.onClick(event); } }, onKeyDown: event => { openOnArrowDown(event); if (mergedToggleProps.onKeyDown) { mergedToggleProps.onKeyDown(event); } }, "aria-haspopup": "true", "aria-expanded": isOpen, label: label, text: text, showTooltip: (_toggleProps$showTool = toggleProps?.showTooltip) !== null && _toggleProps$showTool !== void 0 ? _toggleProps$showTool : true, children: mergedToggleProps.children }); }, renderContent: props => { const mergedMenuProps = dropdown_menu_mergeProps({ 'aria-label': label, className: dist_clsx('components-dropdown-menu__menu', { 'no-icons': noIcons }) }, menuProps); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(navigable_container_menu, { ...mergedMenuProps, role: "menu", children: [dropdown_menu_isFunction(children) ? children(props) : null, controlSets?.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, onClick: event => { event.stopPropagation(); props.onClose(); if (control.onClick) { control.onClick(); } }, className: dist_clsx('components-dropdown-menu__menu-item', { 'has-separator': indexOfSet > 0 && indexOfControl === 0, 'is-active': control.isActive, 'is-icon-only': !control.title }), icon: control.icon, label: control.label, "aria-checked": control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.isActive : undefined, role: control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.role : 'menuitem', accessibleWhenDisabled: true, disabled: control.isDisabled, children: control.title }, [indexOfSet, indexOfControl].join())))] }); }, open: open, defaultOpen: defaultOpen, onToggle: onToggleProp }); } /** * * The DropdownMenu displays a list of actions (each contained in a MenuItem, * MenuItemsChoice, or MenuGroup) in a compact way. It appears in a Popover * after the user has interacted with an element (a button or icon) or when * they perform a specific action. * * Render a Dropdown Menu with a set of controls: * * ```jsx * import { DropdownMenu } from '@wordpress/components'; * import { * more, * arrowLeft, * arrowRight, * arrowUp, * arrowDown, * } from '@wordpress/icons'; * * const MyDropdownMenu = () => ( * <DropdownMenu * icon={ more } * label="Select a direction" * controls={ [ * { * title: 'Up', * icon: arrowUp, * onClick: () => console.log( 'up' ), * }, * { * title: 'Right', * icon: arrowRight, * onClick: () => console.log( 'right' ), * }, * { * title: 'Down', * icon: arrowDown, * onClick: () => console.log( 'down' ), * }, * { * title: 'Left', * icon: arrowLeft, * onClick: () => console.log( 'left' ), * }, * ] } * /> * ); * ``` * * Alternatively, specify a `children` function which returns elements valid for * use in a DropdownMenu: `MenuItem`, `MenuItemsChoice`, or `MenuGroup`. * * ```jsx * import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components'; * import { more, arrowUp, arrowDown, trash } from '@wordpress/icons'; * * const MyDropdownMenu = () => ( * <DropdownMenu icon={ more } label="Select a direction"> * { ( { onClose } ) => ( * <> * <MenuGroup> * <MenuItem icon={ arrowUp } onClick={ onClose }> * Move Up * </MenuItem> * <MenuItem icon={ arrowDown } onClick={ onClose }> * Move Down * </MenuItem> * </MenuGroup> * <MenuGroup> * <MenuItem icon={ trash } onClick={ onClose }> * Remove * </MenuItem> * </MenuGroup> * </> * ) } * </DropdownMenu> * ); * ``` * */ const DropdownMenu = contextConnectWithoutRef(UnconnectedDropdownMenu, 'DropdownMenu'); /* harmony default export */ const dropdown_menu = (DropdownMenu); ;// ./node_modules/@wordpress/components/build-module/palette-edit/styles.js function palette_edit_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const IndicatorStyled = /*#__PURE__*/emotion_styled_base_browser_esm(color_indicator, true ? { target: "e1lpqc908" } : 0)("&&{flex-shrink:0;width:", space(6), ";height:", space(6), ";}" + ( true ? "" : 0)); const NameInputControl = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? { target: "e1lpqc907" } : 0)(Container, "{background:", COLORS.gray[100], ";border-radius:", config_values.radiusXSmall, ";", Input, Input, Input, Input, "{height:", space(8), ";}", BackdropUI, BackdropUI, BackdropUI, "{border-color:transparent;box-shadow:none;}}" + ( true ? "" : 0)); const NameContainer = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1lpqc906" } : 0)("line-height:", space(8), ";margin-left:", space(2), ";margin-right:", space(2), ";white-space:nowrap;overflow:hidden;" + ( true ? "" : 0)); const PaletteHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? { target: "e1lpqc905" } : 0)("text-transform:uppercase;line-height:", space(6), ";font-weight:500;&&&{font-size:11px;margin-bottom:0;}" + ( true ? "" : 0)); const PaletteActionsContainer = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? { target: "e1lpqc904" } : 0)("height:", space(6), ";display:flex;" + ( true ? "" : 0)); const PaletteEditContents = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? { target: "e1lpqc903" } : 0)("margin-top:", space(2), ";" + ( true ? "" : 0)); const PaletteEditStyles = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? { target: "e1lpqc902" } : 0)( true ? { name: "u6wnko", styles: "&&&{.components-button.has-icon{min-width:0;padding:0;}}" } : 0); const DoneButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? { target: "e1lpqc901" } : 0)("&&{color:", COLORS.theme.accent, ";}" + ( true ? "" : 0)); const RemoveButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? { target: "e1lpqc900" } : 0)("&&{margin-top:", space(1), ";}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/palette-edit/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_COLOR = '#000'; function NameInput({ value, onChange, label }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NameInputControl, { size: "compact", label: label, hideLabelFromVision: true, value: value, onChange: onChange }); } /* * Deduplicates the slugs of the provided elements. */ function deduplicateElementSlugs(elements) { const slugCounts = {}; return elements.map(element => { var _newSlug; let newSlug; const { slug } = element; slugCounts[slug] = (slugCounts[slug] || 0) + 1; if (slugCounts[slug] > 1) { newSlug = `${slug}-${slugCounts[slug] - 1}`; } return { ...element, slug: (_newSlug = newSlug) !== null && _newSlug !== void 0 ? _newSlug : slug }; }); } /** * Returns a name and slug for a palette item. The name takes the format "Color + id". * To ensure there are no duplicate ids, this function checks all slugs. * It expects slugs to be in the format: slugPrefix + color- + number. * It then sets the id component of the new name based on the incremented id of the highest existing slug id. * * @param elements An array of color palette items. * @param slugPrefix The slug prefix used to match the element slug. * * @return A name and slug for the new palette item. */ function getNameAndSlugForPosition(elements, slugPrefix) { const nameRegex = new RegExp(`^${slugPrefix}color-([\\d]+)$`); const position = elements.reduce((previousValue, currentValue) => { if (typeof currentValue?.slug === 'string') { const matches = currentValue?.slug.match(nameRegex); if (matches) { const id = parseInt(matches[1], 10); if (id >= previousValue) { return id + 1; } } } return previousValue; }, 1); return { name: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: is an id for a custom color */ (0,external_wp_i18n_namespaceObject.__)('Color %s'), position), slug: `${slugPrefix}color-${position}` }; } function ColorPickerPopover({ isGradient, element, onChange, popoverProps: receivedPopoverProps, onClose = () => {} }) { const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ shift: true, offset: 20, // Disabling resize as it would otherwise cause the popover to show // scrollbars while dragging the color picker's handle close to the // popover edge. resize: false, placement: 'left-start', ...receivedPopoverProps, className: dist_clsx('components-palette-edit__popover', receivedPopoverProps?.className) }), [receivedPopoverProps]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(popover, { ...popoverProps, onClose: onClose, children: [!isGradient && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LegacyAdapter, { color: element.color, enableAlpha: true, onChange: newColor => { onChange({ ...element, color: newColor }); } }), isGradient && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-palette-edit__popover-gradient-picker", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(custom_gradient_picker, { __experimentalIsRenderedInSidebar: true, value: element.gradient, onChange: newGradient => { onChange({ ...element, gradient: newGradient }); } }) })] }); } function palette_edit_Option({ canOnlyChangeValues, element, onChange, onRemove, popoverProps: receivedPopoverProps, slugPrefix, isGradient }) { const value = isGradient ? element.gradient : element.color; const [isEditingColor, setIsEditingColor] = (0,external_wp_element_namespaceObject.useState)(false); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...receivedPopoverProps, // Use the custom palette color item as the popover anchor. anchor: popoverAnchor }), [popoverAnchor, receivedPopoverProps]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(item_component, { ref: setPopoverAnchor, size: "small", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { size: "small", onClick: () => { setIsEditingColor(true); }, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is a color or gradient name, e.g. "Red". (0,external_wp_i18n_namespaceObject.__)('Edit: %s'), element.name.trim().length ? element.name : value), style: { padding: 0 }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IndicatorStyled, { colorValue: value }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_item_component, { children: !canOnlyChangeValues ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NameInput, { label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Gradient name') : (0,external_wp_i18n_namespaceObject.__)('Color name'), value: element.name, onChange: nextName => onChange({ ...element, name: nextName, slug: slugPrefix + kebabCase(nextName !== null && nextName !== void 0 ? nextName : '') }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NameContainer, { children: element.name.trim().length ? element.name : /* Fall back to non-breaking space to maintain height */ '\u00A0' }) }), !canOnlyChangeValues && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_item_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RemoveButton, { size: "small", icon: line_solid, label: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is a color or gradient name, e.g. "Red". (0,external_wp_i18n_namespaceObject.__)('Remove color: %s'), element.name.trim().length ? element.name : value), onClick: onRemove }) })] }), isEditingColor && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPickerPopover, { isGradient: isGradient, onChange: onChange, element: element, popoverProps: popoverProps, onClose: () => setIsEditingColor(false) })] }); } function PaletteEditListView({ elements, onChange, canOnlyChangeValues, slugPrefix, isGradient, popoverProps, addColorRef }) { // When unmounting the component if there are empty elements (the user did not complete the insertion) clean them. const elementsReferenceRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { elementsReferenceRef.current = elements; }, [elements]); const debounceOnChange = (0,external_wp_compose_namespaceObject.useDebounce)(updatedElements => onChange(deduplicateElementSlugs(updatedElements)), 100); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(v_stack_component, { spacing: 3, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(item_group_component, { isRounded: true, isBordered: true, isSeparated: true, children: elements.map((element, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(palette_edit_Option, { isGradient: isGradient, canOnlyChangeValues: canOnlyChangeValues, element: element, onChange: newElement => { debounceOnChange(elements.map((currentElement, currentIndex) => { if (currentIndex === index) { return newElement; } return currentElement; })); }, onRemove: () => { const newElements = elements.filter((_currentElement, currentIndex) => { if (currentIndex === index) { return false; } return true; }); onChange(newElements.length ? newElements : undefined); addColorRef.current?.focus(); }, slugPrefix: slugPrefix, popoverProps: popoverProps }, index)) }) }); } const EMPTY_ARRAY = []; /** * Allows editing a palette of colors or gradients. * * ```jsx * import { PaletteEdit } from '@wordpress/components'; * const MyPaletteEdit = () => { * const [ controlledColors, setControlledColors ] = useState( colors ); * * return ( * <PaletteEdit * colors={ controlledColors } * onChange={ ( newColors?: Color[] ) => { * setControlledColors( newColors ); * } } * paletteLabel="Here is a label" * /> * ); * }; * ``` */ function PaletteEdit({ gradients, colors = EMPTY_ARRAY, onChange, paletteLabel, paletteLabelHeadingLevel = 2, emptyMessage, canOnlyChangeValues, canReset, slugPrefix = '', popoverProps }) { const isGradient = !!gradients; const elements = isGradient ? gradients : colors; const [isEditing, setIsEditing] = (0,external_wp_element_namespaceObject.useState)(false); const [editingElement, setEditingElement] = (0,external_wp_element_namespaceObject.useState)(null); const isAdding = isEditing && !!editingElement && elements[editingElement] && !elements[editingElement].slug; const elementsLength = elements.length; const hasElements = elementsLength > 0; const debounceOnChange = (0,external_wp_compose_namespaceObject.useDebounce)(onChange, 100); const onSelectPaletteItem = (0,external_wp_element_namespaceObject.useCallback)((value, newEditingElementIndex) => { const selectedElement = newEditingElementIndex === undefined ? undefined : elements[newEditingElementIndex]; const key = isGradient ? 'gradient' : 'color'; // Ensures that the index returned matches a known element value. if (!!selectedElement && selectedElement[key] === value) { setEditingElement(newEditingElementIndex); } else { setIsEditing(true); } }, [isGradient, elements]); const addColorRef = (0,external_wp_element_namespaceObject.useRef)(null); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PaletteEditStyles, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PaletteHeading, { level: paletteLabelHeadingLevel, children: paletteLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PaletteActionsContainer, { children: [hasElements && isEditing && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DoneButton, { size: "small", onClick: () => { setIsEditing(false); setEditingElement(null); }, children: (0,external_wp_i18n_namespaceObject.__)('Done') }), !canOnlyChangeValues && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { ref: addColorRef, size: "small", isPressed: isAdding, icon: library_plus, label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Add gradient') : (0,external_wp_i18n_namespaceObject.__)('Add color'), onClick: () => { const { name, slug } = getNameAndSlugForPosition(elements, slugPrefix); if (!!gradients) { onChange([...gradients, { gradient: DEFAULT_GRADIENT, name, slug }]); } else { onChange([...colors, { color: DEFAULT_COLOR, name, slug }]); } setIsEditing(true); setEditingElement(elements.length); } }), hasElements && (!isEditing || !canOnlyChangeValues || canReset) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_menu, { icon: more_vertical, label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Gradient options') : (0,external_wp_i18n_namespaceObject.__)('Color options'), toggleProps: { size: 'small' }, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(navigable_container_menu, { role: "menu", children: [!isEditing && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { setIsEditing(true); onClose(); }, className: "components-palette-edit__menu-button", children: (0,external_wp_i18n_namespaceObject.__)('Show details') }), !canOnlyChangeValues && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { setEditingElement(null); setIsEditing(false); onChange(); onClose(); }, className: "components-palette-edit__menu-button", children: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Remove all gradients') : (0,external_wp_i18n_namespaceObject.__)('Remove all colors') }), canReset && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, className: "components-palette-edit__menu-button", variant: "tertiary", onClick: () => { setEditingElement(null); onChange(); onClose(); }, children: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Reset gradient') : (0,external_wp_i18n_namespaceObject.__)('Reset colors') })] }) }) })] })] }), hasElements && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PaletteEditContents, { children: [isEditing && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PaletteEditListView, { canOnlyChangeValues: canOnlyChangeValues, elements: elements // @ts-expect-error TODO: Don't know how to resolve , onChange: onChange, slugPrefix: slugPrefix, isGradient: isGradient, popoverProps: popoverProps, addColorRef: addColorRef }), !isEditing && editingElement !== null && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPickerPopover, { isGradient: isGradient, onClose: () => setEditingElement(null), onChange: newElement => { debounceOnChange( // @ts-expect-error TODO: Don't know how to resolve elements.map((currentElement, currentIndex) => { if (currentIndex === editingElement) { return newElement; } return currentElement; })); }, element: elements[editingElement !== null && editingElement !== void 0 ? editingElement : -1], popoverProps: popoverProps }), !isEditing && (isGradient ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(gradient_picker, { gradients: gradients, onChange: onSelectPaletteItem, clearable: false, disableCustomGradients: true }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_palette, { colors: colors, onChange: onSelectPaletteItem, clearable: false, disableCustomColors: true }))] }), !hasElements && emptyMessage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PaletteEditContents, { children: emptyMessage })] }); } /* harmony default export */ const palette_edit = (PaletteEdit); ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js /** * WordPress dependencies */ const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); /* harmony default export */ const close_small = (closeSmall); ;// ./node_modules/@wordpress/components/build-module/combobox-control/styles.js /** * External dependencies */ /** * Internal dependencies */ const deprecatedDefaultSize = ({ __next40pxDefaultSize }) => !__next40pxDefaultSize && /*#__PURE__*/emotion_react_browser_esm_css("height:28px;padding-left:", space(1), ";padding-right:", space(1), ";" + ( true ? "" : 0), true ? "" : 0); const InputWrapperFlex = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? { target: "evuatpg0" } : 0)("height:38px;padding-left:", space(2), ";padding-right:", space(2), ";", deprecatedDefaultSize, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/form-token-field/token-input.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnForwardedTokenInput(props, ref) { const { value, isExpanded, instanceId, selectedSuggestionIndex, className, onChange, onFocus, onBlur, ...restProps } = props; const [hasFocus, setHasFocus] = (0,external_wp_element_namespaceObject.useState)(false); const size = value ? value.length + 1 : 0; const onChangeHandler = event => { if (onChange) { onChange({ value: event.target.value }); } }; const onFocusHandler = e => { setHasFocus(true); onFocus?.(e); }; const onBlurHandler = e => { setHasFocus(false); onBlur?.(e); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { ref: ref, id: `components-form-token-input-${instanceId}`, type: "text", ...restProps, value: value || '', onChange: onChangeHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, size: size, className: dist_clsx(className, 'components-form-token-field__input'), autoComplete: "off", role: "combobox", "aria-expanded": isExpanded, "aria-autocomplete": "list", "aria-owns": isExpanded ? `components-form-token-suggestions-${instanceId}` : undefined, "aria-activedescendant": // Only add the `aria-activedescendant` attribute when: // - the user is actively interacting with the input (`hasFocus`) // - there is a selected suggestion (`selectedSuggestionIndex !== -1`) // - the list of suggestions are rendered in the DOM (`isExpanded`) hasFocus && selectedSuggestionIndex !== -1 && isExpanded ? `components-form-token-suggestions-${instanceId}-${selectedSuggestionIndex}` : undefined, "aria-describedby": `components-form-token-suggestions-howto-${instanceId}` }); } const TokenInput = (0,external_wp_element_namespaceObject.forwardRef)(UnForwardedTokenInput); /* harmony default export */ const token_input = (TokenInput); ;// ./node_modules/@wordpress/components/build-module/form-token-field/suggestions-list.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const handleMouseDown = e => { // By preventing default here, we will not lose focus of <input> when clicking a suggestion. e.preventDefault(); }; function SuggestionsList({ selectedIndex, scrollIntoView, match, onHover, onSelect, suggestions = [], displayTransform, instanceId, __experimentalRenderItem }) { const listRef = (0,external_wp_compose_namespaceObject.useRefEffect)(listNode => { // only have to worry about scrolling selected suggestion into view // when already expanded. let rafId; if (selectedIndex > -1 && scrollIntoView && listNode.children[selectedIndex]) { listNode.children[selectedIndex].scrollIntoView({ behavior: 'instant', block: 'nearest', inline: 'nearest' }); } return () => { if (rafId !== undefined) { cancelAnimationFrame(rafId); } }; }, [selectedIndex, scrollIntoView]); const handleHover = suggestion => { return () => { onHover?.(suggestion); }; }; const handleClick = suggestion => { return () => { onSelect?.(suggestion); }; }; const computeSuggestionMatch = suggestion => { const matchText = displayTransform(match).toLocaleLowerCase(); if (matchText.length === 0) { return null; } const transformedSuggestion = displayTransform(suggestion); const indexOfMatch = transformedSuggestion.toLocaleLowerCase().indexOf(matchText); return { suggestionBeforeMatch: transformedSuggestion.substring(0, indexOfMatch), suggestionMatch: transformedSuggestion.substring(indexOfMatch, indexOfMatch + matchText.length), suggestionAfterMatch: transformedSuggestion.substring(indexOfMatch + matchText.length) }; }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { ref: listRef, className: "components-form-token-field__suggestions-list", id: `components-form-token-suggestions-${instanceId}`, role: "listbox", children: [suggestions.map((suggestion, index) => { const matchText = computeSuggestionMatch(suggestion); const isSelected = index === selectedIndex; const isDisabled = typeof suggestion === 'object' && suggestion?.disabled; const key = typeof suggestion === 'object' && 'value' in suggestion ? suggestion?.value : displayTransform(suggestion); const className = dist_clsx('components-form-token-field__suggestion', { 'is-selected': isSelected }); let output; if (typeof __experimentalRenderItem === 'function') { output = __experimentalRenderItem({ item: suggestion }); } else if (matchText) { output = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { "aria-label": displayTransform(suggestion), children: [matchText.suggestionBeforeMatch, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { className: "components-form-token-field__suggestion-match", children: matchText.suggestionMatch }), matchText.suggestionAfterMatch] }); } else { output = displayTransform(suggestion); } /* eslint-disable jsx-a11y/click-events-have-key-events */ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { id: `components-form-token-suggestions-${instanceId}-${index}`, role: "option", className: className, onMouseDown: handleMouseDown, onClick: handleClick(suggestion), onMouseEnter: handleHover(suggestion), "aria-selected": index === selectedIndex, "aria-disabled": isDisabled, children: output }, key); /* eslint-enable jsx-a11y/click-events-have-key-events */ }), suggestions.length === 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "components-form-token-field__suggestion is-empty", children: (0,external_wp_i18n_namespaceObject.__)('No items found') })] }); } /* harmony default export */ const suggestions_list = (SuggestionsList); ;// ./node_modules/@wordpress/components/build-module/higher-order/with-focus-outside/index.js /** * WordPress dependencies */ /* harmony default export */ const with_focus_outside = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => { const [handleFocusOutside, setHandleFocusOutside] = (0,external_wp_element_namespaceObject.useState)(undefined); const bindFocusOutsideHandler = (0,external_wp_element_namespaceObject.useCallback)(node => setHandleFocusOutside(() => node?.handleFocusOutside ? node.handleFocusOutside.bind(node) : undefined), []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...(0,external_wp_compose_namespaceObject.__experimentalUseFocusOutside)(handleFocusOutside), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ref: bindFocusOutsideHandler, ...props }) }); }, 'withFocusOutside')); ;// ./node_modules/@wordpress/components/build-module/spinner/styles.js function spinner_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const spinAnimation = emotion_react_browser_esm_keyframes` from { transform: rotate(0deg); } to { transform: rotate(360deg); } `; const StyledSpinner = /*#__PURE__*/emotion_styled_base_browser_esm("svg", true ? { target: "ea4tfvq2" } : 0)("width:", config_values.spinnerSize, "px;height:", config_values.spinnerSize, "px;display:inline-block;margin:5px 11px 0;position:relative;color:", COLORS.theme.accent, ";overflow:visible;opacity:1;background-color:transparent;" + ( true ? "" : 0)); const commonPathProps = true ? { name: "9s4963", styles: "fill:transparent;stroke-width:1.5px" } : 0; const SpinnerTrack = /*#__PURE__*/emotion_styled_base_browser_esm("circle", true ? { target: "ea4tfvq1" } : 0)(commonPathProps, ";stroke:", COLORS.gray[300], ";" + ( true ? "" : 0)); const SpinnerIndicator = /*#__PURE__*/emotion_styled_base_browser_esm("path", true ? { target: "ea4tfvq0" } : 0)(commonPathProps, ";stroke:currentColor;stroke-linecap:round;transform-origin:50% 50%;animation:1.4s linear infinite both ", spinAnimation, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/spinner/index.js /** * External dependencies */ /** * Internal dependencies */ /** * WordPress dependencies */ function UnforwardedSpinner({ className, ...props }, forwardedRef) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(StyledSpinner, { className: dist_clsx('components-spinner', className), viewBox: "0 0 100 100", width: "16", height: "16", xmlns: "http://www.w3.org/2000/svg", role: "presentation", focusable: "false", ...props, ref: forwardedRef, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpinnerTrack, { cx: "50", cy: "50", r: "50", vectorEffect: "non-scaling-stroke" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpinnerIndicator, { d: "m 50 0 a 50 50 0 0 1 50 50", vectorEffect: "non-scaling-stroke" })] }); } /** * `Spinner` is a component used to notify users that their action is being processed. * * ```js * import { Spinner } from '@wordpress/components'; * * function Example() { * return <Spinner />; * } * ``` */ const Spinner = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSpinner); /* harmony default export */ const spinner = (Spinner); ;// ./node_modules/@wordpress/components/build-module/combobox-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const combobox_control_noop = () => {}; const DetectOutside = with_focus_outside(class extends external_wp_element_namespaceObject.Component { handleFocusOutside(event) { this.props.onFocusOutside(event); } render() { return this.props.children; } }); const getIndexOfMatchingSuggestion = (selectedSuggestion, matchingSuggestions) => selectedSuggestion === null ? -1 : matchingSuggestions.indexOf(selectedSuggestion); /** * `ComboboxControl` is an enhanced version of a [`SelectControl`](../select-control/README.md) with the addition of * being able to search for options using a search input. * * ```jsx * import { ComboboxControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const options = [ * { * value: 'small', * label: 'Small', * }, * { * value: 'normal', * label: 'Normal', * disabled: true, * }, * { * value: 'large', * label: 'Large', * disabled: false, * }, * ]; * * function MyComboboxControl() { * const [ fontSize, setFontSize ] = useState(); * const [ filteredOptions, setFilteredOptions ] = useState( options ); * return ( * <ComboboxControl * __next40pxDefaultSize * __nextHasNoMarginBottom * label="Font Size" * value={ fontSize } * onChange={ setFontSize } * options={ filteredOptions } * onFilterValueChange={ ( inputValue ) => * setFilteredOptions( * options.filter( ( option ) => * option.label * .toLowerCase() * .startsWith( inputValue.toLowerCase() ) * ) * ) * } * /> * ); * } * ``` */ function ComboboxControl(props) { var _currentOption$label; const { __nextHasNoMarginBottom = false, __next40pxDefaultSize = false, value: valueProp, label, options, onChange: onChangeProp, onFilterValueChange = combobox_control_noop, hideLabelFromVision, help, allowReset = true, className, isLoading = false, messages = { selected: (0,external_wp_i18n_namespaceObject.__)('Item selected.') }, __experimentalRenderItem, expandOnFocus = true, placeholder } = useDeprecated36pxDefaultSizeProp(props); const [value, setValue] = useControlledValue({ value: valueProp, onChange: onChangeProp }); const currentOption = options.find(option => option.value === value); const currentLabel = (_currentOption$label = currentOption?.label) !== null && _currentOption$label !== void 0 ? _currentOption$label : ''; // Use a custom prefix when generating the `instanceId` to avoid having // duplicate input IDs when rendering this component and `FormTokenField` // in the same page (see https://github.com/WordPress/gutenberg/issues/42112). const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ComboboxControl, 'combobox-control'); const [selectedSuggestion, setSelectedSuggestion] = (0,external_wp_element_namespaceObject.useState)(currentOption || null); const [isExpanded, setIsExpanded] = (0,external_wp_element_namespaceObject.useState)(false); const [inputHasFocus, setInputHasFocus] = (0,external_wp_element_namespaceObject.useState)(false); const [inputValue, setInputValue] = (0,external_wp_element_namespaceObject.useState)(''); const inputContainer = (0,external_wp_element_namespaceObject.useRef)(null); const matchingSuggestions = (0,external_wp_element_namespaceObject.useMemo)(() => { const startsWithMatch = []; const containsMatch = []; const match = normalizeTextString(inputValue); options.forEach(option => { const index = normalizeTextString(option.label).indexOf(match); if (index === 0) { startsWithMatch.push(option); } else if (index > 0) { containsMatch.push(option); } }); return startsWithMatch.concat(containsMatch); }, [inputValue, options]); const onSuggestionSelected = newSelectedSuggestion => { if (newSelectedSuggestion.disabled) { return; } setValue(newSelectedSuggestion.value); (0,external_wp_a11y_namespaceObject.speak)(messages.selected, 'assertive'); setSelectedSuggestion(newSelectedSuggestion); setInputValue(''); setIsExpanded(false); }; const handleArrowNavigation = (offset = 1) => { const index = getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions); let nextIndex = index + offset; if (nextIndex < 0) { nextIndex = matchingSuggestions.length - 1; } else if (nextIndex >= matchingSuggestions.length) { nextIndex = 0; } setSelectedSuggestion(matchingSuggestions[nextIndex]); setIsExpanded(true); }; const onKeyDown = withIgnoreIMEEvents(event => { let preventDefault = false; if (event.defaultPrevented) { return; } switch (event.code) { case 'Enter': if (selectedSuggestion) { onSuggestionSelected(selectedSuggestion); preventDefault = true; } break; case 'ArrowUp': handleArrowNavigation(-1); preventDefault = true; break; case 'ArrowDown': handleArrowNavigation(1); preventDefault = true; break; case 'Escape': setIsExpanded(false); setSelectedSuggestion(null); preventDefault = true; break; default: break; } if (preventDefault) { event.preventDefault(); } }); const onBlur = () => { setInputHasFocus(false); }; const onFocus = () => { setInputHasFocus(true); if (expandOnFocus) { setIsExpanded(true); } onFilterValueChange(''); setInputValue(''); }; const onClick = () => { setIsExpanded(true); }; const onFocusOutside = () => { setIsExpanded(false); }; const onInputChange = event => { const text = event.value; setInputValue(text); onFilterValueChange(text); if (inputHasFocus) { setIsExpanded(true); } }; const handleOnReset = () => { setValue(null); inputContainer.current?.focus(); }; // Stop propagation of the keydown event when pressing Enter on the Reset // button to prevent calling the onKeydown callback on the container div // element which actually sets the selected suggestion. const handleResetStopPropagation = event => { event.stopPropagation(); }; // Update current selections when the filter input changes. (0,external_wp_element_namespaceObject.useEffect)(() => { const hasMatchingSuggestions = matchingSuggestions.length > 0; const hasSelectedMatchingSuggestions = getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions) > 0; if (hasMatchingSuggestions && !hasSelectedMatchingSuggestions) { // If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions. setSelectedSuggestion(matchingSuggestions[0]); } }, [matchingSuggestions, selectedSuggestion]); // Announcements. (0,external_wp_element_namespaceObject.useEffect)(() => { const hasMatchingSuggestions = matchingSuggestions.length > 0; if (isExpanded) { const message = hasMatchingSuggestions ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : (0,external_wp_i18n_namespaceObject.__)('No results.'); (0,external_wp_a11y_namespaceObject.speak)(message, 'polite'); } }, [matchingSuggestions, isExpanded]); maybeWarnDeprecated36pxSize({ componentName: 'ComboboxControl', __next40pxDefaultSize, size: undefined }); // Disable reason: There is no appropriate role which describes the // input container intended accessible usability. // TODO: Refactor click detection to use blur to stop propagation. /* eslint-disable jsx-a11y/no-static-element-interactions */ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DetectOutside, { onFocusOutside: onFocusOutside, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "ComboboxControl", className: dist_clsx(className, 'components-combobox-control'), label: label, id: `components-form-token-input-${instanceId}`, hideLabelFromVision: hideLabelFromVision, help: help, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-combobox-control__suggestions-container", tabIndex: -1, onKeyDown: onKeyDown, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(InputWrapperFlex, { __next40pxDefaultSize: __next40pxDefaultSize, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_block_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(token_input, { className: "components-combobox-control__input", instanceId: instanceId, ref: inputContainer, placeholder: placeholder, value: isExpanded ? inputValue : currentLabel, onFocus: onFocus, onBlur: onBlur, onClick: onClick, isExpanded: isExpanded, selectedSuggestionIndex: getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions), onChange: onInputChange }) }), isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spinner, {}), allowReset && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { size: "small", icon: close_small // Disable reason: Focus returns to input field when reset is clicked. // eslint-disable-next-line no-restricted-syntax , disabled: !value, onClick: handleOnReset, onKeyDown: handleResetStopPropagation, label: (0,external_wp_i18n_namespaceObject.__)('Reset') })] }), isExpanded && !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(suggestions_list, { instanceId: instanceId // The empty string for `value` here is not actually used, but is // just a quick way to satisfy the TypeScript requirements of SuggestionsList. // See: https://github.com/WordPress/gutenberg/pull/47581/files#r1091089330 , match: { label: inputValue, value: '' }, displayTransform: suggestion => suggestion.label, suggestions: matchingSuggestions, selectedIndex: getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions), onHover: setSelectedSuggestion, onSelect: onSuggestionSelected, scrollIntoView: true, __experimentalRenderItem: __experimentalRenderItem })] }) }) }); /* eslint-enable jsx-a11y/no-static-element-interactions */ } /* harmony default export */ const combobox_control = (ComboboxControl); ;// ./node_modules/@wordpress/components/build-module/composite/legacy/index.js /** * Composite is a component that may contain navigable items represented by * CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements * all the keyboard navigation mechanisms to ensure that there's only one * tab stop for the whole Composite element. This means that it can behave as * a roving tabindex or aria-activedescendant container. * * This file aims at providing components that are as close as possible to the * original `reakit`-based implementation (which was removed from the codebase), * although it is recommended that consumers of the package switch to the stable, * un-prefixed, `ariakit`-based version of `Composite`. * * @see https://ariakit.org/components/composite */ /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ // Legacy composite components can either provide state through a // single `state` prop, or via individual props, usually through // spreading the state generated by `useCompositeState`. // That is, `<Composite* { ...state }>`. function mapLegacyStatePropsToComponentProps(legacyProps) { // If a `state` prop is provided, we unpack that; otherwise, // the necessary props are provided directly in `legacyProps`. if (legacyProps.state) { const { state, ...rest } = legacyProps; const { store, ...props } = mapLegacyStatePropsToComponentProps(state); return { ...rest, ...props, store }; } return legacyProps; } const LEGACY_TO_NEW_DISPLAY_NAME = { __unstableComposite: 'Composite', __unstableCompositeGroup: 'Composite.Group or Composite.Row', __unstableCompositeItem: 'Composite.Item', __unstableUseCompositeState: 'Composite' }; function proxyComposite(ProxiedComponent, propMap = {}) { var _ProxiedComponent$dis; const displayName = (_ProxiedComponent$dis = ProxiedComponent.displayName) !== null && _ProxiedComponent$dis !== void 0 ? _ProxiedComponent$dis : ''; const Component = legacyProps => { external_wp_deprecated_default()(`wp.components.${displayName}`, { since: '6.7', alternative: LEGACY_TO_NEW_DISPLAY_NAME.hasOwnProperty(displayName) ? LEGACY_TO_NEW_DISPLAY_NAME[displayName] : undefined }); const { store, ...rest } = mapLegacyStatePropsToComponentProps(legacyProps); let props = rest; props = { ...props, id: (0,external_wp_compose_namespaceObject.useInstanceId)(store, props.baseId, props.id) }; Object.entries(propMap).forEach(([from, to]) => { if (props.hasOwnProperty(from)) { Object.assign(props, { [to]: props[from] }); delete props[from]; } }); delete props.baseId; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ProxiedComponent, { ...props, store: store }); }; Component.displayName = displayName; return Component; } // The old `CompositeGroup` used to behave more like the current // `CompositeRow`, but this has been split into two different // components. We handle that difference by checking on the // provided role, and returning the appropriate component. const UnproxiedCompositeGroup = (0,external_wp_element_namespaceObject.forwardRef)(({ role, ...props }, ref) => { const Component = role === 'row' ? Composite.Row : Composite.Group; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ref: ref, role: role, ...props }); }); /** * _Note: please use the `Composite` component instead._ * * @deprecated */ const legacy_Composite = proxyComposite(Object.assign(Composite, { displayName: '__unstableComposite' }), { baseId: 'id' }); /** * _Note: please use the `Composite.Row` or `Composite.Group` components instead._ * * @deprecated */ const legacy_CompositeGroup = proxyComposite(Object.assign(UnproxiedCompositeGroup, { displayName: '__unstableCompositeGroup' })); /** * _Note: please use the `Composite.Item` component instead._ * * @deprecated */ const legacy_CompositeItem = proxyComposite(Object.assign(Composite.Item, { displayName: '__unstableCompositeItem' }), { focusable: 'accessibleWhenDisabled' }); /** * _Note: please use the `Composite` component instead._ * * @deprecated */ function useCompositeState(legacyStateOptions = {}) { external_wp_deprecated_default()(`wp.components.__unstableUseCompositeState`, { since: '6.7', alternative: LEGACY_TO_NEW_DISPLAY_NAME.__unstableUseCompositeState }); const { baseId, currentId: defaultActiveId, orientation, rtl = false, loop: focusLoop = false, wrap: focusWrap = false, shift: focusShift = false, // eslint-disable-next-line camelcase unstable_virtual: virtualFocus } = legacyStateOptions; return { baseId: (0,external_wp_compose_namespaceObject.useInstanceId)(legacy_Composite, 'composite', baseId), store: useCompositeStore({ defaultActiveId, rtl, orientation, focusLoop, focusShift, focusWrap, virtualFocus }) }; } ;// ./node_modules/@wordpress/components/build-module/modal/aria-helper.js const LIVE_REGION_ARIA_ROLES = new Set(['alert', 'status', 'log', 'marquee', 'timer']); const hiddenElementsByDepth = []; /** * Hides all elements in the body element from screen-readers except * the provided element and elements that should not be hidden from * screen-readers. * * The reason we do this is because `aria-modal="true"` currently is bugged * in Safari, and support is spotty in other browsers overall. In the future * we should consider removing these helper functions in favor of * `aria-modal="true"`. * * @param modalElement The element that should not be hidden. */ function modalize(modalElement) { const elements = Array.from(document.body.children); const hiddenElements = []; hiddenElementsByDepth.push(hiddenElements); for (const element of elements) { if (element === modalElement) { continue; } if (elementShouldBeHidden(element)) { element.setAttribute('aria-hidden', 'true'); hiddenElements.push(element); } } } /** * Determines if the passed element should not be hidden from screen readers. * * @param element The element that should be checked. * * @return Whether the element should not be hidden from screen-readers. */ function elementShouldBeHidden(element) { const role = element.getAttribute('role'); return !(element.tagName === 'SCRIPT' || element.hasAttribute('hidden') || element.hasAttribute('aria-hidden') || element.hasAttribute('aria-live') || role && LIVE_REGION_ARIA_ROLES.has(role)); } /** * Accessibly reveals the elements hidden by the latest modal. */ function unmodalize() { const hiddenElements = hiddenElementsByDepth.pop(); if (!hiddenElements) { return; } for (const element of hiddenElements) { element.removeAttribute('aria-hidden'); } } ;// ./node_modules/@wordpress/components/build-module/modal/use-modal-exit-animation.js /** * WordPress dependencies */ /** * Internal dependencies */ // Animation duration (ms) extracted to JS in order to be used on a setTimeout. const FRAME_ANIMATION_DURATION = config_values.transitionDuration; const FRAME_ANIMATION_DURATION_NUMBER = Number.parseInt(config_values.transitionDuration); const EXIT_ANIMATION_NAME = 'components-modal__disappear-animation'; function useModalExitAnimation() { const frameRef = (0,external_wp_element_namespaceObject.useRef)(); const [isAnimatingOut, setIsAnimatingOut] = (0,external_wp_element_namespaceObject.useState)(false); const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const closeModal = (0,external_wp_element_namespaceObject.useCallback)(() => new Promise(closeModalResolve => { // Grab a "stable" reference of the frame element, since // the value held by the react ref might change at runtime. const frameEl = frameRef.current; if (isReducedMotion) { closeModalResolve(); return; } if (!frameEl) { true ? external_wp_warning_default()("wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element.") : 0; closeModalResolve(); return; } let handleAnimationEnd; const startAnimation = () => new Promise(animationResolve => { handleAnimationEnd = e => { if (e.animationName === EXIT_ANIMATION_NAME) { animationResolve(); } }; frameEl.addEventListener('animationend', handleAnimationEnd); setIsAnimatingOut(true); }); const animationTimeout = () => new Promise(timeoutResolve => { setTimeout(() => timeoutResolve(), // Allow an extra 20% of the animation duration for the // animationend event to fire, in case the animation frame is // slightly delayes by some other events in the event loop. FRAME_ANIMATION_DURATION_NUMBER * 1.2); }); Promise.race([startAnimation(), animationTimeout()]).then(() => { if (handleAnimationEnd) { frameEl.removeEventListener('animationend', handleAnimationEnd); } setIsAnimatingOut(false); closeModalResolve(); }); }), [isReducedMotion]); return { overlayClassname: isAnimatingOut ? 'is-animating-out' : undefined, frameRef, frameStyle: { '--modal-frame-animation-duration': `${FRAME_ANIMATION_DURATION}` }, closeModal }; } ;// ./node_modules/@wordpress/components/build-module/modal/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ // Used to track and dismiss the prior modal when another opens unless nested. const ModalContext = (0,external_wp_element_namespaceObject.createContext)(new Set()); // Used to track body class names applied while modals are open. const bodyOpenClasses = new Map(); function UnforwardedModal(props, forwardedRef) { const { bodyOpenClassName = 'modal-open', role = 'dialog', title = null, focusOnMount = true, shouldCloseOnEsc = true, shouldCloseOnClickOutside = true, isDismissible = true, /* Accessibility. */ aria = { labelledby: undefined, describedby: undefined }, onRequestClose, icon, closeButtonLabel, children, style, overlayClassName: overlayClassnameProp, className, contentLabel, onKeyDown, isFullScreen = false, size, headerActions = null, __experimentalHideHeader = false } = props; const ref = (0,external_wp_element_namespaceObject.useRef)(); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Modal); const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby; // The focus hook does not support 'firstContentElement' but this is a valid // value for the Modal's focusOnMount prop. The following code ensures the focus // hook will focus the first focusable node within the element to which it is applied. // When `firstContentElement` is passed as the value of the focusOnMount prop, // the focus hook is applied to the Modal's content element. // Otherwise, the focus hook is applied to the Modal's ref. This ensures that the // focus hook will focus the first element in the Modal's **content** when // `firstContentElement` is passed. const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)(focusOnMount === 'firstContentElement' ? 'firstElement' : focusOnMount); const constrainedTabbingRef = (0,external_wp_compose_namespaceObject.useConstrainedTabbing)(); const focusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); const contentRef = (0,external_wp_element_namespaceObject.useRef)(null); const childrenContainerRef = (0,external_wp_element_namespaceObject.useRef)(null); const [hasScrolledContent, setHasScrolledContent] = (0,external_wp_element_namespaceObject.useState)(false); const [hasScrollableContent, setHasScrollableContent] = (0,external_wp_element_namespaceObject.useState)(false); let sizeClass; if (isFullScreen || size === 'fill') { sizeClass = 'is-full-screen'; } else if (size) { sizeClass = `has-size-${size}`; } // Determines whether the Modal content is scrollable and updates the state. const isContentScrollable = (0,external_wp_element_namespaceObject.useCallback)(() => { if (!contentRef.current) { return; } const closestScrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(contentRef.current); if (contentRef.current === closestScrollContainer) { setHasScrollableContent(true); } else { setHasScrollableContent(false); } }, [contentRef]); // Accessibly isolates/unisolates the modal. (0,external_wp_element_namespaceObject.useEffect)(() => { modalize(ref.current); return () => unmodalize(); }, []); // Keeps a fresh ref for the subsequent effect. const onRequestCloseRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { onRequestCloseRef.current = onRequestClose; }, [onRequestClose]); // The list of `onRequestClose` callbacks of open (non-nested) Modals. Only // one should remain open at a time and the list enables closing prior ones. const dismissers = (0,external_wp_element_namespaceObject.useContext)(ModalContext); // Used for the tracking and dismissing any nested modals. const [nestedDismissers] = (0,external_wp_element_namespaceObject.useState)(() => new Set()); // Updates the stack tracking open modals at this level and calls // onRequestClose for any prior and/or nested modals as applicable. (0,external_wp_element_namespaceObject.useEffect)(() => { // add this modal instance to the dismissers set dismissers.add(onRequestCloseRef); // request that all the other modals close themselves for (const dismisser of dismissers) { if (dismisser !== onRequestCloseRef) { dismisser.current?.(); } } return () => { // request that all the nested modals close themselves for (const dismisser of nestedDismissers) { dismisser.current?.(); } // remove this modal instance from the dismissers set dismissers.delete(onRequestCloseRef); }; }, [dismissers, nestedDismissers]); // Adds/removes the value of bodyOpenClassName to body element. (0,external_wp_element_namespaceObject.useEffect)(() => { var _bodyOpenClasses$get; const theClass = bodyOpenClassName; const oneMore = 1 + ((_bodyOpenClasses$get = bodyOpenClasses.get(theClass)) !== null && _bodyOpenClasses$get !== void 0 ? _bodyOpenClasses$get : 0); bodyOpenClasses.set(theClass, oneMore); document.body.classList.add(bodyOpenClassName); return () => { const oneLess = bodyOpenClasses.get(theClass) - 1; if (oneLess === 0) { document.body.classList.remove(theClass); bodyOpenClasses.delete(theClass); } else { bodyOpenClasses.set(theClass, oneLess); } }; }, [bodyOpenClassName]); const { closeModal, frameRef, frameStyle, overlayClassname } = useModalExitAnimation(); // Calls the isContentScrollable callback when the Modal children container resizes. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!window.ResizeObserver || !childrenContainerRef.current) { return; } const resizeObserver = new ResizeObserver(isContentScrollable); resizeObserver.observe(childrenContainerRef.current); isContentScrollable(); return () => { resizeObserver.disconnect(); }; }, [isContentScrollable, childrenContainerRef]); function handleEscapeKeyDown(event) { if (shouldCloseOnEsc && (event.code === 'Escape' || event.key === 'Escape') && !event.defaultPrevented) { event.preventDefault(); closeModal().then(() => onRequestClose(event)); } } const onContentContainerScroll = (0,external_wp_element_namespaceObject.useCallback)(e => { var _e$currentTarget$scro; const scrollY = (_e$currentTarget$scro = e?.currentTarget?.scrollTop) !== null && _e$currentTarget$scro !== void 0 ? _e$currentTarget$scro : -1; if (!hasScrolledContent && scrollY > 0) { setHasScrolledContent(true); } else if (hasScrolledContent && scrollY <= 0) { setHasScrolledContent(false); } }, [hasScrolledContent]); let pressTarget = null; const overlayPressHandlers = { onPointerDown: event => { if (event.target === event.currentTarget) { pressTarget = event.target; // Avoids focus changing so that focus return works as expected. event.preventDefault(); } }, // Closes the modal with two exceptions. 1. Opening the context menu on // the overlay. 2. Pressing on the overlay then dragging the pointer // over the modal and releasing. Due to the modal being a child of the // overlay, such a gesture is a `click` on the overlay and cannot be // excepted by a `click` handler. Thus the tactic of handling // `pointerup` and comparing its target to that of the `pointerdown`. onPointerUp: ({ target, button }) => { const isSameTarget = target === pressTarget; pressTarget = null; if (button === 0 && isSameTarget) { closeModal().then(() => onRequestClose()); } } }; const modal = /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/no-static-element-interactions (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]), className: dist_clsx('components-modal__screen-overlay', overlayClassname, overlayClassnameProp), onKeyDown: withIgnoreIMEEvents(handleEscapeKeyDown), ...(shouldCloseOnClickOutside ? overlayPressHandlers : {}), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_provider, { document: document, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('components-modal__frame', sizeClass, className), style: { ...frameStyle, ...style }, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([frameRef, constrainedTabbingRef, focusReturnRef, focusOnMount !== 'firstContentElement' ? focusOnMountRef : null]), role: role, "aria-label": contentLabel, "aria-labelledby": contentLabel ? undefined : headingId, "aria-describedby": aria.describedby, tabIndex: -1, onKeyDown: onKeyDown, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('components-modal__content', { 'hide-header': __experimentalHideHeader, 'is-scrollable': hasScrollableContent, 'has-scrolled-content': hasScrolledContent }), role: "document", onScroll: onContentContainerScroll, ref: contentRef, "aria-label": hasScrollableContent ? (0,external_wp_i18n_namespaceObject.__)('Scrollable section') : undefined, tabIndex: hasScrollableContent ? 0 : undefined, children: [!__experimentalHideHeader && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-modal__header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-modal__header-heading-container", children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-modal__icon-container", "aria-hidden": true, children: icon }), title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { id: headingId, className: "components-modal__header-heading", children: title })] }), headerActions, isDismissible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { marginBottom: 0, marginLeft: 2 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { size: "compact", onClick: event => closeModal().then(() => onRequestClose(event)), icon: library_close, label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close') })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([childrenContainerRef, focusOnMount === 'firstContentElement' ? focusOnMountRef : null]), children: children })] }) }) }) }); return (0,external_wp_element_namespaceObject.createPortal)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModalContext.Provider, { value: nestedDismissers, children: modal }), document.body); } /** * Modals give users information and choices related to a task they’re trying to * accomplish. They can contain critical information, require decisions, or * involve multiple tasks. * * ```jsx * import { Button, Modal } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyModal = () => { * const [ isOpen, setOpen ] = useState( false ); * const openModal = () => setOpen( true ); * const closeModal = () => setOpen( false ); * * return ( * <> * <Button variant="secondary" onClick={ openModal }> * Open Modal * </Button> * { isOpen && ( * <Modal title="This is my modal" onRequestClose={ closeModal }> * <Button variant="secondary" onClick={ closeModal }> * My custom close button * </Button> * </Modal> * ) } * </> * ); * }; * ``` */ const Modal = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedModal); /* harmony default export */ const modal = (Modal); ;// ./node_modules/@wordpress/components/build-module/confirm-dialog/styles.js function confirm_dialog_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * The z-index for ConfirmDialog is being set here instead of in * packages/base-styles/_z-index.scss, because this component uses * emotion instead of sass. * * ConfirmDialog needs this higher z-index to ensure it renders on top of * any parent Popover component. */ const styles_wrapper = true ? { name: "7g5ii0", styles: "&&{z-index:1000001;}" } : 0; ;// ./node_modules/@wordpress/components/build-module/confirm-dialog/component.js /** * WordPress dependencies */ /** * Internal dependencies */ const UnconnectedConfirmDialog = (props, forwardedRef) => { const { isOpen: isOpenProp, onConfirm, onCancel, children, confirmButtonText, cancelButtonText, ...otherProps } = useContextSystem(props, 'ConfirmDialog'); const cx = useCx(); const wrapperClassName = cx(styles_wrapper); const cancelButtonRef = (0,external_wp_element_namespaceObject.useRef)(); const confirmButtonRef = (0,external_wp_element_namespaceObject.useRef)(); const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(); const [shouldSelfClose, setShouldSelfClose] = (0,external_wp_element_namespaceObject.useState)(); (0,external_wp_element_namespaceObject.useEffect)(() => { // We only allow the dialog to close itself if `isOpenProp` is *not* set. // If `isOpenProp` is set, then it (probably) means it's controlled by a // parent component. In that case, `shouldSelfClose` might do more harm than // good, so we disable it. const isIsOpenSet = typeof isOpenProp !== 'undefined'; setIsOpen(isIsOpenSet ? isOpenProp : true); setShouldSelfClose(!isIsOpenSet); }, [isOpenProp]); const handleEvent = (0,external_wp_element_namespaceObject.useCallback)(callback => event => { callback?.(event); if (shouldSelfClose) { setIsOpen(false); } }, [shouldSelfClose, setIsOpen]); const handleEnter = (0,external_wp_element_namespaceObject.useCallback)(event => { // Avoid triggering the 'confirm' action when a button is focused, // as this can cause a double submission. const isConfirmOrCancelButton = event.target === cancelButtonRef.current || event.target === confirmButtonRef.current; if (!isConfirmOrCancelButton && event.key === 'Enter') { handleEvent(onConfirm)(event); } }, [handleEvent, onConfirm]); const cancelLabel = cancelButtonText !== null && cancelButtonText !== void 0 ? cancelButtonText : (0,external_wp_i18n_namespaceObject.__)('Cancel'); const confirmLabel = confirmButtonText !== null && confirmButtonText !== void 0 ? confirmButtonText : (0,external_wp_i18n_namespaceObject.__)('OK'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: isOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(modal, { onRequestClose: handleEvent(onCancel), onKeyDown: handleEnter, closeButtonLabel: cancelLabel, isDismissible: true, ref: forwardedRef, overlayClassName: wrapperClassName, __experimentalHideHeader: true, ...otherProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { spacing: 8, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(text_component, { children: children }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(flex_component, { direction: "row", justify: "flex-end", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, ref: cancelButtonRef, variant: "tertiary", onClick: handleEvent(onCancel), children: cancelLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, ref: confirmButtonRef, variant: "primary", onClick: handleEvent(onConfirm), children: confirmLabel })] })] }) }) }); }; /** * `ConfirmDialog` is built of top of [`Modal`](/packages/components/src/modal/README.md) * and displays a confirmation dialog, with _confirm_ and _cancel_ buttons. * The dialog is confirmed by clicking the _confirm_ button or by pressing the `Enter` key. * It is cancelled (closed) by clicking the _cancel_ button, by pressing the `ESC` key, or by * clicking outside the dialog focus (i.e, the overlay). * * `ConfirmDialog` has two main implicit modes: controlled and uncontrolled. * * UnControlled: * * Allows the component to be used standalone, just by declaring it as part of another React's component render method: * - It will be automatically open (displayed) upon mounting; * - It will be automatically closed when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay); * - `onCancel` is not mandatory but can be passed. Even if passed, the dialog will still be able to close itself. * * Activating this mode is as simple as omitting the `isOpen` prop. The only mandatory prop, in this case, is the `onConfirm` callback. The message is passed as the `children`. You can pass any JSX you'd like, which allows to further format the message or include sub-component if you'd like: * * ```jsx * import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components'; * * function Example() { * return ( * <ConfirmDialog onConfirm={ () => console.debug( ' Confirmed! ' ) }> * Are you sure? <strong>This action cannot be undone!</strong> * </ConfirmDialog> * ); * } * ``` * * * Controlled mode: * Let the parent component control when the dialog is open/closed. It's activated when a * boolean value is passed to `isOpen`: * - It will not be automatically closed. You need to let it know when to open/close by updating the value of the `isOpen` prop; * - Both `onConfirm` and the `onCancel` callbacks are mandatory props in this mode; * - You'll want to update the state that controls `isOpen` by updating it from the `onCancel` and `onConfirm` callbacks. * *```jsx * import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * function Example() { * const [ isOpen, setIsOpen ] = useState( true ); * * const handleConfirm = () => { * console.debug( 'Confirmed!' ); * setIsOpen( false ); * }; * * const handleCancel = () => { * console.debug( 'Cancelled!' ); * setIsOpen( false ); * }; * * return ( * <ConfirmDialog * isOpen={ isOpen } * onConfirm={ handleConfirm } * onCancel={ handleCancel } * > * Are you sure? <strong>This action cannot be undone!</strong> * </ConfirmDialog> * ); * } * ``` */ const ConfirmDialog = contextConnect(UnconnectedConfirmDialog, 'ConfirmDialog'); /* harmony default export */ const confirm_dialog_component = (ConfirmDialog); ;// ./node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js "use client"; // src/combobox/combobox-context.tsx var ComboboxListRoleContext = (0,external_React_.createContext)( void 0 ); var VEVQD5MH_ctx = createStoreContext( [PopoverContextProvider, CompositeContextProvider], [PopoverScopedContextProvider, CompositeScopedContextProvider] ); var useComboboxContext = VEVQD5MH_ctx.useContext; var useComboboxScopedContext = VEVQD5MH_ctx.useScopedContext; var useComboboxProviderContext = VEVQD5MH_ctx.useProviderContext; var ComboboxContextProvider = VEVQD5MH_ctx.ContextProvider; var ComboboxScopedContextProvider = VEVQD5MH_ctx.ScopedContextProvider; var ComboboxItemValueContext = (0,external_React_.createContext)( void 0 ); var ComboboxItemCheckedContext = (0,external_React_.createContext)(false); ;// ./node_modules/@ariakit/core/esm/select/select-store.js "use client"; // src/select/select-store.ts function createSelectStore(_a = {}) { var _b = _a, { combobox } = _b, props = _3YLGPPWQ_objRest(_b, [ "combobox" ]); const store = mergeStore( props.store, omit2(combobox, [ "value", "items", "renderedItems", "baseElement", "arrowElement", "anchorElement", "contentElement", "popoverElement", "disclosureElement" ]) ); throwOnConflictingProps(props, store); const syncState = store.getState(); const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store, virtualFocus: defaultValue( props.virtualFocus, syncState.virtualFocus, true ), includesBaseElement: defaultValue( props.includesBaseElement, syncState.includesBaseElement, false ), activeId: defaultValue( props.activeId, syncState.activeId, props.defaultActiveId, null ), orientation: defaultValue( props.orientation, syncState.orientation, "vertical" ) })); const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store, placement: defaultValue( props.placement, syncState.placement, "bottom-start" ) })); const initialValue = new String(""); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), { value: defaultValue( props.value, syncState.value, props.defaultValue, initialValue ), setValueOnMove: defaultValue( props.setValueOnMove, syncState.setValueOnMove, false ), labelElement: defaultValue(syncState.labelElement, null), selectElement: defaultValue(syncState.selectElement, null), listElement: defaultValue(syncState.listElement, null) }); const select = createStore(initialState, composite, popover, store); setup( select, () => sync(select, ["value", "items"], (state) => { if (state.value !== initialValue) return; if (!state.items.length) return; const item = state.items.find( (item2) => !item2.disabled && item2.value != null ); if ((item == null ? void 0 : item.value) == null) return; select.setState("value", item.value); }) ); setup( select, () => sync(select, ["mounted"], (state) => { if (state.mounted) return; select.setState("activeId", initialState.activeId); }) ); setup( select, () => sync(select, ["mounted", "items", "value"], (state) => { if (combobox) return; if (state.mounted) return; const values = toArray(state.value); const lastValue = values[values.length - 1]; if (lastValue == null) return; const item = state.items.find( (item2) => !item2.disabled && item2.value === lastValue ); if (!item) return; select.setState("activeId", item.id); }) ); setup( select, () => batch(select, ["setValueOnMove", "moves"], (state) => { const { mounted, value, activeId } = select.getState(); if (!state.setValueOnMove && mounted) return; if (Array.isArray(value)) return; if (!state.moves) return; if (!activeId) return; const item = composite.item(activeId); if (!item || item.disabled || item.value == null) return; select.setState("value", item.value); }) ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite), popover), select), { combobox, setValue: (value) => select.setState("value", value), setLabelElement: (element) => select.setState("labelElement", element), setSelectElement: (element) => select.setState("selectElement", element), setListElement: (element) => select.setState("listElement", element) }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/S5WQ44SQ.js "use client"; // src/select/select-store.ts function useSelectStoreOptions(props) { const combobox = useComboboxProviderContext(); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { combobox: props.combobox !== void 0 ? props.combobox : combobox }); return useCompositeStoreOptions(props); } function useSelectStoreProps(store, update, props) { useUpdateEffect(update, [props.combobox]); useStoreProps(store, props, "value", "setValue"); useStoreProps(store, props, "setValueOnMove"); return Object.assign( usePopoverStoreProps( useCompositeStoreProps(store, update, props), update, props ), { combobox: props.combobox } ); } function useSelectStore(props = {}) { props = useSelectStoreOptions(props); const [store, update] = YV4JVR4I_useStore(createSelectStore, props); return useSelectStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/KPEX55MY.js "use client"; // src/select/select-context.tsx var KPEX55MY_ctx = createStoreContext( [PopoverContextProvider, CompositeContextProvider], [PopoverScopedContextProvider, CompositeScopedContextProvider] ); var useSelectContext = KPEX55MY_ctx.useContext; var useSelectScopedContext = KPEX55MY_ctx.useScopedContext; var useSelectProviderContext = KPEX55MY_ctx.useProviderContext; var SelectContextProvider = KPEX55MY_ctx.ContextProvider; var SelectScopedContextProvider = KPEX55MY_ctx.ScopedContextProvider; var SelectItemCheckedContext = (0,external_React_.createContext)(false); var SelectHeadingContext = (0,external_React_.createContext)(null); ;// ./node_modules/@ariakit/react-core/esm/select/select-label.js "use client"; // src/select/select-label.tsx var select_label_TagName = "div"; var useSelectLabel = createHook( function useSelectLabel2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useSelectProviderContext(); store = store || context; invariant( store, false && 0 ); const id = useId(props.id); const onClickProp = props.onClick; const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; queueMicrotask(() => { const select = store == null ? void 0 : store.getState().selectElement; select == null ? void 0 : select.focus(); }); }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id }, props), { ref: useMergeRefs(store.setLabelElement, props.ref), onClick, style: _3YLGPPWQ_spreadValues({ cursor: "default" }, props.style) }); return removeUndefinedValues(props); } ); var SelectLabel = memo2( forwardRef2(function SelectLabel2(props) { const htmlProps = useSelectLabel(props); return LMDWO4NN_createElement(select_label_TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/X5NMLKT6.js "use client"; // src/button/button.tsx var X5NMLKT6_TagName = "button"; var useButton = createHook( function useButton2(props) { const ref = (0,external_React_.useRef)(null); const tagName = useTagName(ref, X5NMLKT6_TagName); const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)( () => !!tagName && isButton({ tagName, type: props.type }) ); (0,external_React_.useEffect)(() => { if (!ref.current) return; setIsNativeButton(isButton(ref.current)); }, []); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ role: !isNativeButton && tagName !== "a" ? "button" : void 0 }, props), { ref: useMergeRefs(ref, props.ref) }); props = useCommand(props); return props; } ); var X5NMLKT6_Button = forwardRef2(function Button2(props) { const htmlProps = useButton(props); return LMDWO4NN_createElement(X5NMLKT6_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/P4IRICAX.js "use client"; // src/disclosure/disclosure.tsx var P4IRICAX_TagName = "button"; var P4IRICAX_symbol = Symbol("disclosure"); var useDisclosure = createHook( function useDisclosure2(_a) { var _b = _a, { store, toggleOnClick = true } = _b, props = __objRest(_b, ["store", "toggleOnClick"]); const context = useDisclosureProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const [expanded, setExpanded] = (0,external_React_.useState)(false); const disclosureElement = store.useState("disclosureElement"); const open = store.useState("open"); (0,external_React_.useEffect)(() => { let isCurrentDisclosure = disclosureElement === ref.current; if (!(disclosureElement == null ? void 0 : disclosureElement.isConnected)) { store == null ? void 0 : store.setDisclosureElement(ref.current); isCurrentDisclosure = true; } setExpanded(open && isCurrentDisclosure); }, [disclosureElement, store, open]); const onClickProp = props.onClick; const toggleOnClickProp = useBooleanEvent(toggleOnClick); const [isDuplicate, metadataProps] = useMetadataProps(props, P4IRICAX_symbol, true); const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; if (isDuplicate) return; if (!toggleOnClickProp(event)) return; store == null ? void 0 : store.setDisclosureElement(event.currentTarget); store == null ? void 0 : store.toggle(); }); const contentElement = store.useState("contentElement"); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({ "aria-expanded": expanded, "aria-controls": contentElement == null ? void 0 : contentElement.id }, metadataProps), props), { ref: useMergeRefs(ref, props.ref), onClick }); props = useButton(props); return props; } ); var Disclosure = forwardRef2(function Disclosure2(props) { const htmlProps = useDisclosure(props); return LMDWO4NN_createElement(P4IRICAX_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/AXB53BZF.js "use client"; // src/dialog/dialog-disclosure.tsx var AXB53BZF_TagName = "button"; var useDialogDisclosure = createHook( function useDialogDisclosure2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useDialogProviderContext(); store = store || context; invariant( store, false && 0 ); const contentElement = store.useState("contentElement"); props = _3YLGPPWQ_spreadValues({ "aria-haspopup": getPopupRole(contentElement, "dialog") }, props); props = useDisclosure(_3YLGPPWQ_spreadValues({ store }, props)); return props; } ); var DialogDisclosure = forwardRef2(function DialogDisclosure2(props) { const htmlProps = useDialogDisclosure(props); return LMDWO4NN_createElement(AXB53BZF_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js "use client"; // src/popover/popover-anchor.tsx var OMU7RWRV_TagName = "div"; var usePopoverAnchor = createHook( function usePopoverAnchor2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = usePopoverProviderContext(); store = store || context; props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref) }); return props; } ); var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) { const htmlProps = usePopoverAnchor(props); return LMDWO4NN_createElement(OMU7RWRV_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/QYJ6MIDR.js "use client"; // src/popover/popover-disclosure.tsx var QYJ6MIDR_TagName = "button"; var usePopoverDisclosure = createHook(function usePopoverDisclosure2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = usePopoverProviderContext(); store = store || context; invariant( store, false && 0 ); const onClickProp = props.onClick; const onClick = useEvent((event) => { store == null ? void 0 : store.setAnchorElement(event.currentTarget); onClickProp == null ? void 0 : onClickProp(event); }); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PopoverScopedContextProvider, { value: store, children: element }), [store] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { onClick }); props = usePopoverAnchor(_3YLGPPWQ_spreadValues({ store }, props)); props = useDialogDisclosure(_3YLGPPWQ_spreadValues({ store }, props)); return props; }); var PopoverDisclosure = forwardRef2(function PopoverDisclosure2(props) { const htmlProps = usePopoverDisclosure(props); return LMDWO4NN_createElement(QYJ6MIDR_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/DR55NYVS.js "use client"; // src/popover/popover-disclosure-arrow.tsx var DR55NYVS_TagName = "span"; var pointsMap = { top: "4,10 8,6 12,10", right: "6,4 10,8 6,12", bottom: "4,6 8,10 12,6", left: "10,4 6,8 10,12" }; var usePopoverDisclosureArrow = createHook(function usePopoverDisclosureArrow2(_a) { var _b = _a, { store, placement } = _b, props = __objRest(_b, ["store", "placement"]); const context = usePopoverContext(); store = store || context; invariant( store, false && 0 ); const position = store.useState((state) => placement || state.placement); const dir = position.split("-")[0]; const points = pointsMap[dir]; const children = (0,external_React_.useMemo)( () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "svg", { display: "block", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, viewBox: "0 0 16 16", height: "1em", width: "1em", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("polyline", { points }) } ), [points] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ children, "aria-hidden": true }, props), { style: _3YLGPPWQ_spreadValues({ width: "1em", height: "1em", pointerEvents: "none" }, props.style) }); return removeUndefinedValues(props); }); var PopoverDisclosureArrow = forwardRef2( function PopoverDisclosureArrow2(props) { const htmlProps = usePopoverDisclosureArrow(props); return LMDWO4NN_createElement(DR55NYVS_TagName, htmlProps); } ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/UD53QJDV.js "use client"; // src/select/select-arrow.tsx var UD53QJDV_TagName = "span"; var useSelectArrow = createHook( function useSelectArrow2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useSelectContext(); store = store || context; props = usePopoverDisclosureArrow(_3YLGPPWQ_spreadValues({ store }, props)); return props; } ); var SelectArrow = forwardRef2(function SelectArrow2(props) { const htmlProps = useSelectArrow(props); return LMDWO4NN_createElement(UD53QJDV_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/select/select.js "use client"; // src/select/select.tsx var select_TagName = "button"; function getSelectedValues(select) { return Array.from(select.selectedOptions).map((option) => option.value); } function nextWithValue(store, next) { return () => { const nextId = next(); if (!nextId) return; let i = 0; let nextItem = store.item(nextId); const firstItem = nextItem; while (nextItem && nextItem.value == null) { const nextId2 = next(++i); if (!nextId2) return; nextItem = store.item(nextId2); if (nextItem === firstItem) break; } return nextItem == null ? void 0 : nextItem.id; }; } var useSelect = createHook(function useSelect2(_a) { var _b = _a, { store, name, form, required, showOnKeyDown = true, moveOnKeyDown = true, toggleOnPress = true, toggleOnClick = toggleOnPress } = _b, props = __objRest(_b, [ "store", "name", "form", "required", "showOnKeyDown", "moveOnKeyDown", "toggleOnPress", "toggleOnClick" ]); const context = useSelectProviderContext(); store = store || context; invariant( store, false && 0 ); const onKeyDownProp = props.onKeyDown; const showOnKeyDownProp = useBooleanEvent(showOnKeyDown); const moveOnKeyDownProp = useBooleanEvent(moveOnKeyDown); const placement = store.useState("placement"); const dir = placement.split("-")[0]; const value = store.useState("value"); const multiSelectable = Array.isArray(value); const onKeyDown = useEvent((event) => { var _a2; onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (event.defaultPrevented) return; if (!store) return; const { orientation, items: items2, activeId } = store.getState(); const isVertical = orientation !== "horizontal"; const isHorizontal = orientation !== "vertical"; const isGrid = !!((_a2 = items2.find((item) => !item.disabled && item.value != null)) == null ? void 0 : _a2.rowId); const moveKeyMap = { ArrowUp: (isGrid || isVertical) && nextWithValue(store, store.up), ArrowRight: (isGrid || isHorizontal) && nextWithValue(store, store.next), ArrowDown: (isGrid || isVertical) && nextWithValue(store, store.down), ArrowLeft: (isGrid || isHorizontal) && nextWithValue(store, store.previous) }; const getId = moveKeyMap[event.key]; if (getId && moveOnKeyDownProp(event)) { event.preventDefault(); store.move(getId()); } const isTopOrBottom = dir === "top" || dir === "bottom"; const isLeft = dir === "left"; const isRight = dir === "right"; const canShowKeyMap = { ArrowDown: isTopOrBottom, ArrowUp: isTopOrBottom, ArrowLeft: isLeft, ArrowRight: isRight }; const canShow = canShowKeyMap[event.key]; if (canShow && showOnKeyDownProp(event)) { event.preventDefault(); store.move(activeId); queueBeforeEvent(event.currentTarget, "keyup", store.show); } }); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectScopedContextProvider, { value: store, children: element }), [store] ); const [autofill, setAutofill] = (0,external_React_.useState)(false); const nativeSelectChangedRef = (0,external_React_.useRef)(false); (0,external_React_.useEffect)(() => { const nativeSelectChanged = nativeSelectChangedRef.current; nativeSelectChangedRef.current = false; if (nativeSelectChanged) return; setAutofill(false); }, [value]); const labelId = store.useState((state) => { var _a2; return (_a2 = state.labelElement) == null ? void 0 : _a2.id; }); const label = props["aria-label"]; const labelledBy = props["aria-labelledby"] || labelId; const items = store.useState((state) => { if (!name) return; return state.items; }); const values = (0,external_React_.useMemo)(() => { return [...new Set(items == null ? void 0 : items.map((i) => i.value).filter((v) => v != null))]; }, [items]); props = useWrapElement( props, (element) => { if (!name) return element; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "select", { style: { border: 0, clip: "rect(0 0 0 0)", height: "1px", margin: "-1px", overflow: "hidden", padding: 0, position: "absolute", whiteSpace: "nowrap", width: "1px" }, tabIndex: -1, "aria-hidden": true, "aria-label": label, "aria-labelledby": labelledBy, name, form, required, value, multiple: multiSelectable, onFocus: () => { var _a2; return (_a2 = store == null ? void 0 : store.getState().selectElement) == null ? void 0 : _a2.focus(); }, onChange: (event) => { nativeSelectChangedRef.current = true; setAutofill(true); store == null ? void 0 : store.setValue( multiSelectable ? getSelectedValues(event.target) : event.target.value ); }, children: [ toArray(value).map((value2) => { if (value2 == null) return null; if (values.includes(value2)) return null; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("option", { value: value2, children: value2 }, value2); }), values.map((value2) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("option", { value: value2, children: value2 }, value2)) ] } ), element ] }); }, [ store, label, labelledBy, name, form, required, value, multiSelectable, values ] ); const children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ value, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectArrow, {}) ] }); const contentElement = store.useState("contentElement"); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ role: "combobox", "aria-autocomplete": "none", "aria-labelledby": labelId, "aria-haspopup": getPopupRole(contentElement, "listbox"), "data-autofill": autofill || void 0, "data-name": name, children }, props), { ref: useMergeRefs(store.setSelectElement, props.ref), onKeyDown }); props = usePopoverDisclosure(_3YLGPPWQ_spreadValues({ store, toggleOnClick }, props)); props = useCompositeTypeahead(_3YLGPPWQ_spreadValues({ store }, props)); return props; }); var select_Select = forwardRef2(function Select2(props) { const htmlProps = useSelect(props); return LMDWO4NN_createElement(select_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/XRBJGF7I.js "use client"; // src/select/select-list.tsx var XRBJGF7I_TagName = "div"; var SelectListContext = (0,external_React_.createContext)(null); var useSelectList = createHook( function useSelectList2(_a) { var _b = _a, { store, resetOnEscape = true, hideOnEnter = true, focusOnMove = true, composite, alwaysVisible } = _b, props = __objRest(_b, [ "store", "resetOnEscape", "hideOnEnter", "focusOnMove", "composite", "alwaysVisible" ]); const context = useSelectContext(); store = store || context; invariant( store, false && 0 ); const id = useId(props.id); const value = store.useState("value"); const multiSelectable = Array.isArray(value); const [defaultValue, setDefaultValue] = (0,external_React_.useState)(value); const mounted = store.useState("mounted"); (0,external_React_.useEffect)(() => { if (mounted) return; setDefaultValue(value); }, [mounted, value]); resetOnEscape = resetOnEscape && !multiSelectable; const onKeyDownProp = props.onKeyDown; const resetOnEscapeProp = useBooleanEvent(resetOnEscape); const hideOnEnterProp = useBooleanEvent(hideOnEnter); const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (event.defaultPrevented) return; if (event.key === "Escape" && resetOnEscapeProp(event)) { store == null ? void 0 : store.setValue(defaultValue); } if (event.key === " " || event.key === "Enter") { if (isSelfTarget(event) && hideOnEnterProp(event)) { event.preventDefault(); store == null ? void 0 : store.hide(); } } }); const headingContext = (0,external_React_.useContext)(SelectHeadingContext); const headingState = (0,external_React_.useState)(); const [headingId, setHeadingId] = headingContext || headingState; const headingContextValue = (0,external_React_.useMemo)( () => [headingId, setHeadingId], [headingId] ); const [childStore, setChildStore] = (0,external_React_.useState)(null); const setStore = (0,external_React_.useContext)(SelectListContext); (0,external_React_.useEffect)(() => { if (!setStore) return; setStore(store); return () => setStore(null); }, [setStore, store]); props = useWrapElement( props, (element2) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectListContext.Provider, { value: setChildStore, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectHeadingContext.Provider, { value: headingContextValue, children: element2 }) }) }), [store, headingContextValue] ); const hasCombobox = !!store.combobox; composite = composite != null ? composite : !hasCombobox && childStore !== store; const [element, setElement] = useTransactionState( composite ? store.setListElement : null ); const role = useAttribute(element, "role", props.role); const isCompositeRole = role === "listbox" || role === "menu" || role === "tree" || role === "grid"; const ariaMultiSelectable = composite || isCompositeRole ? multiSelectable || void 0 : void 0; const hidden = isHidden(mounted, props.hidden, alwaysVisible); const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style; if (composite) { props = _3YLGPPWQ_spreadValues({ role: "listbox", "aria-multiselectable": ariaMultiSelectable }, props); } const labelId = store.useState( (state) => { var _a2; return headingId || ((_a2 = state.labelElement) == null ? void 0 : _a2.id); } ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, "aria-labelledby": labelId, hidden }, props), { ref: useMergeRefs(setElement, props.ref), style, onKeyDown }); props = useComposite(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store }, props), { composite })); props = useCompositeTypeahead(_3YLGPPWQ_spreadValues({ store, typeahead: !hasCombobox }, props)); return props; } ); var SelectList = forwardRef2(function SelectList2(props) { const htmlProps = useSelectList(props); return LMDWO4NN_createElement(XRBJGF7I_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/select/select-popover.js "use client"; // src/select/select-popover.tsx var select_popover_TagName = "div"; var useSelectPopover = createHook( function useSelectPopover2(_a) { var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); const context = useSelectProviderContext(); store = store || context; props = useSelectList(_3YLGPPWQ_spreadValues({ store, alwaysVisible }, props)); props = usePopover(_3YLGPPWQ_spreadValues({ store, alwaysVisible }, props)); return props; } ); var SelectPopover = createDialogComponent( forwardRef2(function SelectPopover2(props) { const htmlProps = useSelectPopover(props); return LMDWO4NN_createElement(select_popover_TagName, htmlProps); }), useSelectProviderContext ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/YF2ICFG4.js "use client"; // src/select/select-item.tsx var YF2ICFG4_TagName = "div"; function isSelected(storeValue, itemValue) { if (itemValue == null) return; if (storeValue == null) return false; if (Array.isArray(storeValue)) { return storeValue.includes(itemValue); } return storeValue === itemValue; } var useSelectItem = createHook( function useSelectItem2(_a) { var _b = _a, { store, value, getItem: getItemProp, hideOnClick, setValueOnClick = value != null, preventScrollOnKeyDown = true, focusOnHover = true } = _b, props = __objRest(_b, [ "store", "value", "getItem", "hideOnClick", "setValueOnClick", "preventScrollOnKeyDown", "focusOnHover" ]); var _a2; const context = useSelectScopedContext(); store = store || context; invariant( store, false && 0 ); const id = useId(props.id); const disabled = disabledFromProps(props); const { listElement, multiSelectable, selected, autoFocus } = useStoreStateObject(store, { listElement: "listElement", multiSelectable(state) { return Array.isArray(state.value); }, selected(state) { return isSelected(state.value, value); }, autoFocus(state) { if (value == null) return false; if (state.value == null) return false; if (state.activeId !== id && (store == null ? void 0 : store.item(state.activeId))) { return false; } if (Array.isArray(state.value)) { return state.value[state.value.length - 1] === value; } return state.value === value; } }); const getItem = (0,external_React_.useCallback)( (item) => { const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { value: disabled ? void 0 : value, children: value }); if (getItemProp) { return getItemProp(nextItem); } return nextItem; }, [disabled, value, getItemProp] ); hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable; const onClickProp = props.onClick; const setValueOnClickProp = useBooleanEvent(setValueOnClick); const hideOnClickProp = useBooleanEvent(hideOnClick); const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; if (isDownloading(event)) return; if (isOpeningInNewTab(event)) return; if (setValueOnClickProp(event) && value != null) { store == null ? void 0 : store.setValue((prevValue) => { if (!Array.isArray(prevValue)) return value; if (prevValue.includes(value)) { return prevValue.filter((v) => v !== value); } return [...prevValue, value]; }); } if (hideOnClickProp(event)) { store == null ? void 0 : store.hide(); } }); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }), [selected] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, role: getPopupItemRole(listElement), "aria-selected": selected, children: value }, props), { autoFocus: (_a2 = props.autoFocus) != null ? _a2 : autoFocus, onClick }); props = useCompositeItem(_3YLGPPWQ_spreadValues({ store, getItem, preventScrollOnKeyDown }, props)); const focusOnHoverProp = useBooleanEvent(focusOnHover); props = useCompositeHover(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store }, props), { // We have to disable focusOnHover when the popup is closed, otherwise // the active item will change to null (the container) when the popup is // closed by clicking on an item. focusOnHover(event) { if (!focusOnHoverProp(event)) return false; const state = store == null ? void 0 : store.getState(); return !!(state == null ? void 0 : state.open); } })); return props; } ); var SelectItem = memo2( forwardRef2(function SelectItem2(props) { const htmlProps = useSelectItem(props); return LMDWO4NN_createElement(YF2ICFG4_TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/EYKMH5G5.js "use client"; // src/checkbox/checkbox-checked-context.tsx var CheckboxCheckedContext = (0,external_React_.createContext)(false); ;// ./node_modules/@ariakit/react-core/esm/__chunks/5JCRYSSV.js "use client"; // src/checkbox/checkbox-check.tsx var _5JCRYSSV_TagName = "span"; var checkmark = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "svg", { display: "block", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, viewBox: "0 0 16 16", height: "1em", width: "1em", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("polyline", { points: "4,8 7,12 12,4" }) } ); function getChildren(props) { if (props.checked) { return props.children || checkmark; } if (typeof props.children === "function") { return props.children; } return null; } var useCheckboxCheck = createHook( function useCheckboxCheck2(_a) { var _b = _a, { store, checked } = _b, props = __objRest(_b, ["store", "checked"]); const context = (0,external_React_.useContext)(CheckboxCheckedContext); checked = checked != null ? checked : context; const children = getChildren({ checked, children: props.children }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ "aria-hidden": true }, props), { children, style: _3YLGPPWQ_spreadValues({ width: "1em", height: "1em", pointerEvents: "none" }, props.style) }); return removeUndefinedValues(props); } ); var CheckboxCheck = forwardRef2(function CheckboxCheck2(props) { const htmlProps = useCheckboxCheck(props); return LMDWO4NN_createElement(_5JCRYSSV_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/select/select-item-check.js "use client"; // src/select/select-item-check.tsx var select_item_check_TagName = "span"; var useSelectItemCheck = createHook( function useSelectItemCheck2(_a) { var _b = _a, { store, checked } = _b, props = __objRest(_b, ["store", "checked"]); const context = (0,external_React_.useContext)(SelectItemCheckedContext); checked = checked != null ? checked : context; props = useCheckboxCheck(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { checked })); return props; } ); var SelectItemCheck = forwardRef2(function SelectItemCheck2(props) { const htmlProps = useSelectItemCheck(props); return LMDWO4NN_createElement(select_item_check_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/custom-select-control-v2/styles.js function custom_select_control_v2_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ // TODO: extract to common utils and apply to relevant components const ANIMATION_PARAMS = { SLIDE_AMOUNT: '2px', DURATION: '400ms', EASING: 'cubic-bezier( 0.16, 1, 0.3, 1 )' }; const INLINE_PADDING = { compact: config_values.controlPaddingXSmall, small: config_values.controlPaddingXSmall, default: config_values.controlPaddingX }; const getSelectSize = (size, heightProperty) => { const sizes = { compact: { [heightProperty]: 32, paddingInlineStart: INLINE_PADDING.compact, paddingInlineEnd: INLINE_PADDING.compact + chevronIconSize }, default: { [heightProperty]: 40, paddingInlineStart: INLINE_PADDING.default, paddingInlineEnd: INLINE_PADDING.default + chevronIconSize }, small: { [heightProperty]: 24, paddingInlineStart: INLINE_PADDING.small, paddingInlineEnd: INLINE_PADDING.small + chevronIconSize } }; return sizes[size] || sizes.default; }; const getSelectItemSize = size => { // Used to visually align the checkmark with the chevron const checkmarkCorrection = 6; const sizes = { compact: { paddingInlineStart: INLINE_PADDING.compact, paddingInlineEnd: INLINE_PADDING.compact - checkmarkCorrection }, default: { paddingInlineStart: INLINE_PADDING.default, paddingInlineEnd: INLINE_PADDING.default - checkmarkCorrection }, small: { paddingInlineStart: INLINE_PADDING.small, paddingInlineEnd: INLINE_PADDING.small - checkmarkCorrection } }; return sizes[size] || sizes.default; }; const styles_Select = /*#__PURE__*/emotion_styled_base_browser_esm(select_Select, true ? { // Do not forward `hasCustomRenderProp` to the underlying Ariakit.Select component shouldForwardProp: prop => prop !== 'hasCustomRenderProp', target: "e1p3eej77" } : 0)(({ size, hasCustomRenderProp }) => /*#__PURE__*/emotion_react_browser_esm_css("display:block;background-color:", COLORS.theme.background, ";border:none;color:", COLORS.theme.foreground, ";cursor:pointer;font-family:inherit;text-align:start;user-select:none;width:100%;&[data-focus-visible]{outline:none;}", getSelectSize(size, hasCustomRenderProp ? 'minHeight' : 'height'), " ", !hasCustomRenderProp && truncateStyles, " ", fontSizeStyles({ inputSize: size }), ";" + ( true ? "" : 0), true ? "" : 0), true ? "" : 0); const slideDownAndFade = emotion_react_browser_esm_keyframes({ '0%': { opacity: 0, transform: `translateY(-${ANIMATION_PARAMS.SLIDE_AMOUNT})` }, '100%': { opacity: 1, transform: 'translateY(0)' } }); const styles_SelectPopover = /*#__PURE__*/emotion_styled_base_browser_esm(SelectPopover, true ? { target: "e1p3eej76" } : 0)("display:flex;flex-direction:column;background-color:", COLORS.theme.background, ";border-radius:", config_values.radiusSmall, ";border:1px solid ", COLORS.theme.foreground, ";box-shadow:", config_values.elevationMedium, ";z-index:1000000;max-height:min( var( --popover-available-height, 400px ), 400px );overflow:auto;overscroll-behavior:contain;min-width:min-content;&[data-open]{@media not ( prefers-reduced-motion ){animation-duration:", ANIMATION_PARAMS.DURATION, ";animation-timing-function:", ANIMATION_PARAMS.EASING, ";animation-name:", slideDownAndFade, ";will-change:transform,opacity;}}&[data-focus-visible]{outline:none;}" + ( true ? "" : 0)); const styles_SelectItem = /*#__PURE__*/emotion_styled_base_browser_esm(SelectItem, true ? { target: "e1p3eej75" } : 0)(({ size }) => /*#__PURE__*/emotion_react_browser_esm_css("cursor:default;display:flex;align-items:center;justify-content:space-between;font-size:", config_values.fontSize, ";line-height:28px;padding-block:", space(2), ";scroll-margin:", space(1), ";user-select:none;&[aria-disabled='true']{cursor:not-allowed;}&[data-active-item]{background-color:", COLORS.theme.gray[300], ";}", getSelectItemSize(size), ";" + ( true ? "" : 0), true ? "" : 0), true ? "" : 0); const truncateStyles = true ? { name: "1h52dri", styles: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap" } : 0; const SelectedExperimentalHintWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1p3eej74" } : 0)(truncateStyles, ";" + ( true ? "" : 0)); const SelectedExperimentalHintItem = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1p3eej73" } : 0)("color:", COLORS.theme.gray[600], ";margin-inline-start:", space(2), ";" + ( true ? "" : 0)); const WithHintItemWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1p3eej72" } : 0)("display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;flex:1;column-gap:", space(4), ";" + ( true ? "" : 0)); const WithHintItemHint = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1p3eej71" } : 0)("color:", COLORS.theme.gray[600], ";text-align:initial;line-height:", config_values.fontLineHeightBase, ";padding-inline-end:", space(1), ";margin-block:", space(1), ";" + ( true ? "" : 0)); const SelectedItemCheck = /*#__PURE__*/emotion_styled_base_browser_esm(SelectItemCheck, true ? { target: "e1p3eej70" } : 0)("display:flex;align-items:center;margin-inline-start:", space(2), ";align-self:start;margin-block-start:2px;font-size:0;", WithHintItemWrapper, "~&,&:not(:empty){font-size:24px;}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/custom-select-control-v2/custom-select.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const CustomSelectContext = (0,external_wp_element_namespaceObject.createContext)(undefined); function defaultRenderSelectedValue(value) { const isValueEmpty = Array.isArray(value) ? value.length === 0 : value === undefined || value === null; if (isValueEmpty) { return (0,external_wp_i18n_namespaceObject.__)('Select an item'); } if (Array.isArray(value)) { return value.length === 1 ? value[0] : // translators: %s: number of items selected (it will always be 2 or more items) (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s items selected'), value.length); } return value; } const CustomSelectButton = ({ renderSelectedValue, size = 'default', store, ...restProps }) => { const { value: currentValue } = useStoreState(store); const computedRenderSelectedValue = (0,external_wp_element_namespaceObject.useMemo)(() => renderSelectedValue !== null && renderSelectedValue !== void 0 ? renderSelectedValue : defaultRenderSelectedValue, [renderSelectedValue]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_Select, { ...restProps, size: size, hasCustomRenderProp: !!renderSelectedValue, store: store, children: computedRenderSelectedValue(currentValue) }); }; function _CustomSelect(props) { const { children, hideLabelFromVision = false, label, size, store, className, isLegacy = false, ...restProps } = props; const onSelectPopoverKeyDown = (0,external_wp_element_namespaceObject.useCallback)(e => { if (isLegacy) { e.stopPropagation(); } }, [isLegacy]); const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ store, size }), [store, size]); return ( /*#__PURE__*/ // Where should `restProps` be forwarded to? (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectLabel, { store: store, render: hideLabelFromVision ? /*#__PURE__*/ // @ts-expect-error `children` are passed via the render prop (0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, {}) : /*#__PURE__*/ // @ts-expect-error `children` are passed via the render prop (0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control.VisualLabel, { as: "div" }), children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(input_base, { __next40pxDefaultSize: true, size: size, suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(select_control_chevron_down, {}), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomSelectButton, { ...restProps, size: size, store: store // Match legacy behavior (move selection rather than open the popover) , showOnKeyDown: !isLegacy }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_SelectPopover, { gutter: 12, store: store, sameWidth: true, slide: false, onKeyDown: onSelectPopoverKeyDown // Match legacy behavior , flip: !isLegacy, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomSelectContext.Provider, { value: contextValue, children: children }) })] })] }) ); } /* harmony default export */ const custom_select = (_CustomSelect); ;// ./node_modules/@wordpress/components/build-module/custom-select-control-v2/item.js /** * WordPress dependencies */ /** * Internal dependencies */ function CustomSelectItem({ children, ...props }) { var _customSelectContext$; const customSelectContext = (0,external_wp_element_namespaceObject.useContext)(CustomSelectContext); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(styles_SelectItem, { store: customSelectContext?.store, size: (_customSelectContext$ = customSelectContext?.size) !== null && _customSelectContext$ !== void 0 ? _customSelectContext$ : 'default', ...props, children: [children !== null && children !== void 0 ? children : props.value, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectedItemCheck, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: library_check }) })] }); } CustomSelectItem.displayName = 'CustomSelectControlV2.Item'; /* harmony default export */ const custom_select_control_v2_item = (CustomSelectItem); ;// ./node_modules/@wordpress/components/build-module/custom-select-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function custom_select_control_useDeprecatedProps({ __experimentalShowSelectedHint, ...otherProps }) { return { showSelectedHint: __experimentalShowSelectedHint, ...otherProps }; } // The removal of `__experimentalHint` in favour of `hint` doesn't happen in // the `useDeprecatedProps` hook in order not to break consumers that rely // on object identity (see https://github.com/WordPress/gutenberg/pull/63248#discussion_r1672213131) function applyOptionDeprecations({ __experimentalHint, ...rest }) { return { hint: __experimentalHint, ...rest }; } function getDescribedBy(currentValue, describedBy) { if (describedBy) { return describedBy; } // translators: %s: The selected option. return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Currently selected: %s'), currentValue); } function CustomSelectControl(props) { const { __next40pxDefaultSize = false, __shouldNotWarnDeprecated36pxSize, describedBy, options, onChange, size = 'default', value, className: classNameProp, showSelectedHint = false, ...restProps } = custom_select_control_useDeprecatedProps(props); maybeWarnDeprecated36pxSize({ componentName: 'CustomSelectControl', __next40pxDefaultSize, size, __shouldNotWarnDeprecated36pxSize }); const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(CustomSelectControl, 'custom-select-control__description'); // Forward props + store from v2 implementation const store = useSelectStore({ async setValue(nextValue) { const nextOption = options.find(item => item.name === nextValue); if (!onChange || !nextOption) { return; } // Executes the logic in a microtask after the popup is closed. // This is simply to ensure the isOpen state matches the one from the // previous legacy implementation. await Promise.resolve(); const state = store.getState(); const changeObject = { highlightedIndex: state.renderedItems.findIndex(item => item.value === nextValue), inputValue: '', isOpen: state.open, selectedItem: nextOption, type: '' }; onChange(changeObject); }, value: value?.name, // Setting the first option as a default value when no value is provided // is already done natively by the underlying Ariakit component, // but doing this explicitly avoids the `onChange` callback from firing // on initial render, thus making this implementation closer to the v1. defaultValue: options[0]?.name }); const children = options.map(applyOptionDeprecations).map(({ name, key, hint, style, className }) => { const withHint = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithHintItemWrapper, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WithHintItemHint, { // Keeping the classname for legacy reasons className: "components-custom-select-control__item-hint", children: hint })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(custom_select_control_v2_item, { value: name, children: hint ? withHint : name, style: style, className: dist_clsx(className, // Keeping the classnames for legacy reasons 'components-custom-select-control__item', { 'has-hint': hint }) }, key); }); const currentValue = useStoreState(store, 'value'); const renderSelectedValueHint = () => { const selectedOptionHint = options?.map(applyOptionDeprecations)?.find(({ name }) => currentValue === name)?.hint; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SelectedExperimentalHintWrapper, { children: [currentValue, selectedOptionHint && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectedExperimentalHintItem, { // Keeping the classname for legacy reasons className: "components-custom-select-control__hint", children: selectedOptionHint })] }); }; const translatedSize = (() => { if (__next40pxDefaultSize && size === 'default' || size === '__unstable-large') { return 'default'; } if (!__next40pxDefaultSize && size === 'default') { return 'compact'; } return size; })(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(custom_select, { "aria-describedby": descriptionId, renderSelectedValue: showSelectedHint ? renderSelectedValueHint : undefined, size: translatedSize, store: store, className: dist_clsx( // Keeping the classname for legacy reasons 'components-custom-select-control', classNameProp), isLegacy: true, ...restProps, children: children }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: descriptionId, children: getDescribedBy(currentValue, describedBy) }) })] }); } /* harmony default export */ const custom_select_control = (CustomSelectControl); ;// ./node_modules/date-fns/toDate.mjs /** * @name toDate * @category Common Helpers * @summary Convert the given argument to an instance of Date. * * @description * Convert the given argument to an instance of Date. * * If the argument is an instance of Date, the function returns its clone. * * If the argument is a number, it is treated as a timestamp. * * If the argument is none of the above, the function returns Invalid Date. * * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param argument - The value to convert * * @returns The parsed date in the local time zone * * @example * // Clone the date: * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) * //=> Tue Feb 11 2014 11:30:30 * * @example * // Convert the timestamp to date: * const result = toDate(1392098430000) * //=> Tue Feb 11 2014 11:30:30 */ function toDate(argument) { const argStr = Object.prototype.toString.call(argument); // Clone the date if ( argument instanceof Date || (typeof argument === "object" && argStr === "[object Date]") ) { // Prevent the date to lose the milliseconds when passed to new Date() in IE10 return new argument.constructor(+argument); } else if ( typeof argument === "number" || argStr === "[object Number]" || typeof argument === "string" || argStr === "[object String]" ) { // TODO: Can we get rid of as? return new Date(argument); } else { // TODO: Can we get rid of as? return new Date(NaN); } } // Fallback for modularized imports: /* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate))); ;// ./node_modules/date-fns/startOfDay.mjs /** * @name startOfDay * @category Day Helpers * @summary Return the start of a day for the given date. * * @description * Return the start of a day for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * * @returns The start of a day * * @example * // The start of a day for 2 September 2014 11:55:00: * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0)) * //=> Tue Sep 02 2014 00:00:00 */ function startOfDay(date) { const _date = toDate(date); _date.setHours(0, 0, 0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfDay = ((/* unused pure expression or super */ null && (startOfDay))); ;// ./node_modules/date-fns/constructFrom.mjs /** * @name constructFrom * @category Generic Helpers * @summary Constructs a date using the reference date and the value * * @description * The function constructs a new date using the constructor from the reference * date and the given value. It helps to build generic functions that accept * date extensions. * * It defaults to `Date` if the passed reference date is a number or a string. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The reference date to take constructor from * @param value - The value to create the date * * @returns Date initialized using the given date and value * * @example * import { constructFrom } from 'date-fns' * * // A function that clones a date preserving the original type * function cloneDate<DateType extends Date(date: DateType): DateType { * return constructFrom( * date, // Use contrustor from the given date * date.getTime() // Use the date value to create a new date * ) * } */ function constructFrom(date, value) { if (date instanceof Date) { return new date.constructor(value); } else { return new Date(value); } } // Fallback for modularized imports: /* harmony default export */ const date_fns_constructFrom = ((/* unused pure expression or super */ null && (constructFrom))); ;// ./node_modules/date-fns/addMonths.mjs /** * @name addMonths * @category Month Helpers * @summary Add the specified number of months to the given date. * * @description * Add the specified number of months to the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param amount - The amount of months to be added. * * @returns The new date with the months added * * @example * // Add 5 months to 1 September 2014: * const result = addMonths(new Date(2014, 8, 1), 5) * //=> Sun Feb 01 2015 00:00:00 * * // Add one month to 30 January 2023: * const result = addMonths(new Date(2023, 0, 30), 1) * //=> Tue Feb 28 2023 00:00:00 */ function addMonths(date, amount) { const _date = toDate(date); if (isNaN(amount)) return constructFrom(date, NaN); if (!amount) { // If 0 months, no-op to avoid changing times in the hour before end of DST return _date; } const dayOfMonth = _date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we // want except that dates will wrap around the end of a month, meaning that // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So // we'll default to the end of the desired month by adding 1 to the desired // month and using a date of 0 to back up one day to the end of the desired // month. const endOfDesiredMonth = constructFrom(date, _date.getTime()); endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); const daysInMonth = endOfDesiredMonth.getDate(); if (dayOfMonth >= daysInMonth) { // If we're already at the end of the month, then this is the correct date // and we're done. return endOfDesiredMonth; } else { // Otherwise, we now know that setting the original day-of-month value won't // cause an overflow, so set the desired day-of-month. Note that we can't // just set the date of `endOfDesiredMonth` because that object may have had // its time changed in the unusual case where where a DST transition was on // the last day of the month and its local time was in the hour skipped or // repeated next to a DST transition. So we use `date` instead which is // guaranteed to still have the original time. _date.setFullYear( endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth, ); return _date; } } // Fallback for modularized imports: /* harmony default export */ const date_fns_addMonths = ((/* unused pure expression or super */ null && (addMonths))); ;// ./node_modules/date-fns/subMonths.mjs /** * @name subMonths * @category Month Helpers * @summary Subtract the specified number of months from the given date. * * @description * Subtract the specified number of months from the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param amount - The amount of months to be subtracted. * * @returns The new date with the months subtracted * * @example * // Subtract 5 months from 1 February 2015: * const result = subMonths(new Date(2015, 1, 1), 5) * //=> Mon Sep 01 2014 00:00:00 */ function subMonths(date, amount) { return addMonths(date, -amount); } // Fallback for modularized imports: /* harmony default export */ const date_fns_subMonths = ((/* unused pure expression or super */ null && (subMonths))); ;// ./node_modules/date-fns/locale/en-US/_lib/formatDistance.mjs const formatDistanceLocale = { lessThanXSeconds: { one: "less than a second", other: "less than {{count}} seconds", }, xSeconds: { one: "1 second", other: "{{count}} seconds", }, halfAMinute: "half a minute", lessThanXMinutes: { one: "less than a minute", other: "less than {{count}} minutes", }, xMinutes: { one: "1 minute", other: "{{count}} minutes", }, aboutXHours: { one: "about 1 hour", other: "about {{count}} hours", }, xHours: { one: "1 hour", other: "{{count}} hours", }, xDays: { one: "1 day", other: "{{count}} days", }, aboutXWeeks: { one: "about 1 week", other: "about {{count}} weeks", }, xWeeks: { one: "1 week", other: "{{count}} weeks", }, aboutXMonths: { one: "about 1 month", other: "about {{count}} months", }, xMonths: { one: "1 month", other: "{{count}} months", }, aboutXYears: { one: "about 1 year", other: "about {{count}} years", }, xYears: { one: "1 year", other: "{{count}} years", }, overXYears: { one: "over 1 year", other: "over {{count}} years", }, almostXYears: { one: "almost 1 year", other: "almost {{count}} years", }, }; const formatDistance = (token, count, options) => { let result; const tokenValue = formatDistanceLocale[token]; if (typeof tokenValue === "string") { result = tokenValue; } else if (count === 1) { result = tokenValue.one; } else { result = tokenValue.other.replace("{{count}}", count.toString()); } if (options?.addSuffix) { if (options.comparison && options.comparison > 0) { return "in " + result; } else { return result + " ago"; } } return result; }; ;// ./node_modules/date-fns/locale/_lib/buildFormatLongFn.mjs function buildFormatLongFn(args) { return (options = {}) => { // TODO: Remove String() const width = options.width ? String(options.width) : args.defaultWidth; const format = args.formats[width] || args.formats[args.defaultWidth]; return format; }; } ;// ./node_modules/date-fns/locale/en-US/_lib/formatLong.mjs const dateFormats = { full: "EEEE, MMMM do, y", long: "MMMM do, y", medium: "MMM d, y", short: "MM/dd/yyyy", }; const timeFormats = { full: "h:mm:ss a zzzz", long: "h:mm:ss a z", medium: "h:mm:ss a", short: "h:mm a", }; const dateTimeFormats = { full: "{{date}} 'at' {{time}}", long: "{{date}} 'at' {{time}}", medium: "{{date}}, {{time}}", short: "{{date}}, {{time}}", }; const formatLong = { date: buildFormatLongFn({ formats: dateFormats, defaultWidth: "full", }), time: buildFormatLongFn({ formats: timeFormats, defaultWidth: "full", }), dateTime: buildFormatLongFn({ formats: dateTimeFormats, defaultWidth: "full", }), }; ;// ./node_modules/date-fns/locale/en-US/_lib/formatRelative.mjs const formatRelativeLocale = { lastWeek: "'last' eeee 'at' p", yesterday: "'yesterday at' p", today: "'today at' p", tomorrow: "'tomorrow at' p", nextWeek: "eeee 'at' p", other: "P", }; const formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token]; ;// ./node_modules/date-fns/locale/_lib/buildLocalizeFn.mjs /* eslint-disable no-unused-vars */ /** * The localize function argument callback which allows to convert raw value to * the actual type. * * @param value - The value to convert * * @returns The converted value */ /** * The map of localized values for each width. */ /** * The index type of the locale unit value. It types conversion of units of * values that don't start at 0 (i.e. quarters). */ /** * Converts the unit value to the tuple of values. */ /** * The tuple of localized era values. The first element represents BC, * the second element represents AD. */ /** * The tuple of localized quarter values. The first element represents Q1. */ /** * The tuple of localized day values. The first element represents Sunday. */ /** * The tuple of localized month values. The first element represents January. */ function buildLocalizeFn(args) { return (value, options) => { const context = options?.context ? String(options.context) : "standalone"; let valuesArray; if (context === "formatting" && args.formattingValues) { const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; const width = options?.width ? String(options.width) : defaultWidth; valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; } else { const defaultWidth = args.defaultWidth; const width = options?.width ? String(options.width) : args.defaultWidth; valuesArray = args.values[width] || args.values[defaultWidth]; } const index = args.argumentCallback ? args.argumentCallback(value) : value; // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it! return valuesArray[index]; }; } ;// ./node_modules/date-fns/locale/en-US/_lib/localize.mjs const eraValues = { narrow: ["B", "A"], abbreviated: ["BC", "AD"], wide: ["Before Christ", "Anno Domini"], }; const quarterValues = { narrow: ["1", "2", "3", "4"], abbreviated: ["Q1", "Q2", "Q3", "Q4"], wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"], }; // Note: in English, the names of days of the week and months are capitalized. // If you are making a new locale based on this one, check if the same is true for the language you're working on. // Generally, formatted dates should look like they are in the middle of a sentence, // e.g. in Spanish language the weekdays and months should be in the lowercase. const monthValues = { narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], abbreviated: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ], wide: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ], }; const dayValues = { narrow: ["S", "M", "T", "W", "T", "F", "S"], short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], wide: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", ], }; const dayPeriodValues = { narrow: { am: "a", pm: "p", midnight: "mi", noon: "n", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night", }, abbreviated: { am: "AM", pm: "PM", midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night", }, wide: { am: "a.m.", pm: "p.m.", midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night", }, }; const formattingDayPeriodValues = { narrow: { am: "a", pm: "p", midnight: "mi", noon: "n", morning: "in the morning", afternoon: "in the afternoon", evening: "in the evening", night: "at night", }, abbreviated: { am: "AM", pm: "PM", midnight: "midnight", noon: "noon", morning: "in the morning", afternoon: "in the afternoon", evening: "in the evening", night: "at night", }, wide: { am: "a.m.", pm: "p.m.", midnight: "midnight", noon: "noon", morning: "in the morning", afternoon: "in the afternoon", evening: "in the evening", night: "at night", }, }; const ordinalNumber = (dirtyNumber, _options) => { const number = Number(dirtyNumber); // If ordinal numbers depend on context, for example, // if they are different for different grammatical genders, // use `options.unit`. // // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear', // 'day', 'hour', 'minute', 'second'. const rem100 = number % 100; if (rem100 > 20 || rem100 < 10) { switch (rem100 % 10) { case 1: return number + "st"; case 2: return number + "nd"; case 3: return number + "rd"; } } return number + "th"; }; const localize = { ordinalNumber, era: buildLocalizeFn({ values: eraValues, defaultWidth: "wide", }), quarter: buildLocalizeFn({ values: quarterValues, defaultWidth: "wide", argumentCallback: (quarter) => quarter - 1, }), month: buildLocalizeFn({ values: monthValues, defaultWidth: "wide", }), day: buildLocalizeFn({ values: dayValues, defaultWidth: "wide", }), dayPeriod: buildLocalizeFn({ values: dayPeriodValues, defaultWidth: "wide", formattingValues: formattingDayPeriodValues, defaultFormattingWidth: "wide", }), }; ;// ./node_modules/date-fns/locale/_lib/buildMatchFn.mjs function buildMatchFn(args) { return (string, options = {}) => { const width = options.width; const matchPattern = (width && args.matchPatterns[width]) || args.matchPatterns[args.defaultMatchWidth]; const matchResult = string.match(matchPattern); if (!matchResult) { return null; } const matchedString = matchResult[0]; const parsePatterns = (width && args.parsePatterns[width]) || args.parsePatterns[args.defaultParseWidth]; const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type findKey(parsePatterns, (pattern) => pattern.test(matchedString)); let value; value = args.valueCallback ? args.valueCallback(key) : key; value = options.valueCallback ? // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type options.valueCallback(value) : value; const rest = string.slice(matchedString.length); return { value, rest }; }; } function findKey(object, predicate) { for (const key in object) { if ( Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key]) ) { return key; } } return undefined; } function findIndex(array, predicate) { for (let key = 0; key < array.length; key++) { if (predicate(array[key])) { return key; } } return undefined; } ;// ./node_modules/date-fns/locale/_lib/buildMatchPatternFn.mjs function buildMatchPatternFn(args) { return (string, options = {}) => { const matchResult = string.match(args.matchPattern); if (!matchResult) return null; const matchedString = matchResult[0]; const parseResult = string.match(args.parsePattern); if (!parseResult) return null; let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type value = options.valueCallback ? options.valueCallback(value) : value; const rest = string.slice(matchedString.length); return { value, rest }; }; } ;// ./node_modules/date-fns/locale/en-US/_lib/match.mjs const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; const parseOrdinalNumberPattern = /\d+/i; const matchEraPatterns = { narrow: /^(b|a)/i, abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, wide: /^(before christ|before common era|anno domini|common era)/i, }; const parseEraPatterns = { any: [/^b/i, /^(a|c)/i], }; const matchQuarterPatterns = { narrow: /^[1234]/i, abbreviated: /^q[1234]/i, wide: /^[1234](th|st|nd|rd)? quarter/i, }; const parseQuarterPatterns = { any: [/1/i, /2/i, /3/i, /4/i], }; const matchMonthPatterns = { narrow: /^[jfmasond]/i, abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i, }; const parseMonthPatterns = { narrow: [ /^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i, ], any: [ /^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i, ], }; const matchDayPatterns = { narrow: /^[smtwf]/i, short: /^(su|mo|tu|we|th|fr|sa)/i, abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i, }; const parseDayPatterns = { narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i], }; const matchDayPeriodPatterns = { narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i, }; const parseDayPeriodPatterns = { any: { am: /^a/i, pm: /^p/i, midnight: /^mi/i, noon: /^no/i, morning: /morning/i, afternoon: /afternoon/i, evening: /evening/i, night: /night/i, }, }; const match_match = { ordinalNumber: buildMatchPatternFn({ matchPattern: matchOrdinalNumberPattern, parsePattern: parseOrdinalNumberPattern, valueCallback: (value) => parseInt(value, 10), }), era: buildMatchFn({ matchPatterns: matchEraPatterns, defaultMatchWidth: "wide", parsePatterns: parseEraPatterns, defaultParseWidth: "any", }), quarter: buildMatchFn({ matchPatterns: matchQuarterPatterns, defaultMatchWidth: "wide", parsePatterns: parseQuarterPatterns, defaultParseWidth: "any", valueCallback: (index) => index + 1, }), month: buildMatchFn({ matchPatterns: matchMonthPatterns, defaultMatchWidth: "wide", parsePatterns: parseMonthPatterns, defaultParseWidth: "any", }), day: buildMatchFn({ matchPatterns: matchDayPatterns, defaultMatchWidth: "wide", parsePatterns: parseDayPatterns, defaultParseWidth: "any", }), dayPeriod: buildMatchFn({ matchPatterns: matchDayPeriodPatterns, defaultMatchWidth: "any", parsePatterns: parseDayPeriodPatterns, defaultParseWidth: "any", }), }; ;// ./node_modules/date-fns/locale/en-US.mjs /** * @category Locales * @summary English locale (United States). * @language English * @iso-639-2 eng * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp) * @author Lesha Koss [@leshakoss](https://github.com/leshakoss) */ const enUS = { code: "en-US", formatDistance: formatDistance, formatLong: formatLong, formatRelative: formatRelative, localize: localize, match: match_match, options: { weekStartsOn: 0 /* Sunday */, firstWeekContainsDate: 1, }, }; // Fallback for modularized imports: /* harmony default export */ const en_US = ((/* unused pure expression or super */ null && (enUS))); ;// ./node_modules/date-fns/_lib/defaultOptions.mjs let defaultOptions_defaultOptions = {}; function getDefaultOptions() { return defaultOptions_defaultOptions; } function setDefaultOptions(newOptions) { defaultOptions_defaultOptions = newOptions; } ;// ./node_modules/date-fns/constants.mjs /** * @module constants * @summary Useful constants * @description * Collection of useful date constants. * * The constants could be imported from `date-fns/constants`: * * ```ts * import { maxTime, minTime } from "./constants/date-fns/constants"; * * function isAllowedTime(time) { * return time <= maxTime && time >= minTime; * } * ``` */ /** * @constant * @name daysInWeek * @summary Days in 1 week. */ const daysInWeek = 7; /** * @constant * @name daysInYear * @summary Days in 1 year. * * @description * How many days in a year. * * One years equals 365.2425 days according to the formula: * * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400. * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days */ const daysInYear = 365.2425; /** * @constant * @name maxTime * @summary Maximum allowed time. * * @example * import { maxTime } from "./constants/date-fns/constants"; * * const isValid = 8640000000000001 <= maxTime; * //=> false * * new Date(8640000000000001); * //=> Invalid Date */ const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000; /** * @constant * @name minTime * @summary Minimum allowed time. * * @example * import { minTime } from "./constants/date-fns/constants"; * * const isValid = -8640000000000001 >= minTime; * //=> false * * new Date(-8640000000000001) * //=> Invalid Date */ const minTime = -maxTime; /** * @constant * @name millisecondsInWeek * @summary Milliseconds in 1 week. */ const millisecondsInWeek = 604800000; /** * @constant * @name millisecondsInDay * @summary Milliseconds in 1 day. */ const millisecondsInDay = 86400000; /** * @constant * @name millisecondsInMinute * @summary Milliseconds in 1 minute */ const millisecondsInMinute = 60000; /** * @constant * @name millisecondsInHour * @summary Milliseconds in 1 hour */ const millisecondsInHour = 3600000; /** * @constant * @name millisecondsInSecond * @summary Milliseconds in 1 second */ const millisecondsInSecond = 1000; /** * @constant * @name minutesInYear * @summary Minutes in 1 year. */ const minutesInYear = 525600; /** * @constant * @name minutesInMonth * @summary Minutes in 1 month. */ const minutesInMonth = 43200; /** * @constant * @name minutesInDay * @summary Minutes in 1 day. */ const minutesInDay = 1440; /** * @constant * @name minutesInHour * @summary Minutes in 1 hour. */ const minutesInHour = 60; /** * @constant * @name monthsInQuarter * @summary Months in 1 quarter. */ const monthsInQuarter = 3; /** * @constant * @name monthsInYear * @summary Months in 1 year. */ const monthsInYear = 12; /** * @constant * @name quartersInYear * @summary Quarters in 1 year */ const quartersInYear = 4; /** * @constant * @name secondsInHour * @summary Seconds in 1 hour. */ const secondsInHour = 3600; /** * @constant * @name secondsInMinute * @summary Seconds in 1 minute. */ const secondsInMinute = 60; /** * @constant * @name secondsInDay * @summary Seconds in 1 day. */ const secondsInDay = secondsInHour * 24; /** * @constant * @name secondsInWeek * @summary Seconds in 1 week. */ const secondsInWeek = secondsInDay * 7; /** * @constant * @name secondsInYear * @summary Seconds in 1 year. */ const secondsInYear = secondsInDay * daysInYear; /** * @constant * @name secondsInMonth * @summary Seconds in 1 month */ const secondsInMonth = secondsInYear / 12; /** * @constant * @name secondsInQuarter * @summary Seconds in 1 quarter. */ const secondsInQuarter = secondsInMonth * 3; ;// ./node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs /** * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds. * They usually appear for dates that denote time before the timezones were introduced * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891 * and GMT+01:00:00 after that date) * * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above, * which would lead to incorrect calculations. * * This function returns the timezone offset in milliseconds that takes seconds in account. */ function getTimezoneOffsetInMilliseconds(date) { const _date = toDate(date); const utcDate = new Date( Date.UTC( _date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds(), ), ); utcDate.setUTCFullYear(_date.getFullYear()); return +date - +utcDate; } ;// ./node_modules/date-fns/differenceInCalendarDays.mjs /** * @name differenceInCalendarDays * @category Day Helpers * @summary Get the number of calendar days between the given dates. * * @description * Get the number of calendar days between the given dates. This means that the times are removed * from the dates and then the difference in days is calculated. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param dateLeft - The later date * @param dateRight - The earlier date * * @returns The number of calendar days * * @example * // How many calendar days are between * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00? * const result = differenceInCalendarDays( * new Date(2012, 6, 2, 0, 0), * new Date(2011, 6, 2, 23, 0) * ) * //=> 366 * // How many calendar days are between * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00? * const result = differenceInCalendarDays( * new Date(2011, 6, 3, 0, 1), * new Date(2011, 6, 2, 23, 59) * ) * //=> 1 */ function differenceInCalendarDays(dateLeft, dateRight) { const startOfDayLeft = startOfDay(dateLeft); const startOfDayRight = startOfDay(dateRight); const timestampLeft = +startOfDayLeft - getTimezoneOffsetInMilliseconds(startOfDayLeft); const timestampRight = +startOfDayRight - getTimezoneOffsetInMilliseconds(startOfDayRight); // Round the number of days to the nearest integer because the number of // milliseconds in a day is not constant (e.g. it's different in the week of // the daylight saving time clock shift). return Math.round((timestampLeft - timestampRight) / millisecondsInDay); } // Fallback for modularized imports: /* harmony default export */ const date_fns_differenceInCalendarDays = ((/* unused pure expression or super */ null && (differenceInCalendarDays))); ;// ./node_modules/date-fns/startOfYear.mjs /** * @name startOfYear * @category Year Helpers * @summary Return the start of a year for the given date. * * @description * Return the start of a year for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * * @returns The start of a year * * @example * // The start of a year for 2 September 2014 11:55:00: * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00)) * //=> Wed Jan 01 2014 00:00:00 */ function startOfYear(date) { const cleanDate = toDate(date); const _date = constructFrom(date, 0); _date.setFullYear(cleanDate.getFullYear(), 0, 1); _date.setHours(0, 0, 0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfYear = ((/* unused pure expression or super */ null && (startOfYear))); ;// ./node_modules/date-fns/getDayOfYear.mjs /** * @name getDayOfYear * @category Day Helpers * @summary Get the day of the year of the given date. * * @description * Get the day of the year of the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The given date * * @returns The day of year * * @example * // Which day of the year is 2 July 2014? * const result = getDayOfYear(new Date(2014, 6, 2)) * //=> 183 */ function getDayOfYear(date) { const _date = toDate(date); const diff = differenceInCalendarDays(_date, startOfYear(_date)); const dayOfYear = diff + 1; return dayOfYear; } // Fallback for modularized imports: /* harmony default export */ const date_fns_getDayOfYear = ((/* unused pure expression or super */ null && (getDayOfYear))); ;// ./node_modules/date-fns/startOfWeek.mjs /** * The {@link startOfWeek} function options. */ /** * @name startOfWeek * @category Week Helpers * @summary Return the start of a week for the given date. * * @description * Return the start of a week for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * @param options - An object with options * * @returns The start of a week * * @example * // The start of a week for 2 September 2014 11:55:00: * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0)) * //=> Sun Aug 31 2014 00:00:00 * * @example * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00: * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 }) * //=> Mon Sep 01 2014 00:00:00 */ function startOfWeek(date, options) { const defaultOptions = getDefaultOptions(); const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; const _date = toDate(date); const day = _date.getDay(); const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; _date.setDate(_date.getDate() - diff); _date.setHours(0, 0, 0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfWeek = ((/* unused pure expression or super */ null && (startOfWeek))); ;// ./node_modules/date-fns/startOfISOWeek.mjs /** * @name startOfISOWeek * @category ISO Week Helpers * @summary Return the start of an ISO week for the given date. * * @description * Return the start of an ISO week for the given date. * The result will be in the local timezone. * * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * * @returns The start of an ISO week * * @example * // The start of an ISO week for 2 September 2014 11:55:00: * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0)) * //=> Mon Sep 01 2014 00:00:00 */ function startOfISOWeek(date) { return startOfWeek(date, { weekStartsOn: 1 }); } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfISOWeek = ((/* unused pure expression or super */ null && (startOfISOWeek))); ;// ./node_modules/date-fns/getISOWeekYear.mjs /** * @name getISOWeekYear * @category ISO Week-Numbering Year Helpers * @summary Get the ISO week-numbering year of the given date. * * @description * Get the ISO week-numbering year of the given date, * which always starts 3 days before the year's first Thursday. * * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The given date * * @returns The ISO week-numbering year * * @example * // Which ISO-week numbering year is 2 January 2005? * const result = getISOWeekYear(new Date(2005, 0, 2)) * //=> 2004 */ function getISOWeekYear(date) { const _date = toDate(date); const year = _date.getFullYear(); const fourthOfJanuaryOfNextYear = constructFrom(date, 0); fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); const fourthOfJanuaryOfThisYear = constructFrom(date, 0); fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); if (_date.getTime() >= startOfNextYear.getTime()) { return year + 1; } else if (_date.getTime() >= startOfThisYear.getTime()) { return year; } else { return year - 1; } } // Fallback for modularized imports: /* harmony default export */ const date_fns_getISOWeekYear = ((/* unused pure expression or super */ null && (getISOWeekYear))); ;// ./node_modules/date-fns/startOfISOWeekYear.mjs /** * @name startOfISOWeekYear * @category ISO Week-Numbering Year Helpers * @summary Return the start of an ISO week-numbering year for the given date. * * @description * Return the start of an ISO week-numbering year, * which always starts 3 days before the year's first Thursday. * The result will be in the local timezone. * * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * * @returns The start of an ISO week-numbering year * * @example * // The start of an ISO week-numbering year for 2 July 2005: * const result = startOfISOWeekYear(new Date(2005, 6, 2)) * //=> Mon Jan 03 2005 00:00:00 */ function startOfISOWeekYear(date) { const year = getISOWeekYear(date); const fourthOfJanuary = constructFrom(date, 0); fourthOfJanuary.setFullYear(year, 0, 4); fourthOfJanuary.setHours(0, 0, 0, 0); return startOfISOWeek(fourthOfJanuary); } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfISOWeekYear = ((/* unused pure expression or super */ null && (startOfISOWeekYear))); ;// ./node_modules/date-fns/getISOWeek.mjs /** * @name getISOWeek * @category ISO Week Helpers * @summary Get the ISO week of the given date. * * @description * Get the ISO week of the given date. * * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The given date * * @returns The ISO week * * @example * // Which week of the ISO-week numbering year is 2 January 2005? * const result = getISOWeek(new Date(2005, 0, 2)) * //=> 53 */ function getISOWeek(date) { const _date = toDate(date); const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date); // Round the number of weeks to the nearest integer because the number of // milliseconds in a week is not constant (e.g. it's different in the week of // the daylight saving time clock shift). return Math.round(diff / millisecondsInWeek) + 1; } // Fallback for modularized imports: /* harmony default export */ const date_fns_getISOWeek = ((/* unused pure expression or super */ null && (getISOWeek))); ;// ./node_modules/date-fns/getWeekYear.mjs /** * The {@link getWeekYear} function options. */ /** * @name getWeekYear * @category Week-Numbering Year Helpers * @summary Get the local week-numbering year of the given date. * * @description * Get the local week-numbering year of the given date. * The exact calculation depends on the values of * `options.weekStartsOn` (which is the index of the first day of the week) * and `options.firstWeekContainsDate` (which is the day of January, which is always in * the first week of the week-numbering year) * * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The given date * @param options - An object with options. * * @returns The local week-numbering year * * @example * // Which week numbering year is 26 December 2004 with the default settings? * const result = getWeekYear(new Date(2004, 11, 26)) * //=> 2005 * * @example * // Which week numbering year is 26 December 2004 if week starts on Saturday? * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 }) * //=> 2004 * * @example * // Which week numbering year is 26 December 2004 if the first week contains 4 January? * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 }) * //=> 2004 */ function getWeekYear(date, options) { const _date = toDate(date); const year = _date.getFullYear(); const defaultOptions = getDefaultOptions(); const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; const firstWeekOfNextYear = constructFrom(date, 0); firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); firstWeekOfNextYear.setHours(0, 0, 0, 0); const startOfNextYear = startOfWeek(firstWeekOfNextYear, options); const firstWeekOfThisYear = constructFrom(date, 0); firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); firstWeekOfThisYear.setHours(0, 0, 0, 0); const startOfThisYear = startOfWeek(firstWeekOfThisYear, options); if (_date.getTime() >= startOfNextYear.getTime()) { return year + 1; } else if (_date.getTime() >= startOfThisYear.getTime()) { return year; } else { return year - 1; } } // Fallback for modularized imports: /* harmony default export */ const date_fns_getWeekYear = ((/* unused pure expression or super */ null && (getWeekYear))); ;// ./node_modules/date-fns/startOfWeekYear.mjs /** * The {@link startOfWeekYear} function options. */ /** * @name startOfWeekYear * @category Week-Numbering Year Helpers * @summary Return the start of a local week-numbering year for the given date. * * @description * Return the start of a local week-numbering year. * The exact calculation depends on the values of * `options.weekStartsOn` (which is the index of the first day of the week) * and `options.firstWeekContainsDate` (which is the day of January, which is always in * the first week of the week-numbering year) * * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * @param options - An object with options * * @returns The start of a week-numbering year * * @example * // The start of an a week-numbering year for 2 July 2005 with default settings: * const result = startOfWeekYear(new Date(2005, 6, 2)) * //=> Sun Dec 26 2004 00:00:00 * * @example * // The start of a week-numbering year for 2 July 2005 * // if Monday is the first day of week * // and 4 January is always in the first week of the year: * const result = startOfWeekYear(new Date(2005, 6, 2), { * weekStartsOn: 1, * firstWeekContainsDate: 4 * }) * //=> Mon Jan 03 2005 00:00:00 */ function startOfWeekYear(date, options) { const defaultOptions = getDefaultOptions(); const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; const year = getWeekYear(date, options); const firstWeek = constructFrom(date, 0); firstWeek.setFullYear(year, 0, firstWeekContainsDate); firstWeek.setHours(0, 0, 0, 0); const _date = startOfWeek(firstWeek, options); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfWeekYear = ((/* unused pure expression or super */ null && (startOfWeekYear))); ;// ./node_modules/date-fns/getWeek.mjs /** * The {@link getWeek} function options. */ /** * @name getWeek * @category Week Helpers * @summary Get the local week index of the given date. * * @description * Get the local week index of the given date. * The exact calculation depends on the values of * `options.weekStartsOn` (which is the index of the first day of the week) * and `options.firstWeekContainsDate` (which is the day of January, which is always in * the first week of the week-numbering year) * * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The given date * @param options - An object with options * * @returns The week * * @example * // Which week of the local week numbering year is 2 January 2005 with default options? * const result = getWeek(new Date(2005, 0, 2)) * //=> 2 * * @example * // Which week of the local week numbering year is 2 January 2005, * // if Monday is the first day of the week, * // and the first week of the year always contains 4 January? * const result = getWeek(new Date(2005, 0, 2), { * weekStartsOn: 1, * firstWeekContainsDate: 4 * }) * //=> 53 */ function getWeek(date, options) { const _date = toDate(date); const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options); // Round the number of weeks to the nearest integer because the number of // milliseconds in a week is not constant (e.g. it's different in the week of // the daylight saving time clock shift). return Math.round(diff / millisecondsInWeek) + 1; } // Fallback for modularized imports: /* harmony default export */ const date_fns_getWeek = ((/* unused pure expression or super */ null && (getWeek))); ;// ./node_modules/date-fns/_lib/addLeadingZeros.mjs function addLeadingZeros(number, targetLength) { const sign = number < 0 ? "-" : ""; const output = Math.abs(number).toString().padStart(targetLength, "0"); return sign + output; } ;// ./node_modules/date-fns/_lib/format/lightFormatters.mjs /* * | | Unit | | Unit | * |-----|--------------------------------|-----|--------------------------------| * | a | AM, PM | A* | | * | d | Day of month | D | | * | h | Hour [1-12] | H | Hour [0-23] | * | m | Minute | M | Month | * | s | Second | S | Fraction of second | * | y | Year (abs) | Y | | * * Letters marked by * are not implemented but reserved by Unicode standard. */ const lightFormatters = { // Year y(date, token) { // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens // | Year | y | yy | yyy | yyyy | yyyyy | // |----------|-------|----|-------|-------|-------| // | AD 1 | 1 | 01 | 001 | 0001 | 00001 | // | AD 12 | 12 | 12 | 012 | 0012 | 00012 | // | AD 123 | 123 | 23 | 123 | 0123 | 00123 | // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 | // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 | const signedYear = date.getFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript) const year = signedYear > 0 ? signedYear : 1 - signedYear; return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); }, // Month M(date, token) { const month = date.getMonth(); return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); }, // Day of the month d(date, token) { return addLeadingZeros(date.getDate(), token.length); }, // AM or PM a(date, token) { const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; switch (token) { case "a": case "aa": return dayPeriodEnumValue.toUpperCase(); case "aaa": return dayPeriodEnumValue; case "aaaaa": return dayPeriodEnumValue[0]; case "aaaa": default: return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; } }, // Hour [1-12] h(date, token) { return addLeadingZeros(date.getHours() % 12 || 12, token.length); }, // Hour [0-23] H(date, token) { return addLeadingZeros(date.getHours(), token.length); }, // Minute m(date, token) { return addLeadingZeros(date.getMinutes(), token.length); }, // Second s(date, token) { return addLeadingZeros(date.getSeconds(), token.length); }, // Fraction of second S(date, token) { const numberOfDigits = token.length; const milliseconds = date.getMilliseconds(); const fractionalSeconds = Math.trunc( milliseconds * Math.pow(10, numberOfDigits - 3), ); return addLeadingZeros(fractionalSeconds, token.length); }, }; ;// ./node_modules/date-fns/_lib/format/formatters.mjs const dayPeriodEnum = { am: "am", pm: "pm", midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night", }; /* * | | Unit | | Unit | * |-----|--------------------------------|-----|--------------------------------| * | a | AM, PM | A* | Milliseconds in day | * | b | AM, PM, noon, midnight | B | Flexible day period | * | c | Stand-alone local day of week | C* | Localized hour w/ day period | * | d | Day of month | D | Day of year | * | e | Local day of week | E | Day of week | * | f | | F* | Day of week in month | * | g* | Modified Julian day | G | Era | * | h | Hour [1-12] | H | Hour [0-23] | * | i! | ISO day of week | I! | ISO week of year | * | j* | Localized hour w/ day period | J* | Localized hour w/o day period | * | k | Hour [1-24] | K | Hour [0-11] | * | l* | (deprecated) | L | Stand-alone month | * | m | Minute | M | Month | * | n | | N | | * | o! | Ordinal number modifier | O | Timezone (GMT) | * | p! | Long localized time | P! | Long localized date | * | q | Stand-alone quarter | Q | Quarter | * | r* | Related Gregorian year | R! | ISO week-numbering year | * | s | Second | S | Fraction of second | * | t! | Seconds timestamp | T! | Milliseconds timestamp | * | u | Extended year | U* | Cyclic year | * | v* | Timezone (generic non-locat.) | V* | Timezone (location) | * | w | Local week of year | W* | Week of month | * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) | * | y | Year (abs) | Y | Local week-numbering year | * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) | * * Letters marked by * are not implemented but reserved by Unicode standard. * * Letters marked by ! are non-standard, but implemented by date-fns: * - `o` modifies the previous token to turn it into an ordinal (see `format` docs) * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days, * i.e. 7 for Sunday, 1 for Monday, etc. * - `I` is ISO week of year, as opposed to `w` which is local week of year. * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year. * `R` is supposed to be used in conjunction with `I` and `i` * for universal ISO week-numbering date, whereas * `Y` is supposed to be used in conjunction with `w` and `e` * for week-numbering date specific to the locale. * - `P` is long localized date format * - `p` is long localized time format */ const formatters = { // Era G: function (date, token, localize) { const era = date.getFullYear() > 0 ? 1 : 0; switch (token) { // AD, BC case "G": case "GG": case "GGG": return localize.era(era, { width: "abbreviated" }); // A, B case "GGGGG": return localize.era(era, { width: "narrow" }); // Anno Domini, Before Christ case "GGGG": default: return localize.era(era, { width: "wide" }); } }, // Year y: function (date, token, localize) { // Ordinal number if (token === "yo") { const signedYear = date.getFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript) const year = signedYear > 0 ? signedYear : 1 - signedYear; return localize.ordinalNumber(year, { unit: "year" }); } return lightFormatters.y(date, token); }, // Local week-numbering year Y: function (date, token, localize, options) { const signedWeekYear = getWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript) const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year if (token === "YY") { const twoDigitYear = weekYear % 100; return addLeadingZeros(twoDigitYear, 2); } // Ordinal number if (token === "Yo") { return localize.ordinalNumber(weekYear, { unit: "year" }); } // Padding return addLeadingZeros(weekYear, token.length); }, // ISO week-numbering year R: function (date, token) { const isoWeekYear = getISOWeekYear(date); // Padding return addLeadingZeros(isoWeekYear, token.length); }, // Extended year. This is a single number designating the year of this calendar system. // The main difference between `y` and `u` localizers are B.C. years: // | Year | `y` | `u` | // |------|-----|-----| // | AC 1 | 1 | 1 | // | BC 1 | 1 | 0 | // | BC 2 | 2 | -1 | // Also `yy` always returns the last two digits of a year, // while `uu` pads single digit years to 2 characters and returns other years unchanged. u: function (date, token) { const year = date.getFullYear(); return addLeadingZeros(year, token.length); }, // Quarter Q: function (date, token, localize) { const quarter = Math.ceil((date.getMonth() + 1) / 3); switch (token) { // 1, 2, 3, 4 case "Q": return String(quarter); // 01, 02, 03, 04 case "QQ": return addLeadingZeros(quarter, 2); // 1st, 2nd, 3rd, 4th case "Qo": return localize.ordinalNumber(quarter, { unit: "quarter" }); // Q1, Q2, Q3, Q4 case "QQQ": return localize.quarter(quarter, { width: "abbreviated", context: "formatting", }); // 1, 2, 3, 4 (narrow quarter; could be not numerical) case "QQQQQ": return localize.quarter(quarter, { width: "narrow", context: "formatting", }); // 1st quarter, 2nd quarter, ... case "QQQQ": default: return localize.quarter(quarter, { width: "wide", context: "formatting", }); } }, // Stand-alone quarter q: function (date, token, localize) { const quarter = Math.ceil((date.getMonth() + 1) / 3); switch (token) { // 1, 2, 3, 4 case "q": return String(quarter); // 01, 02, 03, 04 case "qq": return addLeadingZeros(quarter, 2); // 1st, 2nd, 3rd, 4th case "qo": return localize.ordinalNumber(quarter, { unit: "quarter" }); // Q1, Q2, Q3, Q4 case "qqq": return localize.quarter(quarter, { width: "abbreviated", context: "standalone", }); // 1, 2, 3, 4 (narrow quarter; could be not numerical) case "qqqqq": return localize.quarter(quarter, { width: "narrow", context: "standalone", }); // 1st quarter, 2nd quarter, ... case "qqqq": default: return localize.quarter(quarter, { width: "wide", context: "standalone", }); } }, // Month M: function (date, token, localize) { const month = date.getMonth(); switch (token) { case "M": case "MM": return lightFormatters.M(date, token); // 1st, 2nd, ..., 12th case "Mo": return localize.ordinalNumber(month + 1, { unit: "month" }); // Jan, Feb, ..., Dec case "MMM": return localize.month(month, { width: "abbreviated", context: "formatting", }); // J, F, ..., D case "MMMMM": return localize.month(month, { width: "narrow", context: "formatting", }); // January, February, ..., December case "MMMM": default: return localize.month(month, { width: "wide", context: "formatting" }); } }, // Stand-alone month L: function (date, token, localize) { const month = date.getMonth(); switch (token) { // 1, 2, ..., 12 case "L": return String(month + 1); // 01, 02, ..., 12 case "LL": return addLeadingZeros(month + 1, 2); // 1st, 2nd, ..., 12th case "Lo": return localize.ordinalNumber(month + 1, { unit: "month" }); // Jan, Feb, ..., Dec case "LLL": return localize.month(month, { width: "abbreviated", context: "standalone", }); // J, F, ..., D case "LLLLL": return localize.month(month, { width: "narrow", context: "standalone", }); // January, February, ..., December case "LLLL": default: return localize.month(month, { width: "wide", context: "standalone" }); } }, // Local week of year w: function (date, token, localize, options) { const week = getWeek(date, options); if (token === "wo") { return localize.ordinalNumber(week, { unit: "week" }); } return addLeadingZeros(week, token.length); }, // ISO week of year I: function (date, token, localize) { const isoWeek = getISOWeek(date); if (token === "Io") { return localize.ordinalNumber(isoWeek, { unit: "week" }); } return addLeadingZeros(isoWeek, token.length); }, // Day of the month d: function (date, token, localize) { if (token === "do") { return localize.ordinalNumber(date.getDate(), { unit: "date" }); } return lightFormatters.d(date, token); }, // Day of year D: function (date, token, localize) { const dayOfYear = getDayOfYear(date); if (token === "Do") { return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); } return addLeadingZeros(dayOfYear, token.length); }, // Day of week E: function (date, token, localize) { const dayOfWeek = date.getDay(); switch (token) { // Tue case "E": case "EE": case "EEE": return localize.day(dayOfWeek, { width: "abbreviated", context: "formatting", }); // T case "EEEEE": return localize.day(dayOfWeek, { width: "narrow", context: "formatting", }); // Tu case "EEEEEE": return localize.day(dayOfWeek, { width: "short", context: "formatting", }); // Tuesday case "EEEE": default: return localize.day(dayOfWeek, { width: "wide", context: "formatting", }); } }, // Local day of week e: function (date, token, localize, options) { const dayOfWeek = date.getDay(); const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; switch (token) { // Numerical value (Nth day of week with current locale or weekStartsOn) case "e": return String(localDayOfWeek); // Padded numerical value case "ee": return addLeadingZeros(localDayOfWeek, 2); // 1st, 2nd, ..., 7th case "eo": return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); case "eee": return localize.day(dayOfWeek, { width: "abbreviated", context: "formatting", }); // T case "eeeee": return localize.day(dayOfWeek, { width: "narrow", context: "formatting", }); // Tu case "eeeeee": return localize.day(dayOfWeek, { width: "short", context: "formatting", }); // Tuesday case "eeee": default: return localize.day(dayOfWeek, { width: "wide", context: "formatting", }); } }, // Stand-alone local day of week c: function (date, token, localize, options) { const dayOfWeek = date.getDay(); const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; switch (token) { // Numerical value (same as in `e`) case "c": return String(localDayOfWeek); // Padded numerical value case "cc": return addLeadingZeros(localDayOfWeek, token.length); // 1st, 2nd, ..., 7th case "co": return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); case "ccc": return localize.day(dayOfWeek, { width: "abbreviated", context: "standalone", }); // T case "ccccc": return localize.day(dayOfWeek, { width: "narrow", context: "standalone", }); // Tu case "cccccc": return localize.day(dayOfWeek, { width: "short", context: "standalone", }); // Tuesday case "cccc": default: return localize.day(dayOfWeek, { width: "wide", context: "standalone", }); } }, // ISO day of week i: function (date, token, localize) { const dayOfWeek = date.getDay(); const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; switch (token) { // 2 case "i": return String(isoDayOfWeek); // 02 case "ii": return addLeadingZeros(isoDayOfWeek, token.length); // 2nd case "io": return localize.ordinalNumber(isoDayOfWeek, { unit: "day" }); // Tue case "iii": return localize.day(dayOfWeek, { width: "abbreviated", context: "formatting", }); // T case "iiiii": return localize.day(dayOfWeek, { width: "narrow", context: "formatting", }); // Tu case "iiiiii": return localize.day(dayOfWeek, { width: "short", context: "formatting", }); // Tuesday case "iiii": default: return localize.day(dayOfWeek, { width: "wide", context: "formatting", }); } }, // AM or PM a: function (date, token, localize) { const hours = date.getHours(); const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; switch (token) { case "a": case "aa": return localize.dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }); case "aaa": return localize .dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }) .toLowerCase(); case "aaaaa": return localize.dayPeriod(dayPeriodEnumValue, { width: "narrow", context: "formatting", }); case "aaaa": default: return localize.dayPeriod(dayPeriodEnumValue, { width: "wide", context: "formatting", }); } }, // AM, PM, midnight, noon b: function (date, token, localize) { const hours = date.getHours(); let dayPeriodEnumValue; if (hours === 12) { dayPeriodEnumValue = dayPeriodEnum.noon; } else if (hours === 0) { dayPeriodEnumValue = dayPeriodEnum.midnight; } else { dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; } switch (token) { case "b": case "bb": return localize.dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }); case "bbb": return localize .dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }) .toLowerCase(); case "bbbbb": return localize.dayPeriod(dayPeriodEnumValue, { width: "narrow", context: "formatting", }); case "bbbb": default: return localize.dayPeriod(dayPeriodEnumValue, { width: "wide", context: "formatting", }); } }, // in the morning, in the afternoon, in the evening, at night B: function (date, token, localize) { const hours = date.getHours(); let dayPeriodEnumValue; if (hours >= 17) { dayPeriodEnumValue = dayPeriodEnum.evening; } else if (hours >= 12) { dayPeriodEnumValue = dayPeriodEnum.afternoon; } else if (hours >= 4) { dayPeriodEnumValue = dayPeriodEnum.morning; } else { dayPeriodEnumValue = dayPeriodEnum.night; } switch (token) { case "B": case "BB": case "BBB": return localize.dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }); case "BBBBB": return localize.dayPeriod(dayPeriodEnumValue, { width: "narrow", context: "formatting", }); case "BBBB": default: return localize.dayPeriod(dayPeriodEnumValue, { width: "wide", context: "formatting", }); } }, // Hour [1-12] h: function (date, token, localize) { if (token === "ho") { let hours = date.getHours() % 12; if (hours === 0) hours = 12; return localize.ordinalNumber(hours, { unit: "hour" }); } return lightFormatters.h(date, token); }, // Hour [0-23] H: function (date, token, localize) { if (token === "Ho") { return localize.ordinalNumber(date.getHours(), { unit: "hour" }); } return lightFormatters.H(date, token); }, // Hour [0-11] K: function (date, token, localize) { const hours = date.getHours() % 12; if (token === "Ko") { return localize.ordinalNumber(hours, { unit: "hour" }); } return addLeadingZeros(hours, token.length); }, // Hour [1-24] k: function (date, token, localize) { let hours = date.getHours(); if (hours === 0) hours = 24; if (token === "ko") { return localize.ordinalNumber(hours, { unit: "hour" }); } return addLeadingZeros(hours, token.length); }, // Minute m: function (date, token, localize) { if (token === "mo") { return localize.ordinalNumber(date.getMinutes(), { unit: "minute" }); } return lightFormatters.m(date, token); }, // Second s: function (date, token, localize) { if (token === "so") { return localize.ordinalNumber(date.getSeconds(), { unit: "second" }); } return lightFormatters.s(date, token); }, // Fraction of second S: function (date, token) { return lightFormatters.S(date, token); }, // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) X: function (date, token, _localize) { const timezoneOffset = date.getTimezoneOffset(); if (timezoneOffset === 0) { return "Z"; } switch (token) { // Hours and optional minutes case "X": return formatTimezoneWithOptionalMinutes(timezoneOffset); // Hours, minutes and optional seconds without `:` delimiter // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets // so this token always has the same output as `XX` case "XXXX": case "XX": // Hours and minutes without `:` delimiter return formatTimezone(timezoneOffset); // Hours, minutes and optional seconds with `:` delimiter // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets // so this token always has the same output as `XXX` case "XXXXX": case "XXX": // Hours and minutes with `:` delimiter default: return formatTimezone(timezoneOffset, ":"); } }, // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) x: function (date, token, _localize) { const timezoneOffset = date.getTimezoneOffset(); switch (token) { // Hours and optional minutes case "x": return formatTimezoneWithOptionalMinutes(timezoneOffset); // Hours, minutes and optional seconds without `:` delimiter // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets // so this token always has the same output as `xx` case "xxxx": case "xx": // Hours and minutes without `:` delimiter return formatTimezone(timezoneOffset); // Hours, minutes and optional seconds with `:` delimiter // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets // so this token always has the same output as `xxx` case "xxxxx": case "xxx": // Hours and minutes with `:` delimiter default: return formatTimezone(timezoneOffset, ":"); } }, // Timezone (GMT) O: function (date, token, _localize) { const timezoneOffset = date.getTimezoneOffset(); switch (token) { // Short case "O": case "OO": case "OOO": return "GMT" + formatTimezoneShort(timezoneOffset, ":"); // Long case "OOOO": default: return "GMT" + formatTimezone(timezoneOffset, ":"); } }, // Timezone (specific non-location) z: function (date, token, _localize) { const timezoneOffset = date.getTimezoneOffset(); switch (token) { // Short case "z": case "zz": case "zzz": return "GMT" + formatTimezoneShort(timezoneOffset, ":"); // Long case "zzzz": default: return "GMT" + formatTimezone(timezoneOffset, ":"); } }, // Seconds timestamp t: function (date, token, _localize) { const timestamp = Math.trunc(date.getTime() / 1000); return addLeadingZeros(timestamp, token.length); }, // Milliseconds timestamp T: function (date, token, _localize) { const timestamp = date.getTime(); return addLeadingZeros(timestamp, token.length); }, }; function formatTimezoneShort(offset, delimiter = "") { const sign = offset > 0 ? "-" : "+"; const absOffset = Math.abs(offset); const hours = Math.trunc(absOffset / 60); const minutes = absOffset % 60; if (minutes === 0) { return sign + String(hours); } return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); } function formatTimezoneWithOptionalMinutes(offset, delimiter) { if (offset % 60 === 0) { const sign = offset > 0 ? "-" : "+"; return sign + addLeadingZeros(Math.abs(offset) / 60, 2); } return formatTimezone(offset, delimiter); } function formatTimezone(offset, delimiter = "") { const sign = offset > 0 ? "-" : "+"; const absOffset = Math.abs(offset); const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2); const minutes = addLeadingZeros(absOffset % 60, 2); return sign + hours + delimiter + minutes; } ;// ./node_modules/date-fns/_lib/format/longFormatters.mjs const dateLongFormatter = (pattern, formatLong) => { switch (pattern) { case "P": return formatLong.date({ width: "short" }); case "PP": return formatLong.date({ width: "medium" }); case "PPP": return formatLong.date({ width: "long" }); case "PPPP": default: return formatLong.date({ width: "full" }); } }; const timeLongFormatter = (pattern, formatLong) => { switch (pattern) { case "p": return formatLong.time({ width: "short" }); case "pp": return formatLong.time({ width: "medium" }); case "ppp": return formatLong.time({ width: "long" }); case "pppp": default: return formatLong.time({ width: "full" }); } }; const dateTimeLongFormatter = (pattern, formatLong) => { const matchResult = pattern.match(/(P+)(p+)?/) || []; const datePattern = matchResult[1]; const timePattern = matchResult[2]; if (!timePattern) { return dateLongFormatter(pattern, formatLong); } let dateTimeFormat; switch (datePattern) { case "P": dateTimeFormat = formatLong.dateTime({ width: "short" }); break; case "PP": dateTimeFormat = formatLong.dateTime({ width: "medium" }); break; case "PPP": dateTimeFormat = formatLong.dateTime({ width: "long" }); break; case "PPPP": default: dateTimeFormat = formatLong.dateTime({ width: "full" }); break; } return dateTimeFormat .replace("{{date}}", dateLongFormatter(datePattern, formatLong)) .replace("{{time}}", timeLongFormatter(timePattern, formatLong)); }; const longFormatters = { p: timeLongFormatter, P: dateTimeLongFormatter, }; ;// ./node_modules/date-fns/_lib/protectedTokens.mjs const dayOfYearTokenRE = /^D+$/; const weekYearTokenRE = /^Y+$/; const throwTokens = ["D", "DD", "YY", "YYYY"]; function isProtectedDayOfYearToken(token) { return dayOfYearTokenRE.test(token); } function isProtectedWeekYearToken(token) { return weekYearTokenRE.test(token); } function warnOrThrowProtectedError(token, format, input) { const _message = message(token, format, input); console.warn(_message); if (throwTokens.includes(token)) throw new RangeError(_message); } function message(token, format, input) { const subject = token[0] === "Y" ? "years" : "days of the month"; return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`; } ;// ./node_modules/date-fns/isDate.mjs /** * @name isDate * @category Common Helpers * @summary Is the given value a date? * * @description * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes. * * @param value - The value to check * * @returns True if the given value is a date * * @example * // For a valid date: * const result = isDate(new Date()) * //=> true * * @example * // For an invalid date: * const result = isDate(new Date(NaN)) * //=> true * * @example * // For some value: * const result = isDate('2014-02-31') * //=> false * * @example * // For an object: * const result = isDate({}) * //=> false */ function isDate(value) { return ( value instanceof Date || (typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]") ); } // Fallback for modularized imports: /* harmony default export */ const date_fns_isDate = ((/* unused pure expression or super */ null && (isDate))); ;// ./node_modules/date-fns/isValid.mjs /** * @name isValid * @category Common Helpers * @summary Is the given date valid? * * @description * Returns false if argument is Invalid Date and true otherwise. * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate) * Invalid Date is a Date, whose time value is NaN. * * Time value of Date: http://es5.github.io/#x15.9.1.1 * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to check * * @returns The date is valid * * @example * // For the valid date: * const result = isValid(new Date(2014, 1, 31)) * //=> true * * @example * // For the value, convertable into a date: * const result = isValid(1393804800000) * //=> true * * @example * // For the invalid date: * const result = isValid(new Date('')) * //=> false */ function isValid(date) { if (!isDate(date) && typeof date !== "number") { return false; } const _date = toDate(date); return !isNaN(Number(_date)); } // Fallback for modularized imports: /* harmony default export */ const date_fns_isValid = ((/* unused pure expression or super */ null && (isValid))); ;// ./node_modules/date-fns/format.mjs // Rexports of internal for libraries to use. // See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874 // This RegExp consists of three parts separated by `|`: // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token // (one of the certain letters followed by `o`) // - (\w)\1* matches any sequences of the same letter // - '' matches two quote characters in a row // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('), // except a single quote symbol, which ends the sequence. // Two quote characters do not end the sequence. // If there is no matching single quote // then the sequence will continue until the end of the string. // - . matches any single character unmatched by previous parts of the RegExps const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also // sequences of symbols P, p, and the combinations like `PPPPPPPppppp` const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; const escapedStringRegExp = /^'([^]*?)'?$/; const doubleQuoteRegExp = /''/g; const unescapedLatinCharacterRegExp = /[a-zA-Z]/; /** * The {@link format} function options. */ /** * @name format * @alias formatDate * @category Common Helpers * @summary Format the date. * * @description * Return the formatted date string in the given format. The result may vary by locale. * * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries. * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * * The characters wrapped between two single quotes characters (') are escaped. * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote. * (see the last example) * * Format of the string is based on Unicode Technical Standard #35: * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table * with a few additions (see note 7 below the table). * * Accepted patterns: * | Unit | Pattern | Result examples | Notes | * |---------------------------------|---------|-----------------------------------|-------| * | Era | G..GGG | AD, BC | | * | | GGGG | Anno Domini, Before Christ | 2 | * | | GGGGG | A, B | | * | Calendar year | y | 44, 1, 1900, 2017 | 5 | * | | yo | 44th, 1st, 0th, 17th | 5,7 | * | | yy | 44, 01, 00, 17 | 5 | * | | yyy | 044, 001, 1900, 2017 | 5 | * | | yyyy | 0044, 0001, 1900, 2017 | 5 | * | | yyyyy | ... | 3,5 | * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 | * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 | * | | YY | 44, 01, 00, 17 | 5,8 | * | | YYY | 044, 001, 1900, 2017 | 5 | * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 | * | | YYYYY | ... | 3,5 | * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 | * | | RR | -43, 00, 01, 1900, 2017 | 5,7 | * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 | * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 | * | | RRRRR | ... | 3,5,7 | * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 | * | | uu | -43, 01, 1900, 2017 | 5 | * | | uuu | -043, 001, 1900, 2017 | 5 | * | | uuuu | -0043, 0001, 1900, 2017 | 5 | * | | uuuuu | ... | 3,5 | * | Quarter (formatting) | Q | 1, 2, 3, 4 | | * | | Qo | 1st, 2nd, 3rd, 4th | 7 | * | | QQ | 01, 02, 03, 04 | | * | | QQQ | Q1, Q2, Q3, Q4 | | * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 | * | | QQQQQ | 1, 2, 3, 4 | 4 | * | Quarter (stand-alone) | q | 1, 2, 3, 4 | | * | | qo | 1st, 2nd, 3rd, 4th | 7 | * | | qq | 01, 02, 03, 04 | | * | | qqq | Q1, Q2, Q3, Q4 | | * | | qqqq | 1st quarter, 2nd quarter, ... | 2 | * | | qqqqq | 1, 2, 3, 4 | 4 | * | Month (formatting) | M | 1, 2, ..., 12 | | * | | Mo | 1st, 2nd, ..., 12th | 7 | * | | MM | 01, 02, ..., 12 | | * | | MMM | Jan, Feb, ..., Dec | | * | | MMMM | January, February, ..., December | 2 | * | | MMMMM | J, F, ..., D | | * | Month (stand-alone) | L | 1, 2, ..., 12 | | * | | Lo | 1st, 2nd, ..., 12th | 7 | * | | LL | 01, 02, ..., 12 | | * | | LLL | Jan, Feb, ..., Dec | | * | | LLLL | January, February, ..., December | 2 | * | | LLLLL | J, F, ..., D | | * | Local week of year | w | 1, 2, ..., 53 | | * | | wo | 1st, 2nd, ..., 53th | 7 | * | | ww | 01, 02, ..., 53 | | * | ISO week of year | I | 1, 2, ..., 53 | 7 | * | | Io | 1st, 2nd, ..., 53th | 7 | * | | II | 01, 02, ..., 53 | 7 | * | Day of month | d | 1, 2, ..., 31 | | * | | do | 1st, 2nd, ..., 31st | 7 | * | | dd | 01, 02, ..., 31 | | * | Day of year | D | 1, 2, ..., 365, 366 | 9 | * | | Do | 1st, 2nd, ..., 365th, 366th | 7 | * | | DD | 01, 02, ..., 365, 366 | 9 | * | | DDD | 001, 002, ..., 365, 366 | | * | | DDDD | ... | 3 | * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | | * | | EEEE | Monday, Tuesday, ..., Sunday | 2 | * | | EEEEE | M, T, W, T, F, S, S | | * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | | * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 | * | | io | 1st, 2nd, ..., 7th | 7 | * | | ii | 01, 02, ..., 07 | 7 | * | | iii | Mon, Tue, Wed, ..., Sun | 7 | * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 | * | | iiiii | M, T, W, T, F, S, S | 7 | * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 | * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | | * | | eo | 2nd, 3rd, ..., 1st | 7 | * | | ee | 02, 03, ..., 01 | | * | | eee | Mon, Tue, Wed, ..., Sun | | * | | eeee | Monday, Tuesday, ..., Sunday | 2 | * | | eeeee | M, T, W, T, F, S, S | | * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | | * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | | * | | co | 2nd, 3rd, ..., 1st | 7 | * | | cc | 02, 03, ..., 01 | | * | | ccc | Mon, Tue, Wed, ..., Sun | | * | | cccc | Monday, Tuesday, ..., Sunday | 2 | * | | ccccc | M, T, W, T, F, S, S | | * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | | * | AM, PM | a..aa | AM, PM | | * | | aaa | am, pm | | * | | aaaa | a.m., p.m. | 2 | * | | aaaaa | a, p | | * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | | * | | bbb | am, pm, noon, midnight | | * | | bbbb | a.m., p.m., noon, midnight | 2 | * | | bbbbb | a, p, n, mi | | * | Flexible day period | B..BBB | at night, in the morning, ... | | * | | BBBB | at night, in the morning, ... | 2 | * | | BBBBB | at night, in the morning, ... | | * | Hour [1-12] | h | 1, 2, ..., 11, 12 | | * | | ho | 1st, 2nd, ..., 11th, 12th | 7 | * | | hh | 01, 02, ..., 11, 12 | | * | Hour [0-23] | H | 0, 1, 2, ..., 23 | | * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 | * | | HH | 00, 01, 02, ..., 23 | | * | Hour [0-11] | K | 1, 2, ..., 11, 0 | | * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 | * | | KK | 01, 02, ..., 11, 00 | | * | Hour [1-24] | k | 24, 1, 2, ..., 23 | | * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 | * | | kk | 24, 01, 02, ..., 23 | | * | Minute | m | 0, 1, ..., 59 | | * | | mo | 0th, 1st, ..., 59th | 7 | * | | mm | 00, 01, ..., 59 | | * | Second | s | 0, 1, ..., 59 | | * | | so | 0th, 1st, ..., 59th | 7 | * | | ss | 00, 01, ..., 59 | | * | Fraction of second | S | 0, 1, ..., 9 | | * | | SS | 00, 01, ..., 99 | | * | | SSS | 000, 001, ..., 999 | | * | | SSSS | ... | 3 | * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | | * | | XX | -0800, +0530, Z | | * | | XXX | -08:00, +05:30, Z | | * | | XXXX | -0800, +0530, Z, +123456 | 2 | * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | | * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | | * | | xx | -0800, +0530, +0000 | | * | | xxx | -08:00, +05:30, +00:00 | 2 | * | | xxxx | -0800, +0530, +0000, +123456 | | * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | | * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | | * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 | * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 | * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 | * | Seconds timestamp | t | 512969520 | 7 | * | | tt | ... | 3,7 | * | Milliseconds timestamp | T | 512969520900 | 7 | * | | TT | ... | 3,7 | * | Long localized date | P | 04/29/1453 | 7 | * | | PP | Apr 29, 1453 | 7 | * | | PPP | April 29th, 1453 | 7 | * | | PPPP | Friday, April 29th, 1453 | 2,7 | * | Long localized time | p | 12:00 AM | 7 | * | | pp | 12:00:00 AM | 7 | * | | ppp | 12:00:00 AM GMT+2 | 7 | * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 | * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 | * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 | * | | PPPppp | April 29th, 1453 at ... | 7 | * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 | * Notes: * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale * are the same as "stand-alone" units, but are different in some languages. * "Formatting" units are declined according to the rules of the language * in the context of a date. "Stand-alone" units are always nominative singular: * * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'` * * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'` * * 2. Any sequence of the identical letters is a pattern, unless it is escaped by * the single quote characters (see below). * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`) * the output will be the same as default pattern for this unit, usually * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units * are marked with "2" in the last column of the table. * * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'` * * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'` * * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'` * * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'` * * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'` * * 3. Some patterns could be unlimited length (such as `yyyyyyyy`). * The output will be padded with zeros to match the length of the pattern. * * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'` * * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales. * These tokens represent the shortest form of the quarter. * * 5. The main difference between `y` and `u` patterns are B.C. years: * * | Year | `y` | `u` | * |------|-----|-----| * | AC 1 | 1 | 1 | * | BC 1 | 1 | 0 | * | BC 2 | 2 | -1 | * * Also `yy` always returns the last two digits of a year, * while `uu` pads single digit years to 2 characters and returns other years unchanged: * * | Year | `yy` | `uu` | * |------|------|------| * | 1 | 01 | 01 | * | 14 | 14 | 14 | * | 376 | 76 | 376 | * | 1453 | 53 | 1453 | * * The same difference is true for local and ISO week-numbering years (`Y` and `R`), * except local week-numbering years are dependent on `options.weekStartsOn` * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear) * and [getWeekYear](https://date-fns.org/docs/getWeekYear)). * * 6. Specific non-location timezones are currently unavailable in `date-fns`, * so right now these tokens fall back to GMT timezones. * * 7. These patterns are not in the Unicode Technical Standard #35: * - `i`: ISO day of week * - `I`: ISO week of year * - `R`: ISO week-numbering year * - `t`: seconds timestamp * - `T`: milliseconds timestamp * - `o`: ordinal number modifier * - `P`: long localized date * - `p`: long localized time * * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years. * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month. * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * @param format - The string of tokens * @param options - An object with options * * @returns The formatted date string * * @throws `date` must not be Invalid Date * @throws `options.locale` must contain `localize` property * @throws `options.locale` must contain `formatLong` property * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * @throws format string contains an unescaped latin alphabet character * * @example * // Represent 11 February 2014 in middle-endian format: * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy') * //=> '02/11/2014' * * @example * // Represent 2 July 2014 in Esperanto: * import { eoLocale } from 'date-fns/locale/eo' * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", { * locale: eoLocale * }) * //=> '2-a de julio 2014' * * @example * // Escape string by single quote characters: * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'") * //=> "3 o'clock" */ function format(date, formatStr, options) { const defaultOptions = getDefaultOptions(); const locale = options?.locale ?? defaultOptions.locale ?? enUS; const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; const originalDate = toDate(date); if (!isValid(originalDate)) { throw new RangeError("Invalid time value"); } let parts = formatStr .match(longFormattingTokensRegExp) .map((substring) => { const firstCharacter = substring[0]; if (firstCharacter === "p" || firstCharacter === "P") { const longFormatter = longFormatters[firstCharacter]; return longFormatter(substring, locale.formatLong); } return substring; }) .join("") .match(formattingTokensRegExp) .map((substring) => { // Replace two single quote characters with one single quote character if (substring === "''") { return { isToken: false, value: "'" }; } const firstCharacter = substring[0]; if (firstCharacter === "'") { return { isToken: false, value: cleanEscapedString(substring) }; } if (formatters[firstCharacter]) { return { isToken: true, value: substring }; } if (firstCharacter.match(unescapedLatinCharacterRegExp)) { throw new RangeError( "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`", ); } return { isToken: false, value: substring }; }); // invoke localize preprocessor (only for french locales at the moment) if (locale.localize.preprocessor) { parts = locale.localize.preprocessor(originalDate, parts); } const formatterOptions = { firstWeekContainsDate, weekStartsOn, locale, }; return parts .map((part) => { if (!part.isToken) return part.value; const token = part.value; if ( (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) || (!options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) ) { warnOrThrowProtectedError(token, formatStr, String(date)); } const formatter = formatters[token[0]]; return formatter(originalDate, token, locale.localize, formatterOptions); }) .join(""); } function cleanEscapedString(input) { const matched = input.match(escapedStringRegExp); if (!matched) { return input; } return matched[1].replace(doubleQuoteRegExp, "'"); } // Fallback for modularized imports: /* harmony default export */ const date_fns_format = ((/* unused pure expression or super */ null && (format))); ;// ./node_modules/date-fns/isSameMonth.mjs /** * @name isSameMonth * @category Month Helpers * @summary Are the given dates in the same month (and year)? * * @description * Are the given dates in the same month (and year)? * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param dateLeft - The first date to check * @param dateRight - The second date to check * * @returns The dates are in the same month (and year) * * @example * // Are 2 September 2014 and 25 September 2014 in the same month? * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25)) * //=> true * * @example * // Are 2 September 2014 and 25 September 2015 in the same month? * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25)) * //=> false */ function isSameMonth(dateLeft, dateRight) { const _dateLeft = toDate(dateLeft); const _dateRight = toDate(dateRight); return ( _dateLeft.getFullYear() === _dateRight.getFullYear() && _dateLeft.getMonth() === _dateRight.getMonth() ); } // Fallback for modularized imports: /* harmony default export */ const date_fns_isSameMonth = ((/* unused pure expression or super */ null && (isSameMonth))); ;// ./node_modules/date-fns/isEqual.mjs /** * @name isEqual * @category Common Helpers * @summary Are the given dates equal? * * @description * Are the given dates equal? * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param dateLeft - The first date to compare * @param dateRight - The second date to compare * * @returns The dates are equal * * @example * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal? * const result = isEqual( * new Date(2014, 6, 2, 6, 30, 45, 0), * new Date(2014, 6, 2, 6, 30, 45, 500) * ) * //=> false */ function isEqual(leftDate, rightDate) { const _dateLeft = toDate(leftDate); const _dateRight = toDate(rightDate); return +_dateLeft === +_dateRight; } // Fallback for modularized imports: /* harmony default export */ const date_fns_isEqual = ((/* unused pure expression or super */ null && (isEqual))); ;// ./node_modules/date-fns/isSameDay.mjs /** * @name isSameDay * @category Day Helpers * @summary Are the given dates in the same day (and year and month)? * * @description * Are the given dates in the same day (and year and month)? * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param dateLeft - The first date to check * @param dateRight - The second date to check * @returns The dates are in the same day (and year and month) * * @example * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day? * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0)) * //=> true * * @example * // Are 4 September and 4 October in the same day? * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4)) * //=> false * * @example * // Are 4 September, 2014 and 4 September, 2015 in the same day? * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4)) * //=> false */ function isSameDay(dateLeft, dateRight) { const dateLeftStartOfDay = startOfDay(dateLeft); const dateRightStartOfDay = startOfDay(dateRight); return +dateLeftStartOfDay === +dateRightStartOfDay; } // Fallback for modularized imports: /* harmony default export */ const date_fns_isSameDay = ((/* unused pure expression or super */ null && (isSameDay))); ;// ./node_modules/date-fns/addDays.mjs /** * @name addDays * @category Day Helpers * @summary Add the specified number of days to the given date. * * @description * Add the specified number of days to the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param amount - The amount of days to be added. * * @returns The new date with the days added * * @example * // Add 10 days to 1 September 2014: * const result = addDays(new Date(2014, 8, 1), 10) * //=> Thu Sep 11 2014 00:00:00 */ function addDays(date, amount) { const _date = toDate(date); if (isNaN(amount)) return constructFrom(date, NaN); if (!amount) { // If 0 days, no-op to avoid changing times in the hour before end of DST return _date; } _date.setDate(_date.getDate() + amount); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_addDays = ((/* unused pure expression or super */ null && (addDays))); ;// ./node_modules/date-fns/addWeeks.mjs /** * @name addWeeks * @category Week Helpers * @summary Add the specified number of weeks to the given date. * * @description * Add the specified number of week to the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param amount - The amount of weeks to be added. * * @returns The new date with the weeks added * * @example * // Add 4 weeks to 1 September 2014: * const result = addWeeks(new Date(2014, 8, 1), 4) * //=> Mon Sep 29 2014 00:00:00 */ function addWeeks(date, amount) { const days = amount * 7; return addDays(date, days); } // Fallback for modularized imports: /* harmony default export */ const date_fns_addWeeks = ((/* unused pure expression or super */ null && (addWeeks))); ;// ./node_modules/date-fns/subWeeks.mjs /** * @name subWeeks * @category Week Helpers * @summary Subtract the specified number of weeks from the given date. * * @description * Subtract the specified number of weeks from the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param amount - The amount of weeks to be subtracted. * * @returns The new date with the weeks subtracted * * @example * // Subtract 4 weeks from 1 September 2014: * const result = subWeeks(new Date(2014, 8, 1), 4) * //=> Mon Aug 04 2014 00:00:00 */ function subWeeks(date, amount) { return addWeeks(date, -amount); } // Fallback for modularized imports: /* harmony default export */ const date_fns_subWeeks = ((/* unused pure expression or super */ null && (subWeeks))); ;// ./node_modules/date-fns/endOfWeek.mjs /** * The {@link endOfWeek} function options. */ /** * @name endOfWeek * @category Week Helpers * @summary Return the end of a week for the given date. * * @description * Return the end of a week for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * @param options - An object with options * * @returns The end of a week * * @example * // The end of a week for 2 September 2014 11:55:00: * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0)) * //=> Sat Sep 06 2014 23:59:59.999 * * @example * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00: * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 }) * //=> Sun Sep 07 2014 23:59:59.999 */ function endOfWeek(date, options) { const defaultOptions = getDefaultOptions(); const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; const _date = toDate(date); const day = _date.getDay(); const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); _date.setDate(_date.getDate() + diff); _date.setHours(23, 59, 59, 999); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_endOfWeek = ((/* unused pure expression or super */ null && (endOfWeek))); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js /** * WordPress dependencies */ const arrowRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); /* harmony default export */ const arrow_right = (arrowRight); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js /** * WordPress dependencies */ const arrowLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) }); /* harmony default export */ const arrow_left = (arrowLeft); ;// external ["wp","date"] const external_wp_date_namespaceObject = window["wp"]["date"]; ;// ./node_modules/date-fns/isAfter.mjs /** * @name isAfter * @category Common Helpers * @summary Is the first date after the second one? * * @description * Is the first date after the second one? * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date that should be after the other one to return true * @param dateToCompare - The date to compare with * * @returns The first date is after the second date * * @example * // Is 10 July 1989 after 11 February 1987? * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11)) * //=> true */ function isAfter(date, dateToCompare) { const _date = toDate(date); const _dateToCompare = toDate(dateToCompare); return _date.getTime() > _dateToCompare.getTime(); } // Fallback for modularized imports: /* harmony default export */ const date_fns_isAfter = ((/* unused pure expression or super */ null && (isAfter))); ;// ./node_modules/date-fns/isBefore.mjs /** * @name isBefore * @category Common Helpers * @summary Is the first date before the second one? * * @description * Is the first date before the second one? * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date that should be before the other one to return true * @param dateToCompare - The date to compare with * * @returns The first date is before the second date * * @example * // Is 10 July 1989 before 11 February 1987? * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11)) * //=> false */ function isBefore(date, dateToCompare) { const _date = toDate(date); const _dateToCompare = toDate(dateToCompare); return +_date < +_dateToCompare; } // Fallback for modularized imports: /* harmony default export */ const date_fns_isBefore = ((/* unused pure expression or super */ null && (isBefore))); ;// ./node_modules/date-fns/getDaysInMonth.mjs /** * @name getDaysInMonth * @category Month Helpers * @summary Get the number of days in a month of the given date. * * @description * Get the number of days in a month of the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The given date * * @returns The number of days in a month * * @example * // How many days are in February 2000? * const result = getDaysInMonth(new Date(2000, 1)) * //=> 29 */ function getDaysInMonth(date) { const _date = toDate(date); const year = _date.getFullYear(); const monthIndex = _date.getMonth(); const lastDayOfMonth = constructFrom(date, 0); lastDayOfMonth.setFullYear(year, monthIndex + 1, 0); lastDayOfMonth.setHours(0, 0, 0, 0); return lastDayOfMonth.getDate(); } // Fallback for modularized imports: /* harmony default export */ const date_fns_getDaysInMonth = ((/* unused pure expression or super */ null && (getDaysInMonth))); ;// ./node_modules/date-fns/setMonth.mjs /** * @name setMonth * @category Month Helpers * @summary Set the month to the given date. * * @description * Set the month to the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param month - The month index to set (0-11) * * @returns The new date with the month set * * @example * // Set February to 1 September 2014: * const result = setMonth(new Date(2014, 8, 1), 1) * //=> Sat Feb 01 2014 00:00:00 */ function setMonth(date, month) { const _date = toDate(date); const year = _date.getFullYear(); const day = _date.getDate(); const dateWithDesiredMonth = constructFrom(date, 0); dateWithDesiredMonth.setFullYear(year, month, 15); dateWithDesiredMonth.setHours(0, 0, 0, 0); const daysInMonth = getDaysInMonth(dateWithDesiredMonth); // Set the last day of the new month // if the original date was the last day of the longer month _date.setMonth(month, Math.min(day, daysInMonth)); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_setMonth = ((/* unused pure expression or super */ null && (setMonth))); ;// ./node_modules/date-fns/set.mjs /** * @name set * @category Common Helpers * @summary Set date values to a given date. * * @description * Set date values to a given date. * * Sets time values to date from object `values`. * A value is not set if it is undefined or null or doesn't exist in `values`. * * Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts * to use native `Date#setX` methods. If you use this function, you may not want to include the * other `setX` functions that date-fns provides if you are concerned about the bundle size. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param values - The date values to be set * * @returns The new date with options set * * @example * // Transform 1 September 2014 into 20 October 2015 in a single line: * const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 }) * //=> Tue Oct 20 2015 00:00:00 * * @example * // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00: * const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 }) * //=> Mon Sep 01 2014 12:23:45 */ function set(date, values) { let _date = toDate(date); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date if (isNaN(+_date)) { return constructFrom(date, NaN); } if (values.year != null) { _date.setFullYear(values.year); } if (values.month != null) { _date = setMonth(_date, values.month); } if (values.date != null) { _date.setDate(values.date); } if (values.hours != null) { _date.setHours(values.hours); } if (values.minutes != null) { _date.setMinutes(values.minutes); } if (values.seconds != null) { _date.setSeconds(values.seconds); } if (values.milliseconds != null) { _date.setMilliseconds(values.milliseconds); } return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_set = ((/* unused pure expression or super */ null && (set))); ;// ./node_modules/date-fns/startOfToday.mjs /** * @name startOfToday * @category Day Helpers * @summary Return the start of today. * @pure false * * @description * Return the start of today. * * @returns The start of today * * @example * // If today is 6 October 2014: * const result = startOfToday() * //=> Mon Oct 6 2014 00:00:00 */ function startOfToday() { return startOfDay(Date.now()); } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfToday = ((/* unused pure expression or super */ null && (startOfToday))); ;// ./node_modules/date-fns/setYear.mjs /** * @name setYear * @category Year Helpers * @summary Set the year to the given date. * * @description * Set the year to the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param year - The year of the new date * * @returns The new date with the year set * * @example * // Set year 2013 to 1 September 2014: * const result = setYear(new Date(2014, 8, 1), 2013) * //=> Sun Sep 01 2013 00:00:00 */ function setYear(date, year) { const _date = toDate(date); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date if (isNaN(+_date)) { return constructFrom(date, NaN); } _date.setFullYear(year); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_setYear = ((/* unused pure expression or super */ null && (setYear))); ;// ./node_modules/date-fns/addYears.mjs /** * @name addYears * @category Year Helpers * @summary Add the specified number of years to the given date. * * @description * Add the specified number of years to the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param amount - The amount of years to be added. * * @returns The new date with the years added * * @example * // Add 5 years to 1 September 2014: * const result = addYears(new Date(2014, 8, 1), 5) * //=> Sun Sep 01 2019 00:00:00 */ function addYears(date, amount) { return addMonths(date, amount * 12); } // Fallback for modularized imports: /* harmony default export */ const date_fns_addYears = ((/* unused pure expression or super */ null && (addYears))); ;// ./node_modules/date-fns/subYears.mjs /** * @name subYears * @category Year Helpers * @summary Subtract the specified number of years from the given date. * * @description * Subtract the specified number of years from the given date. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The date to be changed * @param amount - The amount of years to be subtracted. * * @returns The new date with the years subtracted * * @example * // Subtract 5 years from 1 September 2014: * const result = subYears(new Date(2014, 8, 1), 5) * //=> Tue Sep 01 2009 00:00:00 */ function subYears(date, amount) { return addYears(date, -amount); } // Fallback for modularized imports: /* harmony default export */ const date_fns_subYears = ((/* unused pure expression or super */ null && (subYears))); ;// ./node_modules/date-fns/eachDayOfInterval.mjs /** * The {@link eachDayOfInterval} function options. */ /** * @name eachDayOfInterval * @category Interval Helpers * @summary Return the array of dates within the specified time interval. * * @description * Return the array of dates within the specified time interval. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param interval - The interval. * @param options - An object with options. * * @returns The array with starts of days from the day of the interval start to the day of the interval end * * @example * // Each day between 6 October 2014 and 10 October 2014: * const result = eachDayOfInterval({ * start: new Date(2014, 9, 6), * end: new Date(2014, 9, 10) * }) * //=> [ * // Mon Oct 06 2014 00:00:00, * // Tue Oct 07 2014 00:00:00, * // Wed Oct 08 2014 00:00:00, * // Thu Oct 09 2014 00:00:00, * // Fri Oct 10 2014 00:00:00 * // ] */ function eachDayOfInterval(interval, options) { const startDate = toDate(interval.start); const endDate = toDate(interval.end); let reversed = +startDate > +endDate; const endTime = reversed ? +startDate : +endDate; const currentDate = reversed ? endDate : startDate; currentDate.setHours(0, 0, 0, 0); let step = options?.step ?? 1; if (!step) return []; if (step < 0) { step = -step; reversed = !reversed; } const dates = []; while (+currentDate <= endTime) { dates.push(toDate(currentDate)); currentDate.setDate(currentDate.getDate() + step); currentDate.setHours(0, 0, 0, 0); } return reversed ? dates.reverse() : dates; } // Fallback for modularized imports: /* harmony default export */ const date_fns_eachDayOfInterval = ((/* unused pure expression or super */ null && (eachDayOfInterval))); ;// ./node_modules/date-fns/eachMonthOfInterval.mjs /** * The {@link eachMonthOfInterval} function options. */ /** * @name eachMonthOfInterval * @category Interval Helpers * @summary Return the array of months within the specified time interval. * * @description * Return the array of months within the specified time interval. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param interval - The interval * * @returns The array with starts of months from the month of the interval start to the month of the interval end * * @example * // Each month between 6 February 2014 and 10 August 2014: * const result = eachMonthOfInterval({ * start: new Date(2014, 1, 6), * end: new Date(2014, 7, 10) * }) * //=> [ * // Sat Feb 01 2014 00:00:00, * // Sat Mar 01 2014 00:00:00, * // Tue Apr 01 2014 00:00:00, * // Thu May 01 2014 00:00:00, * // Sun Jun 01 2014 00:00:00, * // Tue Jul 01 2014 00:00:00, * // Fri Aug 01 2014 00:00:00 * // ] */ function eachMonthOfInterval(interval, options) { const startDate = toDate(interval.start); const endDate = toDate(interval.end); let reversed = +startDate > +endDate; const endTime = reversed ? +startDate : +endDate; const currentDate = reversed ? endDate : startDate; currentDate.setHours(0, 0, 0, 0); currentDate.setDate(1); let step = options?.step ?? 1; if (!step) return []; if (step < 0) { step = -step; reversed = !reversed; } const dates = []; while (+currentDate <= endTime) { dates.push(toDate(currentDate)); currentDate.setMonth(currentDate.getMonth() + step); } return reversed ? dates.reverse() : dates; } // Fallback for modularized imports: /* harmony default export */ const date_fns_eachMonthOfInterval = ((/* unused pure expression or super */ null && (eachMonthOfInterval))); ;// ./node_modules/date-fns/startOfMonth.mjs /** * @name startOfMonth * @category Month Helpers * @summary Return the start of a month for the given date. * * @description * Return the start of a month for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * * @returns The start of a month * * @example * // The start of a month for 2 September 2014 11:55:00: * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0)) * //=> Mon Sep 01 2014 00:00:00 */ function startOfMonth(date) { const _date = toDate(date); _date.setDate(1); _date.setHours(0, 0, 0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth))); ;// ./node_modules/date-fns/endOfMonth.mjs /** * @name endOfMonth * @category Month Helpers * @summary Return the end of a month for the given date. * * @description * Return the end of a month for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * * @returns The end of a month * * @example * // The end of a month for 2 September 2014 11:55:00: * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0)) * //=> Tue Sep 30 2014 23:59:59.999 */ function endOfMonth(date) { const _date = toDate(date); const month = _date.getMonth(); _date.setFullYear(_date.getFullYear(), month + 1, 0); _date.setHours(23, 59, 59, 999); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_endOfMonth = ((/* unused pure expression or super */ null && (endOfMonth))); ;// ./node_modules/date-fns/eachWeekOfInterval.mjs /** * The {@link eachWeekOfInterval} function options. */ /** * @name eachWeekOfInterval * @category Interval Helpers * @summary Return the array of weeks within the specified time interval. * * @description * Return the array of weeks within the specified time interval. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param interval - The interval. * @param options - An object with options. * * @returns The array with starts of weeks from the week of the interval start to the week of the interval end * * @example * // Each week within interval 6 October 2014 - 23 November 2014: * const result = eachWeekOfInterval({ * start: new Date(2014, 9, 6), * end: new Date(2014, 10, 23) * }) * //=> [ * // Sun Oct 05 2014 00:00:00, * // Sun Oct 12 2014 00:00:00, * // Sun Oct 19 2014 00:00:00, * // Sun Oct 26 2014 00:00:00, * // Sun Nov 02 2014 00:00:00, * // Sun Nov 09 2014 00:00:00, * // Sun Nov 16 2014 00:00:00, * // Sun Nov 23 2014 00:00:00 * // ] */ function eachWeekOfInterval(interval, options) { const startDate = toDate(interval.start); const endDate = toDate(interval.end); let reversed = +startDate > +endDate; const startDateWeek = reversed ? startOfWeek(endDate, options) : startOfWeek(startDate, options); const endDateWeek = reversed ? startOfWeek(startDate, options) : startOfWeek(endDate, options); // Some timezones switch DST at midnight, making start of day unreliable in these timezones, 3pm is a safe bet startDateWeek.setHours(15); endDateWeek.setHours(15); const endTime = +endDateWeek.getTime(); let currentDate = startDateWeek; let step = options?.step ?? 1; if (!step) return []; if (step < 0) { step = -step; reversed = !reversed; } const dates = []; while (+currentDate <= endTime) { currentDate.setHours(0); dates.push(toDate(currentDate)); currentDate = addWeeks(currentDate, step); currentDate.setHours(15); } return reversed ? dates.reverse() : dates; } // Fallback for modularized imports: /* harmony default export */ const date_fns_eachWeekOfInterval = ((/* unused pure expression or super */ null && (eachWeekOfInterval))); ;// ./node_modules/@wordpress/components/build-module/date-time/date/use-lilius/index.js /** * This source is a local copy of the use-lilius library, since the original * library is not actively maintained. * @see https://github.com/WordPress/gutenberg/discussions/64968 * * use-lilius@2.0.5 * https://github.com/Avarios/use-lilius * * The MIT License (MIT) * * Copyright (c) 2021-Present Danny Tatom * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * External dependencies */ /** * WordPress dependencies */ let Month = /*#__PURE__*/function (Month) { Month[Month["JANUARY"] = 0] = "JANUARY"; Month[Month["FEBRUARY"] = 1] = "FEBRUARY"; Month[Month["MARCH"] = 2] = "MARCH"; Month[Month["APRIL"] = 3] = "APRIL"; Month[Month["MAY"] = 4] = "MAY"; Month[Month["JUNE"] = 5] = "JUNE"; Month[Month["JULY"] = 6] = "JULY"; Month[Month["AUGUST"] = 7] = "AUGUST"; Month[Month["SEPTEMBER"] = 8] = "SEPTEMBER"; Month[Month["OCTOBER"] = 9] = "OCTOBER"; Month[Month["NOVEMBER"] = 10] = "NOVEMBER"; Month[Month["DECEMBER"] = 11] = "DECEMBER"; return Month; }({}); let Day = /*#__PURE__*/function (Day) { Day[Day["SUNDAY"] = 0] = "SUNDAY"; Day[Day["MONDAY"] = 1] = "MONDAY"; Day[Day["TUESDAY"] = 2] = "TUESDAY"; Day[Day["WEDNESDAY"] = 3] = "WEDNESDAY"; Day[Day["THURSDAY"] = 4] = "THURSDAY"; Day[Day["FRIDAY"] = 5] = "FRIDAY"; Day[Day["SATURDAY"] = 6] = "SATURDAY"; return Day; }({}); const inRange = (date, min, max) => (isEqual(date, min) || isAfter(date, min)) && (isEqual(date, max) || isBefore(date, max)); const use_lilius_clearTime = date => set(date, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }); const useLilius = ({ weekStartsOn = Day.SUNDAY, viewing: initialViewing = new Date(), selected: initialSelected = [], numberOfMonths = 1 } = {}) => { const [viewing, setViewing] = (0,external_wp_element_namespaceObject.useState)(initialViewing); const viewToday = (0,external_wp_element_namespaceObject.useCallback)(() => setViewing(startOfToday()), [setViewing]); const viewMonth = (0,external_wp_element_namespaceObject.useCallback)(month => setViewing(v => setMonth(v, month)), []); const viewPreviousMonth = (0,external_wp_element_namespaceObject.useCallback)(() => setViewing(v => subMonths(v, 1)), []); const viewNextMonth = (0,external_wp_element_namespaceObject.useCallback)(() => setViewing(v => addMonths(v, 1)), []); const viewYear = (0,external_wp_element_namespaceObject.useCallback)(year => setViewing(v => setYear(v, year)), []); const viewPreviousYear = (0,external_wp_element_namespaceObject.useCallback)(() => setViewing(v => subYears(v, 1)), []); const viewNextYear = (0,external_wp_element_namespaceObject.useCallback)(() => setViewing(v => addYears(v, 1)), []); const [selected, setSelected] = (0,external_wp_element_namespaceObject.useState)(initialSelected.map(use_lilius_clearTime)); const clearSelected = () => setSelected([]); const isSelected = (0,external_wp_element_namespaceObject.useCallback)(date => selected.findIndex(s => isEqual(s, date)) > -1, [selected]); const select = (0,external_wp_element_namespaceObject.useCallback)((date, replaceExisting) => { if (replaceExisting) { setSelected(Array.isArray(date) ? date : [date]); } else { setSelected(selectedItems => selectedItems.concat(Array.isArray(date) ? date : [date])); } }, []); const deselect = (0,external_wp_element_namespaceObject.useCallback)(date => setSelected(selectedItems => Array.isArray(date) ? selectedItems.filter(s => !date.map(d => d.getTime()).includes(s.getTime())) : selectedItems.filter(s => !isEqual(s, date))), []); const toggle = (0,external_wp_element_namespaceObject.useCallback)((date, replaceExisting) => isSelected(date) ? deselect(date) : select(date, replaceExisting), [deselect, isSelected, select]); const selectRange = (0,external_wp_element_namespaceObject.useCallback)((start, end, replaceExisting) => { if (replaceExisting) { setSelected(eachDayOfInterval({ start, end })); } else { setSelected(selectedItems => selectedItems.concat(eachDayOfInterval({ start, end }))); } }, []); const deselectRange = (0,external_wp_element_namespaceObject.useCallback)((start, end) => { setSelected(selectedItems => selectedItems.filter(s => !eachDayOfInterval({ start, end }).map(d => d.getTime()).includes(s.getTime()))); }, []); const calendar = (0,external_wp_element_namespaceObject.useMemo)(() => eachMonthOfInterval({ start: startOfMonth(viewing), end: endOfMonth(addMonths(viewing, numberOfMonths - 1)) }).map(month => eachWeekOfInterval({ start: startOfMonth(month), end: endOfMonth(month) }, { weekStartsOn }).map(week => eachDayOfInterval({ start: startOfWeek(week, { weekStartsOn }), end: endOfWeek(week, { weekStartsOn }) }))), [viewing, weekStartsOn, numberOfMonths]); return { clearTime: use_lilius_clearTime, inRange, viewing, setViewing, viewToday, viewMonth, viewPreviousMonth, viewNextMonth, viewYear, viewPreviousYear, viewNextYear, selected, setSelected, clearSelected, isSelected, select, deselect, toggle, selectRange, deselectRange, calendar }; }; ;// ./node_modules/@wordpress/components/build-module/date-time/date/styles.js /** * External dependencies */ /** * Internal dependencies */ const styles_Wrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e105ri6r5" } : 0)(boxSizingReset, ";" + ( true ? "" : 0)); const Navigator = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? { target: "e105ri6r4" } : 0)("margin-bottom:", space(4), ";" + ( true ? "" : 0)); const NavigatorHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? { target: "e105ri6r3" } : 0)("font-size:", config_values.fontSize, ";font-weight:", config_values.fontWeight, ";strong{font-weight:", config_values.fontWeightHeading, ";}" + ( true ? "" : 0)); const Calendar = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e105ri6r2" } : 0)("column-gap:", space(2), ";display:grid;grid-template-columns:0.5fr repeat( 5, 1fr ) 0.5fr;justify-items:center;row-gap:", space(2), ";" + ( true ? "" : 0)); const DayOfWeek = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e105ri6r1" } : 0)("color:", COLORS.theme.gray[700], ";font-size:", config_values.fontSize, ";line-height:", config_values.fontLineHeightBase, ";&:nth-of-type( 1 ){justify-self:start;}&:nth-of-type( 7 ){justify-self:end;}" + ( true ? "" : 0)); const DayButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? { shouldForwardProp: prop => !['column', 'isSelected', 'isToday', 'hasEvents'].includes(prop), target: "e105ri6r0" } : 0)("grid-column:", props => props.column, ";position:relative;justify-content:center;", props => props.column === 1 && ` justify-self: start; `, " ", props => props.column === 7 && ` justify-self: end; `, " ", props => props.disabled && ` pointer-events: none; `, " &&&{border-radius:", config_values.radiusRound, ";height:", space(7), ";width:", space(7), ";", props => props.isSelected && ` background: ${COLORS.theme.accent}; &, &:hover:not(:disabled, [aria-disabled=true]) { color: ${COLORS.theme.accentInverted}; } &:focus:not(:disabled), &:focus:not(:disabled) { border: ${config_values.borderWidthFocus} solid currentColor; } /* Highlight the selected day for high-contrast mode */ &::after { content: ''; position: absolute; pointer-events: none; inset: 0; border-radius: inherit; border: 1px solid transparent; } `, " ", props => !props.isSelected && props.isToday && ` background: ${COLORS.theme.gray[200]}; `, ";}", props => props.hasEvents && ` ::before { border: 2px solid ${props.isSelected ? COLORS.theme.accentInverted : COLORS.theme.accent}; border-radius: ${config_values.radiusRound}; content: " "; left: 50%; position: absolute; transform: translate(-50%, 9px); } `, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/date-time/utils.js /** * External dependencies */ /** * Internal dependencies */ /** * Like date-fn's toDate, but tries to guess the format when a string is * given. * * @param input Value to turn into a date. */ function inputToDate(input) { if (typeof input === 'string') { return new Date(input); } return toDate(input); } /** * Converts a 12-hour time to a 24-hour time. * @param hours * @param isPm */ function from12hTo24h(hours, isPm) { return isPm ? (hours % 12 + 12) % 24 : hours % 12; } /** * Converts a 24-hour time to a 12-hour time. * @param hours */ function from24hTo12h(hours) { return hours % 12 || 12; } /** * Creates an InputControl reducer used to pad an input so that it is always a * given width. For example, the hours and minutes inputs are padded to 2 so * that '4' appears as '04'. * * @param pad How many digits the value should be. */ function buildPadInputStateReducer(pad) { return (state, action) => { const nextState = { ...state }; if (action.type === COMMIT || action.type === PRESS_UP || action.type === PRESS_DOWN) { if (nextState.value !== undefined) { nextState.value = nextState.value.toString().padStart(pad, '0'); } } return nextState; }; } /** * Validates the target of a React event to ensure it is an input element and * that the input is valid. * @param event */ function validateInputElementTarget(event) { var _ownerDocument$defaul; // `instanceof` checks need to get the instance definition from the // corresponding window object — therefore, the following logic makes // the component work correctly even when rendered inside an iframe. const HTMLInputElementInstance = (_ownerDocument$defaul = event.target?.ownerDocument.defaultView?.HTMLInputElement) !== null && _ownerDocument$defaul !== void 0 ? _ownerDocument$defaul : HTMLInputElement; if (!(event.target instanceof HTMLInputElementInstance)) { return false; } return event.target.validity.valid; } ;// ./node_modules/@wordpress/components/build-module/date-time/constants.js const TIMEZONELESS_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; ;// ./node_modules/@wordpress/components/build-module/date-time/date/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * DatePicker is a React component that renders a calendar for date selection. * * ```jsx * import { DatePicker } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyDatePicker = () => { * const [ date, setDate ] = useState( new Date() ); * * return ( * <DatePicker * currentDate={ date } * onChange={ ( newDate ) => setDate( newDate ) } * /> * ); * }; * ``` */ function DatePicker({ currentDate, onChange, events = [], isInvalidDate, onMonthPreviewed, startOfWeek: weekStartsOn = 0 }) { const date = currentDate ? inputToDate(currentDate) : new Date(); const { calendar, viewing, setSelected, setViewing, isSelected, viewPreviousMonth, viewNextMonth } = useLilius({ selected: [startOfDay(date)], viewing: startOfDay(date), weekStartsOn }); // Used to implement a roving tab index. Tracks the day that receives focus // when the user tabs into the calendar. const [focusable, setFocusable] = (0,external_wp_element_namespaceObject.useState)(startOfDay(date)); // Allows us to only programmatically focus() a day when focus was already // within the calendar. This stops us stealing focus from e.g. a TimePicker // input. const [isFocusWithinCalendar, setIsFocusWithinCalendar] = (0,external_wp_element_namespaceObject.useState)(false); // Update internal state when currentDate prop changes. const [prevCurrentDate, setPrevCurrentDate] = (0,external_wp_element_namespaceObject.useState)(currentDate); if (currentDate !== prevCurrentDate) { setPrevCurrentDate(currentDate); setSelected([startOfDay(date)]); setViewing(startOfDay(date)); setFocusable(startOfDay(date)); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(styles_Wrapper, { className: "components-datetime__date", role: "application", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Calendar'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Navigator, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? arrow_right : arrow_left, variant: "tertiary", "aria-label": (0,external_wp_i18n_namespaceObject.__)('View previous month'), onClick: () => { viewPreviousMonth(); setFocusable(subMonths(focusable, 1)); onMonthPreviewed?.(format(subMonths(viewing, 1), TIMEZONELESS_FORMAT)); }, size: "compact" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(NavigatorHeading, { level: 3, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: (0,external_wp_date_namespaceObject.dateI18n)('F', viewing, -viewing.getTimezoneOffset()) }), ' ', (0,external_wp_date_namespaceObject.dateI18n)('Y', viewing, -viewing.getTimezoneOffset())] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? arrow_left : arrow_right, variant: "tertiary", "aria-label": (0,external_wp_i18n_namespaceObject.__)('View next month'), onClick: () => { viewNextMonth(); setFocusable(addMonths(focusable, 1)); onMonthPreviewed?.(format(addMonths(viewing, 1), TIMEZONELESS_FORMAT)); }, size: "compact" })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Calendar, { onFocus: () => setIsFocusWithinCalendar(true), onBlur: () => setIsFocusWithinCalendar(false), children: [calendar[0][0].map(day => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DayOfWeek, { children: (0,external_wp_date_namespaceObject.dateI18n)('D', day, -day.getTimezoneOffset()) }, day.toString())), calendar[0].map(week => week.map((day, index) => { if (!isSameMonth(day, viewing)) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(date_Day, { day: day, column: index + 1, isSelected: isSelected(day), isFocusable: isEqual(day, focusable), isFocusAllowed: isFocusWithinCalendar, isToday: isSameDay(day, new Date()), isInvalid: isInvalidDate ? isInvalidDate(day) : false, numEvents: events.filter(event => isSameDay(event.date, day)).length, onClick: () => { setSelected([day]); setFocusable(day); onChange?.(format( // Don't change the selected date's time fields. new Date(day.getFullYear(), day.getMonth(), day.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()), TIMEZONELESS_FORMAT)); }, onKeyDown: event => { let nextFocusable; if (event.key === 'ArrowLeft') { nextFocusable = addDays(day, (0,external_wp_i18n_namespaceObject.isRTL)() ? 1 : -1); } if (event.key === 'ArrowRight') { nextFocusable = addDays(day, (0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1); } if (event.key === 'ArrowUp') { nextFocusable = subWeeks(day, 1); } if (event.key === 'ArrowDown') { nextFocusable = addWeeks(day, 1); } if (event.key === 'PageUp') { nextFocusable = subMonths(day, 1); } if (event.key === 'PageDown') { nextFocusable = addMonths(day, 1); } if (event.key === 'Home') { nextFocusable = startOfWeek(day); } if (event.key === 'End') { nextFocusable = startOfDay(endOfWeek(day)); } if (nextFocusable) { event.preventDefault(); setFocusable(nextFocusable); if (!isSameMonth(nextFocusable, viewing)) { setViewing(nextFocusable); onMonthPreviewed?.(format(nextFocusable, TIMEZONELESS_FORMAT)); } } } }, day.toString()); }))] })] }); } function date_Day({ day, column, isSelected, isFocusable, isFocusAllowed, isToday, isInvalid, numEvents, onClick, onKeyDown }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); // Focus the day when it becomes focusable, e.g. because an arrow key is // pressed. Only do this if focus is allowed - this stops us stealing focus // from e.g. a TimePicker input. (0,external_wp_element_namespaceObject.useEffect)(() => { if (ref.current && isFocusable && isFocusAllowed) { ref.current.focus(); } // isFocusAllowed is not a dep as there is no point calling focus() on // an already focused element. }, [isFocusable]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DayButton, { __next40pxDefaultSize: true, ref: ref, className: "components-datetime__date__day" // Unused, for backwards compatibility. , disabled: isInvalid, tabIndex: isFocusable ? 0 : -1, "aria-label": getDayLabel(day, isSelected, numEvents), column: column, isSelected: isSelected, isToday: isToday, hasEvents: numEvents > 0, onClick: onClick, onKeyDown: onKeyDown, children: (0,external_wp_date_namespaceObject.dateI18n)('j', day, -day.getTimezoneOffset()) }); } function getDayLabel(date, isSelected, numEvents) { const { formats } = (0,external_wp_date_namespaceObject.getSettings)(); const localizedDate = (0,external_wp_date_namespaceObject.dateI18n)(formats.date, date, -date.getTimezoneOffset()); if (isSelected && numEvents > 0) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The calendar date. 2: Number of events on the calendar date. (0,external_wp_i18n_namespaceObject._n)('%1$s. Selected. There is %2$d event', '%1$s. Selected. There are %2$d events', numEvents), localizedDate, numEvents); } else if (isSelected) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The calendar date. (0,external_wp_i18n_namespaceObject.__)('%1$s. Selected'), localizedDate); } else if (numEvents > 0) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The calendar date. 2: Number of events on the calendar date. (0,external_wp_i18n_namespaceObject._n)('%1$s. There is %2$d event', '%1$s. There are %2$d events', numEvents), localizedDate, numEvents); } return localizedDate; } /* harmony default export */ const date = (DatePicker); ;// ./node_modules/date-fns/startOfMinute.mjs /** * @name startOfMinute * @category Minute Helpers * @summary Return the start of a minute for the given date. * * @description * Return the start of a minute for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The original date * * @returns The start of a minute * * @example * // The start of a minute for 1 December 2014 22:15:45.400: * const result = startOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400)) * //=> Mon Dec 01 2014 22:15:00 */ function startOfMinute(date) { const _date = toDate(date); _date.setSeconds(0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfMinute = ((/* unused pure expression or super */ null && (startOfMinute))); ;// ./node_modules/@wordpress/components/build-module/date-time/time/styles.js function time_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const time_styles_Wrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "evcr2319" } : 0)("box-sizing:border-box;font-size:", config_values.fontSize, ";" + ( true ? "" : 0)); const Fieldset = /*#__PURE__*/emotion_styled_base_browser_esm("fieldset", true ? { target: "evcr2318" } : 0)("border:0;margin:0 0 ", space(2 * 2), " 0;padding:0;&:last-child{margin-bottom:0;}" + ( true ? "" : 0)); const TimeWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "evcr2317" } : 0)( true ? { name: "pd0mhc", styles: "direction:ltr;display:flex" } : 0); const baseInput = /*#__PURE__*/emotion_react_browser_esm_css("&&& ", Input, "{padding-left:", space(2), ";padding-right:", space(2), ";text-align:center;}" + ( true ? "" : 0), true ? "" : 0); const HoursInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? { target: "evcr2316" } : 0)(baseInput, " width:", space(9), ";&&& ", Input, "{padding-right:0;}&&& ", BackdropUI, "{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;}" + ( true ? "" : 0)); const TimeSeparator = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "evcr2315" } : 0)("border-top:", config_values.borderWidth, " solid ", COLORS.gray[700], ";border-bottom:", config_values.borderWidth, " solid ", COLORS.gray[700], ";font-size:", config_values.fontSize, ";line-height:calc(\n\t\t", config_values.controlHeight, " - ", config_values.borderWidth, " * 2\n\t);display:inline-block;" + ( true ? "" : 0)); const MinutesInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? { target: "evcr2314" } : 0)(baseInput, " width:", space(9), ";&&& ", Input, "{padding-left:0;}&&& ", BackdropUI, "{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;}" + ( true ? "" : 0)); // Ideally we wouldn't need a wrapper, but can't otherwise target the // <BaseControl> in <SelectControl> const MonthSelectWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "evcr2313" } : 0)( true ? { name: "1ff36h2", styles: "flex-grow:1" } : 0); const DayInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? { target: "evcr2312" } : 0)(baseInput, " width:", space(9), ";" + ( true ? "" : 0)); const YearInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? { target: "evcr2311" } : 0)(baseInput, " width:", space(14), ";" + ( true ? "" : 0)); const TimeZone = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "evcr2310" } : 0)( true ? { name: "ebu3jh", styles: "text-decoration:underline dotted" } : 0); ;// ./node_modules/@wordpress/components/build-module/date-time/time/timezone.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Displays timezone information when user timezone is different from site * timezone. */ const timezone_TimeZone = () => { const { timezone } = (0,external_wp_date_namespaceObject.getSettings)(); // Convert timezone offset to hours. const userTimezoneOffset = -1 * (new Date().getTimezoneOffset() / 60); // System timezone and user timezone match, nothing needed. // Compare as numbers because it comes over as string. if (Number(timezone.offset) === userTimezoneOffset) { return null; } const offsetSymbol = Number(timezone.offset) >= 0 ? '+' : ''; const zoneAbbr = '' !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offsetFormatted}`; // Replace underscore with space in strings like `America/Costa_Rica`. const prettyTimezoneString = timezone.string.replace('_', ' '); const timezoneDetail = 'UTC' === timezone.string ? (0,external_wp_i18n_namespaceObject.__)('Coordinated Universal Time') : `(${zoneAbbr}) ${prettyTimezoneString}`; // When the prettyTimezoneString is empty, there is no additional timezone // detail information to show in a Tooltip. const hasNoAdditionalTimezoneDetail = prettyTimezoneString.trim().length === 0; return hasNoAdditionalTimezoneDetail ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeZone, { className: "components-datetime__timezone", children: zoneAbbr }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tooltip, { placement: "top", text: timezoneDetail, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeZone, { className: "components-datetime__timezone", children: zoneAbbr }) }); }; /* harmony default export */ const timezone = (timezone_TimeZone); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToggleGroupControlOption(props, ref) { const { label, ...restProps } = props; const optionLabel = restProps['aria-label'] || label; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_option_base_component, { ...restProps, "aria-label": optionLabel, ref: ref, children: label }); } /** * `ToggleGroupControlOption` is a form component and is meant to be used as a * child of `ToggleGroupControl`. * * ```jsx * import { * __experimentalToggleGroupControl as ToggleGroupControl, * __experimentalToggleGroupControlOption as ToggleGroupControlOption, * } from '@wordpress/components'; * * function Example() { * return ( * <ToggleGroupControl * label="my label" * value="vertical" * isBlock * __nextHasNoMarginBottom * __next40pxDefaultSize * > * <ToggleGroupControlOption value="horizontal" label="Horizontal" /> * <ToggleGroupControlOption value="vertical" label="Vertical" /> * </ToggleGroupControl> * ); * } * ``` */ const ToggleGroupControlOption = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlOption); /* harmony default export */ const toggle_group_control_option_component = (ToggleGroupControlOption); ;// ./node_modules/@wordpress/components/build-module/date-time/time/time-input/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function TimeInput({ value: valueProp, defaultValue, is12Hour, label, minutesProps, onChange }) { const [value = { hours: new Date().getHours(), minutes: new Date().getMinutes() }, setValue] = useControlledValue({ value: valueProp, onChange, defaultValue }); const dayPeriod = parseDayPeriod(value.hours); const hours12Format = from24hTo12h(value.hours); const buildNumberControlChangeCallback = method => { return (_value, { event }) => { if (!validateInputElementTarget(event)) { return; } // We can safely assume value is a number if target is valid. const numberValue = Number(_value); setValue({ ...value, [method]: method === 'hours' && is12Hour ? from12hTo24h(numberValue, dayPeriod === 'PM') : numberValue }); }; }; const buildAmPmChangeCallback = _value => { return () => { if (dayPeriod === _value) { return; } setValue({ ...value, hours: from12hTo24h(hours12Format, _value === 'PM') }); }; }; function parseDayPeriod(_hours) { return _hours < 12 ? 'AM' : 'PM'; } const Wrapper = label ? Fieldset : external_wp_element_namespaceObject.Fragment; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control.VisualLabel, { as: "legend", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { alignment: "left", expanded: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(TimeWrapper, { className: "components-datetime__time-field components-datetime__time-field-time" // Unused, for backwards compatibility. , children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HoursInput, { className: "components-datetime__time-field-hours-input" // Unused, for backwards compatibility. , label: (0,external_wp_i18n_namespaceObject.__)('Hours'), hideLabelFromVision: true, __next40pxDefaultSize: true, value: String(is12Hour ? hours12Format : value.hours).padStart(2, '0'), step: 1, min: is12Hour ? 1 : 0, max: is12Hour ? 12 : 23, required: true, spinControls: "none", isPressEnterToChange: true, isDragEnabled: false, isShiftStepEnabled: false, onChange: buildNumberControlChangeCallback('hours'), __unstableStateReducer: buildPadInputStateReducer(2) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeSeparator, { className: "components-datetime__time-separator" // Unused, for backwards compatibility. , "aria-hidden": "true", children: ":" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MinutesInput, { className: dist_clsx('components-datetime__time-field-minutes-input', // Unused, for backwards compatibility. minutesProps?.className), label: (0,external_wp_i18n_namespaceObject.__)('Minutes'), hideLabelFromVision: true, __next40pxDefaultSize: true, value: String(value.minutes).padStart(2, '0'), step: 1, min: 0, max: 59, required: true, spinControls: "none", isPressEnterToChange: true, isDragEnabled: false, isShiftStepEnabled: false, onChange: (...args) => { buildNumberControlChangeCallback('minutes')(...args); minutesProps?.onChange?.(...args); }, __unstableStateReducer: buildPadInputStateReducer(2), ...minutesProps })] }), is12Hour && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(toggle_group_control_component, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, isBlock: true, label: (0,external_wp_i18n_namespaceObject.__)('Select AM or PM'), hideLabelFromVision: true, value: dayPeriod, onChange: newValue => { buildAmPmChangeCallback(newValue)(); }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_option_component, { value: "AM", label: (0,external_wp_i18n_namespaceObject.__)('AM') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_option_component, { value: "PM", label: (0,external_wp_i18n_namespaceObject.__)('PM') })] })] })] }); } /* harmony default export */ const time_input = ((/* unused pure expression or super */ null && (TimeInput))); ;// ./node_modules/@wordpress/components/build-module/date-time/time/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const VALID_DATE_ORDERS = ['dmy', 'mdy', 'ymd']; /** * TimePicker is a React component that renders a clock for time selection. * * ```jsx * import { TimePicker } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyTimePicker = () => { * const [ time, setTime ] = useState( new Date() ); * * return ( * <TimePicker * currentTime={ date } * onChange={ ( newTime ) => setTime( newTime ) } * is12Hour * /> * ); * }; * ``` */ function TimePicker({ is12Hour, currentTime, onChange, dateOrder: dateOrderProp, hideLabelFromVision = false }) { const [date, setDate] = (0,external_wp_element_namespaceObject.useState)(() => // Truncate the date at the minutes, see: #15495. currentTime ? startOfMinute(inputToDate(currentTime)) : new Date()); // Reset the state when currentTime changed. // TODO: useEffect() shouldn't be used like this, causes an unnecessary render (0,external_wp_element_namespaceObject.useEffect)(() => { setDate(currentTime ? startOfMinute(inputToDate(currentTime)) : new Date()); }, [currentTime]); const monthOptions = [{ value: '01', label: (0,external_wp_i18n_namespaceObject.__)('January') }, { value: '02', label: (0,external_wp_i18n_namespaceObject.__)('February') }, { value: '03', label: (0,external_wp_i18n_namespaceObject.__)('March') }, { value: '04', label: (0,external_wp_i18n_namespaceObject.__)('April') }, { value: '05', label: (0,external_wp_i18n_namespaceObject.__)('May') }, { value: '06', label: (0,external_wp_i18n_namespaceObject.__)('June') }, { value: '07', label: (0,external_wp_i18n_namespaceObject.__)('July') }, { value: '08', label: (0,external_wp_i18n_namespaceObject.__)('August') }, { value: '09', label: (0,external_wp_i18n_namespaceObject.__)('September') }, { value: '10', label: (0,external_wp_i18n_namespaceObject.__)('October') }, { value: '11', label: (0,external_wp_i18n_namespaceObject.__)('November') }, { value: '12', label: (0,external_wp_i18n_namespaceObject.__)('December') }]; const { day, month, year, minutes, hours } = (0,external_wp_element_namespaceObject.useMemo)(() => ({ day: format(date, 'dd'), month: format(date, 'MM'), year: format(date, 'yyyy'), minutes: format(date, 'mm'), hours: format(date, 'HH'), am: format(date, 'a') }), [date]); const buildNumberControlChangeCallback = method => { const callback = (value, { event }) => { if (!validateInputElementTarget(event)) { return; } // We can safely assume value is a number if target is valid. const numberValue = Number(value); const newDate = set(date, { [method]: numberValue }); setDate(newDate); onChange?.(format(newDate, TIMEZONELESS_FORMAT)); }; return callback; }; const onTimeInputChangeCallback = ({ hours: newHours, minutes: newMinutes }) => { const newDate = set(date, { hours: newHours, minutes: newMinutes }); setDate(newDate); onChange?.(format(newDate, TIMEZONELESS_FORMAT)); }; const dayField = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DayInput, { className: "components-datetime__time-field components-datetime__time-field-day" // Unused, for backwards compatibility. , label: (0,external_wp_i18n_namespaceObject.__)('Day'), hideLabelFromVision: true, __next40pxDefaultSize: true, value: day, step: 1, min: 1, max: 31, required: true, spinControls: "none", isPressEnterToChange: true, isDragEnabled: false, isShiftStepEnabled: false, onChange: buildNumberControlChangeCallback('date') }, "day"); const monthField = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MonthSelectWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(select_control, { className: "components-datetime__time-field components-datetime__time-field-month" // Unused, for backwards compatibility. , label: (0,external_wp_i18n_namespaceObject.__)('Month'), hideLabelFromVision: true, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, value: month, options: monthOptions, onChange: value => { const newDate = setMonth(date, Number(value) - 1); setDate(newDate); onChange?.(format(newDate, TIMEZONELESS_FORMAT)); } }) }, "month"); const yearField = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(YearInput, { className: "components-datetime__time-field components-datetime__time-field-year" // Unused, for backwards compatibility. , label: (0,external_wp_i18n_namespaceObject.__)('Year'), hideLabelFromVision: true, __next40pxDefaultSize: true, value: year, step: 1, min: 1, max: 9999, required: true, spinControls: "none", isPressEnterToChange: true, isDragEnabled: false, isShiftStepEnabled: false, onChange: buildNumberControlChangeCallback('year'), __unstableStateReducer: buildPadInputStateReducer(4) }, "year"); const defaultDateOrder = is12Hour ? 'mdy' : 'dmy'; const dateOrder = dateOrderProp && VALID_DATE_ORDERS.includes(dateOrderProp) ? dateOrderProp : defaultDateOrder; const fields = dateOrder.split('').map(field => { switch (field) { case 'd': return dayField; case 'm': return monthField; case 'y': return yearField; default: return null; } }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(time_styles_Wrapper, { className: "components-datetime__time" // Unused, for backwards compatibility. , children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Fieldset, { children: [hideLabelFromVision ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Time') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control.VisualLabel, { as: "legend", className: "components-datetime__time-legend" // Unused, for backwards compatibility. , children: (0,external_wp_i18n_namespaceObject.__)('Time') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { className: "components-datetime__time-wrapper" // Unused, for backwards compatibility. , children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeInput, { value: { hours: Number(hours), minutes: Number(minutes) }, is12Hour: is12Hour, onChange: onTimeInputChangeCallback }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(timezone, {})] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Fieldset, { children: [hideLabelFromVision ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Date') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control.VisualLabel, { as: "legend", className: "components-datetime__time-legend" // Unused, for backwards compatibility. , children: (0,external_wp_i18n_namespaceObject.__)('Date') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(h_stack_component, { className: "components-datetime__time-wrapper" // Unused, for backwards compatibility. , children: fields })] })] }); } /** * A component to input a time. * * Values are passed as an object in 24-hour format (`{ hours: number, minutes: number }`). * * ```jsx * import { TimePicker } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyTimeInput = () => { * const [ time, setTime ] = useState( { hours: 13, minutes: 30 } ); * * return ( * <TimePicker.TimeInput * value={ time } * onChange={ setTime } * label="Time" * /> * ); * }; * ``` */ TimePicker.TimeInput = TimeInput; Object.assign(TimePicker.TimeInput, { displayName: 'TimePicker.TimeInput' }); /* harmony default export */ const date_time_time = (TimePicker); ;// ./node_modules/@wordpress/components/build-module/date-time/date-time/styles.js function date_time_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const date_time_styles_Wrapper = /*#__PURE__*/emotion_styled_base_browser_esm(v_stack_component, true ? { target: "e1p5onf00" } : 0)( true ? { name: "1khn195", styles: "box-sizing:border-box" } : 0); ;// ./node_modules/@wordpress/components/build-module/date-time/date-time/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const date_time_noop = () => {}; function UnforwardedDateTimePicker({ currentDate, is12Hour, dateOrder, isInvalidDate, onMonthPreviewed = date_time_noop, onChange, events, startOfWeek }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(date_time_styles_Wrapper, { ref: ref, className: "components-datetime", spacing: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(date_time_time, { currentTime: currentDate, onChange: onChange, is12Hour: is12Hour, dateOrder: dateOrder }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(date, { currentDate: currentDate, onChange: onChange, isInvalidDate: isInvalidDate, events: events, onMonthPreviewed: onMonthPreviewed, startOfWeek: startOfWeek })] }) }); } /** * DateTimePicker is a React component that renders a calendar and clock for * date and time selection. The calendar and clock components can be accessed * individually using the `DatePicker` and `TimePicker` components respectively. * * ```jsx * import { DateTimePicker } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyDateTimePicker = () => { * const [ date, setDate ] = useState( new Date() ); * * return ( * <DateTimePicker * currentDate={ date } * onChange={ ( newDate ) => setDate( newDate ) } * is12Hour * /> * ); * }; * ``` */ const DateTimePicker = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedDateTimePicker); /* harmony default export */ const date_time = (DateTimePicker); ;// ./node_modules/@wordpress/components/build-module/date-time/index.js /** * Internal dependencies */ /* harmony default export */ const build_module_date_time = (date_time); ;// ./node_modules/@wordpress/components/build-module/dimension-control/sizes.js /** * Sizes * * defines the sizes used in dimension controls * all hardcoded `size` values are based on the value of * the Sass variable `$block-padding` from * `packages/block-editor/src/components/dimension-control/sizes.js`. */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Finds the correct size object from the provided sizes * table by size slug (eg: `medium`) * * @param sizes containing objects for each size definition. * @param slug a string representation of the size (eg: `medium`). */ const findSizeBySlug = (sizes, slug) => sizes.find(size => slug === size.slug); /* harmony default export */ const dimension_control_sizes = ([{ name: (0,external_wp_i18n_namespaceObject._x)('None', 'Size of a UI element'), slug: 'none' }, { name: (0,external_wp_i18n_namespaceObject._x)('Small', 'Size of a UI element'), slug: 'small' }, { name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'Size of a UI element'), slug: 'medium' }, { name: (0,external_wp_i18n_namespaceObject._x)('Large', 'Size of a UI element'), slug: 'large' }, { name: (0,external_wp_i18n_namespaceObject._x)('Extra Large', 'Size of a UI element'), slug: 'xlarge' }]); ;// ./node_modules/@wordpress/components/build-module/dimension-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const dimension_control_CONTEXT_VALUE = { BaseControl: { // Temporary during deprecation grace period: Overrides the underlying `__associatedWPComponentName` // via the context system to override the value set by SelectControl. _overrides: { __associatedWPComponentName: 'DimensionControl' } } }; /** * `DimensionControl` is a component designed to provide a UI to control spacing and/or dimensions. * * @deprecated * * ```jsx * import { __experimentalDimensionControl as DimensionControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * export default function MyCustomDimensionControl() { * const [ paddingSize, setPaddingSize ] = useState( '' ); * * return ( * <DimensionControl * __next40pxDefaultSize * __nextHasNoMarginBottom * label={ 'Padding' } * icon={ 'desktop' } * onChange={ ( value ) => setPaddingSize( value ) } * value={ paddingSize } * /> * ); * } * ``` */ function DimensionControl(props) { const { __next40pxDefaultSize = false, __nextHasNoMarginBottom = false, label, value, sizes = dimension_control_sizes, icon, onChange, className = '' } = props; external_wp_deprecated_default()('wp.components.DimensionControl', { since: '6.7', version: '7.0' }); maybeWarnDeprecated36pxSize({ componentName: 'DimensionControl', __next40pxDefaultSize, size: undefined }); const onChangeSpacingSize = val => { const theSize = findSizeBySlug(sizes, val); if (!theSize || value === theSize.slug) { onChange?.(undefined); } else if (typeof onChange === 'function') { onChange(theSize.slug); } }; const formatSizesAsOptions = theSizes => { const options = theSizes.map(({ name, slug }) => ({ label: name, value: slug })); return [{ label: (0,external_wp_i18n_namespaceObject.__)('Default'), value: '' }, ...options]; }; const selectLabel = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon }), label] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextSystemProvider, { value: dimension_control_CONTEXT_VALUE, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(select_control, { __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, __nextHasNoMarginBottom: __nextHasNoMarginBottom, className: dist_clsx(className, 'block-editor-dimension-control'), label: selectLabel, hideLabelFromVision: false, value: value, onChange: onChangeSpacingSize, options: formatSizesAsOptions(sizes) }) }); } /* harmony default export */ const dimension_control = (DimensionControl); ;// ./node_modules/@wordpress/components/build-module/disabled/styles/disabled-styles.js function disabled_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ const disabled_styles_disabledStyles = true ? { name: "u2jump", styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}" } : 0; ;// ./node_modules/@wordpress/components/build-module/disabled/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const Context = (0,external_wp_element_namespaceObject.createContext)(false); const { Consumer, Provider: disabled_Provider } = Context; /** * `Disabled` is a component which disables descendant tabbable elements and * prevents pointer interaction. * * _Note: this component may not behave as expected in browsers that don't * support the `inert` HTML attribute. We recommend adding the official WICG * polyfill when using this component in your project._ * * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert * * ```jsx * import { Button, Disabled, TextControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyDisabled = () => { * const [ isDisabled, setIsDisabled ] = useState( true ); * * let input = ( * <TextControl * __next40pxDefaultSize * __nextHasNoMarginBottom * label="Input" * onChange={ () => {} } * /> * ); * if ( isDisabled ) { * input = <Disabled>{ input }</Disabled>; * } * * const toggleDisabled = () => { * setIsDisabled( ( state ) => ! state ); * }; * * return ( * <div> * { input } * <Button variant="primary" onClick={ toggleDisabled }> * Toggle Disabled * </Button> * </div> * ); * }; * ``` */ function Disabled({ className, children, isDisabled = true, ...props }) { const cx = useCx(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(disabled_Provider, { value: isDisabled, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { // @ts-ignore Reason: inert is a recent HTML attribute inert: isDisabled ? 'true' : undefined, className: isDisabled ? cx(disabled_styles_disabledStyles, className, 'components-disabled') : undefined, ...props, children: children }) }); } Disabled.Context = Context; Disabled.Consumer = Consumer; /* harmony default export */ const disabled = (Disabled); ;// ./node_modules/@wordpress/components/build-module/disclosure/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Accessible Disclosure component that controls visibility of a section of * content. It follows the WAI-ARIA Disclosure Pattern. */ const UnforwardedDisclosureContent = ({ visible, children, ...props }, ref) => { const disclosure = useDisclosureStore({ open: visible }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContent, { store: disclosure, ref: ref, ...props, children: children }); }; const disclosure_DisclosureContent = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedDisclosureContent); /* harmony default export */ const disclosure = ((/* unused pure expression or super */ null && (disclosure_DisclosureContent))); ;// ./node_modules/@wordpress/components/build-module/draggable/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const dragImageClass = 'components-draggable__invisible-drag-image'; const cloneWrapperClass = 'components-draggable__clone'; const clonePadding = 0; const bodyClass = 'is-dragging-components-draggable'; /** * `Draggable` is a Component that provides a way to set up a cross-browser * (including IE) customizable drag image and the transfer data for the drag * event. It decouples the drag handle and the element to drag: use it by * wrapping the component that will become the drag handle and providing the DOM * ID of the element to drag. * * Note that the drag handle needs to declare the `draggable="true"` property * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable` * takes care of the logic to setup the drag image and the transfer data, but is * not concerned with creating an actual DOM element that is draggable. * * ```jsx * import { Draggable, Panel, PanelBody } from '@wordpress/components'; * import { Icon, more } from '@wordpress/icons'; * * const MyDraggable = () => ( * <div id="draggable-panel"> * <Panel header="Draggable panel"> * <PanelBody> * <Draggable elementId="draggable-panel" transferData={ {} }> * { ( { onDraggableStart, onDraggableEnd } ) => ( * <div * className="example-drag-handle" * draggable * onDragStart={ onDraggableStart } * onDragEnd={ onDraggableEnd } * > * <Icon icon={ more } /> * </div> * ) } * </Draggable> * </PanelBody> * </Panel> * </div> * ); * ``` */ function Draggable({ children, onDragStart, onDragOver, onDragEnd, appendToOwnerDocument = false, cloneClassname, elementId, transferData, __experimentalTransferDataType: transferDataType = 'text', __experimentalDragComponent: dragComponent }) { const dragComponentRef = (0,external_wp_element_namespaceObject.useRef)(null); const cleanupRef = (0,external_wp_element_namespaceObject.useRef)(() => {}); /** * Removes the element clone, resets cursor, and removes drag listener. * * @param event The non-custom DragEvent. */ function end(event) { event.preventDefault(); cleanupRef.current(); if (onDragEnd) { onDragEnd(event); } } /** * This method does a couple of things: * * - Clones the current element and spawns clone over original element. * - Adds a fake temporary drag image to avoid browser defaults. * - Sets transfer data. * - Adds dragover listener. * * @param event The non-custom DragEvent. */ function start(event) { const { ownerDocument } = event.target; event.dataTransfer.setData(transferDataType, JSON.stringify(transferData)); const cloneWrapper = ownerDocument.createElement('div'); // Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise. cloneWrapper.style.top = '0'; cloneWrapper.style.left = '0'; const dragImage = ownerDocument.createElement('div'); // Set a fake drag image to avoid browser defaults. Remove from DOM // right after. event.dataTransfer.setDragImage is not supported yet in // IE, we need to check for its existence first. if ('function' === typeof event.dataTransfer.setDragImage) { dragImage.classList.add(dragImageClass); ownerDocument.body.appendChild(dragImage); event.dataTransfer.setDragImage(dragImage, 0, 0); } cloneWrapper.classList.add(cloneWrapperClass); if (cloneClassname) { cloneWrapper.classList.add(cloneClassname); } let x = 0; let y = 0; // If a dragComponent is defined, the following logic will clone the // HTML node and inject it into the cloneWrapper. if (dragComponentRef.current) { // Position dragComponent at the same position as the cursor. x = event.clientX; y = event.clientY; cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`; const clonedDragComponent = ownerDocument.createElement('div'); clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML; cloneWrapper.appendChild(clonedDragComponent); // Inject the cloneWrapper into the DOM. ownerDocument.body.appendChild(cloneWrapper); } else { const element = ownerDocument.getElementById(elementId); // Prepare element clone and append to element wrapper. const elementRect = element.getBoundingClientRect(); const elementWrapper = element.parentNode; const elementTopOffset = elementRect.top; const elementLeftOffset = elementRect.left; cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`; const clone = element.cloneNode(true); clone.id = `clone-${elementId}`; // Position clone right over the original element (20px padding). x = elementLeftOffset - clonePadding; y = elementTopOffset - clonePadding; cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`; // Hack: Remove iFrames as it's causing the embeds drag clone to freeze. Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode?.removeChild(child)); cloneWrapper.appendChild(clone); // Inject the cloneWrapper into the DOM. if (appendToOwnerDocument) { ownerDocument.body.appendChild(cloneWrapper); } else { elementWrapper?.appendChild(cloneWrapper); } } // Mark the current cursor coordinates. let cursorLeft = event.clientX; let cursorTop = event.clientY; function over(e) { // Skip doing any work if mouse has not moved. if (cursorLeft === e.clientX && cursorTop === e.clientY) { return; } const nextX = x + e.clientX - cursorLeft; const nextY = y + e.clientY - cursorTop; cloneWrapper.style.transform = `translate( ${nextX}px, ${nextY}px )`; cursorLeft = e.clientX; cursorTop = e.clientY; x = nextX; y = nextY; if (onDragOver) { onDragOver(e); } } // Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead, // note that browsers may throttle raf below 60fps in certain conditions. // @ts-ignore const throttledDragOver = (0,external_wp_compose_namespaceObject.throttle)(over, 16); ownerDocument.addEventListener('dragover', throttledDragOver); // Update cursor to 'grabbing', document wide. ownerDocument.body.classList.add(bodyClass); if (onDragStart) { onDragStart(event); } cleanupRef.current = () => { // Remove drag clone. if (cloneWrapper && cloneWrapper.parentNode) { cloneWrapper.parentNode.removeChild(cloneWrapper); } if (dragImage && dragImage.parentNode) { dragImage.parentNode.removeChild(dragImage); } // Reset cursor. ownerDocument.body.classList.remove(bodyClass); ownerDocument.removeEventListener('dragover', throttledDragOver); }; } (0,external_wp_element_namespaceObject.useEffect)(() => () => { cleanupRef.current(); }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [children({ onDraggableStart: start, onDraggableEnd: end }), dragComponent && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-draggable-drag-component-root", style: { display: 'none' }, ref: dragComponentRef, children: dragComponent })] }); } /* harmony default export */ const draggable = (Draggable); ;// ./node_modules/@wordpress/icons/build-module/library/upload.js /** * WordPress dependencies */ const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) }); /* harmony default export */ const library_upload = (upload); ;// ./node_modules/@wordpress/components/build-module/drop-zone/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * `DropZone` is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event. * * ```jsx * import { DropZone } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyDropZone = () => { * const [ hasDropped, setHasDropped ] = useState( false ); * * return ( * <div> * { hasDropped ? 'Dropped!' : 'Drop something here' } * <DropZone * onFilesDrop={ () => setHasDropped( true ) } * onHTMLDrop={ () => setHasDropped( true ) } * onDrop={ () => setHasDropped( true ) } * /> * </div> * ); * } * ``` */ function DropZoneComponent({ className, label, onFilesDrop, onHTMLDrop, onDrop, isEligible = () => true, ...restProps }) { const [isDraggingOverDocument, setIsDraggingOverDocument] = (0,external_wp_element_namespaceObject.useState)(); const [isDraggingOverElement, setIsDraggingOverElement] = (0,external_wp_element_namespaceObject.useState)(); const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(); const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ onDrop(event) { if (!event.dataTransfer) { return; } const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer); const html = event.dataTransfer.getData('text/html'); /** * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML. * The order of the checks is important to recognize the HTML drop. */ if (html && onHTMLDrop) { onHTMLDrop(html); } else if (files.length && onFilesDrop) { onFilesDrop(files); } else if (onDrop) { onDrop(event); } }, onDragStart(event) { setIsDraggingOverDocument(true); if (!event.dataTransfer) { return; } /** * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML. * The order of the checks is important to recognize the HTML drop. */ if (event.dataTransfer.types.includes('text/html')) { setIsActive(!!onHTMLDrop); } else if ( // Check for the types because sometimes the files themselves // are only available on drop. event.dataTransfer.types.includes('Files') || (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer).length > 0) { setIsActive(!!onFilesDrop); } else { setIsActive(!!onDrop && isEligible(event.dataTransfer)); } }, onDragEnd() { setIsDraggingOverElement(false); setIsDraggingOverDocument(false); setIsActive(undefined); }, onDragEnter() { setIsDraggingOverElement(true); }, onDragLeave() { setIsDraggingOverElement(false); } }); const classes = dist_clsx('components-drop-zone', className, { 'is-active': isActive, 'is-dragging-over-document': isDraggingOverDocument, 'is-dragging-over-element': isDraggingOverElement }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...restProps, ref: ref, className: classes, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-drop-zone__content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-drop-zone__content-inner", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: library_upload, className: "components-drop-zone__content-icon" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-drop-zone__content-text", children: label ? label : (0,external_wp_i18n_namespaceObject.__)('Drop files to upload') })] }) }) }); } /* harmony default export */ const drop_zone = (DropZoneComponent); ;// ./node_modules/@wordpress/components/build-module/drop-zone/provider.js /** * WordPress dependencies */ function DropZoneProvider({ children }) { external_wp_deprecated_default()('wp.components.DropZoneProvider', { since: '5.8', hint: 'wp.component.DropZone no longer needs a provider. wp.components.DropZoneProvider is safe to remove from your code.' }); return children; } ;// ./node_modules/@wordpress/icons/build-module/library/swatch.js /** * WordPress dependencies */ const swatch = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 17.7c.4.5.8.9 1.2 1.2l1.1-1.4c-.4-.3-.7-.6-1-1L5 17.7zM5 6.3l1.4 1.1c.3-.4.6-.7 1-1L6.3 5c-.5.4-.9.8-1.3 1.3zm.1 7.8l-1.7.5c.2.6.4 1.1.7 1.6l1.5-.8c-.2-.4-.4-.8-.5-1.3zM4.8 12v-.7L3 11.1v1.8l1.7-.2c.1-.2.1-.5.1-.7zm3 7.9c.5.3 1.1.5 1.6.7l.5-1.7c-.5-.1-.9-.3-1.3-.5l-.8 1.5zM19 6.3c-.4-.5-.8-.9-1.2-1.2l-1.1 1.4c.4.3.7.6 1 1L19 6.3zm-.1 3.6l1.7-.5c-.2-.6-.4-1.1-.7-1.6l-1.5.8c.2.4.4.8.5 1.3zM5.6 8.6l-1.5-.8c-.3.5-.5 1-.7 1.6l1.7.5c.1-.5.3-.9.5-1.3zm2.2-4.5l.8 1.5c.4-.2.8-.4 1.3-.5l-.5-1.7c-.6.2-1.1.4-1.6.7zm8.8 13.5l1.1 1.4c.5-.4.9-.8 1.2-1.2l-1.4-1.1c-.2.3-.5.6-.9.9zm1.8-2.2l1.5.8c.3-.5.5-1.1.7-1.6l-1.7-.5c-.1.5-.3.9-.5 1.3zm2.6-4.3l-1.7.2v1.4l1.7.2V12v-.9zM11.1 3l.2 1.7h1.4l.2-1.7h-1.8zm3 2.1c.5.1.9.3 1.3.5l.8-1.5c-.5-.3-1.1-.5-1.6-.7l-.5 1.7zM12 19.2h-.7l-.2 1.8h1.8l-.2-1.7c-.2-.1-.5-.1-.7-.1zm2.1-.3l.5 1.7c.6-.2 1.1-.4 1.6-.7l-.8-1.5c-.4.2-.8.4-1.3.5z" }) }); /* harmony default export */ const library_swatch = (swatch); ;// ./node_modules/@wordpress/components/build-module/duotone-picker/utils.js /** * External dependencies */ /** * Internal dependencies */ k([names]); /** * Object representation for a color. * * @typedef {Object} RGBColor * @property {number} r Red component of the color in the range [0,1]. * @property {number} g Green component of the color in the range [0,1]. * @property {number} b Blue component of the color in the range [0,1]. */ /** * Calculate the brightest and darkest values from a color palette. * * @param palette Color palette for the theme. * * @return Tuple of the darkest color and brightest color. */ function getDefaultColors(palette) { // A default dark and light color are required. if (!palette || palette.length < 2) { return ['#000', '#fff']; } return palette.map(({ color }) => ({ color, brightness: w(color).brightness() })).reduce(([min, max], current) => { return [current.brightness <= min.brightness ? current : min, current.brightness >= max.brightness ? current : max]; }, [{ brightness: 1, color: '' }, { brightness: 0, color: '' }]).map(({ color }) => color); } /** * Generate a duotone gradient from a list of colors. * * @param colors CSS color strings. * @param angle CSS gradient angle. * * @return CSS gradient string for the duotone swatch. */ function getGradientFromCSSColors(colors = [], angle = '90deg') { const l = 100 / colors.length; const stops = colors.map((c, i) => `${c} ${i * l}%, ${c} ${(i + 1) * l}%`).join(', '); return `linear-gradient( ${angle}, ${stops} )`; } /** * Convert a color array to an array of color stops. * * @param colors CSS colors array * * @return Color stop information. */ function getColorStopsFromColors(colors) { return colors.map((color, i) => ({ position: i * 100 / (colors.length - 1), color })); } /** * Convert a color stop array to an array colors. * * @param colorStops Color stop information. * * @return CSS colors array. */ function getColorsFromColorStops(colorStops = []) { return colorStops.map(({ color }) => color); } ;// ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-swatch.js /** * WordPress dependencies */ /** * Internal dependencies */ function DuotoneSwatch({ values }) { return values ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_indicator, { colorValue: getGradientFromCSSColors(values, '135deg') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_swatch }); } /* harmony default export */ const duotone_swatch = (DuotoneSwatch); ;// ./node_modules/@wordpress/components/build-module/duotone-picker/color-list-picker/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function ColorOption({ label, value, colors, disableCustomColors, enableAlpha, onChange }) { const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false); const idRoot = (0,external_wp_compose_namespaceObject.useInstanceId)(ColorOption, 'color-list-picker-option'); const labelId = `${idRoot}__label`; const contentId = `${idRoot}__content`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, className: "components-color-list-picker__swatch-button", id: labelId, onClick: () => setIsOpen(prev => !prev), "aria-expanded": isOpen, "aria-controls": contentId, icon: value ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_indicator, { colorValue: value, className: "components-color-list-picker__swatch-color" }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_swatch }), text: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "group", id: contentId, "aria-labelledby": labelId, "aria-hidden": !isOpen, children: isOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_palette, { "aria-label": (0,external_wp_i18n_namespaceObject.__)('Color options'), className: "components-color-list-picker__color-picker", colors: colors, value: value, clearable: false, onChange: onChange, disableCustomColors: disableCustomColors, enableAlpha: enableAlpha }) })] }); } function ColorListPicker({ colors, labels, value = [], disableCustomColors, enableAlpha, onChange }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-color-list-picker", children: labels.map((label, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorOption, { label: label, value: value[index], colors: colors, disableCustomColors: disableCustomColors, enableAlpha: enableAlpha, onChange: newColor => { const newColors = value.slice(); newColors[index] = newColor; onChange(newColors); } }, index)) }); } /* harmony default export */ const color_list_picker = (ColorListPicker); ;// ./node_modules/@wordpress/components/build-module/duotone-picker/custom-duotone-bar.js /** * Internal dependencies */ const PLACEHOLDER_VALUES = ['#333', '#CCC']; function CustomDuotoneBar({ value, onChange }) { const hasGradient = !!value; const values = hasGradient ? value : PLACEHOLDER_VALUES; const background = getGradientFromCSSColors(values); const controlPoints = getColorStopsFromColors(values); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomGradientBar, { disableInserter: true, background: background, hasGradient: hasGradient, value: controlPoints, onChange: newColorStops => { const newValue = getColorsFromColorStops(newColorStops); onChange(newValue); } }); } ;// ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-picker.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * ```jsx * import { DuotonePicker, DuotoneSwatch } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const DUOTONE_PALETTE = [ * { colors: [ '#8c00b7', '#fcff41' ], name: 'Purple and yellow', slug: 'purple-yellow' }, * { colors: [ '#000097', '#ff4747' ], name: 'Blue and red', slug: 'blue-red' }, * ]; * * const COLOR_PALETTE = [ * { color: '#ff4747', name: 'Red', slug: 'red' }, * { color: '#fcff41', name: 'Yellow', slug: 'yellow' }, * { color: '#000097', name: 'Blue', slug: 'blue' }, * { color: '#8c00b7', name: 'Purple', slug: 'purple' }, * ]; * * const Example = () => { * const [ duotone, setDuotone ] = useState( [ '#000000', '#ffffff' ] ); * return ( * <> * <DuotonePicker * duotonePalette={ DUOTONE_PALETTE } * colorPalette={ COLOR_PALETTE } * value={ duotone } * onChange={ setDuotone } * /> * <DuotoneSwatch values={ duotone } /> * </> * ); * }; * ``` */ function DuotonePicker({ asButtons, loop, clearable = true, unsetable = true, colorPalette, duotonePalette, disableCustomColors, disableCustomDuotone, value, onChange, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, ...otherProps }) { const [defaultDark, defaultLight] = (0,external_wp_element_namespaceObject.useMemo)(() => getDefaultColors(colorPalette), [colorPalette]); const isUnset = value === 'unset'; const unsetOptionLabel = (0,external_wp_i18n_namespaceObject.__)('Unset'); const unsetOption = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.Option, { value: "unset", isSelected: isUnset, tooltipText: unsetOptionLabel, "aria-label": unsetOptionLabel, className: "components-duotone-picker__color-indicator", onClick: () => { onChange(isUnset ? undefined : 'unset'); } }, "unset"); const duotoneOptions = duotonePalette.map(({ colors, slug, name }) => { const style = { background: getGradientFromCSSColors(colors, '135deg'), color: 'transparent' }; const tooltipText = name !== null && name !== void 0 ? name : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: duotone code e.g: "dark-grayscale" or "7f7f7f-ffffff". (0,external_wp_i18n_namespaceObject.__)('Duotone code: %s'), slug); const label = name ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the option e.g: "Dark grayscale". (0,external_wp_i18n_namespaceObject.__)('Duotone: %s'), name) : tooltipText; const isSelected = es6_default()(colors, value); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.Option, { value: colors, isSelected: isSelected, "aria-label": label, tooltipText: tooltipText, style: style, onClick: () => { onChange(isSelected ? undefined : colors); } }, slug); }); const { metaProps, labelProps } = getComputeCircularOptionPickerCommonProps(asButtons, loop, ariaLabel, ariaLabelledby); const options = unsetable ? [unsetOption, ...duotoneOptions] : duotoneOptions; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker, { ...otherProps, ...metaProps, ...labelProps, options: options, actions: !!clearable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.ButtonAction, { onClick: () => onChange(undefined), accessibleWhenDisabled: true, disabled: !value, children: (0,external_wp_i18n_namespaceObject.__)('Clear') }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { paddingTop: options.length === 0 ? 0 : 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, { spacing: 3, children: [!disableCustomColors && !disableCustomDuotone && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDuotoneBar, { value: isUnset ? undefined : value, onChange: onChange }), !disableCustomDuotone && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_list_picker, { labels: [(0,external_wp_i18n_namespaceObject.__)('Shadows'), (0,external_wp_i18n_namespaceObject.__)('Highlights')], colors: colorPalette, value: isUnset ? undefined : value, disableCustomColors: disableCustomColors, enableAlpha: true, onChange: newColors => { if (!newColors[0]) { newColors[0] = defaultDark; } if (!newColors[1]) { newColors[1] = defaultLight; } const newValue = newColors.length >= 2 ? newColors : undefined; // @ts-expect-error TODO: The color arrays for a DuotonePicker should be a tuple of two colors, // but it's currently typed as a string[]. // See also https://github.com/WordPress/gutenberg/pull/49060#discussion_r1136951035 onChange(newValue); } })] }) }) }); } /* harmony default export */ const duotone_picker = (DuotonePicker); ;// ./node_modules/@wordpress/components/build-module/external-link/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedExternalLink(props, ref) { const { href, children, className, rel = '', ...additionalProps } = props; const optimizedRel = [...new Set([...rel.split(' '), 'external', 'noreferrer', 'noopener'].filter(Boolean))].join(' '); const classes = dist_clsx('components-external-link', className); /* Anchor links are perceived as external links. This constant helps check for on page anchor links, to prevent them from being opened in the editor. */ const isInternalAnchor = !!href?.startsWith('#'); const onClickHandler = event => { if (isInternalAnchor) { event.preventDefault(); } if (props.onClick) { props.onClick(event); } }; return /*#__PURE__*/ /* eslint-disable react/jsx-no-target-blank */(0,external_ReactJSXRuntime_namespaceObject.jsxs)("a", { ...additionalProps, className: classes, href: href, onClick: onClickHandler, target: "_blank", rel: optimizedRel, ref: ref, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-external-link__contents", children: children }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-external-link__icon", "aria-label": /* translators: accessibility text */ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'), children: "\u2197" })] }) /* eslint-enable react/jsx-no-target-blank */; } /** * Link to an external resource. * * ```jsx * import { ExternalLink } from '@wordpress/components'; * * const MyExternalLink = () => ( * <ExternalLink href="https://wordpress.org">WordPress.org</ExternalLink> * ); * ``` */ const ExternalLink = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedExternalLink); /* harmony default export */ const external_link = (ExternalLink); ;// ./node_modules/@wordpress/components/build-module/focal-point-picker/utils.js const INITIAL_BOUNDS = { width: 200, height: 170 }; const VIDEO_EXTENSIONS = ['avi', 'mpg', 'mpeg', 'mov', 'mp4', 'm4v', 'ogg', 'ogv', 'webm', 'wmv']; /** * Gets the extension of a file name. * * @param filename The file name. * @return The extension of the file name. */ function getExtension(filename = '') { const parts = filename.split('.'); return parts[parts.length - 1]; } /** * Checks if a file is a video. * * @param filename The file name. * @return Whether the file is a video. */ function isVideoType(filename = '') { if (!filename) { return false; } return filename.startsWith('data:video/') || VIDEO_EXTENSIONS.includes(getExtension(filename)); } /** * Transforms a fraction value to a percentage value. * * @param fraction The fraction value. * @return A percentage value. */ function fractionToPercentage(fraction) { return Math.round(fraction * 100); } ;// ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-picker-style.js function focal_point_picker_style_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const MediaWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeew7dm8" } : 0)( true ? { name: "jqnsxy", styles: "background-color:transparent;display:flex;text-align:center;width:100%" } : 0); const MediaContainer = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeew7dm7" } : 0)("align-items:center;border-radius:", config_values.radiusSmall, ";cursor:pointer;display:inline-flex;justify-content:center;margin:auto;position:relative;height:100%;&:after{border-radius:inherit;bottom:0;box-shadow:inset 0 0 0 1px rgba( 0, 0, 0, 0.1 );content:'';left:0;pointer-events:none;position:absolute;right:0;top:0;}img,video{border-radius:inherit;box-sizing:border-box;display:block;height:auto;margin:0;max-height:100%;max-width:100%;pointer-events:none;user-select:none;width:auto;}" + ( true ? "" : 0)); const MediaPlaceholder = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeew7dm6" } : 0)("background:", COLORS.gray[100], ";border-radius:inherit;box-sizing:border-box;height:", INITIAL_BOUNDS.height, "px;max-width:280px;min-width:", INITIAL_BOUNDS.width, "px;width:100%;" + ( true ? "" : 0)); const focal_point_picker_style_StyledUnitControl = /*#__PURE__*/emotion_styled_base_browser_esm(unit_control, true ? { target: "eeew7dm5" } : 0)( true ? { name: "1d3w5wq", styles: "width:100%" } : 0); var focal_point_picker_style_ref2 = true ? { name: "1mn7kwb", styles: "padding-bottom:1em" } : 0; const deprecatedBottomMargin = ({ __nextHasNoMarginBottom }) => { return !__nextHasNoMarginBottom ? focal_point_picker_style_ref2 : undefined; }; var focal_point_picker_style_ref = true ? { name: "1mn7kwb", styles: "padding-bottom:1em" } : 0; const extraHelpTextMargin = ({ hasHelpText = false }) => { return hasHelpText ? focal_point_picker_style_ref : undefined; }; const ControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? { target: "eeew7dm4" } : 0)("max-width:320px;padding-top:1em;", extraHelpTextMargin, " ", deprecatedBottomMargin, ";" + ( true ? "" : 0)); const GridView = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeew7dm3" } : 0)("left:50%;overflow:hidden;pointer-events:none;position:absolute;top:50%;transform:translate3d( -50%, -50%, 0 );z-index:1;@media not ( prefers-reduced-motion ){transition:opacity 100ms linear;}opacity:", ({ showOverlay }) => showOverlay ? 1 : 0, ";" + ( true ? "" : 0)); const GridLine = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeew7dm2" } : 0)( true ? { name: "1yzbo24", styles: "background:rgba( 255, 255, 255, 0.4 );backdrop-filter:blur( 16px ) saturate( 180% );position:absolute;transform:translateZ( 0 )" } : 0); const GridLineX = /*#__PURE__*/emotion_styled_base_browser_esm(GridLine, true ? { target: "eeew7dm1" } : 0)( true ? { name: "1sw8ur", styles: "height:1px;left:1px;right:1px" } : 0); const GridLineY = /*#__PURE__*/emotion_styled_base_browser_esm(GridLine, true ? { target: "eeew7dm0" } : 0)( true ? { name: "188vg4t", styles: "width:1px;top:1px;bottom:1px" } : 0); ;// ./node_modules/@wordpress/components/build-module/focal-point-picker/controls.js /** * WordPress dependencies */ /** * Internal dependencies */ const TEXTCONTROL_MIN = 0; const TEXTCONTROL_MAX = 100; const controls_noop = () => {}; function FocalPointPickerControls({ __nextHasNoMarginBottom, hasHelpText, onChange = controls_noop, point = { x: 0.5, y: 0.5 } }) { const valueX = fractionToPercentage(point.x); const valueY = fractionToPercentage(point.y); const handleChange = (value, axis) => { if (value === undefined) { return; } const num = parseInt(value, 10); if (!isNaN(num)) { onChange({ ...point, [axis]: num / 100 }); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ControlWrapper, { className: "focal-point-picker__controls", __nextHasNoMarginBottom: __nextHasNoMarginBottom, hasHelpText: hasHelpText, gap: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FocalPointUnitControl, { label: (0,external_wp_i18n_namespaceObject.__)('Left'), "aria-label": (0,external_wp_i18n_namespaceObject.__)('Focal point left position'), value: [valueX, '%'].join(''), onChange: next => handleChange(next, 'x'), dragDirection: "e" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FocalPointUnitControl, { label: (0,external_wp_i18n_namespaceObject.__)('Top'), "aria-label": (0,external_wp_i18n_namespaceObject.__)('Focal point top position'), value: [valueY, '%'].join(''), onChange: next => handleChange(next, 'y'), dragDirection: "s" })] }); } function FocalPointUnitControl(props) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(focal_point_picker_style_StyledUnitControl, { __next40pxDefaultSize: true, className: "focal-point-picker__controls-position-unit-control", labelPosition: "top", max: TEXTCONTROL_MAX, min: TEXTCONTROL_MIN, units: [{ value: '%', label: '%' }], ...props }); } ;// ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-style.js /** * External dependencies */ /** * Internal dependencies */ const PointerCircle = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e19snlhg0" } : 0)("background-color:transparent;cursor:grab;height:40px;margin:-20px 0 0 -20px;position:absolute;user-select:none;width:40px;will-change:transform;z-index:10000;background:rgba( 255, 255, 255, 0.4 );border:1px solid rgba( 255, 255, 255, 0.4 );border-radius:", config_values.radiusRound, ";backdrop-filter:blur( 16px ) saturate( 180% );box-shadow:rgb( 0 0 0 / 10% ) 0px 0px 8px;@media not ( prefers-reduced-motion ){transition:transform 100ms linear;}", ({ isDragging }) => isDragging && ` box-shadow: rgb( 0 0 0 / 12% ) 0px 0px 10px; transform: scale( 1.1 ); cursor: grabbing; `, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/focal-point-picker/focal-point.js /** * Internal dependencies */ /** * External dependencies */ function FocalPoint({ left = '50%', top = '50%', ...props }) { const style = { left, top }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PointerCircle, { ...props, className: "components-focal-point-picker__icon_container", style: style }); } ;// ./node_modules/@wordpress/components/build-module/focal-point-picker/grid.js /** * Internal dependencies */ function FocalPointPickerGrid({ bounds, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(GridView, { ...props, className: "components-focal-point-picker__grid", style: { width: bounds.width, height: bounds.height }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLineX, { style: { top: '33%' } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLineX, { style: { top: '66%' } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLineY, { style: { left: '33%' } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLineY, { style: { left: '66%' } })] }); } ;// ./node_modules/@wordpress/components/build-module/focal-point-picker/media.js /** * External dependencies */ /** * Internal dependencies */ function media_Media({ alt, autoPlay, src, onLoad, mediaRef, // Exposing muted prop for test rendering purposes // https://github.com/testing-library/react-testing-library/issues/470 muted = true, ...props }) { if (!src) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaPlaceholder, { className: "components-focal-point-picker__media components-focal-point-picker__media--placeholder", ref: mediaRef, ...props }); } const isVideo = isVideoType(src); return isVideo ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { ...props, autoPlay: autoPlay, className: "components-focal-point-picker__media components-focal-point-picker__media--video", loop: true, muted: muted, onLoadedData: onLoad, ref: mediaRef, src: src }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { ...props, alt: alt, className: "components-focal-point-picker__media components-focal-point-picker__media--image", onLoad: onLoad, ref: mediaRef, src: src }); } ;// ./node_modules/@wordpress/components/build-module/focal-point-picker/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const GRID_OVERLAY_TIMEOUT = 600; /** * Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image. * * This component addresses a specific problem: with large background images it is common to see undesirable crops, * especially when viewing on smaller viewports such as mobile phones. This component allows the selection of * the point with the most important visual information and returns it as a pair of numbers between 0 and 1. * This value can be easily converted into the CSS `background-position` attribute, and will ensure that the * focal point is never cropped out, regardless of viewport. * * - Example focal point picker value: `{ x: 0.5, y: 0.1 }` * - Corresponding CSS: `background-position: 50% 10%;` * * ```jsx * import { FocalPointPicker } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const Example = () => { * const [ focalPoint, setFocalPoint ] = useState( { * x: 0.5, * y: 0.5, * } ); * * const url = '/path/to/image'; * * // Example function to render the CSS styles based on Focal Point Picker value * const style = { * backgroundImage: `url(${ url })`, * backgroundPosition: `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`, * }; * * return ( * <> * <FocalPointPicker * __nextHasNoMarginBottom * url={ url } * value={ focalPoint } * onDragStart={ setFocalPoint } * onDrag={ setFocalPoint } * onChange={ setFocalPoint } * /> * <div style={ style } /> * </> * ); * }; * ``` */ function FocalPointPicker({ __nextHasNoMarginBottom, autoPlay = true, className, help, label, onChange, onDrag, onDragEnd, onDragStart, resolvePoint, url, value: valueProp = { x: 0.5, y: 0.5 }, ...restProps }) { const [point, setPoint] = (0,external_wp_element_namespaceObject.useState)(valueProp); const [showGridOverlay, setShowGridOverlay] = (0,external_wp_element_namespaceObject.useState)(false); const { startDrag, endDrag, isDragging } = (0,external_wp_compose_namespaceObject.__experimentalUseDragging)({ onDragStart: event => { dragAreaRef.current?.focus(); const value = getValueWithinDragArea(event); // `value` can technically be undefined if getValueWithinDragArea() is // called before dragAreaRef is set, but this shouldn't happen in reality. if (!value) { return; } onDragStart?.(value, event); setPoint(value); }, onDragMove: event => { // Prevents text-selection when dragging. event.preventDefault(); const value = getValueWithinDragArea(event); if (!value) { return; } onDrag?.(value, event); setPoint(value); }, onDragEnd: () => { onDragEnd?.(); onChange?.(point); } }); // Uses the internal point while dragging or else the value from props. const { x, y } = isDragging ? point : valueProp; const dragAreaRef = (0,external_wp_element_namespaceObject.useRef)(null); const [bounds, setBounds] = (0,external_wp_element_namespaceObject.useState)(INITIAL_BOUNDS); const refUpdateBounds = (0,external_wp_element_namespaceObject.useRef)(() => { if (!dragAreaRef.current) { return; } const { clientWidth: width, clientHeight: height } = dragAreaRef.current; // Falls back to initial bounds if the ref has no size. Since styles // give the drag area dimensions even when the media has not loaded // this should only happen in unit tests (jsdom). setBounds(width > 0 && height > 0 ? { width, height } : { ...INITIAL_BOUNDS }); }); (0,external_wp_element_namespaceObject.useEffect)(() => { const updateBounds = refUpdateBounds.current; if (!dragAreaRef.current) { return; } const { defaultView } = dragAreaRef.current.ownerDocument; defaultView?.addEventListener('resize', updateBounds); return () => defaultView?.removeEventListener('resize', updateBounds); }, []); // Updates the bounds to cover cases of unspecified media or load failures. (0,external_wp_compose_namespaceObject.useIsomorphicLayoutEffect)(() => void refUpdateBounds.current(), []); // TODO: Consider refactoring getValueWithinDragArea() into a pure function. // https://github.com/WordPress/gutenberg/pull/43872#discussion_r963455173 const getValueWithinDragArea = ({ clientX, clientY, shiftKey }) => { if (!dragAreaRef.current) { return; } const { top, left } = dragAreaRef.current.getBoundingClientRect(); let nextX = (clientX - left) / bounds.width; let nextY = (clientY - top) / bounds.height; // Enables holding shift to jump values by 10%. if (shiftKey) { nextX = Math.round(nextX / 0.1) * 0.1; nextY = Math.round(nextY / 0.1) * 0.1; } return getFinalValue({ x: nextX, y: nextY }); }; const getFinalValue = value => { var _resolvePoint; const resolvedValue = (_resolvePoint = resolvePoint?.(value)) !== null && _resolvePoint !== void 0 ? _resolvePoint : value; resolvedValue.x = Math.max(0, Math.min(resolvedValue.x, 1)); resolvedValue.y = Math.max(0, Math.min(resolvedValue.y, 1)); const roundToTwoDecimalPlaces = n => Math.round(n * 1e2) / 1e2; return { x: roundToTwoDecimalPlaces(resolvedValue.x), y: roundToTwoDecimalPlaces(resolvedValue.y) }; }; const arrowKeyStep = event => { const { code, shiftKey } = event; if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(code)) { return; } event.preventDefault(); const value = { x, y }; const step = shiftKey ? 0.1 : 0.01; const delta = code === 'ArrowUp' || code === 'ArrowLeft' ? -1 * step : step; const axis = code === 'ArrowUp' || code === 'ArrowDown' ? 'y' : 'x'; value[axis] = value[axis] + delta; onChange?.(getFinalValue(value)); }; const focalPointPosition = { left: x !== undefined ? x * bounds.width : 0.5 * bounds.width, top: y !== undefined ? y * bounds.height : 0.5 * bounds.height }; const classes = dist_clsx('components-focal-point-picker-control', className); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(FocalPointPicker); const id = `inspector-focal-point-picker-control-${instanceId}`; use_update_effect(() => { setShowGridOverlay(true); const timeout = window.setTimeout(() => { setShowGridOverlay(false); }, GRID_OVERLAY_TIMEOUT); return () => window.clearTimeout(timeout); }, [x, y]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(base_control, { ...restProps, __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "FocalPointPicker", label: label, id: id, help: help, className: classes, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaWrapper, { className: "components-focal-point-picker-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(MediaContainer, { className: "components-focal-point-picker", onKeyDown: arrowKeyStep, onMouseDown: startDrag, onBlur: () => { if (isDragging) { endDrag(); } }, ref: dragAreaRef, role: "button", tabIndex: -1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FocalPointPickerGrid, { bounds: bounds, showOverlay: showGridOverlay }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_Media, { alt: (0,external_wp_i18n_namespaceObject.__)('Media preview'), autoPlay: autoPlay, onLoad: refUpdateBounds.current, src: url }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FocalPoint, { ...focalPointPosition, isDragging: isDragging })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FocalPointPickerControls, { __nextHasNoMarginBottom: __nextHasNoMarginBottom, hasHelpText: !!help, point: { x, y }, onChange: value => { onChange?.(getFinalValue(value)); } })] }); } /* harmony default export */ const focal_point_picker = (FocalPointPicker); ;// ./node_modules/@wordpress/components/build-module/focusable-iframe/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function FocusableIframe({ iframeRef, ...props }) { const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]); external_wp_deprecated_default()('wp.components.FocusableIframe', { since: '5.9', alternative: 'wp.compose.useFocusableIframe' }); // Disable reason: The rendered iframe is a pass-through component, // assigning props inherited from the rendering parent. It's the // responsibility of the parent to assign a title. // eslint-disable-next-line jsx-a11y/iframe-has-title return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { ref: ref, ...props }); } ;// ./node_modules/@wordpress/components/build-module/font-size-picker/utils.js /** * Internal dependencies */ /** * Some themes use css vars for their font sizes, so until we * have the way of calculating them don't display them. * * @param value The value that is checked. * @return Whether the value is a simple css value. */ function isSimpleCssValue(value) { const sizeRegex = /^[\d\.]+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i; return sizeRegex.test(String(value)); } /** * If all of the given font sizes have the same unit (e.g. 'px'), return that * unit. Otherwise return null. * * @param fontSizes List of font sizes. * @return The common unit, or null. */ function getCommonSizeUnit(fontSizes) { const [firstFontSize, ...otherFontSizes] = fontSizes; if (!firstFontSize) { return null; } const [, firstUnit] = parseQuantityAndUnitFromRawValue(firstFontSize.size); const areAllSizesSameUnit = otherFontSizes.every(fontSize => { const [, unit] = parseQuantityAndUnitFromRawValue(fontSize.size); return unit === firstUnit; }); return areAllSizesSameUnit ? firstUnit : null; } ;// ./node_modules/@wordpress/components/build-module/font-size-picker/styles.js function font_size_picker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const styles_Container = /*#__PURE__*/emotion_styled_base_browser_esm("fieldset", true ? { target: "e8tqeku4" } : 0)( true ? { name: "k2q51s", styles: "border:0;margin:0;padding:0;display:contents" } : 0); const styles_Header = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? { target: "e8tqeku3" } : 0)("height:", space(4), ";" + ( true ? "" : 0)); const HeaderToggle = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? { target: "e8tqeku2" } : 0)("margin-top:", space(-1), ";" + ( true ? "" : 0)); const HeaderLabel = /*#__PURE__*/emotion_styled_base_browser_esm(base_control.VisualLabel, true ? { target: "e8tqeku1" } : 0)("display:flex;gap:", space(1), ";justify-content:flex-start;margin-bottom:0;" + ( true ? "" : 0)); const HeaderHint = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e8tqeku0" } : 0)("color:", COLORS.gray[700], ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/font-size-picker/font-size-picker-select.js /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_OPTION = { key: 'default', name: (0,external_wp_i18n_namespaceObject.__)('Default'), value: undefined }; const FontSizePickerSelect = props => { var _options$find; const { __next40pxDefaultSize, fontSizes, value, size, onChange } = props; const areAllSizesSameUnit = !!getCommonSizeUnit(fontSizes); const options = [DEFAULT_OPTION, ...fontSizes.map(fontSize => { let hint; if (areAllSizesSameUnit) { const [quantity] = parseQuantityAndUnitFromRawValue(fontSize.size); if (quantity !== undefined) { hint = String(quantity); } } else if (isSimpleCssValue(fontSize.size)) { hint = String(fontSize.size); } return { key: fontSize.slug, name: fontSize.name || fontSize.slug, value: fontSize.size, hint }; })]; const selectedOption = (_options$find = options.find(option => option.value === value)) !== null && _options$find !== void 0 ? _options$find : DEFAULT_OPTION; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(custom_select_control, { __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, className: "components-font-size-picker__select", label: (0,external_wp_i18n_namespaceObject.__)('Font size'), hideLabelFromVision: true, describedBy: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font size. (0,external_wp_i18n_namespaceObject.__)('Currently selected font size: %s'), selectedOption.name), options: options, value: selectedOption, showSelectedHint: true, onChange: ({ selectedItem }) => { onChange(selectedItem.value); }, size: size }); }; /* harmony default export */ const font_size_picker_select = (FontSizePickerSelect); ;// ./node_modules/@wordpress/components/build-module/font-size-picker/constants.js /** * WordPress dependencies */ /** * List of T-shirt abbreviations. * * When there are 5 font sizes or fewer, we assume that the font sizes are * ordered by size and show T-shirt labels. */ const T_SHIRT_ABBREVIATIONS = [/* translators: S stands for 'small' and is a size label. */ (0,external_wp_i18n_namespaceObject.__)('S'), /* translators: M stands for 'medium' and is a size label. */ (0,external_wp_i18n_namespaceObject.__)('M'), /* translators: L stands for 'large' and is a size label. */ (0,external_wp_i18n_namespaceObject.__)('L'), /* translators: XL stands for 'extra large' and is a size label. */ (0,external_wp_i18n_namespaceObject.__)('XL'), /* translators: XXL stands for 'extra extra large' and is a size label. */ (0,external_wp_i18n_namespaceObject.__)('XXL')]; /** * List of T-shirt names. * * When there are 5 font sizes or fewer, we assume that the font sizes are * ordered by size and show T-shirt labels. */ const T_SHIRT_NAMES = [(0,external_wp_i18n_namespaceObject.__)('Small'), (0,external_wp_i18n_namespaceObject.__)('Medium'), (0,external_wp_i18n_namespaceObject.__)('Large'), (0,external_wp_i18n_namespaceObject.__)('Extra Large'), (0,external_wp_i18n_namespaceObject.__)('Extra Extra Large')]; ;// ./node_modules/@wordpress/components/build-module/font-size-picker/font-size-picker-toggle-group.js /** * WordPress dependencies */ /** * Internal dependencies */ const FontSizePickerToggleGroup = props => { const { fontSizes, value, __next40pxDefaultSize, size, onChange } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_component, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Font size'), hideLabelFromVision: true, value: value, onChange: onChange, isBlock: true, size: size, children: fontSizes.map((fontSize, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_option_component, { value: fontSize.size, label: T_SHIRT_ABBREVIATIONS[index], "aria-label": fontSize.name || T_SHIRT_NAMES[index], showTooltip: true }, fontSize.slug)) }); }; /* harmony default export */ const font_size_picker_toggle_group = (FontSizePickerToggleGroup); ;// ./node_modules/@wordpress/components/build-module/font-size-picker/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_UNITS = ['px', 'em', 'rem', 'vw', 'vh']; const MAX_TOGGLE_GROUP_SIZES = 5; const UnforwardedFontSizePicker = (props, ref) => { const { __next40pxDefaultSize = false, fallbackFontSize, fontSizes = [], disableCustomFontSizes = false, onChange, size = 'default', units: unitsProp = DEFAULT_UNITS, value, withSlider = false, withReset = true } = props; const units = useCustomUnits({ availableUnits: unitsProp }); const selectedFontSize = fontSizes.find(fontSize => fontSize.size === value); const isCustomValue = !!value && !selectedFontSize; // Initially request a custom picker if the value is not from the predef list. const [userRequestedCustom, setUserRequestedCustom] = (0,external_wp_element_namespaceObject.useState)(isCustomValue); let currentPickerType; if (!disableCustomFontSizes && userRequestedCustom) { // While showing the custom value picker, switch back to predef only if // `disableCustomFontSizes` is set to `true`. currentPickerType = 'custom'; } else { currentPickerType = fontSizes.length > MAX_TOGGLE_GROUP_SIZES ? 'select' : 'togglegroup'; } const headerHint = (0,external_wp_element_namespaceObject.useMemo)(() => { switch (currentPickerType) { case 'custom': return (0,external_wp_i18n_namespaceObject.__)('Custom'); case 'togglegroup': if (selectedFontSize) { return selectedFontSize.name || T_SHIRT_NAMES[fontSizes.indexOf(selectedFontSize)]; } break; case 'select': const commonUnit = getCommonSizeUnit(fontSizes); if (commonUnit) { return `(${commonUnit})`; } break; } return ''; }, [currentPickerType, selectedFontSize, fontSizes]); if (fontSizes.length === 0 && disableCustomFontSizes) { return null; } // If neither the value or first font size is a string, then FontSizePicker // operates in a legacy "unitless" mode where UnitControl can only be used // to select px values and onChange() is always called with number values. const hasUnits = typeof value === 'string' || typeof fontSizes[0]?.size === 'string'; const [valueQuantity, valueUnit] = parseQuantityAndUnitFromRawValue(value, units); const isValueUnitRelative = !!valueUnit && ['em', 'rem', 'vw', 'vh'].includes(valueUnit); const isDisabled = value === undefined; maybeWarnDeprecated36pxSize({ componentName: 'FontSizePicker', __next40pxDefaultSize, size }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(styles_Container, { ref: ref, className: "components-font-size-picker", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Font size') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(styles_Header, { className: "components-font-size-picker__header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(HeaderLabel, { "aria-label": `${(0,external_wp_i18n_namespaceObject.__)('Size')} ${headerHint || ''}`, children: [(0,external_wp_i18n_namespaceObject.__)('Size'), headerHint && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HeaderHint, { className: "components-font-size-picker__header__hint", children: headerHint })] }), !disableCustomFontSizes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HeaderToggle, { label: currentPickerType === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'), icon: library_settings, onClick: () => setUserRequestedCustom(!userRequestedCustom), isPressed: currentPickerType === 'custom', size: "small" })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [currentPickerType === 'select' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_picker_select, { __next40pxDefaultSize: __next40pxDefaultSize, fontSizes: fontSizes, value: value, disableCustomFontSizes: disableCustomFontSizes, size: size, onChange: newValue => { if (newValue === undefined) { onChange?.(undefined); } else { onChange?.(hasUnits ? newValue : Number(newValue), fontSizes.find(fontSize => fontSize.size === newValue)); } }, onSelectCustom: () => setUserRequestedCustom(true) }), currentPickerType === 'togglegroup' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_picker_toggle_group, { fontSizes: fontSizes, value: value, __next40pxDefaultSize: __next40pxDefaultSize, size: size, onChange: newValue => { if (newValue === undefined) { onChange?.(undefined); } else { onChange?.(hasUnits ? newValue : Number(newValue), fontSizes.find(fontSize => fontSize.size === newValue)); } } }), currentPickerType === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(flex_component, { className: "components-font-size-picker__custom-size-control", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_item_component, { isBlock: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(unit_control, { __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Custom'), labelPosition: "top", hideLabelFromVision: true, value: value, onChange: newValue => { setUserRequestedCustom(true); if (newValue === undefined) { onChange?.(undefined); } else { onChange?.(hasUnits ? newValue : parseInt(newValue, 10)); } }, size: size, units: hasUnits ? units : [], min: 0 }) }), withSlider && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_item_component, { isBlock: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { marginX: 2, marginBottom: 0, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(range_control, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, className: "components-font-size-picker__custom-input", label: (0,external_wp_i18n_namespaceObject.__)('Custom Size'), hideLabelFromVision: true, value: valueQuantity, initialPosition: fallbackFontSize, withInputField: false, onChange: newValue => { setUserRequestedCustom(true); if (newValue === undefined) { onChange?.(undefined); } else if (hasUnits) { onChange?.(newValue + (valueUnit !== null && valueUnit !== void 0 ? valueUnit : 'px')); } else { onChange?.(newValue); } }, min: 0, max: isValueUnitRelative ? 10 : 100, step: isValueUnitRelative ? 0.1 : 1 }) }) }), withReset && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_item_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Button, { disabled: isDisabled, accessibleWhenDisabled: true, onClick: () => { onChange?.(undefined); }, variant: "secondary", __next40pxDefaultSize: true, size: size === '__unstable-large' || props.__next40pxDefaultSize ? 'default' : 'small', children: (0,external_wp_i18n_namespaceObject.__)('Reset') }) })] })] })] }); }; const FontSizePicker = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedFontSizePicker); /* harmony default export */ const font_size_picker = (FontSizePicker); ;// ./node_modules/@wordpress/components/build-module/form-file-upload/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * FormFileUpload allows users to select files from their local device. * * ```jsx * import { FormFileUpload } from '@wordpress/components'; * * const MyFormFileUpload = () => ( * <FormFileUpload * __next40pxDefaultSize * accept="image/*" * onChange={ ( event ) => console.log( event.currentTarget.files ) } * > * Upload * </FormFileUpload> * ); * ``` */ function FormFileUpload({ accept, children, multiple = false, onChange, onClick, render, ...props }) { const ref = (0,external_wp_element_namespaceObject.useRef)(null); const openFileDialog = () => { ref.current?.click(); }; if (!render) { maybeWarnDeprecated36pxSize({ componentName: 'FormFileUpload', __next40pxDefaultSize: props.__next40pxDefaultSize, // @ts-expect-error - We don't "officially" support all Button props but this likely happens. size: props.size }); } const ui = render ? render({ openFileDialog }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { onClick: openFileDialog, ...props, children: children }); // @todo: Temporary fix a bug that prevents Chromium browsers from selecting ".heic" files // from the file upload. See https://core.trac.wordpress.org/ticket/62268#comment:4. // This can be removed once the Chromium fix is in the stable channel. // Prevent Safari from adding "image/heic" and "image/heif" to the accept attribute. const isSafari = globalThis.window?.navigator.userAgent.includes('Safari') && !globalThis.window?.navigator.userAgent.includes('Chrome') && !globalThis.window?.navigator.userAgent.includes('Chromium'); const compatAccept = !isSafari && !!accept?.includes('image/*') ? `${accept}, image/heic, image/heif` : accept; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-form-file-upload", children: [ui, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { type: "file", ref: ref, multiple: multiple, style: { display: 'none' }, accept: compatAccept, onChange: onChange, onClick: onClick, "data-testid": "form-file-upload-input" })] }); } /* harmony default export */ const form_file_upload = (FormFileUpload); ;// ./node_modules/@wordpress/components/build-module/form-toggle/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const form_toggle_noop = () => {}; function UnforwardedFormToggle(props, ref) { const { className, checked, id, disabled, onChange = form_toggle_noop, ...additionalProps } = props; const wrapperClasses = dist_clsx('components-form-toggle', className, { 'is-checked': checked, 'is-disabled': disabled }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: wrapperClasses, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { className: "components-form-toggle__input", id: id, type: "checkbox", checked: checked, onChange: onChange, disabled: disabled, ...additionalProps, ref: ref }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-form-toggle__track" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-form-toggle__thumb" })] }); } /** * FormToggle switches a single setting on or off. * * ```jsx * import { FormToggle } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyFormToggle = () => { * const [ isChecked, setChecked ] = useState( true ); * * return ( * <FormToggle * checked={ isChecked } * onChange={ () => setChecked( ( state ) => ! state ) } * /> * ); * }; * ``` */ const FormToggle = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedFormToggle); /* harmony default export */ const form_toggle = (FormToggle); ;// ./node_modules/@wordpress/components/build-module/form-token-field/token.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const token_noop = () => {}; function Token({ value, status, title, displayTransform, isBorderless = false, disabled = false, onClickRemove = token_noop, onMouseEnter, onMouseLeave, messages, termPosition, termsCount }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Token); const tokenClasses = dist_clsx('components-form-token-field__token', { 'is-error': 'error' === status, 'is-success': 'success' === status, 'is-validating': 'validating' === status, 'is-borderless': isBorderless, 'is-disabled': disabled }); const onClick = () => onClickRemove({ value }); const transformedValue = displayTransform(value); const termPositionAndCount = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */ (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s of %3$s)'), transformedValue, termPosition, termsCount); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: tokenClasses, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, title: title, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "components-form-token-field__token-text", id: `components-form-token-field__token-text-${instanceId}`, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "span", children: termPositionAndCount }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-hidden": "true", children: transformedValue })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { className: "components-form-token-field__remove-token", size: "small", icon: close_small, onClick: !disabled ? onClick : undefined // Disable reason: Even when FormTokenField itself is accessibly disabled, token reset buttons shouldn't be in the tab sequence. // eslint-disable-next-line no-restricted-syntax , disabled: disabled, label: messages.remove, "aria-describedby": `components-form-token-field__token-text-${instanceId}` })] }); } ;// ./node_modules/@wordpress/components/build-module/form-token-field/styles.js /** * External dependencies */ /** * Internal dependencies */ const deprecatedPaddings = ({ __next40pxDefaultSize, hasTokens }) => !__next40pxDefaultSize && /*#__PURE__*/emotion_react_browser_esm_css("padding-top:", space(hasTokens ? 1 : 0.5), ";padding-bottom:", space(hasTokens ? 1 : 0.5), ";" + ( true ? "" : 0), true ? "" : 0); const TokensAndInputWrapperFlex = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? { target: "ehq8nmi0" } : 0)("padding:7px;", boxSizingReset, " ", deprecatedPaddings, ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/form-token-field/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const form_token_field_identity = value => value; /** * A `FormTokenField` is a field similar to the tags and categories fields in the interim editor chrome, * or the "to" field in Mail on OS X. Tokens can be entered by typing them or selecting them from a list of suggested tokens. * * Up to one hundred suggestions that match what the user has typed so far will be shown from which the user can pick from (auto-complete). * Tokens are separated by the "," character. Suggestions can be selected with the up or down arrows and added with the tab or enter key. * * The `value` property is handled in a manner similar to controlled form components. * See [Forms](https://react.dev/reference/react-dom/components#form-components) in the React Documentation for more information. */ function FormTokenField(props) { const { autoCapitalize, autoComplete, maxLength, placeholder, label = (0,external_wp_i18n_namespaceObject.__)('Add item'), className, suggestions = [], maxSuggestions = 100, value = [], displayTransform = form_token_field_identity, saveTransform = token => token.trim(), onChange = () => {}, onInputChange = () => {}, onFocus = undefined, isBorderless = false, disabled = false, tokenizeOnSpace = false, messages = { added: (0,external_wp_i18n_namespaceObject.__)('Item added.'), removed: (0,external_wp_i18n_namespaceObject.__)('Item removed.'), remove: (0,external_wp_i18n_namespaceObject.__)('Remove item'), __experimentalInvalid: (0,external_wp_i18n_namespaceObject.__)('Invalid item') }, __experimentalRenderItem, __experimentalExpandOnFocus = false, __experimentalValidateInput = () => true, __experimentalShowHowTo = true, __next40pxDefaultSize = false, __experimentalAutoSelectFirstMatch = false, __nextHasNoMarginBottom = false, tokenizeOnBlur = false } = useDeprecated36pxDefaultSizeProp(props); if (!__nextHasNoMarginBottom) { external_wp_deprecated_default()('Bottom margin styles for wp.components.FormTokenField', { since: '6.7', version: '7.0', hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.' }); } maybeWarnDeprecated36pxSize({ componentName: 'FormTokenField', size: undefined, __next40pxDefaultSize }); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(FormTokenField); // We reset to these initial values again in the onBlur const [incompleteTokenValue, setIncompleteTokenValue] = (0,external_wp_element_namespaceObject.useState)(''); const [inputOffsetFromEnd, setInputOffsetFromEnd] = (0,external_wp_element_namespaceObject.useState)(0); const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false); const [isExpanded, setIsExpanded] = (0,external_wp_element_namespaceObject.useState)(false); const [selectedSuggestionIndex, setSelectedSuggestionIndex] = (0,external_wp_element_namespaceObject.useState)(-1); const [selectedSuggestionScroll, setSelectedSuggestionScroll] = (0,external_wp_element_namespaceObject.useState)(false); const prevSuggestions = (0,external_wp_compose_namespaceObject.usePrevious)(suggestions); const prevValue = (0,external_wp_compose_namespaceObject.usePrevious)(value); const input = (0,external_wp_element_namespaceObject.useRef)(null); const tokensAndInput = (0,external_wp_element_namespaceObject.useRef)(null); const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); (0,external_wp_element_namespaceObject.useEffect)(() => { // Make sure to focus the input when the isActive state is true. if (isActive && !hasFocus()) { focus(); } }, [isActive]); (0,external_wp_element_namespaceObject.useEffect)(() => { const suggestionsDidUpdate = !external_wp_isShallowEqual_default()(suggestions, prevSuggestions || []); if (suggestionsDidUpdate || value !== prevValue) { updateSuggestions(suggestionsDidUpdate); } // TODO: updateSuggestions() should first be refactored so its actual deps are clearer. }, [suggestions, prevSuggestions, value, prevValue]); (0,external_wp_element_namespaceObject.useEffect)(() => { updateSuggestions(); }, [incompleteTokenValue]); (0,external_wp_element_namespaceObject.useEffect)(() => { updateSuggestions(); }, [__experimentalAutoSelectFirstMatch]); if (disabled && isActive) { setIsActive(false); setIncompleteTokenValue(''); } function focus() { input.current?.focus(); } function hasFocus() { return input.current === input.current?.ownerDocument.activeElement; } function onFocusHandler(event) { // If focus is on the input or on the container, set the isActive state to true. if (hasFocus() || event.target === tokensAndInput.current) { setIsActive(true); setIsExpanded(__experimentalExpandOnFocus || isExpanded); } else { /* * Otherwise, focus is on one of the token "remove" buttons and we * set the isActive state to false to prevent the input to be * re-focused, see componentDidUpdate(). */ setIsActive(false); } if ('function' === typeof onFocus) { onFocus(event); } } function onBlur(event) { if (inputHasValidValue() && __experimentalValidateInput(incompleteTokenValue)) { setIsActive(false); if (tokenizeOnBlur && inputHasValidValue()) { addNewToken(incompleteTokenValue); } } else { // Reset to initial state setIncompleteTokenValue(''); setInputOffsetFromEnd(0); setIsActive(false); if (__experimentalExpandOnFocus) { // If `__experimentalExpandOnFocus` is true, don't close the suggestions list when // the user clicks on it (`tokensAndInput` will be the element that caused the blur). const hasFocusWithin = event.relatedTarget === tokensAndInput.current; setIsExpanded(hasFocusWithin); } else { // Else collapse the suggestion list. This will result in the suggestion list closing // after a suggestion has been submitted since that causes a blur. setIsExpanded(false); } setSelectedSuggestionIndex(-1); setSelectedSuggestionScroll(false); } } function onKeyDown(event) { let preventDefault = false; if (event.defaultPrevented) { return; } switch (event.key) { case 'Backspace': preventDefault = handleDeleteKey(deleteTokenBeforeInput); break; case 'Enter': preventDefault = addCurrentToken(); break; case 'ArrowLeft': preventDefault = handleLeftArrowKey(); break; case 'ArrowUp': preventDefault = handleUpArrowKey(); break; case 'ArrowRight': preventDefault = handleRightArrowKey(); break; case 'ArrowDown': preventDefault = handleDownArrowKey(); break; case 'Delete': preventDefault = handleDeleteKey(deleteTokenAfterInput); break; case 'Space': if (tokenizeOnSpace) { preventDefault = addCurrentToken(); } break; case 'Escape': preventDefault = handleEscapeKey(event); break; default: break; } if (preventDefault) { event.preventDefault(); } } function onKeyPress(event) { let preventDefault = false; switch (event.key) { case ',': preventDefault = handleCommaKey(); break; default: break; } if (preventDefault) { event.preventDefault(); } } function onContainerTouched(event) { // Prevent clicking/touching the tokensAndInput container from blurring // the input and adding the current token. if (event.target === tokensAndInput.current && isActive) { event.preventDefault(); } } function onTokenClickRemove(event) { deleteToken(event.value); focus(); } function onSuggestionHovered(suggestion) { const index = getMatchingSuggestions().indexOf(suggestion); if (index >= 0) { setSelectedSuggestionIndex(index); setSelectedSuggestionScroll(false); } } function onSuggestionSelected(suggestion) { addNewToken(suggestion); } function onInputChangeHandler(event) { const text = event.value; const separator = tokenizeOnSpace ? /[ ,\t]+/ : /[,\t]+/; const items = text.split(separator); const tokenValue = items[items.length - 1] || ''; if (items.length > 1) { addNewTokens(items.slice(0, -1)); } setIncompleteTokenValue(tokenValue); onInputChange(tokenValue); } function handleDeleteKey(_deleteToken) { let preventDefault = false; if (hasFocus() && isInputEmpty()) { _deleteToken(); preventDefault = true; } return preventDefault; } function handleLeftArrowKey() { let preventDefault = false; if (isInputEmpty()) { moveInputBeforePreviousToken(); preventDefault = true; } return preventDefault; } function handleRightArrowKey() { let preventDefault = false; if (isInputEmpty()) { moveInputAfterNextToken(); preventDefault = true; } return preventDefault; } function handleUpArrowKey() { setSelectedSuggestionIndex(index => { return (index === 0 ? getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length : index) - 1; }); setSelectedSuggestionScroll(true); return true; // PreventDefault. } function handleDownArrowKey() { setSelectedSuggestionIndex(index => { return (index + 1) % getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length; }); setSelectedSuggestionScroll(true); return true; // PreventDefault. } function handleEscapeKey(event) { if (event.target instanceof HTMLInputElement) { setIncompleteTokenValue(event.target.value); setIsExpanded(false); setSelectedSuggestionIndex(-1); setSelectedSuggestionScroll(false); } return true; // PreventDefault. } function handleCommaKey() { if (inputHasValidValue()) { addNewToken(incompleteTokenValue); } return true; // PreventDefault. } function moveInputToIndex(index) { setInputOffsetFromEnd(value.length - Math.max(index, -1) - 1); } function moveInputBeforePreviousToken() { setInputOffsetFromEnd(prevInputOffsetFromEnd => { return Math.min(prevInputOffsetFromEnd + 1, value.length); }); } function moveInputAfterNextToken() { setInputOffsetFromEnd(prevInputOffsetFromEnd => { return Math.max(prevInputOffsetFromEnd - 1, 0); }); } function deleteTokenBeforeInput() { const index = getIndexOfInput() - 1; if (index > -1) { deleteToken(value[index]); } } function deleteTokenAfterInput() { const index = getIndexOfInput(); if (index < value.length) { deleteToken(value[index]); // Update input offset since it's the offset from the last token. moveInputToIndex(index); } } function addCurrentToken() { let preventDefault = false; const selectedSuggestion = getSelectedSuggestion(); if (selectedSuggestion) { addNewToken(selectedSuggestion); preventDefault = true; } else if (inputHasValidValue()) { addNewToken(incompleteTokenValue); preventDefault = true; } return preventDefault; } function addNewTokens(tokens) { const tokensToAdd = [...new Set(tokens.map(saveTransform).filter(Boolean).filter(token => !valueContainsToken(token)))]; if (tokensToAdd.length > 0) { const newValue = [...value]; newValue.splice(getIndexOfInput(), 0, ...tokensToAdd); onChange(newValue); } } function addNewToken(token) { if (!__experimentalValidateInput(token)) { (0,external_wp_a11y_namespaceObject.speak)(messages.__experimentalInvalid, 'assertive'); return; } addNewTokens([token]); (0,external_wp_a11y_namespaceObject.speak)(messages.added, 'assertive'); setIncompleteTokenValue(''); setSelectedSuggestionIndex(-1); setSelectedSuggestionScroll(false); setIsExpanded(!__experimentalExpandOnFocus); if (isActive && !tokenizeOnBlur) { focus(); } } function deleteToken(token) { const newTokens = value.filter(item => { return getTokenValue(item) !== getTokenValue(token); }); onChange(newTokens); (0,external_wp_a11y_namespaceObject.speak)(messages.removed, 'assertive'); } function getTokenValue(token) { if ('object' === typeof token) { return token.value; } return token; } function getMatchingSuggestions(searchValue = incompleteTokenValue, _suggestions = suggestions, _value = value, _maxSuggestions = maxSuggestions, _saveTransform = saveTransform) { let match = _saveTransform(searchValue); const startsWithMatch = []; const containsMatch = []; const normalizedValue = _value.map(item => { if (typeof item === 'string') { return item; } return item.value; }); if (match.length === 0) { _suggestions = _suggestions.filter(suggestion => !normalizedValue.includes(suggestion)); } else { match = match.toLocaleLowerCase(); _suggestions.forEach(suggestion => { const index = suggestion.toLocaleLowerCase().indexOf(match); if (normalizedValue.indexOf(suggestion) === -1) { if (index === 0) { startsWithMatch.push(suggestion); } else if (index > 0) { containsMatch.push(suggestion); } } }); _suggestions = startsWithMatch.concat(containsMatch); } return _suggestions.slice(0, _maxSuggestions); } function getSelectedSuggestion() { if (selectedSuggestionIndex !== -1) { return getMatchingSuggestions()[selectedSuggestionIndex]; } return undefined; } function valueContainsToken(token) { return value.some(item => { return getTokenValue(token) === getTokenValue(item); }); } function getIndexOfInput() { return value.length - inputOffsetFromEnd; } function isInputEmpty() { return incompleteTokenValue.length === 0; } function inputHasValidValue() { return saveTransform(incompleteTokenValue).length > 0; } function updateSuggestions(resetSelectedSuggestion = true) { const inputHasMinimumChars = incompleteTokenValue.trim().length > 1; const matchingSuggestions = getMatchingSuggestions(incompleteTokenValue); const hasMatchingSuggestions = matchingSuggestions.length > 0; const shouldExpandIfFocuses = hasFocus() && __experimentalExpandOnFocus; setIsExpanded(shouldExpandIfFocuses || inputHasMinimumChars && hasMatchingSuggestions); if (resetSelectedSuggestion) { if (__experimentalAutoSelectFirstMatch && inputHasMinimumChars && hasMatchingSuggestions) { setSelectedSuggestionIndex(0); setSelectedSuggestionScroll(true); } else { setSelectedSuggestionIndex(-1); setSelectedSuggestionScroll(false); } } if (inputHasMinimumChars) { const message = hasMatchingSuggestions ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : (0,external_wp_i18n_namespaceObject.__)('No results.'); debouncedSpeak(message, 'assertive'); } } function renderTokensAndInput() { const components = value.map(renderToken); components.splice(getIndexOfInput(), 0, renderInput()); return components; } function renderToken(token, index, tokens) { const _value = getTokenValue(token); const status = typeof token !== 'string' ? token.status : undefined; const termPosition = index + 1; const termsCount = tokens.length; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_item_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Token, { value: _value, status: status, title: typeof token !== 'string' ? token.title : undefined, displayTransform: displayTransform, onClickRemove: onTokenClickRemove, isBorderless: typeof token !== 'string' && token.isBorderless || isBorderless, onMouseEnter: typeof token !== 'string' ? token.onMouseEnter : undefined, onMouseLeave: typeof token !== 'string' ? token.onMouseLeave : undefined, disabled: 'error' !== status && disabled, messages: messages, termsCount: termsCount, termPosition: termPosition }) }, 'token-' + _value); } function renderInput() { const inputProps = { instanceId, autoCapitalize, autoComplete, placeholder: value.length === 0 ? placeholder : '', disabled, value: incompleteTokenValue, onBlur, isExpanded, selectedSuggestionIndex }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(token_input, { ...inputProps, onChange: !(maxLength && value.length >= maxLength) ? onInputChangeHandler : undefined, ref: input }, "input"); } const classes = dist_clsx(className, 'components-form-token-field__input-container', { 'is-active': isActive, 'is-disabled': disabled }); let tokenFieldProps = { className: 'components-form-token-field', tabIndex: -1 }; const matchingSuggestions = getMatchingSuggestions(); if (!disabled) { tokenFieldProps = Object.assign({}, tokenFieldProps, { onKeyDown: withIgnoreIMEEvents(onKeyDown), onKeyPress, onFocus: onFocusHandler }); } // Disable reason: There is no appropriate role which describes the // input container intended accessible usability. // TODO: Refactor click detection to use blur to stop propagation. /* eslint-disable jsx-a11y/no-static-element-interactions */ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...tokenFieldProps, children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledLabel, { htmlFor: `components-form-token-input-${instanceId}`, className: "components-form-token-field__label", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: tokensAndInput, className: classes, tabIndex: -1, onMouseDown: onContainerTouched, onTouchStart: onContainerTouched, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TokensAndInputWrapperFlex, { justify: "flex-start", align: "center", gap: 1, wrap: true, __next40pxDefaultSize: __next40pxDefaultSize, hasTokens: !!value.length, children: renderTokensAndInput() }), isExpanded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(suggestions_list, { instanceId: instanceId, match: saveTransform(incompleteTokenValue), displayTransform: displayTransform, suggestions: matchingSuggestions, selectedIndex: selectedSuggestionIndex, scrollIntoView: selectedSuggestionScroll, onHover: onSuggestionHovered, onSelect: onSuggestionSelected, __experimentalRenderItem: __experimentalRenderItem })] }), !__nextHasNoMarginBottom && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { marginBottom: 2 }), __experimentalShowHowTo && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledHelp, { id: `components-form-token-suggestions-howto-${instanceId}`, className: "components-form-token-field__help", __nextHasNoMarginBottom: __nextHasNoMarginBottom, children: tokenizeOnSpace ? (0,external_wp_i18n_namespaceObject.__)('Separate with commas, spaces, or the Enter key.') : (0,external_wp_i18n_namespaceObject.__)('Separate with commas or the Enter key.') })] }); /* eslint-enable jsx-a11y/no-static-element-interactions */ } /* harmony default export */ const form_token_field = (FormTokenField); ;// ./node_modules/@wordpress/components/build-module/guide/icons.js /** * WordPress dependencies */ const PageControlIcon = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "8", height: "8", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Circle, { cx: "4", cy: "4", r: "4" }) }); ;// ./node_modules/@wordpress/components/build-module/guide/page-control.js /** * WordPress dependencies */ /** * Internal dependencies */ function PageControl({ currentPage, numberOfPages, setCurrentPage }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "components-guide__page-control", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Guide controls'), children: Array.from({ length: numberOfPages }).map((_, page) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { // Set aria-current="step" on the active page, see https://www.w3.org/TR/wai-aria-1.1/#aria-current "aria-current": page === currentPage ? 'step' : undefined, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { size: "small", icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageControlIcon, {}), "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: current page number 2: total number of pages */ (0,external_wp_i18n_namespaceObject.__)('Page %1$d of %2$d'), page + 1, numberOfPages), onClick: () => setCurrentPage(page) }, page) }, page)) }); } ;// ./node_modules/@wordpress/components/build-module/guide/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * `Guide` is a React component that renders a _user guide_ in a modal. The guide consists of several pages which the user can step through one by one. The guide is finished when the modal is closed or when the user clicks _Finish_ on the last page of the guide. * * ```jsx * function MyTutorial() { * const [ isOpen, setIsOpen ] = useState( true ); * * if ( ! isOpen ) { * return null; * } * * return ( * <Guide * onFinish={ () => setIsOpen( false ) } * pages={ [ * { * content: <p>Welcome to the ACME Store!</p>, * }, * { * image: <img src="https://acmestore.com/add-to-cart.png" />, * content: ( * <p> * Click <i>Add to Cart</i> to buy a product. * </p> * ), * }, * ] } * /> * ); * } * ``` */ function Guide({ children, className, contentLabel, finishButtonText = (0,external_wp_i18n_namespaceObject.__)('Finish'), onFinish, pages = [] }) { const ref = (0,external_wp_element_namespaceObject.useRef)(null); const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(0); (0,external_wp_element_namespaceObject.useEffect)(() => { // Place focus at the top of the guide on mount and when the page changes. const frame = ref.current?.querySelector('.components-guide'); if (frame instanceof HTMLElement) { frame.focus(); } }, [currentPage]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (external_wp_element_namespaceObject.Children.count(children)) { external_wp_deprecated_default()('Passing children to <Guide>', { since: '5.5', alternative: 'the `pages` prop' }); } }, [children]); if (external_wp_element_namespaceObject.Children.count(children)) { var _Children$map; pages = (_Children$map = external_wp_element_namespaceObject.Children.map(children, child => ({ content: child }))) !== null && _Children$map !== void 0 ? _Children$map : []; } const canGoBack = currentPage > 0; const canGoForward = currentPage < pages.length - 1; const goBack = () => { if (canGoBack) { setCurrentPage(currentPage - 1); } }; const goForward = () => { if (canGoForward) { setCurrentPage(currentPage + 1); } }; if (pages.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(modal, { className: dist_clsx('components-guide', className), contentLabel: contentLabel, isDismissible: pages.length > 1, onRequestClose: onFinish, onKeyDown: event => { if (event.code === 'ArrowLeft') { goBack(); // Do not scroll the modal's contents. event.preventDefault(); } else if (event.code === 'ArrowRight') { goForward(); // Do not scroll the modal's contents. event.preventDefault(); } }, ref: ref, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-guide__container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-guide__page", children: [pages[currentPage].image, pages.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageControl, { currentPage: currentPage, numberOfPages: pages.length, setCurrentPage: setCurrentPage }), pages[currentPage].content] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-guide__footer", children: [canGoBack && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { className: "components-guide__back-button", variant: "tertiary", onClick: goBack, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Previous') }), canGoForward && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { className: "components-guide__forward-button", variant: "primary", onClick: goForward, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Next') }), !canGoForward && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { className: "components-guide__finish-button", variant: "primary", onClick: onFinish, __next40pxDefaultSize: true, children: finishButtonText })] })] }) }); } /* harmony default export */ const guide = (Guide); ;// ./node_modules/@wordpress/components/build-module/guide/page.js /** * WordPress dependencies */ /** * Internal dependencies */ function GuidePage(props) { (0,external_wp_element_namespaceObject.useEffect)(() => { external_wp_deprecated_default()('<GuidePage>', { since: '5.5', alternative: 'the `pages` prop in <Guide>' }); }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props }); } ;// ./node_modules/@wordpress/components/build-module/button/deprecated.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedIconButton({ label, labelPosition, size, tooltip, ...props }, ref) { external_wp_deprecated_default()('wp.components.IconButton', { since: '5.4', alternative: 'wp.components.Button', version: '6.2' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { ...props, ref: ref, tooltipPosition: labelPosition, iconSize: size, showTooltip: tooltip !== undefined ? !!tooltip : undefined, label: tooltip || label }); } /* harmony default export */ const deprecated = ((0,external_wp_element_namespaceObject.forwardRef)(UnforwardedIconButton)); ;// ./node_modules/@wordpress/components/build-module/keyboard-shortcuts/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function KeyboardShortcut({ target, callback, shortcut, bindGlobal, eventName }) { (0,external_wp_compose_namespaceObject.useKeyboardShortcut)(shortcut, callback, { bindGlobal, target, eventName }); return null; } /** * `KeyboardShortcuts` is a component which handles keyboard sequences during the lifetime of the rendering element. * * When passed children, it will capture key events which occur on or within the children. If no children are passed, events are captured on the document. * * It uses the [Mousetrap](https://craig.is/killing/mice) library to implement keyboard sequence bindings. * * ```jsx * import { KeyboardShortcuts } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyKeyboardShortcuts = () => { * const [ isAllSelected, setIsAllSelected ] = useState( false ); * const selectAll = () => { * setIsAllSelected( true ); * }; * * return ( * <div> * <KeyboardShortcuts * shortcuts={ { * 'mod+a': selectAll, * } } * /> * [cmd/ctrl + A] Combination pressed? { isAllSelected ? 'Yes' : 'No' } * </div> * ); * }; * ``` */ function KeyboardShortcuts({ children, shortcuts, bindGlobal, eventName }) { const target = (0,external_wp_element_namespaceObject.useRef)(null); const element = Object.entries(shortcuts !== null && shortcuts !== void 0 ? shortcuts : {}).map(([shortcut, callback]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyboardShortcut, { shortcut: shortcut, callback: callback, bindGlobal: bindGlobal, eventName: eventName, target: target }, shortcut)); // Render as non-visual if there are no children pressed. Keyboard // events will be bound to the document instead. if (!external_wp_element_namespaceObject.Children.count(children)) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: element }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: target, children: [element, children] }); } /* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); ;// ./node_modules/@wordpress/components/build-module/menu-group/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * `MenuGroup` wraps a series of related `MenuItem` components into a common * section. * * ```jsx * import { MenuGroup, MenuItem } from '@wordpress/components'; * * const MyMenuGroup = () => ( * <MenuGroup label="Settings"> * <MenuItem>Setting 1</MenuItem> * <MenuItem>Setting 2</MenuItem> * </MenuGroup> * ); * ``` */ function MenuGroup(props) { const { children, className = '', label, hideSeparator } = props; const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(MenuGroup); if (!external_wp_element_namespaceObject.Children.count(children)) { return null; } const labelId = `components-menu-group-label-${instanceId}`; const classNames = dist_clsx(className, 'components-menu-group', { 'has-hidden-separator': hideSeparator }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: classNames, children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-menu-group__label", id: labelId, "aria-hidden": "true", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "group", "aria-labelledby": label ? labelId : undefined, children: children })] }); } /* harmony default export */ const menu_group = (MenuGroup); ;// ./node_modules/@wordpress/components/build-module/menu-item/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedMenuItem(props, ref) { let { children, info, className, icon, iconPosition = 'right', shortcut, isSelected, role = 'menuitem', suffix, ...buttonProps } = props; className = dist_clsx('components-menu-item__button', className); if (info) { children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "components-menu-item__info-wrapper", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-menu-item__item", children: children }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-menu-item__info", children: info })] }); } if (icon && typeof icon !== 'string') { icon = (0,external_wp_element_namespaceObject.cloneElement)(icon, { className: dist_clsx('components-menu-items__item-icon', { 'has-icon-right': iconPosition === 'right' }) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(build_module_button, { __next40pxDefaultSize: true, ref: ref // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked , "aria-checked": role === 'menuitemcheckbox' || role === 'menuitemradio' ? isSelected : undefined, role: role, icon: iconPosition === 'left' ? icon : undefined, className: className, ...buttonProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-menu-item__item", children: children }), !suffix && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_shortcut, { className: "components-menu-item__shortcut", shortcut: shortcut }), !suffix && icon && iconPosition === 'right' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon }), suffix] }); } /** * MenuItem is a component which renders a button intended to be used in combination with the `DropdownMenu` component. * * ```jsx * import { MenuItem } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyMenuItem = () => { * const [ isActive, setIsActive ] = useState( true ); * * return ( * <MenuItem * icon={ isActive ? 'yes' : 'no' } * isSelected={ isActive } * role="menuitemcheckbox" * onClick={ () => setIsActive( ( state ) => ! state ) } * > * Toggle * </MenuItem> * ); * }; * ``` */ const MenuItem = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedMenuItem); /* harmony default export */ const menu_item = (MenuItem); ;// ./node_modules/@wordpress/components/build-module/menu-items-choice/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const menu_items_choice_noop = () => {}; /** * `MenuItemsChoice` functions similarly to a set of `MenuItem`s, but allows the user to select one option from a set of multiple choices. * * * ```jsx * import { MenuGroup, MenuItemsChoice } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyMenuItemsChoice = () => { * const [ mode, setMode ] = useState( 'visual' ); * const choices = [ * { * value: 'visual', * label: 'Visual editor', * }, * { * value: 'text', * label: 'Code editor', * }, * ]; * * return ( * <MenuGroup label="Editor"> * <MenuItemsChoice * choices={ choices } * value={ mode } * onSelect={ ( newMode ) => setMode( newMode ) } * /> * </MenuGroup> * ); * }; * ``` */ function MenuItemsChoice({ choices = [], onHover = menu_items_choice_noop, onSelect, value }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: choices.map(item => { const isSelected = value === item.value; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_item, { role: "menuitemradio", disabled: item.disabled, icon: isSelected ? library_check : null, info: item.info, isSelected: isSelected, shortcut: item.shortcut, className: "components-menu-items-choice", onClick: () => { if (!isSelected) { onSelect(item.value); } }, onMouseEnter: () => onHover(item.value), onMouseLeave: () => onHover(null), "aria-label": item['aria-label'], children: item.label }, item.value); }) }); } /* harmony default export */ const menu_items_choice = (MenuItemsChoice); ;// ./node_modules/@wordpress/components/build-module/navigable-container/tabbable.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedTabbableContainer({ eventToOffset, ...props }, ref) { const innerEventToOffset = evt => { const { code, shiftKey } = evt; if ('Tab' === code) { return shiftKey ? -1 : 1; } // Allow custom handling of keys besides Tab. // // By default, TabbableContainer will move focus forward on Tab and // backward on Shift+Tab. The handler below will be used for all other // events. The semantics for `eventToOffset`'s return // values are the following: // // - +1: move focus forward // - -1: move focus backward // - 0: don't move focus, but acknowledge event and thus stop it // - undefined: do nothing, let the event propagate. if (eventToOffset) { return eventToOffset(evt); } return undefined; }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(container, { ref: ref, stopNavigationEvents: true, onlyBrowserTabstops: true, eventToOffset: innerEventToOffset, ...props }); } /** * A container for tabbable elements. * * ```jsx * import { * TabbableContainer, * Button, * } from '@wordpress/components'; * * function onNavigate( index, target ) { * console.log( `Navigates to ${ index }`, target ); * } * * const MyTabbableContainer = () => ( * <div> * <span>Tabbable Container:</span> * <TabbableContainer onNavigate={ onNavigate }> * <Button variant="secondary" tabIndex="0"> * Section 1 * </Button> * <Button variant="secondary" tabIndex="0"> * Section 2 * </Button> * <Button variant="secondary" tabIndex="0"> * Section 3 * </Button> * <Button variant="secondary" tabIndex="0"> * Section 4 * </Button> * </TabbableContainer> * </div> * ); * ``` */ const TabbableContainer = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTabbableContainer); /* harmony default export */ const tabbable = (TabbableContainer); ;// ./node_modules/@wordpress/components/build-module/navigation/constants.js const ROOT_MENU = 'root'; const SEARCH_FOCUS_DELAY = 100; ;// ./node_modules/@wordpress/components/build-module/navigation/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const context_noop = () => {}; const defaultIsEmpty = () => false; const defaultGetter = () => undefined; const NavigationContext = (0,external_wp_element_namespaceObject.createContext)({ activeItem: undefined, activeMenu: ROOT_MENU, setActiveMenu: context_noop, navigationTree: { items: {}, getItem: defaultGetter, addItem: context_noop, removeItem: context_noop, menus: {}, getMenu: defaultGetter, addMenu: context_noop, removeMenu: context_noop, childMenu: {}, traverseMenu: context_noop, isMenuEmpty: defaultIsEmpty } }); const useNavigationContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationContext); ;// ./node_modules/@wordpress/components/build-module/navigation/styles/navigation-styles.js function navigation_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const NavigationUI = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeiismy11" } : 0)("width:100%;box-sizing:border-box;padding:0 ", space(4), ";overflow:hidden;" + ( true ? "" : 0)); const MenuUI = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeiismy10" } : 0)("margin-top:", space(6), ";margin-bottom:", space(6), ";display:flex;flex-direction:column;ul{padding:0;margin:0;list-style:none;}.components-navigation__back-button{margin-bottom:", space(6), ";}.components-navigation__group+.components-navigation__group{margin-top:", space(6), ";}" + ( true ? "" : 0)); const MenuBackButtonUI = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? { target: "eeiismy9" } : 0)( true ? { name: "26l0q2", styles: "&.is-tertiary{color:inherit;opacity:0.7;&:hover:not( :disabled ){opacity:1;box-shadow:none;color:inherit;}&:active:not( :disabled ){background:transparent;opacity:1;color:inherit;}}" } : 0); const MenuTitleUI = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeiismy8" } : 0)( true ? { name: "1aubja5", styles: "overflow:hidden;width:100%" } : 0); const MenuTitleSearchControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeiismy7" } : 0)( true ? { name: "rgorny", styles: "margin:11px 0;padding:1px" } : 0); const MenuTitleActionsUI = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "eeiismy6" } : 0)("height:", space(6), ";.components-button.is-small{color:inherit;opacity:0.7;margin-right:", space(1), ";padding:0;&:active:not( :disabled ){background:none;opacity:1;color:inherit;}&:hover:not( :disabled ){box-shadow:none;opacity:1;color:inherit;}}" + ( true ? "" : 0)); const GroupTitleUI = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? { target: "eeiismy5" } : 0)("min-height:", space(12), ";align-items:center;color:inherit;display:flex;justify-content:space-between;margin-bottom:", space(2), ";padding:", () => (0,external_wp_i18n_namespaceObject.isRTL)() ? `${space(1)} ${space(4)} ${space(1)} ${space(2)}` : `${space(1)} ${space(2)} ${space(1)} ${space(4)}`, ";" + ( true ? "" : 0)); const ItemBaseUI = /*#__PURE__*/emotion_styled_base_browser_esm("li", true ? { target: "eeiismy4" } : 0)("border-radius:", config_values.radiusSmall, ";color:inherit;margin-bottom:0;>button,>a.components-button,>a{width:100%;color:inherit;opacity:0.7;padding:", space(2), " ", space(4), ";", rtl({ textAlign: 'left' }, { textAlign: 'right' }), " &:hover,&:focus:not( [aria-disabled='true'] ):active,&:active:not( [aria-disabled='true'] ):active{color:inherit;opacity:1;}}&.is-active{background-color:", COLORS.theme.accent, ";color:", COLORS.theme.accentInverted, ";>button,.components-button:hover,>a{color:", COLORS.theme.accentInverted, ";opacity:1;}}>svg path{color:", COLORS.gray[600], ";}" + ( true ? "" : 0)); const ItemUI = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eeiismy3" } : 0)("display:flex;align-items:center;height:auto;min-height:40px;margin:0;padding:", space(1.5), " ", space(4), ";font-weight:400;line-height:20px;width:100%;color:inherit;opacity:0.7;" + ( true ? "" : 0)); const ItemIconUI = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "eeiismy2" } : 0)("display:flex;margin-right:", space(2), ";" + ( true ? "" : 0)); const ItemBadgeUI = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "eeiismy1" } : 0)("margin-left:", () => (0,external_wp_i18n_namespaceObject.isRTL)() ? '0' : space(2), ";margin-right:", () => (0,external_wp_i18n_namespaceObject.isRTL)() ? space(2) : '0', ";display:inline-flex;padding:", space(1), " ", space(3), ";border-radius:", config_values.radiusSmall, ";@keyframes fade-in{from{opacity:0;}to{opacity:1;}}@media not ( prefers-reduced-motion ){animation:fade-in 250ms ease-out;}" + ( true ? "" : 0)); const ItemTitleUI = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? { target: "eeiismy0" } : 0)(() => (0,external_wp_i18n_namespaceObject.isRTL)() ? 'margin-left: auto;' : 'margin-right: auto;', " font-size:14px;line-height:20px;color:inherit;" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/navigation/use-navigation-tree-nodes.js /** * WordPress dependencies */ function useNavigationTreeNodes() { const [nodes, setNodes] = (0,external_wp_element_namespaceObject.useState)({}); const getNode = key => nodes[key]; const addNode = (key, value) => { const { children, ...newNode } = value; return setNodes(original => ({ ...original, [key]: newNode })); }; const removeNode = key => { return setNodes(original => { const { [key]: removedNode, ...remainingNodes } = original; return remainingNodes; }); }; return { nodes, getNode, addNode, removeNode }; } ;// ./node_modules/@wordpress/components/build-module/navigation/use-create-navigation-tree.js /** * WordPress dependencies */ /** * Internal dependencies */ const useCreateNavigationTree = () => { const { nodes: items, getNode: getItem, addNode: addItem, removeNode: removeItem } = useNavigationTreeNodes(); const { nodes: menus, getNode: getMenu, addNode: addMenu, removeNode: removeMenu } = useNavigationTreeNodes(); /** * Stores direct nested menus of menus * This makes it easy to traverse menu tree * * Key is the menu prop of the menu * Value is an array of menu keys */ const [childMenu, setChildMenu] = (0,external_wp_element_namespaceObject.useState)({}); const getChildMenu = menu => childMenu[menu] || []; const traverseMenu = (startMenu, callback) => { const visited = []; let queue = [startMenu]; let current; while (queue.length > 0) { // Type cast to string is safe because of the `length > 0` check above. current = getMenu(queue.shift()); if (!current || visited.includes(current.menu)) { continue; } visited.push(current.menu); queue = [...queue, ...getChildMenu(current.menu)]; if (callback(current) === false) { break; } } }; const isMenuEmpty = menuToCheck => { let isEmpty = true; traverseMenu(menuToCheck, current => { if (!current.isEmpty) { isEmpty = false; return false; } return undefined; }); return isEmpty; }; return { items, getItem, addItem, removeItem, menus, getMenu, addMenu: (key, value) => { setChildMenu(state => { const newState = { ...state }; if (!value.parentMenu) { return newState; } if (!newState[value.parentMenu]) { newState[value.parentMenu] = []; } newState[value.parentMenu].push(key); return newState; }); addMenu(key, value); }, removeMenu, childMenu, traverseMenu, isMenuEmpty }; }; ;// ./node_modules/@wordpress/components/build-module/navigation/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const navigation_noop = () => {}; /** * Render a navigation list with optional groupings and hierarchy. * * @deprecated Use `Navigator` instead. * * ```jsx * import { * __experimentalNavigation as Navigation, * __experimentalNavigationGroup as NavigationGroup, * __experimentalNavigationItem as NavigationItem, * __experimentalNavigationMenu as NavigationMenu, * } from '@wordpress/components'; * * const MyNavigation = () => ( * <Navigation> * <NavigationMenu title="Home"> * <NavigationGroup title="Group 1"> * <NavigationItem item="item-1" title="Item 1" /> * <NavigationItem item="item-2" title="Item 2" /> * </NavigationGroup> * <NavigationGroup title="Group 2"> * <NavigationItem * item="item-3" * navigateToMenu="category" * title="Category" * /> * </NavigationGroup> * </NavigationMenu> * * <NavigationMenu * backButtonLabel="Home" * menu="category" * parentMenu="root" * title="Category" * > * <NavigationItem badge="1" item="child-1" title="Child 1" /> * <NavigationItem item="child-2" title="Child 2" /> * </NavigationMenu> * </Navigation> * ); * ``` */ function Navigation({ activeItem, activeMenu = ROOT_MENU, children, className, onActivateMenu = navigation_noop }) { const [menu, setMenu] = (0,external_wp_element_namespaceObject.useState)(activeMenu); const [slideOrigin, setSlideOrigin] = (0,external_wp_element_namespaceObject.useState)(); const navigationTree = useCreateNavigationTree(); const defaultSlideOrigin = (0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left'; external_wp_deprecated_default()('wp.components.Navigation (and all subcomponents)', { since: '6.8', version: '7.1', alternative: 'wp.components.Navigator' }); const setActiveMenu = (menuId, slideInOrigin = defaultSlideOrigin) => { if (!navigationTree.getMenu(menuId)) { return; } setSlideOrigin(slideInOrigin); setMenu(menuId); onActivateMenu(menuId); }; // Used to prevent the sliding animation on mount const isMountedRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isMountedRef.current) { isMountedRef.current = true; } }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { if (activeMenu !== menu) { setActiveMenu(activeMenu); } // Not adding deps for now, as it would require either a larger refactor or some questionable workarounds. // See https://github.com/WordPress/gutenberg/pull/41612 for context. }, [activeMenu]); const context = { activeItem, activeMenu: menu, setActiveMenu, navigationTree }; const classes = dist_clsx('components-navigation', className); const animateClassName = getAnimateClassName({ type: 'slide-in', origin: slideOrigin }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationUI, { className: classes, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: animateClassName ? dist_clsx({ [animateClassName]: isMountedRef.current && slideOrigin }) : undefined, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationContext.Provider, { value: context, children: children }) }, menu) }); } /* harmony default export */ const navigation = (Navigation); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js /** * WordPress dependencies */ const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); /* harmony default export */ const chevron_right = (chevronRight); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js /** * WordPress dependencies */ const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); /* harmony default export */ const chevron_left = (chevronLeft); ;// ./node_modules/@wordpress/components/build-module/navigation/back-button/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedNavigationBackButton({ backButtonLabel, className, href, onClick, parentMenu }, ref) { const { setActiveMenu, navigationTree } = useNavigationContext(); const classes = dist_clsx('components-navigation__back-button', className); const parentMenuTitle = parentMenu !== undefined ? navigationTree.getMenu(parentMenu)?.title : undefined; const handleOnClick = event => { if (typeof onClick === 'function') { onClick(event); } const animationDirection = (0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right'; if (parentMenu && !event.defaultPrevented) { setActiveMenu(parentMenu, animationDirection); } }; const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(MenuBackButtonUI, { __next40pxDefaultSize: true, className: classes, href: href, variant: "tertiary", ref: ref, onClick: handleOnClick, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: icon }), backButtonLabel || parentMenuTitle || (0,external_wp_i18n_namespaceObject.__)('Back')] }); } /** * @deprecated Use `Navigator` instead. */ const NavigationBackButton = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedNavigationBackButton); /* harmony default export */ const back_button = (NavigationBackButton); ;// ./node_modules/@wordpress/components/build-module/navigation/group/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const NavigationGroupContext = (0,external_wp_element_namespaceObject.createContext)({ group: undefined }); const useNavigationGroupContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationGroupContext); ;// ./node_modules/@wordpress/components/build-module/navigation/group/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ let uniqueId = 0; /** * @deprecated Use `Navigator` instead. */ function NavigationGroup({ children, className, title }) { const [groupId] = (0,external_wp_element_namespaceObject.useState)(`group-${++uniqueId}`); const { navigationTree: { items } } = useNavigationContext(); const context = { group: groupId }; // Keep the children rendered to make sure invisible items are included in the navigation tree. if (!Object.values(items).some(item => item.group === groupId && item._isVisible)) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationGroupContext.Provider, { value: context, children: children }); } const groupTitleId = `components-navigation__group-title-${groupId}`; const classes = dist_clsx('components-navigation__group', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationGroupContext.Provider, { value: context, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: classes, children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GroupTitleUI, { className: "components-navigation__group-title", id: groupTitleId, level: 3, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { "aria-labelledby": groupTitleId, role: "group", children: children })] }) }); } /* harmony default export */ const group = (NavigationGroup); ;// ./node_modules/@wordpress/components/build-module/navigation/item/base-content.js /** * Internal dependencies */ function NavigationItemBaseContent(props) { const { badge, title } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemTitleUI, { className: "components-navigation__item-title", as: "span", children: title }), badge && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemBadgeUI, { className: "components-navigation__item-badge", children: badge })] }); } ;// ./node_modules/@wordpress/components/build-module/navigation/menu/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const NavigationMenuContext = (0,external_wp_element_namespaceObject.createContext)({ menu: undefined, search: '' }); const useNavigationMenuContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationMenuContext); ;// ./node_modules/@wordpress/components/build-module/navigation/utils.js /** * External dependencies */ // @see packages/block-editor/src/components/inserter/search-items.js const normalizeInput = input => remove_accents_default()(input).replace(/^\//, '').toLowerCase(); const normalizedSearch = (title, search) => -1 !== normalizeInput(title).indexOf(normalizeInput(search)); ;// ./node_modules/@wordpress/components/build-module/navigation/item/use-navigation-tree-item.js /** * WordPress dependencies */ /** * Internal dependencies */ const useNavigationTreeItem = (itemId, props) => { const { activeMenu, navigationTree: { addItem, removeItem } } = useNavigationContext(); const { group } = useNavigationGroupContext(); const { menu, search } = useNavigationMenuContext(); (0,external_wp_element_namespaceObject.useEffect)(() => { const isMenuActive = activeMenu === menu; const isItemVisible = !search || props.title !== undefined && normalizedSearch(props.title, search); addItem(itemId, { ...props, group, menu, _isVisible: isMenuActive && isItemVisible }); return () => { removeItem(itemId); }; // Not adding deps for now, as it would require either a larger refactor. // See https://github.com/WordPress/gutenberg/pull/41639 }, [activeMenu, search]); }; ;// ./node_modules/@wordpress/components/build-module/navigation/item/base.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ let base_uniqueId = 0; function NavigationItemBase(props) { // Also avoid to pass the `title` and `href` props to the ItemBaseUI styled component. const { children, className, title, href, ...restProps } = props; const [itemId] = (0,external_wp_element_namespaceObject.useState)(`item-${++base_uniqueId}`); useNavigationTreeItem(itemId, props); const { navigationTree } = useNavigationContext(); if (!navigationTree.getItem(itemId)?._isVisible) { return null; } const classes = dist_clsx('components-navigation__item', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemBaseUI, { className: classes, ...restProps, children: children }); } ;// ./node_modules/@wordpress/components/build-module/navigation/item/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const item_noop = () => {}; /** * @deprecated Use `Navigator` instead. */ function NavigationItem(props) { const { badge, children, className, href, item, navigateToMenu, onClick = item_noop, title, icon, hideIfTargetMenuEmpty, isText, ...restProps } = props; const { activeItem, setActiveMenu, navigationTree: { isMenuEmpty } } = useNavigationContext(); // If hideIfTargetMenuEmpty prop is true // And the menu we are supposed to navigate to // Is marked as empty, then we skip rendering the item. if (hideIfTargetMenuEmpty && navigateToMenu && isMenuEmpty(navigateToMenu)) { return null; } const isActive = item && activeItem === item; const classes = dist_clsx(className, { 'is-active': isActive }); const onItemClick = event => { if (navigateToMenu) { setActiveMenu(navigateToMenu); } onClick(event); }; const navigationIcon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right; const baseProps = children ? props : { ...props, onClick: undefined }; const itemProps = isText ? restProps : { as: build_module_button, __next40pxDefaultSize: 'as' in restProps ? restProps.as === undefined : true, href, onClick: onItemClick, 'aria-current': isActive ? 'page' : undefined, ...restProps }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationItemBase, { ...baseProps, className: classes, children: children || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ItemUI, { ...itemProps, children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemIconUI, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: icon }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationItemBaseContent, { title: title, badge: badge }), navigateToMenu && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: navigationIcon })] }) }); } /* harmony default export */ const navigation_item = (NavigationItem); ;// ./node_modules/@wordpress/components/build-module/navigation/menu/use-navigation-tree-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ const useNavigationTreeMenu = props => { const { navigationTree: { addMenu, removeMenu } } = useNavigationContext(); const key = props.menu || ROOT_MENU; (0,external_wp_element_namespaceObject.useEffect)(() => { addMenu(key, { ...props, menu: key }); return () => { removeMenu(key); }; // Not adding deps for now, as it would require either a larger refactor // See https://github.com/WordPress/gutenberg/pull/44090 }, []); }; ;// ./node_modules/@wordpress/icons/build-module/library/search.js /** * WordPress dependencies */ const search = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); /* harmony default export */ const library_search = (search); ;// ./node_modules/@wordpress/components/build-module/higher-order/with-spoken-messages/index.js /** * WordPress dependencies */ /** @typedef {import('react').ComponentType} ComponentType */ /** * A Higher Order Component used to provide speak and debounced speak functions. * * @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak * * @param {ComponentType} Component The component to be wrapped. * * @return {ComponentType} The wrapped component. */ /* harmony default export */ const with_spoken_messages = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(Component => props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props, speak: external_wp_a11y_namespaceObject.speak, debouncedSpeak: (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500) }), 'withSpokenMessages')); ;// ./node_modules/@wordpress/components/build-module/search-control/styles.js /** * External dependencies */ /** * Internal dependencies */ const inlinePadding = ({ size }) => { return space(size === 'compact' ? 1 : 2); }; const SuffixItemWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "effl84m1" } : 0)("display:flex;padding-inline-end:", inlinePadding, ";svg{fill:currentColor;}" + ( true ? "" : 0)); const StyledInputControl = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? { target: "effl84m0" } : 0)("input[type='search']{&::-webkit-search-decoration,&::-webkit-search-cancel-button,&::-webkit-search-results-button,&::-webkit-search-results-decoration{-webkit-appearance:none;}}&:not( :focus-within ){--wp-components-color-background:", COLORS.theme.gray[100], ";}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/search-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function SuffixItem({ searchRef, value, onChange, onClose }) { if (!onClose && !value) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: library_search }); } if (onClose) { external_wp_deprecated_default()('`onClose` prop in wp.components.SearchControl', { since: '6.8' }); } const onReset = () => { onChange(''); searchRef.current?.focus(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { size: "small", icon: close_small, label: onClose ? (0,external_wp_i18n_namespaceObject.__)('Close search') : (0,external_wp_i18n_namespaceObject.__)('Reset search'), onClick: onClose !== null && onClose !== void 0 ? onClose : onReset }); } function UnforwardedSearchControl({ __nextHasNoMarginBottom = false, className, onChange, value, label = (0,external_wp_i18n_namespaceObject.__)('Search'), placeholder = (0,external_wp_i18n_namespaceObject.__)('Search'), hideLabelFromVision = true, onClose, size = 'default', ...restProps }, forwardedRef) { // @ts-expect-error The `disabled` prop is not yet supported in the SearchControl component. // Work with the design team (@WordPress/gutenberg-design) if you need this feature. const { disabled, ...filteredRestProps } = restProps; const searchRef = (0,external_wp_element_namespaceObject.useRef)(null); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(SearchControl, 'components-search-control'); const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ BaseControl: { // Overrides the underlying BaseControl `__nextHasNoMarginBottom` via the context system // to provide backwards compatible margin for SearchControl. // (In a standard InputControl, the BaseControl `__nextHasNoMarginBottom` is always set to true.) _overrides: { __nextHasNoMarginBottom }, __associatedWPComponentName: 'SearchControl' }, // `isBorderless` is still experimental and not a public prop for InputControl yet. InputBase: { isBorderless: true } }), [__nextHasNoMarginBottom]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextSystemProvider, { value: contextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledInputControl, { __next40pxDefaultSize: true, id: instanceId, hideLabelFromVision: hideLabelFromVision, label: label, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([searchRef, forwardedRef]), type: "search", size: size, className: dist_clsx('components-search-control', className), onChange: nextValue => onChange(nextValue !== null && nextValue !== void 0 ? nextValue : ''), autoComplete: "off", placeholder: placeholder, value: value !== null && value !== void 0 ? value : '', suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuffixItemWrapper, { size: size, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuffixItem, { searchRef: searchRef, value: value, onChange: onChange, onClose: onClose }) }), ...filteredRestProps }) }); } /** * SearchControl components let users display a search control. * * ```jsx * import { SearchControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * function MySearchControl( { className, setState } ) { * const [ searchInput, setSearchInput ] = useState( '' ); * * return ( * <SearchControl * __nextHasNoMarginBottom * value={ searchInput } * onChange={ setSearchInput } * /> * ); * } * ``` */ const SearchControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSearchControl); /* harmony default export */ const search_control = (SearchControl); ;// ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title-search.js /** * WordPress dependencies */ /** * Internal dependencies */ function MenuTitleSearch({ debouncedSpeak, onCloseSearch, onSearch, search, title }) { const { navigationTree: { items } } = useNavigationContext(); const { menu } = useNavigationMenuContext(); const inputRef = (0,external_wp_element_namespaceObject.useRef)(null); // Wait for the slide-in animation to complete before autofocusing the input. // This prevents scrolling to the input during the animation. (0,external_wp_element_namespaceObject.useEffect)(() => { const delayedFocus = setTimeout(() => { inputRef.current?.focus(); }, SEARCH_FOCUS_DELAY); return () => { clearTimeout(delayedFocus); }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!search) { return; } const count = Object.values(items).filter(item => item._isVisible).length; const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); debouncedSpeak(resultsFoundMessage); // Not adding deps for now, as it would require either a larger refactor. // See https://github.com/WordPress/gutenberg/pull/44090 }, [items, search]); const onClose = () => { onSearch?.(''); onCloseSearch(); }; const onKeyDown = event => { if (event.code === 'Escape' && !event.defaultPrevented) { event.preventDefault(); onClose(); } }; const inputId = `components-navigation__menu-title-search-${menu}`; const placeholder = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: placeholder for menu search box. %s: menu title */ (0,external_wp_i18n_namespaceObject.__)('Search %s'), title?.toLowerCase()).trim(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuTitleSearchControlWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_control, { __nextHasNoMarginBottom: true, className: "components-navigation__menu-search-input", id: inputId, onChange: value => onSearch?.(value), onKeyDown: onKeyDown, placeholder: placeholder, onClose: onClose, ref: inputRef, value: search }) }); } /* harmony default export */ const menu_title_search = (with_spoken_messages(MenuTitleSearch)); ;// ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title.js /** * WordPress dependencies */ /** * Internal dependencies */ function NavigationMenuTitle({ hasSearch, onSearch, search, title, titleAction }) { const [isSearching, setIsSearching] = (0,external_wp_element_namespaceObject.useState)(false); const { menu } = useNavigationMenuContext(); const searchButtonRef = (0,external_wp_element_namespaceObject.useRef)(null); if (!title) { return null; } const onCloseSearch = () => { setIsSearching(false); // Wait for the slide-in animation to complete before focusing the search button. // eslint-disable-next-line @wordpress/react-no-unsafe-timeout setTimeout(() => { searchButtonRef.current?.focus(); }, SEARCH_FOCUS_DELAY); }; const menuTitleId = `components-navigation__menu-title-${menu}`; /* translators: search button label for menu search box. %s: menu title */ const searchButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Search in %s'), title); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(MenuTitleUI, { className: "components-navigation__menu-title", children: [!isSearching && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(GroupTitleUI, { as: "h2", className: "components-navigation__menu-title-heading", level: 3, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: menuTitleId, children: title }), (hasSearch || titleAction) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(MenuTitleActionsUI, { children: [titleAction, hasSearch && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { size: "small", variant: "tertiary", label: searchButtonLabel, onClick: () => setIsSearching(true), ref: searchButtonRef, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: library_search }) })] })] }), isSearching && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: getAnimateClassName({ type: 'slide-in', origin: 'left' }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_title_search, { onCloseSearch: onCloseSearch, onSearch: onSearch, search: search, title: title }) })] }); } ;// ./node_modules/@wordpress/components/build-module/navigation/menu/search-no-results-found.js /** * WordPress dependencies */ /** * Internal dependencies */ function NavigationSearchNoResultsFound({ search }) { const { navigationTree: { items } } = useNavigationContext(); const resultsCount = Object.values(items).filter(item => item._isVisible).length; if (!search || !!resultsCount) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemBaseUI, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ItemUI, { children: [(0,external_wp_i18n_namespaceObject.__)('No results found.'), " "] }) }); } ;// ./node_modules/@wordpress/components/build-module/navigation/menu/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * @deprecated Use `Navigator` instead. */ function NavigationMenu(props) { const { backButtonLabel, children, className, hasSearch, menu = ROOT_MENU, onBackButtonClick, onSearch: setControlledSearch, parentMenu, search: controlledSearch, isSearchDebouncing, title, titleAction } = props; const [uncontrolledSearch, setUncontrolledSearch] = (0,external_wp_element_namespaceObject.useState)(''); useNavigationTreeMenu(props); const { activeMenu } = useNavigationContext(); const context = { menu, search: uncontrolledSearch }; // Keep the children rendered to make sure invisible items are included in the navigation tree. if (activeMenu !== menu) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContext.Provider, { value: context, children: children }); } const isControlledSearch = !!setControlledSearch; const search = isControlledSearch ? controlledSearch : uncontrolledSearch; const onSearch = isControlledSearch ? setControlledSearch : setUncontrolledSearch; const menuTitleId = `components-navigation__menu-title-${menu}`; const classes = dist_clsx('components-navigation__menu', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContext.Provider, { value: context, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(MenuUI, { className: classes, children: [(parentMenu || onBackButtonClick) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button, { backButtonLabel: backButtonLabel, parentMenu: parentMenu, onClick: onBackButtonClick }), title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuTitle, { hasSearch: hasSearch, onSearch: onSearch, search: search, title: title, titleAction: titleAction }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_container_menu, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { "aria-labelledby": menuTitleId, children: [children, search && !isSearchDebouncing && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationSearchNoResultsFound, { search: search })] }) })] }) }); } /* harmony default export */ const navigation_menu = (NavigationMenu); ;// ./node_modules/path-to-regexp/dist.es2015/index.js /** * Tokenize input string. */ function lexer(str) { var tokens = []; var i = 0; while (i < str.length) { var char = str[i]; if (char === "*" || char === "+" || char === "?") { tokens.push({ type: "MODIFIER", index: i, value: str[i++] }); continue; } if (char === "\\") { tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] }); continue; } if (char === "{") { tokens.push({ type: "OPEN", index: i, value: str[i++] }); continue; } if (char === "}") { tokens.push({ type: "CLOSE", index: i, value: str[i++] }); continue; } if (char === ":") { var name = ""; var j = i + 1; while (j < str.length) { var code = str.charCodeAt(j); if ( // `0-9` (code >= 48 && code <= 57) || // `A-Z` (code >= 65 && code <= 90) || // `a-z` (code >= 97 && code <= 122) || // `_` code === 95) { name += str[j++]; continue; } break; } if (!name) throw new TypeError("Missing parameter name at ".concat(i)); tokens.push({ type: "NAME", index: i, value: name }); i = j; continue; } if (char === "(") { var count = 1; var pattern = ""; var j = i + 1; if (str[j] === "?") { throw new TypeError("Pattern cannot start with \"?\" at ".concat(j)); } while (j < str.length) { if (str[j] === "\\") { pattern += str[j++] + str[j++]; continue; } if (str[j] === ")") { count--; if (count === 0) { j++; break; } } else if (str[j] === "(") { count++; if (str[j + 1] !== "?") { throw new TypeError("Capturing groups are not allowed at ".concat(j)); } } pattern += str[j++]; } if (count) throw new TypeError("Unbalanced pattern at ".concat(i)); if (!pattern) throw new TypeError("Missing pattern at ".concat(i)); tokens.push({ type: "PATTERN", index: i, value: pattern }); i = j; continue; } tokens.push({ type: "CHAR", index: i, value: str[i++] }); } tokens.push({ type: "END", index: i, value: "" }); return tokens; } /** * Parse a string for the raw tokens. */ function dist_es2015_parse(str, options) { if (options === void 0) { options = {}; } var tokens = lexer(str); var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a, _b = options.delimiter, delimiter = _b === void 0 ? "/#?" : _b; var result = []; var key = 0; var i = 0; var path = ""; var tryConsume = function (type) { if (i < tokens.length && tokens[i].type === type) return tokens[i++].value; }; var mustConsume = function (type) { var value = tryConsume(type); if (value !== undefined) return value; var _a = tokens[i], nextType = _a.type, index = _a.index; throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type)); }; var consumeText = function () { var result = ""; var value; while ((value = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR"))) { result += value; } return result; }; var isSafe = function (value) { for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) { var char = delimiter_1[_i]; if (value.indexOf(char) > -1) return true; } return false; }; var safePattern = function (prefix) { var prev = result[result.length - 1]; var prevText = prefix || (prev && typeof prev === "string" ? prev : ""); if (prev && !prevText) { throw new TypeError("Must have text between two parameters, missing text after \"".concat(prev.name, "\"")); } if (!prevText || isSafe(prevText)) return "[^".concat(escapeString(delimiter), "]+?"); return "(?:(?!".concat(escapeString(prevText), ")[^").concat(escapeString(delimiter), "])+?"); }; while (i < tokens.length) { var char = tryConsume("CHAR"); var name = tryConsume("NAME"); var pattern = tryConsume("PATTERN"); if (name || pattern) { var prefix = char || ""; if (prefixes.indexOf(prefix) === -1) { path += prefix; prefix = ""; } if (path) { result.push(path); path = ""; } result.push({ name: name || key++, prefix: prefix, suffix: "", pattern: pattern || safePattern(prefix), modifier: tryConsume("MODIFIER") || "", }); continue; } var value = char || tryConsume("ESCAPED_CHAR"); if (value) { path += value; continue; } if (path) { result.push(path); path = ""; } var open = tryConsume("OPEN"); if (open) { var prefix = consumeText(); var name_1 = tryConsume("NAME") || ""; var pattern_1 = tryConsume("PATTERN") || ""; var suffix = consumeText(); mustConsume("CLOSE"); result.push({ name: name_1 || (pattern_1 ? key++ : ""), pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1, prefix: prefix, suffix: suffix, modifier: tryConsume("MODIFIER") || "", }); continue; } mustConsume("END"); } return result; } /** * Compile a string to a template function for the path. */ function dist_es2015_compile(str, options) { return tokensToFunction(dist_es2015_parse(str, options), options); } /** * Expose a method for transforming tokens into the path function. */ function tokensToFunction(tokens, options) { if (options === void 0) { options = {}; } var reFlags = flags(options); var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b; // Compile all the tokens into regexps. var matches = tokens.map(function (token) { if (typeof token === "object") { return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags); } }); return function (data) { var path = ""; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; if (typeof token === "string") { path += token; continue; } var value = data ? data[token.name] : undefined; var optional = token.modifier === "?" || token.modifier === "*"; var repeat = token.modifier === "*" || token.modifier === "+"; if (Array.isArray(value)) { if (!repeat) { throw new TypeError("Expected \"".concat(token.name, "\" to not repeat, but got an array")); } if (value.length === 0) { if (optional) continue; throw new TypeError("Expected \"".concat(token.name, "\" to not be empty")); } for (var j = 0; j < value.length; j++) { var segment = encode(value[j], token); if (validate && !matches[i].test(segment)) { throw new TypeError("Expected all \"".concat(token.name, "\" to match \"").concat(token.pattern, "\", but got \"").concat(segment, "\"")); } path += token.prefix + segment + token.suffix; } continue; } if (typeof value === "string" || typeof value === "number") { var segment = encode(String(value), token); if (validate && !matches[i].test(segment)) { throw new TypeError("Expected \"".concat(token.name, "\" to match \"").concat(token.pattern, "\", but got \"").concat(segment, "\"")); } path += token.prefix + segment + token.suffix; continue; } if (optional) continue; var typeOfMessage = repeat ? "an array" : "a string"; throw new TypeError("Expected \"".concat(token.name, "\" to be ").concat(typeOfMessage)); } return path; }; } /** * Create path match function from `path-to-regexp` spec. */ function dist_es2015_match(str, options) { var keys = []; var re = pathToRegexp(str, keys, options); return regexpToFunction(re, keys, options); } /** * Create a path match function from `path-to-regexp` output. */ function regexpToFunction(re, keys, options) { if (options === void 0) { options = {}; } var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a; return function (pathname) { var m = re.exec(pathname); if (!m) return false; var path = m[0], index = m.index; var params = Object.create(null); var _loop_1 = function (i) { if (m[i] === undefined) return "continue"; var key = keys[i - 1]; if (key.modifier === "*" || key.modifier === "+") { params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) { return decode(value, key); }); } else { params[key.name] = decode(m[i], key); } }; for (var i = 1; i < m.length; i++) { _loop_1(i); } return { path: path, index: index, params: params }; }; } /** * Escape a regular expression string. */ function escapeString(str) { return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"); } /** * Get the flags for a regexp from the options. */ function flags(options) { return options && options.sensitive ? "" : "i"; } /** * Pull out keys from a regexp. */ function regexpToRegexp(path, keys) { if (!keys) return path; var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g; var index = 0; var execResult = groupsRegex.exec(path.source); while (execResult) { keys.push({ // Use parenthesized substring match if available, index otherwise name: execResult[1] || index++, prefix: "", suffix: "", modifier: "", pattern: "", }); execResult = groupsRegex.exec(path.source); } return path; } /** * Transform an array into a regexp. */ function arrayToRegexp(paths, keys, options) { var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; }); return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options)); } /** * Create a path regexp from string input. */ function stringToRegexp(path, keys, options) { return tokensToRegexp(dist_es2015_parse(path, options), keys, options); } /** * Expose a function for taking tokens and returning a RegExp. */ function tokensToRegexp(tokens, keys, options) { if (options === void 0) { options = {}; } var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f; var endsWithRe = "[".concat(escapeString(endsWith), "]|$"); var delimiterRe = "[".concat(escapeString(delimiter), "]"); var route = start ? "^" : ""; // Iterate over the tokens and create our regexp string. for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) { var token = tokens_1[_i]; if (typeof token === "string") { route += escapeString(encode(token)); } else { var prefix = escapeString(encode(token.prefix)); var suffix = escapeString(encode(token.suffix)); if (token.pattern) { if (keys) keys.push(token); if (prefix || suffix) { if (token.modifier === "+" || token.modifier === "*") { var mod = token.modifier === "*" ? "?" : ""; route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod); } else { route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier); } } else { if (token.modifier === "+" || token.modifier === "*") { throw new TypeError("Can not repeat \"".concat(token.name, "\" without a prefix and suffix")); } route += "(".concat(token.pattern, ")").concat(token.modifier); } } else { route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier); } } } if (end) { if (!strict) route += "".concat(delimiterRe, "?"); route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")"); } else { var endToken = tokens[tokens.length - 1]; var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === undefined; if (!strict) { route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?"); } if (!isEndDelimited) { route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")"); } } return new RegExp(route, flags(options)); } /** * Normalize the given path string, returning a regular expression. * * An empty array can be passed in for the keys, which will hold the * placeholder key descriptions. For example, using `/user/:id`, `keys` will * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. */ function pathToRegexp(path, keys, options) { if (path instanceof RegExp) return regexpToRegexp(path, keys); if (Array.isArray(path)) return arrayToRegexp(path, keys, options); return stringToRegexp(path, keys, options); } ;// ./node_modules/@wordpress/components/build-module/navigator/utils/router.js /** * External dependencies */ /** * Internal dependencies */ function matchPath(path, pattern) { const matchingFunction = dist_es2015_match(pattern, { decode: decodeURIComponent }); return matchingFunction(path); } function patternMatch(path, screens) { for (const screen of screens) { const matched = matchPath(path, screen.path); if (matched) { return { params: matched.params, id: screen.id }; } } return undefined; } function findParent(path, screens) { if (!path.startsWith('/')) { return undefined; } const pathParts = path.split('/'); let parentPath; while (pathParts.length > 1 && parentPath === undefined) { pathParts.pop(); const potentialParentPath = pathParts.join('/') === '' ? '/' : pathParts.join('/'); if (screens.find(screen => { return matchPath(potentialParentPath, screen.path) !== false; })) { parentPath = potentialParentPath; } } return parentPath; } ;// ./node_modules/@wordpress/components/build-module/navigator/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const context_initialContextValue = { location: {}, goTo: () => {}, goBack: () => {}, goToParent: () => {}, addScreen: () => {}, removeScreen: () => {}, params: {} }; const NavigatorContext = (0,external_wp_element_namespaceObject.createContext)(context_initialContextValue); ;// ./node_modules/@wordpress/components/build-module/navigator/styles.js function navigator_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ const navigatorWrapper = true ? { name: "1br0vvk", styles: "position:relative;overflow-x:clip;contain:layout;display:grid;grid-template-columns:1fr;grid-template-rows:1fr;align-items:start" } : 0; const fadeIn = emotion_react_browser_esm_keyframes({ from: { opacity: 0 } }); const fadeOut = emotion_react_browser_esm_keyframes({ to: { opacity: 0 } }); const slideFromRight = emotion_react_browser_esm_keyframes({ from: { transform: 'translateX(100px)' } }); const slideToLeft = emotion_react_browser_esm_keyframes({ to: { transform: 'translateX(-80px)' } }); const slideFromLeft = emotion_react_browser_esm_keyframes({ from: { transform: 'translateX(-100px)' } }); const slideToRight = emotion_react_browser_esm_keyframes({ to: { transform: 'translateX(80px)' } }); const FADE = { DURATION: 70, EASING: 'linear', DELAY: { IN: 70, OUT: 40 } }; const SLIDE = { DURATION: 300, EASING: 'cubic-bezier(0.33, 0, 0, 1)' }; const TOTAL_ANIMATION_DURATION = { IN: Math.max(FADE.DURATION + FADE.DELAY.IN, SLIDE.DURATION), OUT: Math.max(FADE.DURATION + FADE.DELAY.OUT, SLIDE.DURATION) }; const ANIMATION_END_NAMES = { end: { in: slideFromRight.name, out: slideToLeft.name }, start: { in: slideFromLeft.name, out: slideToRight.name } }; const ANIMATION = { end: { in: /*#__PURE__*/emotion_react_browser_esm_css(FADE.DURATION, "ms ", FADE.EASING, " ", FADE.DELAY.IN, "ms both ", fadeIn, ",", SLIDE.DURATION, "ms ", SLIDE.EASING, " both ", slideFromRight, ";" + ( true ? "" : 0), true ? "" : 0), out: /*#__PURE__*/emotion_react_browser_esm_css(FADE.DURATION, "ms ", FADE.EASING, " ", FADE.DELAY.OUT, "ms both ", fadeOut, ",", SLIDE.DURATION, "ms ", SLIDE.EASING, " both ", slideToLeft, ";" + ( true ? "" : 0), true ? "" : 0) }, start: { in: /*#__PURE__*/emotion_react_browser_esm_css(FADE.DURATION, "ms ", FADE.EASING, " ", FADE.DELAY.IN, "ms both ", fadeIn, ",", SLIDE.DURATION, "ms ", SLIDE.EASING, " both ", slideFromLeft, ";" + ( true ? "" : 0), true ? "" : 0), out: /*#__PURE__*/emotion_react_browser_esm_css(FADE.DURATION, "ms ", FADE.EASING, " ", FADE.DELAY.OUT, "ms both ", fadeOut, ",", SLIDE.DURATION, "ms ", SLIDE.EASING, " both ", slideToRight, ";" + ( true ? "" : 0), true ? "" : 0) } }; const navigatorScreenAnimation = /*#__PURE__*/emotion_react_browser_esm_css("z-index:1;&[data-animation-type='out']{z-index:0;}@media not ( prefers-reduced-motion ){&:not( [data-skip-animation] ){", ['start', 'end'].map(direction => ['in', 'out'].map(type => /*#__PURE__*/emotion_react_browser_esm_css("&[data-animation-direction='", direction, "'][data-animation-type='", type, "']{animation:", ANIMATION[direction][type], ";}" + ( true ? "" : 0), true ? "" : 0))), ";}}" + ( true ? "" : 0), true ? "" : 0); const navigatorScreen = true ? { name: "14di7zd", styles: "overflow-x:auto;max-height:100%;box-sizing:border-box;position:relative;grid-column:1/-1;grid-row:1/-1" } : 0; ;// ./node_modules/@wordpress/components/build-module/navigator/navigator/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function addScreen({ screens }, screen) { if (screens.some(s => s.path === screen.path)) { true ? external_wp_warning_default()(`Navigator: a screen with path ${screen.path} already exists. The screen with id ${screen.id} will not be added.`) : 0; return screens; } return [...screens, screen]; } function removeScreen({ screens }, screen) { return screens.filter(s => s.id !== screen.id); } function goTo(state, path, options = {}) { var _focusSelectorsCopy2; const { focusSelectors } = state; const currentLocation = { ...state.currentLocation }; const { // Default assignments isBack = false, skipFocus = false, // Extract to avoid forwarding replace, focusTargetSelector, // Rest ...restOptions } = options; if (currentLocation.path === path) { return { currentLocation, focusSelectors }; } let focusSelectorsCopy; function getFocusSelectorsCopy() { var _focusSelectorsCopy; focusSelectorsCopy = (_focusSelectorsCopy = focusSelectorsCopy) !== null && _focusSelectorsCopy !== void 0 ? _focusSelectorsCopy : new Map(state.focusSelectors); return focusSelectorsCopy; } // Set a focus selector that will be used when navigating // back to the current location. if (focusTargetSelector && currentLocation.path) { getFocusSelectorsCopy().set(currentLocation.path, focusTargetSelector); } // Get the focus selector for the new location. let currentFocusSelector; if (focusSelectors.get(path)) { if (isBack) { // Use the found focus selector only when navigating back. currentFocusSelector = focusSelectors.get(path); } // Make a copy of the focusSelectors map to remove the focus selector // only if necessary (ie. a focus selector was found). getFocusSelectorsCopy().delete(path); } return { currentLocation: { ...restOptions, isInitial: false, path, isBack, hasRestoredFocus: false, focusTargetSelector: currentFocusSelector, skipFocus }, focusSelectors: (_focusSelectorsCopy2 = focusSelectorsCopy) !== null && _focusSelectorsCopy2 !== void 0 ? _focusSelectorsCopy2 : focusSelectors }; } function goToParent(state, options = {}) { const { screens, focusSelectors } = state; const currentLocation = { ...state.currentLocation }; const currentPath = currentLocation.path; if (currentPath === undefined) { return { currentLocation, focusSelectors }; } const parentPath = findParent(currentPath, screens); if (parentPath === undefined) { return { currentLocation, focusSelectors }; } return goTo(state, parentPath, { ...options, isBack: true }); } function routerReducer(state, action) { let { screens, currentLocation, matchedPath, focusSelectors, ...restState } = state; switch (action.type) { case 'add': screens = addScreen(state, action.screen); break; case 'remove': screens = removeScreen(state, action.screen); break; case 'goto': ({ currentLocation, focusSelectors } = goTo(state, action.path, action.options)); break; case 'gotoparent': ({ currentLocation, focusSelectors } = goToParent(state, action.options)); break; } // Return early in case there is no change if (screens === state.screens && currentLocation === state.currentLocation) { return state; } // Compute the matchedPath const currentPath = currentLocation.path; matchedPath = currentPath !== undefined ? patternMatch(currentPath, screens) : undefined; // If the new match is the same as the previous match, // return the previous one to keep immutability. if (matchedPath && state.matchedPath && matchedPath.id === state.matchedPath.id && external_wp_isShallowEqual_default()(matchedPath.params, state.matchedPath.params)) { matchedPath = state.matchedPath; } return { ...restState, screens, currentLocation, matchedPath, focusSelectors }; } function UnconnectedNavigator(props, forwardedRef) { const { initialPath: initialPathProp, children, className, ...otherProps } = useContextSystem(props, 'Navigator'); const [routerState, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(routerReducer, initialPathProp, path => ({ screens: [], currentLocation: { path, isInitial: true }, matchedPath: undefined, focusSelectors: new Map(), initialPath: initialPathProp })); // The methods are constant forever, create stable references to them. const methods = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Note: calling goBack calls `goToParent` internally, as it was established // that `goBack` should behave like `goToParent`, and `goToParent` should // be marked as deprecated. goBack: options => dispatch({ type: 'gotoparent', options }), goTo: (path, options) => dispatch({ type: 'goto', path, options }), goToParent: options => { external_wp_deprecated_default()(`wp.components.useNavigator().goToParent`, { since: '6.7', alternative: 'wp.components.useNavigator().goBack' }); dispatch({ type: 'gotoparent', options }); }, addScreen: screen => dispatch({ type: 'add', screen }), removeScreen: screen => dispatch({ type: 'remove', screen }) }), []); const { currentLocation, matchedPath } = routerState; const navigatorContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => { var _matchedPath$params; return { location: currentLocation, params: (_matchedPath$params = matchedPath?.params) !== null && _matchedPath$params !== void 0 ? _matchedPath$params : {}, match: matchedPath?.id, ...methods }; }, [currentLocation, matchedPath, methods]); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(navigatorWrapper, className), [className, cx]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ref: forwardedRef, className: classes, ...otherProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigatorContext.Provider, { value: navigatorContextValue, children: children }) }); } const component_Navigator = contextConnect(UnconnectedNavigator, 'Navigator'); ;// external ["wp","escapeHtml"] const external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"]; ;// ./node_modules/@wordpress/components/build-module/navigator/navigator-screen/use-screen-animate-presence.js /** * WordPress dependencies */ /** * Internal dependencies */ // Possible values: // - 'INITIAL': the initial state // - 'ANIMATING_IN': start enter animation // - 'IN': enter animation has ended // - 'ANIMATING_OUT': start exit animation // - 'OUT': the exit animation has ended // Allow an extra 20% of the total animation duration to account for potential // event loop delays. const ANIMATION_TIMEOUT_MARGIN = 1.2; const isEnterAnimation = (animationDirection, animationStatus, animationName) => animationStatus === 'ANIMATING_IN' && animationName === ANIMATION_END_NAMES[animationDirection].in; const isExitAnimation = (animationDirection, animationStatus, animationName) => animationStatus === 'ANIMATING_OUT' && animationName === ANIMATION_END_NAMES[animationDirection].out; function useScreenAnimatePresence({ isMatch, skipAnimation, isBack, onAnimationEnd }) { const isRTL = (0,external_wp_i18n_namespaceObject.isRTL)(); const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const [animationStatus, setAnimationStatus] = (0,external_wp_element_namespaceObject.useState)('INITIAL'); // Start enter and exit animations when the screen is selected or deselected. // The animation status is set to `IN` or `OUT` immediately if the animation // should be skipped. const becameSelected = animationStatus !== 'ANIMATING_IN' && animationStatus !== 'IN' && isMatch; const becameUnselected = animationStatus !== 'ANIMATING_OUT' && animationStatus !== 'OUT' && !isMatch; (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (becameSelected) { setAnimationStatus(skipAnimation || prefersReducedMotion ? 'IN' : 'ANIMATING_IN'); } else if (becameUnselected) { setAnimationStatus(skipAnimation || prefersReducedMotion ? 'OUT' : 'ANIMATING_OUT'); } }, [becameSelected, becameUnselected, skipAnimation, prefersReducedMotion]); // Animation attributes (derived state). const animationDirection = isRTL && isBack || !isRTL && !isBack ? 'end' : 'start'; const isAnimatingIn = animationStatus === 'ANIMATING_IN'; const isAnimatingOut = animationStatus === 'ANIMATING_OUT'; let animationType; if (isAnimatingIn) { animationType = 'in'; } else if (isAnimatingOut) { animationType = 'out'; } const onScreenAnimationEnd = (0,external_wp_element_namespaceObject.useCallback)(e => { onAnimationEnd?.(e); if (isExitAnimation(animationDirection, animationStatus, e.animationName)) { // When the exit animation ends on an unselected screen, set the // status to 'OUT' to remove the screen contents from the DOM. setAnimationStatus('OUT'); } else if (isEnterAnimation(animationDirection, animationStatus, e.animationName)) { // When the enter animation ends on a selected screen, set the // status to 'IN' to ensure the screen is rendered in the DOM. setAnimationStatus('IN'); } }, [onAnimationEnd, animationStatus, animationDirection]); // Fallback timeout to ensure that the logic is applied even if the // `animationend` event is not triggered. (0,external_wp_element_namespaceObject.useEffect)(() => { let animationTimeout; if (isAnimatingOut) { animationTimeout = window.setTimeout(() => { setAnimationStatus('OUT'); animationTimeout = undefined; }, TOTAL_ANIMATION_DURATION.OUT * ANIMATION_TIMEOUT_MARGIN); } else if (isAnimatingIn) { animationTimeout = window.setTimeout(() => { setAnimationStatus('IN'); animationTimeout = undefined; }, TOTAL_ANIMATION_DURATION.IN * ANIMATION_TIMEOUT_MARGIN); } return () => { if (animationTimeout) { window.clearTimeout(animationTimeout); animationTimeout = undefined; } }; }, [isAnimatingOut, isAnimatingIn]); return { animationStyles: navigatorScreenAnimation, // Render the screen's contents in the DOM not only when the screen is // selected, but also while it is animating out. shouldRenderScreen: isMatch || animationStatus === 'IN' || animationStatus === 'ANIMATING_OUT', screenProps: { onAnimationEnd: onScreenAnimationEnd, 'data-animation-direction': animationDirection, 'data-animation-type': animationType, 'data-skip-animation': skipAnimation || undefined } }; } ;// ./node_modules/@wordpress/components/build-module/navigator/navigator-screen/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnconnectedNavigatorScreen(props, forwardedRef) { if (!/^\//.test(props.path)) { true ? external_wp_warning_default()('wp.components.Navigator.Screen: the `path` should follow a URL-like scheme; it should start with and be separated by the `/` character.') : 0; } const screenId = (0,external_wp_element_namespaceObject.useId)(); const { children, className, path, onAnimationEnd: onAnimationEndProp, ...otherProps } = useContextSystem(props, 'Navigator.Screen'); const { location, match, addScreen, removeScreen } = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext); const { isInitial, isBack, focusTargetSelector, skipFocus } = location; const isMatch = match === screenId; const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(null); const skipAnimationAndFocusRestoration = !!isInitial && !isBack; // Register / unregister screen with the navigator context. (0,external_wp_element_namespaceObject.useEffect)(() => { const screen = { id: screenId, path: (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path) }; addScreen(screen); return () => removeScreen(screen); }, [screenId, path, addScreen, removeScreen]); // Animation. const { animationStyles, shouldRenderScreen, screenProps } = useScreenAnimatePresence({ isMatch, isBack, onAnimationEnd: onAnimationEndProp, skipAnimation: skipAnimationAndFocusRestoration }); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(navigatorScreen, animationStyles, className), [className, cx, animationStyles]); // Focus restoration const locationRef = (0,external_wp_element_namespaceObject.useRef)(location); (0,external_wp_element_namespaceObject.useEffect)(() => { locationRef.current = location; }, [location]); (0,external_wp_element_namespaceObject.useEffect)(() => { const wrapperEl = wrapperRef.current; // Only attempt to restore focus: // - if the current location is not the initial one (to avoid moving focus on page load) // - when the screen becomes visible // - if the wrapper ref has been assigned // - if focus hasn't already been restored for the current location // - if the `skipFocus` option is not set to `true`. This is useful when we trigger the navigation outside of NavigatorScreen. if (skipAnimationAndFocusRestoration || !isMatch || !wrapperEl || locationRef.current.hasRestoredFocus || skipFocus) { return; } const activeElement = wrapperEl.ownerDocument.activeElement; // If an element is already focused within the wrapper do not focus the // element. This prevents inputs or buttons from losing focus unnecessarily. if (wrapperEl.contains(activeElement)) { return; } let elementToFocus = null; // When navigating back, if a selector is provided, use it to look for the // target element (assumed to be a node inside the current NavigatorScreen) if (isBack && focusTargetSelector) { elementToFocus = wrapperEl.querySelector(focusTargetSelector); } // If the previous query didn't run or find any element to focus, fallback // to the first tabbable element in the screen (or the screen itself). if (!elementToFocus) { const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(wrapperEl); elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : wrapperEl; } locationRef.current.hasRestoredFocus = true; elementToFocus.focus(); }, [skipAnimationAndFocusRestoration, isMatch, isBack, focusTargetSelector, skipFocus]); const mergedWrapperRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, wrapperRef]); return shouldRenderScreen ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ref: mergedWrapperRef, className: classes, ...screenProps, ...otherProps, children: children }) : null; } const NavigatorScreen = contextConnect(UnconnectedNavigatorScreen, 'Navigator.Screen'); ;// ./node_modules/@wordpress/components/build-module/navigator/use-navigator.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Retrieves a `navigator` instance. This hook provides advanced functionality, * such as imperatively navigating to a new location (with options like * navigating back or skipping focus restoration) and accessing the current * location and path parameters. */ function useNavigator() { const { location, params, goTo, goBack, goToParent } = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext); return { location, goTo, goBack, goToParent, params }; } ;// ./node_modules/@wordpress/components/build-module/navigator/navigator-button/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ const cssSelectorForAttribute = (attrName, attrValue) => `[${attrName}="${attrValue}"]`; function useNavigatorButton(props) { const { path, onClick, as = build_module_button, attributeName = 'id', ...otherProps } = useContextSystem(props, 'Navigator.Button'); const escapedPath = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path); const { goTo } = useNavigator(); const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => { e.preventDefault(); goTo(escapedPath, { focusTargetSelector: cssSelectorForAttribute(attributeName, escapedPath) }); onClick?.(e); }, [goTo, onClick, attributeName, escapedPath]); return { as, onClick: handleClick, ...otherProps, [attributeName]: escapedPath }; } ;// ./node_modules/@wordpress/components/build-module/navigator/navigator-button/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedNavigatorButton(props, forwardedRef) { const navigatorButtonProps = useNavigatorButton(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ref: forwardedRef, ...navigatorButtonProps }); } const NavigatorButton = contextConnect(UnconnectedNavigatorButton, 'Navigator.Button'); ;// ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useNavigatorBackButton(props) { const { onClick, as = build_module_button, ...otherProps } = useContextSystem(props, 'Navigator.BackButton'); const { goBack } = useNavigator(); const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => { e.preventDefault(); goBack(); onClick?.(e); }, [goBack, onClick]); return { as, onClick: handleClick, ...otherProps }; } ;// ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedNavigatorBackButton(props, forwardedRef) { const navigatorBackButtonProps = useNavigatorBackButton(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ref: forwardedRef, ...navigatorBackButtonProps }); } const NavigatorBackButton = contextConnect(UnconnectedNavigatorBackButton, 'Navigator.BackButton'); ;// ./node_modules/@wordpress/components/build-module/navigator/navigator-to-parent-button/component.js /** * WordPress dependencies */ /** * Internal dependencies */ function UnconnectedNavigatorToParentButton(props, forwardedRef) { external_wp_deprecated_default()('wp.components.NavigatorToParentButton', { since: '6.7', alternative: 'wp.components.Navigator.BackButton' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigatorBackButton, { ref: forwardedRef, ...props }); } /** * @deprecated */ const NavigatorToParentButton = contextConnect(UnconnectedNavigatorToParentButton, 'Navigator.ToParentButton'); ;// ./node_modules/@wordpress/components/build-module/navigator/legacy.js /** * Internal dependencies */ /** * The `NavigatorProvider` component allows rendering nested views/panels/menus * (via the `NavigatorScreen` component and navigate between them * (via the `NavigatorButton` and `NavigatorBackButton` components). * * ```jsx * import { * __experimentalNavigatorProvider as NavigatorProvider, * __experimentalNavigatorScreen as NavigatorScreen, * __experimentalNavigatorButton as NavigatorButton, * __experimentalNavigatorBackButton as NavigatorBackButton, * } from '@wordpress/components'; * * const MyNavigation = () => ( * <NavigatorProvider initialPath="/"> * <NavigatorScreen path="/"> * <p>This is the home screen.</p> * <NavigatorButton path="/child"> * Navigate to child screen. * </NavigatorButton> * </NavigatorScreen> * * <NavigatorScreen path="/child"> * <p>This is the child screen.</p> * <NavigatorBackButton> * Go back * </NavigatorBackButton> * </NavigatorScreen> * </NavigatorProvider> * ); * ``` */ const NavigatorProvider = Object.assign(component_Navigator, { displayName: 'NavigatorProvider' }); /** * The `NavigatorScreen` component represents a single view/screen/panel and * should be used in combination with the `NavigatorProvider`, the * `NavigatorButton` and the `NavigatorBackButton` components. * * @example * ```jsx * import { * __experimentalNavigatorProvider as NavigatorProvider, * __experimentalNavigatorScreen as NavigatorScreen, * __experimentalNavigatorButton as NavigatorButton, * __experimentalNavigatorBackButton as NavigatorBackButton, * } from '@wordpress/components'; * * const MyNavigation = () => ( * <NavigatorProvider initialPath="/"> * <NavigatorScreen path="/"> * <p>This is the home screen.</p> * <NavigatorButton path="/child"> * Navigate to child screen. * </NavigatorButton> * </NavigatorScreen> * * <NavigatorScreen path="/child"> * <p>This is the child screen.</p> * <NavigatorBackButton> * Go back * </NavigatorBackButton> * </NavigatorScreen> * </NavigatorProvider> * ); * ``` */ const legacy_NavigatorScreen = Object.assign(NavigatorScreen, { displayName: 'NavigatorScreen' }); /** * The `NavigatorButton` component can be used to navigate to a screen and should * be used in combination with the `NavigatorProvider`, the `NavigatorScreen` * and the `NavigatorBackButton` components. * * @example * ```jsx * import { * __experimentalNavigatorProvider as NavigatorProvider, * __experimentalNavigatorScreen as NavigatorScreen, * __experimentalNavigatorButton as NavigatorButton, * __experimentalNavigatorBackButton as NavigatorBackButton, * } from '@wordpress/components'; * * const MyNavigation = () => ( * <NavigatorProvider initialPath="/"> * <NavigatorScreen path="/"> * <p>This is the home screen.</p> * <NavigatorButton path="/child"> * Navigate to child screen. * </NavigatorButton> * </NavigatorScreen> * * <NavigatorScreen path="/child"> * <p>This is the child screen.</p> * <NavigatorBackButton> * Go back * </NavigatorBackButton> * </NavigatorScreen> * </NavigatorProvider> * ); * ``` */ const legacy_NavigatorButton = Object.assign(NavigatorButton, { displayName: 'NavigatorButton' }); /** * The `NavigatorBackButton` component can be used to navigate to a screen and * should be used in combination with the `NavigatorProvider`, the * `NavigatorScreen` and the `NavigatorButton` components. * * @example * ```jsx * import { * __experimentalNavigatorProvider as NavigatorProvider, * __experimentalNavigatorScreen as NavigatorScreen, * __experimentalNavigatorButton as NavigatorButton, * __experimentalNavigatorBackButton as NavigatorBackButton, * } from '@wordpress/components'; * * const MyNavigation = () => ( * <NavigatorProvider initialPath="/"> * <NavigatorScreen path="/"> * <p>This is the home screen.</p> * <NavigatorButton path="/child"> * Navigate to child screen. * </NavigatorButton> * </NavigatorScreen> * * <NavigatorScreen path="/child"> * <p>This is the child screen.</p> * <NavigatorBackButton> * Go back (to parent) * </NavigatorBackButton> * </NavigatorScreen> * </NavigatorProvider> * ); * ``` */ const legacy_NavigatorBackButton = Object.assign(NavigatorBackButton, { displayName: 'NavigatorBackButton' }); /** * _Note: this component is deprecated. Please use the `NavigatorBackButton` * component instead._ * * @deprecated */ const legacy_NavigatorToParentButton = Object.assign(NavigatorToParentButton, { displayName: 'NavigatorToParentButton' }); ;// ./node_modules/@wordpress/components/build-module/navigator/index.js /** * Internal dependencies */ /** * The `Navigator` component allows rendering nested views/panels/menus * (via the `Navigator.Screen` component) and navigate between them * (via the `Navigator.Button` and `Navigator.BackButton` components). * * ```jsx * import { Navigator } from '@wordpress/components'; * * const MyNavigation = () => ( * <Navigator initialPath="/"> * <Navigator.Screen path="/"> * <p>This is the home screen.</p> * <Navigator.Button path="/child"> * Navigate to child screen. * </Navigator.Button> * </Navigator.Screen> * * <Navigator.Screen path="/child"> * <p>This is the child screen.</p> * <Navigator.BackButton> * Go back * </Navigator.BackButton> * </Navigator.Screen> * </Navigator> * ); * ``` */ const navigator_Navigator = Object.assign(component_Navigator, { /** * The `Navigator.Screen` component represents a single view/screen/panel and * should be used in combination with the `Navigator`, the `Navigator.Button` * and the `Navigator.BackButton` components. * * @example * ```jsx * import { Navigator } from '@wordpress/components'; * * const MyNavigation = () => ( * <Navigator initialPath="/"> * <Navigator.Screen path="/"> * <p>This is the home screen.</p> * <Navigator.Button path="/child"> * Navigate to child screen. * </Navigator.Button> * </Navigator.Screen> * * <Navigator.Screen path="/child"> * <p>This is the child screen.</p> * <Navigator.BackButton> * Go back * </Navigator.BackButton> * </Navigator.Screen> * </Navigator> * ); * ``` */ Screen: Object.assign(NavigatorScreen, { displayName: 'Navigator.Screen' }), /** * The `Navigator.Button` component can be used to navigate to a screen and * should be used in combination with the `Navigator`, the `Navigator.Screen` * and the `Navigator.BackButton` components. * * @example * ```jsx * import { Navigator } from '@wordpress/components'; * * const MyNavigation = () => ( * <Navigator initialPath="/"> * <Navigator.Screen path="/"> * <p>This is the home screen.</p> * <Navigator.Button path="/child"> * Navigate to child screen. * </Navigator.Button> * </Navigator.Screen> * * <Navigator.Screen path="/child"> * <p>This is the child screen.</p> * <Navigator.BackButton> * Go back * </Navigator.BackButton> * </Navigator.Screen> * </Navigator> * ); * ``` */ Button: Object.assign(NavigatorButton, { displayName: 'Navigator.Button' }), /** * The `Navigator.BackButton` component can be used to navigate to a screen and * should be used in combination with the `Navigator`, the `Navigator.Screen` * and the `Navigator.Button` components. * * @example * ```jsx * import { Navigator } from '@wordpress/components'; * * const MyNavigation = () => ( * <Navigator initialPath="/"> * <Navigator.Screen path="/"> * <p>This is the home screen.</p> * <Navigator.Button path="/child"> * Navigate to child screen. * </Navigator.Button> * </Navigator.Screen> * * <Navigator.Screen path="/child"> * <p>This is the child screen.</p> * <Navigator.BackButton> * Go back * </Navigator.BackButton> * </Navigator.Screen> * </Navigator> * ); * ``` */ BackButton: Object.assign(NavigatorBackButton, { displayName: 'Navigator.BackButton' }) }); ;// ./node_modules/@wordpress/components/build-module/notice/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const notice_noop = () => {}; /** * Custom hook which announces the message with the given politeness, if a * valid message is provided. */ function useSpokenMessage(message, politeness) { const spokenMessage = typeof message === 'string' ? message : (0,external_wp_element_namespaceObject.renderToString)(message); (0,external_wp_element_namespaceObject.useEffect)(() => { if (spokenMessage) { (0,external_wp_a11y_namespaceObject.speak)(spokenMessage, politeness); } }, [spokenMessage, politeness]); } function getDefaultPoliteness(status) { switch (status) { case 'success': case 'warning': case 'info': return 'polite'; // The default will also catch the 'error' status. default: return 'assertive'; } } function getStatusLabel(status) { switch (status) { case 'warning': return (0,external_wp_i18n_namespaceObject.__)('Warning notice'); case 'info': return (0,external_wp_i18n_namespaceObject.__)('Information notice'); case 'error': return (0,external_wp_i18n_namespaceObject.__)('Error notice'); // The default will also catch the 'success' status. default: return (0,external_wp_i18n_namespaceObject.__)('Notice'); } } /** * `Notice` is a component used to communicate feedback to the user. * *```jsx * import { Notice } from `@wordpress/components`; * * const MyNotice = () => ( * <Notice status="error">An unknown error occurred.</Notice> * ); * ``` */ function Notice({ className, status = 'info', children, spokenMessage = children, onRemove = notice_noop, isDismissible = true, actions = [], politeness = getDefaultPoliteness(status), __unstableHTML, // onDismiss is a callback executed when the notice is dismissed. // It is distinct from onRemove, which _looks_ like a callback but is // actually the function to call to remove the notice from the UI. onDismiss = notice_noop }) { useSpokenMessage(spokenMessage, politeness); const classes = dist_clsx(className, 'components-notice', 'is-' + status, { 'is-dismissible': isDismissible }); if (__unstableHTML && typeof children === 'string') { children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: children }); } const onDismissNotice = () => { onDismiss(); onRemove(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: classes, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { children: getStatusLabel(status) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-notice__content", children: [children, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-notice__actions", children: actions.map(({ className: buttonCustomClasses, label, isPrimary, variant, noDefaultClasses = false, onClick, url }, index) => { let computedVariant = variant; if (variant !== 'primary' && !noDefaultClasses) { computedVariant = !url ? 'secondary' : 'link'; } if (typeof computedVariant === 'undefined' && isPrimary) { computedVariant = 'primary'; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, href: url, variant: computedVariant, onClick: url ? undefined : onClick, className: dist_clsx('components-notice__action', buttonCustomClasses), children: label }, index); }) })] }), isDismissible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { size: "small", className: "components-notice__dismiss", icon: library_close, label: (0,external_wp_i18n_namespaceObject.__)('Close'), onClick: onDismissNotice })] }); } /* harmony default export */ const build_module_notice = (Notice); ;// ./node_modules/@wordpress/components/build-module/notice/list.js /** * External dependencies */ /** * Internal dependencies */ const list_noop = () => {}; /** * `NoticeList` is a component used to render a collection of notices. * *```jsx * import { Notice, NoticeList } from `@wordpress/components`; * * const MyNoticeList = () => { * const [ notices, setNotices ] = useState( [ * { * id: 'second-notice', * content: 'second notice content', * }, * { * id: 'fist-notice', * content: 'first notice content', * }, * ] ); * * const removeNotice = ( id ) => { * setNotices( notices.filter( ( notice ) => notice.id !== id ) ); * }; * * return <NoticeList notices={ notices } onRemove={ removeNotice } />; *}; *``` */ function NoticeList({ notices, onRemove = list_noop, className, children }) { const removeNotice = id => () => onRemove(id); className = dist_clsx('components-notice-list', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, children: [children, [...notices].reverse().map(notice => { const { content, ...restNotice } = notice; return /*#__PURE__*/(0,external_React_.createElement)(build_module_notice, { ...restNotice, key: notice.id, onRemove: removeNotice(notice.id) }, notice.content); })] }); } /* harmony default export */ const list = (NoticeList); ;// ./node_modules/@wordpress/components/build-module/panel/header.js /** * Internal dependencies */ /** * `PanelHeader` renders the header for the `Panel`. * This is used by the `Panel` component under the hood, * so it does not typically need to be used. */ function PanelHeader({ label, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-panel__header", children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { children: label }), children] }); } /* harmony default export */ const panel_header = (PanelHeader); ;// ./node_modules/@wordpress/components/build-module/panel/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedPanel({ header, className, children }, ref) { const classNames = dist_clsx(className, 'components-panel'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: classNames, ref: ref, children: [header && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_header, { label: header }), children] }); } /** * `Panel` expands and collapses multiple sections of content. * * ```jsx * import { Panel, PanelBody, PanelRow } from '@wordpress/components'; * import { more } from '@wordpress/icons'; * * const MyPanel = () => ( * <Panel header="My Panel"> * <PanelBody title="My Block Settings" icon={ more } initialOpen={ true }> * <PanelRow>My Panel Inputs and Labels</PanelRow> * </PanelBody> * </Panel> * ); * ``` */ const Panel = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedPanel); /* harmony default export */ const panel = (Panel); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js /** * WordPress dependencies */ const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); /* harmony default export */ const chevron_up = (chevronUp); ;// ./node_modules/@wordpress/components/build-module/panel/body.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const body_noop = () => {}; function UnforwardedPanelBody(props, ref) { const { buttonProps = {}, children, className, icon, initialOpen, onToggle = body_noop, opened, title, scrollAfterOpen = true } = props; const [isOpened, setIsOpened] = use_controlled_state(opened, { initial: initialOpen === undefined ? true : initialOpen, fallback: false }); const nodeRef = (0,external_wp_element_namespaceObject.useRef)(null); // Defaults to 'smooth' scrolling // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView const scrollBehavior = (0,external_wp_compose_namespaceObject.useReducedMotion)() ? 'auto' : 'smooth'; const handleOnToggle = event => { event.preventDefault(); const next = !isOpened; setIsOpened(next); onToggle(next); }; // Ref is used so that the effect does not re-run upon scrollAfterOpen changing value. const scrollAfterOpenRef = (0,external_wp_element_namespaceObject.useRef)(); scrollAfterOpenRef.current = scrollAfterOpen; // Runs after initial render. use_update_effect(() => { if (isOpened && scrollAfterOpenRef.current && nodeRef.current?.scrollIntoView) { /* * Scrolls the content into view when visible. * This improves the UX when there are multiple stacking <PanelBody /> * components in a scrollable container. */ nodeRef.current.scrollIntoView({ inline: 'nearest', block: 'nearest', behavior: scrollBehavior }); } }, [isOpened, scrollBehavior]); const classes = dist_clsx('components-panel__body', className, { 'is-opened': isOpened }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: classes, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([nodeRef, ref]), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelBodyTitle, { icon: icon, isOpened: Boolean(isOpened), onClick: handleOnToggle, title: title, ...buttonProps }), typeof children === 'function' ? children({ opened: Boolean(isOpened) }) : isOpened && children] }); } const PanelBodyTitle = (0,external_wp_element_namespaceObject.forwardRef)(({ isOpened, icon, title, ...props }, ref) => { if (!title) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "components-panel__body-title", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(build_module_button, { __next40pxDefaultSize: true, className: "components-panel__body-toggle", "aria-expanded": isOpened, ref: ref, ...props, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-hidden": "true", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { className: "components-panel__arrow", icon: isOpened ? chevron_up : chevron_down }) }), title, icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon, className: "components-panel__icon", size: 20 })] }) }); }); const PanelBody = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedPanelBody); /* harmony default export */ const body = (PanelBody); ;// ./node_modules/@wordpress/components/build-module/panel/row.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedPanelRow({ className, children }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('components-panel__row', className), ref: ref, children: children }); } /** * `PanelRow` is a generic container for rows within a `PanelBody`. * It is a flex container with a top margin for spacing. */ const PanelRow = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedPanelRow); /* harmony default export */ const row = (PanelRow); ;// ./node_modules/@wordpress/components/build-module/placeholder/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const PlaceholderIllustration = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { className: "components-placeholder__illustration", fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 60 60", preserveAspectRatio: "none", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { vectorEffect: "non-scaling-stroke", d: "M60 60 0 0" }) }); /** * Renders a placeholder. Normally used by blocks to render their empty state. * * ```jsx * import { Placeholder } from '@wordpress/components'; * import { more } from '@wordpress/icons'; * * const MyPlaceholder = () => <Placeholder icon={ more } label="Placeholder" />; * ``` */ function Placeholder(props) { const { icon, children, label, instructions, className, notices, preview, isColumnLayout, withIllustration, ...additionalProps } = props; const [resizeListener, { width }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); // Since `useResizeObserver` will report a width of `null` until after the // first render, avoid applying any modifier classes until width is known. let modifierClassNames; if (typeof width === 'number') { modifierClassNames = { 'is-large': width >= 480, 'is-medium': width >= 160 && width < 480, 'is-small': width < 160 }; } const classes = dist_clsx('components-placeholder', className, modifierClassNames, withIllustration ? 'has-illustration' : null); const fieldsetClasses = dist_clsx('components-placeholder__fieldset', { 'is-column-layout': isColumnLayout }); (0,external_wp_element_namespaceObject.useEffect)(() => { if (instructions) { (0,external_wp_a11y_namespaceObject.speak)(instructions); } }, [instructions]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...additionalProps, className: classes, children: [withIllustration ? PlaceholderIllustration : null, resizeListener, notices, preview && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-placeholder__preview", children: preview }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-placeholder__label", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon }), label] }), !!instructions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-placeholder__instructions", children: instructions }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: fieldsetClasses, children: children })] }); } /* harmony default export */ const placeholder = (Placeholder); ;// ./node_modules/@wordpress/components/build-module/progress-bar/styles.js function progress_bar_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function animateProgressBar(isRtl = false) { const animationDirection = isRtl ? 'right' : 'left'; return emotion_react_browser_esm_keyframes({ '0%': { [animationDirection]: '-50%' }, '100%': { [animationDirection]: '100%' } }); } // Width of the indicator for the indeterminate progress bar const INDETERMINATE_TRACK_WIDTH = 50; const styles_Track = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e15u147w2" } : 0)("position:relative;overflow:hidden;height:", config_values.borderWidthFocus, ";background-color:color-mix(\n\t\tin srgb,\n\t\t", COLORS.theme.foreground, ",\n\t\ttransparent 90%\n\t);border-radius:", config_values.radiusFull, ";outline:2px solid transparent;outline-offset:2px;:where( & ){width:160px;}" + ( true ? "" : 0)); var progress_bar_styles_ref = true ? { name: "152sa26", styles: "width:var(--indicator-width);transition:width 0.4s ease-in-out" } : 0; const Indicator = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e15u147w1" } : 0)("display:inline-block;position:absolute;top:0;height:100%;border-radius:", config_values.radiusFull, ";background-color:color-mix(\n\t\tin srgb,\n\t\t", COLORS.theme.foreground, ",\n\t\ttransparent 10%\n\t);outline:2px solid transparent;outline-offset:-2px;", ({ isIndeterminate }) => isIndeterminate ? /*#__PURE__*/emotion_react_browser_esm_css({ animationDuration: '1.5s', animationTimingFunction: 'ease-in-out', animationIterationCount: 'infinite', animationName: animateProgressBar((0,external_wp_i18n_namespaceObject.isRTL)()), width: `${INDETERMINATE_TRACK_WIDTH}%` }, true ? "" : 0, true ? "" : 0) : progress_bar_styles_ref, ";" + ( true ? "" : 0)); const ProgressElement = /*#__PURE__*/emotion_styled_base_browser_esm("progress", true ? { target: "e15u147w0" } : 0)( true ? { name: "11fb690", styles: "position:absolute;top:0;left:0;opacity:0;width:100%;height:100%" } : 0); ;// ./node_modules/@wordpress/components/build-module/progress-bar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedProgressBar(props, ref) { const { className, value, ...progressProps } = props; const isIndeterminate = !Number.isFinite(value); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(styles_Track, { className: className, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Indicator, { style: { '--indicator-width': !isIndeterminate ? `${value}%` : undefined }, isIndeterminate: isIndeterminate }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ProgressElement, { max: 100, value: value, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Loading …'), ref: ref, ...progressProps })] }); } /** * A simple horizontal progress bar component. * * Supports two modes: determinate and indeterminate. A progress bar is determinate * when a specific progress value has been specified (from 0 to 100), and indeterminate * when a value hasn't been specified. * * ```jsx * import { ProgressBar } from '@wordpress/components'; * * const MyLoadingComponent = () => { * return <ProgressBar />; * }; * ``` */ const ProgressBar = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedProgressBar); /* harmony default export */ const progress_bar = (ProgressBar); ;// ./node_modules/@wordpress/components/build-module/query-controls/terms.js /** * Internal dependencies */ const ensureParentsAreDefined = terms => { return terms.every(term => term.parent !== null); }; /** * Returns terms in a tree form. * * @param flatTerms Array of terms in flat format. * * @return Terms in tree format. */ function buildTermsTree(flatTerms) { const flatTermsWithParentAndChildren = flatTerms.map(term => ({ children: [], parent: null, ...term, id: String(term.id) })); // We use a custom type guard here to ensure that the parent property is // defined on all terms. The type of the `parent` property is `number | null` // and we need to ensure that it is `number`. This is because we use the // `parent` property as a key in the `termsByParent` object. if (!ensureParentsAreDefined(flatTermsWithParentAndChildren)) { return flatTermsWithParentAndChildren; } const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => { const { parent } = term; if (!acc[parent]) { acc[parent] = []; } acc[parent].push(term); return acc; }, {}); const fillWithChildren = terms => { return terms.map(term => { const children = termsByParent[term.id]; return { ...term, children: children && children.length ? fillWithChildren(children) : [] }; }); }; return fillWithChildren(termsByParent['0'] || []); } ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/components/build-module/tree-select/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const tree_select_CONTEXT_VALUE = { BaseControl: { // Temporary during deprecation grace period: Overrides the underlying `__associatedWPComponentName` // via the context system to override the value set by SelectControl. _overrides: { __associatedWPComponentName: 'TreeSelect' } } }; function getSelectOptions(tree, level = 0) { return tree.flatMap(treeNode => [{ value: treeNode.id, label: '\u00A0'.repeat(level * 3) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name) }, ...getSelectOptions(treeNode.children || [], level + 1)]); } /** * Generates a hierarchical select input. * * ```jsx * import { useState } from 'react'; * import { TreeSelect } from '@wordpress/components'; * * const MyTreeSelect = () => { * const [ page, setPage ] = useState( 'p21' ); * * return ( * <TreeSelect * __nextHasNoMarginBottom * __next40pxDefaultSize * label="Parent page" * noOptionLabel="No parent page" * onChange={ ( newPage ) => setPage( newPage ) } * selectedId={ page } * tree={ [ * { * name: 'Page 1', * id: 'p1', * children: [ * { name: 'Descend 1 of page 1', id: 'p11' }, * { name: 'Descend 2 of page 1', id: 'p12' }, * ], * }, * { * name: 'Page 2', * id: 'p2', * children: [ * { * name: 'Descend 1 of page 2', * id: 'p21', * children: [ * { * name: 'Descend 1 of Descend 1 of page 2', * id: 'p211', * }, * ], * }, * ], * }, * ] } * /> * ); * } * ``` */ function TreeSelect(props) { const { label, noOptionLabel, onChange, selectedId, tree = [], ...restProps } = useDeprecated36pxDefaultSizeProp(props); const options = (0,external_wp_element_namespaceObject.useMemo)(() => { return [noOptionLabel && { value: '', label: noOptionLabel }, ...getSelectOptions(tree)].filter(option => !!option); }, [noOptionLabel, tree]); maybeWarnDeprecated36pxSize({ componentName: 'TreeSelect', size: restProps.size, __next40pxDefaultSize: restProps.__next40pxDefaultSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextSystemProvider, { value: tree_select_CONTEXT_VALUE, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectControl, { __shouldNotWarnDeprecated36pxSize: true, label, options, onChange, value: selectedId, ...restProps }) }); } /* harmony default export */ const tree_select = (TreeSelect); ;// ./node_modules/@wordpress/components/build-module/query-controls/author-select.js /** * Internal dependencies */ function AuthorSelect({ __next40pxDefaultSize, label, noOptionLabel, authorList, selectedAuthorId, onChange: onChangeProp }) { if (!authorList) { return null; } const termsTree = buildTermsTree(authorList); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tree_select, { label, noOptionLabel, onChange: onChangeProp, tree: termsTree, selectedId: selectedAuthorId !== undefined ? String(selectedAuthorId) : undefined, __nextHasNoMarginBottom: true, __next40pxDefaultSize: __next40pxDefaultSize }); } ;// ./node_modules/@wordpress/components/build-module/query-controls/category-select.js /** * Internal dependencies */ /** * WordPress dependencies */ function CategorySelect({ __next40pxDefaultSize, label, noOptionLabel, categoriesList, selectedCategoryId, onChange: onChangeProp, ...props }) { const termsTree = (0,external_wp_element_namespaceObject.useMemo)(() => { return buildTermsTree(categoriesList); }, [categoriesList]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tree_select, { label, noOptionLabel, onChange: onChangeProp, tree: termsTree, selectedId: selectedCategoryId !== undefined ? String(selectedCategoryId) : undefined, ...props, __nextHasNoMarginBottom: true, __next40pxDefaultSize: __next40pxDefaultSize }); } ;// ./node_modules/@wordpress/components/build-module/query-controls/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_MIN_ITEMS = 1; const DEFAULT_MAX_ITEMS = 100; const MAX_CATEGORIES_SUGGESTIONS = 20; function isSingleCategorySelection(props) { return 'categoriesList' in props; } function isMultipleCategorySelection(props) { return 'categorySuggestions' in props; } const defaultOrderByOptions = [{ label: (0,external_wp_i18n_namespaceObject.__)('Newest to oldest'), value: 'date/desc' }, { label: (0,external_wp_i18n_namespaceObject.__)('Oldest to newest'), value: 'date/asc' }, { /* translators: Label for ordering posts by title in ascending order. */ label: (0,external_wp_i18n_namespaceObject.__)('A → Z'), value: 'title/asc' }, { /* translators: Label for ordering posts by title in descending order. */ label: (0,external_wp_i18n_namespaceObject.__)('Z → A'), value: 'title/desc' }]; /** * Controls to query for posts. * * ```jsx * const MyQueryControls = () => ( * <QueryControls * { ...{ maxItems, minItems, numberOfItems, order, orderBy, orderByOptions } } * onOrderByChange={ ( newOrderBy ) => { * updateQuery( { orderBy: newOrderBy } ) * } * onOrderChange={ ( newOrder ) => { * updateQuery( { order: newOrder } ) * } * categoriesList={ categories } * selectedCategoryId={ category } * onCategoryChange={ ( newCategory ) => { * updateQuery( { category: newCategory } ) * } * onNumberOfItemsChange={ ( newNumberOfItems ) => { * updateQuery( { numberOfItems: newNumberOfItems } ) * } } * /> * ); * ``` */ function QueryControls({ authorList, selectedAuthorId, numberOfItems, order, orderBy, orderByOptions = defaultOrderByOptions, maxItems = DEFAULT_MAX_ITEMS, minItems = DEFAULT_MIN_ITEMS, onAuthorChange, onNumberOfItemsChange, onOrderChange, onOrderByChange, // Props for single OR multiple category selection are not destructured here, // but instead are destructured inline where necessary. ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(v_stack_component, { spacing: "4", className: "components-query-controls", children: [onOrderChange && onOrderByChange && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(select_control, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Order by'), value: orderBy === undefined || order === undefined ? undefined : `${orderBy}/${order}`, options: orderByOptions, onChange: value => { if (typeof value !== 'string') { return; } const [newOrderBy, newOrder] = value.split('/'); if (newOrder !== order) { onOrderChange(newOrder); } if (newOrderBy !== orderBy) { onOrderByChange(newOrderBy); } } }, "query-controls-order-select"), isSingleCategorySelection(props) && props.categoriesList && props.onCategoryChange && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategorySelect, { __next40pxDefaultSize: true, categoriesList: props.categoriesList, label: (0,external_wp_i18n_namespaceObject.__)('Category'), noOptionLabel: (0,external_wp_i18n_namespaceObject._x)('All', 'categories'), selectedCategoryId: props.selectedCategoryId, onChange: props.onCategoryChange }, "query-controls-category-select"), isMultipleCategorySelection(props) && props.categorySuggestions && props.onCategoryChange && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(form_token_field, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Categories'), value: props.selectedCategories && props.selectedCategories.map(item => ({ id: item.id, // Keeping the fallback to `item.value` for legacy reasons, // even if items of `selectedCategories` should not have a // `value` property. // @ts-expect-error value: item.name || item.value })), suggestions: Object.keys(props.categorySuggestions), onChange: props.onCategoryChange, maxSuggestions: MAX_CATEGORIES_SUGGESTIONS }, "query-controls-categories-select"), onAuthorChange && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AuthorSelect, { __next40pxDefaultSize: true, authorList: authorList, label: (0,external_wp_i18n_namespaceObject.__)('Author'), noOptionLabel: (0,external_wp_i18n_namespaceObject._x)('All', 'authors'), selectedAuthorId: selectedAuthorId, onChange: onAuthorChange }, "query-controls-author-select"), onNumberOfItemsChange && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(range_control, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Number of items'), value: numberOfItems, onChange: onNumberOfItemsChange, min: minItems, max: maxItems, required: true }, "query-controls-range-control")] }); } /* harmony default export */ const query_controls = (QueryControls); ;// ./node_modules/@wordpress/components/build-module/radio-group/context.js /** * External dependencies */ /** * WordPress dependencies */ const RadioGroupContext = (0,external_wp_element_namespaceObject.createContext)({ store: undefined, disabled: undefined }); ;// ./node_modules/@wordpress/components/build-module/radio-group/radio.js /** * WordPress dependencies */ /** * External dependencies */ /** * Internal dependencies */ function UnforwardedRadio({ value, children, ...props }, ref) { const { store, disabled } = (0,external_wp_element_namespaceObject.useContext)(RadioGroupContext); const selectedValue = useStoreState(store, 'value'); const isChecked = selectedValue !== undefined && selectedValue === value; maybeWarnDeprecated36pxSize({ componentName: 'Radio', size: undefined, __next40pxDefaultSize: props.__next40pxDefaultSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Radio, { disabled: disabled, store: store, ref: ref, value: value, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { variant: isChecked ? 'primary' : 'secondary', ...props }), children: children || value }); } /** * @deprecated Use `RadioControl` or `ToggleGroupControl` instead. */ const radio_Radio = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedRadio); /* harmony default export */ const radio_group_radio = (radio_Radio); ;// ./node_modules/@wordpress/components/build-module/radio-group/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedRadioGroup({ label, checked, defaultChecked, disabled, onChange, children, ...props }, ref) { const radioStore = useRadioStore({ value: checked, defaultValue: defaultChecked, setValue: newValue => { onChange?.(newValue !== null && newValue !== void 0 ? newValue : undefined); }, rtl: (0,external_wp_i18n_namespaceObject.isRTL)() }); const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ store: radioStore, disabled }), [radioStore, disabled]); external_wp_deprecated_default()('wp.components.__experimentalRadioGroup', { alternative: 'wp.components.RadioControl or wp.components.__experimentalToggleGroupControl', since: '6.8' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RadioGroupContext.Provider, { value: contextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RadioGroup, { store: radioStore, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(button_group, { __shouldNotWarnDeprecated: true, children: children }), "aria-label": label, ref: ref, ...props }) }); } /** * @deprecated Use `RadioControl` or `ToggleGroupControl` instead. */ const radio_group_RadioGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedRadioGroup); /* harmony default export */ const radio_group = (radio_group_RadioGroup); ;// ./node_modules/@wordpress/components/build-module/radio-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function generateOptionDescriptionId(radioGroupId, index) { return `${radioGroupId}-${index}-option-description`; } function generateOptionId(radioGroupId, index) { return `${radioGroupId}-${index}`; } function generateHelpId(radioGroupId) { return `${radioGroupId}__help`; } /** * Render a user interface to select the user type using radio inputs. * * ```jsx * import { RadioControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyRadioControl = () => { * const [ option, setOption ] = useState( 'a' ); * * return ( * <RadioControl * label="User type" * help="The type of the current user" * selected={ option } * options={ [ * { label: 'Author', value: 'a' }, * { label: 'Editor', value: 'e' }, * ] } * onChange={ ( value ) => setOption( value ) } * /> * ); * }; * ``` */ function RadioControl(props) { const { label, className, selected, help, onChange, hideLabelFromVision, options = [], id: preferredId, ...additionalProps } = props; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(RadioControl, 'inspector-radio-control', preferredId); const onChangeValue = event => onChange(event.target.value); if (!options?.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { id: id, className: dist_clsx(className, 'components-radio-control'), "aria-describedby": !!help ? generateHelpId(id) : undefined, children: [hideLabelFromVision ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { as: "legend", children: label }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control.VisualLabel, { as: "legend", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(v_stack_component, { spacing: 3, className: dist_clsx('components-radio-control__group-wrapper', { 'has-help': !!help }), children: options.map((option, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-radio-control__option", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { id: generateOptionId(id, index), className: "components-radio-control__input", type: "radio", name: id, value: option.value, onChange: onChangeValue, checked: option.value === selected, "aria-describedby": !!option.description ? generateOptionDescriptionId(id, index) : undefined, ...additionalProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { className: "components-radio-control__label", htmlFor: generateOptionId(id, index), children: option.label }), !!option.description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledHelp, { __nextHasNoMarginBottom: true, id: generateOptionDescriptionId(id, index), className: "components-radio-control__option-description", children: option.description }) : null] }, generateOptionId(id, index))) }), !!help && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledHelp, { __nextHasNoMarginBottom: true, id: generateHelpId(id), className: "components-base-control__help", children: help })] }); } /* harmony default export */ const radio_control = (RadioControl); ;// ./node_modules/re-resizable/lib/resizer.js var resizer_extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var resizer_assign = (undefined && undefined.__assign) || function () { resizer_assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return resizer_assign.apply(this, arguments); }; var rowSizeBase = { width: '100%', height: '10px', top: '0px', left: '0px', cursor: 'row-resize', }; var colSizeBase = { width: '10px', height: '100%', top: '0px', left: '0px', cursor: 'col-resize', }; var edgeBase = { width: '20px', height: '20px', position: 'absolute', }; var resizer_styles = { top: resizer_assign(resizer_assign({}, rowSizeBase), { top: '-5px' }), right: resizer_assign(resizer_assign({}, colSizeBase), { left: undefined, right: '-5px' }), bottom: resizer_assign(resizer_assign({}, rowSizeBase), { top: undefined, bottom: '-5px' }), left: resizer_assign(resizer_assign({}, colSizeBase), { left: '-5px' }), topRight: resizer_assign(resizer_assign({}, edgeBase), { right: '-10px', top: '-10px', cursor: 'ne-resize' }), bottomRight: resizer_assign(resizer_assign({}, edgeBase), { right: '-10px', bottom: '-10px', cursor: 'se-resize' }), bottomLeft: resizer_assign(resizer_assign({}, edgeBase), { left: '-10px', bottom: '-10px', cursor: 'sw-resize' }), topLeft: resizer_assign(resizer_assign({}, edgeBase), { left: '-10px', top: '-10px', cursor: 'nw-resize' }), }; var Resizer = /** @class */ (function (_super) { resizer_extends(Resizer, _super); function Resizer() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.onMouseDown = function (e) { _this.props.onResizeStart(e, _this.props.direction); }; _this.onTouchStart = function (e) { _this.props.onResizeStart(e, _this.props.direction); }; return _this; } Resizer.prototype.render = function () { return (external_React_.createElement("div", { className: this.props.className || '', style: resizer_assign(resizer_assign({ position: 'absolute', userSelect: 'none' }, resizer_styles[this.props.direction]), (this.props.replaceStyles || {})), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children)); }; return Resizer; }(external_React_.PureComponent)); ;// ./node_modules/re-resizable/lib/index.js var lib_extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var lib_assign = (undefined && undefined.__assign) || function () { lib_assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return lib_assign.apply(this, arguments); }; var DEFAULT_SIZE = { width: 'auto', height: 'auto', }; var lib_clamp = function (n, min, max) { return Math.max(Math.min(n, max), min); }; var snap = function (n, size) { return Math.round(n / size) * size; }; var hasDirection = function (dir, target) { return new RegExp(dir, 'i').test(target); }; // INFO: In case of window is a Proxy and does not porxy Events correctly, use isTouchEvent & isMouseEvent to distinguish event type instead of `instanceof`. var isTouchEvent = function (event) { return Boolean(event.touches && event.touches.length); }; var isMouseEvent = function (event) { return Boolean((event.clientX || event.clientX === 0) && (event.clientY || event.clientY === 0)); }; var findClosestSnap = function (n, snapArray, snapGap) { if (snapGap === void 0) { snapGap = 0; } var closestGapIndex = snapArray.reduce(function (prev, curr, index) { return (Math.abs(curr - n) < Math.abs(snapArray[prev] - n) ? index : prev); }, 0); var gap = Math.abs(snapArray[closestGapIndex] - n); return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n; }; var getStringSize = function (n) { n = n.toString(); if (n === 'auto') { return n; } if (n.endsWith('px')) { return n; } if (n.endsWith('%')) { return n; } if (n.endsWith('vh')) { return n; } if (n.endsWith('vw')) { return n; } if (n.endsWith('vmax')) { return n; } if (n.endsWith('vmin')) { return n; } return n + "px"; }; var getPixelSize = function (size, parentSize, innerWidth, innerHeight) { if (size && typeof size === 'string') { if (size.endsWith('px')) { return Number(size.replace('px', '')); } if (size.endsWith('%')) { var ratio = Number(size.replace('%', '')) / 100; return parentSize * ratio; } if (size.endsWith('vw')) { var ratio = Number(size.replace('vw', '')) / 100; return innerWidth * ratio; } if (size.endsWith('vh')) { var ratio = Number(size.replace('vh', '')) / 100; return innerHeight * ratio; } } return size; }; var calculateNewMax = function (parentSize, innerWidth, innerHeight, maxWidth, maxHeight, minWidth, minHeight) { maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth, innerHeight); maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth, innerHeight); minWidth = getPixelSize(minWidth, parentSize.width, innerWidth, innerHeight); minHeight = getPixelSize(minHeight, parentSize.height, innerWidth, innerHeight); return { maxWidth: typeof maxWidth === 'undefined' ? undefined : Number(maxWidth), maxHeight: typeof maxHeight === 'undefined' ? undefined : Number(maxHeight), minWidth: typeof minWidth === 'undefined' ? undefined : Number(minWidth), minHeight: typeof minHeight === 'undefined' ? undefined : Number(minHeight), }; }; var definedProps = [ 'as', 'style', 'className', 'grid', 'snap', 'bounds', 'boundsByDirection', 'size', 'defaultSize', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'lockAspectRatio', 'lockAspectRatioExtraWidth', 'lockAspectRatioExtraHeight', 'enable', 'handleStyles', 'handleClasses', 'handleWrapperStyle', 'handleWrapperClass', 'children', 'onResizeStart', 'onResize', 'onResizeStop', 'handleComponent', 'scale', 'resizeRatio', 'snapGap', ]; // HACK: This class is used to calculate % size. var baseClassName = '__resizable_base__'; var Resizable = /** @class */ (function (_super) { lib_extends(Resizable, _super); function Resizable(props) { var _this = _super.call(this, props) || this; _this.ratio = 1; _this.resizable = null; // For parent boundary _this.parentLeft = 0; _this.parentTop = 0; // For boundary _this.resizableLeft = 0; _this.resizableRight = 0; _this.resizableTop = 0; _this.resizableBottom = 0; // For target boundary _this.targetLeft = 0; _this.targetTop = 0; _this.appendBase = function () { if (!_this.resizable || !_this.window) { return null; } var parent = _this.parentNode; if (!parent) { return null; } var element = _this.window.document.createElement('div'); element.style.width = '100%'; element.style.height = '100%'; element.style.position = 'absolute'; element.style.transform = 'scale(0, 0)'; element.style.left = '0'; element.style.flex = '0 0 100%'; if (element.classList) { element.classList.add(baseClassName); } else { element.className += baseClassName; } parent.appendChild(element); return element; }; _this.removeBase = function (base) { var parent = _this.parentNode; if (!parent) { return; } parent.removeChild(base); }; _this.ref = function (c) { if (c) { _this.resizable = c; } }; _this.state = { isResizing: false, width: typeof (_this.propsSize && _this.propsSize.width) === 'undefined' ? 'auto' : _this.propsSize && _this.propsSize.width, height: typeof (_this.propsSize && _this.propsSize.height) === 'undefined' ? 'auto' : _this.propsSize && _this.propsSize.height, direction: 'right', original: { x: 0, y: 0, width: 0, height: 0, }, backgroundStyle: { height: '100%', width: '100%', backgroundColor: 'rgba(0,0,0,0)', cursor: 'auto', opacity: 0, position: 'fixed', zIndex: 9999, top: '0', left: '0', bottom: '0', right: '0', }, flexBasis: undefined, }; _this.onResizeStart = _this.onResizeStart.bind(_this); _this.onMouseMove = _this.onMouseMove.bind(_this); _this.onMouseUp = _this.onMouseUp.bind(_this); return _this; } Object.defineProperty(Resizable.prototype, "parentNode", { get: function () { if (!this.resizable) { return null; } return this.resizable.parentNode; }, enumerable: false, configurable: true }); Object.defineProperty(Resizable.prototype, "window", { get: function () { if (!this.resizable) { return null; } if (!this.resizable.ownerDocument) { return null; } return this.resizable.ownerDocument.defaultView; }, enumerable: false, configurable: true }); Object.defineProperty(Resizable.prototype, "propsSize", { get: function () { return this.props.size || this.props.defaultSize || DEFAULT_SIZE; }, enumerable: false, configurable: true }); Object.defineProperty(Resizable.prototype, "size", { get: function () { var width = 0; var height = 0; if (this.resizable && this.window) { var orgWidth = this.resizable.offsetWidth; var orgHeight = this.resizable.offsetHeight; // HACK: Set position `relative` to get parent size. // This is because when re-resizable set `absolute`, I can not get base width correctly. var orgPosition = this.resizable.style.position; if (orgPosition !== 'relative') { this.resizable.style.position = 'relative'; } // INFO: Use original width or height if set auto. width = this.resizable.style.width !== 'auto' ? this.resizable.offsetWidth : orgWidth; height = this.resizable.style.height !== 'auto' ? this.resizable.offsetHeight : orgHeight; // Restore original position this.resizable.style.position = orgPosition; } return { width: width, height: height }; }, enumerable: false, configurable: true }); Object.defineProperty(Resizable.prototype, "sizeStyle", { get: function () { var _this = this; var size = this.props.size; var getSize = function (key) { if (typeof _this.state[key] === 'undefined' || _this.state[key] === 'auto') { return 'auto'; } if (_this.propsSize && _this.propsSize[key] && _this.propsSize[key].toString().endsWith('%')) { if (_this.state[key].toString().endsWith('%')) { return _this.state[key].toString(); } var parentSize = _this.getParentSize(); var value = Number(_this.state[key].toString().replace('px', '')); var percent = (value / parentSize[key]) * 100; return percent + "%"; } return getStringSize(_this.state[key]); }; var width = size && typeof size.width !== 'undefined' && !this.state.isResizing ? getStringSize(size.width) : getSize('width'); var height = size && typeof size.height !== 'undefined' && !this.state.isResizing ? getStringSize(size.height) : getSize('height'); return { width: width, height: height }; }, enumerable: false, configurable: true }); Resizable.prototype.getParentSize = function () { if (!this.parentNode) { if (!this.window) { return { width: 0, height: 0 }; } return { width: this.window.innerWidth, height: this.window.innerHeight }; } var base = this.appendBase(); if (!base) { return { width: 0, height: 0 }; } // INFO: To calculate parent width with flex layout var wrapChanged = false; var wrap = this.parentNode.style.flexWrap; if (wrap !== 'wrap') { wrapChanged = true; this.parentNode.style.flexWrap = 'wrap'; // HACK: Use relative to get parent padding size } base.style.position = 'relative'; base.style.minWidth = '100%'; base.style.minHeight = '100%'; var size = { width: base.offsetWidth, height: base.offsetHeight, }; if (wrapChanged) { this.parentNode.style.flexWrap = wrap; } this.removeBase(base); return size; }; Resizable.prototype.bindEvents = function () { if (this.window) { this.window.addEventListener('mouseup', this.onMouseUp); this.window.addEventListener('mousemove', this.onMouseMove); this.window.addEventListener('mouseleave', this.onMouseUp); this.window.addEventListener('touchmove', this.onMouseMove, { capture: true, passive: false, }); this.window.addEventListener('touchend', this.onMouseUp); } }; Resizable.prototype.unbindEvents = function () { if (this.window) { this.window.removeEventListener('mouseup', this.onMouseUp); this.window.removeEventListener('mousemove', this.onMouseMove); this.window.removeEventListener('mouseleave', this.onMouseUp); this.window.removeEventListener('touchmove', this.onMouseMove, true); this.window.removeEventListener('touchend', this.onMouseUp); } }; Resizable.prototype.componentDidMount = function () { if (!this.resizable || !this.window) { return; } var computedStyle = this.window.getComputedStyle(this.resizable); this.setState({ width: this.state.width || this.size.width, height: this.state.height || this.size.height, flexBasis: computedStyle.flexBasis !== 'auto' ? computedStyle.flexBasis : undefined, }); }; Resizable.prototype.componentWillUnmount = function () { if (this.window) { this.unbindEvents(); } }; Resizable.prototype.createSizeForCssProperty = function (newSize, kind) { var propsSize = this.propsSize && this.propsSize[kind]; return this.state[kind] === 'auto' && this.state.original[kind] === newSize && (typeof propsSize === 'undefined' || propsSize === 'auto') ? 'auto' : newSize; }; Resizable.prototype.calculateNewMaxFromBoundary = function (maxWidth, maxHeight) { var boundsByDirection = this.props.boundsByDirection; var direction = this.state.direction; var widthByDirection = boundsByDirection && hasDirection('left', direction); var heightByDirection = boundsByDirection && hasDirection('top', direction); var boundWidth; var boundHeight; if (this.props.bounds === 'parent') { var parent_1 = this.parentNode; if (parent_1) { boundWidth = widthByDirection ? this.resizableRight - this.parentLeft : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft); boundHeight = heightByDirection ? this.resizableBottom - this.parentTop : parent_1.offsetHeight + (this.parentTop - this.resizableTop); } } else if (this.props.bounds === 'window') { if (this.window) { boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft; boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop; } } else if (this.props.bounds) { boundWidth = widthByDirection ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft); boundHeight = heightByDirection ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop); } if (boundWidth && Number.isFinite(boundWidth)) { maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth; } if (boundHeight && Number.isFinite(boundHeight)) { maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight; } return { maxWidth: maxWidth, maxHeight: maxHeight }; }; Resizable.prototype.calculateNewSizeFromDirection = function (clientX, clientY) { var scale = this.props.scale || 1; var resizeRatio = this.props.resizeRatio || 1; var _a = this.state, direction = _a.direction, original = _a.original; var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth; var newWidth = original.width; var newHeight = original.height; var extraHeight = lockAspectRatioExtraHeight || 0; var extraWidth = lockAspectRatioExtraWidth || 0; if (hasDirection('right', direction)) { newWidth = original.width + ((clientX - original.x) * resizeRatio) / scale; if (lockAspectRatio) { newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; } } if (hasDirection('left', direction)) { newWidth = original.width - ((clientX - original.x) * resizeRatio) / scale; if (lockAspectRatio) { newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; } } if (hasDirection('bottom', direction)) { newHeight = original.height + ((clientY - original.y) * resizeRatio) / scale; if (lockAspectRatio) { newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; } } if (hasDirection('top', direction)) { newHeight = original.height - ((clientY - original.y) * resizeRatio) / scale; if (lockAspectRatio) { newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; } } return { newWidth: newWidth, newHeight: newHeight }; }; Resizable.prototype.calculateNewSizeFromAspectRatio = function (newWidth, newHeight, max, min) { var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth; var computedMinWidth = typeof min.width === 'undefined' ? 10 : min.width; var computedMaxWidth = typeof max.width === 'undefined' || max.width < 0 ? newWidth : max.width; var computedMinHeight = typeof min.height === 'undefined' ? 10 : min.height; var computedMaxHeight = typeof max.height === 'undefined' || max.height < 0 ? newHeight : max.height; var extraHeight = lockAspectRatioExtraHeight || 0; var extraWidth = lockAspectRatioExtraWidth || 0; if (lockAspectRatio) { var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth; var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth; var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight; var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight; var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth); var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth); var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight); var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight); newWidth = lib_clamp(newWidth, lockedMinWidth, lockedMaxWidth); newHeight = lib_clamp(newHeight, lockedMinHeight, lockedMaxHeight); } else { newWidth = lib_clamp(newWidth, computedMinWidth, computedMaxWidth); newHeight = lib_clamp(newHeight, computedMinHeight, computedMaxHeight); } return { newWidth: newWidth, newHeight: newHeight }; }; Resizable.prototype.setBoundingClientRect = function () { // For parent boundary if (this.props.bounds === 'parent') { var parent_2 = this.parentNode; if (parent_2) { var parentRect = parent_2.getBoundingClientRect(); this.parentLeft = parentRect.left; this.parentTop = parentRect.top; } } // For target(html element) boundary if (this.props.bounds && typeof this.props.bounds !== 'string') { var targetRect = this.props.bounds.getBoundingClientRect(); this.targetLeft = targetRect.left; this.targetTop = targetRect.top; } // For boundary if (this.resizable) { var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom; this.resizableLeft = left; this.resizableRight = right; this.resizableTop = top_1; this.resizableBottom = bottom; } }; Resizable.prototype.onResizeStart = function (event, direction) { if (!this.resizable || !this.window) { return; } var clientX = 0; var clientY = 0; if (event.nativeEvent && isMouseEvent(event.nativeEvent)) { clientX = event.nativeEvent.clientX; clientY = event.nativeEvent.clientY; } else if (event.nativeEvent && isTouchEvent(event.nativeEvent)) { clientX = event.nativeEvent.touches[0].clientX; clientY = event.nativeEvent.touches[0].clientY; } if (this.props.onResizeStart) { if (this.resizable) { var startResize = this.props.onResizeStart(event, direction, this.resizable); if (startResize === false) { return; } } } // Fix #168 if (this.props.size) { if (typeof this.props.size.height !== 'undefined' && this.props.size.height !== this.state.height) { this.setState({ height: this.props.size.height }); } if (typeof this.props.size.width !== 'undefined' && this.props.size.width !== this.state.width) { this.setState({ width: this.props.size.width }); } } // For lockAspectRatio case this.ratio = typeof this.props.lockAspectRatio === 'number' ? this.props.lockAspectRatio : this.size.width / this.size.height; var flexBasis; var computedStyle = this.window.getComputedStyle(this.resizable); if (computedStyle.flexBasis !== 'auto') { var parent_3 = this.parentNode; if (parent_3) { var dir = this.window.getComputedStyle(parent_3).flexDirection; this.flexDir = dir.startsWith('row') ? 'row' : 'column'; flexBasis = computedStyle.flexBasis; } } // For boundary this.setBoundingClientRect(); this.bindEvents(); var state = { original: { x: clientX, y: clientY, width: this.size.width, height: this.size.height, }, isResizing: true, backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || 'auto' }), direction: direction, flexBasis: flexBasis, }; this.setState(state); }; Resizable.prototype.onMouseMove = function (event) { var _this = this; if (!this.state.isResizing || !this.resizable || !this.window) { return; } if (this.window.TouchEvent && isTouchEvent(event)) { try { event.preventDefault(); event.stopPropagation(); } catch (e) { // Ignore on fail } } var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight; var clientX = isTouchEvent(event) ? event.touches[0].clientX : event.clientX; var clientY = isTouchEvent(event) ? event.touches[0].clientY : event.clientY; var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height; var parentSize = this.getParentSize(); var max = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight); maxWidth = max.maxWidth; maxHeight = max.maxHeight; minWidth = max.minWidth; minHeight = max.minHeight; // Calculate new size var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth; // Calculate max size from boundary settings var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight); if (this.props.snap && this.props.snap.x) { newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap); } if (this.props.snap && this.props.snap.y) { newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap); } // Calculate new size from aspect ratio var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight }); newWidth = newSize.newWidth; newHeight = newSize.newHeight; if (this.props.grid) { var newGridWidth = snap(newWidth, this.props.grid[0]); var newGridHeight = snap(newHeight, this.props.grid[1]); var gap = this.props.snapGap || 0; newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth; newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight; } var delta = { width: newWidth - original.width, height: newHeight - original.height, }; if (width && typeof width === 'string') { if (width.endsWith('%')) { var percent = (newWidth / parentSize.width) * 100; newWidth = percent + "%"; } else if (width.endsWith('vw')) { var vw = (newWidth / this.window.innerWidth) * 100; newWidth = vw + "vw"; } else if (width.endsWith('vh')) { var vh = (newWidth / this.window.innerHeight) * 100; newWidth = vh + "vh"; } } if (height && typeof height === 'string') { if (height.endsWith('%')) { var percent = (newHeight / parentSize.height) * 100; newHeight = percent + "%"; } else if (height.endsWith('vw')) { var vw = (newHeight / this.window.innerWidth) * 100; newHeight = vw + "vw"; } else if (height.endsWith('vh')) { var vh = (newHeight / this.window.innerHeight) * 100; newHeight = vh + "vh"; } } var newState = { width: this.createSizeForCssProperty(newWidth, 'width'), height: this.createSizeForCssProperty(newHeight, 'height'), }; if (this.flexDir === 'row') { newState.flexBasis = newState.width; } else if (this.flexDir === 'column') { newState.flexBasis = newState.height; } // For v18, update state sync (0,external_ReactDOM_namespaceObject.flushSync)(function () { _this.setState(newState); }); if (this.props.onResize) { this.props.onResize(event, direction, this.resizable, delta); } }; Resizable.prototype.onMouseUp = function (event) { var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original; if (!isResizing || !this.resizable) { return; } var delta = { width: this.size.width - original.width, height: this.size.height - original.height, }; if (this.props.onResizeStop) { this.props.onResizeStop(event, direction, this.resizable, delta); } if (this.props.size) { this.setState(this.props.size); } this.unbindEvents(); this.setState({ isResizing: false, backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: 'auto' }), }); }; Resizable.prototype.updateSize = function (size) { this.setState({ width: size.width, height: size.height }); }; Resizable.prototype.renderResizer = function () { var _this = this; var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent; if (!enable) { return null; } var resizers = Object.keys(enable).map(function (dir) { if (enable[dir] !== false) { return (external_React_.createElement(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null)); } return null; }); // #93 Wrap the resize box in span (will not break 100% width/height) return (external_React_.createElement("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers)); }; Resizable.prototype.render = function () { var _this = this; var extendsProps = Object.keys(this.props).reduce(function (acc, key) { if (definedProps.indexOf(key) !== -1) { return acc; } acc[key] = _this.props[key]; return acc; }, {}); var style = lib_assign(lib_assign(lib_assign({ position: 'relative', userSelect: this.state.isResizing ? 'none' : 'auto' }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: 'border-box', flexShrink: 0 }); if (this.state.flexBasis) { style.flexBasis = this.state.flexBasis; } var Wrapper = this.props.as || 'div'; return (external_React_.createElement(Wrapper, lib_assign({ ref: this.ref, style: style, className: this.props.className }, extendsProps), this.state.isResizing && external_React_.createElement("div", { style: this.state.backgroundStyle }), this.props.children, this.renderResizer())); }; Resizable.defaultProps = { as: 'div', onResizeStart: function () { }, onResize: function () { }, onResizeStop: function () { }, enable: { top: true, right: true, bottom: true, left: true, topRight: true, bottomRight: true, bottomLeft: true, topLeft: true, }, style: {}, grid: [1, 1], lockAspectRatio: false, lockAspectRatioExtraWidth: 0, lockAspectRatioExtraHeight: 0, scale: 1, resizeRatio: 1, snapGap: 0, }; return Resizable; }(external_React_.PureComponent)); ;// ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/utils.js /** * WordPress dependencies */ const utils_noop = () => {}; const POSITIONS = { bottom: 'bottom', corner: 'corner' }; /** * Custom hook that manages resize listener events. It also provides a label * based on current resize width x height values. * * @param props * @param props.axis Only shows the label corresponding to the axis. * @param props.fadeTimeout Duration (ms) before deactivating the resize label. * @param props.onResize Callback when a resize occurs. Provides { width, height } callback. * @param props.position Adjusts label value. * @param props.showPx Whether to add `PX` to the label. * * @return Properties for hook. */ function useResizeLabel({ axis, fadeTimeout = 180, onResize = utils_noop, position = POSITIONS.bottom, showPx = false }) { /* * The width/height values derive from this special useResizeObserver hook. * This custom hook uses the ResizeObserver API to listen for resize events. */ const [resizeListener, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); /* * Indicates if the x/y axis is preferred. * If set, we will avoid resetting the moveX and moveY values. * This will allow for the preferred axis values to persist in the label. */ const isAxisControlled = !!axis; /* * The moveX and moveY values are used to track whether the label should * display width, height, or width x height. */ const [moveX, setMoveX] = (0,external_wp_element_namespaceObject.useState)(false); const [moveY, setMoveY] = (0,external_wp_element_namespaceObject.useState)(false); /* * Cached dimension values to check for width/height updates from the * sizes property from useResizeAware() */ const { width, height } = sizes; const heightRef = (0,external_wp_element_namespaceObject.useRef)(height); const widthRef = (0,external_wp_element_namespaceObject.useRef)(width); /* * This timeout is used with setMoveX and setMoveY to determine of * both width and height values have changed at (roughly) the same time. */ const moveTimeoutRef = (0,external_wp_element_namespaceObject.useRef)(); const debounceUnsetMoveXY = (0,external_wp_element_namespaceObject.useCallback)(() => { const unsetMoveXY = () => { /* * If axis is controlled, we will avoid resetting the moveX and moveY values. * This will allow for the preferred axis values to persist in the label. */ if (isAxisControlled) { return; } setMoveX(false); setMoveY(false); }; if (moveTimeoutRef.current) { window.clearTimeout(moveTimeoutRef.current); } moveTimeoutRef.current = window.setTimeout(unsetMoveXY, fadeTimeout); }, [fadeTimeout, isAxisControlled]); (0,external_wp_element_namespaceObject.useEffect)(() => { /* * On the initial render of useResizeAware, the height and width values are * null. They are calculated then set using via an internal useEffect hook. */ const isRendered = width !== null || height !== null; if (!isRendered) { return; } const didWidthChange = width !== widthRef.current; const didHeightChange = height !== heightRef.current; if (!didWidthChange && !didHeightChange) { return; } /* * After the initial render, the useResizeAware will set the first * width and height values. We'll sync those values with our * width and height refs. However, we shouldn't render our Tooltip * label on this first cycle. */ if (width && !widthRef.current && height && !heightRef.current) { widthRef.current = width; heightRef.current = height; return; } /* * After the first cycle, we can track width and height changes. */ if (didWidthChange) { setMoveX(true); widthRef.current = width; } if (didHeightChange) { setMoveY(true); heightRef.current = height; } onResize({ width, height }); debounceUnsetMoveXY(); }, [width, height, onResize, debounceUnsetMoveXY]); const label = getSizeLabel({ axis, height, moveX, moveY, position, showPx, width }); return { label, resizeListener }; } /** * Gets the resize label based on width and height values (as well as recent changes). * * @param props * @param props.axis Only shows the label corresponding to the axis. * @param props.height Height value. * @param props.moveX Recent width (x axis) changes. * @param props.moveY Recent width (y axis) changes. * @param props.position Adjusts label value. * @param props.showPx Whether to add `PX` to the label. * @param props.width Width value. * * @return The rendered label. */ function getSizeLabel({ axis, height, moveX = false, moveY = false, position = POSITIONS.bottom, showPx = false, width }) { if (!moveX && !moveY) { return undefined; } /* * Corner position... * We want the label to appear like width x height. */ if (position === POSITIONS.corner) { return `${width} x ${height}`; } /* * Other POSITIONS... * The label will combine both width x height values if both * values have recently been changed. * * Otherwise, only width or height will be displayed. * The `PX` unit will be added, if specified by the `showPx` prop. */ const labelUnit = showPx ? ' px' : ''; if (axis) { if (axis === 'x' && moveX) { return `${width}${labelUnit}`; } if (axis === 'y' && moveY) { return `${height}${labelUnit}`; } } if (moveX && moveY) { return `${width} x ${height}`; } if (moveX) { return `${width}${labelUnit}`; } if (moveY) { return `${height}${labelUnit}`; } return undefined; } ;// ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js function resize_tooltip_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const resize_tooltip_styles_Root = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1wq7y4k3" } : 0)( true ? { name: "1cd7zoc", styles: "bottom:0;box-sizing:border-box;left:0;pointer-events:none;position:absolute;right:0;top:0" } : 0); const TooltipWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1wq7y4k2" } : 0)( true ? { name: "ajymcs", styles: "align-items:center;box-sizing:border-box;display:inline-flex;justify-content:center;opacity:0;pointer-events:none;transition:opacity 120ms linear" } : 0); const resize_tooltip_styles_Tooltip = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1wq7y4k1" } : 0)("background:", COLORS.theme.foreground, ";border-radius:", config_values.radiusSmall, ";box-sizing:border-box;font-family:", font('default.fontFamily'), ";font-size:12px;color:", COLORS.theme.foregroundInverted, ";padding:4px 8px;position:relative;" + ( true ? "" : 0)); // TODO: Resolve need to use &&& to increase specificity // https://github.com/WordPress/gutenberg/issues/18483 const LabelText = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? { target: "e1wq7y4k0" } : 0)("&&&{color:", COLORS.theme.foregroundInverted, ";display:block;font-size:13px;line-height:1.4;white-space:nowrap;}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/label.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const CORNER_OFFSET = 4; const CURSOR_OFFSET_TOP = CORNER_OFFSET * 2.5; function resize_tooltip_label_Label({ label, position = POSITIONS.corner, zIndex = 1000, ...props }, ref) { const showLabel = !!label; const isBottom = position === POSITIONS.bottom; const isCorner = position === POSITIONS.corner; if (!showLabel) { return null; } let style = { opacity: showLabel ? 1 : undefined, zIndex }; let labelStyle = {}; if (isBottom) { style = { ...style, position: 'absolute', bottom: CURSOR_OFFSET_TOP * -1, left: '50%', transform: 'translate(-50%, 0)' }; labelStyle = { transform: `translate(0, 100%)` }; } if (isCorner) { style = { ...style, position: 'absolute', top: CORNER_OFFSET, right: (0,external_wp_i18n_namespaceObject.isRTL)() ? undefined : CORNER_OFFSET, left: (0,external_wp_i18n_namespaceObject.isRTL)() ? CORNER_OFFSET : undefined }; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TooltipWrapper, { "aria-hidden": "true", className: "components-resizable-tooltip__tooltip-wrapper", ref: ref, style: style, ...props, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resize_tooltip_styles_Tooltip, { className: "components-resizable-tooltip__tooltip", style: labelStyle, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LabelText, { as: "span", children: label }) }) }); } const label_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(resize_tooltip_label_Label); /* harmony default export */ const resize_tooltip_label = (label_ForwardedComponent); ;// ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const resize_tooltip_noop = () => {}; function ResizeTooltip({ axis, className, fadeTimeout = 180, isVisible = true, labelRef, onResize = resize_tooltip_noop, position = POSITIONS.bottom, showPx = true, zIndex = 1000, ...props }, ref) { const { label, resizeListener } = useResizeLabel({ axis, fadeTimeout, onResize, showPx, position }); if (!isVisible) { return null; } const classes = dist_clsx('components-resize-tooltip', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(resize_tooltip_styles_Root, { "aria-hidden": "true", className: classes, ref: ref, ...props, children: [resizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resize_tooltip_label, { "aria-hidden": props['aria-hidden'], label: label, position: position, ref: labelRef, zIndex: zIndex })] }); } const resize_tooltip_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(ResizeTooltip); /* harmony default export */ const resize_tooltip = (resize_tooltip_ForwardedComponent); ;// ./node_modules/@wordpress/components/build-module/resizable-box/index.js /** * WordPress dependencies */ /** * External dependencies */ /** * Internal dependencies */ const HANDLE_CLASS_NAME = 'components-resizable-box__handle'; const SIDE_HANDLE_CLASS_NAME = 'components-resizable-box__side-handle'; const CORNER_HANDLE_CLASS_NAME = 'components-resizable-box__corner-handle'; const HANDLE_CLASSES = { top: dist_clsx(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top'), right: dist_clsx(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-right'), bottom: dist_clsx(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom'), left: dist_clsx(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-left'), topLeft: dist_clsx(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top', 'components-resizable-box__handle-left'), topRight: dist_clsx(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top', 'components-resizable-box__handle-right'), bottomRight: dist_clsx(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-right'), bottomLeft: dist_clsx(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-left') }; // Removes the inline styles in the drag handles. const HANDLE_STYLES_OVERRIDES = { width: undefined, height: undefined, top: undefined, right: undefined, bottom: undefined, left: undefined }; const HANDLE_STYLES = { top: HANDLE_STYLES_OVERRIDES, right: HANDLE_STYLES_OVERRIDES, bottom: HANDLE_STYLES_OVERRIDES, left: HANDLE_STYLES_OVERRIDES, topLeft: HANDLE_STYLES_OVERRIDES, topRight: HANDLE_STYLES_OVERRIDES, bottomRight: HANDLE_STYLES_OVERRIDES, bottomLeft: HANDLE_STYLES_OVERRIDES }; function UnforwardedResizableBox({ className, children, showHandle = true, __experimentalShowTooltip: showTooltip = false, __experimentalTooltipProps: tooltipProps = {}, ...props }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Resizable, { className: dist_clsx('components-resizable-box__container', showHandle && 'has-show-handle', className) // Add a focusable element within the drag handle. Unfortunately, // `re-resizable` does not make them properly focusable by default, // causing focus to move the the block wrapper which triggers block // drag. , handleComponent: Object.fromEntries(Object.keys(HANDLE_CLASSES).map(key => [key, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { tabIndex: -1 }, key)])), handleClasses: HANDLE_CLASSES, handleStyles: HANDLE_STYLES, ref: ref, ...props, children: [children, showTooltip && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resize_tooltip, { ...tooltipProps })] }); } const ResizableBox = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedResizableBox); /* harmony default export */ const resizable_box = (ResizableBox); ;// ./node_modules/@wordpress/components/build-module/responsive-wrapper/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * A wrapper component that maintains its aspect ratio when resized. * * ```jsx * import { ResponsiveWrapper } from '@wordpress/components'; * * const MyResponsiveWrapper = () => ( * <ResponsiveWrapper naturalWidth={ 2000 } naturalHeight={ 680 }> * <img * src="https://s.w.org/style/images/about/WordPress-logotype-standard.png" * alt="WordPress" * /> * </ResponsiveWrapper> * ); * ``` */ function ResponsiveWrapper({ naturalWidth, naturalHeight, children, isInline = false }) { if (external_wp_element_namespaceObject.Children.count(children) !== 1) { return null; } const TagName = isInline ? 'span' : 'div'; let aspectRatio; if (naturalWidth && naturalHeight) { aspectRatio = `${naturalWidth} / ${naturalHeight}`; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { className: "components-responsive-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: (0,external_wp_element_namespaceObject.cloneElement)(children, { className: dist_clsx('components-responsive-wrapper__content', children.props.className), style: { ...children.props.style, aspectRatio } }) }) }); } /* harmony default export */ const responsive_wrapper = (ResponsiveWrapper); ;// ./node_modules/@wordpress/components/build-module/sandbox/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const observeAndResizeJS = function () { const { MutationObserver } = window; if (!MutationObserver || !document.body || !window.parent) { return; } function sendResize() { const clientBoundingRect = document.body.getBoundingClientRect(); window.parent.postMessage({ action: 'resize', width: clientBoundingRect.width, height: clientBoundingRect.height }, '*'); } const observer = new MutationObserver(sendResize); observer.observe(document.body, { attributes: true, attributeOldValue: false, characterData: true, characterDataOldValue: false, childList: true, subtree: true }); window.addEventListener('load', sendResize, true); // Hack: Remove viewport unit styles, as these are relative // the iframe root and interfere with our mechanism for // determining the unconstrained page bounds. function removeViewportStyles(ruleOrNode) { if (ruleOrNode.style) { ['width', 'height', 'minHeight', 'maxHeight'].forEach(function (style) { if (/^\\d+(vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(ruleOrNode.style[style])) { ruleOrNode.style[style] = ''; } }); } } Array.prototype.forEach.call(document.querySelectorAll('[style]'), removeViewportStyles); Array.prototype.forEach.call(document.styleSheets, function (stylesheet) { Array.prototype.forEach.call(stylesheet.cssRules || stylesheet.rules, removeViewportStyles); }); document.body.style.position = 'absolute'; document.body.style.width = '100%'; document.body.setAttribute('data-resizable-iframe-connected', ''); sendResize(); // Resize events can change the width of elements with 100% width, but we don't // get an DOM mutations for that, so do the resize when the window is resized, too. window.addEventListener('resize', sendResize, true); }; // TODO: These styles shouldn't be coupled with WordPress. const style = ` body { margin: 0; } html, body, body > div { width: 100%; } html.wp-has-aspect-ratio, body.wp-has-aspect-ratio, body.wp-has-aspect-ratio > div, body.wp-has-aspect-ratio > div iframe { width: 100%; height: 100%; overflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */ } body > div > * { margin-top: 0 !important; /* Has to have !important to override inline styles. */ margin-bottom: 0 !important; } `; /** * This component provides an isolated environment for arbitrary HTML via iframes. * * ```jsx * import { SandBox } from '@wordpress/components'; * * const MySandBox = () => ( * <SandBox html="<p>Content</p>" title="SandBox" type="embed" /> * ); * ``` */ function SandBox({ html = '', title = '', type, styles = [], scripts = [], onFocus, tabIndex }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(0); const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(0); function isFrameAccessible() { try { return !!ref.current?.contentDocument?.body; } catch (e) { return false; } } function trySandBox(forceRerender = false) { if (!isFrameAccessible()) { return; } const { contentDocument, ownerDocument } = ref.current; if (!forceRerender && null !== contentDocument?.body.getAttribute('data-resizable-iframe-connected')) { return; } // Put the html snippet into a html document, and then write it to the iframe's document // we can use this in the future to inject custom styles or scripts. // Scripts go into the body rather than the head, to support embedded content such as Instagram // that expect the scripts to be part of the body. const htmlDoc = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("html", { lang: ownerDocument.documentElement.lang, className: type, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("head", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("title", { children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { dangerouslySetInnerHTML: { __html: style } }), styles.map((rules, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { dangerouslySetInnerHTML: { __html: rules } }, i))] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("body", { "data-resizable-iframe-connected": "data-resizable-iframe-connected", className: type, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { dangerouslySetInnerHTML: { __html: html } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("script", { type: "text/javascript", dangerouslySetInnerHTML: { __html: `(${observeAndResizeJS.toString()})();` } }), scripts.map(src => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("script", { src: src }, src))] })] }); // Writing the document like this makes it act in the same way as if it was // loaded over the network, so DOM creation and mutation, script execution, etc. // all work as expected. contentDocument.open(); contentDocument.write('<!DOCTYPE html>' + (0,external_wp_element_namespaceObject.renderToString)(htmlDoc)); contentDocument.close(); } (0,external_wp_element_namespaceObject.useEffect)(() => { trySandBox(); function tryNoForceSandBox() { trySandBox(false); } function checkMessageForResize(event) { const iframe = ref.current; // Verify that the mounted element is the source of the message. if (!iframe || iframe.contentWindow !== event.source) { return; } // Attempt to parse the message data as JSON if passed as string. let data = event.data || {}; if ('string' === typeof data) { try { data = JSON.parse(data); } catch (e) {} } // Update the state only if the message is formatted as we expect, // i.e. as an object with a 'resize' action. if ('resize' !== data.action) { return; } setWidth(data.width); setHeight(data.height); } const iframe = ref.current; const defaultView = iframe?.ownerDocument?.defaultView; // This used to be registered using <iframe onLoad={} />, but it made the iframe blank // after reordering the containing block. See these two issues for more details: // https://github.com/WordPress/gutenberg/issues/6146 // https://github.com/facebook/react/issues/18752 iframe?.addEventListener('load', tryNoForceSandBox, false); defaultView?.addEventListener('message', checkMessageForResize); return () => { iframe?.removeEventListener('load', tryNoForceSandBox, false); defaultView?.removeEventListener('message', checkMessageForResize); }; // Passing `exhaustive-deps` will likely involve a more detailed refactor. // See https://github.com/WordPress/gutenberg/pull/44378 }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { trySandBox(); // Passing `exhaustive-deps` will likely involve a more detailed refactor. // See https://github.com/WordPress/gutenberg/pull/44378 }, [title, styles, scripts]); (0,external_wp_element_namespaceObject.useEffect)(() => { trySandBox(true); // Passing `exhaustive-deps` will likely involve a more detailed refactor. // See https://github.com/WordPress/gutenberg/pull/44378 }, [html, type]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]), title: title, tabIndex: tabIndex, className: "components-sandbox", sandbox: "allow-scripts allow-same-origin allow-presentation", onFocus: onFocus, width: Math.ceil(width), height: Math.ceil(height) }); } /* harmony default export */ const sandbox = (SandBox); ;// ./node_modules/@wordpress/components/build-module/snackbar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const NOTICE_TIMEOUT = 10000; /** * Custom hook which announces the message with the given politeness, if a * valid message is provided. * * @param message Message to announce. * @param politeness Politeness to announce. */ function snackbar_useSpokenMessage(message, politeness) { const spokenMessage = typeof message === 'string' ? message : (0,external_wp_element_namespaceObject.renderToString)(message); (0,external_wp_element_namespaceObject.useEffect)(() => { if (spokenMessage) { (0,external_wp_a11y_namespaceObject.speak)(spokenMessage, politeness); } }, [spokenMessage, politeness]); } function UnforwardedSnackbar({ className, children, spokenMessage = children, politeness = 'polite', actions = [], onRemove, icon = null, explicitDismiss = false, // onDismiss is a callback executed when the snackbar is dismissed. // It is distinct from onRemove, which _looks_ like a callback but is // actually the function to call to remove the snackbar from the UI. onDismiss, listRef }, ref) { function dismissMe(event) { if (event && event.preventDefault) { event.preventDefault(); } // Prevent focus loss by moving it to the list element. listRef?.current?.focus(); onDismiss?.(); onRemove?.(); } function onActionClick(event, onClick) { event.stopPropagation(); onRemove?.(); if (onClick) { onClick(event); } } snackbar_useSpokenMessage(spokenMessage, politeness); // The `onDismiss/onRemove` can have unstable references, // trigger side-effect cleanup, and reset timers. const callbacksRef = (0,external_wp_element_namespaceObject.useRef)({ onDismiss, onRemove }); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { callbacksRef.current = { onDismiss, onRemove }; }); (0,external_wp_element_namespaceObject.useEffect)(() => { // Only set up the timeout dismiss if we're not explicitly dismissing. const timeoutHandle = setTimeout(() => { if (!explicitDismiss) { callbacksRef.current.onDismiss?.(); callbacksRef.current.onRemove?.(); } }, NOTICE_TIMEOUT); return () => clearTimeout(timeoutHandle); }, [explicitDismiss]); const classes = dist_clsx(className, 'components-snackbar', { 'components-snackbar-explicit-dismiss': !!explicitDismiss }); if (actions && actions.length > 1) { // We need to inform developers that snackbar only accepts 1 action. true ? external_wp_warning_default()('Snackbar can only have one action. Use Notice if your message requires many actions.') : 0; // return first element only while keeping it inside an array actions = [actions[0]]; } const snackbarContentClassnames = dist_clsx('components-snackbar__content', { 'components-snackbar__content-with-icon': !!icon }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, className: classes, onClick: !explicitDismiss ? dismissMe : undefined, tabIndex: 0, role: !explicitDismiss ? 'button' : undefined, onKeyPress: !explicitDismiss ? dismissMe : undefined, "aria-label": !explicitDismiss ? (0,external_wp_i18n_namespaceObject.__)('Dismiss this notice') : undefined, "data-testid": "snackbar", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: snackbarContentClassnames, children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-snackbar__icon", children: icon }), children, actions.map(({ label, onClick, url }, index) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, href: url, variant: "link", onClick: event => onActionClick(event, onClick), className: "components-snackbar__action", children: label }, index); }), explicitDismiss && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { role: "button", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Dismiss this notice'), tabIndex: 0, className: "components-snackbar__dismiss-button", onClick: dismissMe, onKeyPress: dismissMe, children: "\u2715" })] }) }); } /** * A Snackbar displays a succinct message that is cleared out after a small delay. * * It can also offer the user options, like viewing a published post. * But these options should also be available elsewhere in the UI. * * ```jsx * const MySnackbarNotice = () => ( * <Snackbar>Post published successfully.</Snackbar> * ); * ``` */ const Snackbar = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSnackbar); /* harmony default export */ const snackbar = (Snackbar); ;// ./node_modules/@wordpress/components/build-module/snackbar/list.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const SNACKBAR_VARIANTS = { init: { height: 0, opacity: 0 }, open: { height: 'auto', opacity: 1, transition: { height: { type: 'tween', duration: 0.3, ease: [0, 0, 0.2, 1] }, opacity: { type: 'tween', duration: 0.25, delay: 0.05, ease: [0, 0, 0.2, 1] } } }, exit: { opacity: 0, transition: { type: 'tween', duration: 0.1, ease: [0, 0, 0.2, 1] } } }; /** * Renders a list of notices. * * ```jsx * const MySnackbarListNotice = () => ( * <SnackbarList * notices={ notices } * onRemove={ removeNotice } * /> * ); * ``` */ function SnackbarList({ notices, className, children, onRemove }) { const listRef = (0,external_wp_element_namespaceObject.useRef)(null); const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); className = dist_clsx('components-snackbar-list', className); const removeNotice = notice => () => onRemove?.(notice.id); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, tabIndex: -1, ref: listRef, "data-testid": "snackbar-list", children: [children, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AnimatePresence, { children: notices.map(notice => { const { content, ...restNotice } = notice; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(motion.div, { layout: !isReducedMotion // See https://www.framer.com/docs/animation/#layout-animations , initial: "init", animate: "open", exit: "exit", variants: isReducedMotion ? undefined : SNACKBAR_VARIANTS, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-snackbar-list__notice-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(snackbar, { ...restNotice, onRemove: removeNotice(notice), listRef: listRef, children: notice.content }) }) }, notice.id); }) })] }); } /* harmony default export */ const snackbar_list = (SnackbarList); ;// ./node_modules/@wordpress/components/build-module/surface/component.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedSurface(props, forwardedRef) { const surfaceProps = useSurface(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...surfaceProps, ref: forwardedRef }); } /** * `Surface` is a core component that renders a primary background color. * * In the example below, notice how the `Surface` renders in white (or dark gray if in dark mode). * * ```jsx * import { * __experimentalSurface as Surface, * __experimentalText as Text, * } from '@wordpress/components'; * * function Example() { * return ( * <Surface> * <Text>Code is Poetry</Text> * </Surface> * ); * } * ``` */ const component_Surface = contextConnect(UnconnectedSurface, 'Surface'); /* harmony default export */ const surface_component = (component_Surface); ;// ./node_modules/@ariakit/core/esm/tab/tab-store.js "use client"; // src/tab/tab-store.ts function createTabStore(_a = {}) { var _b = _a, { composite: parentComposite, combobox } = _b, props = _3YLGPPWQ_objRest(_b, [ "composite", "combobox" ]); const independentKeys = [ "items", "renderedItems", "moves", "orientation", "virtualFocus", "includesBaseElement", "baseElement", "focusLoop", "focusShift", "focusWrap" ]; const store = mergeStore( props.store, omit2(parentComposite, independentKeys), omit2(combobox, independentKeys) ); const syncState = store == null ? void 0 : store.getState(); const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store, // We need to explicitly set the default value of `includesBaseElement` to // `false` since we don't want the composite store to default it to `true` // when the activeId state is null, which could be the case when rendering // combobox with tab. includesBaseElement: defaultValue( props.includesBaseElement, syncState == null ? void 0 : syncState.includesBaseElement, false ), orientation: defaultValue( props.orientation, syncState == null ? void 0 : syncState.orientation, "horizontal" ), focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true) })); const panels = createCollectionStore(); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), { selectedId: defaultValue( props.selectedId, syncState == null ? void 0 : syncState.selectedId, props.defaultSelectedId ), selectOnMove: defaultValue( props.selectOnMove, syncState == null ? void 0 : syncState.selectOnMove, true ) }); const tab = createStore(initialState, composite, store); setup( tab, () => sync(tab, ["moves"], () => { const { activeId, selectOnMove } = tab.getState(); if (!selectOnMove) return; if (!activeId) return; const tabItem = composite.item(activeId); if (!tabItem) return; if (tabItem.dimmed) return; if (tabItem.disabled) return; tab.setState("selectedId", tabItem.id); }) ); let syncActiveId = true; setup( tab, () => batch(tab, ["selectedId"], (state, prev) => { if (!syncActiveId) { syncActiveId = true; return; } if (parentComposite && state.selectedId === prev.selectedId) return; tab.setState("activeId", state.selectedId); }) ); setup( tab, () => sync(tab, ["selectedId", "renderedItems"], (state) => { if (state.selectedId !== void 0) return; const { activeId, renderedItems } = tab.getState(); const tabItem = composite.item(activeId); if (tabItem && !tabItem.disabled && !tabItem.dimmed) { tab.setState("selectedId", tabItem.id); } else { const tabItem2 = renderedItems.find( (item) => !item.disabled && !item.dimmed ); tab.setState("selectedId", tabItem2 == null ? void 0 : tabItem2.id); } }) ); setup( tab, () => sync(tab, ["renderedItems"], (state) => { const tabs = state.renderedItems; if (!tabs.length) return; return sync(panels, ["renderedItems"], (state2) => { const items = state2.renderedItems; const hasOrphanPanels = items.some((panel) => !panel.tabId); if (!hasOrphanPanels) return; items.forEach((panel, i) => { if (panel.tabId) return; const tabItem = tabs[i]; if (!tabItem) return; panels.renderItem(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, panel), { tabId: tabItem.id })); }); }); }) ); let selectedIdFromSelectedValue = null; setup(tab, () => { const backupSelectedId = () => { selectedIdFromSelectedValue = tab.getState().selectedId; }; const restoreSelectedId = () => { syncActiveId = false; tab.setState("selectedId", selectedIdFromSelectedValue); }; if (parentComposite && "setSelectElement" in parentComposite) { return chain( sync(parentComposite, ["value"], backupSelectedId), sync(parentComposite, ["mounted"], restoreSelectedId) ); } if (!combobox) return; return chain( sync(combobox, ["selectedValue"], backupSelectedId), sync(combobox, ["mounted"], restoreSelectedId) ); }); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite), tab), { panels, setSelectedId: (id) => tab.setState("selectedId", id), select: (id) => { tab.setState("selectedId", id); composite.move(id); } }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/PY4NZ6HS.js "use client"; // src/tab/tab-store.ts function useTabStoreProps(store, update, props) { useUpdateEffect(update, [props.composite, props.combobox]); store = useCompositeStoreProps(store, update, props); useStoreProps(store, props, "selectedId", "setSelectedId"); useStoreProps(store, props, "selectOnMove"); const [panels, updatePanels] = YV4JVR4I_useStore(() => store.panels, {}); useUpdateEffect(updatePanels, [store, updatePanels]); return Object.assign( (0,external_React_.useMemo)(() => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { panels }), [store, panels]), { composite: props.composite, combobox: props.combobox } ); } function useTabStore(props = {}) { const combobox = useComboboxContext(); const composite = useSelectContext() || combobox; props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { composite: props.composite !== void 0 ? props.composite : composite, combobox: props.combobox !== void 0 ? props.combobox : combobox }); const [store, update] = YV4JVR4I_useStore(createTabStore, props); return useTabStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/UYGDZTLQ.js "use client"; // src/tab/tab-context.tsx var UYGDZTLQ_ctx = createStoreContext( [CompositeContextProvider], [CompositeScopedContextProvider] ); var useTabContext = UYGDZTLQ_ctx.useContext; var useTabScopedContext = UYGDZTLQ_ctx.useScopedContext; var useTabProviderContext = UYGDZTLQ_ctx.useProviderContext; var TabContextProvider = UYGDZTLQ_ctx.ContextProvider; var TabScopedContextProvider = UYGDZTLQ_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/tab/tab-list.js "use client"; // src/tab/tab-list.tsx var tab_list_TagName = "div"; var useTabList = createHook( function useTabList2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useTabProviderContext(); store = store || context; invariant( store, false && 0 ); const orientation = store.useState( (state) => state.orientation === "both" ? void 0 : state.orientation ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TabScopedContextProvider, { value: store, children: element }), [store] ); if (store.composite) { props = _3YLGPPWQ_spreadValues({ focusable: false }, props); } props = _3YLGPPWQ_spreadValues({ role: "tablist", "aria-orientation": orientation }, props); props = useComposite(_3YLGPPWQ_spreadValues({ store }, props)); return props; } ); var TabList = forwardRef2(function TabList2(props) { const htmlProps = useTabList(props); return LMDWO4NN_createElement(tab_list_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/tab/tab.js "use client"; // src/tab/tab.tsx var tab_TagName = "button"; var useTab = createHook(function useTab2(_a) { var _b = _a, { store, getItem: getItemProp } = _b, props = __objRest(_b, [ "store", "getItem" ]); var _a2; const context = useTabScopedContext(); store = store || context; invariant( store, false && 0 ); const defaultId = useId(); const id = props.id || defaultId; const dimmed = disabledFromProps(props); const getItem = (0,external_React_.useCallback)( (item) => { const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { dimmed }); if (getItemProp) { return getItemProp(nextItem); } return nextItem; }, [dimmed, getItemProp] ); const onClickProp = props.onClick; const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; store == null ? void 0 : store.setSelectedId(id); }); const panelId = store.panels.useState( (state) => { var _a3; return (_a3 = state.items.find((item) => item.tabId === id)) == null ? void 0 : _a3.id; } ); const shouldRegisterItem = defaultId ? props.shouldRegisterItem : false; const isActive = store.useState((state) => !!id && state.activeId === id); const selected = store.useState((state) => !!id && state.selectedId === id); const hasActiveItem = store.useState((state) => !!store.item(state.activeId)); const canRegisterComposedItem = isActive || selected && !hasActiveItem; const accessibleWhenDisabled = selected || ((_a2 = props.accessibleWhenDisabled) != null ? _a2 : true); const isWithinVirtualFocusComposite = useStoreState( store.combobox || store.composite, "virtualFocus" ); if (isWithinVirtualFocusComposite) { props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { tabIndex: -1 }); } props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, role: "tab", "aria-selected": selected, "aria-controls": panelId || void 0 }, props), { onClick }); if (store.composite) { const defaultProps = { id, accessibleWhenDisabled, store: store.composite, shouldRegisterItem: canRegisterComposedItem && shouldRegisterItem, rowId: props.rowId, render: props.render }; props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( P2CTZE2T_CompositeItem, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, defaultProps), { render: store.combobox && store.composite !== store.combobox ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(P2CTZE2T_CompositeItem, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, defaultProps), { store: store.combobox })) : defaultProps.render }) ) }); } props = useCompositeItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store }, props), { accessibleWhenDisabled, getItem, shouldRegisterItem })); return props; }); var Tab = memo2( forwardRef2(function Tab2(props) { const htmlProps = useTab(props); return LMDWO4NN_createElement(tab_TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/tab/tab-panel.js "use client"; // src/tab/tab-panel.tsx var tab_panel_TagName = "div"; var useTabPanel = createHook( function useTabPanel2(_a) { var _b = _a, { store, unmountOnHide, tabId: tabIdProp, getItem: getItemProp, scrollRestoration, scrollElement } = _b, props = __objRest(_b, [ "store", "unmountOnHide", "tabId", "getItem", "scrollRestoration", "scrollElement" ]); const context = useTabProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const id = useId(props.id); const tabId = useStoreState( store.panels, () => { var _a2; return tabIdProp || ((_a2 = store == null ? void 0 : store.panels.item(id)) == null ? void 0 : _a2.tabId); } ); const open = useStoreState( store, (state) => !!tabId && state.selectedId === tabId ); const disclosure = useDisclosureStore({ open }); const mounted = useStoreState(disclosure, "mounted"); const scrollPositionRef = (0,external_React_.useRef)( /* @__PURE__ */ new Map() ); const getScrollElement = useEvent(() => { const panelElement = ref.current; if (!panelElement) return null; if (!scrollElement) return panelElement; if (typeof scrollElement === "function") { return scrollElement(panelElement); } if ("current" in scrollElement) { return scrollElement.current; } return scrollElement; }); (0,external_React_.useEffect)(() => { var _a2, _b2; if (!scrollRestoration) return; if (!mounted) return; const element = getScrollElement(); if (!element) return; if (scrollRestoration === "reset") { element.scroll(0, 0); return; } if (!tabId) return; const position = scrollPositionRef.current.get(tabId); element.scroll((_a2 = position == null ? void 0 : position.x) != null ? _a2 : 0, (_b2 = position == null ? void 0 : position.y) != null ? _b2 : 0); const onScroll = () => { scrollPositionRef.current.set(tabId, { x: element.scrollLeft, y: element.scrollTop }); }; element.addEventListener("scroll", onScroll); return () => { element.removeEventListener("scroll", onScroll); }; }, [scrollRestoration, mounted, tabId, getScrollElement, store]); const [hasTabbableChildren, setHasTabbableChildren] = (0,external_React_.useState)(false); (0,external_React_.useEffect)(() => { const element = ref.current; if (!element) return; const tabbable = getAllTabbableIn(element); setHasTabbableChildren(!!tabbable.length); }, []); const getItem = (0,external_React_.useCallback)( (item) => { const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { id: id || item.id, tabId: tabIdProp }); if (getItemProp) { return getItemProp(nextItem); } return nextItem; }, [id, tabIdProp, getItemProp] ); const onKeyDownProp = props.onKeyDown; const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (event.defaultPrevented) return; if (!(store == null ? void 0 : store.composite)) return; const keyMap = { ArrowLeft: store.previous, ArrowRight: store.next, Home: store.first, End: store.last }; const action = keyMap[event.key]; if (!action) return; const { selectedId } = store.getState(); const nextId = action({ activeId: selectedId }); if (!nextId) return; event.preventDefault(); store.move(nextId); }); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TabScopedContextProvider, { value: store, children: element }), [store] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, role: "tabpanel", "aria-labelledby": tabId || void 0 }, props), { children: unmountOnHide && !mounted ? null : props.children, ref: useMergeRefs(ref, props.ref), onKeyDown }); props = useFocusable(_3YLGPPWQ_spreadValues({ // If the tab panel is rendered as part of another composite widget such // as combobox, it should not be focusable. focusable: !store.composite && !hasTabbableChildren }, props)); props = useDisclosureContent(_3YLGPPWQ_spreadValues({ store: disclosure }, props)); props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store: store.panels }, props), { getItem })); return props; } ); var TabPanel = forwardRef2(function TabPanel2(props) { const htmlProps = useTabPanel(props); return LMDWO4NN_createElement(tab_panel_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/tab-panel/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ // Separate the actual tab name from the instance ID. This is // necessary because Ariakit internally uses the element ID when // a new tab is selected, but our implementation looks specifically // for the tab name to be passed to the `onSelect` callback. const extractTabName = id => { if (typeof id === 'undefined' || id === null) { return; } return id.match(/^tab-panel-[0-9]*-(.*)/)?.[1]; }; /** * TabPanel is an ARIA-compliant tabpanel. * * TabPanels organize content across different screens, data sets, and interactions. * It has two sections: a list of tabs, and the view to show when tabs are chosen. * * ```jsx * import { TabPanel } from '@wordpress/components'; * * const onSelect = ( tabName ) => { * console.log( 'Selecting tab', tabName ); * }; * * const MyTabPanel = () => ( * <TabPanel * className="my-tab-panel" * activeClass="active-tab" * onSelect={ onSelect } * tabs={ [ * { * name: 'tab1', * title: 'Tab 1', * className: 'tab-one', * }, * { * name: 'tab2', * title: 'Tab 2', * className: 'tab-two', * }, * ] } * > * { ( tab ) => <p>{ tab.title }</p> } * </TabPanel> * ); * ``` */ const UnforwardedTabPanel = ({ className, children, tabs, selectOnMove = true, initialTabName, orientation = 'horizontal', activeClass = 'is-active', onSelect }, ref) => { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(tab_panel_TabPanel, 'tab-panel'); const prependInstanceId = (0,external_wp_element_namespaceObject.useCallback)(tabName => { if (typeof tabName === 'undefined') { return; } return `${instanceId}-${tabName}`; }, [instanceId]); const tabStore = useTabStore({ setSelectedId: newTabValue => { if (typeof newTabValue === 'undefined' || newTabValue === null) { return; } const newTab = tabs.find(t => prependInstanceId(t.name) === newTabValue); if (newTab?.disabled || newTab === selectedTab) { return; } const simplifiedTabName = extractTabName(newTabValue); if (typeof simplifiedTabName === 'undefined') { return; } onSelect?.(simplifiedTabName); }, orientation, selectOnMove, defaultSelectedId: prependInstanceId(initialTabName), rtl: (0,external_wp_i18n_namespaceObject.isRTL)() }); const selectedTabName = extractTabName(useStoreState(tabStore, 'selectedId')); const setTabStoreSelectedId = (0,external_wp_element_namespaceObject.useCallback)(tabName => { tabStore.setState('selectedId', prependInstanceId(tabName)); }, [prependInstanceId, tabStore]); const selectedTab = tabs.find(({ name }) => name === selectedTabName); const previousSelectedTabName = (0,external_wp_compose_namespaceObject.usePrevious)(selectedTabName); // Ensure `onSelect` is called when the initial tab is selected. (0,external_wp_element_namespaceObject.useEffect)(() => { if (previousSelectedTabName !== selectedTabName && selectedTabName === initialTabName && !!selectedTabName) { onSelect?.(selectedTabName); } }, [selectedTabName, initialTabName, onSelect, previousSelectedTabName]); // Handle selecting the initial tab. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { // If there's a selected tab, don't override it. if (selectedTab) { return; } const initialTab = tabs.find(tab => tab.name === initialTabName); // Wait for the denoted initial tab to be declared before making a // selection. This ensures that if a tab is declared lazily it can // still receive initial selection. if (initialTabName && !initialTab) { return; } if (initialTab && !initialTab.disabled) { // Select the initial tab if it's not disabled. setTabStoreSelectedId(initialTab.name); } else { // Fallback to the first enabled tab when the initial tab is // disabled or it can't be found. const firstEnabledTab = tabs.find(tab => !tab.disabled); if (firstEnabledTab) { setTabStoreSelectedId(firstEnabledTab.name); } } }, [tabs, selectedTab, initialTabName, instanceId, setTabStoreSelectedId]); // Handle the currently selected tab becoming disabled. (0,external_wp_element_namespaceObject.useEffect)(() => { // This effect only runs when the selected tab is defined and becomes disabled. if (!selectedTab?.disabled) { return; } const firstEnabledTab = tabs.find(tab => !tab.disabled); // If the currently selected tab becomes disabled, select the first enabled tab. // (if there is one). if (firstEnabledTab) { setTabStoreSelectedId(firstEnabledTab.name); } }, [tabs, selectedTab?.disabled, setTabStoreSelectedId, instanceId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, ref: ref, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TabList, { store: tabStore, className: "components-tab-panel__tabs", children: tabs.map(tab => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tab, { id: prependInstanceId(tab.name), className: dist_clsx('components-tab-panel__tabs-item', tab.className, { [activeClass]: tab.name === selectedTabName }), disabled: tab.disabled, "aria-controls": `${prependInstanceId(tab.name)}-view`, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { __next40pxDefaultSize: true, icon: tab.icon, label: tab.icon && tab.title, showTooltip: !!tab.icon }), children: !tab.icon && tab.title }, tab.name); }) }), selectedTab && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TabPanel, { id: `${prependInstanceId(selectedTab.name)}-view`, store: tabStore, tabId: prependInstanceId(selectedTab.name), className: "components-tab-panel__tab-content", children: children(selectedTab) })] }); }; const tab_panel_TabPanel = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTabPanel); /* harmony default export */ const tab_panel = (tab_panel_TabPanel); ;// ./node_modules/@wordpress/components/build-module/text-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedTextControl(props, ref) { const { __nextHasNoMarginBottom, __next40pxDefaultSize = false, label, hideLabelFromVision, value, help, id: idProp, className, onChange, type = 'text', ...additionalProps } = props; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(TextControl, 'inspector-text-control', idProp); const onChangeValue = event => onChange(event.target.value); maybeWarnDeprecated36pxSize({ componentName: 'TextControl', size: undefined, __next40pxDefaultSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "TextControl", label: label, hideLabelFromVision: hideLabelFromVision, id: id, help: help, className: className, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { className: dist_clsx('components-text-control__input', { 'is-next-40px-default-size': __next40pxDefaultSize }), type: type, id: id, value: value, onChange: onChangeValue, "aria-describedby": !!help ? id + '__help' : undefined, ref: ref, ...additionalProps }) }); } /** * TextControl components let users enter and edit text. * * ```jsx * import { TextControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyTextControl = () => { * const [ className, setClassName ] = useState( '' ); * * return ( * <TextControl * __nextHasNoMarginBottom * __next40pxDefaultSize * label="Additional CSS Class" * value={ className } * onChange={ ( value ) => setClassName( value ) } * /> * ); * }; * ``` */ const TextControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTextControl); /* harmony default export */ const text_control = (TextControl); ;// ./node_modules/@wordpress/components/build-module/utils/breakpoint-values.js /* harmony default export */ const breakpoint_values = ({ huge: '1440px', wide: '1280px', 'x-large': '1080px', large: '960px', // admin sidebar auto folds medium: '782px', // Adminbar goes big. small: '600px', mobile: '480px', 'zoomed-in': '280px' }); ;// ./node_modules/@wordpress/components/build-module/utils/breakpoint.js /** * Internal dependencies */ /** * @param {keyof breakpoints} point * @return {string} Media query declaration. */ const breakpoint = point => `@media (min-width: ${breakpoint_values[point]})`; ;// ./node_modules/@wordpress/components/build-module/textarea-control/styles/textarea-control-styles.js /** * External dependencies */ /** * Internal dependencies */ const inputStyleNeutral = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:0 0 0 transparent;border-radius:", config_values.radiusSmall, ";border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";@media not ( prefers-reduced-motion ){transition:box-shadow 0.1s linear;}" + ( true ? "" : 0), true ? "" : 0); const inputStyleFocus = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", COLORS.theme.accent, ";box-shadow:0 0 0 calc( ", config_values.borderWidthFocus, " - ", config_values.borderWidth, " ) ", COLORS.theme.accent, ";outline:2px solid transparent;" + ( true ? "" : 0), true ? "" : 0); const StyledTextarea = /*#__PURE__*/emotion_styled_base_browser_esm("textarea", true ? { target: "e1w5nnrk0" } : 0)("width:100%;display:block;font-family:", font('default.fontFamily'), ";line-height:20px;padding:9px 11px;", inputStyleNeutral, ";font-size:", font('mobileTextMinFontSize'), ";", breakpoint('small'), "{font-size:", font('default.fontSize'), ";}&:focus{", inputStyleFocus, ";}&::-webkit-input-placeholder{color:", COLORS.ui.darkGrayPlaceholder, ";}&::-moz-placeholder{color:", COLORS.ui.darkGrayPlaceholder, ";}&:-ms-input-placeholder{color:", COLORS.ui.darkGrayPlaceholder, ";}.is-dark-theme &{&::-webkit-input-placeholder{color:", COLORS.ui.lightGrayPlaceholder, ";}&::-moz-placeholder{color:", COLORS.ui.lightGrayPlaceholder, ";}&:-ms-input-placeholder{color:", COLORS.ui.lightGrayPlaceholder, ";}}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/textarea-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedTextareaControl(props, ref) { const { __nextHasNoMarginBottom, label, hideLabelFromVision, value, help, onChange, rows = 4, className, ...additionalProps } = props; const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(TextareaControl); const id = `inspector-textarea-control-${instanceId}`; const onChangeValue = event => onChange(event.target.value); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "TextareaControl", label: label, hideLabelFromVision: hideLabelFromVision, id: id, help: help, className: className, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledTextarea, { className: "components-textarea-control__input", id: id, rows: rows, onChange: onChangeValue, "aria-describedby": !!help ? id + '__help' : undefined, value: value, ref: ref, ...additionalProps }) }); } /** * TextareaControls are TextControls that allow for multiple lines of text, and * wrap overflow text onto a new line. They are a fixed height and scroll * vertically when the cursor reaches the bottom of the field. * * ```jsx * import { TextareaControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyTextareaControl = () => { * const [ text, setText ] = useState( '' ); * * return ( * <TextareaControl * __nextHasNoMarginBottom * label="Text" * help="Enter some text" * value={ text } * onChange={ ( value ) => setText( value ) } * /> * ); * }; * ``` */ const TextareaControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTextareaControl); /* harmony default export */ const textarea_control = (TextareaControl); ;// ./node_modules/@wordpress/components/build-module/text-highlight/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Highlights occurrences of a given string within another string of text. Wraps * each match with a `<mark>` tag which provides browser default styling. * * ```jsx * import { TextHighlight } from '@wordpress/components'; * * const MyTextHighlight = () => ( * <TextHighlight * text="Why do we like Gutenberg? Because Gutenberg is the best!" * highlight="Gutenberg" * /> * ); * ``` */ const TextHighlight = props => { const { text = '', highlight = '' } = props; const trimmedHighlightText = highlight.trim(); if (!trimmedHighlightText) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: text }); } const regex = new RegExp(`(${escapeRegExp(trimmedHighlightText)})`, 'gi'); return (0,external_wp_element_namespaceObject.createInterpolateElement)(text.replace(regex, '<mark>$&</mark>'), { mark: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("mark", {}) }); }; /* harmony default export */ const text_highlight = (TextHighlight); ;// ./node_modules/@wordpress/icons/build-module/library/tip.js /** * WordPress dependencies */ const tip = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 15.8c-3.7 0-6.8-3-6.8-6.8s3-6.8 6.8-6.8c3.7 0 6.8 3 6.8 6.8s-3.1 6.8-6.8 6.8zm0-12C9.1 3.8 6.8 6.1 6.8 9s2.4 5.2 5.2 5.2c2.9 0 5.2-2.4 5.2-5.2S14.9 3.8 12 3.8zM8 17.5h8V19H8zM10 20.5h4V22h-4z" }) }); /* harmony default export */ const library_tip = (tip); ;// ./node_modules/@wordpress/components/build-module/tip/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function Tip(props) { const { children } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-tip", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: library_tip }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: children })] }); } /* harmony default export */ const build_module_tip = (Tip); ;// ./node_modules/@wordpress/components/build-module/toggle-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToggleControl({ __nextHasNoMarginBottom, label, checked, help, className, onChange, disabled }, ref) { function onChangeToggle(event) { onChange(event.target.checked); } const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleControl); const id = `inspector-toggle-control-${instanceId}`; const cx = useCx(); const classes = cx('components-toggle-control', className, !__nextHasNoMarginBottom && /*#__PURE__*/emotion_react_browser_esm_css({ marginBottom: space(3) }, true ? "" : 0, true ? "" : 0)); if (!__nextHasNoMarginBottom) { external_wp_deprecated_default()('Bottom margin styles for wp.components.ToggleControl', { since: '6.7', version: '7.0', hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.' }); } let describedBy, helpLabel; if (help) { if (typeof help === 'function') { // `help` as a function works only for controlled components where // `checked` is passed down from parent component. Uncontrolled // component can show only a static help label. if (checked !== undefined) { helpLabel = help(checked); } } else { helpLabel = help; } if (helpLabel) { describedBy = id + '__help'; } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { id: id, help: helpLabel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-toggle-control__help", children: helpLabel }), className: classes, __nextHasNoMarginBottom: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { justify: "flex-start", spacing: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(form_toggle, { id: id, checked: checked, onChange: onChangeToggle, "aria-describedby": describedBy, disabled: disabled, ref: ref }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_block_component, { as: "label", htmlFor: id, className: dist_clsx('components-toggle-control__label', { 'is-disabled': disabled }), children: label })] }) }); } /** * ToggleControl is used to generate a toggle user interface. * * ```jsx * import { ToggleControl } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyToggleControl = () => { * const [ value, setValue ] = useState( false ); * * return ( * <ToggleControl * __nextHasNoMarginBottom * label="Fixed Background" * checked={ value } * onChange={ () => setValue( ( state ) => ! state ) } * /> * ); * }; * ``` */ const ToggleControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleControl); /* harmony default export */ const toggle_control = (ToggleControl); ;// ./node_modules/@ariakit/react-core/esm/__chunks/A3WPL2ZJ.js "use client"; // src/toolbar/toolbar-context.tsx var A3WPL2ZJ_ctx = createStoreContext( [CompositeContextProvider], [CompositeScopedContextProvider] ); var useToolbarContext = A3WPL2ZJ_ctx.useContext; var useToolbarScopedContext = A3WPL2ZJ_ctx.useScopedContext; var useToolbarProviderContext = A3WPL2ZJ_ctx.useProviderContext; var ToolbarContextProvider = A3WPL2ZJ_ctx.ContextProvider; var ToolbarScopedContextProvider = A3WPL2ZJ_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/BOLVLGVE.js "use client"; // src/toolbar/toolbar-item.tsx var BOLVLGVE_TagName = "button"; var useToolbarItem = createHook( function useToolbarItem2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useToolbarContext(); store = store || context; props = useCompositeItem(_3YLGPPWQ_spreadValues({ store }, props)); return props; } ); var ToolbarItem = memo2( forwardRef2(function ToolbarItem2(props) { const htmlProps = useToolbarItem(props); return LMDWO4NN_createElement(BOLVLGVE_TagName, htmlProps); }) ); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar-context/index.js /** * External dependencies */ /** * WordPress dependencies */ const ToolbarContext = (0,external_wp_element_namespaceObject.createContext)(undefined); /* harmony default export */ const toolbar_context = (ToolbarContext); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar-item/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function toolbar_item_ToolbarItem({ children, as: Component, ...props }, ref) { const accessibleToolbarStore = (0,external_wp_element_namespaceObject.useContext)(toolbar_context); const isRenderProp = typeof children === 'function'; if (!isRenderProp && !Component) { true ? external_wp_warning_default()('`ToolbarItem` is a generic headless component. You must pass either a `children` prop as a function or an `as` prop as a component. ' + 'See https://developer.wordpress.org/block-editor/components/toolbar-item/') : 0; return null; } const allProps = { ...props, ref, 'data-toolbar-item': true }; if (!accessibleToolbarStore) { if (Component) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...allProps, children: children }); } if (!isRenderProp) { return null; } return children(allProps); } const render = isRenderProp ? children : Component && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { children: children }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ToolbarItem, { accessibleWhenDisabled: true, ...allProps, store: accessibleToolbarStore, render: render }); } /* harmony default export */ const toolbar_item = ((0,external_wp_element_namespaceObject.forwardRef)(toolbar_item_ToolbarItem)); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar-button/toolbar-button-container.js /** * Internal dependencies */ const ToolbarButtonContainer = ({ children, className }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: className, children: children }); /* harmony default export */ const toolbar_button_container = (ToolbarButtonContainer); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar-button/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function toolbar_button_useDeprecatedProps({ isDisabled, ...otherProps }) { return { disabled: isDisabled, ...otherProps }; } function UnforwardedToolbarButton(props, ref) { const { children, className, containerClassName, extraProps, isActive, title, ...restProps } = toolbar_button_useDeprecatedProps(props); const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context); if (!accessibleToolbarState) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_button_container, { className: containerClassName, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { ref: ref, icon: restProps.icon, size: "compact", label: title, shortcut: restProps.shortcut, "data-subscript": restProps.subscript, onClick: event => { event.stopPropagation(); // TODO: Possible bug; maybe use onClick instead of restProps.onClick. if (restProps.onClick) { restProps.onClick(event); } }, className: dist_clsx('components-toolbar__control', className), isPressed: isActive, accessibleWhenDisabled: true, "data-toolbar-item": true, ...extraProps, ...restProps, children: children }) }); } // ToobarItem will pass all props to the render prop child, which will pass // all props to Button. This means that ToolbarButton has the same API as // Button. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_item, { className: dist_clsx('components-toolbar-button', className), ...extraProps, ...restProps, ref: ref, children: toolbarItemProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { size: "compact", label: title, isPressed: isActive, ...toolbarItemProps, children: children }) }); } /** * ToolbarButton can be used to add actions to a toolbar, usually inside a Toolbar * or ToolbarGroup when used to create general interfaces. * * ```jsx * import { Toolbar, ToolbarButton } from '@wordpress/components'; * import { edit } from '@wordpress/icons'; * * function MyToolbar() { * return ( * <Toolbar label="Options"> * <ToolbarButton * icon={ edit } * label="Edit" * onClick={ () => alert( 'Editing' ) } * /> * </Toolbar> * ); * } * ``` */ const ToolbarButton = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToolbarButton); /* harmony default export */ const toolbar_button = (ToolbarButton); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar-group/toolbar-group-container.js /** * Internal dependencies */ const ToolbarGroupContainer = ({ className, children, ...props }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: className, ...props, children: children }); /* harmony default export */ const toolbar_group_container = (ToolbarGroupContainer); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js /** * WordPress dependencies */ /** * Internal dependencies */ function ToolbarGroupCollapsed({ controls = [], toggleProps, ...props }) { // It'll contain state if `ToolbarGroup` is being used within // `<Toolbar label="label" />` const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context); const renderDropdownMenu = internalToggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_menu, { controls: controls, toggleProps: { ...internalToggleProps, 'data-toolbar-item': true }, ...props }); if (accessibleToolbarState) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_item, { ...toggleProps, children: renderDropdownMenu }); } return renderDropdownMenu(toggleProps); } /* harmony default export */ const toolbar_group_collapsed = (ToolbarGroupCollapsed); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar-group/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function isNestedArray(arr) { return Array.isArray(arr) && Array.isArray(arr[0]); } /** * Renders a collapsible group of controls * * The `controls` prop accepts an array of sets. A set is an array of controls. * Controls have the following shape: * * ``` * { * icon: string, * title: string, * subscript: string, * onClick: Function, * isActive: boolean, * isDisabled: boolean * } * ``` * * For convenience it is also possible to pass only an array of controls. It is * then assumed this is the only set. * * Either `controls` or `children` is required, otherwise this components * renders nothing. * * @param props Component props. * @param [props.controls] The controls to render in this toolbar. * @param [props.children] Any other things to render inside the toolbar besides the controls. * @param [props.className] Class to set on the container div. * @param [props.isCollapsed] Turns ToolbarGroup into a dropdown menu. * @param [props.title] ARIA label for dropdown menu if is collapsed. */ function ToolbarGroup({ controls = [], children, className, isCollapsed, title, ...props }) { // It'll contain state if `ToolbarGroup` is being used within // `<Toolbar label="label" />` const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context); if ((!controls || !controls.length) && !children) { return null; } const finalClassName = dist_clsx( // Unfortunately, there's legacy code referencing to `.components-toolbar` // So we can't get rid of it accessibleToolbarState ? 'components-toolbar-group' : 'components-toolbar', className); // Normalize controls to nested array of objects (sets of controls) let controlSets; if (isNestedArray(controls)) { controlSets = controls; } else { controlSets = [controls]; } if (isCollapsed) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_group_collapsed, { label: title, controls: controlSets, className: finalClassName, children: children, ...props }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(toolbar_group_container, { className: finalClassName, ...props, children: [controlSets?.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_button, { containerClassName: indexOfSet > 0 && indexOfControl === 0 ? 'has-left-divider' : undefined, ...control }, [indexOfSet, indexOfControl].join()))), children] }); } /* harmony default export */ const toolbar_group = (ToolbarGroup); ;// ./node_modules/@ariakit/core/esm/toolbar/toolbar-store.js "use client"; // src/toolbar/toolbar-store.ts function createToolbarStore(props = {}) { var _a; const syncState = (_a = props.store) == null ? void 0 : _a.getState(); return createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { orientation: defaultValue( props.orientation, syncState == null ? void 0 : syncState.orientation, "horizontal" ), focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true) })); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/7M5THDKH.js "use client"; // src/toolbar/toolbar-store.ts function useToolbarStoreProps(store, update, props) { return useCompositeStoreProps(store, update, props); } function useToolbarStore(props = {}) { const [store, update] = YV4JVR4I_useStore(createToolbarStore, props); return useToolbarStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/toolbar/toolbar.js "use client"; // src/toolbar/toolbar.tsx var toolbar_TagName = "div"; var useToolbar = createHook( function useToolbar2(_a) { var _b = _a, { store: storeProp, orientation: orientationProp, virtualFocus, focusLoop, rtl } = _b, props = __objRest(_b, [ "store", "orientation", "virtualFocus", "focusLoop", "rtl" ]); const context = useToolbarProviderContext(); storeProp = storeProp || context; const store = useToolbarStore({ store: storeProp, orientation: orientationProp, virtualFocus, focusLoop, rtl }); const orientation = store.useState( (state) => state.orientation === "both" ? void 0 : state.orientation ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ToolbarScopedContextProvider, { value: store, children: element }), [store] ); props = _3YLGPPWQ_spreadValues({ role: "toolbar", "aria-orientation": orientation }, props); props = useComposite(_3YLGPPWQ_spreadValues({ store }, props)); return props; } ); var Toolbar = forwardRef2(function Toolbar2(props) { const htmlProps = useToolbar(props); return LMDWO4NN_createElement(toolbar_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar/toolbar-container.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToolbarContainer({ label, ...props }, ref) { const toolbarStore = useToolbarStore({ focusLoop: true, rtl: (0,external_wp_i18n_namespaceObject.isRTL)() }); return ( /*#__PURE__*/ // This will provide state for `ToolbarButton`'s (0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_context.Provider, { value: toolbarStore, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Toolbar, { ref: ref, "aria-label": label, store: toolbarStore, ...props }) }) ); } const ToolbarContainer = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToolbarContainer); /* harmony default export */ const toolbar_container = (ToolbarContainer); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToolbar({ className, label, variant, ...props }, ref) { const isVariantDefined = variant !== undefined; const contextSystemValue = (0,external_wp_element_namespaceObject.useMemo)(() => { if (isVariantDefined) { return {}; } return { DropdownMenu: { variant: 'toolbar' }, Dropdown: { variant: 'toolbar' }, Menu: { variant: 'toolbar' } }; }, [isVariantDefined]); if (!label) { external_wp_deprecated_default()('Using Toolbar without label prop', { since: '5.6', alternative: 'ToolbarGroup component', link: 'https://developer.wordpress.org/block-editor/components/toolbar/' }); // Extracting title from `props` because `ToolbarGroup` doesn't accept it. const { title: _title, ...restProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_group, { isCollapsed: false, ...restProps, className: className }); } // `ToolbarGroup` already uses components-toolbar for compatibility reasons. const finalClassName = dist_clsx('components-accessible-toolbar', className, variant && `is-${variant}`); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextSystemProvider, { value: contextSystemValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_container, { className: finalClassName, label: label, ref: ref, ...props }) }); } /** * Renders a toolbar. * * To add controls, simply pass `ToolbarButton` components as children. * * ```jsx * import { Toolbar, ToolbarButton } from '@wordpress/components'; * import { formatBold, formatItalic, link } from '@wordpress/icons'; * * function MyToolbar() { * return ( * <Toolbar label="Options"> * <ToolbarButton icon={ formatBold } label="Bold" /> * <ToolbarButton icon={ formatItalic } label="Italic" /> * <ToolbarButton icon={ link } label="Link" /> * </Toolbar> * ); * } * ``` */ const toolbar_Toolbar = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToolbar); /* harmony default export */ const toolbar = (toolbar_Toolbar); ;// ./node_modules/@wordpress/components/build-module/toolbar/toolbar-dropdown-menu/index.js /** * WordPress dependencies */ /** * External dependencies */ /** * Internal dependencies */ function ToolbarDropdownMenu(props, ref) { const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context); if (!accessibleToolbarState) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_menu, { ...props }); } // ToolbarItem will pass all props to the render prop child, which will pass // all props to the toggle of DropdownMenu. This means that ToolbarDropdownMenu // has the same API as DropdownMenu. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_item, { ref: ref, ...props.toggleProps, children: toolbarItemProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_menu, { ...props, popoverProps: { ...props.popoverProps }, toggleProps: toolbarItemProps }) }); } /* harmony default export */ const toolbar_dropdown_menu = ((0,external_wp_element_namespaceObject.forwardRef)(ToolbarDropdownMenu)); ;// ./node_modules/@wordpress/components/build-module/tools-panel/styles.js function tools_panel_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const toolsPanelGrid = { columns: columns => /*#__PURE__*/emotion_react_browser_esm_css("grid-template-columns:", `repeat( ${columns}, minmax(0, 1fr) )`, ";" + ( true ? "" : 0), true ? "" : 0), spacing: /*#__PURE__*/emotion_react_browser_esm_css("column-gap:", space(4), ";row-gap:", space(4), ";" + ( true ? "" : 0), true ? "" : 0), item: { fullWidth: true ? { name: "18iuzk9", styles: "grid-column:1/-1" } : 0 } }; const ToolsPanel = columns => /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.columns(columns), " ", toolsPanelGrid.spacing, " border-top:", config_values.borderWidth, " solid ", COLORS.gray[300], ";margin-top:-1px;padding:", space(4), ";" + ( true ? "" : 0), true ? "" : 0); /** * Items injected into a ToolsPanel via a virtual bubbling slot will require * an inner dom element to be injected. The following rule allows for the * CSS grid display to be re-established. */ const ToolsPanelWithInnerWrapper = columns => { return /*#__PURE__*/emotion_react_browser_esm_css(">div:not( :first-of-type ){display:grid;", toolsPanelGrid.columns(columns), " ", toolsPanelGrid.spacing, " ", toolsPanelGrid.item.fullWidth, ";}" + ( true ? "" : 0), true ? "" : 0); }; const ToolsPanelHiddenInnerWrapper = true ? { name: "huufmu", styles: ">div:not( :first-of-type ){display:none;}" } : 0; const ToolsPanelHeader = /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.item.fullWidth, " gap:", space(2), ";.components-dropdown-menu{margin:", space(-1), " 0;line-height:0;}&&&& .components-dropdown-menu__toggle{padding:0;min-width:", space(6), ";}" + ( true ? "" : 0), true ? "" : 0); const ToolsPanelHeading = true ? { name: "1pmxm02", styles: "font-size:inherit;font-weight:500;line-height:normal;&&{margin:0;}" } : 0; const ToolsPanelItem = /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.item.fullWidth, "&>div,&>fieldset{padding-bottom:0;margin-bottom:0;max-width:100%;}&& ", Wrapper, "{margin-bottom:0;", StyledField, ":last-child{margin-bottom:0;}}", StyledHelp, "{margin-bottom:0;}&& ", LabelWrapper, "{label{line-height:1.4em;}}" + ( true ? "" : 0), true ? "" : 0); const ToolsPanelItemPlaceholder = true ? { name: "eivff4", styles: "display:none" } : 0; const styles_DropdownMenu = true ? { name: "16gsvie", styles: "min-width:200px" } : 0; const ResetLabel = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "ews648u0" } : 0)("color:", COLORS.theme.accentDarker10, ";font-size:11px;font-weight:500;line-height:1.4;", rtl({ marginLeft: space(3) }), " text-transform:uppercase;" + ( true ? "" : 0)); const DefaultControlsItem = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[900], ";&&[aria-disabled='true']{color:", COLORS.gray[700], ";opacity:1;&:hover{color:", COLORS.gray[700], ";}", ResetLabel, "{opacity:0.3;}}" + ( true ? "" : 0), true ? "" : 0); ;// ./node_modules/@wordpress/components/build-module/tools-panel/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const tools_panel_context_noop = () => undefined; const ToolsPanelContext = (0,external_wp_element_namespaceObject.createContext)({ menuItems: { default: {}, optional: {} }, hasMenuItems: false, isResetting: false, shouldRenderPlaceholderItems: false, registerPanelItem: tools_panel_context_noop, deregisterPanelItem: tools_panel_context_noop, flagItemCustomization: tools_panel_context_noop, registerResetAllFilter: tools_panel_context_noop, deregisterResetAllFilter: tools_panel_context_noop, areAllOptionalControlsHidden: true }); const useToolsPanelContext = () => (0,external_wp_element_namespaceObject.useContext)(ToolsPanelContext); ;// ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-header/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useToolsPanelHeader(props) { const { className, headingLevel = 2, ...otherProps } = useContextSystem(props, 'ToolsPanelHeader'); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(ToolsPanelHeader, className); }, [className, cx]); const dropdownMenuClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(styles_DropdownMenu); }, [cx]); const headingClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(ToolsPanelHeading); }, [cx]); const defaultControlsItemClassName = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(DefaultControlsItem); }, [cx]); const { menuItems, hasMenuItems, areAllOptionalControlsHidden } = useToolsPanelContext(); return { ...otherProps, areAllOptionalControlsHidden, defaultControlsItemClassName, dropdownMenuClassName, hasMenuItems, headingClassName, headingLevel, menuItems, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-header/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const DefaultControlsGroup = ({ itemClassName, items, toggleItem }) => { if (!items.length) { return null; } const resetSuffix = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetLabel, { "aria-hidden": true, children: (0,external_wp_i18n_namespaceObject.__)('Reset') }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: items.map(([label, hasValue]) => { if (hasValue) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_item, { className: itemClassName, role: "menuitem", label: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being reset e.g. "Padding". (0,external_wp_i18n_namespaceObject.__)('Reset %s'), label), onClick: () => { toggleItem(label); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being reset e.g. "Padding". (0,external_wp_i18n_namespaceObject.__)('%s reset to default'), label), 'assertive'); }, suffix: resetSuffix, children: label }, label); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_item, { icon: library_check, className: itemClassName, role: "menuitemcheckbox", isSelected: true, "aria-disabled": true, children: label }, label); }) }); }; const OptionalControlsGroup = ({ items, toggleItem }) => { if (!items.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: items.map(([label, isSelected]) => { const itemLabel = isSelected ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being hidden and reset e.g. "Padding". (0,external_wp_i18n_namespaceObject.__)('Hide and reset %s'), label) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control to display e.g. "Padding". (0,external_wp_i18n_namespaceObject._x)('Show %s', 'input control'), label); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_item, { icon: isSelected ? library_check : null, isSelected: isSelected, label: itemLabel, onClick: () => { if (isSelected) { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being reset e.g. "Padding". (0,external_wp_i18n_namespaceObject.__)('%s hidden and reset to default'), label), 'assertive'); } else { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being reset e.g. "Padding". (0,external_wp_i18n_namespaceObject.__)('%s is now visible'), label), 'assertive'); } toggleItem(label); }, role: "menuitemcheckbox", children: label }, label); }) }); }; const component_ToolsPanelHeader = (props, forwardedRef) => { const { areAllOptionalControlsHidden, defaultControlsItemClassName, dropdownMenuClassName, hasMenuItems, headingClassName, headingLevel = 2, label: labelText, menuItems, resetAll, toggleItem, dropdownMenuProps, ...headerProps } = useToolsPanelHeader(props); if (!labelText) { return null; } const defaultItems = Object.entries(menuItems?.default || {}); const optionalItems = Object.entries(menuItems?.optional || {}); const dropDownMenuIcon = areAllOptionalControlsHidden ? library_plus : more_vertical; const dropDownMenuLabelText = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the tool e.g. "Color" or "Typography". (0,external_wp_i18n_namespaceObject._x)('%s options', 'Button label to reveal tool panel options'), labelText); const dropdownMenuDescriptionText = areAllOptionalControlsHidden ? (0,external_wp_i18n_namespaceObject.__)('All options are currently hidden') : undefined; const canResetAll = [...defaultItems, ...optionalItems].some(([, isSelected]) => isSelected); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { ...headerProps, ref: forwardedRef, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(heading_component, { level: headingLevel, className: headingClassName, children: labelText }), hasMenuItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_menu, { ...dropdownMenuProps, icon: dropDownMenuIcon, label: dropDownMenuLabelText, menuProps: { className: dropdownMenuClassName }, toggleProps: { size: 'small', description: dropdownMenuDescriptionText }, children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(menu_group, { label: labelText, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultControlsGroup, { items: defaultItems, toggleItem: toggleItem, itemClassName: defaultControlsItemClassName }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OptionalControlsGroup, { items: optionalItems, toggleItem: toggleItem })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_group, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_item, { "aria-disabled": !canResetAll // @ts-expect-error - TODO: If this "tertiary" style is something we really want to allow on MenuItem, // we should rename it and explicitly allow it as an official API. All the other Button variants // don't make sense in a MenuItem context, and should be disallowed. , variant: "tertiary", onClick: () => { if (canResetAll) { resetAll(); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('All options reset'), 'assertive'); } }, children: (0,external_wp_i18n_namespaceObject.__)('Reset all') }) })] }) })] }); }; const ConnectedToolsPanelHeader = contextConnect(component_ToolsPanelHeader, 'ToolsPanelHeader'); /* harmony default export */ const tools_panel_header_component = (ConnectedToolsPanelHeader); ;// ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_COLUMNS = 2; function emptyMenuItems() { return { default: {}, optional: {} }; } function emptyState() { return { panelItems: [], menuItemOrder: [], menuItems: emptyMenuItems() }; } const generateMenuItems = ({ panelItems, shouldReset, currentMenuItems, menuItemOrder }) => { const newMenuItems = emptyMenuItems(); const menuItems = emptyMenuItems(); panelItems.forEach(({ hasValue, isShownByDefault, label }) => { const group = isShownByDefault ? 'default' : 'optional'; // If a menu item for this label has already been flagged as customized // (for default controls), or toggled on (for optional controls), do not // overwrite its value as those controls would lose that state. const existingItemValue = currentMenuItems?.[group]?.[label]; const value = existingItemValue ? existingItemValue : hasValue(); newMenuItems[group][label] = shouldReset ? false : value; }); // Loop the known, previously registered items first to maintain menu order. menuItemOrder.forEach(key => { if (newMenuItems.default.hasOwnProperty(key)) { menuItems.default[key] = newMenuItems.default[key]; } if (newMenuItems.optional.hasOwnProperty(key)) { menuItems.optional[key] = newMenuItems.optional[key]; } }); // Loop newMenuItems object adding any that aren't in the known items order. Object.keys(newMenuItems.default).forEach(key => { if (!menuItems.default.hasOwnProperty(key)) { menuItems.default[key] = newMenuItems.default[key]; } }); Object.keys(newMenuItems.optional).forEach(key => { if (!menuItems.optional.hasOwnProperty(key)) { menuItems.optional[key] = newMenuItems.optional[key]; } }); return menuItems; }; function panelItemsReducer(panelItems, action) { switch (action.type) { case 'REGISTER_PANEL': { const newItems = [...panelItems]; // If an item with this label has already been registered, remove it // first. This can happen when an item is moved between the default // and optional groups. const existingIndex = newItems.findIndex(oldItem => oldItem.label === action.item.label); if (existingIndex !== -1) { newItems.splice(existingIndex, 1); } newItems.push(action.item); return newItems; } case 'UNREGISTER_PANEL': { const index = panelItems.findIndex(item => item.label === action.label); if (index !== -1) { const newItems = [...panelItems]; newItems.splice(index, 1); return newItems; } return panelItems; } default: return panelItems; } } function menuItemOrderReducer(menuItemOrder, action) { switch (action.type) { case 'REGISTER_PANEL': { // Track the initial order of item registration. This is used for // maintaining menu item order later. if (menuItemOrder.includes(action.item.label)) { return menuItemOrder; } return [...menuItemOrder, action.item.label]; } default: return menuItemOrder; } } function menuItemsReducer(state, action) { switch (action.type) { case 'REGISTER_PANEL': case 'UNREGISTER_PANEL': // generate new menu items from original `menuItems` and updated `panelItems` and `menuItemOrder` return generateMenuItems({ currentMenuItems: state.menuItems, panelItems: state.panelItems, menuItemOrder: state.menuItemOrder, shouldReset: false }); case 'RESET_ALL': return generateMenuItems({ panelItems: state.panelItems, menuItemOrder: state.menuItemOrder, shouldReset: true }); case 'UPDATE_VALUE': { const oldValue = state.menuItems[action.group][action.label]; if (action.value === oldValue) { return state.menuItems; } return { ...state.menuItems, [action.group]: { ...state.menuItems[action.group], [action.label]: action.value } }; } case 'TOGGLE_VALUE': { const currentItem = state.panelItems.find(item => item.label === action.label); if (!currentItem) { return state.menuItems; } const menuGroup = currentItem.isShownByDefault ? 'default' : 'optional'; const newMenuItems = { ...state.menuItems, [menuGroup]: { ...state.menuItems[menuGroup], [action.label]: !state.menuItems[menuGroup][action.label] } }; return newMenuItems; } default: return state.menuItems; } } function panelReducer(state, action) { const panelItems = panelItemsReducer(state.panelItems, action); const menuItemOrder = menuItemOrderReducer(state.menuItemOrder, action); // `menuItemsReducer` is a bit unusual because it generates new state from original `menuItems` // and the updated `panelItems` and `menuItemOrder`. const menuItems = menuItemsReducer({ panelItems, menuItemOrder, menuItems: state.menuItems }, action); return { panelItems, menuItemOrder, menuItems }; } function resetAllFiltersReducer(filters, action) { switch (action.type) { case 'REGISTER': return [...filters, action.filter]; case 'UNREGISTER': return filters.filter(f => f !== action.filter); default: return filters; } } const isMenuItemTypeEmpty = obj => Object.keys(obj).length === 0; function useToolsPanel(props) { const { className, headingLevel = 2, resetAll, panelId, hasInnerWrapper = false, shouldRenderPlaceholderItems = false, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass, ...otherProps } = useContextSystem(props, 'ToolsPanel'); const isResettingRef = (0,external_wp_element_namespaceObject.useRef)(false); const wasResetting = isResettingRef.current; // `isResettingRef` is cleared via this hook to effectively batch together // the resetAll task. Without this, the flag is cleared after the first // control updates and forces a rerender with subsequent controls then // believing they need to reset, unfortunately using stale data. (0,external_wp_element_namespaceObject.useEffect)(() => { if (wasResetting) { isResettingRef.current = false; } }, [wasResetting]); // Allow panel items to register themselves. const [{ panelItems, menuItems }, panelDispatch] = (0,external_wp_element_namespaceObject.useReducer)(panelReducer, undefined, emptyState); const [resetAllFilters, dispatchResetAllFilters] = (0,external_wp_element_namespaceObject.useReducer)(resetAllFiltersReducer, []); const registerPanelItem = (0,external_wp_element_namespaceObject.useCallback)(item => { // Add item to panel items. panelDispatch({ type: 'REGISTER_PANEL', item }); }, []); // Panels need to deregister on unmount to avoid orphans in menu state. // This is an issue when panel items are being injected via SlotFills. const deregisterPanelItem = (0,external_wp_element_namespaceObject.useCallback)(label => { // When switching selections between components injecting matching // controls, e.g. both panels have a "padding" control, the // deregistration of the first panel doesn't occur until after the // registration of the next. panelDispatch({ type: 'UNREGISTER_PANEL', label }); }, []); const registerResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(filter => { dispatchResetAllFilters({ type: 'REGISTER', filter }); }, []); const deregisterResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(filter => { dispatchResetAllFilters({ type: 'UNREGISTER', filter }); }, []); // Updates the status of the panel’s menu items. For default items the // value represents whether it differs from the default and for optional // items whether the item is shown. const flagItemCustomization = (0,external_wp_element_namespaceObject.useCallback)((value, label, group = 'default') => { panelDispatch({ type: 'UPDATE_VALUE', group, label, value }); }, []); // Whether all optional menu items are hidden or not must be tracked // in order to later determine if the panel display is empty and handle // conditional display of a plus icon to indicate the presence of further // menu items. const areAllOptionalControlsHidden = (0,external_wp_element_namespaceObject.useMemo)(() => { return isMenuItemTypeEmpty(menuItems.default) && !isMenuItemTypeEmpty(menuItems.optional) && Object.values(menuItems.optional).every(isSelected => !isSelected); }, [menuItems]); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { const wrapperStyle = hasInnerWrapper && ToolsPanelWithInnerWrapper(DEFAULT_COLUMNS); const emptyStyle = areAllOptionalControlsHidden && ToolsPanelHiddenInnerWrapper; return cx(ToolsPanel(DEFAULT_COLUMNS), wrapperStyle, emptyStyle, className); }, [areAllOptionalControlsHidden, className, cx, hasInnerWrapper]); // Toggle the checked state of a menu item which is then used to determine // display of the item within the panel. const toggleItem = (0,external_wp_element_namespaceObject.useCallback)(label => { panelDispatch({ type: 'TOGGLE_VALUE', label }); }, []); // Resets display of children and executes resetAll callback if available. const resetAllItems = (0,external_wp_element_namespaceObject.useCallback)(() => { if (typeof resetAll === 'function') { isResettingRef.current = true; resetAll(resetAllFilters); } // Turn off display of all non-default items. panelDispatch({ type: 'RESET_ALL' }); }, [resetAllFilters, resetAll]); // Assist ItemGroup styling when there are potentially hidden placeholder // items by identifying first & last items that are toggled on for display. const getFirstVisibleItemLabel = items => { const optionalItems = menuItems.optional || {}; const firstItem = items.find(item => item.isShownByDefault || optionalItems[item.label]); return firstItem?.label; }; const firstDisplayedItem = getFirstVisibleItemLabel(panelItems); const lastDisplayedItem = getFirstVisibleItemLabel([...panelItems].reverse()); const hasMenuItems = panelItems.length > 0; const panelContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({ areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, hasMenuItems, isResetting: isResettingRef.current, lastDisplayedItem, menuItems, panelId, registerPanelItem, registerResetAllFilter, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass }), [areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, lastDisplayedItem, menuItems, panelId, hasMenuItems, registerResetAllFilter, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]); return { ...otherProps, headingLevel, panelContext, resetAllItems, toggleItem, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel/component.js /** * External dependencies */ /** * Internal dependencies */ const UnconnectedToolsPanel = (props, forwardedRef) => { const { children, label, panelContext, resetAllItems, toggleItem, headingLevel, dropdownMenuProps, ...toolsPanelProps } = useToolsPanel(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(grid_component, { ...toolsPanelProps, columns: 2, ref: forwardedRef, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsPanelContext.Provider, { value: panelContext, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_panel_header_component, { label: label, resetAll: resetAllItems, toggleItem: toggleItem, headingLevel: headingLevel, dropdownMenuProps: dropdownMenuProps }), children] }) }); }; /** * The `ToolsPanel` is a container component that displays its children preceded * by a header. The header includes a dropdown menu which is automatically * generated from the panel's inner `ToolsPanelItems`. * * ```jsx * import { __ } from '@wordpress/i18n'; * import { * __experimentalToolsPanel as ToolsPanel, * __experimentalToolsPanelItem as ToolsPanelItem, * __experimentalUnitControl as UnitControl * } from '@wordpress/components'; * * function Example() { * const [ height, setHeight ] = useState(); * const [ width, setWidth ] = useState(); * * const resetAll = () => { * setHeight(); * setWidth(); * } * * return ( * <ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }> * <ToolsPanelItem * hasValue={ () => !! height } * label={ __( 'Height' ) } * onDeselect={ () => setHeight() } * > * <UnitControl * __next40pxDefaultSize * label={ __( 'Height' ) } * onChange={ setHeight } * value={ height } * /> * </ToolsPanelItem> * <ToolsPanelItem * hasValue={ () => !! width } * label={ __( 'Width' ) } * onDeselect={ () => setWidth() } * > * <UnitControl * __next40pxDefaultSize * label={ __( 'Width' ) } * onChange={ setWidth } * value={ width } * /> * </ToolsPanelItem> * </ToolsPanel> * ); * } * ``` */ const component_ToolsPanel = contextConnect(UnconnectedToolsPanel, 'ToolsPanel'); /* harmony default export */ const tools_panel_component = (component_ToolsPanel); ;// ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-item/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ const hook_noop = () => {}; function useToolsPanelItem(props) { const { className, hasValue, isShownByDefault = false, label, panelId, resetAllFilter = hook_noop, onDeselect, onSelect, ...otherProps } = useContextSystem(props, 'ToolsPanelItem'); const { panelId: currentPanelId, menuItems, registerResetAllFilter, deregisterResetAllFilter, registerPanelItem, deregisterPanelItem, flagItemCustomization, isResetting, shouldRenderPlaceholderItems: shouldRenderPlaceholder, firstDisplayedItem, lastDisplayedItem, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass } = useToolsPanelContext(); // hasValue is a new function on every render, so do not add it as a // dependency to the useCallback hook! If needed, we should use a ref. const hasValueCallback = (0,external_wp_element_namespaceObject.useCallback)(hasValue, [panelId]); // resetAllFilter is a new function on every render, so do not add it as a // dependency to the useCallback hook! If needed, we should use a ref. const resetAllFilterCallback = (0,external_wp_element_namespaceObject.useCallback)(resetAllFilter, [panelId]); const previousPanelId = (0,external_wp_compose_namespaceObject.usePrevious)(currentPanelId); const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null; // Registering the panel item allows the panel to include it in its // automatically generated menu and determine its initial checked status. // // This is performed in a layout effect to ensure that the panel item // is registered before it is rendered preventing a rendering glitch. // See: https://github.com/WordPress/gutenberg/issues/56470 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (hasMatchingPanel && previousPanelId !== null) { registerPanelItem({ hasValue: hasValueCallback, isShownByDefault, label, panelId }); } return () => { if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) { deregisterPanelItem(label); } }; }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasMatchingPanel) { registerResetAllFilter(resetAllFilterCallback); } return () => { if (hasMatchingPanel) { deregisterResetAllFilter(resetAllFilterCallback); } }; }, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]); // Note: `label` is used as a key when building menu item state in // `ToolsPanel`. const menuGroup = isShownByDefault ? 'default' : 'optional'; const isMenuItemChecked = menuItems?.[menuGroup]?.[label]; const wasMenuItemChecked = (0,external_wp_compose_namespaceObject.usePrevious)(isMenuItemChecked); const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined; const isValueSet = hasValue(); // Notify the panel when an item's value has changed except for optional // items without value because the item should not cause itself to hide. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isShownByDefault && !isValueSet) { return; } flagItemCustomization(isValueSet, label, menuGroup); }, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]); // Determine if the panel item's corresponding menu is being toggled and // trigger appropriate callback if it is. (0,external_wp_element_namespaceObject.useEffect)(() => { // We check whether this item is currently registered as items rendered // via fills can persist through the parent panel being remounted. // See: https://github.com/WordPress/gutenberg/pull/45673 if (!isRegistered || isResetting || !hasMatchingPanel) { return; } if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) { onSelect?.(); } if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) { onDeselect?.(); } }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]); // The item is shown if it is a default control regardless of whether it // has a value. Optional items are shown when they are checked or have // a value. const isShown = isShownByDefault ? menuItems?.[menuGroup]?.[label] !== undefined : isMenuItemChecked; const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown; const firstItemStyle = firstDisplayedItem === label && __experimentalFirstVisibleItemClass; const lastItemStyle = lastDisplayedItem === label && __experimentalLastVisibleItemClass; return cx(ToolsPanelItem, shouldApplyPlaceholderStyles && ToolsPanelItemPlaceholder, !shouldApplyPlaceholderStyles && className, firstItemStyle, lastItemStyle); }, [isShown, shouldRenderPlaceholder, className, cx, firstDisplayedItem, lastDisplayedItem, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass, label]); return { ...otherProps, isShown, shouldRenderPlaceholder, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-item/component.js /** * External dependencies */ /** * Internal dependencies */ // This wraps controls to be conditionally displayed within a tools panel. It // prevents props being applied to HTML elements that would make them invalid. const UnconnectedToolsPanelItem = (props, forwardedRef) => { const { children, isShown, shouldRenderPlaceholder, ...toolsPanelItemProps } = useToolsPanelItem(props); if (!isShown) { return shouldRenderPlaceholder ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...toolsPanelItemProps, ref: forwardedRef }) : null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...toolsPanelItemProps, ref: forwardedRef, children: children }); }; const component_ToolsPanelItem = contextConnect(UnconnectedToolsPanelItem, 'ToolsPanelItem'); /* harmony default export */ const tools_panel_item_component = (component_ToolsPanelItem); ;// ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-context.js /** * WordPress dependencies */ const RovingTabIndexContext = (0,external_wp_element_namespaceObject.createContext)(undefined); const useRovingTabIndexContext = () => (0,external_wp_element_namespaceObject.useContext)(RovingTabIndexContext); const RovingTabIndexProvider = RovingTabIndexContext.Provider; ;// ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Provider for adding roving tab index behaviors to tree grid structures. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md */ function RovingTabIndex({ children }) { const [lastFocusedElement, setLastFocusedElement] = (0,external_wp_element_namespaceObject.useState)(); // Use `useMemo` to avoid creation of a new object for the providerValue // on every render. Only create a new object when the `lastFocusedElement` // value changes. const providerValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ lastFocusedElement, setLastFocusedElement }), [lastFocusedElement]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RovingTabIndexProvider, { value: providerValue, children: children }); } ;// ./node_modules/@wordpress/components/build-module/tree-grid/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Return focusables in a row element, excluding those from other branches * nested within the row. * * @param rowElement The DOM element representing the row. * * @return The array of focusables in the row. */ function getRowFocusables(rowElement) { const focusablesInRow = external_wp_dom_namespaceObject.focus.focusable.find(rowElement, { sequential: true }); return focusablesInRow.filter(focusable => { return focusable.closest('[role="row"]') === rowElement; }); } /** * Renders both a table and tbody element, used to create a tree hierarchy. * */ function UnforwardedTreeGrid({ children, onExpandRow = () => {}, onCollapseRow = () => {}, onFocusRow = () => {}, applicationAriaLabel, ...props }, /** A ref to the underlying DOM table element. */ ref) { const onKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => { const { keyCode, metaKey, ctrlKey, altKey } = event; // The shift key is intentionally absent from the following list, // to enable shift + up/down to select items from the list. const hasModifierKeyPressed = metaKey || ctrlKey || altKey; if (hasModifierKeyPressed || ![external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT, external_wp_keycodes_namespaceObject.HOME, external_wp_keycodes_namespaceObject.END].includes(keyCode)) { return; } // The event will be handled, stop propagation. event.stopPropagation(); const { activeElement } = document; const { currentTarget: treeGridElement } = event; if (!activeElement || !treeGridElement.contains(activeElement)) { return; } // Calculate the columnIndex of the active element. const activeRow = activeElement.closest('[role="row"]'); if (!activeRow) { return; } const focusablesInRow = getRowFocusables(activeRow); const currentColumnIndex = focusablesInRow.indexOf(activeElement); const canExpandCollapse = 0 === currentColumnIndex; const cannotFocusNextColumn = canExpandCollapse && (activeRow.getAttribute('data-expanded') === 'false' || activeRow.getAttribute('aria-expanded') === 'false') && keyCode === external_wp_keycodes_namespaceObject.RIGHT; if ([external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT].includes(keyCode)) { // Calculate to the next element. let nextIndex; if (keyCode === external_wp_keycodes_namespaceObject.LEFT) { nextIndex = Math.max(0, currentColumnIndex - 1); } else { nextIndex = Math.min(currentColumnIndex + 1, focusablesInRow.length - 1); } // Focus is at the left most column. if (canExpandCollapse) { if (keyCode === external_wp_keycodes_namespaceObject.LEFT) { var _activeRow$getAttribu; // Left: // If a row is focused, and it is expanded, collapses the current row. if (activeRow.getAttribute('data-expanded') === 'true' || activeRow.getAttribute('aria-expanded') === 'true') { onCollapseRow(activeRow); event.preventDefault(); return; } // If a row is focused, and it is collapsed, moves to the parent row (if there is one). const level = Math.max(parseInt((_activeRow$getAttribu = activeRow?.getAttribute('aria-level')) !== null && _activeRow$getAttribu !== void 0 ? _activeRow$getAttribu : '1', 10) - 1, 1); const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]')); let parentRow = activeRow; const currentRowIndex = rows.indexOf(activeRow); for (let i = currentRowIndex; i >= 0; i--) { const ariaLevel = rows[i].getAttribute('aria-level'); if (ariaLevel !== null && parseInt(ariaLevel, 10) === level) { parentRow = rows[i]; break; } } getRowFocusables(parentRow)?.[0]?.focus(); } if (keyCode === external_wp_keycodes_namespaceObject.RIGHT) { // Right: // If a row is focused, and it is collapsed, expands the current row. if (activeRow.getAttribute('data-expanded') === 'false' || activeRow.getAttribute('aria-expanded') === 'false') { onExpandRow(activeRow); event.preventDefault(); return; } // If a row is focused, and it is expanded, focuses the next cell in the row. const focusableItems = getRowFocusables(activeRow); if (focusableItems.length > 0) { focusableItems[nextIndex]?.focus(); } } // Prevent key use for anything else. For example, Voiceover // will start reading text on continued use of left/right arrow // keys. event.preventDefault(); return; } // Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed. if (cannotFocusNextColumn) { return; } focusablesInRow[nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover // doesn't try to handle key navigation. event.preventDefault(); } else if ([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN].includes(keyCode)) { // Calculate the rowIndex of the next row. const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]')); const currentRowIndex = rows.indexOf(activeRow); let nextRowIndex; if (keyCode === external_wp_keycodes_namespaceObject.UP) { nextRowIndex = Math.max(0, currentRowIndex - 1); } else { nextRowIndex = Math.min(currentRowIndex + 1, rows.length - 1); } // Focus is either at the top or bottom edge of the grid. Do nothing. if (nextRowIndex === currentRowIndex) { // Prevent key use for anything else. For example, Voiceover // will start navigating horizontally when reaching the vertical // bounds of a table. event.preventDefault(); return; } // Get the focusables in the next row. const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing. if (!focusablesInNextRow || !focusablesInNextRow.length) { // Prevent key use for anything else. For example, Voiceover // will still focus text when using arrow keys, while this // component should limit navigation to focusables. event.preventDefault(); return; } // Try to focus the element in the next row that's at a similar column to the activeElement. const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1); focusablesInNextRow[nextIndex].focus(); // Let consumers know the row that was originally focused, // and the row that is now in focus. onFocusRow(event, activeRow, rows[nextRowIndex]); // Prevent key use for anything else. This ensures Voiceover // doesn't try to handle key navigation. event.preventDefault(); } else if ([external_wp_keycodes_namespaceObject.HOME, external_wp_keycodes_namespaceObject.END].includes(keyCode)) { // Calculate the rowIndex of the next row. const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]')); const currentRowIndex = rows.indexOf(activeRow); let nextRowIndex; if (keyCode === external_wp_keycodes_namespaceObject.HOME) { nextRowIndex = 0; } else { nextRowIndex = rows.length - 1; } // Focus is either at the top or bottom edge of the grid. Do nothing. if (nextRowIndex === currentRowIndex) { // Prevent key use for anything else. For example, Voiceover // will start navigating horizontally when reaching the vertical // bounds of a table. event.preventDefault(); return; } // Get the focusables in the next row. const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing. if (!focusablesInNextRow || !focusablesInNextRow.length) { // Prevent key use for anything else. For example, Voiceover // will still focus text when using arrow keys, while this // component should limit navigation to focusables. event.preventDefault(); return; } // Try to focus the element in the next row that's at a similar column to the activeElement. const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1); focusablesInNextRow[nextIndex].focus(); // Let consumers know the row that was originally focused, // and the row that is now in focus. onFocusRow(event, activeRow, rows[nextRowIndex]); // Prevent key use for anything else. This ensures Voiceover // doesn't try to handle key navigation. event.preventDefault(); } }, [onExpandRow, onCollapseRow, onFocusRow]); /* Disable reason: A treegrid is implemented using a table element. */ /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RovingTabIndex, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "application", "aria-label": applicationAriaLabel, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("table", { ...props, role: "treegrid", onKeyDown: onKeyDown, ref: ref, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { children: children }) }) }) }); /* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */ } /** * `TreeGrid` is used to create a tree hierarchy. * It is not a visually styled component, but instead helps with adding * keyboard navigation and roving tab index behaviors to tree grid structures. * * A tree grid is a hierarchical 2 dimensional UI component, for example it could be * used to implement a file system browser. * * A tree grid allows the user to navigate using arrow keys. * Up/down to navigate vertically across rows, and left/right to navigate horizontally * between focusables in a row. * * The `TreeGrid` renders both a `table` and `tbody` element, and is intended to be used * with `TreeGridRow` (`tr`) and `TreeGridCell` (`td`) to build out a grid. * * ```jsx * function TreeMenu() { * return ( * <TreeGrid> * <TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 2 }> * <TreeGridCell> * { ( props ) => ( * <Button onClick={ onSelect } { ...props }>Select</Button> * ) } * </TreeGridCell> * <TreeGridCell> * { ( props ) => ( * <Button onClick={ onMove } { ...props }>Move</Button> * ) } * </TreeGridCell> * </TreeGridRow> * <TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 2 }> * <TreeGridCell> * { ( props ) => ( * <Button onClick={ onSelect } { ...props }>Select</Button> * ) } * </TreeGridCell> * <TreeGridCell> * { ( props ) => ( * <Button onClick={ onMove } { ...props }>Move</Button> * ) } * </TreeGridCell> * </TreeGridRow> * <TreeGridRow level={ 2 } positionInSet={ 1 } setSize={ 1 }> * <TreeGridCell> * { ( props ) => ( * <Button onClick={ onSelect } { ...props }>Select</Button> * ) } * </TreeGridCell> * <TreeGridCell> * { ( props ) => ( * <Button onClick={ onMove } { ...props }>Move</Button> * ) } * </TreeGridCell> * </TreeGridRow> * </TreeGrid> * ); * } * ``` * * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html} */ const TreeGrid = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTreeGrid); /* harmony default export */ const tree_grid = (TreeGrid); ;// ./node_modules/@wordpress/components/build-module/tree-grid/row.js /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedTreeGridRow({ children, level, positionInSet, setSize, isExpanded, ...props }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { ...props, ref: ref, role: "row", "aria-level": level, "aria-posinset": positionInSet, "aria-setsize": setSize, "aria-expanded": isExpanded, children: children }); } /** * `TreeGridRow` is used to create a tree hierarchy. * It is not a visually styled component, but instead helps with adding * keyboard navigation and roving tab index behaviors to tree grid structures. * * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html} */ const TreeGridRow = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTreeGridRow); /* harmony default export */ const tree_grid_row = (TreeGridRow); ;// ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-item.js /** * WordPress dependencies */ /** * Internal dependencies */ const RovingTabIndexItem = (0,external_wp_element_namespaceObject.forwardRef)(function UnforwardedRovingTabIndexItem({ children, as: Component, ...props }, forwardedRef) { const localRef = (0,external_wp_element_namespaceObject.useRef)(); const ref = forwardedRef || localRef; // @ts-expect-error - We actually want to throw an error if this is undefined. const { lastFocusedElement, setLastFocusedElement } = useRovingTabIndexContext(); let tabIndex; if (lastFocusedElement) { tabIndex = lastFocusedElement === ( // TODO: The original implementation simply used `ref.current` here, assuming // that a forwarded ref would always be an object, which is not necessarily true. // This workaround maintains the original runtime behavior in a type-safe way, // but should be revisited. 'current' in ref ? ref.current : undefined) ? 0 : -1; } const onFocus = event => setLastFocusedElement?.(event.target); const allProps = { ref, tabIndex, onFocus, ...props }; if (typeof children === 'function') { return children(allProps); } if (!Component) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...allProps, children: children }); }); /* harmony default export */ const roving_tab_index_item = (RovingTabIndexItem); ;// ./node_modules/@wordpress/components/build-module/tree-grid/item.js /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedTreeGridItem({ children, ...props }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(roving_tab_index_item, { ref: ref, ...props, children: children }); } /** * `TreeGridItem` is used to create a tree hierarchy. * It is not a visually styled component, but instead helps with adding * keyboard navigation and roving tab index behaviors to tree grid structures. * * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html} */ const TreeGridItem = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTreeGridItem); /* harmony default export */ const tree_grid_item = (TreeGridItem); ;// ./node_modules/@wordpress/components/build-module/tree-grid/cell.js /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedTreeGridCell({ children, withoutGridItem = false, ...props }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { ...props, role: "gridcell", children: withoutGridItem ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: typeof children === 'function' ? children({ ...props, ref }) : children }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tree_grid_item, { ref: ref, children: children }) }); } /** * `TreeGridCell` is used to create a tree hierarchy. * It is not a visually styled component, but instead helps with adding * keyboard navigation and roving tab index behaviors to tree grid structures. * * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html} */ const TreeGridCell = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTreeGridCell); /* harmony default export */ const cell = (TreeGridCell); ;// ./node_modules/@wordpress/components/build-module/isolated-event-container/index.js /** * External dependencies */ /** * WordPress dependencies */ function stopPropagation(event) { event.stopPropagation(); } const IsolatedEventContainer = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { external_wp_deprecated_default()('wp.components.IsolatedEventContainer', { since: '5.7' }); // Disable reason: this stops certain events from propagating outside of the component. // - onMouseDown is disabled as this can cause interactions with other DOM elements. /* eslint-disable jsx-a11y/no-static-element-interactions */ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, ref: ref, onMouseDown: stopPropagation }); /* eslint-enable jsx-a11y/no-static-element-interactions */ }); /* harmony default export */ const isolated_event_container = (IsolatedEventContainer); ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot-fills.js /** * WordPress dependencies */ /** * Internal dependencies */ function useSlotFills(name) { const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context); return (0,external_wp_compose_namespaceObject.useObservableValue)(registry.fills, name); } ;// ./node_modules/@wordpress/components/build-module/z-stack/styles.js function z_stack_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ const ZStackChildView = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "ebn2ljm1" } : 0)("&:not( :first-of-type ){", ({ offsetAmount }) => /*#__PURE__*/emotion_react_browser_esm_css({ marginInlineStart: offsetAmount }, true ? "" : 0, true ? "" : 0), ";}", ({ zIndex }) => /*#__PURE__*/emotion_react_browser_esm_css({ zIndex }, true ? "" : 0, true ? "" : 0), ";" + ( true ? "" : 0)); var z_stack_styles_ref = true ? { name: "rs0gp6", styles: "grid-row-start:1;grid-column-start:1" } : 0; const ZStackView = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "ebn2ljm0" } : 0)("display:inline-grid;grid-auto-flow:column;position:relative;&>", ZStackChildView, "{position:relative;justify-self:start;", ({ isLayered }) => isLayered ? // When `isLayered` is true, all items overlap in the same grid cell z_stack_styles_ref : undefined, ";}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/z-stack/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnconnectedZStack(props, forwardedRef) { const { children, className, isLayered = true, isReversed = false, offset = 0, ...otherProps } = useContextSystem(props, 'ZStack'); const validChildren = getValidChildren(children); const childrenLastIndex = validChildren.length - 1; const clonedChildren = validChildren.map((child, index) => { const zIndex = isReversed ? childrenLastIndex - index : index; // Only when the component is layered, the offset needs to be multiplied by // the item's index, so that items can correctly stack at the right distance const offsetAmount = isLayered ? offset * index : offset; const key = (0,external_wp_element_namespaceObject.isValidElement)(child) ? child.key : index; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ZStackChildView, { offsetAmount: offsetAmount, zIndex: zIndex, children: child }, key); }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ZStackView, { ...otherProps, className: className, isLayered: isLayered, ref: forwardedRef, children: clonedChildren }); } /** * `ZStack` allows you to stack things along the Z-axis. * * ```jsx * import { __experimentalZStack as ZStack } from '@wordpress/components'; * * function Example() { * return ( * <ZStack offset={ 20 } isLayered> * <ExampleImage /> * <ExampleImage /> * <ExampleImage /> * </ZStack> * ); * } * ``` */ const ZStack = contextConnect(UnconnectedZStack, 'ZStack'); /* harmony default export */ const z_stack_component = (ZStack); ;// ./node_modules/@wordpress/components/build-module/higher-order/navigate-regions/index.js /** * WordPress dependencies */ const defaultShortcuts = { previous: [{ modifier: 'ctrlShift', character: '`' }, { modifier: 'ctrlShift', character: '~' }, { modifier: 'access', character: 'p' }], next: [{ modifier: 'ctrl', character: '`' }, { modifier: 'access', character: 'n' }] }; function useNavigateRegions(shortcuts = defaultShortcuts) { const ref = (0,external_wp_element_namespaceObject.useRef)(null); const [isFocusingRegions, setIsFocusingRegions] = (0,external_wp_element_namespaceObject.useState)(false); function focusRegion(offset) { var _ref$current$querySel; const regions = Array.from((_ref$current$querySel = ref.current?.querySelectorAll('[role="region"][tabindex="-1"]')) !== null && _ref$current$querySel !== void 0 ? _ref$current$querySel : []); if (!regions.length) { return; } let nextRegion = regions[0]; // Based off the current element, use closest to determine the wrapping region since this operates up the DOM. Also, match tabindex to avoid edge cases with regions we do not want. const wrappingRegion = ref.current?.ownerDocument?.activeElement?.closest('[role="region"][tabindex="-1"]'); const selectedIndex = wrappingRegion ? regions.indexOf(wrappingRegion) : -1; if (selectedIndex !== -1) { let nextIndex = selectedIndex + offset; nextIndex = nextIndex === -1 ? regions.length - 1 : nextIndex; nextIndex = nextIndex === regions.length ? 0 : nextIndex; nextRegion = regions[nextIndex]; } nextRegion.focus(); setIsFocusingRegions(true); } const clickRef = (0,external_wp_compose_namespaceObject.useRefEffect)(element => { function onClick() { setIsFocusingRegions(false); } element.addEventListener('click', onClick); return () => { element.removeEventListener('click', onClick); }; }, [setIsFocusingRegions]); return { ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, clickRef]), className: isFocusingRegions ? 'is-focusing-regions' : '', onKeyDown(event) { if (shortcuts.previous.some(({ modifier, character }) => { return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character); })) { focusRegion(-1); } else if (shortcuts.next.some(({ modifier, character }) => { return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character); })) { focusRegion(1); } } }; } /** * `navigateRegions` is a React [higher-order component](https://facebook.github.io/react/docs/higher-order-components.html) * adding keyboard navigation to switch between the different DOM elements marked as "regions" (role="region"). * These regions should be focusable (By adding a tabIndex attribute for example). For better accessibility, * these elements must be properly labelled to briefly describe the purpose of the content in the region. * For more details, see "Landmark Roles" in the [WAI-ARIA specification](https://www.w3.org/TR/wai-aria/) * and "Landmark Regions" in the [ARIA Authoring Practices Guide](https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/). * * ```jsx * import { navigateRegions } from '@wordpress/components'; * * const MyComponentWithNavigateRegions = navigateRegions( () => ( * <div> * <div role="region" tabIndex="-1" aria-label="Header"> * Header * </div> * <div role="region" tabIndex="-1" aria-label="Content"> * Content * </div> * <div role="region" tabIndex="-1" aria-label="Sidebar"> * Sidebar * </div> * </div> * ) ); * ``` */ /* harmony default export */ const navigate_regions = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(Component => ({ shortcuts, ...props }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...useNavigateRegions(shortcuts), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props }) }), 'navigateRegions')); ;// ./node_modules/@wordpress/components/build-module/higher-order/with-constrained-tabbing/index.js /** * WordPress dependencies */ /** * `withConstrainedTabbing` is a React [higher-order component](https://facebook.github.io/react/docs/higher-order-components.html) * adding the ability to constrain keyboard navigation with the Tab key within a component. * For accessibility reasons, some UI components need to constrain Tab navigation, for example * modal dialogs or similar UI. Use of this component is recommended only in cases where a way to * navigate away from the wrapped component is implemented by other means, usually by pressing * the Escape key or using a specific UI control, e.g. a "Close" button. */ const withConstrainedTabbing = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => function ComponentWithConstrainedTabbing(props) { const ref = (0,external_wp_compose_namespaceObject.useConstrainedTabbing)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, tabIndex: -1, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props }) }); }, 'withConstrainedTabbing'); /* harmony default export */ const with_constrained_tabbing = (withConstrainedTabbing); ;// ./node_modules/@wordpress/components/build-module/higher-order/with-fallback-styles/index.js /** * External dependencies */ /** * WordPress dependencies */ /* harmony default export */ const with_fallback_styles = (mapNodeToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => { return class extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.nodeRef = this.props.node; this.state = { fallbackStyles: undefined, grabStylesCompleted: false }; this.bindRef = this.bindRef.bind(this); } bindRef(node) { if (!node) { return; } this.nodeRef = node; } componentDidMount() { this.grabFallbackStyles(); } componentDidUpdate() { this.grabFallbackStyles(); } grabFallbackStyles() { const { grabStylesCompleted, fallbackStyles } = this.state; if (this.nodeRef && !grabStylesCompleted) { const newFallbackStyles = mapNodeToProps(this.nodeRef, this.props); if (!es6_default()(newFallbackStyles, fallbackStyles)) { this.setState({ fallbackStyles: newFallbackStyles, grabStylesCompleted: Object.values(newFallbackStyles).every(Boolean) }); } } } render() { const wrappedComponent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...this.props, ...this.state.fallbackStyles }); return this.props.node ? wrappedComponent : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: this.bindRef, children: [" ", wrappedComponent, " "] }); } }; }, 'withFallbackStyles')); ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// ./node_modules/@wordpress/components/build-module/higher-order/with-filters/index.js /** * WordPress dependencies */ const ANIMATION_FRAME_PERIOD = 16; /** * Creates a higher-order component which adds filtering capability to the * wrapped component. Filters get applied when the original component is about * to be mounted. When a filter is added or removed that matches the hook name, * the wrapped component re-renders. * * @param hookName Hook name exposed to be used by filters. * * @return Higher-order component factory. * * ```jsx * import { withFilters } from '@wordpress/components'; * import { addFilter } from '@wordpress/hooks'; * * const MyComponent = ( { title } ) => <h1>{ title }</h1>; * * const ComponentToAppend = () => <div>Appended component</div>; * * function withComponentAppended( FilteredComponent ) { * return ( props ) => ( * <> * <FilteredComponent { ...props } /> * <ComponentToAppend /> * </> * ); * } * * addFilter( * 'MyHookName', * 'my-plugin/with-component-appended', * withComponentAppended * ); * * const MyComponentWithFilters = withFilters( 'MyHookName' )( MyComponent ); * ``` */ function withFilters(hookName) { return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => { const namespace = 'core/with-filters/' + hookName; /** * The component definition with current filters applied. Each instance * reuse this shared reference as an optimization to avoid excessive * calls to `applyFilters` when many instances exist. */ let FilteredComponent; /** * Initializes the FilteredComponent variable once, if not already * assigned. Subsequent calls are effectively a noop. */ function ensureFilteredComponent() { if (FilteredComponent === undefined) { FilteredComponent = (0,external_wp_hooks_namespaceObject.applyFilters)(hookName, OriginalComponent); } } class FilteredComponentRenderer extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); ensureFilteredComponent(); } componentDidMount() { FilteredComponentRenderer.instances.push(this); // If there were previously no mounted instances for components // filtered on this hook, add the hook handler. if (FilteredComponentRenderer.instances.length === 1) { (0,external_wp_hooks_namespaceObject.addAction)('hookRemoved', namespace, onHooksUpdated); (0,external_wp_hooks_namespaceObject.addAction)('hookAdded', namespace, onHooksUpdated); } } componentWillUnmount() { FilteredComponentRenderer.instances = FilteredComponentRenderer.instances.filter(instance => instance !== this); // If this was the last of the mounted components filtered on // this hook, remove the hook handler. if (FilteredComponentRenderer.instances.length === 0) { (0,external_wp_hooks_namespaceObject.removeAction)('hookRemoved', namespace); (0,external_wp_hooks_namespaceObject.removeAction)('hookAdded', namespace); } } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilteredComponent, { ...this.props }); } } FilteredComponentRenderer.instances = []; /** * Updates the FilteredComponent definition, forcing a render for each * mounted instance. This occurs a maximum of once per animation frame. */ const throttledForceUpdate = (0,external_wp_compose_namespaceObject.debounce)(() => { // Recreate the filtered component, only after delay so that it's // computed once, even if many filters added. FilteredComponent = (0,external_wp_hooks_namespaceObject.applyFilters)(hookName, OriginalComponent); // Force each instance to render. FilteredComponentRenderer.instances.forEach(instance => { instance.forceUpdate(); }); }, ANIMATION_FRAME_PERIOD); /** * When a filter is added or removed for the matching hook name, each * mounted instance should re-render with the new filters having been * applied to the original component. * * @param updatedHookName Name of the hook that was updated. */ function onHooksUpdated(updatedHookName) { if (updatedHookName === hookName) { throttledForceUpdate(); } } return FilteredComponentRenderer; }, 'withFilters'); } ;// ./node_modules/@wordpress/components/build-module/higher-order/with-focus-return/index.js /** * WordPress dependencies */ /** * Returns true if the given object is component-like. An object is component- * like if it is an instance of wp.element.Component, or is a function. * * @param object Object to test. * * @return Whether object is component-like. */ function isComponentLike(object) { return object instanceof external_wp_element_namespaceObject.Component || typeof object === 'function'; } /** * Higher Order Component used to be used to wrap disposable elements like * sidebars, modals, dropdowns. When mounting the wrapped component, we track a * reference to the current active element so we know where to restore focus * when the component is unmounted. * * @param options The component to be enhanced with * focus return behavior, or an object * describing the component and the * focus return characteristics. * * @return Higher Order Component with the focus restoration behaviour. */ /* harmony default export */ const with_focus_return = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)( // @ts-expect-error TODO: Reconcile with intended `createHigherOrderComponent` types options => { const HoC = ({ onFocusReturn } = {}) => WrappedComponent => { const WithFocusReturn = props => { const ref = (0,external_wp_compose_namespaceObject.useFocusReturn)(onFocusReturn); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props }) }); }; return WithFocusReturn; }; if (isComponentLike(options)) { const WrappedComponent = options; return HoC()(WrappedComponent); } return HoC(options); }, 'withFocusReturn')); const with_focus_return_Provider = ({ children }) => { external_wp_deprecated_default()('wp.components.FocusReturnProvider component', { since: '5.7', hint: 'This provider is not used anymore. You can just remove it from your codebase' }); return children; }; ;// ./node_modules/@wordpress/components/build-module/higher-order/with-notices/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Override the default edit UI to include notices if supported. * * Wrapping the original component with `withNotices` encapsulates the component * with the additional props `noticeOperations` and `noticeUI`. * * ```jsx * import { withNotices, Button } from '@wordpress/components'; * * const MyComponentWithNotices = withNotices( * ( { noticeOperations, noticeUI } ) => { * const addError = () => * noticeOperations.createErrorNotice( 'Error message' ); * return ( * <div> * { noticeUI } * <Button variant="secondary" onClick={ addError }> * Add error * </Button> * </div> * ); * } * ); * ``` * * @param OriginalComponent Original component. * * @return Wrapped component. */ /* harmony default export */ const with_notices = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => { function Component(props, ref) { const [noticeList, setNoticeList] = (0,external_wp_element_namespaceObject.useState)([]); const noticeOperations = (0,external_wp_element_namespaceObject.useMemo)(() => { const createNotice = notice => { const noticeToAdd = notice.id ? notice : { ...notice, id: esm_browser_v4() }; setNoticeList(current => [...current, noticeToAdd]); }; return { createNotice, createErrorNotice: msg => { // @ts-expect-error TODO: Missing `id`, potentially a bug createNotice({ status: 'error', content: msg }); }, removeNotice: id => { setNoticeList(current => current.filter(notice => notice.id !== id)); }, removeAllNotices: () => { setNoticeList([]); } }; }, []); const propsOut = { ...props, noticeList, noticeOperations, noticeUI: noticeList.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(list, { className: "components-with-notices-ui", notices: noticeList, onRemove: noticeOperations.removeNotice }) }; return isForwardRef ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { ...propsOut, ref: ref }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { ...propsOut }); } let isForwardRef; // @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef(). const { render } = OriginalComponent; // Returns a forwardRef if OriginalComponent appears to be a forwardRef. if (typeof render === 'function') { isForwardRef = true; return (0,external_wp_element_namespaceObject.forwardRef)(Component); } return Component; }, 'withNotices')); ;// ./node_modules/@ariakit/react-core/esm/__chunks/B2J376ND.js "use client"; // src/menu/menu-context.tsx var B2J376ND_menu = createStoreContext( [CompositeContextProvider, HovercardContextProvider], [CompositeScopedContextProvider, HovercardScopedContextProvider] ); var useMenuContext = B2J376ND_menu.useContext; var useMenuScopedContext = B2J376ND_menu.useScopedContext; var useMenuProviderContext = B2J376ND_menu.useProviderContext; var MenuContextProvider = B2J376ND_menu.ContextProvider; var MenuScopedContextProvider = B2J376ND_menu.ScopedContextProvider; var useMenuBarContext = (/* unused pure expression or super */ null && (useMenubarContext)); var useMenuBarScopedContext = (/* unused pure expression or super */ null && (useMenubarScopedContext)); var useMenuBarProviderContext = (/* unused pure expression or super */ null && (useMenubarProviderContext)); var MenuBarContextProvider = (/* unused pure expression or super */ null && (MenubarContextProvider)); var MenuBarScopedContextProvider = (/* unused pure expression or super */ null && (MenubarScopedContextProvider)); var MenuItemCheckedContext = (0,external_React_.createContext)( void 0 ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/62UHHO2X.js "use client"; // src/menubar/menubar-context.tsx var menubar = createStoreContext( [CompositeContextProvider], [CompositeScopedContextProvider] ); var _62UHHO2X_useMenubarContext = menubar.useContext; var _62UHHO2X_useMenubarScopedContext = menubar.useScopedContext; var _62UHHO2X_useMenubarProviderContext = menubar.useProviderContext; var _62UHHO2X_MenubarContextProvider = menubar.ContextProvider; var _62UHHO2X_MenubarScopedContextProvider = menubar.ScopedContextProvider; var _62UHHO2X_MenuItemCheckedContext = (0,external_React_.createContext)( void 0 ); ;// ./node_modules/@ariakit/core/esm/menu/menu-store.js "use client"; // src/menu/menu-store.ts function createMenuStore(_a = {}) { var _b = _a, { combobox, parent, menubar } = _b, props = _3YLGPPWQ_objRest(_b, [ "combobox", "parent", "menubar" ]); const parentIsMenubar = !!menubar && !parent; const store = mergeStore( props.store, pick2(parent, ["values"]), omit2(combobox, [ "arrowElement", "anchorElement", "contentElement", "popoverElement", "disclosureElement" ]) ); throwOnConflictingProps(props, store); const syncState = store.getState(); const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store, orientation: defaultValue( props.orientation, syncState.orientation, "vertical" ) })); const hovercard = createHovercardStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store, placement: defaultValue( props.placement, syncState.placement, "bottom-start" ), timeout: defaultValue( props.timeout, syncState.timeout, parentIsMenubar ? 0 : 150 ), hideTimeout: defaultValue(props.hideTimeout, syncState.hideTimeout, 0) })); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), hovercard.getState()), { initialFocus: defaultValue(syncState.initialFocus, "container"), values: defaultValue( props.values, syncState.values, props.defaultValues, {} ) }); const menu = createStore(initialState, composite, hovercard, store); setup( menu, () => sync(menu, ["mounted"], (state) => { if (state.mounted) return; menu.setState("activeId", null); }) ); setup( menu, () => sync(parent, ["orientation"], (state) => { menu.setState( "placement", state.orientation === "vertical" ? "right-start" : "bottom-start" ); }) ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite), hovercard), menu), { combobox, parent, menubar, hideAll: () => { hovercard.hide(); parent == null ? void 0 : parent.hideAll(); }, setInitialFocus: (value) => menu.setState("initialFocus", value), setValues: (values) => menu.setState("values", values), setValue: (name, value) => { if (name === "__proto__") return; if (name === "constructor") return; if (Array.isArray(name)) return; menu.setState("values", (values) => { const prevValue = values[name]; const nextValue = applyState(value, prevValue); if (nextValue === prevValue) return values; return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, values), { [name]: nextValue !== void 0 && nextValue }); }); } }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/MRTXKBQF.js "use client"; // src/menu/menu-store.ts function useMenuStoreProps(store, update, props) { useUpdateEffect(update, [props.combobox, props.parent, props.menubar]); useStoreProps(store, props, "values", "setValues"); return Object.assign( useHovercardStoreProps( useCompositeStoreProps(store, update, props), update, props ), { combobox: props.combobox, parent: props.parent, menubar: props.menubar } ); } function useMenuStore(props = {}) { const parent = useMenuContext(); const menubar = _62UHHO2X_useMenubarContext(); const combobox = useComboboxProviderContext(); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { parent: props.parent !== void 0 ? props.parent : parent, menubar: props.menubar !== void 0 ? props.menubar : menubar, combobox: props.combobox !== void 0 ? props.combobox : combobox }); const [store, update] = YV4JVR4I_useStore(createMenuStore, props); return useMenuStoreProps(store, update, props); } ;// ./node_modules/@wordpress/components/build-module/menu/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const context_Context = (0,external_wp_element_namespaceObject.createContext)(undefined); ;// ./node_modules/@ariakit/react-core/esm/__chunks/MVIULMNR.js "use client"; // src/menu/menu-item.tsx var MVIULMNR_TagName = "div"; function menuHasFocus(baseElement, items, currentTarget) { var _a; if (!baseElement) return false; if (hasFocusWithin(baseElement)) return true; const expandedItem = items == null ? void 0 : items.find((item) => { var _a2; if (item.element === currentTarget) return false; return ((_a2 = item.element) == null ? void 0 : _a2.getAttribute("aria-expanded")) === "true"; }); const expandedMenuId = (_a = expandedItem == null ? void 0 : expandedItem.element) == null ? void 0 : _a.getAttribute("aria-controls"); if (!expandedMenuId) return false; const doc = getDocument(baseElement); const expandedMenu = doc.getElementById(expandedMenuId); if (!expandedMenu) return false; if (hasFocusWithin(expandedMenu)) return true; return !!expandedMenu.querySelector("[role=menuitem][aria-expanded=true]"); } var useMenuItem = createHook( function useMenuItem2(_a) { var _b = _a, { store, hideOnClick = true, preventScrollOnKeyDown = true, focusOnHover, blurOnHoverEnd } = _b, props = __objRest(_b, [ "store", "hideOnClick", "preventScrollOnKeyDown", "focusOnHover", "blurOnHoverEnd" ]); const menuContext = useMenuScopedContext(true); const menubarContext = _62UHHO2X_useMenubarScopedContext(); store = store || menuContext || menubarContext; invariant( store, false && 0 ); const onClickProp = props.onClick; const hideOnClickProp = useBooleanEvent(hideOnClick); const hideMenu = "hideAll" in store ? store.hideAll : void 0; const isWithinMenu = !!hideMenu; const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; if (isDownloading(event)) return; if (isOpeningInNewTab(event)) return; if (!hideMenu) return; const popupType = event.currentTarget.getAttribute("aria-haspopup"); if (popupType === "menu") return; if (!hideOnClickProp(event)) return; hideMenu(); }); const contentElement = useStoreState( store, (state) => "contentElement" in state ? state.contentElement : null ); const role = getPopupItemRole(contentElement, "menuitem"); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ role }, props), { onClick }); props = useCompositeItem(_3YLGPPWQ_spreadValues({ store, preventScrollOnKeyDown }, props)); props = useCompositeHover(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store }, props), { focusOnHover(event) { const getFocusOnHover = () => { if (typeof focusOnHover === "function") return focusOnHover(event); if (focusOnHover != null) return focusOnHover; return true; }; if (!store) return false; if (!getFocusOnHover()) return false; const { baseElement, items } = store.getState(); if (isWithinMenu) { if (event.currentTarget.hasAttribute("aria-expanded")) { event.currentTarget.focus(); } return true; } if (menuHasFocus(baseElement, items, event.currentTarget)) { event.currentTarget.focus(); return true; } return false; }, blurOnHoverEnd(event) { if (typeof blurOnHoverEnd === "function") return blurOnHoverEnd(event); if (blurOnHoverEnd != null) return blurOnHoverEnd; return isWithinMenu; } })); return props; } ); var MVIULMNR_MenuItem = memo2( forwardRef2(function MenuItem2(props) { const htmlProps = useMenuItem(props); return LMDWO4NN_createElement(MVIULMNR_TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/RNCDFVMF.js "use client"; // src/checkbox/checkbox-context.tsx var RNCDFVMF_ctx = createStoreContext(); var useCheckboxContext = RNCDFVMF_ctx.useContext; var useCheckboxScopedContext = RNCDFVMF_ctx.useScopedContext; var useCheckboxProviderContext = RNCDFVMF_ctx.useProviderContext; var CheckboxContextProvider = RNCDFVMF_ctx.ContextProvider; var CheckboxScopedContextProvider = RNCDFVMF_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/ASMQKSDT.js "use client"; // src/checkbox/checkbox.tsx var ASMQKSDT_TagName = "input"; function setMixed(element, mixed) { if (mixed) { element.indeterminate = true; } else if (element.indeterminate) { element.indeterminate = false; } } function isNativeCheckbox(tagName, type) { return tagName === "input" && (!type || type === "checkbox"); } function getPrimitiveValue(value) { if (Array.isArray(value)) { return value.toString(); } return value; } var useCheckbox = createHook( function useCheckbox2(_a) { var _b = _a, { store, name, value: valueProp, checked: checkedProp, defaultChecked } = _b, props = __objRest(_b, [ "store", "name", "value", "checked", "defaultChecked" ]); const context = useCheckboxContext(); store = store || context; const [_checked, setChecked] = (0,external_React_.useState)(defaultChecked != null ? defaultChecked : false); const checked = useStoreState(store, (state) => { if (checkedProp !== void 0) return checkedProp; if ((state == null ? void 0 : state.value) === void 0) return _checked; if (valueProp != null) { if (Array.isArray(state.value)) { const primitiveValue = getPrimitiveValue(valueProp); return state.value.includes(primitiveValue); } return state.value === valueProp; } if (Array.isArray(state.value)) return false; if (typeof state.value === "boolean") return state.value; return false; }); const ref = (0,external_React_.useRef)(null); const tagName = useTagName(ref, ASMQKSDT_TagName); const nativeCheckbox = isNativeCheckbox(tagName, props.type); const mixed = checked ? checked === "mixed" : void 0; const isChecked = checked === "mixed" ? false : checked; const disabled = disabledFromProps(props); const [propertyUpdated, schedulePropertyUpdate] = useForceUpdate(); (0,external_React_.useEffect)(() => { const element = ref.current; if (!element) return; setMixed(element, mixed); if (nativeCheckbox) return; element.checked = isChecked; if (name !== void 0) { element.name = name; } if (valueProp !== void 0) { element.value = `${valueProp}`; } }, [propertyUpdated, mixed, nativeCheckbox, isChecked, name, valueProp]); const onChangeProp = props.onChange; const onChange = useEvent((event) => { if (disabled) { event.stopPropagation(); event.preventDefault(); return; } setMixed(event.currentTarget, mixed); if (!nativeCheckbox) { event.currentTarget.checked = !event.currentTarget.checked; schedulePropertyUpdate(); } onChangeProp == null ? void 0 : onChangeProp(event); if (event.defaultPrevented) return; const elementChecked = event.currentTarget.checked; setChecked(elementChecked); store == null ? void 0 : store.setValue((prevValue) => { if (valueProp == null) return elementChecked; const primitiveValue = getPrimitiveValue(valueProp); if (!Array.isArray(prevValue)) { return prevValue === primitiveValue ? false : primitiveValue; } if (elementChecked) { if (prevValue.includes(primitiveValue)) { return prevValue; } return [...prevValue, primitiveValue]; } return prevValue.filter((v) => v !== primitiveValue); }); }); const onClickProp = props.onClick; const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; if (nativeCheckbox) return; onChange(event); }); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CheckboxCheckedContext.Provider, { value: isChecked, children: element }), [isChecked] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ role: !nativeCheckbox ? "checkbox" : void 0, type: nativeCheckbox ? "checkbox" : void 0, "aria-checked": checked }, props), { ref: useMergeRefs(ref, props.ref), onChange, onClick }); props = useCommand(_3YLGPPWQ_spreadValues({ clickOnEnter: !nativeCheckbox }, props)); return removeUndefinedValues(_3YLGPPWQ_spreadValues({ name: nativeCheckbox ? name : void 0, value: nativeCheckbox ? valueProp : void 0, checked: isChecked }, props)); } ); var Checkbox = forwardRef2(function Checkbox2(props) { const htmlProps = useCheckbox(props); return LMDWO4NN_createElement(ASMQKSDT_TagName, htmlProps); }); ;// ./node_modules/@ariakit/core/esm/checkbox/checkbox-store.js "use client"; // src/checkbox/checkbox-store.ts function createCheckboxStore(props = {}) { var _a; throwOnConflictingProps(props, props.store); const syncState = (_a = props.store) == null ? void 0 : _a.getState(); const initialState = { value: defaultValue( props.value, syncState == null ? void 0 : syncState.value, props.defaultValue, false ) }; const checkbox = createStore(initialState, props.store); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, checkbox), { setValue: (value) => checkbox.setState("value", value) }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/HAVBGUA3.js "use client"; // src/checkbox/checkbox-store.ts function useCheckboxStoreProps(store, update, props) { useUpdateEffect(update, [props.store]); useStoreProps(store, props, "value", "setValue"); return store; } function useCheckboxStore(props = {}) { const [store, update] = YV4JVR4I_useStore(createCheckboxStore, props); return useCheckboxStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/menu/menu-item-checkbox.js "use client"; // src/menu/menu-item-checkbox.tsx var menu_item_checkbox_TagName = "div"; function menu_item_checkbox_getPrimitiveValue(value) { if (Array.isArray(value)) { return value.toString(); } return value; } function getValue(storeValue, value, checked) { if (value === void 0) { if (Array.isArray(storeValue)) return storeValue; return !!checked; } const primitiveValue = menu_item_checkbox_getPrimitiveValue(value); if (!Array.isArray(storeValue)) { if (checked) { return primitiveValue; } return storeValue === primitiveValue ? false : storeValue; } if (checked) { if (storeValue.includes(primitiveValue)) { return storeValue; } return [...storeValue, primitiveValue]; } return storeValue.filter((v) => v !== primitiveValue); } var useMenuItemCheckbox = createHook( function useMenuItemCheckbox2(_a) { var _b = _a, { store, name, value, checked, defaultChecked: defaultCheckedProp, hideOnClick = false } = _b, props = __objRest(_b, [ "store", "name", "value", "checked", "defaultChecked", "hideOnClick" ]); const context = useMenuScopedContext(); store = store || context; invariant( store, false && 0 ); const defaultChecked = useInitialValue(defaultCheckedProp); (0,external_React_.useEffect)(() => { store == null ? void 0 : store.setValue(name, (prevValue = []) => { if (!defaultChecked) return prevValue; return getValue(prevValue, value, true); }); }, [store, name, value, defaultChecked]); (0,external_React_.useEffect)(() => { if (checked === void 0) return; store == null ? void 0 : store.setValue(name, (prevValue) => { return getValue(prevValue, value, checked); }); }, [store, name, value, checked]); const checkboxStore = useCheckboxStore({ value: store.useState((state) => state.values[name]), setValue(internalValue) { store == null ? void 0 : store.setValue(name, () => { if (checked === void 0) return internalValue; const nextValue = getValue(internalValue, value, checked); if (!Array.isArray(nextValue)) return nextValue; if (!Array.isArray(internalValue)) return nextValue; if (shallowEqual(internalValue, nextValue)) return internalValue; return nextValue; }); } }); props = _3YLGPPWQ_spreadValues({ role: "menuitemcheckbox" }, props); props = useCheckbox(_3YLGPPWQ_spreadValues({ store: checkboxStore, name, value, checked }, props)); props = useMenuItem(_3YLGPPWQ_spreadValues({ store, hideOnClick }, props)); return props; } ); var MenuItemCheckbox = memo2( forwardRef2(function MenuItemCheckbox2(props) { const htmlProps = useMenuItemCheckbox(props); return LMDWO4NN_createElement(menu_item_checkbox_TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/menu/menu-item-radio.js "use client"; // src/menu/menu-item-radio.tsx var menu_item_radio_TagName = "div"; function menu_item_radio_getValue(prevValue, value, checked) { if (checked === void 0) return prevValue; if (checked) return value; return prevValue; } var useMenuItemRadio = createHook( function useMenuItemRadio2(_a) { var _b = _a, { store, name, value, checked, onChange: onChangeProp, hideOnClick = false } = _b, props = __objRest(_b, [ "store", "name", "value", "checked", "onChange", "hideOnClick" ]); const context = useMenuScopedContext(); store = store || context; invariant( store, false && 0 ); const defaultChecked = useInitialValue(props.defaultChecked); (0,external_React_.useEffect)(() => { store == null ? void 0 : store.setValue(name, (prevValue = false) => { return menu_item_radio_getValue(prevValue, value, defaultChecked); }); }, [store, name, value, defaultChecked]); (0,external_React_.useEffect)(() => { if (checked === void 0) return; store == null ? void 0 : store.setValue(name, (prevValue) => { return menu_item_radio_getValue(prevValue, value, checked); }); }, [store, name, value, checked]); const isChecked = store.useState((state) => state.values[name] === value); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuItemCheckedContext.Provider, { value: !!isChecked, children: element }), [isChecked] ); props = _3YLGPPWQ_spreadValues({ role: "menuitemradio" }, props); props = useRadio(_3YLGPPWQ_spreadValues({ name, value, checked: isChecked, onChange(event) { onChangeProp == null ? void 0 : onChangeProp(event); if (event.defaultPrevented) return; const element = event.currentTarget; store == null ? void 0 : store.setValue(name, (prevValue) => { return menu_item_radio_getValue(prevValue, value, checked != null ? checked : element.checked); }); } }, props)); props = useMenuItem(_3YLGPPWQ_spreadValues({ store, hideOnClick }, props)); return props; } ); var MenuItemRadio = memo2( forwardRef2(function MenuItemRadio2(props) { const htmlProps = useMenuItemRadio(props); return LMDWO4NN_createElement(menu_item_radio_TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/menu/menu-group.js "use client"; // src/menu/menu-group.tsx var menu_group_TagName = "div"; var useMenuGroup = createHook( function useMenuGroup2(props) { props = useCompositeGroup(props); return props; } ); var menu_group_MenuGroup = forwardRef2(function MenuGroup2(props) { const htmlProps = useMenuGroup(props); return LMDWO4NN_createElement(menu_group_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/menu/menu-group-label.js "use client"; // src/menu/menu-group-label.tsx var menu_group_label_TagName = "div"; var useMenuGroupLabel = createHook( function useMenuGroupLabel2(props) { props = useCompositeGroupLabel(props); return props; } ); var MenuGroupLabel = forwardRef2(function MenuGroupLabel2(props) { const htmlProps = useMenuGroupLabel(props); return LMDWO4NN_createElement(menu_group_label_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/TP7N7UIH.js "use client"; // src/composite/composite-separator.tsx var TP7N7UIH_TagName = "hr"; var useCompositeSeparator = createHook(function useCompositeSeparator2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useCompositeContext(); store = store || context; invariant( store, false && 0 ); const orientation = store.useState( (state) => state.orientation === "horizontal" ? "vertical" : "horizontal" ); props = useSeparator(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { orientation })); return props; }); var CompositeSeparator = forwardRef2(function CompositeSeparator2(props) { const htmlProps = useCompositeSeparator(props); return LMDWO4NN_createElement(TP7N7UIH_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/menu/menu-separator.js "use client"; // src/menu/menu-separator.tsx var menu_separator_TagName = "hr"; var useMenuSeparator = createHook( function useMenuSeparator2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useMenuContext(); store = store || context; props = useCompositeSeparator(_3YLGPPWQ_spreadValues({ store }, props)); return props; } ); var MenuSeparator = forwardRef2(function MenuSeparator2(props) { const htmlProps = useMenuSeparator(props); return LMDWO4NN_createElement(menu_separator_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/menu/styles.js function menu_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const styles_ANIMATION_PARAMS = { SCALE_AMOUNT_OUTER: 0.82, SCALE_AMOUNT_CONTENT: 0.9, DURATION: { IN: '400ms', OUT: '200ms' }, EASING: 'cubic-bezier(0.33, 0, 0, 1)' }; const CONTENT_WRAPPER_PADDING = space(1); const ITEM_PADDING_BLOCK = space(2); const ITEM_PADDING_INLINE = space(3); // TODO: // - border color and divider color are different from COLORS.theme variables // - lighter text color is not defined in COLORS.theme, should it be? // - lighter background color is not defined in COLORS.theme, should it be? const DEFAULT_BORDER_COLOR = COLORS.theme.gray[300]; const DIVIDER_COLOR = COLORS.theme.gray[200]; const LIGHTER_TEXT_COLOR = COLORS.theme.gray[700]; const LIGHT_BACKGROUND_COLOR = COLORS.theme.gray[100]; const TOOLBAR_VARIANT_BORDER_COLOR = COLORS.theme.foreground; const DEFAULT_BOX_SHADOW = `0 0 0 ${config_values.borderWidth} ${DEFAULT_BORDER_COLOR}, ${config_values.elevationMedium}`; const TOOLBAR_VARIANT_BOX_SHADOW = `0 0 0 ${config_values.borderWidth} ${TOOLBAR_VARIANT_BORDER_COLOR}`; const GRID_TEMPLATE_COLS = 'minmax( 0, max-content ) 1fr'; const PopoverOuterWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1wg7tti14" } : 0)("position:relative;background-color:", COLORS.ui.background, ";border-radius:", config_values.radiusMedium, ";", props => /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:", props.variant === 'toolbar' ? TOOLBAR_VARIANT_BOX_SHADOW : DEFAULT_BOX_SHADOW, ";" + ( true ? "" : 0), true ? "" : 0), " overflow:hidden;@media not ( prefers-reduced-motion ){transition-property:transform,opacity;transition-timing-function:", styles_ANIMATION_PARAMS.EASING, ";transition-duration:", styles_ANIMATION_PARAMS.DURATION.IN, ";will-change:transform,opacity;opacity:0;&:has( [data-enter] ){opacity:1;}&:has( [data-leave] ){transition-duration:", styles_ANIMATION_PARAMS.DURATION.OUT, ";}&:has( [data-side='bottom'] ),&:has( [data-side='top'] ){transform:scaleY( ", styles_ANIMATION_PARAMS.SCALE_AMOUNT_OUTER, " );}&:has( [data-side='bottom'] ){transform-origin:top;}&:has( [data-side='top'] ){transform-origin:bottom;}&:has( [data-enter][data-side='bottom'] ),&:has( [data-enter][data-side='top'] ),&:has( [data-leave][data-side='bottom'] ),&:has( [data-leave][data-side='top'] ){transform:scaleY( 1 );}}" + ( true ? "" : 0)); const PopoverInnerWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1wg7tti13" } : 0)("position:relative;z-index:1000000;display:grid;grid-template-columns:", GRID_TEMPLATE_COLS, ";grid-template-rows:auto;box-sizing:border-box;min-width:160px;max-width:320px;max-height:var( --popover-available-height );padding:", CONTENT_WRAPPER_PADDING, ";overscroll-behavior:contain;overflow:auto;outline:2px solid transparent!important;@media not ( prefers-reduced-motion ){transition:inherit;transform-origin:inherit;&[data-side='bottom'],&[data-side='top']{transform:scaleY(\n\t\t\t\tcalc(\n\t\t\t\t\t1 / ", styles_ANIMATION_PARAMS.SCALE_AMOUNT_OUTER, " *\n\t\t\t\t\t\t", styles_ANIMATION_PARAMS.SCALE_AMOUNT_CONTENT, "\n\t\t\t\t)\n\t\t\t);}&[data-enter][data-side='bottom'],&[data-enter][data-side='top'],&[data-leave][data-side='bottom'],&[data-leave][data-side='top']{transform:scaleY( 1 );}}" + ( true ? "" : 0)); const baseItem = /*#__PURE__*/emotion_react_browser_esm_css("all:unset;position:relative;min-height:", space(10), ";box-sizing:border-box;grid-column:1/-1;display:grid;grid-template-columns:", GRID_TEMPLATE_COLS, ";align-items:center;@supports ( grid-template-columns: subgrid ){grid-template-columns:subgrid;}font-size:", font('default.fontSize'), ";font-family:inherit;font-weight:normal;line-height:20px;color:", COLORS.theme.foreground, ";border-radius:", config_values.radiusSmall, ";padding-block:", ITEM_PADDING_BLOCK, ";padding-inline:", ITEM_PADDING_INLINE, ";scroll-margin:", CONTENT_WRAPPER_PADDING, ";user-select:none;outline:none;&[aria-disabled='true']{color:", COLORS.ui.textDisabled, ";cursor:not-allowed;}&[data-active-item]:not( [data-focus-visible] ):not(\n\t\t\t[aria-disabled='true']\n\t\t){background-color:", COLORS.theme.accent, ";color:", COLORS.theme.accentInverted, ";}&[data-focus-visible]{box-shadow:0 0 0 1.5px ", COLORS.theme.accent, ";outline:2px solid transparent;}&:active,&[data-active]{}", PopoverInnerWrapper, ":not(:focus) &:not(:focus)[aria-expanded=\"true\"]{background-color:", LIGHT_BACKGROUND_COLOR, ";color:", COLORS.theme.foreground, ";}svg{fill:currentColor;}" + ( true ? "" : 0), true ? "" : 0); const styles_Item = /*#__PURE__*/emotion_styled_base_browser_esm(MVIULMNR_MenuItem, true ? { target: "e1wg7tti12" } : 0)(baseItem, ";" + ( true ? "" : 0)); const styles_CheckboxItem = /*#__PURE__*/emotion_styled_base_browser_esm(MenuItemCheckbox, true ? { target: "e1wg7tti11" } : 0)(baseItem, ";" + ( true ? "" : 0)); const styles_RadioItem = /*#__PURE__*/emotion_styled_base_browser_esm(MenuItemRadio, true ? { target: "e1wg7tti10" } : 0)(baseItem, ";" + ( true ? "" : 0)); const ItemPrefixWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1wg7tti9" } : 0)("grid-column:1;", styles_CheckboxItem, ">&,", styles_RadioItem, ">&{min-width:", space(6), ";}", styles_CheckboxItem, ">&,", styles_RadioItem, ">&,&:not( :empty ){margin-inline-end:", space(2), ";}display:flex;align-items:center;justify-content:center;color:", LIGHTER_TEXT_COLOR, ";[data-active-item]:not( [data-focus-visible] )>&,[aria-disabled='true']>&{color:inherit;}" + ( true ? "" : 0)); const ItemContentWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1wg7tti8" } : 0)("grid-column:2;display:flex;align-items:center;justify-content:space-between;gap:", space(3), ";pointer-events:none;" + ( true ? "" : 0)); const ItemChildrenWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1wg7tti7" } : 0)("flex:1;display:inline-flex;flex-direction:column;gap:", space(1), ";" + ( true ? "" : 0)); const ItemSuffixWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "e1wg7tti6" } : 0)("flex:0 1 fit-content;min-width:0;width:fit-content;display:flex;align-items:center;justify-content:center;gap:", space(3), ";color:", LIGHTER_TEXT_COLOR, ";[data-active-item]:not( [data-focus-visible] ) *:not(", PopoverInnerWrapper, ") &,[aria-disabled='true'] *:not(", PopoverInnerWrapper, ") &{color:inherit;}" + ( true ? "" : 0)); const styles_Group = /*#__PURE__*/emotion_styled_base_browser_esm(menu_group_MenuGroup, true ? { target: "e1wg7tti5" } : 0)( true ? { name: "49aokf", styles: "display:contents" } : 0); const styles_GroupLabel = /*#__PURE__*/emotion_styled_base_browser_esm(MenuGroupLabel, true ? { target: "e1wg7tti4" } : 0)("grid-column:1/-1;padding-block-start:", space(3), ";padding-block-end:", space(2), ";padding-inline:", ITEM_PADDING_INLINE, ";" + ( true ? "" : 0)); const styles_Separator = /*#__PURE__*/emotion_styled_base_browser_esm(MenuSeparator, true ? { target: "e1wg7tti3" } : 0)("grid-column:1/-1;border:none;height:", config_values.borderWidth, ";background-color:", props => props.variant === 'toolbar' ? TOOLBAR_VARIANT_BORDER_COLOR : DIVIDER_COLOR, ";margin-block:", space(2), ";margin-inline:", ITEM_PADDING_INLINE, ";outline:2px solid transparent;" + ( true ? "" : 0)); const SubmenuChevronIcon = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_icon, true ? { target: "e1wg7tti2" } : 0)("width:", space(1.5), ";", rtl({ transform: `scaleX(1)` }, { transform: `scaleX(-1)` }), ";" + ( true ? "" : 0)); const styles_ItemLabel = /*#__PURE__*/emotion_styled_base_browser_esm(truncate_component, true ? { target: "e1wg7tti1" } : 0)("font-size:", font('default.fontSize'), ";line-height:20px;color:inherit;" + ( true ? "" : 0)); const styles_ItemHelpText = /*#__PURE__*/emotion_styled_base_browser_esm(truncate_component, true ? { target: "e1wg7tti0" } : 0)("font-size:", font('helpText.fontSize'), ";line-height:16px;color:", LIGHTER_TEXT_COLOR, ";overflow-wrap:anywhere;[data-active-item]:not( [data-focus-visible] ) *:not( ", PopoverInnerWrapper, " ) &,[aria-disabled='true'] *:not( ", PopoverInnerWrapper, " ) &{color:inherit;}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/menu/item.js /** * WordPress dependencies */ /** * Internal dependencies */ const item_Item = (0,external_wp_element_namespaceObject.forwardRef)(function Item({ prefix, suffix, children, disabled = false, hideOnClick = true, store, ...props }, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store) { throw new Error('Menu.Item can only be rendered inside a Menu component'); } // In most cases, the menu store will be retrieved from context (ie. the store // created by the top-level menu component). But in rare cases (ie. // `Menu.SubmenuTriggerItem`), the context store wouldn't be correct. This is // why the component accepts a `store` prop to override the context store. const computedStore = store !== null && store !== void 0 ? store : menuContext.store; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(styles_Item, { ref: ref, ...props, accessibleWhenDisabled: true, disabled: disabled, hideOnClick: hideOnClick, store: computedStore, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemPrefixWrapper, { children: prefix }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ItemContentWrapper, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemChildrenWrapper, { children: children }), suffix && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemSuffixWrapper, { children: suffix })] })] }); }); ;// ./node_modules/@ariakit/react-core/esm/menu/menu-item-check.js "use client"; // src/menu/menu-item-check.tsx var menu_item_check_TagName = "span"; var useMenuItemCheck = createHook( function useMenuItemCheck2(_a) { var _b = _a, { store, checked } = _b, props = __objRest(_b, ["store", "checked"]); const context = (0,external_React_.useContext)(MenuItemCheckedContext); checked = checked != null ? checked : context; props = useCheckboxCheck(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { checked })); return props; } ); var MenuItemCheck = forwardRef2(function MenuItemCheck2(props) { const htmlProps = useMenuItemCheck(props); return LMDWO4NN_createElement(menu_item_check_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/menu/checkbox-item.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const CheckboxItem = (0,external_wp_element_namespaceObject.forwardRef)(function CheckboxItem({ suffix, children, disabled = false, hideOnClick = false, ...props }, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store) { throw new Error('Menu.CheckboxItem can only be rendered inside a Menu component'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(styles_CheckboxItem, { ref: ref, ...props, accessibleWhenDisabled: true, disabled: disabled, hideOnClick: hideOnClick, store: menuContext.store, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuItemCheck, { store: menuContext.store, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemPrefixWrapper, {}) // Override some ariakit inline styles , style: { width: 'auto', height: 'auto' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: library_check, size: 24 }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ItemContentWrapper, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemChildrenWrapper, { children: children }), suffix && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemSuffixWrapper, { children: suffix })] })] }); }); ;// ./node_modules/@wordpress/components/build-module/menu/radio-item.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const radioCheck = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Circle, { cx: 12, cy: 12, r: 3 }) }); const RadioItem = (0,external_wp_element_namespaceObject.forwardRef)(function RadioItem({ suffix, children, disabled = false, hideOnClick = false, ...props }, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store) { throw new Error('Menu.RadioItem can only be rendered inside a Menu component'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(styles_RadioItem, { ref: ref, ...props, accessibleWhenDisabled: true, disabled: disabled, hideOnClick: hideOnClick, store: menuContext.store, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuItemCheck, { store: menuContext.store, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemPrefixWrapper, {}) // Override some ariakit inline styles , style: { width: 'auto', height: 'auto' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: radioCheck, size: 24 }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ItemContentWrapper, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemChildrenWrapper, { children: children }), suffix && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemSuffixWrapper, { children: suffix })] })] }); }); ;// ./node_modules/@wordpress/components/build-module/menu/group.js /** * WordPress dependencies */ /** * Internal dependencies */ const group_Group = (0,external_wp_element_namespaceObject.forwardRef)(function Group(props, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store) { throw new Error('Menu.Group can only be rendered inside a Menu component'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_Group, { ref: ref, ...props, store: menuContext.store }); }); ;// ./node_modules/@wordpress/components/build-module/menu/group-label.js /** * WordPress dependencies */ /** * Internal dependencies */ const group_label_GroupLabel = (0,external_wp_element_namespaceObject.forwardRef)(function Group(props, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store) { throw new Error('Menu.GroupLabel can only be rendered inside a Menu component'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_GroupLabel, { ref: ref, render: /*#__PURE__*/ // @ts-expect-error The `children` prop is passed (0,external_ReactJSXRuntime_namespaceObject.jsx)(text_component, { upperCase: true, variant: "muted", size: "11px", weight: 500, lineHeight: "16px" }), ...props, store: menuContext.store }); }); ;// ./node_modules/@wordpress/components/build-module/menu/separator.js /** * WordPress dependencies */ /** * Internal dependencies */ const separator_Separator = (0,external_wp_element_namespaceObject.forwardRef)(function Separator(props, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store) { throw new Error('Menu.Separator can only be rendered inside a Menu component'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_Separator, { ref: ref, ...props, store: menuContext.store, variant: menuContext.variant }); }); ;// ./node_modules/@wordpress/components/build-module/menu/item-label.js /** * WordPress dependencies */ /** * Internal dependencies */ const ItemLabel = (0,external_wp_element_namespaceObject.forwardRef)(function ItemLabel(props, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store) { throw new Error('Menu.ItemLabel can only be rendered inside a Menu component'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_ItemLabel, { numberOfLines: 1, ref: ref, ...props }); }); ;// ./node_modules/@wordpress/components/build-module/menu/item-help-text.js /** * WordPress dependencies */ /** * Internal dependencies */ const ItemHelpText = (0,external_wp_element_namespaceObject.forwardRef)(function ItemHelpText(props, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store) { throw new Error('Menu.ItemHelpText can only be rendered inside a Menu component'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_ItemHelpText, { numberOfLines: 2, ref: ref, ...props }); }); ;// ./node_modules/@ariakit/react-core/esm/menu/menu-button.js "use client"; // src/menu/menu-button.tsx var menu_button_TagName = "button"; function getInitialFocus(event, dir) { const keyMap = { ArrowDown: dir === "bottom" || dir === "top" ? "first" : false, ArrowUp: dir === "bottom" || dir === "top" ? "last" : false, ArrowRight: dir === "right" ? "first" : false, ArrowLeft: dir === "left" ? "first" : false }; return keyMap[event.key]; } function hasActiveItem(items, excludeElement) { return !!(items == null ? void 0 : items.some((item) => { if (!item.element) return false; if (item.element === excludeElement) return false; return item.element.getAttribute("aria-expanded") === "true"; })); } var useMenuButton = createHook( function useMenuButton2(_a) { var _b = _a, { store, focusable, accessibleWhenDisabled, showOnHover } = _b, props = __objRest(_b, [ "store", "focusable", "accessibleWhenDisabled", "showOnHover" ]); const context = useMenuProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const parentMenu = store.parent; const parentMenubar = store.menubar; const hasParentMenu = !!parentMenu; const parentIsMenubar = !!parentMenubar && !hasParentMenu; const disabled = disabledFromProps(props); const showMenu = () => { const trigger = ref.current; if (!trigger) return; store == null ? void 0 : store.setDisclosureElement(trigger); store == null ? void 0 : store.setAnchorElement(trigger); store == null ? void 0 : store.show(); }; const onFocusProp = props.onFocus; const onFocus = useEvent((event) => { onFocusProp == null ? void 0 : onFocusProp(event); if (disabled) return; if (event.defaultPrevented) return; store == null ? void 0 : store.setAutoFocusOnShow(false); store == null ? void 0 : store.setActiveId(null); if (!parentMenubar) return; if (!parentIsMenubar) return; const { items } = parentMenubar.getState(); if (hasActiveItem(items, event.currentTarget)) { showMenu(); } }); const dir = useStoreState( store, (state) => state.placement.split("-")[0] ); const onKeyDownProp = props.onKeyDown; const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (disabled) return; if (event.defaultPrevented) return; const initialFocus = getInitialFocus(event, dir); if (initialFocus) { event.preventDefault(); showMenu(); store == null ? void 0 : store.setAutoFocusOnShow(true); store == null ? void 0 : store.setInitialFocus(initialFocus); } }); const onClickProp = props.onClick; const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; if (!store) return; const isKeyboardClick = !event.detail; const { open } = store.getState(); if (!open || isKeyboardClick) { if (!hasParentMenu || isKeyboardClick) { store.setAutoFocusOnShow(true); } store.setInitialFocus(isKeyboardClick ? "first" : "container"); } if (hasParentMenu) { showMenu(); } }); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuContextProvider, { value: store, children: element }), [store] ); if (hasParentMenu) { props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Role.div, { render: props.render }) }); } const id = useId(props.id); const parentContentElement = useStoreState( (parentMenu == null ? void 0 : parentMenu.combobox) || parentMenu, "contentElement" ); const role = hasParentMenu || parentIsMenubar ? getPopupItemRole(parentContentElement, "menuitem") : void 0; const contentElement = store.useState("contentElement"); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, role, "aria-haspopup": getPopupRole(contentElement, "menu") }, props), { ref: useMergeRefs(ref, props.ref), onFocus, onKeyDown, onClick }); props = useHovercardAnchor(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store, focusable, accessibleWhenDisabled }, props), { showOnHover: (event) => { const getShowOnHover = () => { if (typeof showOnHover === "function") return showOnHover(event); if (showOnHover != null) return showOnHover; if (hasParentMenu) return true; if (!parentMenubar) return false; const { items } = parentMenubar.getState(); return parentIsMenubar && hasActiveItem(items); }; const canShowOnHover = getShowOnHover(); if (!canShowOnHover) return false; const parent = parentIsMenubar ? parentMenubar : parentMenu; if (!parent) return true; parent.setActiveId(event.currentTarget.id); return true; } })); props = usePopoverDisclosure(_3YLGPPWQ_spreadValues({ store, toggleOnClick: !hasParentMenu, focusable, accessibleWhenDisabled }, props)); props = useCompositeTypeahead(_3YLGPPWQ_spreadValues({ store, typeahead: parentIsMenubar }, props)); return props; } ); var MenuButton = forwardRef2(function MenuButton2(props) { const htmlProps = useMenuButton(props); return LMDWO4NN_createElement(menu_button_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/menu/trigger-button.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const TriggerButton = (0,external_wp_element_namespaceObject.forwardRef)(function TriggerButton({ children, disabled = false, ...props }, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store) { throw new Error('Menu.TriggerButton can only be rendered inside a Menu component'); } if (menuContext.store.parent) { throw new Error('Menu.TriggerButton should not be rendered inside a nested Menu component. Use Menu.SubmenuTriggerItem instead.'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuButton, { ref: ref, ...props, disabled: disabled, store: menuContext.store, children: children }); }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js /** * WordPress dependencies */ const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); /* harmony default export */ const chevron_right_small = (chevronRightSmall); ;// ./node_modules/@wordpress/components/build-module/menu/submenu-trigger-item.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const SubmenuTriggerItem = (0,external_wp_element_namespaceObject.forwardRef)(function SubmenuTriggerItem({ suffix, ...otherProps }, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); if (!menuContext?.store.parent) { throw new Error('Menu.SubmenuTriggerItem can only be rendered inside a nested Menu component'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuButton, { ref: ref, accessibleWhenDisabled: true, store: menuContext.store, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(item_Item, { ...otherProps, // The menu item needs to register and be part of the parent menu. // Without specifying the store explicitly, the `Item` component // would otherwise read the store via context and pick up the one from // the sub-menu `Menu` component. store: menuContext.store.parent, suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [suffix, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SubmenuChevronIcon, { "aria-hidden": "true", icon: chevron_right_small, size: 24, preserveAspectRatio: "xMidYMid slice" })] }) }) }); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/ASGALOAX.js "use client"; // src/menu/menu-list.tsx var ASGALOAX_TagName = "div"; function useAriaLabelledBy(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const [id, setId] = (0,external_React_.useState)(void 0); const label = props["aria-label"]; const disclosureElement = useStoreState(store, "disclosureElement"); const contentElement = useStoreState(store, "contentElement"); (0,external_React_.useEffect)(() => { const disclosure = disclosureElement; if (!disclosure) return; const menu = contentElement; if (!menu) return; const menuLabel = label || menu.hasAttribute("aria-label"); if (menuLabel) { setId(void 0); } else if (disclosure.id) { setId(disclosure.id); } }, [label, disclosureElement, contentElement]); return id; } var useMenuList = createHook( function useMenuList2(_a) { var _b = _a, { store, alwaysVisible, composite } = _b, props = __objRest(_b, ["store", "alwaysVisible", "composite"]); const context = useMenuProviderContext(); store = store || context; invariant( store, false && 0 ); const parentMenu = store.parent; const parentMenubar = store.menubar; const hasParentMenu = !!parentMenu; const id = useId(props.id); const onKeyDownProp = props.onKeyDown; const dir = store.useState( (state) => state.placement.split("-")[0] ); const orientation = store.useState( (state) => state.orientation === "both" ? void 0 : state.orientation ); const isHorizontal = orientation !== "vertical"; const isMenubarHorizontal = useStoreState( parentMenubar, (state) => !!state && state.orientation !== "vertical" ); const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (event.defaultPrevented) return; if (hasParentMenu || parentMenubar && !isHorizontal) { const hideMap = { ArrowRight: () => dir === "left" && !isHorizontal, ArrowLeft: () => dir === "right" && !isHorizontal, ArrowUp: () => dir === "bottom" && isHorizontal, ArrowDown: () => dir === "top" && isHorizontal }; const action = hideMap[event.key]; if (action == null ? void 0 : action()) { event.stopPropagation(); event.preventDefault(); return store == null ? void 0 : store.hide(); } } if (parentMenubar) { const keyMap = { ArrowRight: () => { if (!isMenubarHorizontal) return; return parentMenubar.next(); }, ArrowLeft: () => { if (!isMenubarHorizontal) return; return parentMenubar.previous(); }, ArrowDown: () => { if (isMenubarHorizontal) return; return parentMenubar.next(); }, ArrowUp: () => { if (isMenubarHorizontal) return; return parentMenubar.previous(); } }; const action = keyMap[event.key]; const id2 = action == null ? void 0 : action(); if (id2 !== void 0) { event.stopPropagation(); event.preventDefault(); parentMenubar.move(id2); } } }); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuScopedContextProvider, { value: store, children: element }), [store] ); const ariaLabelledBy = useAriaLabelledBy(_3YLGPPWQ_spreadValues({ store }, props)); const mounted = store.useState("mounted"); const hidden = isHidden(mounted, props.hidden, alwaysVisible); const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style; props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, "aria-labelledby": ariaLabelledBy, hidden }, props), { ref: useMergeRefs(id ? store.setContentElement : null, props.ref), style, onKeyDown }); const hasCombobox = !!store.combobox; composite = composite != null ? composite : !hasCombobox; if (composite) { props = _3YLGPPWQ_spreadValues({ role: "menu", "aria-orientation": orientation }, props); } props = useComposite(_3YLGPPWQ_spreadValues({ store, composite }, props)); props = useCompositeTypeahead(_3YLGPPWQ_spreadValues({ store, typeahead: !hasCombobox }, props)); return props; } ); var MenuList = forwardRef2(function MenuList2(props) { const htmlProps = useMenuList(props); return LMDWO4NN_createElement(ASGALOAX_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/menu/menu.js "use client"; // src/menu/menu.tsx var menu_TagName = "div"; var useMenu = createHook(function useMenu2(_a) { var _b = _a, { store, modal: modalProp = false, portal = !!modalProp, hideOnEscape = true, autoFocusOnShow = true, hideOnHoverOutside, alwaysVisible } = _b, props = __objRest(_b, [ "store", "modal", "portal", "hideOnEscape", "autoFocusOnShow", "hideOnHoverOutside", "alwaysVisible" ]); const context = useMenuProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const parentMenu = store.parent; const parentMenubar = store.menubar; const hasParentMenu = !!parentMenu; const parentIsMenubar = !!parentMenubar && !hasParentMenu; props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(ref, props.ref) }); const _a2 = useMenuList(_3YLGPPWQ_spreadValues({ store, alwaysVisible }, props)), { "aria-labelledby": ariaLabelledBy } = _a2, menuListProps = __objRest(_a2, ["aria-labelledby"]); props = menuListProps; const [initialFocusRef, setInitialFocusRef] = (0,external_React_.useState)(); const autoFocusOnShowState = store.useState("autoFocusOnShow"); const initialFocus = store.useState("initialFocus"); const baseElement = store.useState("baseElement"); const items = store.useState("renderedItems"); (0,external_React_.useEffect)(() => { let cleaning = false; setInitialFocusRef((prevInitialFocusRef) => { var _a3, _b2, _c; if (cleaning) return; if (!autoFocusOnShowState) return; if ((_a3 = prevInitialFocusRef == null ? void 0 : prevInitialFocusRef.current) == null ? void 0 : _a3.isConnected) return prevInitialFocusRef; const ref2 = (0,external_React_.createRef)(); switch (initialFocus) { case "first": ref2.current = ((_b2 = items.find((item) => !item.disabled && item.element)) == null ? void 0 : _b2.element) || null; break; case "last": ref2.current = ((_c = [...items].reverse().find((item) => !item.disabled && item.element)) == null ? void 0 : _c.element) || null; break; default: ref2.current = baseElement; } return ref2; }); return () => { cleaning = true; }; }, [store, autoFocusOnShowState, initialFocus, items, baseElement]); const modal = hasParentMenu ? false : modalProp; const mayAutoFocusOnShow = !!autoFocusOnShow; const canAutoFocusOnShow = !!initialFocusRef || !!props.initialFocus || !!modal; const contentElement = useStoreState( store.combobox || store, "contentElement" ); const parentContentElement = useStoreState( (parentMenu == null ? void 0 : parentMenu.combobox) || parentMenu, "contentElement" ); const preserveTabOrderAnchor = (0,external_React_.useMemo)(() => { if (!parentContentElement) return; if (!contentElement) return; const role = contentElement.getAttribute("role"); const parentRole = parentContentElement.getAttribute("role"); const parentIsMenuOrMenubar = parentRole === "menu" || parentRole === "menubar"; if (parentIsMenuOrMenubar && role === "menu") return; return parentContentElement; }, [contentElement, parentContentElement]); if (preserveTabOrderAnchor !== void 0) { props = _3YLGPPWQ_spreadValues({ preserveTabOrderAnchor }, props); } props = useHovercard(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store, alwaysVisible, initialFocus: initialFocusRef, autoFocusOnShow: mayAutoFocusOnShow ? canAutoFocusOnShow && autoFocusOnShow : autoFocusOnShowState || !!modal }, props), { hideOnEscape(event) { if (isFalsyBooleanCallback(hideOnEscape, event)) return false; store == null ? void 0 : store.hideAll(); return true; }, hideOnHoverOutside(event) { const disclosureElement = store == null ? void 0 : store.getState().disclosureElement; const getHideOnHoverOutside = () => { if (typeof hideOnHoverOutside === "function") { return hideOnHoverOutside(event); } if (hideOnHoverOutside != null) return hideOnHoverOutside; if (hasParentMenu) return true; if (!parentIsMenubar) return false; if (!disclosureElement) return true; if (hasFocusWithin(disclosureElement)) return false; return true; }; if (!getHideOnHoverOutside()) return false; if (event.defaultPrevented) return true; if (!hasParentMenu) return true; if (!disclosureElement) return true; fireEvent(disclosureElement, "mouseout", event); if (!hasFocusWithin(disclosureElement)) return true; requestAnimationFrame(() => { if (hasFocusWithin(disclosureElement)) return; store == null ? void 0 : store.hide(); }); return false; }, modal, portal, backdrop: hasParentMenu ? false : props.backdrop })); props = _3YLGPPWQ_spreadValues({ "aria-labelledby": ariaLabelledBy }, props); return props; }); var Menu = createDialogComponent( forwardRef2(function Menu2(props) { const htmlProps = useMenu(props); return LMDWO4NN_createElement(menu_TagName, htmlProps); }), useMenuProviderContext ); ;// ./node_modules/@wordpress/components/build-module/menu/popover.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const menu_popover_Popover = (0,external_wp_element_namespaceObject.forwardRef)(function Popover({ gutter, children, shift, modal = true, ...otherProps }, ref) { const menuContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); // Extract the side from the applied placement — useful for animations. // Using `currentPlacement` instead of `placement` to make sure that we // use the final computed placement (including "flips" etc). const appliedPlacementSide = useStoreState(menuContext?.store, 'currentPlacement')?.split('-')[0]; const hideOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => { // Pressing Escape can cause unexpected consequences (ie. exiting // full screen mode on MacOs, close parent modals...). event.preventDefault(); // Returning `true` causes the menu to hide. return true; }, []); const computedDirection = useStoreState(menuContext?.store, 'rtl') ? 'rtl' : 'ltr'; const wrapperProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ dir: computedDirection, style: { direction: computedDirection } }), [computedDirection]); if (!menuContext?.store) { throw new Error('Menu.Popover can only be rendered inside a Menu component'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu, { ...otherProps, ref: ref, modal: modal, store: menuContext.store // Root menu has an 8px distance from its trigger, // otherwise 0 (which causes the submenu to slightly overlap) , gutter: gutter !== null && gutter !== void 0 ? gutter : menuContext.store.parent ? 0 : 8 // Align nested menu by the same (but opposite) amount // as the menu container's padding. , shift: shift !== null && shift !== void 0 ? shift : menuContext.store.parent ? -4 : 0, hideOnHoverOutside: false, "data-side": appliedPlacementSide, wrapperProps: wrapperProps, hideOnEscape: hideOnEscape, unmountOnHide: true, render: renderProps => /*#__PURE__*/ // Two wrappers are needed for the entry animation, where the menu // container scales with a different factor than its contents. // The {...renderProps} are passed to the inner wrapper, so that the // menu element is the direct parent of the menu item elements. (0,external_ReactJSXRuntime_namespaceObject.jsx)(PopoverOuterWrapper, { variant: menuContext.variant, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PopoverInnerWrapper, { ...renderProps }) }), children: children }); }); ;// ./node_modules/@wordpress/components/build-module/menu/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const UnconnectedMenu = props => { const { children, defaultOpen = false, open, onOpenChange, placement, // From internal components context variant } = useContextSystem(props, 'Menu'); const parentContext = (0,external_wp_element_namespaceObject.useContext)(context_Context); const rtl = (0,external_wp_i18n_namespaceObject.isRTL)(); // If an explicit value for the `placement` prop is not passed, // apply a default placement of `bottom-start` for the root menu popover, // and of `right-start` for nested menu popovers. let computedPlacement = placement !== null && placement !== void 0 ? placement : parentContext?.store ? 'right-start' : 'bottom-start'; // Swap left/right in case of RTL direction if (rtl) { if (/right/.test(computedPlacement)) { computedPlacement = computedPlacement.replace('right', 'left'); } else if (/left/.test(computedPlacement)) { computedPlacement = computedPlacement.replace('left', 'right'); } } const menuStore = useMenuStore({ parent: parentContext?.store, open, defaultOpen, placement: computedPlacement, focusLoop: true, setOpen(willBeOpen) { onOpenChange?.(willBeOpen); }, rtl }); const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ store: menuStore, variant }), [menuStore, variant]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(context_Context.Provider, { value: contextValue, children: children }); }; /** * Menu is a collection of React components that combine to render * ARIA-compliant [menu](https://www.w3.org/WAI/ARIA/apg/patterns/menu/) and * [menu button](https://www.w3.org/WAI/ARIA/apg/patterns/menubutton/) patterns. * * `Menu` itself is a wrapper component and context provider. * It is responsible for managing the state of the menu and its items, and for * rendering the `Menu.TriggerButton` (or the `Menu.SubmenuTriggerItem`) * component, and the `Menu.Popover` component. */ const menu_Menu = Object.assign(contextConnectWithoutRef(UnconnectedMenu, 'Menu'), { Context: Object.assign(context_Context, { displayName: 'Menu.Context' }), /** * Renders a menu item inside the `Menu.Popover` or `Menu.Group` components. * * It can optionally contain one instance of the `Menu.ItemLabel` component * and one instance of the `Menu.ItemHelpText` component. */ Item: Object.assign(item_Item, { displayName: 'Menu.Item' }), /** * Renders a radio menu item inside the `Menu.Popover` or `Menu.Group` * components. * * It can optionally contain one instance of the `Menu.ItemLabel` component * and one instance of the `Menu.ItemHelpText` component. */ RadioItem: Object.assign(RadioItem, { displayName: 'Menu.RadioItem' }), /** * Renders a checkbox menu item inside the `Menu.Popover` or `Menu.Group` * components. * * It can optionally contain one instance of the `Menu.ItemLabel` component * and one instance of the `Menu.ItemHelpText` component. */ CheckboxItem: Object.assign(CheckboxItem, { displayName: 'Menu.CheckboxItem' }), /** * Renders a group for menu items. * * It should contain one instance of `Menu.GroupLabel` and one or more * instances of `Menu.Item`, `Menu.RadioItem`, or `Menu.CheckboxItem`. */ Group: Object.assign(group_Group, { displayName: 'Menu.Group' }), /** * Renders a label in a menu group. * * This component should be wrapped with `Menu.Group` so the * `aria-labelledby` is correctly set on the group element. */ GroupLabel: Object.assign(group_label_GroupLabel, { displayName: 'Menu.GroupLabel' }), /** * Renders a divider between menu items or menu groups. */ Separator: Object.assign(separator_Separator, { displayName: 'Menu.Separator' }), /** * Renders a menu item's label text. It should be wrapped with `Menu.Item`, * `Menu.RadioItem`, or `Menu.CheckboxItem`. */ ItemLabel: Object.assign(ItemLabel, { displayName: 'Menu.ItemLabel' }), /** * Renders a menu item's help text. It should be wrapped with `Menu.Item`, * `Menu.RadioItem`, or `Menu.CheckboxItem`. */ ItemHelpText: Object.assign(ItemHelpText, { displayName: 'Menu.ItemHelpText' }), /** * Renders a dropdown menu element that's controlled by a sibling * `Menu.TriggerButton` component. It renders a popover and automatically * focuses on items when the menu is shown. * * The only valid children of `Menu.Popover` are `Menu.Item`, * `Menu.RadioItem`, `Menu.CheckboxItem`, `Menu.Group`, `Menu.Separator`, * and `Menu` (for nested dropdown menus). */ Popover: Object.assign(menu_popover_Popover, { displayName: 'Menu.Popover' }), /** * Renders a menu button that toggles the visibility of a sibling * `Menu.Popover` component when clicked or when using arrow keys. */ TriggerButton: Object.assign(TriggerButton, { displayName: 'Menu.TriggerButton' }), /** * Renders a menu item that toggles the visibility of a sibling * `Menu.Popover` component when clicked or when using arrow keys. * * This component is used to create a nested dropdown menu. */ SubmenuTriggerItem: Object.assign(SubmenuTriggerItem, { displayName: 'Menu.SubmenuTriggerItem' }) }); /* harmony default export */ const build_module_menu = ((/* unused pure expression or super */ null && (menu_Menu))); ;// ./node_modules/@wordpress/components/build-module/theme/styles.js function theme_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const colorVariables = ({ colors }) => { const shades = Object.entries(colors.gray || {}).map(([k, v]) => `--wp-components-color-gray-${k}: ${v};`).join(''); return [/*#__PURE__*/emotion_react_browser_esm_css("--wp-components-color-accent:", colors.accent, ";--wp-components-color-accent-darker-10:", colors.accentDarker10, ";--wp-components-color-accent-darker-20:", colors.accentDarker20, ";--wp-components-color-accent-inverted:", colors.accentInverted, ";--wp-components-color-background:", colors.background, ";--wp-components-color-foreground:", colors.foreground, ";--wp-components-color-foreground-inverted:", colors.foregroundInverted, ";", shades, ";" + ( true ? "" : 0), true ? "" : 0)]; }; const theme_styles_Wrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1krjpvb0" } : 0)( true ? { name: "1a3idx0", styles: "color:var( --wp-components-color-foreground, currentColor )" } : 0); ;// ./node_modules/@wordpress/components/build-module/theme/color-algorithms.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ k([names, a11y]); function generateThemeVariables(inputs) { validateInputs(inputs); const generatedColors = { ...generateAccentDependentColors(inputs.accent), ...generateBackgroundDependentColors(inputs.background) }; warnContrastIssues(checkContrasts(inputs, generatedColors)); return { colors: generatedColors }; } function validateInputs(inputs) { for (const [key, value] of Object.entries(inputs)) { if (typeof value !== 'undefined' && !w(value).isValid()) { true ? external_wp_warning_default()(`wp.components.Theme: "${value}" is not a valid color value for the '${key}' prop.`) : 0; } } } function checkContrasts(inputs, outputs) { const background = inputs.background || COLORS.white; const accent = inputs.accent || '#3858e9'; const foreground = outputs.foreground || COLORS.gray[900]; const gray = outputs.gray || COLORS.gray; return { accent: w(background).isReadable(accent) ? undefined : `The background color ("${background}") does not have sufficient contrast against the accent color ("${accent}").`, foreground: w(background).isReadable(foreground) ? undefined : `The background color provided ("${background}") does not have sufficient contrast against the standard foreground colors.`, grays: w(background).contrast(gray[600]) >= 3 && w(background).contrast(gray[700]) >= 4.5 ? undefined : `The background color provided ("${background}") cannot generate a set of grayscale foreground colors with sufficient contrast. Try adjusting the color to be lighter or darker.` }; } function warnContrastIssues(issues) { for (const error of Object.values(issues)) { if (error) { true ? external_wp_warning_default()('wp.components.Theme: ' + error) : 0; } } } function generateAccentDependentColors(accent) { if (!accent) { return {}; } return { accent, accentDarker10: w(accent).darken(0.1).toHex(), accentDarker20: w(accent).darken(0.2).toHex(), accentInverted: getForegroundForColor(accent) }; } function generateBackgroundDependentColors(background) { if (!background) { return {}; } const foreground = getForegroundForColor(background); return { background, foreground, foregroundInverted: getForegroundForColor(foreground), gray: generateShades(background, foreground) }; } function getForegroundForColor(color) { return w(color).isDark() ? COLORS.white : COLORS.gray[900]; } function generateShades(background, foreground) { // How much darkness you need to add to #fff to get the COLORS.gray[n] color const SHADES = { 100: 0.06, 200: 0.121, 300: 0.132, 400: 0.2, 600: 0.42, 700: 0.543, 800: 0.821 }; // Darkness of COLORS.gray[ 900 ], relative to #fff const limit = 0.884; const direction = w(background).isDark() ? 'lighten' : 'darken'; // Lightness delta between the background and foreground colors const range = Math.abs(w(background).toHsl().l - w(foreground).toHsl().l) / 100; const result = {}; Object.entries(SHADES).forEach(([key, value]) => { result[parseInt(key)] = w(background)[direction](value / limit * range).toHex(); }); return result; } ;// ./node_modules/@wordpress/components/build-module/theme/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * `Theme` allows defining theme variables for components in the `@wordpress/components` package. * * Multiple `Theme` components can be nested in order to override specific theme variables. * * * ```jsx * const Example = () => { * return ( * <Theme accent="red"> * <Button variant="primary">I'm red</Button> * <Theme accent="blue"> * <Button variant="primary">I'm blue</Button> * </Theme> * </Theme> * ); * }; * ``` */ function Theme({ accent, background, className, ...props }) { const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(...colorVariables(generateThemeVariables({ accent, background })), className), [accent, background, className, cx]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(theme_styles_Wrapper, { className: classes, ...props }); } /* harmony default export */ const theme = (Theme); ;// ./node_modules/@wordpress/components/build-module/tabs/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const TabsContext = (0,external_wp_element_namespaceObject.createContext)(undefined); const useTabsContext = () => (0,external_wp_element_namespaceObject.useContext)(TabsContext); ;// ./node_modules/@wordpress/components/build-module/tabs/styles.js function tabs_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const StyledTabList = /*#__PURE__*/emotion_styled_base_browser_esm(TabList, true ? { target: "enfox0g4" } : 0)("display:flex;align-items:stretch;overflow-x:auto;&[aria-orientation='vertical']{flex-direction:column;}:where( [aria-orientation='horizontal'] ){width:fit-content;}--direction-factor:1;--direction-start:left;--direction-end:right;--selected-start:var( --selected-left, 0 );&:dir( rtl ){--direction-factor:-1;--direction-start:right;--direction-end:left;--selected-start:var( --selected-right, 0 );}@media not ( prefers-reduced-motion ){&[data-indicator-animated]::before{transition-property:transform,border-radius,border-block;transition-duration:0.2s;transition-timing-function:ease-out;}}position:relative;&::before{content:'';position:absolute;pointer-events:none;transform-origin:var( --direction-start ) top;outline:2px solid transparent;outline-offset:-1px;}--antialiasing-factor:100;&[aria-orientation='horizontal']{--fade-width:4rem;--fade-gradient-base:transparent 0%,black var( --fade-width );--fade-gradient-composed:var( --fade-gradient-base ),black 60%,transparent 50%;&.is-overflowing-first{mask-image:linear-gradient(\n\t\t\t\tto var( --direction-end ),\n\t\t\t\tvar( --fade-gradient-base )\n\t\t\t);}&.is-overflowing-last{mask-image:linear-gradient(\n\t\t\t\tto var( --direction-start ),\n\t\t\t\tvar( --fade-gradient-base )\n\t\t\t);}&.is-overflowing-first.is-overflowing-last{mask-image:linear-gradient(\n\t\t\t\t\tto right,\n\t\t\t\t\tvar( --fade-gradient-composed )\n\t\t\t\t),linear-gradient( to left, var( --fade-gradient-composed ) );}&::before{bottom:0;height:0;width:calc( var( --antialiasing-factor ) * 1px );transform:translateX(\n\t\t\t\t\tcalc(\n\t\t\t\t\t\tvar( --selected-start ) * var( --direction-factor ) *\n\t\t\t\t\t\t\t1px\n\t\t\t\t\t)\n\t\t\t\t) scaleX(\n\t\t\t\t\tcalc(\n\t\t\t\t\t\tvar( --selected-width, 0 ) /\n\t\t\t\t\t\t\tvar( --antialiasing-factor )\n\t\t\t\t\t)\n\t\t\t\t);border-bottom:var( --wp-admin-border-width-focus ) solid ", COLORS.theme.accent, ";}}&[aria-orientation='vertical']{&::before{border-radius:", config_values.radiusSmall, "/calc(\n\t\t\t\t\t", config_values.radiusSmall, " /\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tvar( --selected-height, 0 ) /\n\t\t\t\t\t\t\t\tvar( --antialiasing-factor )\n\t\t\t\t\t\t)\n\t\t\t\t);top:0;left:0;width:100%;height:calc( var( --antialiasing-factor ) * 1px );transform:translateY( calc( var( --selected-top, 0 ) * 1px ) ) scaleY(\n\t\t\t\t\tcalc(\n\t\t\t\t\t\tvar( --selected-height, 0 ) /\n\t\t\t\t\t\t\tvar( --antialiasing-factor )\n\t\t\t\t\t)\n\t\t\t\t);background-color:color-mix(\n\t\t\t\tin srgb,\n\t\t\t\t", COLORS.theme.accent, ",\n\t\t\t\ttransparent 96%\n\t\t\t);}&[data-select-on-move='true']:has(\n\t\t\t\t:is( :focus-visible, [data-focus-visible] )\n\t\t\t)::before{box-sizing:border-box;border:var( --wp-admin-border-width-focus ) solid ", COLORS.theme.accent, ";border-block-width:calc(\n\t\t\t\tvar( --wp-admin-border-width-focus, 1px ) /\n\t\t\t\t\t(\n\t\t\t\t\t\tvar( --selected-height, 0 ) /\n\t\t\t\t\t\t\tvar( --antialiasing-factor )\n\t\t\t\t\t)\n\t\t\t);}}" + ( true ? "" : 0)); const styles_Tab = /*#__PURE__*/emotion_styled_base_browser_esm(Tab, true ? { target: "enfox0g3" } : 0)("&{border-radius:0;background:transparent;border:none;box-shadow:none;flex:1 0 auto;white-space:nowrap;display:flex;align-items:center;cursor:pointer;line-height:1.2;font-weight:400;color:", COLORS.theme.foreground, ";position:relative;&[aria-disabled='true']{cursor:default;color:", COLORS.ui.textDisabled, ";}&:not( [aria-disabled='true'] ):is( :hover, [data-focus-visible] ){color:", COLORS.theme.accent, ";}&:focus:not( :disabled ){box-shadow:none;outline:none;}&::after{position:absolute;pointer-events:none;outline:var( --wp-admin-border-width-focus ) solid ", COLORS.theme.accent, ";border-radius:", config_values.radiusSmall, ";opacity:0;@media not ( prefers-reduced-motion ){transition:opacity 0.1s linear;}}&[data-focus-visible]::after{opacity:1;}}[aria-orientation='horizontal'] &{padding-inline:", space(4), ";height:", space(12), ";scroll-margin:24px;&::after{content:'';inset:", space(3), ";}}[aria-orientation='vertical'] &{padding:", space(2), " ", space(3), ";min-height:", space(10), ";&[aria-selected='true']{color:", COLORS.theme.accent, ";fill:currentColor;}}[aria-orientation='vertical'][data-select-on-move='false'] &::after{content:'';inset:var( --wp-admin-border-width-focus );}" + ( true ? "" : 0)); const TabChildren = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? { target: "enfox0g2" } : 0)( true ? { name: "9at4z3", styles: "flex-grow:1;display:flex;align-items:center;[aria-orientation='horizontal'] &{justify-content:center;}[aria-orientation='vertical'] &{justify-content:start;}" } : 0); const TabChevron = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_icon, true ? { target: "enfox0g1" } : 0)("flex-shrink:0;margin-inline-end:", space(-1), ";[aria-orientation='horizontal'] &{display:none;}opacity:0;[role='tab']:is( [aria-selected='true'], [data-focus-visible], :hover ) &{opacity:1;}@media not ( prefers-reduced-motion ){[data-select-on-move='true'] [role='tab']:is( [aria-selected='true'], ) &{transition:opacity 0.15s 0.15s linear;}}&:dir( rtl ){rotate:180deg;}" + ( true ? "" : 0)); const styles_TabPanel = /*#__PURE__*/emotion_styled_base_browser_esm(TabPanel, true ? { target: "enfox0g0" } : 0)("&:focus{box-shadow:none;outline:none;}&[data-focus-visible]{box-shadow:0 0 0 var( --wp-admin-border-width-focus ) ", COLORS.theme.accent, ";outline:2px solid transparent;outline-offset:0;}" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/tabs/tab.js /** * WordPress dependencies */ /** * Internal dependencies */ const tab_Tab = (0,external_wp_element_namespaceObject.forwardRef)(function Tab({ children, tabId, disabled, render, ...otherProps }, ref) { var _useTabsContext; const { store, instanceId } = (_useTabsContext = useTabsContext()) !== null && _useTabsContext !== void 0 ? _useTabsContext : {}; if (!store) { true ? external_wp_warning_default()('`Tabs.Tab` must be wrapped in a `Tabs` component.') : 0; return null; } const instancedTabId = `${instanceId}-${tabId}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(styles_Tab, { ref: ref, store: store, id: instancedTabId, disabled: disabled, render: render, ...otherProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TabChildren, { children: children }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TabChevron, { icon: chevron_right })] }); }); ;// ./node_modules/@wordpress/components/build-module/tabs/use-track-overflow.js /* eslint-disable jsdoc/require-param */ /** * WordPress dependencies */ /** * Tracks if an element contains overflow and on which end by tracking the * first and last child elements with an `IntersectionObserver` in relation * to the parent element. * * Note that the returned value will only indicate whether the first or last * element is currently "going out of bounds" but not whether it happens on * the X or Y axis. */ function useTrackOverflow(parent, children) { const [first, setFirst] = (0,external_wp_element_namespaceObject.useState)(false); const [last, setLast] = (0,external_wp_element_namespaceObject.useState)(false); const [observer, setObserver] = (0,external_wp_element_namespaceObject.useState)(); const callback = (0,external_wp_compose_namespaceObject.useEvent)(entries => { for (const entry of entries) { if (entry.target === children.first) { setFirst(!entry.isIntersecting); } if (entry.target === children.last) { setLast(!entry.isIntersecting); } } }); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!parent || !window.IntersectionObserver) { return; } const newObserver = new IntersectionObserver(callback, { root: parent, threshold: 0.9 }); setObserver(newObserver); return () => newObserver.disconnect(); }, [callback, parent]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!observer) { return; } if (children.first) { observer.observe(children.first); } if (children.last) { observer.observe(children.last); } return () => { if (children.first) { observer.unobserve(children.first); } if (children.last) { observer.unobserve(children.last); } }; }, [children.first, children.last, observer]); return { first, last }; } /* eslint-enable jsdoc/require-param */ ;// ./node_modules/@wordpress/components/build-module/tabs/tablist.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_SCROLL_MARGIN = 24; /** * Scrolls a given parent element so that a given rect is visible. * * The scroll is updated initially and whenever the rect changes. */ function useScrollRectIntoView(parent, rect, { margin = DEFAULT_SCROLL_MARGIN } = {}) { (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!parent || !rect) { return; } const { scrollLeft: parentScroll } = parent; const parentWidth = parent.getBoundingClientRect().width; const { left: childLeft, width: childWidth } = rect; const parentRightEdge = parentScroll + parentWidth; const childRightEdge = childLeft + childWidth; const rightOverflow = childRightEdge + margin - parentRightEdge; const leftOverflow = parentScroll - (childLeft - margin); let scrollLeft = null; if (leftOverflow > 0) { scrollLeft = parentScroll - leftOverflow; } else if (rightOverflow > 0) { scrollLeft = parentScroll + rightOverflow; } if (scrollLeft !== null) { /** * The optional chaining is used here to avoid unit test failures. * It can be removed when JSDOM supports `Element` scroll methods. * See: https://github.com/WordPress/gutenberg/pull/66498#issuecomment-2441146096 */ parent.scroll?.({ left: scrollLeft }); } }, [margin, parent, rect]); } const tablist_TabList = (0,external_wp_element_namespaceObject.forwardRef)(function TabList({ children, ...otherProps }, ref) { var _useTabsContext; const { store } = (_useTabsContext = useTabsContext()) !== null && _useTabsContext !== void 0 ? _useTabsContext : {}; const selectedId = useStoreState(store, 'selectedId'); const activeId = useStoreState(store, 'activeId'); const selectOnMove = useStoreState(store, 'selectOnMove'); const items = useStoreState(store, 'items'); const [parent, setParent] = (0,external_wp_element_namespaceObject.useState)(); const refs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setParent]); const selectedItem = store?.item(selectedId); const renderedItems = useStoreState(store, 'renderedItems'); const selectedItemIndex = renderedItems && selectedItem ? renderedItems.indexOf(selectedItem) : -1; // Use selectedItemIndex as a dependency to force recalculation when the // selected item index changes (elements are swapped / added / removed). const selectedRect = useTrackElementOffsetRect(selectedItem?.element, [selectedItemIndex]); // Track overflow to show scroll hints. const overflow = useTrackOverflow(parent, { first: items?.at(0)?.element, last: items?.at(-1)?.element }); // Size, position, and animate the indicator. useAnimatedOffsetRect(parent, selectedRect, { prefix: 'selected', dataAttribute: 'indicator-animated', transitionEndFilter: event => event.pseudoElement === '::before', roundRect: true }); // Make sure selected tab is scrolled into view. useScrollRectIntoView(parent, selectedRect); const onBlur = () => { if (!selectOnMove) { return; } // When automatic tab selection is on, make sure that the active tab is up // to date with the selected tab when leaving the tablist. This makes sure // that the selected tab will receive keyboard focus when tabbing back into // the tablist. if (selectedId !== activeId) { store?.setActiveId(selectedId); } }; if (!store) { true ? external_wp_warning_default()('`Tabs.TabList` must be wrapped in a `Tabs` component.') : 0; return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledTabList, { ref: refs, store: store, render: props => { var _props$tabIndex; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, // Fallback to -1 to prevent browsers from making the tablist // tabbable when it is a scrolling container. tabIndex: (_props$tabIndex = props.tabIndex) !== null && _props$tabIndex !== void 0 ? _props$tabIndex : -1 }); }, onBlur: onBlur, "data-select-on-move": selectOnMove ? 'true' : 'false', ...otherProps, className: dist_clsx(overflow.first && 'is-overflowing-first', overflow.last && 'is-overflowing-last', otherProps.className), children: children }); }); ;// ./node_modules/@wordpress/components/build-module/tabs/tabpanel.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const tabpanel_TabPanel = (0,external_wp_element_namespaceObject.forwardRef)(function TabPanel({ children, tabId, focusable = true, ...otherProps }, ref) { const context = useTabsContext(); const selectedId = useStoreState(context?.store, 'selectedId'); if (!context) { true ? external_wp_warning_default()('`Tabs.TabPanel` must be wrapped in a `Tabs` component.') : 0; return null; } const { store, instanceId } = context; const instancedTabId = `${instanceId}-${tabId}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_TabPanel, { ref: ref, store: store // For TabPanel, the id passed here is the id attribute of the DOM // element. // `tabId` is the id of the tab that controls this panel. , id: `${instancedTabId}-view`, tabId: instancedTabId, focusable: focusable, ...otherProps, children: selectedId === instancedTabId && children }); }); ;// ./node_modules/@wordpress/components/build-module/tabs/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function externalToInternalTabId(externalId, instanceId) { return externalId && `${instanceId}-${externalId}`; } function internalToExternalTabId(internalId, instanceId) { return typeof internalId === 'string' ? internalId.replace(`${instanceId}-`, '') : internalId; } /** * Tabs is a collection of React components that combine to render * an [ARIA-compliant tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/). * * Tabs organizes content across different screens, data sets, and interactions. * It has two sections: a list of tabs, and the view to show when a tab is chosen. * * `Tabs` itself is a wrapper component and context provider. * It is responsible for managing the state of the tabs, and rendering one instance of the `Tabs.TabList` component and one or more instances of the `Tab.TabPanel` component. */ const Tabs = Object.assign(function Tabs({ selectOnMove = true, defaultTabId, orientation = 'horizontal', onSelect, children, selectedTabId, activeTabId, defaultActiveTabId, onActiveTabIdChange }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Tabs, 'tabs'); const store = useTabStore({ selectOnMove, orientation, defaultSelectedId: externalToInternalTabId(defaultTabId, instanceId), setSelectedId: newSelectedId => { onSelect?.(internalToExternalTabId(newSelectedId, instanceId)); }, selectedId: externalToInternalTabId(selectedTabId, instanceId), defaultActiveId: externalToInternalTabId(defaultActiveTabId, instanceId), setActiveId: newActiveId => { onActiveTabIdChange?.(internalToExternalTabId(newActiveId, instanceId)); }, activeId: externalToInternalTabId(activeTabId, instanceId), rtl: (0,external_wp_i18n_namespaceObject.isRTL)() }); const { items, activeId } = useStoreState(store); const { setActiveId } = store; (0,external_wp_element_namespaceObject.useEffect)(() => { requestAnimationFrame(() => { const focusedElement = items?.[0]?.element?.ownerDocument.activeElement; if (!focusedElement || !items.some(item => focusedElement === item.element)) { return; // Return early if no tabs are focused. } // If, after ariakit re-computes the active tab, that tab doesn't match // the currently focused tab, then we force an update to ariakit to avoid // any mismatches, especially when navigating to previous/next tab with // arrow keys. if (activeId !== focusedElement.id) { setActiveId(focusedElement.id); } }); }, [activeId, items, setActiveId]); const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ store, instanceId }), [store, instanceId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TabsContext.Provider, { value: contextValue, children: children }); }, { /** * Renders a single tab. * * The currently active tab receives default styling that can be * overridden with CSS targeting `[aria-selected="true"]`. */ Tab: Object.assign(tab_Tab, { displayName: 'Tabs.Tab' }), /** * A wrapper component for the `Tab` components. * * It is responsible for rendering the list of tabs. */ TabList: Object.assign(tablist_TabList, { displayName: 'Tabs.TabList' }), /** * Renders the content to display for a single tab once that tab is selected. */ TabPanel: Object.assign(tabpanel_TabPanel, { displayName: 'Tabs.TabPanel' }), Context: Object.assign(TabsContext, { displayName: 'Tabs.Context' }) }); ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/components/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/components'); ;// ./node_modules/@wordpress/icons/build-module/library/info.js /** * WordPress dependencies */ const info = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" }) }); /* harmony default export */ const library_info = (info); ;// ./node_modules/@wordpress/icons/build-module/library/published.js /** * WordPress dependencies */ const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" }) }); /* harmony default export */ const library_published = (published); ;// ./node_modules/@wordpress/icons/build-module/library/caution.js /** * WordPress dependencies */ const caution = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" }) }); /* harmony default export */ const library_caution = (caution); ;// ./node_modules/@wordpress/icons/build-module/library/error.js /** * WordPress dependencies */ const error = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" }) }); /* harmony default export */ const library_error = (error); ;// ./node_modules/@wordpress/components/build-module/badge/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns an icon based on the badge context. * * @return The corresponding icon for the provided context. */ function contextBasedIcon(intent = 'default') { switch (intent) { case 'info': return library_info; case 'success': return library_published; case 'warning': return library_caution; case 'error': return library_error; default: return null; } } function Badge({ className, intent = 'default', children, ...props }) { const icon = contextBasedIcon(intent); const hasIcon = !!icon; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: dist_clsx('components-badge', className, { [`is-${intent}`]: intent, 'has-icon': hasIcon }), ...props, children: [hasIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon, size: 16, fill: "currentColor", className: "components-badge__icon" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-badge__content", children: children })] }); } /* harmony default export */ const badge = (Badge); ;// ./node_modules/@wordpress/components/build-module/private-apis.js /** * Internal dependencies */ const privateApis = {}; lock(privateApis, { __experimentalPopoverLegacyPositionToPlacement: positionToPlacement, ComponentsContext: ComponentsContext, Tabs: Tabs, Theme: theme, Menu: menu_Menu, kebabCase: kebabCase, withIgnoreIMEEvents: withIgnoreIMEEvents, Badge: badge }); ;// ./node_modules/@wordpress/components/build-module/index.js // Primitives. // Components. // Higher-Order Components. // Private APIs. })(); (window.wp = window.wp || {}).components = __webpack_exports__; /******/ })() ; dist/plugins.js 0000644 00000043545 15125140777 0007552 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { PluginArea: () => (/* reexport */ plugin_area), getPlugin: () => (/* reexport */ getPlugin), getPlugins: () => (/* reexport */ getPlugins), registerPlugin: () => (/* reexport */ registerPlugin), unregisterPlugin: () => (/* reexport */ unregisterPlugin), usePluginContext: () => (/* reexport */ usePluginContext), withPluginContext: () => (/* reexport */ withPluginContext) }); ;// ./node_modules/memize/dist/index.js /** * Memize options object. * * @typedef MemizeOptions * * @property {number} [maxSize] Maximum size of the cache. */ /** * Internal cache entry. * * @typedef MemizeCacheNode * * @property {?MemizeCacheNode|undefined} [prev] Previous node. * @property {?MemizeCacheNode|undefined} [next] Next node. * @property {Array<*>} args Function arguments for cache * entry. * @property {*} val Function result. */ /** * Properties of the enhanced function for controlling cache. * * @typedef MemizeMemoizedFunction * * @property {()=>void} clear Clear the cache. */ /** * Accepts a function to be memoized, and returns a new memoized function, with * optional options. * * @template {(...args: any[]) => any} F * * @param {F} fn Function to memoize. * @param {MemizeOptions} [options] Options object. * * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. */ function memize(fn, options) { var size = 0; /** @type {?MemizeCacheNode|undefined} */ var head; /** @type {?MemizeCacheNode|undefined} */ var tail; options = options || {}; function memoized(/* ...args */) { var node = head, len = arguments.length, args, i; searchCache: while (node) { // Perform a shallow equality test to confirm that whether the node // under test is a candidate for the arguments passed. Two arrays // are shallowly equal if their length matches and each entry is // strictly equal between the two sets. Avoid abstracting to a // function which could incur an arguments leaking deoptimization. // Check whether node arguments match arguments length if (node.args.length !== arguments.length) { node = node.next; continue; } // Check whether node arguments match arguments values for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } // At this point we can assume we've found a match // Surface matched node to head if not already if (node !== head) { // As tail, shift to previous. Must only shift if not also // head, since if both head and tail, there is no previous. if (node === tail) { tail = node.prev; } // Adjust siblings to point to each other. If node was tail, // this also handles new tail's empty `next` assignment. /** @type {MemizeCacheNode} */ (node.prev).next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; /** @type {MemizeCacheNode} */ (head).prev = node; head = node; } // Return immediately return node.val; } // No cached value found. Continue to insertion phase: // Create a copy of arguments (avoid leaking deoptimization) args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args: args, // Generate the result from original function val: fn.apply(null, args), }; // Don't need to check whether node is already head, since it would // have been returned above already if it was // Shift existing head down list if (head) { head.prev = node; node.next = head; } else { // If no head, follows that there's no tail (at initial or reset) tail = node; } // Trim tail if we're reached max size and are pending cache insertion if (size === /** @type {MemizeOptions} */ (options).maxSize) { tail = /** @type {MemizeCacheNode} */ (tail).prev; /** @type {MemizeCacheNode} */ (tail).next = null; } else { size++; } head = node; return node.val; } memoized.clear = function () { head = null; tail = null; size = 0; }; // Ignore reason: There's not a clear solution to create an intersection of // the function with additional properties, where the goal is to retain the // function signature of the incoming argument and add control properties // on the return value. // @ts-ignore return memoized; } ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/plugins/build-module/components/plugin-context/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const Context = (0,external_wp_element_namespaceObject.createContext)({ name: null, icon: null }); const PluginContextProvider = Context.Provider; /** * A hook that returns the plugin context. * * @return {PluginContext} Plugin context */ function usePluginContext() { return (0,external_wp_element_namespaceObject.useContext)(Context); } /** * A Higher Order Component used to inject Plugin context to the * wrapped component. * * @deprecated 6.8.0 Use `usePluginContext` hook instead. * * @param mapContextToProps Function called on every context change, * expected to return object of props to * merge with the component's own props. * * @return {Component} Enhanced component with injected context as props. */ const withPluginContext = mapContextToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => { external_wp_deprecated_default()('wp.plugins.withPluginContext', { since: '6.8.0', alternative: 'wp.plugins.usePluginContext' }); return props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Context.Consumer, { children: context => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { ...props, ...mapContextToProps(context, props) }) }); }, 'withPluginContext'); ;// ./node_modules/@wordpress/plugins/build-module/components/plugin-error-boundary/index.js /** * WordPress dependencies */ class PluginErrorBoundary extends external_wp_element_namespaceObject.Component { /** * @param {Object} props */ constructor(props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError() { return { hasError: true }; } /** * @param {Error} error Error object passed by React. */ componentDidCatch(error) { const { name, onError } = this.props; if (onError) { onError(name, error); } } render() { if (!this.state.hasError) { return this.props.children; } return null; } } ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/plugins.js /** * WordPress dependencies */ const plugins = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" }) }); /* harmony default export */ const library_plugins = (plugins); ;// ./node_modules/@wordpress/plugins/build-module/api/index.js /* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */ /** * External dependencies */ /** * WordPress dependencies */ /** * Defined behavior of a plugin type. */ /** * Plugin definitions keyed by plugin name. */ const api_plugins = {}; /** * Registers a plugin to the editor. * * @param name A string identifying the plugin. Must be * unique across all registered plugins. * @param settings The settings for this plugin. * * @example * ```js * // Using ES5 syntax * var el = React.createElement; * var Fragment = wp.element.Fragment; * var PluginSidebar = wp.editor.PluginSidebar; * var PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem; * var registerPlugin = wp.plugins.registerPlugin; * var moreIcon = React.createElement( 'svg' ); //... svg element. * * function Component() { * return el( * Fragment, * {}, * el( * PluginSidebarMoreMenuItem, * { * target: 'sidebar-name', * }, * 'My Sidebar' * ), * el( * PluginSidebar, * { * name: 'sidebar-name', * title: 'My Sidebar', * }, * 'Content of the sidebar' * ) * ); * } * registerPlugin( 'plugin-name', { * icon: moreIcon, * render: Component, * scope: 'my-page', * } ); * ``` * * @example * ```js * // Using ESNext syntax * import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/editor'; * import { registerPlugin } from '@wordpress/plugins'; * import { more } from '@wordpress/icons'; * * const Component = () => ( * <> * <PluginSidebarMoreMenuItem * target="sidebar-name" * > * My Sidebar * </PluginSidebarMoreMenuItem> * <PluginSidebar * name="sidebar-name" * title="My Sidebar" * > * Content of the sidebar * </PluginSidebar> * </> * ); * * registerPlugin( 'plugin-name', { * icon: more, * render: Component, * scope: 'my-page', * } ); * ``` * * @return The final plugin settings object. */ function registerPlugin(name, settings) { if (typeof settings !== 'object') { console.error('No settings object provided!'); return null; } if (typeof name !== 'string') { console.error('Plugin name must be string.'); return null; } if (!/^[a-z][a-z0-9-]*$/.test(name)) { console.error('Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".'); return null; } if (api_plugins[name]) { console.error(`Plugin "${name}" is already registered.`); } settings = (0,external_wp_hooks_namespaceObject.applyFilters)('plugins.registerPlugin', settings, name); const { render, scope } = settings; if (typeof render !== 'function') { console.error('The "render" property must be specified and must be a valid function.'); return null; } if (scope) { if (typeof scope !== 'string') { console.error('Plugin scope must be string.'); return null; } if (!/^[a-z][a-z0-9-]*$/.test(scope)) { console.error('Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".'); return null; } } api_plugins[name] = { name, icon: library_plugins, ...settings }; (0,external_wp_hooks_namespaceObject.doAction)('plugins.pluginRegistered', settings, name); return settings; } /** * Unregisters a plugin by name. * * @param name Plugin name. * * @example * ```js * // Using ES5 syntax * var unregisterPlugin = wp.plugins.unregisterPlugin; * * unregisterPlugin( 'plugin-name' ); * ``` * * @example * ```js * // Using ESNext syntax * import { unregisterPlugin } from '@wordpress/plugins'; * * unregisterPlugin( 'plugin-name' ); * ``` * * @return The previous plugin settings object, if it has been * successfully unregistered; otherwise `undefined`. */ function unregisterPlugin(name) { if (!api_plugins[name]) { console.error('Plugin "' + name + '" is not registered.'); return; } const oldPlugin = api_plugins[name]; delete api_plugins[name]; (0,external_wp_hooks_namespaceObject.doAction)('plugins.pluginUnregistered', oldPlugin, name); return oldPlugin; } /** * Returns a registered plugin settings. * * @param name Plugin name. * * @return Plugin setting. */ function getPlugin(name) { return api_plugins[name]; } /** * Returns all registered plugins without a scope or for a given scope. * * @param scope The scope to be used when rendering inside * a plugin area. No scope by default. * * @return The list of plugins without a scope or for a given scope. */ function getPlugins(scope) { return Object.values(api_plugins).filter(plugin => plugin.scope === scope); } ;// ./node_modules/@wordpress/plugins/build-module/components/plugin-area/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const getPluginContext = memize((icon, name) => ({ icon, name })); /** * A component that renders all plugin fills in a hidden div. * * @param props * @param props.scope * @param props.onError * @example * ```js * // Using ES5 syntax * var el = React.createElement; * var PluginArea = wp.plugins.PluginArea; * * function Layout() { * return el( * 'div', * { scope: 'my-page' }, * 'Content of the page', * PluginArea * ); * } * ``` * * @example * ```js * // Using ESNext syntax * import { PluginArea } from '@wordpress/plugins'; * * const Layout = () => ( * <div> * Content of the page * <PluginArea scope="my-page" /> * </div> * ); * ``` * * @return {Component} The component to be rendered. */ function PluginArea({ scope, onError }) { const store = (0,external_wp_element_namespaceObject.useMemo)(() => { let lastValue = []; return { subscribe(listener) { (0,external_wp_hooks_namespaceObject.addAction)('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered', listener); (0,external_wp_hooks_namespaceObject.addAction)('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered', listener); return () => { (0,external_wp_hooks_namespaceObject.removeAction)('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered'); (0,external_wp_hooks_namespaceObject.removeAction)('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered'); }; }, getValue() { const nextValue = getPlugins(scope); if (!external_wp_isShallowEqual_default()(lastValue, nextValue)) { lastValue = nextValue; } return lastValue; } }; }, [scope]); const plugins = (0,external_wp_element_namespaceObject.useSyncExternalStore)(store.subscribe, store.getValue, store.getValue); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { display: 'none' }, children: plugins.map(({ icon, name, render: Plugin }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginContextProvider, { value: getPluginContext(icon, name), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginErrorBoundary, { name: name, onError: onError, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Plugin, {}) }) }, name)) }); } /* harmony default export */ const plugin_area = (PluginArea); ;// ./node_modules/@wordpress/plugins/build-module/components/index.js ;// ./node_modules/@wordpress/plugins/build-module/index.js (window.wp = window.wp || {}).plugins = __webpack_exports__; /******/ })() ; dist/edit-site.js 0000644 00006204366 15125140777 0007766 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 83: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; /** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var React = __webpack_require__(1609); function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React.useState, useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue; function useSyncExternalStore$2(subscribe, getSnapshot) { var value = getSnapshot(), _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1]; useLayoutEffect( function () { inst.value = value; inst.getSnapshot = getSnapshot; checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); }, [subscribe, value, getSnapshot] ); useEffect( function () { checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); return subscribe(function () { checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); }); }, [subscribe] ); useDebugValue(value); return value; } function checkIfSnapshotChanged(inst) { var latestGetSnapshot = inst.getSnapshot; inst = inst.value; try { var nextValue = latestGetSnapshot(); return !objectIs(inst, nextValue); } catch (error) { return !0; } } function useSyncExternalStore$1(subscribe, getSnapshot) { return getSnapshot(); } var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim; /***/ }), /***/ 422: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (true) { module.exports = __webpack_require__(83); } else {} /***/ }), /***/ 1609: /***/ ((module) => { "use strict"; module.exports = window["React"]; /***/ }), /***/ 4660: /***/ ((module) => { /** * Credits: * * lib-font * https://github.com/Pomax/lib-font * https://github.com/Pomax/lib-font/blob/master/lib/inflate.js * * The MIT License (MIT) * * Copyright (c) 2020 pomax@nihongoresources.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* eslint eslint-comments/no-unlimited-disable: 0 */ /* eslint-disable */ /* pako 1.0.10 nodeca/pako */(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ 'use strict'; var TYPED_OK = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Int32Array !== 'undefined'); function _has(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } exports.assign = function (obj /*from1, from2, from3, ...*/) { var sources = Array.prototype.slice.call(arguments, 1); while (sources.length) { var source = sources.shift(); if (!source) { continue; } if (typeof source !== 'object') { throw new TypeError(source + 'must be non-object'); } for (var p in source) { if (_has(source, p)) { obj[p] = source[p]; } } } return obj; }; // reduce buffer size, avoiding mem copy exports.shrinkBuf = function (buf, size) { if (buf.length === size) { return buf; } if (buf.subarray) { return buf.subarray(0, size); } buf.length = size; return buf; }; var fnTyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { if (src.subarray && dest.subarray) { dest.set(src.subarray(src_offs, src_offs + len), dest_offs); return; } // Fallback to ordinary array for (var i = 0; i < len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function (chunks) { var i, l, len, pos, chunk, result; // calculate data length len = 0; for (i = 0, l = chunks.length; i < l; i++) { len += chunks[i].length; } // join chunks result = new Uint8Array(len); pos = 0; for (i = 0, l = chunks.length; i < l; i++) { chunk = chunks[i]; result.set(chunk, pos); pos += chunk.length; } return result; } }; var fnUntyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { for (var i = 0; i < len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function (chunks) { return [].concat.apply([], chunks); } }; // Enable/Disable typed arrays use, for testing // exports.setTyped = function (on) { if (on) { exports.Buf8 = Uint8Array; exports.Buf16 = Uint16Array; exports.Buf32 = Int32Array; exports.assign(exports, fnTyped); } else { exports.Buf8 = Array; exports.Buf16 = Array; exports.Buf32 = Array; exports.assign(exports, fnUntyped); } }; exports.setTyped(TYPED_OK); },{}],2:[function(require,module,exports){ // String encode/decode helpers 'use strict'; var utils = require('./common'); // Quick check if we can use fast array to bin string conversion // // - apply(Array) can fail on Android 2.2 // - apply(Uint8Array) can fail on iOS 5.1 Safari // var STR_APPLY_OK = true; var STR_APPLY_UIA_OK = true; try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } // Table with utf8 lengths (calculated by first byte of sequence) // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, // because max possible codepoint is 0x10ffff var _utf8len = new utils.Buf8(256); for (var q = 0; q < 256; q++) { _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); } _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start // convert string to array (typed, when possible) exports.string2buf = function (str) { var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; // count binary size for (m_pos = 0; m_pos < str_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { c2 = str.charCodeAt(m_pos + 1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; } // allocate buffer buf = new utils.Buf8(buf_len); // convert for (i = 0, m_pos = 0; i < buf_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { c2 = str.charCodeAt(m_pos + 1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } if (c < 0x80) { /* one byte */ buf[i++] = c; } else if (c < 0x800) { /* two bytes */ buf[i++] = 0xC0 | (c >>> 6); buf[i++] = 0x80 | (c & 0x3f); } else if (c < 0x10000) { /* three bytes */ buf[i++] = 0xE0 | (c >>> 12); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } else { /* four bytes */ buf[i++] = 0xf0 | (c >>> 18); buf[i++] = 0x80 | (c >>> 12 & 0x3f); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } } return buf; }; // Helper (used in 2 places) function buf2binstring(buf, len) { // On Chrome, the arguments in a function call that are allowed is `65534`. // If the length of the buffer is smaller than that, we can use this optimization, // otherwise we will take a slower path. if (len < 65534) { if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); } } var result = ''; for (var i = 0; i < len; i++) { result += String.fromCharCode(buf[i]); } return result; } // Convert byte array to binary string exports.buf2binstring = function (buf) { return buf2binstring(buf, buf.length); }; // Convert binary string (typed, when possible) exports.binstring2buf = function (str) { var buf = new utils.Buf8(str.length); for (var i = 0, len = buf.length; i < len; i++) { buf[i] = str.charCodeAt(i); } return buf; }; // convert array to string exports.buf2string = function (buf, max) { var i, out, c, c_len; var len = max || buf.length; // Reserve max possible length (2 words per char) // NB: by unknown reasons, Array is significantly faster for // String.fromCharCode.apply than Uint16Array. var utf16buf = new Array(len * 2); for (out = 0, i = 0; i < len;) { c = buf[i++]; // quick process ascii if (c < 0x80) { utf16buf[out++] = c; continue; } c_len = _utf8len[c]; // skip 5 & 6 byte codes if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } // apply mask on first byte c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; // join the rest while (c_len > 1 && i < len) { c = (c << 6) | (buf[i++] & 0x3f); c_len--; } // terminated by end of string? if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } if (c < 0x10000) { utf16buf[out++] = c; } else { c -= 0x10000; utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); utf16buf[out++] = 0xdc00 | (c & 0x3ff); } } return buf2binstring(utf16buf, out); }; // Calculate max possible position in utf8 buffer, // that will not break sequence. If that's not possible // - (very small limits) return max size as is. // // buf[] - utf8 bytes array // max - length limit (mandatory); exports.utf8border = function (buf, max) { var pos; max = max || buf.length; if (max > buf.length) { max = buf.length; } // go back from last position, until start of sequence found pos = max - 1; while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } // Very small and broken sequence, // return max, because we should return something anyway. if (pos < 0) { return max; } // If we came to start of buffer - that means buffer is too small, // return max too. if (pos === 0) { return max; } return (pos + _utf8len[buf[pos]] > max) ? pos : max; }; },{"./common":1}],3:[function(require,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. // It isn't worth it to make additional optimizations as in original. // Small size is preferable. // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. function adler32(adler, buf, len, pos) { var s1 = (adler & 0xffff) |0, s2 = ((adler >>> 16) & 0xffff) |0, n = 0; while (len !== 0) { // Set limit ~ twice less than 5552, to keep // s2 in 31-bits, because we force signed ints. // in other case %= will fail. n = len > 2000 ? 2000 : len; len -= n; do { s1 = (s1 + buf[pos++]) |0; s2 = (s2 + s1) |0; } while (--n); s1 %= 65521; s2 %= 65521; } return (s1 | (s2 << 16)) |0; } module.exports = adler32; },{}],4:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. module.exports = { /* Allowed flush values; see deflate() and inflate() below for details */ Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, //Z_MEM_ERROR: -4, Z_BUF_ERROR: -5, //Z_VERSION_ERROR: -6, /* compression levels */ Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, /* Possible values of the data_type field (though see inflate()) */ Z_BINARY: 0, Z_TEXT: 1, //Z_ASCII: 1, // = Z_TEXT (deprecated) Z_UNKNOWN: 2, /* The deflate compression method */ Z_DEFLATED: 8 //Z_NULL: null // Use -1 or null inline, depending on var type }; },{}],5:[function(require,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. // So write code to minimize size - no pregenerated tables // and array tools dependencies. // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // Use ordinary array, since untyped makes no boost here function makeTable() { var c, table = []; for (var n = 0; n < 256; n++) { c = n; for (var k = 0; k < 8; k++) { c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); } table[n] = c; } return table; } // Create table on load. Just 255 signed longs. Not a problem. var crcTable = makeTable(); function crc32(crc, buf, len, pos) { var t = crcTable, end = pos + len; crc ^= -1; for (var i = pos; i < end; i++) { crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; } return (crc ^ (-1)); // >>> 0; } module.exports = crc32; },{}],6:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. function GZheader() { /* true if compressed data believed to be text */ this.text = 0; /* modification time */ this.time = 0; /* extra flags (not used when writing a gzip file) */ this.xflags = 0; /* operating system */ this.os = 0; /* pointer to extra field or Z_NULL if none */ this.extra = null; /* extra field length (valid if extra != Z_NULL) */ this.extra_len = 0; // Actually, we don't need it in JS, // but leave for few code modifications // // Setup limits is not necessary because in js we should not preallocate memory // for inflate use constant limit in 65536 bytes // /* space at extra (only when reading header) */ // this.extra_max = 0; /* pointer to zero-terminated file name or Z_NULL */ this.name = ''; /* space at name (only when reading header) */ // this.name_max = 0; /* pointer to zero-terminated comment or Z_NULL */ this.comment = ''; /* space at comment (only when reading header) */ // this.comm_max = 0; /* true if there was or will be a header crc */ this.hcrc = 0; /* true when done reading gzip header (not used when writing a gzip file) */ this.done = false; } module.exports = GZheader; },{}],7:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // See state defs from inflate.js var BAD = 30; /* got a data error -- remain here until reset */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time is spent in this routine. Entry assumptions: state.mode === LEN strm.avail_in >= 6 strm.avail_out >= 258 start >= strm.avail_out state.bits < 8 On return, state.mode is one of: LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block BAD -- error in block data Notes: - The maximum input bits used by a length/distance pair is 15 bits for the length code, 5 bits for the length extra, 15 bits for the distance code, and 13 bits for the distance extra. This totals 48 bits, or six bytes. Therefore if strm.avail_in >= 6, then there is enough input to avoid checking for available input while decoding. - The maximum bytes that a single length/distance pair can output is 258 bytes, which is the maximum length that can be coded. inflate_fast() requires strm.avail_out >= 258 for each loop to avoid checking for output space. */ module.exports = function inflate_fast(strm, start) { var state; var _in; /* local strm.input */ var last; /* have enough input while in < last */ var _out; /* local strm.output */ var beg; /* inflate()'s initial strm.output */ var end; /* while out < end, enough space available */ //#ifdef INFLATE_STRICT var dmax; /* maximum distance from zlib header */ //#endif var wsize; /* window size or zero if not using window */ var whave; /* valid bytes in the window */ var wnext; /* window write index */ // Use `s_window` instead `window`, avoid conflict with instrumentation tools var s_window; /* allocated sliding window, if wsize != 0 */ var hold; /* local strm.hold */ var bits; /* local strm.bits */ var lcode; /* local strm.lencode */ var dcode; /* local strm.distcode */ var lmask; /* mask for first level of length codes */ var dmask; /* mask for first level of distance codes */ var here; /* retrieved table entry */ var op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ var len; /* match length, unused bytes */ var dist; /* match distance */ var from; /* where to copy match from */ var from_source; var input, output; // JS specific, because we have no pointers /* copy state to local variables */ state = strm.state; //here = state.here; _in = strm.next_in; input = strm.input; last = _in + (strm.avail_in - 5); _out = strm.next_out; output = strm.output; beg = _out - (start - strm.avail_out); end = _out + (strm.avail_out - 257); //#ifdef INFLATE_STRICT dmax = state.dmax; //#endif wsize = state.wsize; whave = state.whave; wnext = state.wnext; s_window = state.window; hold = state.hold; bits = state.bits; lcode = state.lencode; dcode = state.distcode; lmask = (1 << state.lenbits) - 1; dmask = (1 << state.distbits) - 1; /* decode literals and length/distances until end-of-block or not enough input data or output space */ top: do { if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = lcode[hold & lmask]; dolen: for (;;) { // Goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op === 0) { /* literal */ //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); output[_out++] = here & 0xffff/*here.val*/; } else if (op & 16) { /* length base */ len = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (op) { if (bits < op) { hold += input[_in++] << bits; bits += 8; } len += hold & ((1 << op) - 1); hold >>>= op; bits -= op; } //Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = dcode[hold & dmask]; dodist: for (;;) { // goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op & 16) { /* distance base */ dist = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (bits < op) { hold += input[_in++] << bits; bits += 8; if (bits < op) { hold += input[_in++] << bits; bits += 8; } } dist += hold & ((1 << op) - 1); //#ifdef INFLATE_STRICT if (dist > dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } //#endif hold >>>= op; bits -= op; //Tracevv((stderr, "inflate: distance %u\n", dist)); op = _out - beg; /* max distance in output */ if (dist > op) { /* see if copy from window */ op = dist - op; /* distance back in window */ if (op > whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } // (!) This block is disabled in zlib defaults, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // if (len <= op - whave) { // do { // output[_out++] = 0; // } while (--len); // continue top; // } // len -= op - whave; // do { // output[_out++] = 0; // } while (--op > whave); // if (op === 0) { // from = _out - dist; // do { // output[_out++] = output[from++]; // } while (--len); // continue top; // } //#endif } from = 0; // window index from_source = s_window; if (wnext === 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } else if (wnext < op) { /* wrap around window */ from += wsize + wnext - op; op -= wnext; if (op < len) { /* some from end of window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = 0; if (wnext < len) { /* some from start of window */ op = wnext; len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } } else { /* contiguous in window */ from += wnext - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } while (len > 2) { output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; len -= 3; } if (len) { output[_out++] = from_source[from++]; if (len > 1) { output[_out++] = from_source[from++]; } } } else { from = _out - dist; /* copy direct from output */ do { /* minimum length is three */ output[_out++] = output[from++]; output[_out++] = output[from++]; output[_out++] = output[from++]; len -= 3; } while (len > 2); if (len) { output[_out++] = output[from++]; if (len > 1) { output[_out++] = output[from++]; } } } } else if ((op & 64) === 0) { /* 2nd level distance code */ here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dodist; } else { strm.msg = 'invalid distance code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } else if ((op & 64) === 0) { /* 2nd level length code */ here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dolen; } else if (op & 32) { /* end-of-block */ //Tracevv((stderr, "inflate: end of block\n")); state.mode = TYPE; break top; } else { strm.msg = 'invalid literal/length code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } while (_in < last && _out < end); /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ len = bits >> 3; _in -= len; bits -= len << 3; hold &= (1 << bits) - 1; /* update state and return */ strm.next_in = _in; strm.next_out = _out; strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); state.hold = hold; state.bits = bits; return; }; },{}],8:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. var utils = require('../utils/common'); var adler32 = require('./adler32'); var crc32 = require('./crc32'); var inflate_fast = require('./inffast'); var inflate_table = require('./inftrees'); var CODES = 0; var LENS = 1; var DISTS = 2; /* Public constants ==========================================================*/ /* ===========================================================================*/ /* Allowed flush values; see deflate() and inflate() below for details */ //var Z_NO_FLUSH = 0; //var Z_PARTIAL_FLUSH = 1; //var Z_SYNC_FLUSH = 2; //var Z_FULL_FLUSH = 3; var Z_FINISH = 4; var Z_BLOCK = 5; var Z_TREES = 6; /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ var Z_OK = 0; var Z_STREAM_END = 1; var Z_NEED_DICT = 2; //var Z_ERRNO = -1; var Z_STREAM_ERROR = -2; var Z_DATA_ERROR = -3; var Z_MEM_ERROR = -4; var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6; /* The deflate compression method */ var Z_DEFLATED = 8; /* STATES ====================================================================*/ /* ===========================================================================*/ var HEAD = 1; /* i: waiting for magic header */ var FLAGS = 2; /* i: waiting for method and flags (gzip) */ var TIME = 3; /* i: waiting for modification time (gzip) */ var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ var EXLEN = 5; /* i: waiting for extra length (gzip) */ var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ var NAME = 7; /* i: waiting for end of file name (gzip) */ var COMMENT = 8; /* i: waiting for end of comment (gzip) */ var HCRC = 9; /* i: waiting for header crc (gzip) */ var DICTID = 10; /* i: waiting for dictionary check value */ var DICT = 11; /* waiting for inflateSetDictionary() call */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ var STORED = 14; /* i: waiting for stored size (length and complement) */ var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ var COPY = 16; /* i/o: waiting for input or output to copy stored block */ var TABLE = 17; /* i: waiting for dynamic block table lengths */ var LENLENS = 18; /* i: waiting for code length code lengths */ var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ var LEN_ = 20; /* i: same as LEN below, but only first time in */ var LEN = 21; /* i: waiting for length/lit/eob code */ var LENEXT = 22; /* i: waiting for length extra bits */ var DIST = 23; /* i: waiting for distance code */ var DISTEXT = 24; /* i: waiting for distance extra bits */ var MATCH = 25; /* o: waiting for output space to copy string */ var LIT = 26; /* o: waiting for output space to write literal */ var CHECK = 27; /* i: waiting for 32-bit check value */ var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ var DONE = 29; /* finished check, done -- remain here until reset */ var BAD = 30; /* got a data error -- remain here until reset */ var MEM = 31; /* got an inflate() memory error -- remain here until reset */ var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ /* ===========================================================================*/ var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var MAX_WBITS = 15; /* 32K LZ77 window */ var DEF_WBITS = MAX_WBITS; function zswap32(q) { return (((q >>> 24) & 0xff) + ((q >>> 8) & 0xff00) + ((q & 0xff00) << 8) + ((q & 0xff) << 24)); } function InflateState() { this.mode = 0; /* current inflate mode */ this.last = false; /* true if processing last block */ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ this.havedict = false; /* true if dictionary provided */ this.flags = 0; /* gzip header method and flags (0 if zlib) */ this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ this.check = 0; /* protected copy of check value */ this.total = 0; /* protected copy of output count */ // TODO: may be {} this.head = null; /* where to save gzip header information */ /* sliding window */ this.wbits = 0; /* log base 2 of requested window size */ this.wsize = 0; /* window size or zero if not using window */ this.whave = 0; /* valid bytes in the window */ this.wnext = 0; /* window write index */ this.window = null; /* allocated sliding window, if needed */ /* bit accumulator */ this.hold = 0; /* input bit accumulator */ this.bits = 0; /* number of bits in "in" */ /* for string and stored block copying */ this.length = 0; /* literal or length of data to copy */ this.offset = 0; /* distance back to copy string from */ /* for table and code decoding */ this.extra = 0; /* extra bits needed */ /* fixed and dynamic code tables */ this.lencode = null; /* starting table for length/literal codes */ this.distcode = null; /* starting table for distance codes */ this.lenbits = 0; /* index bits for lencode */ this.distbits = 0; /* index bits for distcode */ /* dynamic table building */ this.ncode = 0; /* number of code length code lengths */ this.nlen = 0; /* number of length code lengths */ this.ndist = 0; /* number of distance code lengths */ this.have = 0; /* number of code lengths in lens[] */ this.next = null; /* next available space in codes[] */ this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ this.work = new utils.Buf16(288); /* work area for code table building */ /* because we don't have pointers in js, we use lencode and distcode directly as buffers so we don't need codes */ //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ this.distdyn = null; /* dynamic table for distance codes (JS specific) */ this.sane = 0; /* if false, allow invalid distance too far */ this.back = 0; /* bits back of last unprocessed length/lit */ this.was = 0; /* initial length of match */ } function inflateResetKeep(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; strm.total_in = strm.total_out = state.total = 0; strm.msg = ''; /*Z_NULL*/ if (state.wrap) { /* to support ill-conceived Java test suite */ strm.adler = state.wrap & 1; } state.mode = HEAD; state.last = 0; state.havedict = 0; state.dmax = 32768; state.head = null/*Z_NULL*/; state.hold = 0; state.bits = 0; //state.lencode = state.distcode = state.next = state.codes; state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); state.sane = 1; state.back = -1; //Tracev((stderr, "inflate: reset\n")); return Z_OK; } function inflateReset(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; state.wsize = 0; state.whave = 0; state.wnext = 0; return inflateResetKeep(strm); } function inflateReset2(strm, windowBits) { var wrap; var state; /* get the state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { wrap = 0; windowBits = -windowBits; } else { wrap = (windowBits >> 4) + 1; if (windowBits < 48) { windowBits &= 15; } } /* set number of window bits, free window if different */ if (windowBits && (windowBits < 8 || windowBits > 15)) { return Z_STREAM_ERROR; } if (state.window !== null && state.wbits !== windowBits) { state.window = null; } /* update state and reset the rest of it */ state.wrap = wrap; state.wbits = windowBits; return inflateReset(strm); } function inflateInit2(strm, windowBits) { var ret; var state; if (!strm) { return Z_STREAM_ERROR; } //strm.msg = Z_NULL; /* in case we return an error */ state = new InflateState(); //if (state === Z_NULL) return Z_MEM_ERROR; //Tracev((stderr, "inflate: allocated\n")); strm.state = state; state.window = null/*Z_NULL*/; ret = inflateReset2(strm, windowBits); if (ret !== Z_OK) { strm.state = null/*Z_NULL*/; } return ret; } function inflateInit(strm) { return inflateInit2(strm, DEF_WBITS); } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ var virgin = true; var lenfix, distfix; // We have no pointers in JS, so keep tables separate function fixedtables(state) { /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { var sym; lenfix = new utils.Buf32(512); distfix = new utils.Buf32(32); /* literal/length table */ sym = 0; while (sym < 144) { state.lens[sym++] = 8; } while (sym < 256) { state.lens[sym++] = 9; } while (sym < 280) { state.lens[sym++] = 7; } while (sym < 288) { state.lens[sym++] = 8; } inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); /* distance table */ sym = 0; while (sym < 32) { state.lens[sym++] = 5; } inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); /* do this just once */ virgin = false; } state.lencode = lenfix; state.lenbits = 9; state.distcode = distfix; state.distbits = 5; } /* Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called when a window is already in use, or when output has been written during this inflate call, but the end of the deflate stream has not been reached yet. It is also called to create a window for dictionary data when a dictionary is loaded. Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ function updatewindow(strm, src, end, copy) { var dist; var state = strm.state; /* if it hasn't been done already, allocate space for the window */ if (state.window === null) { state.wsize = 1 << state.wbits; state.wnext = 0; state.whave = 0; state.window = new utils.Buf8(state.wsize); } /* copy state->wsize or less output bytes into the circular window */ if (copy >= state.wsize) { utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); state.wnext = 0; state.whave = state.wsize; } else { dist = state.wsize - state.wnext; if (dist > copy) { dist = copy; } //zmemcpy(state->window + state->wnext, end - copy, dist); utils.arraySet(state.window, src, end - copy, dist, state.wnext); copy -= dist; if (copy) { //zmemcpy(state->window, end - copy, copy); utils.arraySet(state.window, src, end - copy, copy, 0); state.wnext = copy; state.whave = state.wsize; } else { state.wnext += dist; if (state.wnext === state.wsize) { state.wnext = 0; } if (state.whave < state.wsize) { state.whave += dist; } } } return 0; } function inflate(strm, flush) { var state; var input, output; // input/output buffers var next; /* next input INDEX */ var put; /* next output INDEX */ var have, left; /* available input and output */ var hold; /* bit buffer */ var bits; /* bits in bit buffer */ var _in, _out; /* save starting available input and output */ var copy; /* number of stored or match bytes to copy */ var from; /* where to copy match bytes from */ var from_source; var here = 0; /* current decoding table entry */ var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) //var last; /* parent table entry */ var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) var len; /* length to copy for repeats, bits to drop */ var ret; /* return code */ var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ var opts; var n; // temporary var for NEED_BITS var order = /* permutation of code lengths */ [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; if (!strm || !strm.state || !strm.output || (!strm.input && strm.avail_in !== 0)) { return Z_STREAM_ERROR; } state = strm.state; if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- _in = have; _out = left; ret = Z_OK; inf_leave: // goto emulation for (;;) { switch (state.mode) { case HEAD: if (state.wrap === 0) { state.mode = TYPEDO; break; } //=== NEEDBITS(16); while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ state.check = 0/*crc32(0L, Z_NULL, 0)*/; //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = FLAGS; break; } state.flags = 0; /* expect zlib header */ if (state.head) { state.head.done = false; } if (!(state.wrap & 1) || /* check if zlib header allowed */ (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { strm.msg = 'incorrect header check'; state.mode = BAD; break; } if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// len = (hold & 0x0f)/*BITS(4)*/ + 8; if (state.wbits === 0) { state.wbits = len; } else if (len > state.wbits) { strm.msg = 'invalid window size'; state.mode = BAD; break; } state.dmax = 1 << len; //Tracev((stderr, "inflate: zlib header ok\n")); strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = hold & 0x200 ? DICTID : TYPE; //=== INITBITS(); hold = 0; bits = 0; //===// break; case FLAGS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.flags = hold; if ((state.flags & 0xff) !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } if (state.flags & 0xe000) { strm.msg = 'unknown header flags set'; state.mode = BAD; break; } if (state.head) { state.head.text = ((hold >> 8) & 1); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = TIME; /* falls through */ case TIME: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.time = hold; } if (state.flags & 0x0200) { //=== CRC4(state.check, hold) hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; hbuf[2] = (hold >>> 16) & 0xff; hbuf[3] = (hold >>> 24) & 0xff; state.check = crc32(state.check, hbuf, 4, 0); //=== } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = OS; /* falls through */ case OS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.xflags = (hold & 0xff); state.head.os = (hold >> 8); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = EXLEN; /* falls through */ case EXLEN: if (state.flags & 0x0400) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length = hold; if (state.head) { state.head.extra_len = hold; } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// } else if (state.head) { state.head.extra = null/*Z_NULL*/; } state.mode = EXTRA; /* falls through */ case EXTRA: if (state.flags & 0x0400) { copy = state.length; if (copy > have) { copy = have; } if (copy) { if (state.head) { len = state.head.extra_len - state.length; if (!state.head.extra) { // Use untyped array for more convenient processing later state.head.extra = new Array(state.head.extra_len); } utils.arraySet( state.head.extra, input, next, // extra field is limited to 65536 bytes // - no need for additional size check copy, /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ len ); //zmemcpy(state.head.extra + len, next, // len + copy > state.head.extra_max ? // state.head.extra_max - len : copy); } if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; state.length -= copy; } if (state.length) { break inf_leave; } } state.length = 0; state.mode = NAME; /* falls through */ case NAME: if (state.flags & 0x0800) { if (have === 0) { break inf_leave; } copy = 0; do { // TODO: 2 or 1 bytes? len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.name_max*/)) { state.head.name += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.name = null; } state.length = 0; state.mode = COMMENT; /* falls through */ case COMMENT: if (state.flags & 0x1000) { if (have === 0) { break inf_leave; } copy = 0; do { len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.comm_max*/)) { state.head.comment += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.comment = null; } state.mode = HCRC; /* falls through */ case HCRC: if (state.flags & 0x0200) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.check & 0xffff)) { strm.msg = 'header crc mismatch'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// } if (state.head) { state.head.hcrc = ((state.flags >> 9) & 1); state.head.done = true; } strm.adler = state.check = 0; state.mode = TYPE; break; case DICTID: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// strm.adler = state.check = zswap32(hold); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = DICT; /* falls through */ case DICT: if (state.havedict === 0) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- return Z_NEED_DICT; } strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = TYPE; /* falls through */ case TYPE: if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } /* falls through */ case TYPEDO: if (state.last) { //--- BYTEBITS() ---// hold >>>= bits & 7; bits -= bits & 7; //---// state.mode = CHECK; break; } //=== NEEDBITS(3); */ while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.last = (hold & 0x01)/*BITS(1)*/; //--- DROPBITS(1) ---// hold >>>= 1; bits -= 1; //---// switch ((hold & 0x03)/*BITS(2)*/) { case 0: /* stored block */ //Tracev((stderr, "inflate: stored block%s\n", // state.last ? " (last)" : "")); state.mode = STORED; break; case 1: /* fixed block */ fixedtables(state); //Tracev((stderr, "inflate: fixed codes block%s\n", // state.last ? " (last)" : "")); state.mode = LEN_; /* decode codes */ if (flush === Z_TREES) { //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break inf_leave; } break; case 2: /* dynamic block */ //Tracev((stderr, "inflate: dynamic codes block%s\n", // state.last ? " (last)" : "")); state.mode = TABLE; break; case 3: strm.msg = 'invalid block type'; state.mode = BAD; } //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break; case STORED: //--- BYTEBITS() ---// /* go to byte boundary */ hold >>>= bits & 7; bits -= bits & 7; //---// //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { strm.msg = 'invalid stored block lengths'; state.mode = BAD; break; } state.length = hold & 0xffff; //Tracev((stderr, "inflate: stored length %u\n", // state.length)); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = COPY_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case COPY_: state.mode = COPY; /* falls through */ case COPY: copy = state.length; if (copy) { if (copy > have) { copy = have; } if (copy > left) { copy = left; } if (copy === 0) { break inf_leave; } //--- zmemcpy(put, next, copy); --- utils.arraySet(output, input, next, copy, put); //---// have -= copy; next += copy; left -= copy; put += copy; state.length -= copy; break; } //Tracev((stderr, "inflate: stored end\n")); state.mode = TYPE; break; case TABLE: //=== NEEDBITS(14); */ while (bits < 14) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// //#ifndef PKZIP_BUG_WORKAROUND if (state.nlen > 286 || state.ndist > 30) { strm.msg = 'too many length or distance symbols'; state.mode = BAD; break; } //#endif //Tracev((stderr, "inflate: table sizes ok\n")); state.have = 0; state.mode = LENLENS; /* falls through */ case LENLENS: while (state.have < state.ncode) { //=== NEEDBITS(3); while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } while (state.have < 19) { state.lens[order[state.have++]] = 0; } // We have separate tables & no pointers. 2 commented lines below not needed. //state.next = state.codes; //state.lencode = state.next; // Switch to use dynamic table state.lencode = state.lendyn; state.lenbits = 7; opts = { bits: state.lenbits }; ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); state.lenbits = opts.bits; if (ret) { strm.msg = 'invalid code lengths set'; state.mode = BAD; break; } //Tracev((stderr, "inflate: code lengths ok\n")); state.have = 0; state.mode = CODELENS; /* falls through */ case CODELENS: while (state.have < state.nlen + state.ndist) { for (;;) { here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_val < 16) { //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.lens[state.have++] = here_val; } else { if (here_val === 16) { //=== NEEDBITS(here.bits + 2); n = here_bits + 2; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// if (state.have === 0) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } len = state.lens[state.have - 1]; copy = 3 + (hold & 0x03);//BITS(2); //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// } else if (here_val === 17) { //=== NEEDBITS(here.bits + 3); n = here_bits + 3; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 3 + (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } else { //=== NEEDBITS(here.bits + 7); n = here_bits + 7; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 11 + (hold & 0x7f);//BITS(7); //--- DROPBITS(7) ---// hold >>>= 7; bits -= 7; //---// } if (state.have + copy > state.nlen + state.ndist) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } while (copy--) { state.lens[state.have++] = len; } } } /* handle error breaks in while */ if (state.mode === BAD) { break; } /* check for end-of-block code (better have one) */ if (state.lens[256] === 0) { strm.msg = 'invalid code -- missing end-of-block'; state.mode = BAD; break; } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state.lenbits = 9; opts = { bits: state.lenbits }; ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.lenbits = opts.bits; // state.lencode = state.next; if (ret) { strm.msg = 'invalid literal/lengths set'; state.mode = BAD; break; } state.distbits = 6; //state.distcode.copy(state.codes); // Switch to use dynamic table state.distcode = state.distdyn; opts = { bits: state.distbits }; ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.distbits = opts.bits; // state.distcode = state.next; if (ret) { strm.msg = 'invalid distances set'; state.mode = BAD; break; } //Tracev((stderr, 'inflate: codes ok\n')); state.mode = LEN_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case LEN_: state.mode = LEN; /* falls through */ case LEN: if (have >= 6 && left >= 258) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- inflate_fast(strm, _out); //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- if (state.mode === TYPE) { state.back = -1; } break; } state.back = 0; for (;;) { here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if (here_bits <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_op && (here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.lencode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; state.length = here_val; if (here_op === 0) { //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); state.mode = LIT; break; } if (here_op & 32) { //Tracevv((stderr, "inflate: end of block\n")); state.back = -1; state.mode = TYPE; break; } if (here_op & 64) { strm.msg = 'invalid literal/length code'; state.mode = BAD; break; } state.extra = here_op & 15; state.mode = LENEXT; /* falls through */ case LENEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //Tracevv((stderr, "inflate: length %u\n", state.length)); state.was = state.length; state.mode = DIST; /* falls through */ case DIST: for (;;) { here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if ((here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.distcode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; if (here_op & 64) { strm.msg = 'invalid distance code'; state.mode = BAD; break; } state.offset = here_val; state.extra = (here_op) & 15; state.mode = DISTEXT; /* falls through */ case DISTEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //#ifdef INFLATE_STRICT if (state.offset > state.dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } //#endif //Tracevv((stderr, "inflate: distance %u\n", state.offset)); state.mode = MATCH; /* falls through */ case MATCH: if (left === 0) { break inf_leave; } copy = _out - left; if (state.offset > copy) { /* copy from window */ copy = state.offset - copy; if (copy > state.whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } // (!) This block is disabled in zlib defaults, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // Trace((stderr, "inflate.c too far\n")); // copy -= state.whave; // if (copy > state.length) { copy = state.length; } // if (copy > left) { copy = left; } // left -= copy; // state.length -= copy; // do { // output[put++] = 0; // } while (--copy); // if (state.length === 0) { state.mode = LEN; } // break; //#endif } if (copy > state.wnext) { copy -= state.wnext; from = state.wsize - copy; } else { from = state.wnext - copy; } if (copy > state.length) { copy = state.length; } from_source = state.window; } else { /* copy from output */ from_source = output; from = put - state.offset; copy = state.length; } if (copy > left) { copy = left; } left -= copy; state.length -= copy; do { output[put++] = from_source[from++]; } while (--copy); if (state.length === 0) { state.mode = LEN; } break; case LIT: if (left === 0) { break inf_leave; } output[put++] = state.length; left--; state.mode = LEN; break; case CHECK: if (state.wrap) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; // Use '|' instead of '+' to make sure that result is signed hold |= input[next++] << bits; bits += 8; } //===// _out -= left; strm.total_out += _out; state.total += _out; if (_out) { strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); } _out = left; // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too if ((state.flags ? hold : zswap32(hold)) !== state.check) { strm.msg = 'incorrect data check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: check matches trailer\n")); } state.mode = LENGTH; /* falls through */ case LENGTH: if (state.wrap && state.flags) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.total & 0xffffffff)) { strm.msg = 'incorrect length check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: length matches trailer\n")); } state.mode = DONE; /* falls through */ case DONE: ret = Z_STREAM_END; break inf_leave; case BAD: ret = Z_DATA_ERROR; break inf_leave; case MEM: return Z_MEM_ERROR; case SYNC: /* falls through */ default: return Z_STREAM_ERROR; } } // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" /* Return from inflate(), updating the total counts and the check value. If there was no progress during the inflate() call, return a buffer error. Call updatewindow() to create and/or update the window state. Note: a memory error from inflate() is non-recoverable. */ //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH))) { if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { state.mode = MEM; return Z_MEM_ERROR; } } _in -= strm.avail_in; _out -= strm.avail_out; strm.total_in += _in; strm.total_out += _out; state.total += _out; if (state.wrap && _out) { strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); } strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { ret = Z_BUF_ERROR; } return ret; } function inflateEnd(strm) { if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { return Z_STREAM_ERROR; } var state = strm.state; if (state.window) { state.window = null; } strm.state = null; return Z_OK; } function inflateGetHeader(strm, head) { var state; /* check state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } /* save header structure */ state.head = head; head.done = false; return Z_OK; } function inflateSetDictionary(strm, dictionary) { var dictLength = dictionary.length; var state; var dictid; var ret; /* check state */ if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } state = strm.state; if (state.wrap !== 0 && state.mode !== DICT) { return Z_STREAM_ERROR; } /* check for correct dictionary identifier */ if (state.mode === DICT) { dictid = 1; /* adler32(0, null, 0)*/ /* dictid = adler32(dictid, dictionary, dictLength); */ dictid = adler32(dictid, dictionary, dictLength, 0); if (dictid !== state.check) { return Z_DATA_ERROR; } } /* copy dictionary to window using updatewindow(), which will amend the existing dictionary if appropriate */ ret = updatewindow(strm, dictionary, dictLength, dictLength); if (ret) { state.mode = MEM; return Z_MEM_ERROR; } state.havedict = 1; // Tracev((stderr, "inflate: dictionary set\n")); return Z_OK; } exports.inflateReset = inflateReset; exports.inflateReset2 = inflateReset2; exports.inflateResetKeep = inflateResetKeep; exports.inflateInit = inflateInit; exports.inflateInit2 = inflateInit2; exports.inflate = inflate; exports.inflateEnd = inflateEnd; exports.inflateGetHeader = inflateGetHeader; exports.inflateSetDictionary = inflateSetDictionary; exports.inflateInfo = 'pako inflate (from Nodeca project)'; /* Not implemented exports.inflateCopy = inflateCopy; exports.inflateGetDictionary = inflateGetDictionary; exports.inflateMark = inflateMark; exports.inflatePrime = inflatePrime; exports.inflateSync = inflateSync; exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ },{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. var utils = require('../utils/common'); var MAXBITS = 15; var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var CODES = 0; var LENS = 1; var DISTS = 2; var lbase = [ /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 ]; var lext = [ /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 ]; var dbase = [ /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0 ]; var dext = [ /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64 ]; module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { var bits = opts.bits; //here = opts.here; /* table entry for duplication */ var len = 0; /* a code's length in bits */ var sym = 0; /* index of code symbols */ var min = 0, max = 0; /* minimum and maximum code lengths */ var root = 0; /* number of index bits for root table */ var curr = 0; /* number of index bits for current table */ var drop = 0; /* code bits to drop for sub-table */ var left = 0; /* number of prefix codes available */ var used = 0; /* code entries in table used */ var huff = 0; /* Huffman code */ var incr; /* for incrementing code, index */ var fill; /* index for replicating entries */ var low; /* low bits for current root entry */ var mask; /* mask for low root bits */ var next; /* next available space in table */ var base = null; /* base value table to use */ var base_index = 0; // var shoextra; /* extra bits table to use */ var end; /* use base and extra for symbol > end */ var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ var extra = null; var extra_index = 0; var here_bits, here_op, here_val; /* Process a set of code lengths to create a canonical Huffman code. The code lengths are lens[0..codes-1]. Each length corresponds to the symbols 0..codes-1. The Huffman code is generated by first sorting the symbols by length from short to long, and retaining the symbol order for codes with equal lengths. Then the code starts with all zero bits for the first code of the shortest length, and the codes are integer increments for the same length, and zeros are appended as the length increases. For the deflate format, these bits are stored backwards from their more natural integer increment ordering, and so when the decoding tables are built in the large loop below, the integer codes are incremented backwards. This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, creating from that a table of starting indices for each length in the sorted table, and then entering the symbols in order in the sorted table. The sorted table is work[], with that space being provided by the caller. The length counts are used for other purposes as well, i.e. finding the minimum and maximum length codes, determining if there are any codes at all, checking for a valid set of lengths, and looking ahead at length counts to determine sub-table sizes when building the decoding tables. */ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ for (len = 0; len <= MAXBITS; len++) { count[len] = 0; } for (sym = 0; sym < codes; sym++) { count[lens[lens_index + sym]]++; } /* bound code lengths, force root to be within code lengths */ root = bits; for (max = MAXBITS; max >= 1; max--) { if (count[max] !== 0) { break; } } if (root > max) { root = max; } if (max === 0) { /* no symbols to code at all */ //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ //table.bits[opts.table_index] = 1; //here.bits = (var char)1; //table.val[opts.table_index++] = 0; //here.val = (var short)0; table[table_index++] = (1 << 24) | (64 << 16) | 0; //table.op[opts.table_index] = 64; //table.bits[opts.table_index] = 1; //table.val[opts.table_index++] = 0; table[table_index++] = (1 << 24) | (64 << 16) | 0; opts.bits = 1; return 0; /* no symbols, but wait for decoding to report error */ } for (min = 1; min < max; min++) { if (count[min] !== 0) { break; } } if (root < min) { root = min; } /* check for an over-subscribed or incomplete set of lengths */ left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= count[len]; if (left < 0) { return -1; } /* over-subscribed */ } if (left > 0 && (type === CODES || max !== 1)) { return -1; /* incomplete set */ } /* generate offsets into symbol table for each length for sorting */ offs[1] = 0; for (len = 1; len < MAXBITS; len++) { offs[len + 1] = offs[len] + count[len]; } /* sort symbols by length, by symbol order within each length */ for (sym = 0; sym < codes; sym++) { if (lens[lens_index + sym] !== 0) { work[offs[lens[lens_index + sym]]++] = sym; } } /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked for LENS and DIST tables against the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the initial root table size constants. See the comments in inftrees.h for more information. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ // poor man optimization - use if-else instead of switch, // to avoid deopts in old v8 if (type === CODES) { base = extra = work; /* dummy value--not used */ end = 19; } else if (type === LENS) { base = lbase; base_index -= 257; extra = lext; extra_index -= 257; end = 256; } else { /* DISTS */ base = dbase; extra = dext; end = -1; } /* initialize opts for loop */ huff = 0; /* starting code */ sym = 0; /* starting code symbol */ len = min; /* starting code length */ next = table_index; /* current table to fill in */ curr = root; /* current table index bits */ drop = 0; /* current bits to drop from code for index */ low = -1; /* trigger new sub-table when len > root */ used = 1 << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } /* process all codes and make table entries */ for (;;) { /* create table entry */ here_bits = len - drop; if (work[sym] < end) { here_op = 0; here_val = work[sym]; } else if (work[sym] > end) { here_op = extra[extra_index + work[sym]]; here_val = base[base_index + work[sym]]; } else { here_op = 32 + 64; /* end of block */ here_val = 0; } /* replicate for those indices with low len bits equal to huff */ incr = 1 << (len - drop); fill = 1 << curr; min = fill; /* save offset to next table */ do { fill -= incr; table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; } while (fill !== 0); /* backwards increment the len-bit code huff */ incr = 1 << (len - 1); while (huff & incr) { incr >>= 1; } if (incr !== 0) { huff &= incr - 1; huff += incr; } else { huff = 0; } /* go to next symbol, update count, len */ sym++; if (--count[len] === 0) { if (len === max) { break; } len = lens[lens_index + work[sym]]; } /* create new sub-table if needed */ if (len > root && (huff & mask) !== low) { /* if first time, transition to sub-tables */ if (drop === 0) { drop = root; } /* increment past last table */ next += min; /* here min is 1 << curr */ /* determine length of next table */ curr = len - drop; left = 1 << curr; while (curr + drop < max) { left -= count[curr + drop]; if (left <= 0) { break; } curr++; left <<= 1; } /* check for enough space */ used += 1 << curr; if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } /* point entry in root table to sub-table */ low = huff & mask; /*table.op[low] = curr; table.bits[low] = root; table.val[low] = next - opts.table_index;*/ table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; } } /* fill in remaining table entry if code is incomplete (guaranteed to have at most one remaining entry, since if the code is incomplete, the maximum code length that was allowed to get this far is one bit) */ if (huff !== 0) { //table.op[next + huff] = 64; /* invalid code marker */ //table.bits[next + huff] = len - drop; //table.val[next + huff] = 0; table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; } /* set return parameters */ //opts.table_index += used; opts.bits = root; return 0; }; },{"../utils/common":1}],10:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. module.exports = { 2: 'need dictionary', /* Z_NEED_DICT 2 */ 1: 'stream end', /* Z_STREAM_END 1 */ 0: '', /* Z_OK 0 */ '-1': 'file error', /* Z_ERRNO (-1) */ '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ '-3': 'data error', /* Z_DATA_ERROR (-3) */ '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; },{}],11:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. function ZStream() { /* next input byte */ this.input = null; // JS specific, because we have no pointers this.next_in = 0; /* number of bytes available at input */ this.avail_in = 0; /* total number of input bytes read so far */ this.total_in = 0; /* next output byte should be put there */ this.output = null; // JS specific, because we have no pointers this.next_out = 0; /* remaining free space at output */ this.avail_out = 0; /* total number of bytes output so far */ this.total_out = 0; /* last error message, NULL if no error */ this.msg = ''/*Z_NULL*/; /* not visible by applications */ this.state = null; /* best guess about the data type: binary or text */ this.data_type = 2/*Z_UNKNOWN*/; /* adler32 value of the uncompressed data */ this.adler = 0; } module.exports = ZStream; },{}],"/lib/inflate.js":[function(require,module,exports){ 'use strict'; var zlib_inflate = require('./zlib/inflate'); var utils = require('./utils/common'); var strings = require('./utils/strings'); var c = require('./zlib/constants'); var msg = require('./zlib/messages'); var ZStream = require('./zlib/zstream'); var GZheader = require('./zlib/gzheader'); var toString = Object.prototype.toString; /** * class Inflate * * Generic JS-style wrapper for zlib calls. If you don't need * streaming behaviour - use more simple functions: [[inflate]] * and [[inflateRaw]]. **/ /* internal * inflate.chunks -> Array * * Chunks of output data, if [[Inflate#onData]] not overridden. **/ /** * Inflate.result -> Uint8Array|Array|String * * Uncompressed result, generated by default [[Inflate#onData]] * and [[Inflate#onEnd]] handlers. Filled after you push last chunk * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you * push a chunk with explicit flush (call [[Inflate#push]] with * `Z_SYNC_FLUSH` param). **/ /** * Inflate.err -> Number * * Error code after inflate finished. 0 (Z_OK) on success. * Should be checked if broken data possible. **/ /** * Inflate.msg -> String * * Error message, if [[Inflate.err]] != 0 **/ /** * new Inflate(options) * - options (Object): zlib inflate options. * * Creates new inflator instance with specified params. Throws exception * on bad params. Supported options: * * - `windowBits` * - `dictionary` * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Additional options, for internal needs: * * - `chunkSize` - size of generated data chunks (16K by default) * - `raw` (Boolean) - do raw inflate * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * By default, when no options set, autodetect deflate/gzip data format via * wrapper header. * * ##### Example: * * ```javascript * var pako = require('pako') * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); * * var inflate = new pako.Inflate({ level: 3}); * * inflate.push(chunk1, false); * inflate.push(chunk2, true); // true -> last chunk * * if (inflate.err) { throw new Error(inflate.err); } * * console.log(inflate.result); * ``` **/ function Inflate(options) { if (!(this instanceof Inflate)) return new Inflate(options); this.options = utils.assign({ chunkSize: 16384, windowBits: 0, to: '' }, options || {}); var opt = this.options; // Force window size for `raw` data, if not set directly, // because we have no header for autodetect. if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { opt.windowBits = -opt.windowBits; if (opt.windowBits === 0) { opt.windowBits = -15; } } // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate if ((opt.windowBits >= 0) && (opt.windowBits < 16) && !(options && options.windowBits)) { opt.windowBits += 32; } // Gzip header has no info about windows size, we can do autodetect only // for deflate. So, if window size not set, force it to max when gzip possible if ((opt.windowBits > 15) && (opt.windowBits < 48)) { // bit 3 (16) -> gzipped data // bit 4 (32) -> autodetect gzip/deflate if ((opt.windowBits & 15) === 0) { opt.windowBits |= 15; } } this.err = 0; // error code, if happens (0 = Z_OK) this.msg = ''; // error message this.ended = false; // used to avoid multiple onEnd() calls this.chunks = []; // chunks of compressed data this.strm = new ZStream(); this.strm.avail_out = 0; var status = zlib_inflate.inflateInit2( this.strm, opt.windowBits ); if (status !== c.Z_OK) { throw new Error(msg[status]); } this.header = new GZheader(); zlib_inflate.inflateGetHeader(this.strm, this.header); // Setup dictionary if (opt.dictionary) { // Convert data if needed if (typeof opt.dictionary === 'string') { opt.dictionary = strings.string2buf(opt.dictionary); } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { opt.dictionary = new Uint8Array(opt.dictionary); } if (opt.raw) { //In raw mode we need to set the dictionary early status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); if (status !== c.Z_OK) { throw new Error(msg[status]); } } } } /** * Inflate#push(data[, mode]) -> Boolean * - data (Uint8Array|Array|ArrayBuffer|String): input data * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. * * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with * new output chunks. Returns `true` on success. The last data block must have * mode Z_FINISH (or `true`). That will flush internal pending buffers and call * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you * can use mode Z_SYNC_FLUSH, keeping the decompression context. * * On fail call [[Inflate#onEnd]] with error code and return false. * * We strongly recommend to use `Uint8Array` on input for best speed (output * format is detected automatically). Also, don't skip last param and always * use the same type in your code (boolean or number). That will improve JS speed. * * For regular `Array`-s make sure all elements are [0..255]. * * ##### Example * * ```javascript * push(chunk, false); // push one of data chunks * ... * push(chunk, true); // push last chunk * ``` **/ Inflate.prototype.push = function (data, mode) { var strm = this.strm; var chunkSize = this.options.chunkSize; var dictionary = this.options.dictionary; var status, _mode; var next_out_utf8, tail, utf8str; // Flag to properly process Z_BUF_ERROR on testing inflate call // when we check that all output data was flushed. var allowBufError = false; if (this.ended) { return false; } _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); // Convert data if needed if (typeof data === 'string') { // Only binary strings can be decompressed on practice strm.input = strings.binstring2buf(data); } else if (toString.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; } strm.next_in = 0; strm.avail_in = strm.input.length; do { if (strm.avail_out === 0) { strm.output = new utils.Buf8(chunkSize); strm.next_out = 0; strm.avail_out = chunkSize; } status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ if (status === c.Z_NEED_DICT && dictionary) { status = zlib_inflate.inflateSetDictionary(this.strm, dictionary); } if (status === c.Z_BUF_ERROR && allowBufError === true) { status = c.Z_OK; allowBufError = false; } if (status !== c.Z_STREAM_END && status !== c.Z_OK) { this.onEnd(status); this.ended = true; return false; } if (strm.next_out) { if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { if (this.options.to === 'string') { next_out_utf8 = strings.utf8border(strm.output, strm.next_out); tail = strm.next_out - next_out_utf8; utf8str = strings.buf2string(strm.output, next_out_utf8); // move tail strm.next_out = tail; strm.avail_out = chunkSize - tail; if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } this.onData(utf8str); } else { this.onData(utils.shrinkBuf(strm.output, strm.next_out)); } } } // When no more input data, we should check that internal inflate buffers // are flushed. The only way to do it when avail_out = 0 - run one more // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. // Here we set flag to process this error properly. // // NOTE. Deflate does not return error in this case and does not needs such // logic. if (strm.avail_in === 0 && strm.avail_out === 0) { allowBufError = true; } } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); if (status === c.Z_STREAM_END) { _mode = c.Z_FINISH; } // Finalize on the last chunk. if (_mode === c.Z_FINISH) { status = zlib_inflate.inflateEnd(this.strm); this.onEnd(status); this.ended = true; return status === c.Z_OK; } // callback interim results if Z_SYNC_FLUSH. if (_mode === c.Z_SYNC_FLUSH) { this.onEnd(c.Z_OK); strm.avail_out = 0; return true; } return true; }; /** * Inflate#onData(chunk) -> Void * - chunk (Uint8Array|Array|String): output data. Type of array depends * on js engine support. When string output requested, each chunk * will be string. * * By default, stores data blocks in `chunks[]` property and glue * those in `onEnd`. Override this handler, if you need another behaviour. **/ Inflate.prototype.onData = function (chunk) { this.chunks.push(chunk); }; /** * Inflate#onEnd(status) -> Void * - status (Number): inflate status. 0 (Z_OK) on success, * other if not. * * Called either after you tell inflate that the input stream is * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) * or if an error happened. By default - join collected chunks, * free memory and fill `results` / `err` properties. **/ Inflate.prototype.onEnd = function (status) { // On success - join if (status === c.Z_OK) { if (this.options.to === 'string') { // Glue & convert here, until we teach pako to send // utf8 aligned strings to onData this.result = this.chunks.join(''); } else { this.result = utils.flattenChunks(this.chunks); } } this.chunks = []; this.err = status; this.msg = this.strm.msg; }; /** * inflate(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Decompress `data` with inflate/ungzip and `options`. Autodetect * format via wrapper header by default. That's why we don't provide * separate `ungzip` method. * * Supported options are: * * - windowBits * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information. * * Sugar (options): * * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify * negative windowBits implicitly. * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * * ##### Example: * * ```javascript * var pako = require('pako') * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) * , output; * * try { * output = pako.inflate(input); * } catch (err) * console.log(err); * } * ``` **/ function inflate(input, options) { var inflator = new Inflate(options); inflator.push(input, true); // That will never happens, if you don't cheat with options :) if (inflator.err) { throw inflator.msg || msg[inflator.err]; } return inflator.result; } /** * inflateRaw(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * The same as [[inflate]], but creates raw data, without wrapper * (header and adler32 crc). **/ function inflateRaw(input, options) { options = options || {}; options.raw = true; return inflate(input, options); } /** * ungzip(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Just shortcut to [[inflate]], because it autodetects format * by header.content. Done for convenience. **/ exports.Inflate = Inflate; exports.inflate = inflate; exports.inflateRaw = inflateRaw; exports.ungzip = inflate; },{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js") }); /* eslint-enable */ /***/ }), /***/ 8572: /***/ ((module) => { /** * Credits: * * lib-font * https://github.com/Pomax/lib-font * https://github.com/Pomax/lib-font/blob/master/lib/unbrotli.js * * The MIT License (MIT) * * Copyright (c) 2020 pomax@nihongoresources.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* eslint eslint-comments/no-unlimited-disable: 0 */ /* eslint-disable */ (function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Bit reading helpers */ var BROTLI_READ_SIZE = 4096; var BROTLI_IBUF_SIZE = (2 * BROTLI_READ_SIZE + 32); var BROTLI_IBUF_MASK = (2 * BROTLI_READ_SIZE - 1); var kBitMask = new Uint32Array([ 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215 ]); /* Input byte buffer, consist of a ringbuffer and a "slack" region where */ /* bytes from the start of the ringbuffer are copied. */ function BrotliBitReader(input) { this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE); this.input_ = input; /* input callback */ this.reset(); } BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE; BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK; BrotliBitReader.prototype.reset = function() { this.buf_ptr_ = 0; /* next input will write here */ this.val_ = 0; /* pre-fetched bits */ this.pos_ = 0; /* byte position in stream */ this.bit_pos_ = 0; /* current bit-reading position in val_ */ this.bit_end_pos_ = 0; /* bit-reading end position from LSB of val_ */ this.eos_ = 0; /* input stream is finished */ this.readMoreInput(); for (var i = 0; i < 4; i++) { this.val_ |= this.buf_[this.pos_] << (8 * i); ++this.pos_; } return this.bit_end_pos_ > 0; }; /* Fills up the input ringbuffer by calling the input callback. Does nothing if there are at least 32 bytes present after current position. Returns 0 if either: - the input callback returned an error, or - there is no more input and the position is past the end of the stream. After encountering the end of the input stream, 32 additional zero bytes are copied to the ringbuffer, therefore it is safe to call this function after every 32 bytes of input is read. */ BrotliBitReader.prototype.readMoreInput = function() { if (this.bit_end_pos_ > 256) { return; } else if (this.eos_) { if (this.bit_pos_ > this.bit_end_pos_) throw new Error('Unexpected end of input ' + this.bit_pos_ + ' ' + this.bit_end_pos_); } else { var dst = this.buf_ptr_; var bytes_read = this.input_.read(this.buf_, dst, BROTLI_READ_SIZE); if (bytes_read < 0) { throw new Error('Unexpected end of input'); } if (bytes_read < BROTLI_READ_SIZE) { this.eos_ = 1; /* Store 32 bytes of zero after the stream end. */ for (var p = 0; p < 32; p++) this.buf_[dst + bytes_read + p] = 0; } if (dst === 0) { /* Copy the head of the ringbuffer to the slack region. */ for (var p = 0; p < 32; p++) this.buf_[(BROTLI_READ_SIZE << 1) + p] = this.buf_[p]; this.buf_ptr_ = BROTLI_READ_SIZE; } else { this.buf_ptr_ = 0; } this.bit_end_pos_ += bytes_read << 3; } }; /* Guarantees that there are at least 24 bits in the buffer. */ BrotliBitReader.prototype.fillBitWindow = function() { while (this.bit_pos_ >= 8) { this.val_ >>>= 8; this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24; ++this.pos_; this.bit_pos_ = this.bit_pos_ - 8 >>> 0; this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0; } }; /* Reads the specified number of bits from Read Buffer. */ BrotliBitReader.prototype.readBits = function(n_bits) { if (32 - this.bit_pos_ < n_bits) { this.fillBitWindow(); } var val = ((this.val_ >>> this.bit_pos_) & kBitMask[n_bits]); this.bit_pos_ += n_bits; return val; }; module.exports = BrotliBitReader; },{}],2:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Lookup table to map the previous two bytes to a context id. There are four different context modeling modes defined here: CONTEXT_LSB6: context id is the least significant 6 bits of the last byte, CONTEXT_MSB6: context id is the most significant 6 bits of the last byte, CONTEXT_UTF8: second-order context model tuned for UTF8-encoded text, CONTEXT_SIGNED: second-order context model tuned for signed integers. The context id for the UTF8 context model is calculated as follows. If p1 and p2 are the previous two bytes, we calcualte the context as context = kContextLookup[p1] | kContextLookup[p2 + 256]. If the previous two bytes are ASCII characters (i.e. < 128), this will be equivalent to context = 4 * context1(p1) + context2(p2), where context1 is based on the previous byte in the following way: 0 : non-ASCII control 1 : \t, \n, \r 2 : space 3 : other punctuation 4 : " ' 5 : % 6 : ( < [ { 7 : ) > ] } 8 : , ; : 9 : . 10 : = 11 : number 12 : upper-case vowel 13 : upper-case consonant 14 : lower-case vowel 15 : lower-case consonant and context2 is based on the second last byte: 0 : control, space 1 : punctuation 2 : upper-case letter, number 3 : lower-case letter If the last byte is ASCII, and the second last byte is not (in a valid UTF8 stream it will be a continuation byte, value between 128 and 191), the context is the same as if the second last byte was an ASCII control or space. If the last byte is a UTF8 lead byte (value >= 192), then the next byte will be a continuation byte and the context id is 2 or 3 depending on the LSB of the last byte and to a lesser extent on the second last byte if it is ASCII. If the last byte is a UTF8 continuation byte, the second last byte can be: - continuation byte: the next byte is probably ASCII or lead byte (assuming 4-byte UTF8 characters are rare) and the context id is 0 or 1. - lead byte (192 - 207): next byte is ASCII or lead byte, context is 0 or 1 - lead byte (208 - 255): next byte is continuation byte, context is 2 or 3 The possible value combinations of the previous two bytes, the range of context ids and the type of the next byte is summarized in the table below: |--------\-----------------------------------------------------------------| | \ Last byte | | Second \---------------------------------------------------------------| | last byte \ ASCII | cont. byte | lead byte | | \ (0-127) | (128-191) | (192-) | |=============|===================|=====================|==================| | ASCII | next: ASCII/lead | not valid | next: cont. | | (0-127) | context: 4 - 63 | | context: 2 - 3 | |-------------|-------------------|---------------------|------------------| | cont. byte | next: ASCII/lead | next: ASCII/lead | next: cont. | | (128-191) | context: 4 - 63 | context: 0 - 1 | context: 2 - 3 | |-------------|-------------------|---------------------|------------------| | lead byte | not valid | next: ASCII/lead | not valid | | (192-207) | | context: 0 - 1 | | |-------------|-------------------|---------------------|------------------| | lead byte | not valid | next: cont. | not valid | | (208-) | | context: 2 - 3 | | |-------------|-------------------|---------------------|------------------| The context id for the signed context mode is calculated as: context = (kContextLookup[512 + p1] << 3) | kContextLookup[512 + p2]. For any context modeling modes, the context ids can be calculated by |-ing together two lookups from one table using context model dependent offsets: context = kContextLookup[offset1 + p1] | kContextLookup[offset2 + p2]. where offset1 and offset2 are dependent on the context mode. */ var CONTEXT_LSB6 = 0; var CONTEXT_MSB6 = 1; var CONTEXT_UTF8 = 2; var CONTEXT_SIGNED = 3; /* Common context lookup table for all context modes. */ exports.lookup = new Uint8Array([ /* CONTEXT_UTF8, last byte. */ /* ASCII range. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12, 12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12, 12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0, /* UTF8 continuation byte range. */ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, /* UTF8 lead byte range. */ 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, /* CONTEXT_UTF8 second last byte. */ /* ASCII range. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0, /* UTF8 continuation byte range. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* UTF8 lead byte range. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* CONTEXT_SIGNED, second last byte. */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */ 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56, /* CONTEXT_LSB6, last byte. */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* CONTEXT_MSB6, last byte. */ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, /* CONTEXT_{M,L}SB6, second last byte, */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]); exports.lookupOffsets = new Uint16Array([ /* CONTEXT_LSB6 */ 1024, 1536, /* CONTEXT_MSB6 */ 1280, 1536, /* CONTEXT_UTF8 */ 0, 256, /* CONTEXT_SIGNED */ 768, 512, ]); },{}],3:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var BrotliInput = require('./streams').BrotliInput; var BrotliOutput = require('./streams').BrotliOutput; var BrotliBitReader = require('./bit_reader'); var BrotliDictionary = require('./dictionary'); var HuffmanCode = require('./huffman').HuffmanCode; var BrotliBuildHuffmanTable = require('./huffman').BrotliBuildHuffmanTable; var Context = require('./context'); var Prefix = require('./prefix'); var Transform = require('./transform'); var kDefaultCodeLength = 8; var kCodeLengthRepeatCode = 16; var kNumLiteralCodes = 256; var kNumInsertAndCopyCodes = 704; var kNumBlockLengthCodes = 26; var kLiteralContextBits = 6; var kDistanceContextBits = 2; var HUFFMAN_TABLE_BITS = 8; var HUFFMAN_TABLE_MASK = 0xff; /* Maximum possible Huffman table size for an alphabet size of 704, max code * length 15 and root table bits 8. */ var HUFFMAN_MAX_TABLE_SIZE = 1080; var CODE_LENGTH_CODES = 18; var kCodeLengthCodeOrder = new Uint8Array([ 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, ]); var NUM_DISTANCE_SHORT_CODES = 16; var kDistanceShortCodeIndexOffset = new Uint8Array([ 3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 ]); var kDistanceShortCodeValueOffset = new Int8Array([ 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3 ]); var kMaxHuffmanTableSize = new Uint16Array([ 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, 854, 886, 920, 952, 984, 1016, 1048, 1080 ]); function DecodeWindowBits(br) { var n; if (br.readBits(1) === 0) { return 16; } n = br.readBits(3); if (n > 0) { return 17 + n; } n = br.readBits(3); if (n > 0) { return 8 + n; } return 17; } /* Decodes a number in the range [0..255], by reading 1 - 11 bits. */ function DecodeVarLenUint8(br) { if (br.readBits(1)) { var nbits = br.readBits(3); if (nbits === 0) { return 1; } else { return br.readBits(nbits) + (1 << nbits); } } return 0; } function MetaBlockLength() { this.meta_block_length = 0; this.input_end = 0; this.is_uncompressed = 0; this.is_metadata = false; } function DecodeMetaBlockLength(br) { var out = new MetaBlockLength; var size_nibbles; var size_bytes; var i; out.input_end = br.readBits(1); if (out.input_end && br.readBits(1)) { return out; } size_nibbles = br.readBits(2) + 4; if (size_nibbles === 7) { out.is_metadata = true; if (br.readBits(1) !== 0) throw new Error('Invalid reserved bit'); size_bytes = br.readBits(2); if (size_bytes === 0) return out; for (i = 0; i < size_bytes; i++) { var next_byte = br.readBits(8); if (i + 1 === size_bytes && size_bytes > 1 && next_byte === 0) throw new Error('Invalid size byte'); out.meta_block_length |= next_byte << (i * 8); } } else { for (i = 0; i < size_nibbles; ++i) { var next_nibble = br.readBits(4); if (i + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0) throw new Error('Invalid size nibble'); out.meta_block_length |= next_nibble << (i * 4); } } ++out.meta_block_length; if (!out.input_end && !out.is_metadata) { out.is_uncompressed = br.readBits(1); } return out; } /* Decodes the next Huffman code from bit-stream. */ function ReadSymbol(table, index, br) { var start_index = index; var nbits; br.fillBitWindow(); index += (br.val_ >>> br.bit_pos_) & HUFFMAN_TABLE_MASK; nbits = table[index].bits - HUFFMAN_TABLE_BITS; if (nbits > 0) { br.bit_pos_ += HUFFMAN_TABLE_BITS; index += table[index].value; index += (br.val_ >>> br.bit_pos_) & ((1 << nbits) - 1); } br.bit_pos_ += table[index].bits; return table[index].value; } function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) { var symbol = 0; var prev_code_len = kDefaultCodeLength; var repeat = 0; var repeat_code_len = 0; var space = 32768; var table = []; for (var i = 0; i < 32; i++) table.push(new HuffmanCode(0, 0)); BrotliBuildHuffmanTable(table, 0, 5, code_length_code_lengths, CODE_LENGTH_CODES); while (symbol < num_symbols && space > 0) { var p = 0; var code_len; br.readMoreInput(); br.fillBitWindow(); p += (br.val_ >>> br.bit_pos_) & 31; br.bit_pos_ += table[p].bits; code_len = table[p].value & 0xff; if (code_len < kCodeLengthRepeatCode) { repeat = 0; code_lengths[symbol++] = code_len; if (code_len !== 0) { prev_code_len = code_len; space -= 32768 >> code_len; } } else { var extra_bits = code_len - 14; var old_repeat; var repeat_delta; var new_len = 0; if (code_len === kCodeLengthRepeatCode) { new_len = prev_code_len; } if (repeat_code_len !== new_len) { repeat = 0; repeat_code_len = new_len; } old_repeat = repeat; if (repeat > 0) { repeat -= 2; repeat <<= extra_bits; } repeat += br.readBits(extra_bits) + 3; repeat_delta = repeat - old_repeat; if (symbol + repeat_delta > num_symbols) { throw new Error('[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols'); } for (var x = 0; x < repeat_delta; x++) code_lengths[symbol + x] = repeat_code_len; symbol += repeat_delta; if (repeat_code_len !== 0) { space -= repeat_delta << (15 - repeat_code_len); } } } if (space !== 0) { throw new Error("[ReadHuffmanCodeLengths] space = " + space); } for (; symbol < num_symbols; symbol++) code_lengths[symbol] = 0; } function ReadHuffmanCode(alphabet_size, tables, table, br) { var table_size = 0; var simple_code_or_skip; var code_lengths = new Uint8Array(alphabet_size); br.readMoreInput(); /* simple_code_or_skip is used as follows: 1 for simple code; 0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */ simple_code_or_skip = br.readBits(2); if (simple_code_or_skip === 1) { /* Read symbols, codes & code lengths directly. */ var i; var max_bits_counter = alphabet_size - 1; var max_bits = 0; var symbols = new Int32Array(4); var num_symbols = br.readBits(2) + 1; while (max_bits_counter) { max_bits_counter >>= 1; ++max_bits; } for (i = 0; i < num_symbols; ++i) { symbols[i] = br.readBits(max_bits) % alphabet_size; code_lengths[symbols[i]] = 2; } code_lengths[symbols[0]] = 1; switch (num_symbols) { case 1: break; case 3: if ((symbols[0] === symbols[1]) || (symbols[0] === symbols[2]) || (symbols[1] === symbols[2])) { throw new Error('[ReadHuffmanCode] invalid symbols'); } break; case 2: if (symbols[0] === symbols[1]) { throw new Error('[ReadHuffmanCode] invalid symbols'); } code_lengths[symbols[1]] = 1; break; case 4: if ((symbols[0] === symbols[1]) || (symbols[0] === symbols[2]) || (symbols[0] === symbols[3]) || (symbols[1] === symbols[2]) || (symbols[1] === symbols[3]) || (symbols[2] === symbols[3])) { throw new Error('[ReadHuffmanCode] invalid symbols'); } if (br.readBits(1)) { code_lengths[symbols[2]] = 3; code_lengths[symbols[3]] = 3; } else { code_lengths[symbols[0]] = 2; } break; } } else { /* Decode Huffman-coded code lengths. */ var i; var code_length_code_lengths = new Uint8Array(CODE_LENGTH_CODES); var space = 32; var num_codes = 0; /* Static Huffman code for the code length code lengths */ var huff = [ new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 1), new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 5) ]; for (i = simple_code_or_skip; i < CODE_LENGTH_CODES && space > 0; ++i) { var code_len_idx = kCodeLengthCodeOrder[i]; var p = 0; var v; br.fillBitWindow(); p += (br.val_ >>> br.bit_pos_) & 15; br.bit_pos_ += huff[p].bits; v = huff[p].value; code_length_code_lengths[code_len_idx] = v; if (v !== 0) { space -= (32 >> v); ++num_codes; } } if (!(num_codes === 1 || space === 0)) throw new Error('[ReadHuffmanCode] invalid num_codes or space'); ReadHuffmanCodeLengths(code_length_code_lengths, alphabet_size, code_lengths, br); } table_size = BrotliBuildHuffmanTable(tables, table, HUFFMAN_TABLE_BITS, code_lengths, alphabet_size); if (table_size === 0) { throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: "); } return table_size; } function ReadBlockLength(table, index, br) { var code; var nbits; code = ReadSymbol(table, index, br); nbits = Prefix.kBlockLengthPrefixCode[code].nbits; return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits); } function TranslateShortCodes(code, ringbuffer, index) { var val; if (code < NUM_DISTANCE_SHORT_CODES) { index += kDistanceShortCodeIndexOffset[code]; index &= 3; val = ringbuffer[index] + kDistanceShortCodeValueOffset[code]; } else { val = code - NUM_DISTANCE_SHORT_CODES + 1; } return val; } function MoveToFront(v, index) { var value = v[index]; var i = index; for (; i; --i) v[i] = v[i - 1]; v[0] = value; } function InverseMoveToFrontTransform(v, v_len) { var mtf = new Uint8Array(256); var i; for (i = 0; i < 256; ++i) { mtf[i] = i; } for (i = 0; i < v_len; ++i) { var index = v[i]; v[i] = mtf[index]; if (index) MoveToFront(mtf, index); } } /* Contains a collection of huffman trees with the same alphabet size. */ function HuffmanTreeGroup(alphabet_size, num_htrees) { this.alphabet_size = alphabet_size; this.num_htrees = num_htrees; this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]); this.htrees = new Uint32Array(num_htrees); } HuffmanTreeGroup.prototype.decode = function(br) { var i; var table_size; var next = 0; for (i = 0; i < this.num_htrees; ++i) { this.htrees[i] = next; table_size = ReadHuffmanCode(this.alphabet_size, this.codes, next, br); next += table_size; } }; function DecodeContextMap(context_map_size, br) { var out = { num_htrees: null, context_map: null }; var use_rle_for_zeros; var max_run_length_prefix = 0; var table; var i; br.readMoreInput(); var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1; var context_map = out.context_map = new Uint8Array(context_map_size); if (num_htrees <= 1) { return out; } use_rle_for_zeros = br.readBits(1); if (use_rle_for_zeros) { max_run_length_prefix = br.readBits(4) + 1; } table = []; for (i = 0; i < HUFFMAN_MAX_TABLE_SIZE; i++) { table[i] = new HuffmanCode(0, 0); } ReadHuffmanCode(num_htrees + max_run_length_prefix, table, 0, br); for (i = 0; i < context_map_size;) { var code; br.readMoreInput(); code = ReadSymbol(table, 0, br); if (code === 0) { context_map[i] = 0; ++i; } else if (code <= max_run_length_prefix) { var reps = 1 + (1 << code) + br.readBits(code); while (--reps) { if (i >= context_map_size) { throw new Error("[DecodeContextMap] i >= context_map_size"); } context_map[i] = 0; ++i; } } else { context_map[i] = code - max_run_length_prefix; ++i; } } if (br.readBits(1)) { InverseMoveToFrontTransform(context_map, context_map_size); } return out; } function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) { var ringbuffer = tree_type * 2; var index = tree_type; var type_code = ReadSymbol(trees, tree_type * HUFFMAN_MAX_TABLE_SIZE, br); var block_type; if (type_code === 0) { block_type = ringbuffers[ringbuffer + (indexes[index] & 1)]; } else if (type_code === 1) { block_type = ringbuffers[ringbuffer + ((indexes[index] - 1) & 1)] + 1; } else { block_type = type_code - 2; } if (block_type >= max_block_type) { block_type -= max_block_type; } block_types[tree_type] = block_type; ringbuffers[ringbuffer + (indexes[index] & 1)] = block_type; ++indexes[index]; } function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) { var rb_size = ringbuffer_mask + 1; var rb_pos = pos & ringbuffer_mask; var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK; var nbytes; /* For short lengths copy byte-by-byte */ if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) { while (len-- > 0) { br.readMoreInput(); ringbuffer[rb_pos++] = br.readBits(8); if (rb_pos === rb_size) { output.write(ringbuffer, rb_size); rb_pos = 0; } } return; } if (br.bit_end_pos_ < 32) { throw new Error('[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32'); } /* Copy remaining 0-4 bytes from br.val_ to ringbuffer. */ while (br.bit_pos_ < 32) { ringbuffer[rb_pos] = (br.val_ >>> br.bit_pos_); br.bit_pos_ += 8; ++rb_pos; --len; } /* Copy remaining bytes from br.buf_ to ringbuffer. */ nbytes = (br.bit_end_pos_ - br.bit_pos_) >> 3; if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) { var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos; for (var x = 0; x < tail; x++) ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; nbytes -= tail; rb_pos += tail; len -= tail; br_pos = 0; } for (var x = 0; x < nbytes; x++) ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; rb_pos += nbytes; len -= nbytes; /* If we wrote past the logical end of the ringbuffer, copy the tail of the ringbuffer to its beginning and flush the ringbuffer to the output. */ if (rb_pos >= rb_size) { output.write(ringbuffer, rb_size); rb_pos -= rb_size; for (var x = 0; x < rb_pos; x++) ringbuffer[x] = ringbuffer[rb_size + x]; } /* If we have more to copy than the remaining size of the ringbuffer, then we first fill the ringbuffer from the input and then flush the ringbuffer to the output */ while (rb_pos + len >= rb_size) { nbytes = rb_size - rb_pos; if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) { throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); } output.write(ringbuffer, rb_size); len -= nbytes; rb_pos = 0; } /* Copy straight from the input onto the ringbuffer. The ringbuffer will be flushed to the output at a later time. */ if (br.input_.read(ringbuffer, rb_pos, len) < len) { throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); } /* Restore the state of the bit reader. */ br.reset(); } /* Advances the bit reader position to the next byte boundary and verifies that any skipped bits are set to zero. */ function JumpToByteBoundary(br) { var new_bit_pos = (br.bit_pos_ + 7) & ~7; var pad_bits = br.readBits(new_bit_pos - br.bit_pos_); return pad_bits == 0; } function BrotliDecompressedSize(buffer) { var input = new BrotliInput(buffer); var br = new BrotliBitReader(input); DecodeWindowBits(br); var out = DecodeMetaBlockLength(br); return out.meta_block_length; } exports.BrotliDecompressedSize = BrotliDecompressedSize; function BrotliDecompressBuffer(buffer, output_size) { var input = new BrotliInput(buffer); if (output_size == null) { output_size = BrotliDecompressedSize(buffer); } var output_buffer = new Uint8Array(output_size); var output = new BrotliOutput(output_buffer); BrotliDecompress(input, output); if (output.pos < output.buffer.length) { output.buffer = output.buffer.subarray(0, output.pos); } return output.buffer; } exports.BrotliDecompressBuffer = BrotliDecompressBuffer; function BrotliDecompress(input, output) { var i; var pos = 0; var input_end = 0; var window_bits = 0; var max_backward_distance; var max_distance = 0; var ringbuffer_size; var ringbuffer_mask; var ringbuffer; var ringbuffer_end; /* This ring buffer holds a few past copy distances that will be used by */ /* some special distance codes. */ var dist_rb = [ 16, 15, 11, 4 ]; var dist_rb_idx = 0; /* The previous 2 bytes used for context. */ var prev_byte1 = 0; var prev_byte2 = 0; var hgroup = [new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0)]; var block_type_trees; var block_len_trees; var br; /* We need the slack region for the following reasons: - always doing two 8-byte copies for fast backward copying - transforms - flushing the input ringbuffer when decoding uncompressed blocks */ var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE; br = new BrotliBitReader(input); /* Decode window size. */ window_bits = DecodeWindowBits(br); max_backward_distance = (1 << window_bits) - 16; ringbuffer_size = 1 << window_bits; ringbuffer_mask = ringbuffer_size - 1; ringbuffer = new Uint8Array(ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength); ringbuffer_end = ringbuffer_size; block_type_trees = []; block_len_trees = []; for (var x = 0; x < 3 * HUFFMAN_MAX_TABLE_SIZE; x++) { block_type_trees[x] = new HuffmanCode(0, 0); block_len_trees[x] = new HuffmanCode(0, 0); } while (!input_end) { var meta_block_remaining_len = 0; var is_uncompressed; var block_length = [ 1 << 28, 1 << 28, 1 << 28 ]; var block_type = [ 0 ]; var num_block_types = [ 1, 1, 1 ]; var block_type_rb = [ 0, 1, 0, 1, 0, 1 ]; var block_type_rb_index = [ 0 ]; var distance_postfix_bits; var num_direct_distance_codes; var distance_postfix_mask; var num_distance_codes; var context_map = null; var context_modes = null; var num_literal_htrees; var dist_context_map = null; var num_dist_htrees; var context_offset = 0; var context_map_slice = null; var literal_htree_index = 0; var dist_context_offset = 0; var dist_context_map_slice = null; var dist_htree_index = 0; var context_lookup_offset1 = 0; var context_lookup_offset2 = 0; var context_mode; var htree_command; for (i = 0; i < 3; ++i) { hgroup[i].codes = null; hgroup[i].htrees = null; } br.readMoreInput(); var _out = DecodeMetaBlockLength(br); meta_block_remaining_len = _out.meta_block_length; if (pos + meta_block_remaining_len > output.buffer.length) { /* We need to grow the output buffer to fit the additional data. */ var tmp = new Uint8Array( pos + meta_block_remaining_len ); tmp.set( output.buffer ); output.buffer = tmp; } input_end = _out.input_end; is_uncompressed = _out.is_uncompressed; if (_out.is_metadata) { JumpToByteBoundary(br); for (; meta_block_remaining_len > 0; --meta_block_remaining_len) { br.readMoreInput(); /* Read one byte and ignore it. */ br.readBits(8); } continue; } if (meta_block_remaining_len === 0) { continue; } if (is_uncompressed) { br.bit_pos_ = (br.bit_pos_ + 7) & ~7; CopyUncompressedBlockToOutput(output, meta_block_remaining_len, pos, ringbuffer, ringbuffer_mask, br); pos += meta_block_remaining_len; continue; } for (i = 0; i < 3; ++i) { num_block_types[i] = DecodeVarLenUint8(br) + 1; if (num_block_types[i] >= 2) { ReadHuffmanCode(num_block_types[i] + 2, block_type_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); ReadHuffmanCode(kNumBlockLengthCodes, block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); block_length[i] = ReadBlockLength(block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); block_type_rb_index[i] = 1; } } br.readMoreInput(); distance_postfix_bits = br.readBits(2); num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits); distance_postfix_mask = (1 << distance_postfix_bits) - 1; num_distance_codes = (num_direct_distance_codes + (48 << distance_postfix_bits)); context_modes = new Uint8Array(num_block_types[0]); for (i = 0; i < num_block_types[0]; ++i) { br.readMoreInput(); context_modes[i] = (br.readBits(2) << 1); } var _o1 = DecodeContextMap(num_block_types[0] << kLiteralContextBits, br); num_literal_htrees = _o1.num_htrees; context_map = _o1.context_map; var _o2 = DecodeContextMap(num_block_types[2] << kDistanceContextBits, br); num_dist_htrees = _o2.num_htrees; dist_context_map = _o2.context_map; hgroup[0] = new HuffmanTreeGroup(kNumLiteralCodes, num_literal_htrees); hgroup[1] = new HuffmanTreeGroup(kNumInsertAndCopyCodes, num_block_types[1]); hgroup[2] = new HuffmanTreeGroup(num_distance_codes, num_dist_htrees); for (i = 0; i < 3; ++i) { hgroup[i].decode(br); } context_map_slice = 0; dist_context_map_slice = 0; context_mode = context_modes[block_type[0]]; context_lookup_offset1 = Context.lookupOffsets[context_mode]; context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; htree_command = hgroup[1].htrees[0]; while (meta_block_remaining_len > 0) { var cmd_code; var range_idx; var insert_code; var copy_code; var insert_length; var copy_length; var distance_code; var distance; var context; var j; var copy_dst; br.readMoreInput(); if (block_length[1] === 0) { DecodeBlockType(num_block_types[1], block_type_trees, 1, block_type, block_type_rb, block_type_rb_index, br); block_length[1] = ReadBlockLength(block_len_trees, HUFFMAN_MAX_TABLE_SIZE, br); htree_command = hgroup[1].htrees[block_type[1]]; } --block_length[1]; cmd_code = ReadSymbol(hgroup[1].codes, htree_command, br); range_idx = cmd_code >> 6; if (range_idx >= 2) { range_idx -= 2; distance_code = -1; } else { distance_code = 0; } insert_code = Prefix.kInsertRangeLut[range_idx] + ((cmd_code >> 3) & 7); copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7); insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset + br.readBits(Prefix.kInsertLengthPrefixCode[insert_code].nbits); copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset + br.readBits(Prefix.kCopyLengthPrefixCode[copy_code].nbits); prev_byte1 = ringbuffer[pos-1 & ringbuffer_mask]; prev_byte2 = ringbuffer[pos-2 & ringbuffer_mask]; for (j = 0; j < insert_length; ++j) { br.readMoreInput(); if (block_length[0] === 0) { DecodeBlockType(num_block_types[0], block_type_trees, 0, block_type, block_type_rb, block_type_rb_index, br); block_length[0] = ReadBlockLength(block_len_trees, 0, br); context_offset = block_type[0] << kLiteralContextBits; context_map_slice = context_offset; context_mode = context_modes[block_type[0]]; context_lookup_offset1 = Context.lookupOffsets[context_mode]; context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; } context = (Context.lookup[context_lookup_offset1 + prev_byte1] | Context.lookup[context_lookup_offset2 + prev_byte2]); literal_htree_index = context_map[context_map_slice + context]; --block_length[0]; prev_byte2 = prev_byte1; prev_byte1 = ReadSymbol(hgroup[0].codes, hgroup[0].htrees[literal_htree_index], br); ringbuffer[pos & ringbuffer_mask] = prev_byte1; if ((pos & ringbuffer_mask) === ringbuffer_mask) { output.write(ringbuffer, ringbuffer_size); } ++pos; } meta_block_remaining_len -= insert_length; if (meta_block_remaining_len <= 0) break; if (distance_code < 0) { var context; br.readMoreInput(); if (block_length[2] === 0) { DecodeBlockType(num_block_types[2], block_type_trees, 2, block_type, block_type_rb, block_type_rb_index, br); block_length[2] = ReadBlockLength(block_len_trees, 2 * HUFFMAN_MAX_TABLE_SIZE, br); dist_context_offset = block_type[2] << kDistanceContextBits; dist_context_map_slice = dist_context_offset; } --block_length[2]; context = (copy_length > 4 ? 3 : copy_length - 2) & 0xff; dist_htree_index = dist_context_map[dist_context_map_slice + context]; distance_code = ReadSymbol(hgroup[2].codes, hgroup[2].htrees[dist_htree_index], br); if (distance_code >= num_direct_distance_codes) { var nbits; var postfix; var offset; distance_code -= num_direct_distance_codes; postfix = distance_code & distance_postfix_mask; distance_code >>= distance_postfix_bits; nbits = (distance_code >> 1) + 1; offset = ((2 + (distance_code & 1)) << nbits) - 4; distance_code = num_direct_distance_codes + ((offset + br.readBits(nbits)) << distance_postfix_bits) + postfix; } } /* Convert the distance code to the actual distance by possibly looking */ /* up past distnaces from the ringbuffer. */ distance = TranslateShortCodes(distance_code, dist_rb, dist_rb_idx); if (distance < 0) { throw new Error('[BrotliDecompress] invalid distance'); } if (pos < max_backward_distance && max_distance !== max_backward_distance) { max_distance = pos; } else { max_distance = max_backward_distance; } copy_dst = pos & ringbuffer_mask; if (distance > max_distance) { if (copy_length >= BrotliDictionary.minDictionaryWordLength && copy_length <= BrotliDictionary.maxDictionaryWordLength) { var offset = BrotliDictionary.offsetsByLength[copy_length]; var word_id = distance - max_distance - 1; var shift = BrotliDictionary.sizeBitsByLength[copy_length]; var mask = (1 << shift) - 1; var word_idx = word_id & mask; var transform_idx = word_id >> shift; offset += word_idx * copy_length; if (transform_idx < Transform.kNumTransforms) { var len = Transform.transformDictionaryWord(ringbuffer, copy_dst, offset, copy_length, transform_idx); copy_dst += len; pos += len; meta_block_remaining_len -= len; if (copy_dst >= ringbuffer_end) { output.write(ringbuffer, ringbuffer_size); for (var _x = 0; _x < (copy_dst - ringbuffer_end); _x++) ringbuffer[_x] = ringbuffer[ringbuffer_end + _x]; } } else { throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len); } } else { throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len); } } else { if (distance_code > 0) { dist_rb[dist_rb_idx & 3] = distance; ++dist_rb_idx; } if (copy_length > meta_block_remaining_len) { throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len); } for (j = 0; j < copy_length; ++j) { ringbuffer[pos & ringbuffer_mask] = ringbuffer[(pos - distance) & ringbuffer_mask]; if ((pos & ringbuffer_mask) === ringbuffer_mask) { output.write(ringbuffer, ringbuffer_size); } ++pos; --meta_block_remaining_len; } } /* When we get here, we must have inserted at least one literal and */ /* made a copy of at least length two, therefore accessing the last 2 */ /* bytes is valid. */ prev_byte1 = ringbuffer[(pos - 1) & ringbuffer_mask]; prev_byte2 = ringbuffer[(pos - 2) & ringbuffer_mask]; } /* Protect pos from overflow, wrap it around at every GB of input data */ pos &= 0x3fffffff; } output.write(ringbuffer, pos & ringbuffer_mask); } exports.BrotliDecompress = BrotliDecompress; BrotliDictionary.init(); },{"./bit_reader":1,"./context":2,"./dictionary":6,"./huffman":7,"./prefix":9,"./streams":10,"./transform":11}],4:[function(require,module,exports){ var base64 = require('base64-js'); //var fs = require('fs'); /** * The normal dictionary-data.js is quite large, which makes it * unsuitable for browser usage. In order to make it smaller, * we read dictionary.bin, which is a compressed version of * the dictionary, and on initial load, Brotli decompresses * it's own dictionary. 😜 */ exports.init = function() { var BrotliDecompressBuffer = require('./decode').BrotliDecompressBuffer; var compressed = base64.toByteArray(require('./dictionary.bin.js')); return BrotliDecompressBuffer(compressed); }; },{"./decode":3,"./dictionary.bin.js":5,"base64-js":8}],5:[function(require,module,exports){ module.exports="W5/fcQLn5gKf2XUbAiQ1XULX+TZz6ADToDsgqk6qVfeC0e4m6OO2wcQ1J76ZBVRV1fRkEsdu//62zQsFEZWSTCnMhcsQKlS2qOhuVYYMGCkV0fXWEoMFbESXrKEZ9wdUEsyw9g4bJlEt1Y6oVMxMRTEVbCIwZzJzboK5j8m4YH02qgXYhv1V+PM435sLVxyHJihaJREEhZGqL03txGFQLm76caGO/ovxKvzCby/3vMTtX/459f0igi7WutnKiMQ6wODSoRh/8Lx1V3Q99MvKtwB6bHdERYRY0hStJoMjNeTsNX7bn+Y7e4EQ3bf8xBc7L0BsyfFPK43dGSXpL6clYC/I328h54/VYrQ5i0648FgbGtl837svJ35L3Mot/+nPlNpWgKx1gGXQYqX6n+bbZ7wuyCHKcUok12Xjqub7NXZGzqBx0SD+uziNf87t7ve42jxSKQoW3nyxVrWIGlFShhCKxjpZZ5MeGna0+lBkk+kaN8F9qFBAFgEogyMBdcX/T1W/WnMOi/7ycWUQloEBKGeC48MkiwqJkJO+12eQiOFHMmck6q/IjWW3RZlany23TBm+cNr/84/oi5GGmGBZWrZ6j+zykVozz5fT/QH/Da6WTbZYYPynVNO7kxzuNN2kxKKWche5WveitPKAecB8YcAHz/+zXLjcLzkdDSktNIDwZE9J9X+tto43oJy65wApM3mDzYtCwX9lM+N5VR3kXYo0Z3t0TtXfgBFg7gU8oN0Dgl7fZlUbhNll+0uuohRVKjrEd8egrSndy5/Tgd2gqjA4CAVuC7ESUmL3DZoGnfhQV8uwnpi8EGvAVVsowNRxPudck7+oqAUDkwZopWqFnW1riss0t1z6iCISVKreYGNvQcXv+1L9+jbP8cd/dPUiqBso2q+7ZyFBvENCkkVr44iyPbtOoOoCecWsiuqMSML5lv+vN5MzUr+Dnh73G7Q1YnRYJVYXHRJaNAOByiaK6CusgFdBPE40r0rvqXV7tksKO2DrHYXBTv8P5ysqxEx8VDXUDDqkPH6NNOV/a2WH8zlkXRELSa8P+heNyJBBP7PgsG1EtWtNef6/i+lcayzQwQCsduidpbKfhWUDgAEmyhGu/zVTacI6RS0zTABrOYueemnVa19u9fT23N/Ta6RvTpof5DWygqreCqrDAgM4LID1+1T/taU6yTFVLqXOv+/MuQOFnaF8vLMKD7tKWDoBdALgxF33zQccCcdHx8fKIVdW69O7qHtXpeGr9jbbpFA+qRMWr5hp0s67FPc7HAiLV0g0/peZlW7hJPYEhZyhpSwahnf93/tZgfqZWXFdmdXBzqxGHLrQKxoAY6fRoBhgCRPmmGueYZ5JexTVDKUIXzkG/fqp/0U3hAgQdJ9zumutK6nqWbaqvm1pgu03IYR+G+8s0jDBBz8cApZFSBeuWasyqo2OMDKAZCozS+GWSvL/HsE9rHxooe17U3s/lTE+VZAk4j3dp6uIGaC0JMiqR5CUsabPyM0dOYDR7Ea7ip4USZlya38YfPtvrX/tBlhHilj55nZ1nfN24AOAi9BVtz/Mbn8AEDJCqJgsVUa6nQnSxv2Fs7l/NlCzpfYEjmPrNyib/+t0ei2eEMjvNhLkHCZlci4WhBe7ePZTmzYqlY9+1pxtS4GB+5lM1BHT9tS270EWUDYFq1I0yY/fNiAk4bk9yBgmef/f2k6AlYQZHsNFnW8wBQxCd68iWv7/35bXfz3JZmfGligWAKRjIs3IpzxQ27vAglHSiOzCYzJ9L9A1CdiyFvyR66ucA4jKifu5ehwER26yV7HjKqn5Mfozo7Coxxt8LWWPT47BeMxX8p0Pjb7hZn+6bw7z3Lw+7653j5sI8CLu5kThpMlj1m4c2ch3jGcP1FsT13vuK3qjecKTZk2kHcOZY40UX+qdaxstZqsqQqgXz+QGF99ZJLqr3VYu4aecl1Ab5GmqS8k/GV5b95zxQ5d4EfXUJ6kTS/CXF/aiqKDOT1T7Jz5z0PwDUcwr9clLN1OJGCiKfqvah+h3XzrBOiLOW8wvn8gW6qE8vPxi+Efv+UH55T7PQFVMh6cZ1pZQlzJpKZ7P7uWvwPGJ6DTlR6wbyj3Iv2HyefnRo/dv7dNx+qaa0N38iBsR++Uil7Wd4afwDNsrzDAK4fXZwvEY/jdKuIKXlfrQd2C39dW7ntnRbIp9OtGy9pPBn/V2ASoi/2UJZfS+xuGLH8bnLuPlzdTNS6zdyk8Dt/h6sfOW5myxh1f+zf3zZ3MX/mO9cQPp5pOx967ZA6/pqHvclNfnUFF+rq+Vd7alKr6KWPcIDhpn6v2K6NlUu6LrKo8b/pYpU/Gazfvtwhn7tEOUuXht5rUJdSf6sLjYf0VTYDgwJ81yaqKTUYej/tbHckSRb/HZicwGJqh1mAHB/IuNs9dc9yuvF3D5Xocm3elWFdq5oEy70dYFit79yaLiNjPj5UUcVmZUVhQEhW5V2Z6Cm4HVH/R8qlamRYwBileuh07CbEce3TXa2JmXWBf+ozt319psboobeZhVnwhMZzOeQJzhpTDbP71Tv8HuZxxUI/+ma3XW6DFDDs4+qmpERwHGBd2edxwUKlODRdUWZ/g0GOezrbzOZauFMai4QU6GVHV6aPNBiBndHSsV4IzpvUiiYyg6OyyrL4Dj5q/Lw3N5kAwftEVl9rNd7Jk5PDij2hTH6wIXnsyXkKePxbmHYgC8A6an5Fob/KH5GtC0l4eFso+VpxedtJHdHpNm+Bvy4C79yVOkrZsLrQ3OHCeB0Ra+kBIRldUGlDCEmq2RwXnfyh6Dz+alk6eftI2n6sastRrGwbwszBeDRS/Fa/KwRJkCzTsLr/JCs5hOPE/MPLYdZ1F1fv7D+VmysX6NpOC8aU9F4Qs6HvDyUy9PvFGDKZ/P5101TYHFl8pjj6wm/qyS75etZhhfg0UEL4OYmHk6m6dO192AzoIyPSV9QedDA4Ml23rRbqxMPMxf7FJnDc5FTElVS/PyqgePzmwVZ26NWhRDQ+oaT7ly7ell4s3DypS1s0g+tOr7XHrrkZj9+x/mJBttrLx98lFIaRZzHz4aC7r52/JQ4VjHahY2/YVXZn/QC2ztQb/sY3uRlyc5vQS8nLPGT/n27495i8HPA152z7Fh5aFpyn1GPJKHuPL8Iw94DuW3KjkURAWZXn4EQy89xiKEHN1mk/tkM4gYDBxwNoYvRfE6LFqsxWJtPrDGbsnLMap3Ka3MUoytW0cvieozOmdERmhcqzG+3HmZv2yZeiIeQTKGdRT4HHNxekm1tY+/n06rGmFleqLscSERzctTKM6G9P0Pc1RmVvrascIxaO1CQCiYPE15bD7c3xSeW7gXxYjgxcrUlcbIvO0r+Yplhx0kTt3qafDOmFyMjgGxXu73rddMHpV1wMubyAGcf/v5dLr5P72Ta9lBF+fzMJrMycwv+9vnU3ANIl1cH9tfW7af8u0/HG0vV47jNFXzFTtaha1xvze/s8KMtCYucXc1nzfd/MQydUXn/b72RBt5wO/3jRcMH9BdhC/yctKBIveRYPrNpDWqBsO8VMmP+WvRaOcA4zRMR1PvSoO92rS7pYEv+fZfEfTMzEdM+6X5tLlyxExhqLRkms5EuLovLfx66de5fL2/yX02H52FPVwahrPqmN/E0oVXnsCKhbi/yRxX83nRbUKWhzYceXOntfuXn51NszJ6MO73pQf5Pl4in3ec4JU8hF7ppV34+mm9r1LY0ee/i1O1wpd8+zfLztE0cqBxggiBi5Bu95v9l3r9r/U5hweLn+TbfxowrWDqdJauKd8+q/dH8sbPkc9ttuyO94f7/XK/nHX46MPFLEb5qQlNPvhJ50/59t9ft3LXu7uVaWaO2bDrDCnRSzZyWvFKxO1+vT8MwwunR3bX0CkfPjqb4K9O19tn5X50PvmYpEwHtiW9WtzuV/s76B1zvLLNkViNd8ySxIl/3orfqP90TyTGaf7/rx8jQzeHJXdmh/N6YDvbvmTBwCdxfEQ1NcL6wNMdSIXNq7b1EUzRy1/Axsyk5p22GMG1b+GxFgbHErZh92wuvco0AuOLXct9hvw2nw/LqIcDRRmJmmZzcgUa7JpM/WV/S9IUfbF56TL2orzqwebdRD8nIYNJ41D/hz37Fo11p2Y21wzPcn713qVGhqtevStYfGH4n69OEJtPvbbLYWvscDqc3Hgnu166+tAyLnxrX0Y5zoYjV++1sI7t5kMr02KT/+uwtkc+rZLOf/qn/s3nYCf13Dg8/sB2diJgjGqjQ+TLhxbzyue2Ob7X6/9lUwW7a+lbznHzOYy8LKW1C/uRPbQY3KW/0gO9LXunHLvPL97afba9bFtc9hmz7GAttjVYlCvQAiOwAk/gC5+hkLEs6tr3AZKxLJtOEwk2dLxTYWsIB/j/ToWtIWzo906FrSG8iaqqqqqqiIiIiAgzMzMzNz+AyK+01/zi8n8S+Y1MjoRaQ80WU/G8MBlO+53VPXANrWm4wzGUVZUjjBJZVdhpcfkjsmcWaO+UEldXi1e+zq+HOsCpknYshuh8pOLISJun7TN0EIGW2xTnlOImeecnoGW4raxe2G1T3HEvfYUYMhG+gAFOAwh5nK8mZhwJMmN7r224QVsNFvZ87Z0qatvknklyPDK3Hy45PgVKXji52Wen4d4PlFVVYGnNap+fSpFbK90rYnhUc6n91Q3AY9E0tJOFrcfZtm/491XbcG/jsViUPPX76qmeuiz+qY1Hk7/1VPM405zWVuoheLUimpWYdVzCmUdKHebMdzgrYrb8mL2eeLSnRWHdonfZa8RsOU9F37w+591l5FLYHiOqWeHtE/lWrBHcRKp3uhtr8yXm8LU/5ms+NM6ZKsqu90cFZ4o58+k4rdrtB97NADFbwmEG7lXqvirhOTOqU14xuUF2myIjURcPHrPOQ4lmM3PeMg7bUuk0nnZi67bXsU6H8lhqIo8TaOrEafCO1ARK9PjC0QOoq2BxmMdgYB9G/lIb9++fqNJ2s7BHGFyBNmZAR8J3KCo012ikaSP8BCrf6VI0X5xdnbhHIO+B5rbOyB54zXkzfObyJ4ecwxfqBJMLFc7m59rNcw7hoHnFZ0b00zee+gTqvjm61Pb4xn0kcDX4jvHM0rBXZypG3DCKnD/Waa/ZtHmtFPgO5eETx+k7RrVg3aSwm2YoNXnCs3XPQDhNn+Fia6IlOOuIG6VJH7TP6ava26ehKHQa2T4N0tcZ9dPCGo3ZdnNltsHQbeYt5vPnJezV/cAeNypdml1vCHI8M81nSRP5Qi2+mI8v/sxiZru9187nRtp3f/42NemcONa+4eVC3PCZzc88aZh851CqSsshe70uPxeN/dmYwlwb3trwMrN1Gq8jbnApcVDx/yDPeYs5/7r62tsQ6lLg+DiFXTEhzR9dHqv0iT4tgj825W+H3XiRUNUZT2kR9Ri0+lp+UM3iQtS8uOE23Ly4KYtvqH13jghUntJRAewuzNLDXp8RxdcaA3cMY6TO2IeSFRXezeWIjCqyhsUdMYuCgYTZSKpBype1zRfq8FshvfBPc6BAQWl7/QxIDp3VGo1J3vn42OEs3qznws+YLRXbymyB19a9XBx6n/owcyxlEYyFWCi+kG9F+EyD/4yn80+agaZ9P7ay2Dny99aK2o91FkfEOY8hBwyfi5uwx2y5SaHmG+oq/zl1FX/8irOf8Y3vAcX/6uLP6A6nvMO24edSGPjQc827Rw2atX+z2bKq0CmW9mOtYnr5/AfDa1ZfPaXnKtlWborup7QYx+Or2uWb+N3N//2+yDcXMqIJdf55xl7/vsj4WoPPlxLxtVrkJ4w/tTe3mLdATOOYwxcq52w5Wxz5MbPdVs5O8/lhfE7dPj0bIiPQ3QV0iqm4m3YX8hRfc6jQ3fWepevMqUDJd86Z4vwM40CWHnn+WphsGHfieF02D3tmZvpWD+kBpNCFcLnZhcmmrhpGzzbdA+sQ1ar18OJD87IOKOFoRNznaHPNHUfUNhvY1iU+uhvEvpKHaUn3qK3exVVyX4joipp3um7FmYJWmA+WbIDshRpbVRx5/nqstCgy87FGbfVB8yDGCqS+2qCsnRwnSAN6zgzxfdB2nBT/vZ4/6uxb6oH8b4VBRxiIB93wLa47hG3w2SL/2Z27yOXJFwZpSJaBYyvajA7vRRYNKqljXKpt/CFD/tSMr18DKKbwB0xggBePatl1nki0yvqW5zchlyZmJ0OTxJ3D+fsYJs/mxYN5+Le5oagtcl+YsVvy8kSjI2YGvGjvmpkRS9W2dtXqWnVuxUhURm1lKtou/hdEq19VBp9OjGvHEQSmrpuf2R24mXGheil8KeiANY8fW1VERUfBImb64j12caBZmRViZHbeVMjCrPDg9A90IXrtnsYCuZtRQ0PyrKDjBNOsPfKsg1pA02gHlVr0OXiFhtp6nJqXVzcbfM0KnzC3ggOENPE9VBdmHKN6LYaijb4wXxJn5A0FSDF5j+h1ooZx885Jt3ZKzO5n7Z5WfNEOtyyPqQEnn7WLv5Fis3PdgMshjF1FRydbNyeBbyKI1oN1TRVrVK7kgsb/zjX4NDPIRMctVeaxVB38Vh1x5KbeJbU138AM5KzmZu3uny0ErygxiJF7GVXUrPzFxrlx1uFdAaZFDN9cvIb74qD9tzBMo7L7WIEYK+sla1DVMHpF0F7b3+Y6S+zjvLeDMCpapmJo1weBWuxKF3rOocih1gun4BoJh1kWnV/Jmiq6uOhK3VfKxEHEkafjLgK3oujaPzY6SXg8phhL4TNR1xvJd1Wa0aYFfPUMLrNBDCh4AuGRTbtKMc6Z1Udj8evY/ZpCuMAUefdo69DZUngoqE1P9A3PJfOf7WixCEj+Y6t7fYeHbbxUAoFV3M89cCKfma3fc1+jKRe7MFWEbQqEfyzO2x/wrO2VYH7iYdQ9BkPyI8/3kXBpLaCpU7eC0Yv/am/tEDu7HZpqg0EvHo0nf/R/gRzUWy33/HXMJQeu1GylKmOkXzlCfGFruAcPPhaGqZOtu19zsJ1SO2Jz4Ztth5cBX6mRQwWmDwryG9FUMlZzNckMdK+IoMJv1rOWnBamS2w2KHiaPMPLC15hCZm4KTpoZyj4E2TqC/P6r7/EhnDMhKicZZ1ZwxuC7DPzDGs53q8gXaI9kFTK+2LTq7bhwsTbrMV8Rsfua5lMS0FwbTitUVnVa1yTb5IX51mmYnUcP9wPr8Ji1tiYJeJV9GZTrQhF7vvdU2OTU42ogJ9FDwhmycI2LIg++03C6scYhUyUuMV5tkw6kGUoL+mjNC38+wMdWNljn6tGPpRES7veqrSn5TRuv+dh6JVL/iDHU1db4c9WK3++OrH3PqziF916UMUKn8G67nN60GfWiHrXYhUG3yVWmyYak59NHj8t1smG4UDiWz2rPHNrKnN4Zo1LBbr2/eF9YZ0n0blx2nG4X+EKFxvS3W28JESD+FWk61VCD3z/URGHiJl++7TdBwkCj6tGOH3qDb0QqcOF9Kzpj0HUb/KyFW3Yhj2VMKJqGZleFBH7vqvf7WqLC3XMuHV8q8a4sTFuxUtkD/6JIBvKaVjv96ndgruKZ1k/BHzqf2K9fLk7HGXANyLDd1vxkK/i055pnzl+zw6zLnwXlVYVtfmacJgEpRP1hbGgrYPVN6v2lG+idQNGmwcKXu/8xEj/P6qe/sB2WmwNp6pp8jaISMkwdleFXYK55NHWLTTbutSUqjBfDGWo/Yg918qQ+8BRZSAHZbfuNZz2O0sov1Ue4CWlVg3rFhM3Kljj9ksGd/NUhk4nH+a5UN2+1i8+NM3vRNp7uQ6sqexSCukEVlVZriHNqFi5rLm9TMWa4qm3idJqppQACol2l4VSuvWLfta4JcXy3bROPNbXOgdOhG47LC0CwW/dMlSx4Jf17aEU3yA1x9p+Yc0jupXgcMuYNku64iYOkGToVDuJvlbEKlJqsmiHbvNrIVZEH+yFdF8DbleZ6iNiWwMqvtMp/mSpwx5KxRrT9p3MAPTHGtMbfvdFhyj9vhaKcn3At8Lc16Ai+vBcSp1ztXi7rCJZx/ql7TXcclq6Q76UeKWDy9boS0WHIjUuWhPG8LBmW5y2rhuTpM5vsLt+HOLh1Yf0DqXa9tsfC+kaKt2htA0ai/L2i7RKoNjEwztkmRU0GfgW1TxUvPFhg0V7DdfWJk5gfrccpYv+MA9M0dkGTLECeYwUixRzjRFdmjG7zdZIl3XKB9YliNKI31lfa7i2JG5C8Ss+rHe0D7Z696/V3DEAOWHnQ9yNahMUl5kENWS6pHKKp2D1BaSrrHdE1w2qNxIztpXgUIrF0bm15YML4b6V1k+GpNysTahKMVrrS85lTVo9OGJ96I47eAy5rYWpRf/mIzeoYU1DKaQCTUVwrhHeyNoDqHel+lLxr9WKzhSYw7vrR6+V5q0pfi2k3L1zqkubY6rrd9ZLvSuWNf0uqnkY+FpTvFzSW9Fp0b9l8JA7THV9eCi/PY/SCZIUYx3BU2alj7Cm3VV6eYpios4b6WuNOJdYXUK3zTqj5CVG2FqYM4Z7CuIU0qO05XR0d71FHM0YhZmJmTRfLlXEumN82BGtzdX0S19t1e+bUieK8zRmqpa4Qc5TSjifmaQsY2ETLjhI36gMR1+7qpjdXXHiceUekfBaucHShAOiFXmv3sNmGQyU5iVgnoocuonQXEPTFwslHtS8R+A47StI9wj0iSrtbi5rMysczFiImsQ+bdFClnFjjpXXwMy6O7qfjOr8Fb0a7ODItisjnn3EQO16+ypd1cwyaAW5Yzxz5QknfMO7643fXW/I9y3U2xH27Oapqr56Z/tEzglj6IbT6HEHjopiXqeRbe5mQQvxtcbDOVverN0ZgMdzqRYRjaXtMRd56Q4cZSmdPvZJdSrhJ1D9zNXPqAEqPIavPdfubt5oke2kmv0dztIszSv2VYuoyf1UuopbsYb+uX9h6WpwjpgtZ6fNNawNJ4q8O3CFoSbioAaOSZMx2GYaPYB+rEb6qjQiNRFQ76TvwNFVKD+BhH9VhcKGsXzmMI7BptU/CNWolM7YzROvpFAntsiWJp6eR2d3GarcYShVYSUqhmYOWj5E96NK2WvmYNTeY7Zs4RUEdv9h9QT4EseKt6LzLrqEOs3hxAY1MaNWpSa6zZx8F3YOVeCYMS88W+CYHDuWe4yoc6YK+djDuEOrBR5lvh0r+Q9uM88lrjx9x9AtgpQVNE8r+3O6Gvw59D+kBF/UMXyhliYUtPjmvXGY6Dk3x+kEOW+GtdMVC4EZTqoS/jmR0P0LS75DOc/w2vnri97M4SdbZ8qeU7gg8DVbERkU5geaMQO3mYrSYyAngeUQqrN0C0/vsFmcgWNXNeidsTAj7/4MncJR0caaBUpbLK1yBCBNRjEv6KvuVSdpPnEMJdsRRtqJ+U8tN1gXA4ePHc6ZT0eviI73UOJF0fEZ8YaneAQqQdGphNvwM4nIqPnXxV0xA0fnCT+oAhJuyw/q8jO0y8CjSteZExwBpIN6SvNp6A5G/abi6egeND/1GTguhuNjaUbbnSbGd4L8937Ezm34Eyi6n1maeOBxh3PI0jzJDf5mh/BsLD7F2GOKvlA/5gtvxI3/eV4sLfKW5Wy+oio+es/u6T8UU+nsofy57Icb/JlZHPFtCgd/x+bwt3ZT+xXTtTtTrGAb4QehC6X9G+8YT+ozcLxDsdCjsuOqwPFnrdLYaFc92Ui0m4fr39lYmlCaqTit7G6O/3kWDkgtXjNH4BiEm/+jegQnihOtfffn33WxsFjhfMd48HT+f6o6X65j7XR8WLSHMFkxbvOYsrRsF1bowDuSQ18Mkxk4qz2zoGPL5fu9h2Hqmt1asl3Q3Yu3szOc+spiCmX4AETBM3pLoTYSp3sVxahyhL8eC4mPN9k2x3o0xkiixIzM3CZFzf5oR4mecQ5+ax2wCah3/crmnHoqR0+KMaOPxRif1oEFRFOO/kTPPmtww+NfMXxEK6gn6iU32U6fFruIz8Q4WgljtnaCVTBgWx7diUdshC9ZEa5yKpRBBeW12r/iNc/+EgNqmhswNB8SBoihHXeDF7rrWDLcmt3V8GYYN7pXRy4DZjj4DJuUBL5iC3DQAaoo4vkftqVTYRGLS3mHZ7gdmdTTqbgNN/PTdTCOTgXolc88MhXAEUMdX0iy1JMuk5wLsgeu0QUYlz2S4skTWwJz6pOm/8ihrmgGfFgri+ZWUK2gAPHgbWa8jaocdSuM4FJYoKicYX/ZSENkg9Q1ZzJfwScfVnR2DegOGwCvmogaWJCLQepv9WNlU6QgsmOwICquU28Mlk3d9W5E81lU/5Ez0LcX6lwKMWDNluNKfBDUy/phJgBcMnfkh9iRxrdOzgs08JdPB85Lwo+GUSb4t3nC+0byqMZtO2fQJ4U2zGIr49t/28qmmGv2RanDD7a3FEcdtutkW8twwwlUSpb8QalodddbBfNHKDQ828BdE7OBgFdiKYohLawFYqpybQoxATZrheLhdI7+0Zlu9Q1myRcd15r9UIm8K2LGJxqTegntqNVMKnf1a8zQiyUR1rxoqjiFxeHxqFcYUTHfDu7rhbWng6qOxOsI+5A1p9mRyEPdVkTlE24vY54W7bWc6jMgZvNXdfC9/9q7408KDsbdL7Utz7QFSDetz2picArzrdpL8OaCHC9V26RroemtDZ5yNM/KGkWMyTmfnInEvwtSD23UcFcjhaE3VKzkoaEMKGBft4XbIO6forTY1lmGQwVmKicBCiArDzE+1oIxE08fWeviIOD5TznqH+OoHadvoOP20drMPe5Irg3XBQziW2XDuHYzjqQQ4wySssjXUs5H+t3FWYMHppUnBHMx/nYIT5d7OmjDbgD9F6na3m4l7KdkeSO3kTEPXafiWinogag7b52taiZhL1TSvBFmEZafFq2H8khQaZXuitCewT5FBgVtPK0j4xUHPfUz3Q28eac1Z139DAP23dgki94EC8vbDPTQC97HPPSWjUNG5tWKMsaxAEMKC0665Xvo1Ntd07wCLNf8Q56mrEPVpCxlIMVlQlWRxM3oAfpgIc+8KC3rEXUog5g06vt7zgXY8grH7hhwVSaeuvC06YYRAwpbyk/Unzj9hLEZNs2oxPQB9yc+GnL6zTgq7rI++KDJwX2SP8Sd6YzTuw5lV/kU6eQxRD12omfQAW6caTR4LikYkBB1CMOrvgRr/VY75+NSB40Cni6bADAtaK+vyxVWpf9NeKJxN2KYQ8Q2xPB3K1s7fuhvWbr2XpgW044VD6DRs0qXoqKf1NFsaGvKJc47leUV3pppP/5VTKFhaGuol4Esfjf5zyCyUHmHthChcYh4hYLQF+AFWsuq4t0wJyWgdwQVOZiV0efRHPoK5+E1vjz9wTJmVkITC9oEstAsyZSgE/dbicwKr89YUxKZI+owD205Tm5lnnmDRuP/JnzxX3gMtlrcX0UesZdxyQqYQuEW4R51vmQ5xOZteUd8SJruMlTUzhtVw/Nq7eUBcqN2/HVotgfngif60yKEtoUx3WYOZlVJuJOh8u59fzSDPFYtQgqDUAGyGhQOAvKroXMcOYY0qjnStJR/G3aP+Jt1sLVlGV8POwr/6OGsqetnyF3TmTqZjENfnXh51oxe9qVUw2M78EzAJ+IM8lZ1MBPQ9ZWSVc4J3mWSrLKrMHReA5qdGoz0ODRsaA+vwxXA2cAM4qlfzBJA6581m4hzxItQw5dxrrBL3Y6kCbUcFxo1S8jyV44q//+7ASNNudZ6xeaNOSIUffqMn4A9lIjFctYn2gpEPAb3f7p3iIBN8H14FUGQ9ct2hPsL+cEsTgUrR47uJVN4n4wt/wgfwwHuOnLd4yobkofy8JvxSQTA7rMpDIc608SlZFJfZYcmbT0tAHpPE8MrtQ42siTUNWxqvWZOmvu9f0JPoQmg+6l7sZWwyfi6PXkxJnwBraUG0MYG4zYHQz3igy/XsFkx5tNQxw43qvI9dU3f0DdhOUlHKjmi1VAr2Kiy0HZwD8VeEbhh0OiDdMYspolQsYdSwjCcjeowIXNZVUPmL2wwIkYhmXKhGozdCJ4lRKbsf4NBh/XnQoS92NJEWOVOFs2YhN8c5QZFeK0pRdAG40hqvLbmoSA8xQmzOOEc7wLcme9JOsjPCEgpCwUs9E2DohMHRhUeyGIN6TFvrbny8nDuilsDpzrH5mS76APoIEJmItS67sQJ+nfwddzmjPxcBEBBCw0kWDwd0EZCkNeOD7NNQhtBm7KHL9mRxj6U1yWU2puzlIDtpYxdH4ZPeXBJkTGAJfUr/oTCz/iypY6uXaR2V1doPxJYlrw2ghH0D5gbrhFcIxzYwi4a/4hqVdf2DdxBp6vGYDjavxMAAoy+1+3aiO6S3W/QAKNVXagDtvsNtx7Ks+HKgo6U21B+QSZgIogV5Bt+BnXisdVfy9VyXV+2P5fMuvdpAjM1o/K9Z+XnE4EOCrue+kcdYHqAQ0/Y/OmNlQ6OI33jH/uD1RalPaHpJAm2av0/xtpqdXVKNDrc9F2izo23Wu7firgbURFDNX9eGGeYBhiypyXZft2j3hTvzE6PMWKsod//rEILDkzBXfi7xh0eFkfb3/1zzPK/PI5Nk3FbZyTl4mq5BfBoVoqiPHO4Q4QKZAlrQ3MdNfi3oxIjvsM3kAFv3fdufurqYR3PSwX/mpGy/GFI/B2MNPiNdOppWVbs/gjF3YH+QA9jMhlAbhvasAHstB0IJew09iAkmXHl1/TEj+jvHOpOGrPRQXbPADM+Ig2/OEcUcpgPTItMtW4DdqgfYVI/+4hAFWYjUGpOP/UwNuB7+BbKOcALbjobdgzeBQfjgNSp2GOpxzGLj70Vvq5cw2AoYENwKLUtJUX8sGRox4dVa/TN4xKwaKcl9XawQR/uNus700Hf17pyNnezrUgaY9e4MADhEDBpsJT6y1gDJs1q6wlwGhuUzGR7C8kgpjPyHWwsvrf3yn1zJEIRa5eSxoLAZOCR9xbuztxFRJW9ZmMYfCFJ0evm9F2fVnuje92Rc4Pl6A8bluN8MZyyJGZ0+sNSb//DvAFxC2BqlEsFwccWeAl6CyBcQV1bx4mQMBP1Jxqk1EUADNLeieS2dUFbQ/c/kvwItbZ7tx0st16viqd53WsRmPTKv2AD8CUnhtPWg5aUegNpsYgasaw2+EVooeNKmrW3MFtj76bYHJm5K9gpAXZXsE5U8DM8XmVOSJ1F1WnLy6nQup+jx52bAb+rCq6y9WXl2B2oZDhfDkW7H3oYfT/4xx5VncBuxMXP2lNfhUVQjSSzSRbuZFE4vFawlzveXxaYKVs8LpvAb8IRYF3ZHiRnm0ADeNPWocwxSzNseG7NrSEVZoHdKWqaGEBz1N8Pt7kFbqh3LYmAbm9i1IChIpLpM5AS6mr6OAPHMwwznVy61YpBYX8xZDN/a+lt7n+x5j4bNOVteZ8lj3hpAHSx1VR8vZHec4AHO9XFCdjZ9eRkSV65ljMmZVzaej2qFn/qt1lvWzNZEfHxK3qOJrHL6crr0CRzMox5f2e8ALBB4UGFZKA3tN6F6IXd32GTJXGQ7DTi9j/dNcLF9jCbDcWGKxoKTYblIwbLDReL00LRcDPMcQuXLMh5YzgtfjkFK1DP1iDzzYYVZz5M/kWYRlRpig1htVRjVCknm+h1M5LiEDXOyHREhvzCGpFZjHS0RsK27o2avgdilrJkalWqPW3D9gmwV37HKmfM3F8YZj2ar+vHFvf3B8CRoH4kDHIK9mrAg+owiEwNjjd9V+FsQKYR8czJrUkf7Qoi2YaW6EVDZp5zYlqiYtuXOTHk4fAcZ7qBbdLDiJq0WNV1l2+Hntk1mMWvxrYmc8kIx8G3rW36J6Ra4lLrTOCgiOihmow+YnzUT19jbV2B3RWqSHyxkhmgsBqMYWvOcUom1jDQ436+fcbu3xf2bbeqU/ca+C4DOKE+e3qvmeMqW3AxejfzBRFVcwVYPq4L0APSWWoJu+5UYX4qg5U6YTioqQGPG9XrnuZ/BkxuYpe6Li87+18EskyQW/uA+uk2rpHpr6hut2TlVbKgWkFpx+AZffweiw2+VittkEyf/ifinS/0ItRL2Jq3tQOcxPaWO2xrG68GdFoUpZgFXaP2wYVtRc6xYCfI1CaBqyWpg4bx8OHBQwsV4XWMibZZ0LYjWEy2IxQ1mZrf1/UNbYCJplWu3nZ4WpodIGVA05d+RWSS+ET9tH3RfGGmNI1cIY7evZZq7o+a0bjjygpmR3mVfalkT/SZGT27Q8QGalwGlDOS9VHCyFAIL0a1Q7JiW3saz9gqY8lqKynFrPCzxkU4SIfLc9VfCI5edgRhDXs0edO992nhTKHriREP1NJC6SROMgQ0xO5kNNZOhMOIT99AUElbxqeZF8A3xrfDJsWtDnUenAHdYWSwAbYjFqQZ+D5gi3hNK8CSxU9i6f6ClL9IGlj1OPMQAsr84YG6ijsJpCaGWj75c3yOZKBB9mNpQNPUKkK0D6wgLH8MGoyRxTX6Y05Q4AnYNXMZwXM4eij/9WpsM/9CoRnFQXGR6MEaY+FXvXEO3RO0JaStk6OXuHVATHJE+1W+TU3bSZ2ksMtqjO0zfSJCdBv7y2d8DMx6TfVme3q0ZpTKMMu4YL/t7ciTNtdDkwPogh3Cnjx7qk08SHwf+dksZ7M2vCOlfsF0hQ6J4ehPCaHTNrM/zBSOqD83dBEBCW/F/LEmeh0nOHd7oVl3/Qo/9GUDkkbj7yz+9cvvu+dDAtx8NzCDTP4iKdZvk9MWiizvtILLepysflSvTLFBZ37RLwiriqyRxYv/zrgFd/9XVHh/OmzBvDX4mitMR/lUavs2Vx6cR94lzAkplm3IRNy4TFfu47tuYs9EQPIPVta4P64tV+sZ7n3ued3cgEx2YK+QL5+xms6osk8qQbTyuKVGdaX9FQqk6qfDnT5ykxk0VK7KZ62b6DNDUfQlqGHxSMKv1P0XN5BqMeKG1P4Wp5QfZDUCEldppoX0U6ss2jIko2XpURKCIhfaOqLPfShdtS37ZrT+jFRSH2xYVV1rmT/MBtRQhxiO4MQ3iAGlaZi+9PWBEIXOVnu9jN1f921lWLZky9bqbM3J2MAAI9jmuAx3gyoEUa6P2ivs0EeNv/OR+AX6q5SW6l5HaoFuS6jr6yg9limu+P0KYKzfMXWcQSfTXzpOzKEKpwI3YGXZpSSy2LTlMgfmFA3CF6R5c9xWEtRuCg2ZPUQ2Nb6dRFTNd4TfGHrnEWSKHPuRyiJSDAZ+KX0VxmSHjGPbQTLVpqixia2uyhQ394gBMt7C3ZAmxn/DJS+l1fBsAo2Eir/C0jG9csd4+/tp12pPc/BVJGaK9mfvr7M/CeztrmCO5qY06Edi4xAGtiEhnWAbzLy2VEyazE1J5nPmgU4RpW4Sa0TnOT6w5lgt3/tMpROigHHmexBGAMY0mdcDbDxWIz41NgdD6oxgHsJRgr5RnT6wZAkTOcStU4NMOQNemSO7gxGahdEsC+NRVGxMUhQmmM0llWRbbmFGHzEqLM4Iw0H7577Kyo+Zf+2cUFIOw93gEY171vQaM0HLwpjpdRR6Jz7V0ckE7XzYJ0TmY9znLdzkva0vNrAGGT5SUZ5uaHDkcGvI0ySpwkasEgZPMseYcu85w8HPdSNi+4T6A83iAwDbxgeFcB1ZM2iGXzFcEOUlYVrEckaOyodfvaYSQ7GuB4ISE0nYJc15X/1ciDTPbPCgYJK55VkEor4LvzL9S2WDy4xj+6FOqVyTAC2ZNowheeeSI5hA/02l8UYkv4nk9iaVn+kCVEUstgk5Hyq+gJm6R9vG3rhuM904he/hFmNQaUIATB1y3vw+OmxP4X5Yi6A5I5jJufHCjF9+AGNwnEllZjUco6XhsO5T5+R3yxz5yLVOnAn0zuS+6zdj0nTJbEZCbXJdtpfYZfCeCOqJHoE2vPPFS6eRLjIJlG69X93nfR0mxSFXzp1Zc0lt/VafDaImhUMtbnqWVb9M4nGNQLN68BHP7AR8Il9dkcxzmBv8PCZlw9guY0lurbBsmNYlwJZsA/B15/HfkbjbwPddaVecls/elmDHNW2r4crAx43feNkfRwsaNq/yyJ0d/p5hZ6AZajz7DBfUok0ZU62gCzz7x8eVfJTKA8IWn45vINLSM1q+HF9CV9qF3zP6Ml21kPPL3CXzkuYUlnSqT+Ij4tI/od5KwIs+tDajDs64owN7tOAd6eucGz+KfO26iNcBFpbWA5732bBNWO4kHNpr9D955L61bvHCF/mwSrz6eQaDjfDEANqGMkFc+NGxpKZzCD2sj/JrHd+zlPQ8Iz7Q+2JVIiVCuCKoK/hlAEHzvk/Piq3mRL1rT/fEh9hoT5GJmeYswg1otiKydizJ/fS2SeKHVu6Z3JEHjiW8NaTQgP5xdBli8nC57XiN9hrquBu99hn9zqwo92+PM2JXtpeVZS0PdqR5mDyDreMMtEws+CpwaRyyzoYtfcvt9PJIW0fJVNNi/FFyRsea7peLvJrL+5b4GOXJ8tAr+ATk9f8KmiIsRhqRy0vFzwRV3Z5dZ3QqIU8JQ/uQpkJbjMUMFj2F9sCFeaBjI4+fL/oN3+LQgjI4zuAfQ+3IPIPFQBccf0clJpsfpnBxD84atwtupkGqKvrH7cGNl/QcWcSi6wcVDML6ljOgYbo+2BOAWNNjlUBPiyitUAwbnhFvLbnqw42kR3Yp2kv2dMeDdcGOX5kT4S6M44KHEB/SpCfl7xgsUvs+JNY9G3O2X/6FEt9FyAn57lrbiu+tl83sCymSvq9eZbe9mchL7MTf/Ta78e80zSf0hYY5eUU7+ff14jv7Xy8qjzfzzzvaJnrIdvFb5BLWKcWGy5/w7+vV2cvIfwHqdTB+RuJK5oj9mbt0Hy94AmjMjjwYNZlNS6uiyxNnwNyt3gdreLb64p/3+08nXkb92LTkkRgFOwk1oGEVllcOj5lv1hfAZywDows0944U8vUFw+A/nuVq/UCygsrmWIBnHyU01d0XJPwriEOvx/ISK6Pk4y2w0gmojZs7lU8TtakBAdne4v/aNxmMpK4VcGMp7si0yqsiolXRuOi1Z1P7SqD3Zmp0CWcyK4Ubmp2SXiXuI5nGLCieFHKHNRIlcY3Pys2dwMTYCaqlyWSITwr2oGXvyU3h1Pf8eQ3w1bnD7ilocVjYDkcXR3Oo1BXgMLTUjNw2xMVwjtp99NhSVc5aIWrDQT5DHPKtCtheBP4zHcw4dz2eRdTMamhlHhtfgqJJHI7NGDUw1XL8vsSeSHyKqDtqoAmrQqsYwvwi7HW3ojWyhIa5oz5xJTaq14NAzFLjVLR12rRNUQ6xohDnrWFb5bG9yf8aCD8d5phoackcNJp+Dw3Due3RM+5Rid7EuIgsnwgpX0rUWh/nqPtByMhMZZ69NpgvRTKZ62ViZ+Q7Dp5r4K0d7EfJuiy06KuIYauRh5Ecrhdt2QpTS1k1AscEHvapNbU3HL1F2TFyR33Wxb5MvH5iZsrn3SDcsxlnnshO8PLwmdGN+paWnQuORtZGX37uhFT64SeuPsx8UOokY6ON85WdQ1dki5zErsJGazcBOddWJEKqNPiJpsMD1GrVLrVY+AOdPWQneTyyP1hRX/lMM4ZogGGOhYuAdr7F/DOiAoc++cn5vlf0zkMUJ40Z1rlgv9BelPqVOpxKeOpzKdF8maK+1Vv23MO9k/8+qpLoxrIGH2EDQlnGmH8CD31G8QqlyQIcpmR5bwmSVw9/Ns6IHgulCRehvZ/+VrM60Cu/r3AontFfrljew74skYe2uyn7JKQtFQBQRJ9ryGic/zQOsbS4scUBctA8cPToQ3x6ZBQu6DPu5m1bnCtP8TllLYA0UTQNVqza5nfew3Mopy1GPUwG5jsl0OVXniPmAcmLqO5HG8Hv3nSLecE9oOjPDXcsTxoCBxYyzBdj4wmnyEV4kvFDunipS8SSkvdaMnTBN9brHUR8xdmmEAp/Pdqk9uextp1t+JrtXwpN/MG2w/qhRMpSNxQ1uhg/kKO30eQ/FyHUDkWHT8V6gGRU4DhDMxZu7xXij9Ui6jlpWmQCqJg3FkOTq3WKneCRYZxBXMNAVLQgHXSCGSqNdjebY94oyIpVjMYehAiFx/tqzBXFHZaL5PeeD74rW5OysFoUXY8sebUZleFTUa/+zBKVTFDopTReXNuZq47QjkWnxjirCommO4L/GrFtVV21EpMyw8wyThL5Y59d88xtlx1g1ttSICDwnof6lt/6zliPzgVUL8jWBjC0o2D6Kg+jNuThkAlaDJsq/AG2aKA//A76avw2KNqtv223P+Wq3StRDDNKFFgtsFukYt1GFDWooFVXitaNhb3RCyJi4cMeNjROiPEDb4k+G3+hD8tsg+5hhmSc/8t2JTSwYoCzAI75doq8QTHe+E/Tw0RQSUDlU+6uBeNN3h6jJGX/mH8oj0i3caCNsjvTnoh73BtyZpsflHLq6AfwJNCDX4S98h4+pCOhGKDhV3rtkKHMa3EG4J9y8zFWI4UsfNzC/Rl5midNn7gwoN9j23HGCQQ+OAZpTTPMdiVow740gIyuEtd0qVxMyNXhHcnuXRKdw5wDUSL358ktjMXmAkvIB73BLa1vfF9BAUZInPYJiwxqFWQQBVk7gQH4ojfUQ/KEjn+A/WR6EEe4CtbpoLe1mzHkajgTIoE0SLDHVauKhrq12zrAXBGbPPWKCt4DGedq3JyGRbmPFW32bE7T20+73BatV/qQhhBWfWBFHfhYWXjALts38FemnoT+9bn1jDBMcUMmYgSc0e7GQjv2MUBwLU8ionCpgV+Qrhg7iUIfUY6JFxR0Y+ZTCPM+rVuq0GNLyJXX6nrUTt8HzFBRY1E/FIm2EeVA9NcXrj7S6YYIChVQCWr/m2fYUjC4j0XLkzZ8GCSLfmkW3PB/xq+nlXsKVBOj7vTvqKCOMq7Ztqr3cQ+N8gBnPaAps+oGwWOkbuxnRYj/x/WjiDclVrs22xMK4qArE1Ztk1456kiJriw6abkNeRHogaPRBgbgF9Z8i/tbzWELN4CvbqtrqV9TtGSnmPS2F9kqOIBaazHYaJ9bi3AoDBvlZasMluxt0BDXfhp02Jn411aVt6S4TUB8ZgFDkI6TP6gwPY85w+oUQSsjIeXVminrwIdK2ZAawb8Se6XOJbOaliQxHSrnAeONDLuCnFejIbp4YDtBcQCwMsYiRZfHefuEJqJcwKTTJ8sx5hjHmJI1sPFHOr6W9AhZ2NAod38mnLQk1gOz2LCAohoQbgMbUK9RMEA3LkiF7Sr9tLZp6lkciIGhE2V546w3Mam53VtVkGbB9w0Yk2XiRnCmbpxmHr2k4eSC0RuNbjNsUfDIfc8DZvRvgUDe1IlKdZTzcT4ZGEb53dp8VtsoZlyXzLHOdAbsp1LPTVaHvLA0GYDFMbAW/WUBfUAdHwqLFAV+3uHvYWrCfhUOR2i89qvCBoOb48usAGdcF2M4aKn79k/43WzBZ+xR1L0uZfia70XP9soQReeuhZiUnXFDG1T8/OXNmssTSnYO+3kVLAgeiY719uDwL9FQycgLPessNihMZbAKG7qwPZyG11G1+ZA3jAX2yddpYfmaKBlmfcK/V0mwIRUDC0nJSOPUl2KB8h13F4dlVZiRhdGY5farwN+f9hEb1cRi41ZcGDn6Xe9MMSTOY81ULJyXIHSWFIQHstVYLiJEiUjktlHiGjntN5/btB8Fu+vp28zl2fZXN+dJDyN6EXhS+0yzqpl/LSJNEUVxmu7BsNdjAY0jVsAhkNuuY0E1G48ej25mSt+00yPbQ4SRCVkIwb6ISvYtmJRPz9Zt5dk76blf+lJwAPH5KDF+vHAmACLoCdG2Adii6dOHnNJnTmZtoOGO8Q1jy1veMw6gbLFToQmfJa7nT7Al89mRbRkZZQxJTKgK5Kc9INzmTJFp0tpAPzNmyL/F08bX3nhCumM/cR/2RPn9emZ3VljokttZD1zVWXlUIqEU7SLk5I0lFRU0AcENXBYazNaVzsVHA/sD3o9hm42wbHIRb/BBQTKzAi8s3+bMtpOOZgLdQzCYPfX3UUxKd1WYVkGH7lh/RBBgMZZwXzU9+GYxdBqlGs0LP+DZ5g2BWNh6FAcR944B+K/JTWI3t9YyVyRhlP4CCoUk/mmF7+r2pilVBjxXBHFaBfBtr9hbVn2zDuI0kEOG3kBx8CGdPOjX1ph1POOZJUO1JEGG0jzUy2tK4X0CgVNYhmkqqQysRNtKuPdCJqK3WW57kaV17vXgiyPrl4KEEWgiGF1euI4QkSFHFf0TDroQiLNKJiLbdhH0YBhriRNCHPxSqJmNNoketaioohqMglh6wLtEGWSM1EZbQg72h0UJAIPVFCAJOThpQGGdKfFovcwEeiBuZHN2Ob4uVM7+gwZLz1D9E7ta4RmMZ24OBBAg7Eh6dLXGofZ4U2TFOCQMKjwhVckjrydRS+YaqCw1kYt6UexuzbNEDyYLTZnrY1PzsHZJT4U+awO2xlqTSYu6n/U29O2wPXgGOEKDMSq+zTUtyc8+6iLp0ivav4FKx+xxVy4FxhIF/pucVDqpsVe2jFOfdZhTzLz2QjtzvsTCvDPU7bzDH2eXVKUV9TZ+qFtaSSxnYgYdXKwVreIgvWhT9eGDB2OvnWyPLfIIIfNnfIxU8nW7MbcH05nhlsYtaW9EZRsxWcKdEqInq1DiZPKCz7iGmAU9/ccnnQud2pNgIGFYOTAWjhIrd63aPDgfj8/sdlD4l+UTlcxTI9jbaMqqN0gQxSHs60IAcW3cH4p3V1aSciTKB29L1tz2eUQhRiTgTvmqc+sGtBNh4ky0mQJGsdycBREP+fAaSs1EREDVo5gvgi5+aCN7NECw30owbCc1mSpjiahyNVwJd1jiGgzSwfTpzf2c5XJvG/g1n0fH88KHNnf+u7ZiRMlXueSIsloJBUtW9ezvsx9grfsX/FNxnbxU1Lvg0hLxixypHKGFAaPu0xCD8oDTeFSyfRT6s8109GMUZL8m2xXp8X2dpPCWWdX84iga4BrTlOfqox4shqEgh/Ht4qRst52cA1xOIUuOxgfUivp6v5f8IVyaryEdpVk72ERAwdT4aoY1usBgmP+0m06Q216H/nubtNYxHaOIYjcach3A8Ez/zc0KcShhel0HCYjFsA0FjYqyJ5ZUH1aZw3+zWC0hLpM6GDfcAdn9fq2orPmZbW6XXrf+Krc9RtvII5jeD3dFoT1KwZJwxfUMvc5KLfn8rROW23Jw89sJ2a5dpB3qWDUBWF2iX8OCuKprHosJ2mflBR+Wqs86VvgI/XMnsqb97+VlKdPVysczPj8Jhzf+WCvGBHijAqYlavbF60soMWlHbvKT+ScvhprgeTln51xX0sF+Eadc/l2s2a5BgkVbHYyz0E85p0LstqH+gEGiR84nBRRFIn8hLSZrGwqjZ3E29cuGi+5Z5bp7EM8MWFa9ssS/vy4VrDfECSv7DSU84DaP0sXI3Ap4lWznQ65nQoTKRWU30gd7Nn8ZowUvGIx4aqyXGwmA/PB4qN8msJUODezUHEl0VP9uo+cZ8vPFodSIB4C7lQYjEFj8yu49C2KIV3qxMFYTevG8KqAr0TPlkbzHHnTpDpvpzziAiNFh8xiT7C/TiyH0EguUw4vxAgpnE27WIypV+uFN2zW7xniF/n75trs9IJ5amB1zXXZ1LFkJ6GbS/dFokzl4cc2mamVwhL4XU0Av5gDWAl+aEWhAP7t2VIwU+EpvfOPDcLASX7H7lZpXA2XQfbSlD4qU18NffNPoAKMNSccBfO9YVVgmlW4RydBqfHAV7+hrZ84WJGho6bNT0YMhxxLdOx/dwGj0oyak9aAkNJ8lRJzUuA8sR+fPyiyTgUHio5+Pp+YaKlHrhR41jY5NESPS3x+zTMe0S2HnLOKCOQPpdxKyviBvdHrCDRqO+l96HhhNBLXWv4yEMuEUYo8kXnYJM8oIgVM4XJ+xXOev4YbWeqsvgq0lmw4/PiYr9sYLt+W5EAuYSFnJEan8CwJwbtASBfLBBpJZiRPor/aCJBZsM+MhvS7ZepyHvU8m5WSmaZnxuLts8ojl6KkS8oSAHkq5GWlCB/NgJ5W3rO2Cj1MK7ahxsCrbTT3a0V/QQH+sErxV4XUWDHx0kkFy25bPmBMBQ6BU3HoHhhYcJB9JhP6NXUWKxnE0raXHB6U9KHpWdQCQI72qevp5fMzcm+AvC85rsynVQhruDA9fp9COe7N56cg1UKGSas89vrN+WlGLYTwi5W+0xYdKEGtGCeNJwXKDU0XqU5uQYnWsMwTENLGtbQMvoGjIFIEMzCRal4rnBAg7D/CSn8MsCvS+FDJJAzoiioJEhZJgAp9n2+1Yznr7H+6eT4YkJ9Mpj60ImcW4i4iHDLn9RydB8dx3QYm3rsX6n4VRrZDsYK6DCGwkwd5n3/INFEpk16fYpP6JtMQpqEMzcOfQGAHXBTEGzuLJ03GYQL9bmV2/7ExDlRf+Uvf1sM2frRtCWmal12pMgtonvSCtR4n1CLUZRdTHDHP1Otwqd+rcdlavnKjUB/OYXQHUJzpNyFoKpQK+2OgrEKpGyIgIBgn2y9QHnTJihZOpEvOKIoHAMGAXHmj21Lym39Mbiow4IF+77xNuewziNVBxr6KD5e+9HzZSBIlUa/AmsDFJFXeyrQakR3FwowTGcADJHcEfhGkXYNGSYo4dh4bxwLM+28xjiqkdn0/3R4UEkvcBrBfn/SzBc1XhKM2VPlJgKSorjDac96V2UnQYXl1/yZPT4DVelgO+soMjexXwYO58VLl5xInQUZI8jc3H2CPnCNb9X05nOxIy4MlecasTqGK6s2az4RjpF2cQP2G28R+7wDPsZDZC/kWtjdoHC7SpdPmqQrUAhMwKVuxCmYTiD9q/O7GHtZvPSN0CAUQN/rymXZNniYLlJDE70bsk6Xxsh4kDOdxe7A2wo7P9F5YvqqRDI6brf79yPCSp4I0jVoO4YnLYtX5nzspR5WB4AKOYtR1ujXbOQpPyYDvfRE3FN5zw0i7reehdi7yV0YDRKRllGCGRk5Yz+Uv1fYl2ZwrnGsqsjgAVo0xEUba8ohjaNMJNwTwZA/wBDWFSCpg1eUH8MYL2zdioxRTqgGQrDZxQyNzyBJPXZF0+oxITJAbj7oNC5JwgDMUJaM5GqlGCWc//KCIrI+aclEe4IA0uzv7cuj6GCdaJONpi13O544vbtIHBF+A+JeDFUQNy61Gki3rtyQ4aUywn6ru314/dkGiP8Iwjo0J/2Txs49ZkwEl4mx+iYUUO55I6pJzU4P+7RRs+DXZkyKUYZqVWrPF4I94m4Wx1tXeE74o9GuX977yvJ/jkdak8+AmoHVjI15V+WwBdARFV2IPirJgVMdsg1Pez2VNHqa7EHWdTkl3XTcyjG9BiueWFvQfXI8aWSkuuRmqi/HUuzqyvLJfNfs0txMqldYYflWB1BS31WkuPJGGwXUCpjiQSktkuBMWwHjSkQxeehqw1Kgz0Trzm7QbtgxiEPDVmWCNCAeCfROTphd1ZNOhzLy6XfJyG6Xgd5MCAZw4xie0Sj5AnY1/akDgNS9YFl3Y06vd6FAsg2gVQJtzG7LVq1OH2frbXNHWH/NY89NNZ4QUSJqL2yEcGADbT38X0bGdukqYlSoliKOcsSTuqhcaemUeYLLoI8+MZor2RxXTRThF1LrHfqf/5LcLAjdl4EERgUysYS2geE+yFdasU91UgUDsc2cSQ1ZoT9+uLOwdgAmifwQqF028INc2IQEDfTmUw3eZxvz7Ud1z3xc1PQfeCvfKsB9jOhRj7rFyb9XcDWLcYj0bByosychMezMLVkFiYcdBBQtvI6K0KRuOZQH2kBsYHJaXTkup8F0eIhO1/GcIwWKpr2mouB7g5TUDJNvORXPXa/mU8bh27TAZYBe2sKx4NSv5OjnHIWD2RuysCzBlUfeNXhDd2jxnHoUlheJ3jBApzURy0fwm2FwwsSU0caQGl0Kv8hopRQE211NnvtLRsmCNrhhpEDoNiZEzD2QdJWKbRRWnaFedXHAELSN0t0bfsCsMf0ktfBoXBoNA+nZN9+pSlmuzspFevmsqqcMllzzvkyXrzoA+Ryo1ePXpdGOoJvhyru+EBRsmOp7MXZ0vNUMUqHLUoKglg1p73sWeZmPc+KAw0pE2zIsFFE5H4192KwDvDxdxEYoDBDNZjbg2bmADTeUKK57IPD4fTYF4c6EnXx/teYMORBDtIhPJneiZny7Nv/zG+YmekIKCoxr6kauE2bZtBLufetNG0BtBY7f+/ImUypMBvdWu/Q7vTMRzw5aQGZWuc1V0HEsItFYMIBnoKGZ0xcarba/TYZq50kCaflFysYjA4EDKHqGdpYWdKYmm+a7TADmW35yfnOYpZYrkpVEtiqF0EujI00aeplNs2k+qyFZNeE3CDPL9P6b4PQ/kataHkVpLSEVGK7EX6rAa7IVNrvZtFvOA6okKvBgMtFDAGZOx88MeBcJ8AR3AgUUeIznAN6tjCUipGDZONm1FjWJp4A3QIzSaIOmZ7DvF/ysYYbM/fFDOV0jntAjRdapxJxL0eThpEhKOjCDDq2ks+3GrwxqIFKLe1WdOzII8XIOPGnwy6LKXVfpSDOTEfaRsGujhpS4hBIsMOqHbl16PJxc4EkaVu9wpEYlF/84NSv5Zum4drMfp9yXbzzAOJqqS4YkI4cBrFrC7bMPiCfgI3nNZAqkk3QOZqR+yyqx+nDQKBBBZ7QKrfGMCL+XpqFaBJU0wpkBdAhbR4hJsmT5aynlvkouoxm/NjD5oe6BzVIO9uktM+/5dEC5P7vZvarmuO/lKXz4sBabVPIATuKTrwbJP8XUkdM6uEctHKXICUJGjaZIWRbZp8czquQYfY6ynBUCfIU+gG6wqSIBmYIm9pZpXdaL121V7q0VjDjmQnXvMe7ysoEZnZL15B0SpxS1jjd83uNIOKZwu5MPzg2NhOx3xMOPYwEn2CUzbSrwAs5OAtrz3GAaUkJOU74XwjaYUmGJdZBS1NJVkGYrToINLKDjxcuIlyfVsKQSG/G4DyiO2SlQvJ0d0Ot1uOG5IFSAkq+PRVMgVMDvOIJMdqjeCFKUGRWBW9wigYvcbU7CQL/7meF2KZAaWl+4y9uhowAX7elogAvItAAxo2+SFxGRsHGEW9BnhlTuWigYxRcnVUBRQHV41LV+Fr5CJYV7sHfeywswx4XMtUx6EkBhR+q8AXXUA8uPJ73Pb49i9KG9fOljvXeyFj9ixgbo6CcbAJ7WHWqKHy/h+YjBwp6VcN7M89FGzQ04qbrQtgrOFybg3gQRTYG5xn73ArkfQWjCJROwy3J38Dx/D7jOa6BBNsitEw1wGq780EEioOeD+ZGp2J66ADiVGMayiHYucMk8nTK2zzT9CnEraAk95kQjy4k0GRElLL5YAKLQErJ5rp1eay9O4Fb6yJGm9U4FaMwPGxtKD6odIIHKoWnhKo1U8KIpFC+MVn59ZXmc7ZTBZfsg6FQ8W10YfTr4u0nYrpHZbZ1jXiLmooF0cOm0+mPnJBXQtepc7n0BqOipNCqI6yyloTeRShNKH04FIo0gcMk0H/xThyN4pPAWjDDkEp3lNNPRNVfpMI44CWRlRgViP64eK0JSRp0WUvCWYumlW/c58Vcz/yMwVcW5oYb9+26TEhwvbxiNg48hl1VI1UXTU//Eta+BMKnGUivctfL5wINDD0giQL1ipt6U7C9cd4+lgqY2lMUZ02Uv6Prs+ZEZer7ZfWBXVghlfOOrClwsoOFKzWEfz6RZu1eCs+K8fLvkts5+BX0gyrFYve0C3qHrn5U/Oh6D/CihmWIrY7HUZRhJaxde+tldu6adYJ+LeXupQw0XExC36RETdNFxcq9glMu4cNQSX9cqR/GQYp+IxUkIcNGWVU7ZtGa6P3XAyodRt0XeS3Tp01AnCh0ZbUh4VrSZeV9RWfSoWyxnY3hzcZ30G/InDq4wxRrEejreBxnhIQbkxenxkaxl+k7eLUQkUR6vKJ2iDFNGX3WmVA1yaOH+mvhBd+sE6vacQzFobwY5BqEAFmejwW5ne7HtVNolOUgJc8CsUxmc/LBi8N5mu9VsIA5HyErnS6zeCz7VLI9+n/hbT6hTokMXTVyXJRKSG2hd2labXTbtmK4fNH3IZBPreSA4FMeVouVN3zG5x9CiGpLw/3pceo4qGqp+rVp+z+7yQ98oEf+nyH4F3+J9IheDBa94Wi63zJbLBCIZm7P0asHGpIJt3PzE3m0S4YIWyXBCVXGikj8MudDPB/6Nm2v4IxJ5gU0ii0guy5SUHqGUYzTP0jIJU5E82RHUXtX4lDdrihBLdP1YaG1AGUC12rQKuIaGvCpMjZC9bWSCYnjDlvpWbkdXMTNeBHLKiuoozMGIvkczmP0aRJSJ8PYnLCVNhKHXBNckH79e8Z8Kc2wUej4sQZoH8qDRGkg86maW/ZQWGNnLcXmq3FlXM6ssR/3P6E/bHMvm6HLrv1yRixit25JsH3/IOr2UV4BWJhxXW5BJ6Xdr07n9kF3ZNAk6/Xpc5MSFmYJ2R7bdL8Kk7q1OU9Elg/tCxJ8giT27wSTySF0GOxg4PbYJdi/Nyia9Nn89CGDulfJemm1aiEr/eleGSN+5MRrVJ4K6lgyTTIW3i9cQ0dAi6FHt0YMbH3wDSAtGLSAccezzxHitt1QdhW36CQgPcA8vIIBh3/JNjf/Obmc2yzpk8edSlS4lVdwgW5vzbYEyFoF4GCBBby1keVNueHAH+evi+H7oOVfS3XuPQSNTXOONAbzJeSb5stwdQHl1ZjrGoE49I8+A9j3t+ahhQj74FCSWpZrj7wRSFJJnnwi1T9HL5qrCFW/JZq6P62XkMWTb+u4lGpKfmmwiJWx178GOG7KbrZGqyWwmuyKWPkNswkZ1q8uptUlviIi+AXh2bOOTOLsrtNkfqbQJeh24reebkINLkjut5r4d9GR/r8CBa9SU0UQhsnZp5cP+RqWCixRm7i4YRFbtZ4EAkhtNa6jHb6gPYQv7MKqkPLRmX3dFsK8XsRLVZ6IEVrCbmNDc8o5mqsogjAQfoC9Bc7R6gfw03m+lQpv6kTfhxscDIX6s0w+fBxtkhjXAXr10UouWCx3C/p/FYwJRS/AXRKkjOb5CLmK4XRe0+xeDDwVkJPZau52bzLEDHCqV0f44pPgKOkYKgTZJ33fmk3Tu8SdxJ02SHM8Fem5SMsWqRyi2F1ynfRJszcFKykdWlNqgDA/L9lKYBmc7Zu/q9ii1FPF47VJkqhirUob53zoiJtVVRVwMR34gV9iqcBaHbRu9kkvqk3yMpfRFG49pKKjIiq7h/VpRwPGTHoY4cg05X5028iHsLvUW/uz+kjPyIEhhcKUwCkJAwbR9pIEGOn8z6svAO8i89sJ3dL5qDWFYbS+HGPRMxYwJItFQN86YESeJQhn2urGiLRffQeLptDl8dAgb+Tp47UQPxWOw17OeChLN1WnzlkPL1T5O+O3Menpn4C3IY5LEepHpnPeZHbvuWfeVtPlkH4LZjPbBrkJT3NoRJzBt86CO0Xq59oQ+8dsm0ymRcmQyn8w71mhmcuEI5byuF+C88VPYly2sEzjlzAQ3vdn/1+Hzguw6qFNNbqenhZGbdiG6RwZaTG7jTA2X9RdXjDN9yj1uQpyO4Lx8KRAcZcbZMafp4wPOd5MdXoFY52V1A8M9hi3sso93+uprE0qYNMjkE22CvK4HuUxqN7oIz5pWuETq1lQAjqlSlqdD2Rnr/ggp/TVkQYjn9lMfYelk2sH5HPdopYo7MHwlV1or9Bxf+QCyLzm92vzG2wjiIjC/ZHEJzeroJl6bdFPTpZho5MV2U86fLQqxNlGIMqCGy+9WYhJ8ob1r0+Whxde9L2PdysETv97O+xVw+VNN1TZSQN5I6l9m5Ip6pLIqLm4a1B1ffH6gHyqT9p82NOjntRWGIofO3bJz5GhkvSWbsXueTAMaJDou99kGLqDlhwBZNEQ4mKPuDvVwSK4WmLluHyhA97pZiVe8g+JxmnJF8IkV/tCs4Jq/HgOoAEGR9tCDsDbDmi3OviUQpG5D8XmKcSAUaFLRXb2lmJTNYdhtYyfjBYZQmN5qT5CNuaD3BVnlkCk7bsMW3AtXkNMMTuW4HjUERSJnVQ0vsBGa1wo3Qh7115XGeTF3NTz8w0440AgU7c3bSXO/KMINaIWXd0oLpoq/0/QJxCQSJ9XnYy1W7TYLBJpHsVWD1ahsA7FjNvRd6mxCiHsm8g6Z0pnzqIpF1dHUtP2ITU5Z1hZHbu+L3BEEStBbL9XYvGfEakv1bmf+bOZGnoiuHEdlBnaChxYKNzB23b8sw8YyT7Ajxfk49eJIAvdbVkdFCe2J0gMefhQ0bIZxhx3fzMIysQNiN8PgOUKxOMur10LduigREDRMZyP4oGWrP1GFY4t6groASsZ421os48wAdnrbovNhLt7ScNULkwZ5AIZJTrbaKYTLjA1oJ3sIuN/aYocm/9uoQHEIlacF1s/TM1fLcPTL38O9fOsjMEIwoPKfvt7opuI9G2Hf/PR4aCLDQ7wNmIdEuXJ/QNL72k5q4NejAldPfe3UVVqzkys8YZ/jYOGOp6c+YzRCrCuq0M11y7TiN6qk7YXRMn/gukxrEimbMQjr3jwRM6dKVZ4RUfWQr8noPXLJq6yh5R3EH1IVOHESst/LItbG2D2vRsZRkAObzvQAAD3mb3/G4NzopI0FAiHfbpq0X72adg6SRj+8OHMShtFxxLZlf/nLgRLbClwl5WmaYSs+yEjkq48tY7Z2bE0N91mJwt+ua0NlRJIDh0HikF4UvSVorFj2YVu9YeS5tfvlVjPSoNu/Zu6dEUfBOT555hahBdN3Sa5Xuj2Rvau1lQNIaC944y0RWj9UiNDskAK1WoL+EfXcC6IbBXFRyVfX/WKXxPAwUyIAGW8ggZ08hcijKTt1YKnUO6QPvcrmDVAb0FCLIXn5id4fD/Jx4tw/gbXs7WF9b2RgXtPhLBG9vF5FEkdHAKrQHZAJC/HWvk7nvzzDzIXZlfFTJoC3JpGgLPBY7SQTjGlUvG577yNutZ1hTfs9/1nkSXK9zzKLRZ3VODeKUovJe0WCq1zVMYxCJMenmNzPIU2S8TA4E7wWmbNkxq9rI2dd6v0VpcAPVMxnDsvWTWFayyqvKZO7Z08a62i/oH2/jxf8rpmfO64in3FLiL1GX8IGtVE9M23yGsIqJbxDTy+LtaMWDaPqkymb5VrQdzOvqldeU0SUi6IirG8UZ3jcpRbwHa1C0Dww9G/SFX3gPvTJQE+kyz+g1BeMILKKO+olcHzctOWgzxYHnOD7dpCRtuZEXACjgqesZMasoPgnuDC4nUviAAxDc5pngjoAITIkvhKwg5d608pdrZcA+qn5TMT6Uo/QzBaOxBCLTJX3Mgk85rMfsnWx86oLxf7p2PX5ONqieTa/qM3tPw4ZXvlAp83NSD8F7+ZgctK1TpoYwtiU2h02HCGioH5tkVCqNVTMH5p00sRy2JU1qyDBP2CII/Dg4WDsIl+zgeX7589srx6YORRQMBfKbodbB743Tl4WLKOEnwWUVBsm94SOlCracU72MSyj068wdpYjyz1FwC2bjQnxnB6Mp/pZ+yyZXtguEaYB+kqhjQ6UUmwSFazOb+rhYjLaoiM+aN9/8KKn0zaCTFpN9eKwWy7/u4EHzO46TdFSNjMfn2iPSJwDPCFHc0I1+vjdAZw5ZjqR/uzi9Zn20oAa5JnLEk/EA3VRWE7J/XrupfFJPtCUuqHPpnlL7ISJtRpSVcB8qsZCm2QEkWoROtCKKxUh3yEcMbWYJwk6DlEBG0bZP6eg06FL3v6RPb7odGuwm7FN8fG4woqtB8e7M5klPpo97GoObNwt+ludTAmxyC5hmcFx+dIvEZKI6igFKHqLH01iY1o7903VzG9QGetyVx5RNmBYUU+zIuSva/yIcECUi4pRmE3VkF2avqulQEUY4yZ/wmNboBzPmAPey3+dSYtBZUjeWWT0pPwCz4Vozxp9xeClIU60qvEFMQCaPvPaA70WlOP9f/ey39macvpGCVa+zfa8gO44wbxpJUlC8GN/pRMTQtzY8Z8/hiNrU+Zq64ZfFGIkdj7m7abcK1EBtws1X4J/hnqvasPvvDSDYWN+QcQVGMqXalkDtTad5rYY0TIR1Eqox3czwPMjKPvF5sFv17Thujr1IZ1Ytl4VX1J0vjXKmLY4lmXipRAro0qVGEcXxEVMMEl54jQMd4J7RjgomU0j1ptjyxY+cLiSyXPfiEcIS2lWDK3ISAy6UZ3Hb5vnPncA94411jcy75ay6B6DSTzK6UTCZR9uDANtPBrvIDgjsfarMiwoax2OlLxaSoYn4iRgkpEGqEkwox5tyI8aKkLlfZ12lO11TxsqRMY89j5JaO55XfPJPDL1LGSnC88Re9Ai+Nu5bZjtwRrvFITUFHPR4ZmxGslQMecgbZO7nHk32qHxYkdvWpup07ojcMCaVrpFAyFZJJbNvBpZfdf39Hdo2kPtT7v0/f8R/B5Nz4f1t9/3zNM/7n6SUHfcWk5dfQFJvcJMgPolGCpOFb/WC0FGWU2asuQyT+rm88ZKZ78Cei/CAh939CH0JYbpZIPtxc2ufXqjS3pHH9lnWK4iJ7OjR/EESpCo2R3MYKyE7rHfhTvWho4cL1QdN4jFTyR6syMwFm124TVDDRXMNveI1Dp/ntwdz8k8kxw7iFSx6+Yx6O+1LzMVrN0BBzziZi9kneZSzgollBnVwBh6oSOPHXrglrOj+QmR/AESrhDpKrWT+8/AiMDxS/5wwRNuGQPLlJ9ovomhJWn8sMLVItQ8N/7IXvtD8kdOoHaw+vBSbFImQsv/OCAIui99E+YSIOMlMvBXkAt+NAZK8wB9Jf8CPtB+TOUOR+z71d/AFXpPBT6+A5FLjxMjLIEoJzrQfquvxEIi+WoUzGR1IzQFNvbYOnxb2PyQ0kGdyXKzW2axQL8lNAXPk6NEjqrRD1oZtKLlFoofrXw0dCNWASHzy+7PSzOUJ3XtaPZsxLDjr+o41fKuKWNmjiZtfkOzItvlV2MDGSheGF0ma04qE3TUEfqJMrXFm7DpK+27DSvCUVf7rbNoljPhha5W7KBqVq0ShUSTbRmuqPtQreVWH4JET5yMhuqMoSd4r/N8sDmeQiQQvi1tcZv7Moc7dT5X5AtCD6kNEGZOzVcNYlpX4AbTsLgSYYliiPyVoniuYYySxsBy5cgb3pD+EK0Gpb0wJg031dPgaL8JZt6sIvzNPEHfVPOjXmaXj4bd4voXzpZ5GApMhILgMbCEWZ2zwgdeQgjNHLbPIt+KqxRwWPLTN6HwZ0Ouijj4UF+Sg0Au8XuIKW0WxlexdrFrDcZJ8Shauat3X0XmHygqgL1nAu2hrJFb4wZXkcS+i36KMyU1yFvYv23bQUJi/3yQpqr/naUOoiEWOxckyq/gq43dFou1DVDaYMZK9tho7+IXXokBCs5GRfOcBK7g3A+jXQ39K4YA8PBRW4m5+yR0ZAxWJncjRVbITvIAPHYRt1EJ3YLiUbqIvoKHtzHKtUy1ddRUQ0AUO41vonZDUOW+mrszw+SW/6Q/IUgNpcXFjkM7F4CSSQ2ExZg85otsMs7kqsQD4OxYeBNDcSpifjMoLb7GEbGWTwasVObmB/bfPcUlq0wYhXCYEDWRW02TP5bBrYsKTGWjnWDDJ1F7zWai0zW/2XsCuvBQjPFcTYaQX3tSXRSm8hsAoDdjArK/OFp6vcWYOE7lizP0Yc+8p16i7/NiXIiiQTp7c7Xus925VEtlKAjUdFhyaiLT7VxDagprMFwix4wZ05u0qj7cDWFd0W9OYHIu3JbJKMXRJ1aYNovugg+QqRN7fNHSi26VSgBpn+JfMuPo3aeqPWik/wI5Rz3BWarPQX4i5+dM0npwVOsX+KsOhC7vDg+OJsz4Q5zlnIeflUWL6QYMbf9WDfLmosLF4Qev3mJiOuHjoor/dMeBpA9iKDkMjYBNbRo414HCxjsHrB4EXNbHzNMDHCLuNBG6Sf+J4MZ/ElVsDSLxjIiGsTPhw8BPjxbfQtskj+dyNMKOOcUYIRBEIqbazz3lmjlRQhplxq673VklMMY6597vu+d89ec/zq7Mi4gQvh87ehYbpOuZEXj5g/Q7S7BFDAAB9DzG35SC853xtWVcnZQoH54jeOqYLR9NDuwxsVthTV7V99n/B7HSbAytbEyVTz/5NhJ8gGIjG0E5j3griULUd5Rg7tQR+90hJgNQKQH2btbSfPcaTOfIexc1db1BxUOhM1vWCpLaYuKr3FdNTt/T3PWCpEUWDKEtzYrjpzlL/wri3MITKsFvtF8QVV/NhVo97aKIBgdliNc10dWdXVDpVtsNn+2UIolrgqdWA4EY8so0YvB4a+aLzMXiMAuOHQrXY0tr+CL10JbvZzgjJJuB1cRkdT7DUqTvnswVUp5kkUSFVtIIFYK05+tQxT6992HHNWVhWxUsD1PkceIrlXuUVRogwmfdhyrf6zzaL8+c0L7GXMZOteAhAVQVwdJh+7nrX7x4LaIIfz2F2v7Dg/uDfz2Fa+4gFm2zHAor8UqimJG3VTJtZEoFXhnDYXvxMJFc6ku2bhbCxzij2z5UNuK0jmp1mnvkVNUfR+SEmj1Lr94Lym75PO7Fs0MIr3GdsWXRXSfgLTVY0FLqba97u1In8NAcY7IC6TjWLigwKEIm43NxTdaVTv9mcKkzuzBkKd8x/xt1p/9BbP7Wyb4bpo1K1gnOpbLvKz58pWl3B55RJ/Z5mRDLPtNQg14jdOEs9+h/V5UVpwrAI8kGbX8KPVPDIMfIqKDjJD9UyDOPhjZ3vFAyecwyq4akUE9mDOtJEK1hpDyi6Ae87sWAClXGTiwPwN7PXWwjxaR79ArHRIPeYKTunVW24sPr/3HPz2IwH8oKH4OlWEmt4BLM6W5g4kMcYbLwj2usodD1088stZA7VOsUSpEVl4w7NMb1EUHMRxAxLF0CIV+0L3iZb+ekB1vSDSFjAZ3hfLJf7gFaXrOKn+mhR+rWw/eTXIcAgl4HvFuBg1LOmOAwJH3eoVEjjwheKA4icbrQCmvAtpQ0mXG0agYp5mj4Rb6mdQ+RV4QBPbxMqh9C7o8nP0Wko2ocnCHeRGhN1XVyT2b9ACsL+6ylUy+yC3QEnaKRIJK91YtaoSrcWZMMwxuM0E9J68Z+YyjA0g8p1PfHAAIROy6Sa04VXOuT6A351FOWhKfTGsFJ3RTJGWYPoLk5FVK4OaYR9hkJvezwF9vQN1126r6isMGXWTqFW+3HL3I/jurlIdDWIVvYY+s6yq7lrFSPAGRdnU7PVwY/SvWbZGpXzy3BQ2LmAJlrONUsZs4oGkly0V267xbD5KMY8woNNsmWG1VVgLCra8aQBBcI4DP2BlNwxhiCtHlaz6OWFoCW0vMR3ErrG7JyMjTSCnvRcsEHgmPnwA6iNpJ2DrFb4gLlhKJyZGaWkA97H6FFdwEcLT6DRQQL++fOkVC4cYGW1TG/3iK5dShRSuiBulmihqgjR45Vi03o2RbQbP3sxt90VxQ6vzdlGfkXmmKmjOi080JSHkLntjvsBJnv7gKscOaTOkEaRQqAnCA4HWtB4XnMtOhpRmH2FH8tTXrIjAGNWEmudQLCkcVlGTQ965Kh0H6ixXbgImQP6b42B49sO5C8pc7iRlgyvSYvcnH9FgQ3azLbQG2cUW96SDojTQStxkOJyOuDGTHAnnWkz29aEwN9FT8EJ4yhXOg+jLTrCPKeEoJ9a7lDXOjEr8AgX4BmnMQ668oW0zYPyQiVMPxKRHtpfnEEyaKhdzNVThlxxDQNdrHeZiUFb6NoY2KwvSb7BnRcpJy+/g/zAYx3fYSN5QEaVD2Y1VsNWxB0BSO12MRsRY8JLfAezRMz5lURuLUnG1ToKk6Q30FughqWN6gBNcFxP/nY/iv+iaUQOa+2Nuym46wtI/DvSfzSp1jEi4SdYBE7YhTiVV5cX9gwboVDMVgZp5YBQlHOQvaDNfcCoCJuYhf5kz5kwiIKPjzgpcRJHPbOhJajeoeRL53cuMahhV8Z7IRr6M4hW0JzT7mzaMUzQpm866zwM7Cs07fJYXuWvjAMkbe5O6V4bu71sOG6JQ4oL8zIeXHheFVavzxmlIyBkgc9IZlEDplMPr8xlcyss4pVUdwK1e7CK2kTsSdq7g5SHRAl3pYUB9Ko4fsh4qleOyJv1z3KFSTSvwEcRO/Ew8ozEDYZSqpfoVW9uhJfYrNAXR0Z3VmeoAD+rVWtwP/13sE/3ICX3HhDG3CMc476dEEC0K3umSAD4j+ZQLVdFOsWL2C1TH5+4KiSWH+lMibo+B55hR3Gq40G1n25sGcN0mEcoU2wN9FCVyQLBhYOu9aHVLWjEKx2JIUZi5ySoHUAI9b8hGzaLMxCZDMLhv8MkcpTqEwz9KFDpCpqQhVmsGQN8m24wyB82FAKNmjgfKRsXRmsSESovAwXjBIoMKSG51p6Um8b3i7GISs7kjTq/PZoioCfJzfKdJTN0Q45kQEQuh9H88M3yEs3DbtRTKALraM0YC8laiMiOOe6ADmTcCiREeAWZelBaEXRaSuj2lx0xHaRYqF65O0Lo5OCFU18A8cMDE4MLYm9w2QSr9NgQAIcRxZsNpA7UJR0e71JL+VU+ISWFk5I97lra8uGg7GlQYhGd4Gc6rxsLFRiIeGO4abP4S4ekQ1fiqDCy87GZHd52fn5aaDGuvOmIofrzpVwMvtbreZ/855OaXTRcNiNE0wzGZSxbjg26v8ko8L537v/XCCWP2MFaArJpvnkep0pA+O86MWjRAZPQRfznZiSIaTppy6m3p6HrNSsY7fDtz7Cl4V/DJAjQDoyiL2uwf1UHVd2AIrzBUSlJaTj4k6NL97a/GqhWKU9RUmjnYKpm2r+JYUcrkCuZKvcYvrg8pDoUKQywY9GDWg03DUFSirlUXBS5SWn/KAntnf0IdHGL/7mwXqDG+LZYjbEdQmqUqq4y54TNmWUP7IgcAw5816YBzwiNIJiE9M4lPCzeI/FGBeYy3p6IAmH4AjXXmvQ4Iy0Y82NTobcAggT2Cdqz6Mx4TdGoq9fn2etrWKUNFyatAHydQTVUQ2S5OWVUlugcNvoUrlA8cJJz9MqOa/W3iVno4zDHfE7zhoY5f5lRTVZDhrQbR8LS4eRLz8iPMyBL6o4PiLlp89FjdokQLaSBmKHUwWp0na5fE3v9zny2YcDXG/jfI9sctulHRbdkI5a4GOPJx4oAJQzVZ/yYAado8KNZUdEFs9ZPiBsausotXMNebEgr0dyopuqfScFJ3ODNPHgclACPdccwv0YJGQdsN2lhoV4HVGBxcEUeUX/alr4nqpcc1CCR3vR7g40zteQg/JvWmFlUE4mAiTpHlYGrB7w+U2KdSwQz2QJKBe/5eiixWipmfP15AFWrK8Sh1GBBYLgzki1wTMhGQmagXqJ2+FuqJ8f0XzXCVJFHQdMAw8xco11HhM347alrAu+wmX3pDFABOvkC+WPX0Uhg1Z5MVHKNROxaR84YV3s12UcM+70cJ460SzEaKLyh472vOMD3XnaK7zxZcXlWqenEvcjmgGNR2OKbI1s8U+iwiW+HotHalp3e1MGDy6BMVIvajnAzkFHbeVsgjmJUkrP9OAwnEHYXVBqYx3q7LvXjoVR0mY8h+ZaOnh053pdsGkmbqhyryN01eVHySr+CkDYkSMeZ1xjPNVM+gVLTDKu2VGsMUJqWO4TwPDP0VOg2/8ITbAUaMGb4LjL7L+Pi11lEVMXTYIlAZ/QHmTENjyx3kDkBdfcvvQt6tKk6jYFM4EG5UXDTaF5+1ZjRz6W7MdJPC+wTkbDUim4p5QQH3b9kGk2Bkilyeur8Bc20wm5uJSBO95GfYDI1EZipoRaH7uVveneqz43tlTZGRQ4a7CNmMHgXyOQQOL6WQkgMUTQDT8vh21aSdz7ERiZT1jK9F+v6wgFvuEmGngSvIUR2CJkc5tx1QygfZnAruONobB1idCLB1FCfO7N1ZdRocT8/Wye+EnDiO9pzqIpnLDl4bkaRKW+ekBVwHn46Shw1X0tclt/0ROijuUB4kIInrVJU4buWf4YITJtjOJ6iKdr1u+flgQeFH70GxKjhdgt/MrwfB4K/sXczQ+9zYcrD4dhY6qZhZ010rrxggWA8JaZyg2pYij8ieYEg1aZJkZK9O1Re7sB0iouf60rK0Gd+AYlp7soqCBCDGwfKeUQhCBn0E0o0GS6PdmjLi0TtCYZeqazqwN+yNINIA8Lk3iPDnWUiIPLGNcHmZDxfeK0iAdxm/T7LnN+gemRL61hHIc0NCAZaiYJR+OHnLWSe8sLrK905B5eEJHNlWq4RmEXIaFTmo49f8w61+NwfEUyuJAwVqZCLFcyHBKAcIVj3sNzfEOXzVKIndxHw+AR93owhbCxUZf6Gs8cz6/1VdrFEPrv330+9s6BtMVPJ3zl/Uf9rUi0Z/opexfdL3ykF76e999GPfVv8fJv/Y/+/5hEMon1tqNFyVRevV9y9/uIvsG3dbB8GRRrgaEXfhx+2xeOFt+cEn3RZanNxdEe2+B6MHpNbrRE53PlDifPvFcp4kO78ILR0T4xyW/WGPyBsqGdoA7zJJCu1TKbGfhnqgnRbxbB2B3UZoeQ2bz2sTVnUwokTcTU21RxN1PYPS3Sar7T0eRIsyCNowr9amwoMU/od9s2APtiKNL6ENOlyKADstAEWKA+sdKDhrJ6BOhRJmZ+QJbAaZ3/5Fq0/lumCgEzGEbu3yi0Y4I4EgVAjqxh4HbuQn0GrRhOWyAfsglQJAVL1y/6yezS2k8RE2MstJLh92NOB3GCYgFXznF4d25qiP4ZCyI4RYGesut6FXK6GwPpKK8WHEkhYui0AyEmr5Ml3uBFtPFdnioI8RiCooa7Z1G1WuyIi3nSNglutc+xY8BkeW3JJXPK6jd2VIMpaSxpVtFq+R+ySK9J6WG5Qvt+C+QH1hyYUOVK7857nFmyDBYgZ/o+AnibzNVqyYCJQvyDXDTK+iXdkA71bY7TL3bvuLxLBQ8kbTvTEY9aqkQ3+MiLWbEgjLzOH+lXgco1ERgzd80rDCymlpaRQbOYnKG/ODoFl46lzT0cjM5FYVvv0qLUbD5lyJtMUaC1pFlTkNONx6lliaX9o0i/1vws5bNKn5OuENQEKmLlcP4o2ZmJjD4zzd3Fk32uQ4uRWkPSUqb4LBe3EXHdORNB2BWsws5daRnMfNVX7isPSb1hMQdAJi1/qmDMfRUlCU74pmnzjbXfL8PVG8NsW6IQM2Ne23iCPIpryJjYbVnm5hCvKpMa7HLViNiNc+xTfDIaKm3jctViD8A1M9YPJNk003VVr4Zo2MuGW8vil8SLaGpPXqG7I4DLdtl8a4Rbx1Lt4w5Huqaa1XzZBtj208EJVGcmKYEuaeN27zT9EE6a09JerXdEbpaNgNqYJdhP1NdqiPKsbDRUi86XvvNC7rME5mrSQtrzAZVndtSjCMqd8BmaeGR4l4YFULGRBeXIV9Y4yxLFdyoUNpiy2IhePSWzBofYPP0eIa2q5JP4j9G8at/AqoSsLAUuRXtvgsqX/zYwsE+of6oSDbUOo4RMJw+DOUTJq+hnqwKim9Yy/napyZNTc2rCq6V9jHtJbxGPDwlzWj/Sk3zF/BHOlT/fSjSq7FqlPI1q6J+ru8Aku008SFINXZfOfnZNOvGPMtEmn2gLPt+H4QLA+/SYe4j398auzhKIp2Pok3mPC5q1IN1HgR+mnEfc4NeeHYwd2/kpszR3cBn7ni9NbIqhtSWFW8xbUJuUPVOeeXu3j0IGZmFNiwaNZ6rH4/zQ2ODz6tFxRLsUYZu1bfd1uIvfQDt4YD/efKYv8VF8bHGDgK22w2Wqwpi43vNCOXFJZCGMqWiPbL8mil6tsmOTXAWCyMCw73e2rADZj2IK6rqksM3EXF2cbLb4vjB14wa/yXK5vwU+05MzERJ5nXsXsW21o7M+gO0js2OyKciP5uF2iXyb2DiptwQeHeqygkrNsqVCSlldxBMpwHi1vfc8RKpP/4L3Lmpq6DZcvhDDfxTCE3splacTcOtXdK2g303dIWBVe2wD/Gvja1cClFQ67gw0t1ZUttsUgQ1Veky8oOpS6ksYEc4bqseCbZy766SvL3FodmnahlWJRgVCNjPxhL/fk2wyvlKhITH/VQCipOI0dNcRa5B1M5HmOBjTLeZQJy237e2mobwmDyJNHePhdDmiknvLKaDbShL+Is1XTCJuLQd2wmdJL7+mKvs294whXQD+vtd88KKk0DXP8B1Xu9J+xo69VOuFgexgTrcvI6SyltuLix9OPuE6/iRJYoBMEXxU4shQMf4Fjqwf1PtnJ/wWSZd29rhZjRmTGgiGTAUQqRz+nCdjeMfYhsBD5Lv60KILWEvNEHfmsDs2L0A252351eUoYxAysVaCJVLdH9QFWAmqJDCODUcdoo12+gd6bW2boY0pBVHWL6LQDK5bYWh1V8vFvi0cRpfwv7cJiMX3AZNJuTddHehTIdU0YQ/sQ1dLoF2xQPcCuHKiuCWOY30DHe1OwcClLAhqAKyqlnIbH/8u9ScJpcS4kgp6HKDUdiOgRaRGSiUCRBjzI5gSksMZKqy7Sd51aeg0tgJ+x0TH9YH2Mgsap9N7ENZdEB0bey2DMTrBA1hn56SErNHf3tKtqyL9b6yXEP97/rc+jgD2N1LNUH6RM9AzP3kSipr06RkKOolR7HO768jjWiH1X92jA7dkg7gcNcjqsZCgfqWw0tPXdLg20cF6vnQypg7gLtkazrHAodyYfENPQZsdfnjMZiNu4nJO97D1/sQE+3vNFzrSDOKw+keLECYf7RJwVHeP/j79833oZ0egonYB2FlFE5qj02B/LVOMJQlsB8uNg3Leg4qtZwntsOSNidR0abbZmAK4sCzvt8Yiuz2yrNCJoH5O8XvX/vLeR/BBYTWj0sOPYM/jyxRd5+/JziKAABaPcw/34UA3aj/gLZxZgRCWN6m4m3demanNgsx0P237/Q+Ew5VYnJPkyCY0cIVHoFn2Ay/e7U4P19APbPFXEHX94N6KhEMPG7iwB3+I+O1jd5n6VSgHegxgaSawO6iQCYFgDsPSMsNOcUj4q3sF6KzGaH/0u5PQoAj/8zq6Uc9MoNrGqhYeb2jQo0WlGlXjxtanZLS24/OIN5Gx/2g684BPDQpwlqnkFcxpmP/osnOXrFuu4PqifouQH0eF5qCkvITQbJw/Zvy5mAHWC9oU+cTiYhJmSfKsCyt1cGVxisKu+NymEQIAyaCgud/V09qT3nk/9s/SWsYtha7yNpzBIMM40rCSGaJ9u6lEkl00vXBiEt7p9P5IBCiavynEOv7FgLqPdeqxRiCwuFVMolSIUBcoyfUC2e2FJSAUgYdVGFf0b0Kn2EZlK97yyxrT2MVgvtRikfdaAW8RwEEfN+B7/eK8bBdp7URpbqn1xcrC6d2UjdsKbzCjBFqkKkoZt7Mrhg6YagE7spkqj0jOrWM+UGQ0MUlG2evP1uE1p2xSv4dMK0dna6ENcNUF+xkaJ7B764NdxLCpuvhblltVRAf7vK5qPttJ/9RYFUUSGcLdibnz6mf7WkPO3MkUUhR2mAOuGv8IWw5XG1ZvoVMnjSAZe6T7WYA99GENxoHkMiKxHlCuK5Gd0INrISImHQrQmv6F4mqU/TTQ8nHMDzCRivKySQ8dqkpQgnUMnwIkaAuc6/FGq1hw3b2Sba398BhUwUZSAIO8XZvnuLdY2n6hOXws+gq9BHUKcKFA6kz6FDnpxLPICa3qGhnc97bo1FT/XJk48LrkHJ2CAtBv0RtN97N21plfpXHvZ8gMJb7Zc4cfI6MbPwsW7AilCSXMFIEUEmir8XLEklA0ztYbGpTTGqttp5hpFTTIqUyaAIqvMT9A/x+Ji5ejA4Bhxb/cl1pUdOD6epd3yilIdO6j297xInoiBPuEDW2/UfslDyhGkQs7Wy253bVnlT+SWg89zYIK/9KXFl5fe+jow2rd5FXv8zDPrmfMXiUPt9QBO/iK4QGbX5j/7Rx1c1vzsY8ONbP3lVIaPrhL4+1QrECTN3nyKavGG0gBBtHvTKhGoBHgMXHStFowN+HKrPriYu+OZ05Frn8okQrPaaxoKP1ULCS/cmKFN3gcH7HQlVjraCeQmtjg1pSQxeuqXiSKgLpxc/1OiZsU4+n4lz4hpahGyWBURLi4642n1gn9qz9bIsaCeEPJ0uJmenMWp2tJmIwLQ6VSgDYErOeBCfSj9P4G/vI7oIF+l/n5fp956QgxGvur77ynawAu3G9MdFbJbu49NZnWnnFcQHjxRuhUYvg1U/e84N4JTecciDAKb/KYIFXzloyuE1eYXf54MmhjTq7B/yBToDzzpx3tJCTo3HCmVPYfmtBRe3mPYEE/6RlTIxbf4fSOcaKFGk4gbaUWe44hVk9SZzhW80yfW5QWBHxmtUzvMhfVQli4gZTktIOZd9mjJ5hsbmzttaHQB29Am3dZkmx3g/qvYocyhZ2PXAWsNQiIaf+Q8W/MWPIK7/TjvCx5q2XRp4lVWydMc2wIQkhadDB0xsnw/kSEyGjLKjI4coVIwtubTF3E7MJ6LS6UOsJKj82XVAVPJJcepfewbzE91ivXZvOvYfsmMevwtPpfMzGmC7WJlyW2j0jh7AF1JLmwEJSKYwIvu6DHc3YnyLH9ZdIBnQ+nOVDRiP+REpqv++typYHIvoJyICGA40d8bR7HR2k7do6UQTHF4oriYeIQbxKe4Th6+/l1BjUtS9hqORh3MbgvYrStXTfSwaBOmAVQZzpYNqsAmQyjY56MUqty3c/xH6GuhNvNaG9vGbG6cPtBM8UA3e8r51D0AR9kozKuGGSMgLz3nAHxDNnc7GTwpLj7/6HeWp1iksDeTjwCLpxejuMtpMnGJgsiku1sOACwQ9ukzESiDRN77YNESxR5LphOlcASXA5uIts1LnBIcn1J7BLWs49DMALSnuz95gdOrTZr0u1SeYHinno/pE58xYoXbVO/S+FEMMs5qyWkMnp8Q3ClyTlZP52Y9nq7b8fITPuVXUk9ohG5EFHw4gAEcjFxfKb3xuAsEjx2z1wxNbSZMcgS9GKyW3R6KwJONgtA64LTyxWm8Bvudp0M1FdJPEGopM4Fvg7G/hsptkhCfHFegv4ENwxPeXmYhxwZy7js+BeM27t9ODBMynVCLJ7RWcBMteZJtvjOYHb5lOnCLYWNEMKC59BA7covu1cANa2PXL05iGdufOzkgFqqHBOrgQVUmLEc+Mkz4Rq8O6WkNr7atNkH4M8d+SD1t/tSzt3oFql+neVs+AwEI5JaBJaxARtY2Z4mKoUqxds4UpZ0sv3zIbNoo0J4fihldQTX3XNcuNcZmcrB5LTWMdzeRuAtBk3cZHYQF6gTi3PNuDJ0nmR+4LPLoHvxQIxRgJ9iNNXqf2SYJhcvCtJiVWo85TsyFOuq7EyBPJrAdhEgE0cTq16FQXhYPJFqSfiVn0IQnPOy0LbU4BeG94QjdYNB0CiQ3QaxQqD2ebSMiNjaVaw8WaM4Z5WnzcVDsr4eGweSLa2DE3BWViaxhZFIcSTjgxNCAfelg+hznVOYoe5VqTYs1g7WtfTm3e4/WduC6p+qqAM8H4ZyrJCGpewThTDPe6H7CzX/zQ8Tm+r65HeZn+MsmxUciEWPlAVaK/VBaQBWfoG/aRL/jSZIQfep/89GjasWmbaWzeEZ2R1FOjvyJT37O9B8046SRSKVEnXWlBqbkb5XCS3qFeuE9xb9+frEknxWB5h1D/hruz2iVDEAS7+qkEz5Ot5agHJc7WCdY94Ws61sURcX5nG8UELGBAHZ3i+3VulAyT0nKNNz4K2LBHBWJcTBX1wzf+//u/j/9+//v87+9/l9Lbh/L/uyNYiTsWV2LwsjaA6MxTuzFMqmxW8Jw/+IppdX8t/Clgi1rI1SN0UC/r6tX/4lUc2VV1OQReSeCsjUpKZchw4XUcjHfw6ryCV3R8s6VXm67vp4n+lcPV9gJwmbKQEsmrJi9c2vkwrm8HFbVYNTaRGq8D91t9n5+U+aD/hNtN3HjC/nC/vUoGFSCkXP+NlRcmLUqLbiUBl4LYf1U/CCvwtd3ryCH8gUmGITAxiH1O5rnGTz7y1LuFjmnFGQ1UWuM7HwfXtWl2fPFKklYwNUpF2IL/TmaRETjQiM5SJacI+3Gv5MBU8lP5Io6gWkawpyzNEVGqOdx4YlO1dCvjbWFZWbCmeiFKPSlMKtKcMFLs/KQxtgAHi7NZNCQ32bBAW2mbHflVZ8wXKi1JKVHkW20bnYnl3dKWJeWJOiX3oKPBD6Zbi0ZvSIuWktUHB8qDR8DMMh1ZfkBL9FS9x5r0hBGLJ8pUCJv3NYH+Ae8p40mZWd5m5fhobFjQeQvqTT4VKWIYfRL0tfaXKiVl75hHReuTJEcqVlug+eOIIc4bdIydtn2K0iNZPsYWQvQio2qbO3OqAlPHDDOB7DfjGEfVF51FqqNacd6QmgFKJpMfLp5DHTv4wXlONKVXF9zTJpDV4m1sYZqJPhotcsliZM8yksKkCkzpiXt+EcRQvSQqmBS9WdWkxMTJXPSw94jqI3varCjQxTazjlMH8jTS8ilaW8014/vwA/LNa+YiFoyyx3s/KswP3O8QW1jtq45yTM/DX9a8M4voTVaO2ebvw1EooDw/yg6Y1faY+WwrdVs5Yt0hQ5EwRfYXSFxray1YvSM+kYmlpLG2/9mm1MfmbKHXr44Ih8nVKb1M537ZANUkCtdsPZ80JVKVKabVHCadaLXg+IV8i5GSwpZti0h6diTaKs9sdpUKEpd7jDUpYmHtiX33SKiO3tuydkaxA7pEc9XIQEOfWJlszj5YpL5bKeQyT7aZSBOamvSHl8xsWvgo26IP/bqk+0EJUz+gkkcvlUlyPp2kdKFtt7y5aCdks9ZJJcFp5ZWeaWKgtnXMN3ORwGLBE0PtkEIek5FY2aVssUZHtsWIvnljMVJtuVIjpZup/5VL1yPOHWWHkOMc6YySWMckczD5jUj2mlLVquFaMU8leGVaqeXis+aRRL8zm4WuBk6cyWfGMxgtr8useQEx7k/PvRoZyd9nde1GUCV84gMX8Ogu/BWezYPSR27llzQnA97oo0pYyxobYUJfsj+ysTm9zJ+S4pk0TGo9VTG0KjqYhTmALfoDZVKla2b5yhv241PxFaLJs3i05K0AAIdcGxCJZmT3ZdT7CliR7q+kur7WdQjygYtOWRL9B8E4s4LI8KpAj7bE0dg7DLOaX+MGeAi0hMMSSWZEz+RudXbZCsGYS0QqiXjH9XQbd8sCB+nIVTq7/T/FDS+zWY9q7Z2fdq1tdLb6v3hKKVDAw5gjj6o9r1wHFROdHc18MJp4SJ2Ucvu+iQ9EgkekW8VCM+psM6y+/2SBy8tNN4a3L1MzP+OLsyvESo5gS7IQOnIqMmviJBVc6zbVG1n8eXiA3j46kmvvtJlewwNDrxk4SbJOtP/TV/lIVK9ueShNbbMHfwnLTLLhbZuO79ec5XvfgRwLFK+w1r5ZWW15rVFZrE+wKqNRv5KqsLNfpGgnoUU6Y71NxEmN7MyqwqAQqoIULOw/LbuUB2+uE75gJt+kq1qY4LoxV+qR/zalupea3D5+WMeaRIn0sAI6DDWDh158fqUb4YhAxhREbUN0qyyJYkBU4V2KARXDT65gW3gRsiv7xSPYEKLwzgriWcWgPr0sbZnv7m1XHNFW6xPdGNZUdxFiUYlmXNjDVWuu7LCkX/nVkrXaJhiYktBISC2xgBXQnNEP+cptWl1eG62a7CPXrnrkTQ5BQASbEqUZWMDiZUisKyHDeLFOaJILUo5f6iDt4ZO8MlqaKLto0AmTHVVbkGuyPa1R/ywZsWRoRDoRdNMMHwYTsklMVnlAd2S0282bgMI8fiJpDh69OSL6K3qbo20KfpNMurnYGQSr/stFqZ7hYsxKlLnKAKhsmB8AIpEQ4bd/NrTLTXefsE6ChRmKWjXKVgpGoPs8GAicgKVw4K0qgDgy1A6hFq1WRat3fHF+FkU+b6H4NWpOU3KXTxrIb2qSHAb+qhm8hiSROi/9ofapjxhyKxxntPpge6KL5Z4+WBMYkAcE6+0Hd3Yh2zBsK2MV3iW0Y6cvOCroXlRb2MMJtdWx+3dkFzGh2Pe3DZ9QpSqpaR/rE1ImOrHqYYyccpiLC22amJIjRWVAherTfpQLmo6/K2pna85GrDuQPlH1Tsar8isAJbXLafSwOof4gg9RkAGm/oYpBQQiPUoyDk2BCQ1k+KILq48ErFo4WSRhHLq/y7mgw3+L85PpP6xWr6cgp9sOjYjKagOrxF148uhuaWtjet953fh1IQiEzgC+d2IgBCcUZqgTAICm2bR8oCjDLBsmg+ThyhfD+zBalsKBY1Ce54Y/t9cwfbLu9SFwEgphfopNA3yNxgyDafUM3mYTovZNgPGdd4ZFFOj1vtfFW3u7N+iHEN1HkeesDMXKPyoCDCGVMo4GCCD6PBhQ3dRZIHy0Y/3MaE5zU9mTCrwwnZojtE+qNpMSkJSpmGe0EzLyFelMJqhfFQ7a50uXxZ8pCc2wxtAKWgHoeamR2O7R+bq7IbPYItO0esdRgoTaY38hZLJ5y02oIVwoPokGIzxAMDuanQ1vn2WDQ00Rh6o5QOaCRu99fwDbQcN0XAuqkFpxT/cfz3slGRVokrNU0iqiMAJFEbKScZdmSkTUznC0U+MfwFOGdLgsewRyPKwBZYSmy6U325iUhBQNxbAC3FLKDV9VSOuQpOOukJ/GAmu/tyEbX9DgEp6dv1zoU0IqzpG6gssSjIYRVPGgU1QAQYRgIT8gEV0EXr1sqeh2I6rXjtmoCYyEDCe/PkFEi/Q48FuT29p557iN+LCwk5CK/CZ2WdAdfQZh2Z9QGrzPLSNRj5igUWzl9Vi0rCqH8G1Kp4QMLkuwMCAypdviDXyOIk0AHTM8HBYKh3b0/F+DxoNj4ZdoZfCpQVdnZarqoMaHWnMLNVcyevytGsrXQEoIbubqWYNo7NRHzdc0zvT21fWVirj7g36iy6pxogfvgHp1xH1Turbz8QyyHnXeBJicpYUctbzApwzZ1HT+FPEXMAgUZetgeGMwt4G+DHiDT2Lu+PT21fjJCAfV16a/Wu1PqOkUHSTKYhWW6PhhHUlNtWzFnA7MbY+r64vkwdpfNB2JfWgWXAvkzd42K4lN9x7Wrg4kIKgXCb4mcW595MCPJ/cTfPAMQMFWwnqwde4w8HZYJFpQwcSMhjVz4B8p6ncSCN1X4klxoIH4BN2J6taBMj6lHkAOs8JJAmXq5xsQtrPIPIIp/HG6i21xMGcFgqDXSRF0xQg14d2uy6HgKE13LSvQe52oShF5Jx1R6avyL4thhXQZHfC94oZzuPUBKFYf1VvDaxIrtV6dNGSx7DO0i1p6CzBkuAmEqyWceQY7F9+U0ObYDzoa1iKao/cOD/v6Q9gHrrr1uCeOk8fST9MG23Ul0KmM3r+Wn6Hi6WAcL7gEeaykicvgjzkjSwFsAXIR81Zx4QJ6oosVyJkCcT+4xAldCcihqvTf94HHUPXYp3REIaR4dhpQF6+FK1H0i9i7Pvh8owu3lO4PT1iuqu+DkL2Bj9+kdfGAg2TXw03iNHyobxofLE2ibjsYDPgeEQlRMR7afXbSGQcnPjI2D+sdtmuQ771dbASUsDndU7t58jrrNGRzISvwioAlHs5FA+cBE5Ccznkd8NMV6BR6ksnKLPZnMUawRDU1MZ/ib3xCdkTblHKu4blNiylH5n213yM0zubEie0o4JhzcfAy3H5qh2l17uLooBNLaO+gzonTH2uF8PQu9EyH+pjGsACTMy4cHzsPdymUSXYJOMP3yTkXqvO/lpvt0cX5ekDEu9PUfBeZODkFuAjXCaGdi6ew4qxJ8PmFfwmPpkgQjQlWqomFY6UkjmcnAtJG75EVR+NpzGpP1Ef5qUUbfowrC3zcSLX3BxgWEgEx/v9cP8H8u1Mvt9/rMDYf6sjwU1xSOPBgzFEeJLMRVFtKo5QHsUYT8ZRLCah27599EuqoC9PYjYO6aoAMHB8X1OHwEAYouHfHB3nyb2B+SnZxM/vw/bCtORjLMSy5aZoEpvgdGvlJfNPFUu/p7Z4VVK1hiI0/UTuB3ZPq4ohEbm7Mntgc1evEtknaosgZSwnDC2BdMmibpeg48X8Ixl+/8+xXdbshQXUPPvx8jT3fkELivHSmqbhblfNFShWAyQnJ3WBU6SMYSIpTDmHjdLVAdlADdz9gCplZw6mTiHqDwIsxbm9ErGusiVpg2w8Q3khKV/R9Oj8PFeF43hmW/nSd99nZzhyjCX3QOZkkB6BsH4H866WGyv9E0hVAzPYah2tkRfQZMmP2rinfOeQalge0ovhduBjJs9a1GBwReerceify49ctOh5/65ATYuMsAkVltmvTLBk4oHpdl6i+p8DoNj4Fb2vhdFYer2JSEilEwPd5n5zNoGBXEjreg/wh2NFnNRaIUHSOXa4eJRwygZoX6vnWnqVdCRT1ARxeFrNBJ+tsdooMwqnYhE7zIxnD8pZH+P0Nu1wWxCPTADfNWmqx626IBJJq6NeapcGeOmbtXvl0TeWG0Y7OGGV4+EHTtNBIT5Wd0Bujl7inXgZgfXTM5efD3qDTJ54O9v3Bkv+tdIRlq1kXcVD0BEMirmFxglNPt5pedb1AnxuCYMChUykwsTIWqT23XDpvTiKEru1cTcEMeniB+HQDehxPXNmkotFdwUPnilB/u4Nx5Xc6l8J9jH1EgKZUUt8t8cyoZleDBEt8oibDmJRAoMKJ5Oe9CSWS5ZMEJvacsGVdXDWjp/Ype5x0p9PXB2PAwt2LRD3d+ftNgpuyvxlP8pB84oB1i73vAVpwyrmXW72hfW6Dzn9Jkj4++0VQ4d0KSx1AsDA4OtXXDo63/w+GD+zC7w5SJaxsmnlYRQ4dgdjA7tTl2KNLnpJ+mvkoDxtt1a4oPaX3EVqj96o9sRKBQqU7ZOiupeAIyLMD+Y3YwHx30XWHB5CQiw7q3mj1EDlP2eBsZbz79ayUMbyHQ7s8gu4Lgip1LiGJj7NQj905/+rgUYKAA5qdrlHKIknWmqfuR+PB8RdBkDg/NgnlT89G72h2NvySnj7UyBwD+mi/IWs1xWbxuVwUIVXun5cMqBtFbrccI+DILjsVQg6eeq0itiRfedn89CvyFtpkxaauEvSANuZmB1p8FGPbU94J9medwsZ9HkUYjmI7OH5HuxendLbxTaYrPuIfE2ffXFKhoNBUp33HsFAXmCV/Vxpq5AYgFoRr5Ay93ZLRlgaIPjhZjXZZChT+aE5iWAXMX0oSFQEtwjiuhQQItTQX5IYrKfKB+queTNplR1Hoflo5/I6aPPmACwQCE2jTOYo5Dz1cs7Sod0KTG/3kEDGk3kUaUCON19xSJCab3kNpWZhSWkO8l+SpW70Wn3g0ciOIJO5JXma6dbos6jyisuxXwUUhj2+1uGhcvuliKtWwsUTw4gi1c/diEEpZHoKoxTBeMDmhPhKTx7TXWRakV8imJR355DcIHkR9IREHxohP4TbyR5LtFU24umRPRmEYHbpe1LghyxPx7YgUHjNbbQFRQhh4KeU1EabXx8FS3JAxp2rwRDoeWkJgWRUSKw6gGP5U2PuO9V4ZuiKXGGzFQuRuf+tkSSsbBtRJKhCi3ENuLlXhPbjTKD4djXVnfXFds6Zb+1XiUrRfyayGxJq1+SYBEfbKlgjiSmk0orgTqzSS+DZ5rTqsJbttiNtp+KMqGE2AHGFw6jQqM5vD6vMptmXV9OAjq49Uf/Lx9Opam+Hn5O9p8qoBBAQixzQZ4eNVkO9sPzJAMyR1y4/RCQQ1s0pV5KAU5sKLw3tkcFbI/JqrjCsK4Mw+W8aod4lioYuawUiCyVWBE/qPaFi5bnkgpfu/ae47174rI1fqQoTbW0HrU6FAejq7ByM0V4zkZTg02/YJK2N7hUQRCeZ4BIgSEqgD8XsjzG6LIsSbuHoIdz/LhFzbNn1clci1NHWJ0/6/O8HJMdIpEZbqi1RrrFfoo/rI/7ufm2MPG5lUI0IYJ4MAiHRTSOFJ2oTverFHYXThkYFIoyFx6rMYFgaOKM4xNWdlOnIcKb/suptptgTOTdVIf4YgdaAjJnIAm4qNNHNQqqAzvi53GkyRCEoseUBrHohZsjUbkR8gfKtc/+Oa72lwxJ8Mq6HDfDATbfbJhzeIuFQJSiw1uZprHlzUf90WgqG76zO0eCB1WdPv1IT6sNxxh91GEL2YpgC97ikFHyoaH92ndwduqZ6IYjkg20DX33MWdoZk7QkcKUCgisIYslOaaLyvIIqRKWQj16jE1DlQWJJaPopWTJjXfixEjRJJo8g4++wuQjbq+WVYjsqCuNIQW3YjnxKe2M5ZKEqq+cX7ZVgnkbsU3RWIyXA1rxv4kGersYJjD//auldXGmcEbcfTeF16Y1708FB1HIfmWv6dSFi6oD4E+RIjCsEZ+kY7dKnwReJJw3xCjKvi3kGN42rvyhUlIz0Bp+fNSV5xwFiuBzG296e5s/oHoFtUyUplmPulIPl+e1CQIQVtjlzLzzzbV+D/OVQtYzo5ixtMi5BmHuG4N/uKfJk5UIREp7+12oZlKtPBomXSzAY0KgtbPzzZoHQxujnREUgBU+O/jKKhgxVhRPtbqyHiUaRwRpHv7pgRPyUrnE7fYkVblGmfTY28tFCvlILC04Tz3ivkNWVazA+OsYrxvRM/hiNn8Fc4bQBeUZABGx5S/xFf9Lbbmk298X7iFg2yeimvsQqqJ+hYbt6uq+Zf9jC+Jcwiccd61NKQtFvGWrgJiHB5lwi6fR8KzYS7EaEHf/ka9EC7H8D+WEa3TEACHBkNSj/cXxFeq4RllC+fUFm2xtstYLL2nos1DfzsC9vqDDdRVcPA3Ho95aEQHvExVThXPqym65llkKlfRXbPTRiDepdylHjmV9YTWAEjlD9DdQnCem7Aj/ml58On366392214B5zrmQz/9ySG2mFqEwjq5sFl5tYJPw5hNz8lyZPUTsr5E0F2C9VMPnZckWP7+mbwp/BiN7f4kf7vtGnZF2JGvjK/sDX1RtcFY5oPQnE4lIAYV49U3C9SP0LCY/9i/WIFK9ORjzM9kG/KGrAuwFmgdEpdLaiqQNpCTGZVuAO65afkY1h33hrqyLjZy92JK3/twdj9pafFcwfXONmPQWldPlMe7jlP24Js0v9m8bIJ9TgS2IuRvE9ZVRaCwSJYOtAfL5H/YS4FfzKWKbek+GFulheyKtDNlBtrdmr+KU+ibHTdalzFUmMfxw3f36x+3cQbJLItSilW9cuvZEMjKw987jykZRlsH/UI+HlKfo2tLwemBEeBFtmxF2xmItA/dAIfQ+rXnm88dqvXa+GapOYVt/2waFimXFx3TC2MUiOi5/Ml+3rj/YU6Ihx2hXgiDXFsUeQkRAD6wF3SCPi2flk7XwKAA4zboqynuELD312EJ88lmDEVOMa1W/K/a8tGylZRMrMoILyoMQzzbDJHNZrhH77L9qSC42HVmKiZ5S0016UTp83gOhCwz9XItK9fgXfK3F5d7nZCBUekoLxrutQaPHa16Rjsa0gTrzyjqTnmcIcrxg6X6dkKiucudc0DD5W4pJPf0vuDW8r5/uw24YfMuxFRpD2ovT2mFX79xH6Jf+MVdv2TYqR6/955QgVPe3JCD/WjAYcLA9tpXgFiEjge2J5ljeI/iUzg91KQuHkII4mmHZxC3XQORLAC6G7uFn5LOmlnXkjFdoO976moNTxElS8HdxWoPAkjjocDR136m2l+f5t6xaaNgdodOvTu0rievnhNAB79WNrVs6EsPgkgfahF9gSFzzAd+rJSraw5Mllit7vUP5YxA843lUpu6/5jAR0RvH4rRXkSg3nE+O5GFyfe+L0s5r3k05FyghSFnKo4TTgs07qj4nTLqOYj6qaW9knJTDkF5OFMYbmCP+8H16Ty482OjvERV6OFyw043L9w3hoJi408sR+SGo1WviXUu8d7qS+ehKjpKwxeCthsm2LBFSFeetx0x4AaKPxtp3CxdWqCsLrB1s/j5TAhc1jNZsXWl6tjo/WDoewxzg8T8NnhZ1niUwL/nhfygLanCnRwaFGDyLw+sfZhyZ1UtYTp8TYB6dE7R3VsKKH95CUxJ8u8N+9u2/9HUNKHW3x3w5GQrfOPafk2w5qZq8MaHT0ebeY3wIsp3rN9lrpIsW9c1ws3VNV+JwNz0Lo9+V7zZr6GD56We6gWVIvtmam5GPPkVAbr74r6SwhuL+TRXtW/0pgyX16VNl4/EAD50TnUPuwrW6OcUO2VlWXS0inq872kk7GUlW6o/ozFKq+Sip6LcTtSDfDrPTcCHhx75H8BeRon+KG2wRwzfDgWhALmiWOMO6h3pm1UCZEPEjScyk7tdLx6WrdA2N1QTPENvNnhCQjW6kl057/qv7IwRryHrZBCwVSbLLnFRiHdTwk8mlYixFt1slEcPD7FVht13HyqVeyD55HOXrh2ElAxJyinGeoFzwKA91zfrdLvDxJSjzmImfvTisreI25EDcVfGsmxLVbfU8PGe/7NmWWKjXcdTJ11jAlVIY/Bv/mcxg/Q10vCHwKG1GW/XbJq5nxDhyLqiorn7Wd7VEVL8UgVzpHMjQ+Z8DUgSukiVwWAKkeTlVVeZ7t1DGnCgJVIdBPZAEK5f8CDyDNo7tK4/5DBjdD5MPV86TaEhGsLVFPQSI68KlBYy84FievdU9gWh6XZrugvtCZmi9vfd6db6V7FmoEcRHnG36VZH8N4aZaldq9zZawt1uBFgxYYx+Gs/qW1jwANeFy+LCoymyM6zgG7j8bGzUyLhvrbJkTYAEdICEb4kMKusKT9V3eIwMLsjdUdgijMc+7iKrr+TxrVWG0U+W95SGrxnxGrE4eaJFfgvAjUM4SAy8UaRwE9j6ZQH5qYAWGtXByvDiLSDfOD0yFA3UCMKSyQ30fyy1mIRg4ZcgZHLNHWl+c9SeijOvbOJxoQy7lTN2r3Y8p6ovxvUY74aOYbuVezryqXA6U+fcp6wSV9X5/OZKP18tB56Ua0gMyxJI7XyNT7IrqN8GsB9rL/kP5KMrjXxgqKLDa+V5OCH6a5hmOWemMUsea9vQl9t5Oce76PrTyTv50ExOqngE3PHPfSL//AItPdB7kGnyTRhVUUFNdJJ2z7RtktZwgmQzhBG/G7QsjZmJfCE7k75EmdIKH7xlnmDrNM/XbTT6FzldcH/rcRGxlPrv4qDScqE7JSmQABJWqRT/TUcJSwoQM+1jvDigvrjjH8oeK2in1S+/yO1j8xAws/T5u0VnIvAPqaE1atNuN0cuRliLcH2j0nTL4JpcR7w9Qya0JoaHgsOiALLCCzRkl1UUESz+ze/gIXHGtDwgYrK6pCFKJ1webSDog4zTlPkgXZqxlQDiYMjhDpwTtBW2WxthWbov9dt2X9XFLFmcF+eEc1UaQ74gqZiZsdj63pH1qcv3Vy8JYciogIVKsJ8Yy3J9w/GhjWVSQAmrS0BPOWK+RKV+0lWqXgYMnIFwpcZVD7zPSp547i9HlflB8gVnSTGmmq1ClO081OW/UH11pEQMfkEdDFzjLC1Cdo/BdL3s7cXb8J++Hzz1rhOUVZFIPehRiZ8VYu6+7Er7j5PSZu9g/GBdmNzJmyCD9wiswj9BZw+T3iBrg81re36ihMLjoVLoWc+62a1U/7qVX5CpvTVF7rocSAKwv4cBVqZm7lLDS/qoXs4fMs/VQi6BtVbNA3uSzKpQfjH1o3x4LrvkOn40zhm6hjduDglzJUwA0POabgdXIndp9fzhOo23Pe+Rk9GSLX0d71Poqry8NQDTzNlsa+JTNG9+UrEf+ngxCjGEsDCc0bz+udVRyHQI1jmEO3S+IOQycEq7XwB6z3wfMfa73m8PVRp+iOgtZfeSBl01xn03vMaQJkyj7vnhGCklsCWVRUl4y+5oNUzQ63B2dbjDF3vikd/3RUMifPYnX5Glfuk2FsV/7RqjI9yKTbE8wJY+74p7qXO8+dIYgjtLD/N8TJtRh04N9tXJA4H59IkMmLElgvr0Q5OCeVfdAt+5hkh4pQgfRMHpL74XatLQpPiOyHRs/OdmHtBf8nOZcxVKzdGclIN16lE7kJ+pVMjspOI+5+TqLRO6m0ZpNXJoZRv9MPDRcAfJUtNZHyig/s2wwReakFgPPJwCQmu1I30/tcBbji+Na53i1W1N+BqoY7Zxo+U/M9XyJ4Ok2SSkBtoOrwuhAY3a03Eu6l8wFdIG1cN+e8hopTkiKF093KuH/BcB39rMiGDLn6XVhGKEaaT/vqb/lufuAdpGExevF1+J9itkFhCfymWr9vGb3BTK4j598zRH7+e+MU9maruZqb0pkGxRDRE1CD4Z8LV4vhgPidk5w2Bq816g3nHw1//j3JStz7NR9HIWELO8TMn3QrP/zZp//+Dv9p429/ogv+GATR+n/UdF+ns9xNkXZQJXY4t9jMkJNUFygAtzndXwjss+yWH9HAnLQQfhAskdZS2l01HLWv7L7us5uTH409pqitvfSOQg/c+Zt7k879P3K9+WV68n7+3cZfuRd/dDPP/03rn+d+/nBvWfgDlt8+LzjqJ/vx3CnNOwiXhho778C96iD+1TBvRZYeP+EH81LE0vVwOOrmCLB3iKzI1x+vJEsrPH4uF0UB4TJ4X3uDfOCo3PYpYe0MF4bouh0DQ/l43fxUF7Y+dpWuvTSffB0yO2UQUETI/LwCZE3BvnevJ7c9zUlY3H58xzke6DNFDQG8n0WtDN4LAYN4nogKav1ezOfK/z+t6tsCTp+dhx4ymjWuCJk1dEUifDP+HyS4iP/Vg9B2jTo9L4NbiBuDS4nuuHW6H+JDQn2JtqRKGkEQPEYE7uzazXIkcxIAqUq1esasZBETlEZY7y7Jo+RoV/IsjY9eIMkUvr42Hc0xqtsavZvhz1OLwSxMOTuqzlhb0WbdOwBH9EYiyBjatz40bUxTHbiWxqJ0uma19qhPruvcWJlbiSSH48OLDDpaHPszvyct41ZfTu10+vjox6kOqK6v0K/gEPphEvMl/vwSv+A4Hhm36JSP9IXTyCZDm4kKsqD5ay8b1Sad/vaiyO5N/sDfEV6Z4q95E+yfjxpqBoBETW2C7xl4pIO2bDODDFurUPwE7EWC2Uplq+AHmBHvir2PSgkR12/Ry65O0aZtQPeXi9mTlF/Wj5GQ+vFkYyhXsLTjrBSP9hwk4GPqDP5rBn5/l8b0mLRAvRSzXHc293bs3s8EsdE3m2exxidWVB4joHR+S+dz5/W+v00K3TqN14CDBth8eWcsTbiwXPsygHdGid0PEdy6HHm2v/IUuV5RVapYmzGsX90mpnIdNGcOOq64Dbc5GUbYpD9M7S+6cLY//QmjxFLP5cuTFRm3vA5rkFZroFnO3bjHF35uU3s8mvL7Tp9nyTc4mymTJ5sLIp7umSnGkO23faehtz3mmTS7fbVx5rP7x3HXIjRNeq/A3xCs9JNB08c9S9BF2O3bOur0ItslFxXgRPdaapBIi4dRpKGxVz7ir69t/bc9qTxjvtOyGOfiLGDhR4fYywHv1WdOplxIV87TpLBy3Wc0QP0P9s4G7FBNOdITS/tep3o3h1TEa5XDDii7fWtqRzUEReP2fbxz7bHWWJdbIOxOUJZtItNZpTFRfj6vm9sYjRxQVO+WTdiOhdPeTJ+8YirPvoeL88l5iLYOHd3b/Imkq+1ZN1El3UikhftuteEYxf1Wujof8Pr4ICTu5ezZyZ4tHQMxlzUHLYO2VMOoNMGL/20S5i2o2obfk+8qqdR7xzbRDbgU0lnuIgz4LelQ5XS7xbLuSQtNS95v3ZUOdaUx/Qd8qxCt6xf2E62yb/HukLO6RyorV8KgYl5YNc75y+KvefrxY+lc/64y9kvWP0a0bDz/rojq+RWjO06WeruWqNFU7r3HPIcLWRql8ICZsz2Ls/qOm/CLn6++X+Qf7mGspYCrZod/lpl6Rw4xN/yuq8gqV4B6aHk1hVE1SfILxWu5gvXqbfARYQpspcxKp1F/c8XOPzkZvmoSw+vEqBLdrq1fr3wAPv5NnM9i8F+jdAuxkP5Z71c6uhK3enlnGymr7UsWZKC12qgUiG8XXGQ9mxnqz4GSIlybF9eXmbqj2sHX+a1jf0gRoONHRdRSrIq03Ty89eQ1GbV/Bk+du4+V15zls+vvERvZ4E7ZbnxWTVjDjb4o/k8jlw44pTIrUGxxuJvBeO+heuhOjpFsO6lVJ/aXnJDa/bM0Ql1cLbXE/Pbv3EZ3vj3iVrB5irjupZTzlnv677NrI9UNYNqbPgp/HZXS+lJmk87wec+7YOxTDo2aw2l3NfDr34VNlvqWJBknuK7oSlZ6/T10zuOoPZOeoIk81N+sL843WJ2Q4Z0fZ3scsqC/JV2fuhWi1jGURSKZV637lf53Xnnx16/vKEXY89aVJ0fv91jGdfG+G4+sniwHes4hS+udOr4RfhFhG/F5gUG35QaU+McuLmclb5ZWmR+sG5V6nf+PxYzlrnFGxpZaK8eqqVo0NfmAWoGfXDiT/FnUbWvzGDOTr8aktOZWg4BYvz5YH12ZbfCcGtNk+dDAZNGWvHov+PIOnY9Prjg8h/wLRrT69suaMVZ5bNuK00lSVpnqSX1NON/81FoP92rYndionwgOiA8WMf4vc8l15KqEEG4yAm2+WAN5Brfu1sq9suWYqgoajgOYt/JCk1gC8wPkK+XKCtRX6TAtgvrnuBgNRmn6I8lVDipOVB9kX6Oxkp4ZKyd1M6Gj8/v2U7k+YQBL95Kb9PQENucJb0JlW3b5tObN7m/Z1j1ev388d7o15zgXsI9CikAGAViR6lkJv7nb4Ak40M2G8TJ447kN+pvfHiOFjSUSP6PM+QfbAywKJCBaxSVxpizHseZUyUBhq59vFwrkyGoRiHbo0apweEZeSLuNiQ+HAekOnarFg00dZNXaPeoHPTRR0FmEyqYExOVaaaO8c0uFUh7U4e/UxdBmthlBDgg257Q33j1hA7HTxSeTTSuVnPZbgW1nodwmG16aKBDKxEetv7D9OjO0JhrbJTnoe+kcGoDJazFSO8/fUN9Jy/g4XK5PUkw2dgPDGpJqBfhe7GA+cjzfE/EGsMM+FV9nj9IAhrSfT/J3QE5TEIYyk5UjsI6ZZcCPr6A8FZUF4g9nnpVmjX90MLSQysIPD0nFzqwCcSJmIb5mYv2Cmk+C1MDFkZQyCBq4c/Yai9LJ6xYkGS/x2s5/frIW2vmG2Wrv0APpCdgCA9snFvfpe8uc0OwdRs4G9973PGEBnQB5qKrCQ6m6X/H7NInZ7y/1674/ZXOVp7OeuCRk8JFS516VHrnH1HkIUIlTIljjHaQtEtkJtosYul77cVwjk3gW1Ajaa6zWeyHGLlpk3VHE2VFzT2yI/EvlGUSz2H9zYE1s4nsKMtMqNyKNtL/59CpFJki5Fou6VXGm8vWATEPwrUVOLvoA8jLuwOzVBCgHB2Cr5V6OwEWtJEKokJkfc87h+sNHTvMb0KVTp5284QTPupoWvQVUwUeogZR3kBMESYo0mfukewRVPKh5+rzLQb7HKjFFIgWhj1w3yN/qCNoPI8XFiUgBNT1hCHBsAz8L7Oyt8wQWUFj92ONn/APyJFg8hzueqoJdNj57ROrFbffuS/XxrSXLTRgj5uxZjpgQYceeMc2wJrahReSKpm3QjHfqExTLAB2ipVumE8pqcZv8LYXQiPHHsgb5BMW8zM5pvQit+mQx8XGaVDcfVbLyMTlY8xcfmm/RSAT/H09UQol5gIz7rESDmnrQ4bURIB4iRXMDQwxgex1GgtDxKp2HayIkR+E/aDmCttNm2C6lytWdfOVzD6X2SpDWjQDlMRvAp1symWv4my1bPCD+E1EmGnMGWhNwmycJnDV2WrQNxO45ukEb08AAffizYKVULp15I4vbNK5DzWwCSUADfmKhfGSUqii1L2UsE8rB7mLuHuUJZOx4+WiizHBJ/hwboaBzhpNOVvgFTf5cJsHef7L1HCI9dOUUbb+YxUJWn6dYOLz+THi91kzY5dtO5c+grX7v0jEbsuoOGnoIreDIg/sFMyG+TyCLIcAWd1IZ1UNFxE8Uie13ucm40U2fcxC0u3WLvLOxwu+F7MWUsHsdtFQZ7W+nlfCASiAKyh8rnP3EyDByvtJb6Kax6/HkLzT9SyEyTMVM1zPtM0MJY14DmsWh4MgD15Ea9Hd00AdkTZ0EiG5NAGuIBzQJJ0JR0na+OB7lQA6UKxMfihIQ7GCCnVz694QvykWXTxpS2soDu+smru1UdIxSvAszBFD1c8c6ZOobA8bJiJIvuycgIXBQIXWwhyTgZDQxJTRXgEwRNAawGSXO0a1DKjdihLVNp/taE/xYhsgwe+VpKEEB4LlraQyE84gEihxCnbfoyOuJIEXy2FIYw+JjRusybKlU2g/vhTSGTydvCvXhYBdtAXtS2v7LkHtmXh/8fly1do8FI/D0f8UbzVb5h+KRhMGSAmR2mhi0YG/uj7wgxcfzCrMvdjitUIpXDX8ae2JcF/36qUWIMwN6JsjaRGNj+jEteGDcFyTUb8X/NHSucKMJp7pduxtD6KuxVlyxxwaeiC1FbGBESO84lbyrAugYxdl+2N8/6AgWpo/IeoAOcsG35IA/b3AuSyoa55L7llBLlaWlEWvuCFd8f8NfcTUgzJv6CbB+6ohWwodlk9nGWFpBAOaz5uEW5xBvmjnHFeDsb0mXwayj3mdYq5gxxNf3H3/tnCgHwjSrpSgVxLmiTtuszdRUFIsn6LiMPjL808vL1uQhDbM7aA43mISXReqjSskynIRcHCJ9qeFopJfx9tqyUoGbSwJex/0aDE3plBPGtNBYgWbdLom3+Q/bjdizR2/AS/c/dH/d3G7pyl1qDXgtOFtEqidwLqxPYtrNEveasWq3vPUUtqTeu8gpov4bdOQRI2kneFvRNMrShyVeEupK1PoLDPMSfWMIJcs267mGB8X9CehQCF0gIyhpP10mbyM7lwW1e6TGvHBV1sg/UyTghHPGRqMyaebC6pbB1WKNCQtlai1GGvmq9zUKaUzLaXsXEBYtHxmFbEZ2kJhR164LhWW2Tlp1dhsGE7ZgIWRBOx3Zcu2DxgH+G83WTPceKG0TgQKKiiNNOlWgvqNEbnrk6fVD+AqRam2OguZb0YWSTX88N+i/ELSxbaUUpPx4vJUzYg/WonSeA8xUK6u7DPHgpqWpEe6D4cXg5uK9FIYVba47V/nb+wyOtk+zG8RrS4EA0ouwa04iByRLSvoJA2FzaobbZtXnq8GdbfqEp5I2dpfpj59TCVif6+E75p665faiX8gS213RqBxTZqfHP46nF6NSenOneuT+vgbLUbdTH2/t0REFXZJOEB6DHvx6N6g9956CYrY/AYcm9gELJXYkrSi+0F0geKDZgOCIYkLU/+GOW5aGj8mvLFgtFH5+XC8hvAE3CvHRfl4ofM/Qwk4x2A+R+nyc9gNu/9Tem7XW4XRnyRymf52z09cTOdr+PG6+P/Vb4QiXlwauc5WB1z3o+IJjlbxI8MyWtSzT+k4sKVbhF3xa+vDts3NxXa87iiu+xRH9cAprnOL2h6vV54iQRXuOAj1s8nLFK8gZ70ThIQcWdF19/2xaJmT0efrkNDkWbpAQPdo92Z8+Hn/aLjbOzB9AI/k12fPs9HhUNDJ1u6ax2VxD3R6PywN7BrLJ26z6s3QoMp76qzzwetrDABKSGkfW5PwS1GvYNUbK6uRqxfyVGNyFB0E+OugMM8kKwmJmupuRWO8XkXXXQECyRVw9UyIrtCtcc4oNqXqr7AURBmKn6Khz3eBN96LwIJrAGP9mr/59uTOSx631suyT+QujDd4beUFpZ0kJEEnjlP+X/Kr2kCKhnENTg4BsMTOmMqlj2WMFLRUlVG0fzdCBgUta9odrJfpVdFomTi6ak0tFjXTcdqqvWBAzjY6hVrH9sbt3Z9gn+AVDpTcQImefbB4edirjzrsNievve4ZT4EUZWV3TxEsIW+9MT/RJoKfZZYSRGfC1CwPG/9rdMOM8qR/LUYvw5f/emUSoD7YSFuOoqchdUg2UePd1eCtFSKgxLSZ764oy4lvRCIH6bowPxZWwxNFctksLeil47pfevcBipkkBIc4ngZG+kxGZ71a72KQ7VaZ6MZOZkQJZXM6kb/Ac0/XkJx8dvyfJcWbI3zONEaEPIW8GbkYjsZcwy+eMoKrYjDmvEEixHzkCSCRPRzhOfJZuLdcbx19EL23MA8rnjTZZ787FGMnkqnpuzB5/90w1gtUSRaWcb0eta8198VEeZMUSfIhyuc4/nywFQ9uqn7jdqXh+5wwv+RK9XouNPbYdoEelNGo34KyySwigsrfCe0v/PlWPvQvQg8R0KgHO18mTVThhQrlbEQ0Kp/JxPdjHyR7E1QPw/ut0r+HDDG7BwZFm9IqEUZRpv2WpzlMkOemeLcAt5CsrzskLGaVOAxyySzZV/D2EY7ydNZMf8e8VhHcKGHAWNszf1EOq8fNstijMY4JXyATwTdncFFqcNDfDo+mWFvxJJpc4sEZtjXyBdoFcxbUmniCoKq5jydUHNjYJxMqN1KzYV62MugcELVhS3Bnd+TLLOh7dws/zSXWzxEb4Nj4aFun5x4kDWLK5TUF/yCXB/cZYvI9kPgVsG2jShtXkxfgT+xzjJofXqPEnIXIQ1lnIdmVzBOM90EXvJUW6a0nZ/7XjJGl8ToO3H/fdxnxmTNKBZxnkpXLVgLXCZywGT3YyS75w/PAH5I/jMuRspej8xZObU9kREbRA+kqjmKRFaKGWAmFQspC+QLbKPf0RaK3OXvBSWqo46p70ws/eZpu6jCtZUgQy6r4tHMPUdAgWGGUYNbuv/1a6K+MVFsd3T183+T8capSo6m0+Sh57fEeG/95dykGJBQMj09DSW2bY0mUonDy9a8trLnnL5B5LW3Nl8rJZNysO8Zb+80zXxqUGFpud3Qzwb7bf+8mq6x0TAnJU9pDQR9YQmZhlna2xuxJt0aCO/f1SU8gblOrbIyMsxTlVUW69VJPzYU2HlRXcqE2lLLxnObZuz2tT9CivfTAUYfmzJlt/lOPgsR6VN64/xQd4Jlk/RV7UKVv2Gx/AWsmTAuCWKhdwC+4HmKEKYZh2Xis4KsUR1BeObs1c13wqFRnocdmuheaTV30gvVXZcouzHKK5zwrN52jXJEuX6dGx3BCpV/++4f3hyaW/cQJLFKqasjsMuO3B3WlMq2gyYfdK1e7L2pO/tRye2mwzwZPfdUMrl5wdLqdd2Kv/wVtnpyWYhd49L6rsOV+8HXPrWH2Kup89l2tz6bf80iYSd+V4LROSOHeamvexR524q4r43rTmtFzQvArpvWfLYFZrbFspBsXNUqqenjxNNsFXatZvlIhk7teUPfK+YL32F8McTnjv0BZNppb+vshoCrtLXjIWq3EJXpVXIlG6ZNL0dh6qEm2WMwDjD3LfOfkGh1/czYc/0qhiD2ozNnH4882MVVt3JbVFkbwowNCO3KL5IoYW5wlVeGCViOuv1svZx7FbzxKzA4zGqBlRRaRWCobXaVq4yYCWbZf8eiJwt3OY+MFiSJengcFP2t0JMfzOiJ7cECvpx7neg1Rc5x+7myPJOXt2FohVRyXtD+/rDoTOyGYInJelZMjolecVHUhUNqvdZWg2J2t0jPmiLFeRD/8fOT4o+NGILb+TufCo9ceBBm3JLVn+MO2675n7qiEX/6W+188cYg3Zn5NSTjgOKfWFSAANa6raCxSoVU851oJLY11WIoYK0du0ec5E4tCnAPoKh71riTsjVIp3gKvBbEYQiNYrmH22oLQWA2AdwMnID6PX9b58dR2QKo4qag1D1Z+L/FwEKTR7osOZPWECPJIHQqPUsM5i/CH5YupVPfFA5pHUBcsesh8eO5YhyWnaVRPZn/BmdXVumZWPxMP5e28zm2uqHgFoT9CymHYNNrzrrjlXZM06HnzDxYNlI5b/QosxLmmrqDFqmogQdqk0WLkUceoAvQxHgkIyvWU69BPFr24VB6+lx75Rna6dGtrmOxDnvBojvi1/4dHjVeg8owofPe1cOnxU1ioh016s/Vudv9mhV9f35At+Sh28h1bpp8xhr09+vf47Elx3Ms6hyp6QvB3t0vnLbOhwo660cp7K0vvepabK7YJfxEWWfrC2YzJfYOjygPwfwd/1amTqa0hZ5ueebhWYVMubRTwIjj+0Oq0ohU3zfRfuL8gt59XsHdwKtxTQQ4Y2qz6gisxnm2UdlmpEkgOsZz7iEk6QOt8BuPwr+NR01LTqXmJo1C76o1N274twJvl+I069TiLpenK/miRxhyY8jvYV6W1WuSwhH9q7kuwnJMtm7IWcqs7HsnyHSqWXLSpYtZGaR1V3t0gauninFPZGtWskF65rtti48UV9uV9KM8kfDYs0pgB00S+TlzTXV6P8mxq15b9En8sz3jWSszcifZa/NuufPNnNTb031pptt0+sRSH/7UG8pzbsgtt3OG3ut7B9JzDMt2mTZuyRNIV8D54TuTrpNcHtgmMlYJeiY9XS83NYJicjRjtJSf9BZLsQv629QdDsKQhTK5CnXhpk7vMNkHzPhm0ExW/VCGApHfPyBagtZQTQmPHx7g5IXXsrQDPzIVhv2LB6Ih138iSDww1JNHrDvzUxvp73MsQBVhW8EbrReaVUcLB1R3PUXyaYG4HpJUcLVxMgDxcPkVRQpL7VTAGabDzbKcvg12t5P8TSGQkrj/gOrpnbiDHwluA73xbXts/L7u468cRWSWRtgTwlQnA47EKg0OiZDgFxAKQQUcsbGomITgeXUAAyKe03eA7Mp4gnyKQmm0LXJtEk6ddksMJCuxDmmHzmVhO+XaN2A54MIh3niw5CF7PwiXFZrnA8wOdeHLvvhdoqIDG9PDI7UnWWHq526T8y6ixJPhkuVKZnoUruOpUgOOp3iIKBjk+yi1vHo5cItHXb1PIKzGaZlRS0g5d3MV2pD8FQdGYLZ73aae/eEIUePMc4NFz8pIUfLCrrF4jVWH5gQneN3S8vANBmUXrEcKGn6hIUN95y1vpsvLwbGpzV9L0ZKTan6TDXM05236uLJcIEMKVAxKNT0K8WljuwNny3BNQRfzovA85beI9zr1AGNYnYCVkR1aGngWURUrgqR+gRrQhxW81l3CHevjvGEPzPMTxdsIfB9dfGRbZU0cg/1mcubtECX4tvaedmNAvTxCJtc2QaoUalGfENCGK7IS/O8CRpdOVca8EWCRwv2sSWE8CJPW5PCugjCXPd3h6U60cPD+bdhtXZuYB6stcoveE7Sm5MM2yvfUHXFSW7KzLmi7/EeEWL0wqcOH9MOSKjhCHHmw+JGLcYE/7SBZQCRggox0ZZTAxrlzNNXYXL5fNIjkdT4YMqVUz6p8YDt049v4OXGdg3qTrtLBUXOZf7ahPlZAY/O+7Sp0bvGSHdyQ8B1LOsplqMb9Se8VAE7gIdSZvxbRSrfl+Lk5Qaqi5QJceqjitdErcHXg/3MryljPSIAMaaloFm1cVwBJ8DNmkDqoGROSHFetrgjQ5CahuKkdH5pRPigMrgTtlFI8ufJPJSUlGgTjbBSvpRc0zypiUn6U5KZqcRoyrtzhmJ7/caeZkmVRwJQeLOG8LY6vP5ChpKhc8Js0El+n6FXqbx9ItdtLtYP92kKfaTLtCi8StLZdENJa9Ex1nOoz1kQ7qxoiZFKRyLf4O4CHRT0T/0W9F8epNKVoeyxUXhy3sQMMsJjQJEyMOjmOhMFgOmmlscV4eFi1CldU92yjwleirEKPW3bPAuEhRZV7JsKV3Lr5cETAiFuX5Nw5UlF7d2HZ96Bh0sgFIL5KGaKSoVYVlvdKpZJVP5+NZ7xDEkQhmDgsDKciazJCXJ6ZN2B3FY2f6VZyGl/t4aunGIAk/BHaS+i+SpdRfnB/OktOvyjinWNfM9Ksr6WwtCa1hCmeRI6icpFM4o8quCLsikU0tMoZI/9EqXRMpKGaWzofl4nQuVQm17d5fU5qXCQeCDqVaL9XJ9qJ08n3G3EFZS28SHEb3cdRBdtO0YcTzil3QknNKEe/smQ1fTb0XbpyNB5xAeuIlf+5KWlEY0DqJbsnzJlQxJPOVyHiKMx5Xu9FcEv1Fbg6Fhm4t+Jyy5JC1W3YO8dYLsO0PXPbxodBgttTbH3rt9Cp1lJIk2r3O1Zqu94eRbnIz2f50lWolYzuKsj4PMok4abHLO8NAC884hiXx5Fy5pWKO0bWL7uEGXaJCtznhP67SlQ4xjWIfgq6EpZ28QMtuZK7JC0RGbl9nA4XtFLug/NLMoH1pGt9IonAJqcEDLyH6TDROcbsmGPaGIxMo41IUAnQVPMPGByp4mOmh9ZQMkBAcksUK55LsZj7E5z5XuZoyWCKu6nHmDq22xI/9Z8YdxJy4kWpD16jLVrpwGLWfyOD0Wd+cBzFBxVaGv7S5k9qwh/5t/LQEXsRqI3Q9Rm3QIoaZW9GlsDaKOUyykyWuhNOprSEi0s1G4rgoiX1V743EELti+pJu5og6X0g6oTynUqlhH9k6ezyRi05NGZHz0nvp3HOJr7ebrAUFrDjbkFBObEvdQWkkUbL0pEvMU46X58vF9j9F3j6kpyetNUBItrEubW9ZvMPM4qNqLlsSBJqOH3XbNwv/cXDXNxN8iFLzUhteisYY+RlHYOuP29/Cb+L+xv+35Rv7xudnZ6ohK4cMPfCG8KI7dNmjNk/H4e84pOxn/sZHK9psfvj8ncA8qJz7O8xqbxESDivGJOZzF7o5PJLQ7g34qAWoyuA+x3btU98LT6ZyGyceIXjrqob2CAVql4VOTQPUQYvHV/g4zAuCZGvYQBtf0wmd5lilrvuEn1BXLny01B4h4SMDlYsnNpm9d7m9h578ufpef9Z4WplqWQvqo52fyUA7J24eZD5av6SyGIV9kpmHNqyvdfzcpEMw97BvknV2fq+MFHun9BT3Lsf8pbzvisWiIQvYkng+8Vxk1V+dli1u56kY50LRjaPdotvT5BwqtwyF+emo/z9J3yVUVGfKrxQtJMOAQWoQii/4dp9wgybSa5mkucmRLtEQZ/pz0tL/NVcgWAd95nEQ3Tg6tNbuyn3Iepz65L3huMUUBntllWuu4DbtOFSMSbpILV4fy6wlM0SOvi6CpLh81c1LreIvKd61uEWBcDw1lUBUW1I0Z+m/PaRlX+PQ/oxg0Ye6KUiIiTF4ADNk59Ydpt5/rkxmq9tV5Kcp/eQLUVVmBzQNVuytQCP6Ezd0G8eLxWyHpmZWJ3bAzkWTtg4lZlw42SQezEmiUPaJUuR/qklVA/87S4ArFCpALdY3QRdUw3G3XbWUp6aq9z0zUizcPa7351p9JXOZyfdZBFnqt90VzQndXB/mwf8LC9STj5kenVpNuqOQQP3mIRJj7eV21FxG8VAxKrEn3c+XfmZ800EPb9/5lIlijscUbB6da0RQaMook0zug1G0tKi/JBC4rw7/D3m4ARzAkzMcVrDcT2SyFtUdWAsFlsPDFqV3N+EjyXaoEePwroaZCiLqEzb8MW+PNE9TmTC01EzWli51PzZvUqkmyuROU+V6ik+Le/9qT6nwzUzf9tP68tYei0YaDGx6kAd7jn1cKqOCuYbiELH9zYqcc4MnRJjkeGiqaGwLImhyeKs+xKJMBlOJ05ow9gGCKZ1VpnMKoSCTbMS+X+23y042zOb5MtcY/6oBeAo1Vy89OTyhpavFP78jXCcFH0t7Gx24hMEOm2gsEfGabVpQgvFqbQKMsknFRRmuPHcZu0Su/WMFphZvB2r/EGbG72rpGGho3h+Msz0uGzJ7hNK2uqQiE1qmn0zgacKYYZBCqsxV+sjbpoVdSilW/b94n2xNb648VmNIoizqEWhBnsen+d0kbCPmRItfWqSBeOd9Wne3c6bcd6uvXOJ6WdiSsuXq0ndhqrQ4QoWUjCjYtZ0EAhnSOP1m44xkf0O7jXghrzSJWxP4a/t72jU29Vu2rvu4n7HfHkkmQOMGSS+NPeLGO5I73mC2B7+lMiBQQZRM9/9liLIfowupUFAbPBbR+lxDM6M8Ptgh1paJq5Rvs7yEuLQv/7d1oU2woFSb3FMPWQOKMuCuJ7pDDjpIclus5TeEoMBy2YdVB4fxmesaCeMNsEgTHKS5WDSGyNUOoEpcC2OFWtIRf0w27ck34/DjxRTVIcc9+kqZE6iMSiVDsiKdP/Xz5XfEhm/sBhO50p1rvJDlkyyxuJ9SPgs7YeUJBjXdeAkE+P9OQJm6SZnn1svcduI78dYmbkE2mtziPrcjVisXG78spLvbZaSFx/Rks9zP4LKn0Cdz/3JsetkT06A8f/yCgMO6Mb1Hme0JJ7b2wZz1qleqTuKBGokhPVUZ0dVu+tnQYNEY1fmkZSz6+EGZ5EzL7657mreZGR3jUfaEk458PDniBzsSmBKhDRzfXameryJv9/D5m6HIqZ0R+ouCE54Dzp4IJuuD1e4Dc5i+PpSORJfG23uVgqixAMDvchMR0nZdH5brclYwRoJRWv/rlxGRI5ffD5NPGmIDt7vDE1434pYdVZIFh89Bs94HGGJbTwrN8T6lh1HZFTOB4lWzWj6EVqxSMvC0/ljWBQ3F2kc/mO2b6tWonT2JEqEwFts8rz2h+oWNds9ceR2cb7zZvJTDppHaEhK5avWqsseWa2Dt5BBhabdWSktS80oMQrL4TvAM9b5HMmyDnO+OkkbMXfUJG7eXqTIG6lqSOEbqVR+qYdP7uWb57WEJqzyh411GAVsDinPs7KvUeXItlcMdOUWzXBH6zscymV1LLVCtc8IePojzXHF9m5b5zGwBRdzcyUJkiu938ApmAayRdJrX1PmVguWUvt2ThQ62czItTyWJMW2An/hdDfMK7SiFQlGIdAbltHz3ycoh7j9V7GxNWBpbtcSdqm4XxRwTawc3cbZ+xfSv9qQfEkDKfZTwCkqWGI/ur250ItXlMlh6vUNWEYIg9A3GzbgmbqvTN8js2YMo87CU5y6nZ4dbJLDQJj9fc7yM7tZzJDZFtqOcU8+mZjYlq4VmifI23iHb1ZoT9E+kT2dolnP1AfiOkt7PQCSykBiXy5mv637IegWSKj9IKrYZf4Lu9+I7ub+mkRdlvYzehh/jaJ9n7HUH5b2IbgeNdkY7wx1yVzxS7pbvky6+nmVUtRllEFfweUQ0/nG017WoUYSxs+j2B4FV/F62EtHlMWZXYrjGHpthnNb1x66LKZ0Qe92INWHdfR/vqp02wMS8r1G4dJqHok8KmQ7947G13a4YXbsGgHcBvRuVu1eAi4/A5+ZixmdSXM73LupB/LH7O9yxLTVXJTyBbI1S49TIROrfVCOb/czZ9pM4JsZx8kUz8dQGv7gUWKxXvTH7QM/3J2OuXXgciUhqY+cgtaOliQQVOYthBLV3xpESZT3rmfEYNZxmpBbb24CRao86prn+i9TNOh8VxRJGXJfXHATJHs1T5txgc/opYrY8XjlGQQbRcoxIBcnVsMjmU1ymmIUL4dviJXndMAJ0Yet+c7O52/p98ytlmAsGBaTAmMhimAnvp1TWNGM9BpuitGj+t810CU2UhorrjPKGtThVC8WaXw04WFnT5fTjqmPyrQ0tN3CkLsctVy2xr0ZWgiWVZ1OrlFjjxJYsOiZv2cAoOvE+7sY0I/TwWcZqMoyIKNOftwP7w++Rfg67ljfovKYa50if3fzE/8aPYVey/Nq35+nH2sLPh/fP5TsylSKGOZ4k69d2PnH43+kq++sRXHQqGArWdwhx+hpwQC6JgT2uxehYU4Zbw7oNb6/HLikPyJROGK2ouyr+vzseESp9G50T4AyFrSqOQ0rroCYP4sMDFBrHn342EyZTMlSyk47rHSq89Y9/nI3zG5lX16Z5lxphguLOcZUndL8wNcrkyjH82jqg8Bo8OYkynrxZvbFno5lUS3OPr8Ko3mX9NoRPdYOKKjD07bvgFgpZ/RF+YzkWvJ/Hs/tUbfeGzGWLxNAjfDzHHMVSDwB5SabQLsIZHiBp43FjGkaienYoDd18hu2BGwOK7U3o70K/WY/kuuKdmdrykIBUdG2mvE91L1JtTbh20mOLbk1vCAamu7utlXeGU2ooVikbU/actcgmsC1FKk2qmj3GWeIWbj4tGIxE7BLcBWUvvcnd/lYxsMV4F917fWeFB/XbINN3qGvIyTpCalz1lVewdIGqeAS/gB8Mi+sA+BqDiX3VGD2eUunTRbSY+AuDy4E3Qx3hAhwnSXX+B0zuj3eQ1miS8Vux2z/l6/BkWtjKGU72aJkOCWhGcSf3+kFkkB15vGOsQrSdFr6qTj0gBYiOlnBO41170gOWHSUoBVRU2JjwppYdhIFDfu7tIRHccSNM5KZOFDPz0TGMAjzzEpeLwTWp+kn201kU6NjbiMQJx83+LX1e1tZ10kuChJZ/XBUQ1dwaBHjTDJDqOympEk8X2M3VtVw21JksChA8w1tTefO3RJ1FMbqZ01bHHkudDB/OhLfe7P5GOHaI28ZXKTMuqo0hLWQ4HabBsGG7NbP1RiXtETz074er6w/OerJWEqjmkq2y51q1BVI+JUudnVa3ogBpzdhFE7fC7kybrAt2Z6RqDjATAUEYeYK45WMupBKQRtQlU+uNsjnzj6ZmGrezA+ASrWxQ6LMkHRXqXwNq7ftv28dUx/ZSJciDXP2SWJsWaN0FjPX9Yko6LobZ7aYW/IdUktI9apTLyHS8DyWPyuoZyxN1TK/vtfxk3HwWh6JczZC8Ftn0bIJay2g+n5wd7lm9rEsKO+svqVmi+c1j88hSCxbzrg4+HEP0Nt1/B6YW1XVm09T1CpAKjc9n18hjqsaFGdfyva1ZG0Xu3ip6N6JGpyTSqY5h4BOlpLPaOnyw45PdXTN+DtAKg7DLrLFTnWusoSBHk3s0d7YouJHq85/R09Tfc37ENXZF48eAYLnq9GLioNcwDZrC6FW6godB8JnqYUPvn0pWLfQz0lM0Yy8Mybgn84Ds3Q9bDP10bLyOV+qzxa4Rd9Dhu7cju8mMaONXK3UqmBQ9qIg7etIwEqM/kECk/Dzja4Bs1xR+Q/tCbc8IKrSGsTdJJ0vge7IG20W687uVmK6icWQ6cD3lwFzgNMGtFvO5qyJeKflGLAAcQZOrkxVwy3cWvqlGpvjmf9Qe6Ap20MPbV92DPV0OhFM4kz8Yr0ffC2zLWSQ1kqY6QdQrttR3kh1YLtQd1kCEv5hVoPIRWl5ERcUTttBIrWp6Xs5Ehh5OUUwI5aEBvuiDmUoENmnVw1FohCrbRp1A1E+XSlWVOTi7ADW+5Ohb9z1vK4qx5R5lPdGCPBJZ00mC+Ssp8VUbgpGAvXWMuWQQRbCqI6Rr2jtxZxtfP7W/8onz+yz0Gs76LaT5HX9ecyiZCB/ZR/gFtMxPsDwohoeCRtiuLxE1GM1vUEUgBv86+eehL58/P56QFGQ/MqOe/vC76L63jzmeax4exd/OKTUvkXg+fOJUHych9xt/9goJMrapSgvXrj8+8vk/N80f22Sewj6cyGqt1B6mztoeklVHHraouhvHJaG/OuBz6DHKMpFmQULU1bRWlyYE0RPXYYkUycIemN7TLtgNCJX6BqdyxDKkegO7nJK5xQ7OVYDZTMf9bVHidtk6DQX9Et+V9M7esgbsYBdEeUpsB0Xvw2kd9+rI7V+m47u+O/tq7mw7262HU1WlS9uFzsV6JxIHNmUCy0QS9e077JGRFbG65z3/dOKB/Zk+yDdKpUmdXjn/aS3N5nv4fK7bMHHmPlHd4E2+iTbV5rpzScRnxk6KARuDTJ8Q1LpK2mP8gj1EbuJ9RIyY+EWK4hCiIDBAS1Tm2IEXAFfgKPgdL9O6mAa06wjCcUAL6EsxPQWO9VNegBPm/0GgkZbDxCynxujX/92vmGcjZRMAY45puak2sFLCLSwXpEsyy5fnF0jGJBhm+fNSHKKUUfy+276A7/feLOFxxUuHRNJI2Osenxyvf8DAGObT60pfTTlhEg9u/KKkhJqm5U1/+BEcSkpFDA5XeCqxwXmPac1jcuZ3JWQ+p0NdWzb/5v1ZvF8GtMTFFEdQjpLO0bwPb0BHNWnip3liDXI2fXf05jjvfJ0NpjLCUgfTh9CMFYVFKEd4Z/OG/2C+N435mnK+9t1gvCiVcaaH7rK4+PjCvpVNiz+t2QyqH1O8x3JKZVl6Q+Lp/XK8wMjVMslOq9FdSw5FtUs/CptXH9PW+wbWHgrV17R5jTVOtGtKFu3nb80T+E0tv9QkzW3J2dbaw/8ddAKZ0pxIaEqLjlPrji3VgJ3GvdFvlqD8075woxh4fVt0JZE0KVFsAvqhe0dqN9b35jtSpnYMXkU+vZq+IAHad3IHc2s/LYrnD1anfG46IFiMIr9oNbZDWvwthqYNqOigaKd/XlLU4XHfk/PXIjPsLy/9/kAtQ+/wKH+hI/IROWj5FPvTZAT9f7j4ZXQyG4M0TujMAFXYkKvEHv1xhySekgXGGqNxWeWKlf8dDAlLuB1cb/qOD+rk7cmwt+1yKpk9cudqBanTi6zTbXRtV8qylNtjyOVKy1HTz0GW9rjt6sSjAZcT5R+KdtyYb0zyqG9pSLuCw5WBwAn7fjBjKLLoxLXMI+52L9cLwIR2B6OllJZLHJ8vDxmWdtF+QJnmt1rsHPIWY20lftk8fYePkAIg6Hgn532QoIpegMxiWgAOfe5/U44APR8Ac0NeZrVh3gEhs12W+tVSiWiUQekf/YBECUy5fdYbA08dd7VzPAP9aiVcIB9k6tY7WdJ1wNV+bHeydNtmC6G5ICtFC1ZwmJU/j8hf0I8TRVKSiz5oYIa93EpUI78X8GYIAZabx47/n8LDAAJ0nNtP1rpROprqKMBRecShca6qXuTSI3jZBLOB3Vp381B5rCGhjSvh/NSVkYp2qIdP/Bg="; },{}],6:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Collection of static dictionary words. */ var data = require('./dictionary-browser'); exports.init = function() { exports.dictionary = data.init(); }; exports.offsetsByLength = new Uint32Array([ 0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032, 53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536, 115968, 118528, 119872, 121280, 122016, ]); exports.sizeBitsByLength = new Uint8Array([ 0, 0, 0, 0, 10, 10, 11, 11, 10, 10, 10, 10, 10, 9, 9, 8, 7, 7, 8, 7, 7, 6, 6, 5, 5, ]); exports.minDictionaryWordLength = 4; exports.maxDictionaryWordLength = 24; },{"./dictionary-browser":4}],7:[function(require,module,exports){ function HuffmanCode(bits, value) { this.bits = bits; /* number of bits used for this symbol */ this.value = value; /* symbol value or table offset */ } exports.HuffmanCode = HuffmanCode; var MAX_LENGTH = 15; /* Returns reverse(reverse(key, len) + 1, len), where reverse(key, len) is the bit-wise reversal of the len least significant bits of key. */ function GetNextKey(key, len) { var step = 1 << (len - 1); while (key & step) { step >>= 1; } return (key & (step - 1)) + step; } /* Stores code in table[0], table[step], table[2*step], ..., table[end] */ /* Assumes that end is an integer multiple of step */ function ReplicateValue(table, i, step, end, code) { do { end -= step; table[i + end] = new HuffmanCode(code.bits, code.value); } while (end > 0); } /* Returns the table width of the next 2nd level table. count is the histogram of bit lengths for the remaining symbols, len is the code length of the next processed symbol */ function NextTableBitSize(count, len, root_bits) { var left = 1 << (len - root_bits); while (len < MAX_LENGTH) { left -= count[len]; if (left <= 0) break; ++len; left <<= 1; } return len - root_bits; } exports.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) { var start_table = table; var code; /* current table entry */ var len; /* current code length */ var symbol; /* symbol index in original or sorted table */ var key; /* reversed prefix code */ var step; /* step size to replicate values in current table */ var low; /* low bits for current root entry */ var mask; /* mask for low bits */ var table_bits; /* key length of current table */ var table_size; /* size of current table */ var total_size; /* sum of root table size and 2nd level table sizes */ var sorted; /* symbols sorted by code length */ var count = new Int32Array(MAX_LENGTH + 1); /* number of codes of each length */ var offset = new Int32Array(MAX_LENGTH + 1); /* offsets in sorted table for each length */ sorted = new Int32Array(code_lengths_size); /* build histogram of code lengths */ for (symbol = 0; symbol < code_lengths_size; symbol++) { count[code_lengths[symbol]]++; } /* generate offsets into sorted symbol table by code length */ offset[1] = 0; for (len = 1; len < MAX_LENGTH; len++) { offset[len + 1] = offset[len] + count[len]; } /* sort symbols by length, by symbol order within each length */ for (symbol = 0; symbol < code_lengths_size; symbol++) { if (code_lengths[symbol] !== 0) { sorted[offset[code_lengths[symbol]]++] = symbol; } } table_bits = root_bits; table_size = 1 << table_bits; total_size = table_size; /* special case code with only one value */ if (offset[MAX_LENGTH] === 1) { for (key = 0; key < total_size; ++key) { root_table[table + key] = new HuffmanCode(0, sorted[0] & 0xffff); } return total_size; } /* fill in root table */ key = 0; symbol = 0; for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) { for (; count[len] > 0; --count[len]) { code = new HuffmanCode(len & 0xff, sorted[symbol++] & 0xffff); ReplicateValue(root_table, table + key, step, table_size, code); key = GetNextKey(key, len); } } /* fill in 2nd level tables and add pointers to root table */ mask = total_size - 1; low = -1; for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) { for (; count[len] > 0; --count[len]) { if ((key & mask) !== low) { table += table_size; table_bits = NextTableBitSize(count, len, root_bits); table_size = 1 << table_bits; total_size += table_size; low = key & mask; root_table[start_table + low] = new HuffmanCode((table_bits + root_bits) & 0xff, ((table - start_table) - low) & 0xffff); } code = new HuffmanCode((len - root_bits) & 0xff, sorted[symbol++] & 0xffff); ReplicateValue(root_table, table + (key >> root_bits), step, table_size, code); key = GetNextKey(key, len); } } return total_size; } },{}],8:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength exports.toByteArray = toByteArray exports.fromByteArray = fromByteArray var lookup = [] var revLookup = [] var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' for (var i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i] revLookup[code.charCodeAt(i)] = i } // Support decoding URL-safe base64 strings, as Node.js does. // See: https://en.wikipedia.org/wiki/Base64#URL_applications revLookup['-'.charCodeAt(0)] = 62 revLookup['_'.charCodeAt(0)] = 63 function getLens (b64) { var len = b64.length if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // Trim off extra bytes after placeholder bytes are found // See: https://github.com/beatgammit/base64-js/issues/42 var validLen = b64.indexOf('=') if (validLen === -1) validLen = len var placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4) return [validLen, placeHoldersLen] } // base64 is 4/3 + up to two characters of the original data function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function _byteLength (b64, validLen, placeHoldersLen) { return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function toByteArray (b64) { var tmp var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) var curByte = 0 // if there are placeholders, only get up to the last complete 4 chars var len = placeHoldersLen > 0 ? validLen - 4 : validLen for (var i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] arr[curByte++] = (tmp >> 16) & 0xFF arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp var output = [] for (var i = start; i < end; i += 3) { tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF) output.push(tripletToBase64(tmp)) } return output.join('') } function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var parts = [] var maxChunkLength = 16383 // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk( uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) )) } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1] parts.push( lookup[tmp >> 2] + lookup[(tmp << 4) & 0x3F] + '==' ) } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + uint8[len - 1] parts.push( lookup[tmp >> 10] + lookup[(tmp >> 4) & 0x3F] + lookup[(tmp << 2) & 0x3F] + '=' ) } return parts.join('') } },{}],9:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Lookup tables to map prefix codes to value ranges. This is used during decoding of the block lengths, literal insertion lengths and copy lengths. */ /* Represents the range of values belonging to a prefix code: */ /* [offset, offset + 2^nbits) */ function PrefixCodeRange(offset, nbits) { this.offset = offset; this.nbits = nbits; } exports.kBlockLengthPrefixCode = [ new PrefixCodeRange(1, 2), new PrefixCodeRange(5, 2), new PrefixCodeRange(9, 2), new PrefixCodeRange(13, 2), new PrefixCodeRange(17, 3), new PrefixCodeRange(25, 3), new PrefixCodeRange(33, 3), new PrefixCodeRange(41, 3), new PrefixCodeRange(49, 4), new PrefixCodeRange(65, 4), new PrefixCodeRange(81, 4), new PrefixCodeRange(97, 4), new PrefixCodeRange(113, 5), new PrefixCodeRange(145, 5), new PrefixCodeRange(177, 5), new PrefixCodeRange(209, 5), new PrefixCodeRange(241, 6), new PrefixCodeRange(305, 6), new PrefixCodeRange(369, 7), new PrefixCodeRange(497, 8), new PrefixCodeRange(753, 9), new PrefixCodeRange(1265, 10), new PrefixCodeRange(2289, 11), new PrefixCodeRange(4337, 12), new PrefixCodeRange(8433, 13), new PrefixCodeRange(16625, 24) ]; exports.kInsertLengthPrefixCode = [ new PrefixCodeRange(0, 0), new PrefixCodeRange(1, 0), new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 1), new PrefixCodeRange(8, 1), new PrefixCodeRange(10, 2), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 3), new PrefixCodeRange(26, 3), new PrefixCodeRange(34, 4), new PrefixCodeRange(50, 4), new PrefixCodeRange(66, 5), new PrefixCodeRange(98, 5), new PrefixCodeRange(130, 6), new PrefixCodeRange(194, 7), new PrefixCodeRange(322, 8), new PrefixCodeRange(578, 9), new PrefixCodeRange(1090, 10), new PrefixCodeRange(2114, 12), new PrefixCodeRange(6210, 14), new PrefixCodeRange(22594, 24), ]; exports.kCopyLengthPrefixCode = [ new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 0), new PrefixCodeRange(7, 0), new PrefixCodeRange(8, 0), new PrefixCodeRange(9, 0), new PrefixCodeRange(10, 1), new PrefixCodeRange(12, 1), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 2), new PrefixCodeRange(22, 3), new PrefixCodeRange(30, 3), new PrefixCodeRange(38, 4), new PrefixCodeRange(54, 4), new PrefixCodeRange(70, 5), new PrefixCodeRange(102, 5), new PrefixCodeRange(134, 6), new PrefixCodeRange(198, 7), new PrefixCodeRange(326, 8), new PrefixCodeRange(582, 9), new PrefixCodeRange(1094, 10), new PrefixCodeRange(2118, 24), ]; exports.kInsertRangeLut = [ 0, 0, 8, 8, 0, 16, 8, 16, 16, ]; exports.kCopyRangeLut = [ 0, 8, 0, 8, 16, 0, 16, 8, 16, ]; },{}],10:[function(require,module,exports){ function BrotliInput(buffer) { this.buffer = buffer; this.pos = 0; } BrotliInput.prototype.read = function(buf, i, count) { if (this.pos + count > this.buffer.length) { count = this.buffer.length - this.pos; } for (var p = 0; p < count; p++) buf[i + p] = this.buffer[this.pos + p]; this.pos += count; return count; } exports.BrotliInput = BrotliInput; function BrotliOutput(buf) { this.buffer = buf; this.pos = 0; } BrotliOutput.prototype.write = function(buf, count) { if (this.pos + count > this.buffer.length) throw new Error('Output buffer is not large enough'); this.buffer.set(buf.subarray(0, count), this.pos); this.pos += count; return count; }; exports.BrotliOutput = BrotliOutput; },{}],11:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Transformations on dictionary words. */ var BrotliDictionary = require('./dictionary'); var kIdentity = 0; var kOmitLast1 = 1; var kOmitLast2 = 2; var kOmitLast3 = 3; var kOmitLast4 = 4; var kOmitLast5 = 5; var kOmitLast6 = 6; var kOmitLast7 = 7; var kOmitLast8 = 8; var kOmitLast9 = 9; var kUppercaseFirst = 10; var kUppercaseAll = 11; var kOmitFirst1 = 12; var kOmitFirst2 = 13; var kOmitFirst3 = 14; var kOmitFirst4 = 15; var kOmitFirst5 = 16; var kOmitFirst6 = 17; var kOmitFirst7 = 18; var kOmitFirst8 = 19; var kOmitFirst9 = 20; function Transform(prefix, transform, suffix) { this.prefix = new Uint8Array(prefix.length); this.transform = transform; this.suffix = new Uint8Array(suffix.length); for (var i = 0; i < prefix.length; i++) this.prefix[i] = prefix.charCodeAt(i); for (var i = 0; i < suffix.length; i++) this.suffix[i] = suffix.charCodeAt(i); } var kTransforms = [ new Transform( "", kIdentity, "" ), new Transform( "", kIdentity, " " ), new Transform( " ", kIdentity, " " ), new Transform( "", kOmitFirst1, "" ), new Transform( "", kUppercaseFirst, " " ), new Transform( "", kIdentity, " the " ), new Transform( " ", kIdentity, "" ), new Transform( "s ", kIdentity, " " ), new Transform( "", kIdentity, " of " ), new Transform( "", kUppercaseFirst, "" ), new Transform( "", kIdentity, " and " ), new Transform( "", kOmitFirst2, "" ), new Transform( "", kOmitLast1, "" ), new Transform( ", ", kIdentity, " " ), new Transform( "", kIdentity, ", " ), new Transform( " ", kUppercaseFirst, " " ), new Transform( "", kIdentity, " in " ), new Transform( "", kIdentity, " to " ), new Transform( "e ", kIdentity, " " ), new Transform( "", kIdentity, "\"" ), new Transform( "", kIdentity, "." ), new Transform( "", kIdentity, "\">" ), new Transform( "", kIdentity, "\n" ), new Transform( "", kOmitLast3, "" ), new Transform( "", kIdentity, "]" ), new Transform( "", kIdentity, " for " ), new Transform( "", kOmitFirst3, "" ), new Transform( "", kOmitLast2, "" ), new Transform( "", kIdentity, " a " ), new Transform( "", kIdentity, " that " ), new Transform( " ", kUppercaseFirst, "" ), new Transform( "", kIdentity, ". " ), new Transform( ".", kIdentity, "" ), new Transform( " ", kIdentity, ", " ), new Transform( "", kOmitFirst4, "" ), new Transform( "", kIdentity, " with " ), new Transform( "", kIdentity, "'" ), new Transform( "", kIdentity, " from " ), new Transform( "", kIdentity, " by " ), new Transform( "", kOmitFirst5, "" ), new Transform( "", kOmitFirst6, "" ), new Transform( " the ", kIdentity, "" ), new Transform( "", kOmitLast4, "" ), new Transform( "", kIdentity, ". The " ), new Transform( "", kUppercaseAll, "" ), new Transform( "", kIdentity, " on " ), new Transform( "", kIdentity, " as " ), new Transform( "", kIdentity, " is " ), new Transform( "", kOmitLast7, "" ), new Transform( "", kOmitLast1, "ing " ), new Transform( "", kIdentity, "\n\t" ), new Transform( "", kIdentity, ":" ), new Transform( " ", kIdentity, ". " ), new Transform( "", kIdentity, "ed " ), new Transform( "", kOmitFirst9, "" ), new Transform( "", kOmitFirst7, "" ), new Transform( "", kOmitLast6, "" ), new Transform( "", kIdentity, "(" ), new Transform( "", kUppercaseFirst, ", " ), new Transform( "", kOmitLast8, "" ), new Transform( "", kIdentity, " at " ), new Transform( "", kIdentity, "ly " ), new Transform( " the ", kIdentity, " of " ), new Transform( "", kOmitLast5, "" ), new Transform( "", kOmitLast9, "" ), new Transform( " ", kUppercaseFirst, ", " ), new Transform( "", kUppercaseFirst, "\"" ), new Transform( ".", kIdentity, "(" ), new Transform( "", kUppercaseAll, " " ), new Transform( "", kUppercaseFirst, "\">" ), new Transform( "", kIdentity, "=\"" ), new Transform( " ", kIdentity, "." ), new Transform( ".com/", kIdentity, "" ), new Transform( " the ", kIdentity, " of the " ), new Transform( "", kUppercaseFirst, "'" ), new Transform( "", kIdentity, ". This " ), new Transform( "", kIdentity, "," ), new Transform( ".", kIdentity, " " ), new Transform( "", kUppercaseFirst, "(" ), new Transform( "", kUppercaseFirst, "." ), new Transform( "", kIdentity, " not " ), new Transform( " ", kIdentity, "=\"" ), new Transform( "", kIdentity, "er " ), new Transform( " ", kUppercaseAll, " " ), new Transform( "", kIdentity, "al " ), new Transform( " ", kUppercaseAll, "" ), new Transform( "", kIdentity, "='" ), new Transform( "", kUppercaseAll, "\"" ), new Transform( "", kUppercaseFirst, ". " ), new Transform( " ", kIdentity, "(" ), new Transform( "", kIdentity, "ful " ), new Transform( " ", kUppercaseFirst, ". " ), new Transform( "", kIdentity, "ive " ), new Transform( "", kIdentity, "less " ), new Transform( "", kUppercaseAll, "'" ), new Transform( "", kIdentity, "est " ), new Transform( " ", kUppercaseFirst, "." ), new Transform( "", kUppercaseAll, "\">" ), new Transform( " ", kIdentity, "='" ), new Transform( "", kUppercaseFirst, "," ), new Transform( "", kIdentity, "ize " ), new Transform( "", kUppercaseAll, "." ), new Transform( "\xc2\xa0", kIdentity, "" ), new Transform( " ", kIdentity, "," ), new Transform( "", kUppercaseFirst, "=\"" ), new Transform( "", kUppercaseAll, "=\"" ), new Transform( "", kIdentity, "ous " ), new Transform( "", kUppercaseAll, ", " ), new Transform( "", kUppercaseFirst, "='" ), new Transform( " ", kUppercaseFirst, "," ), new Transform( " ", kUppercaseAll, "=\"" ), new Transform( " ", kUppercaseAll, ", " ), new Transform( "", kUppercaseAll, "," ), new Transform( "", kUppercaseAll, "(" ), new Transform( "", kUppercaseAll, ". " ), new Transform( " ", kUppercaseAll, "." ), new Transform( "", kUppercaseAll, "='" ), new Transform( " ", kUppercaseAll, ". " ), new Transform( " ", kUppercaseFirst, "=\"" ), new Transform( " ", kUppercaseAll, "='" ), new Transform( " ", kUppercaseFirst, "='" ) ]; exports.kTransforms = kTransforms; exports.kNumTransforms = kTransforms.length; function ToUpperCase(p, i) { if (p[i] < 0xc0) { if (p[i] >= 97 && p[i] <= 122) { p[i] ^= 32; } return 1; } /* An overly simplified uppercasing model for utf-8. */ if (p[i] < 0xe0) { p[i + 1] ^= 32; return 2; } /* An arbitrary transform for three byte characters. */ p[i + 2] ^= 5; return 3; } exports.transformDictionaryWord = function(dst, idx, word, len, transform) { var prefix = kTransforms[transform].prefix; var suffix = kTransforms[transform].suffix; var t = kTransforms[transform].transform; var skip = t < kOmitFirst1 ? 0 : t - (kOmitFirst1 - 1); var i = 0; var start_idx = idx; var uppercase; if (skip > len) { skip = len; } var prefix_pos = 0; while (prefix_pos < prefix.length) { dst[idx++] = prefix[prefix_pos++]; } word += skip; len -= skip; if (t <= kOmitLast9) { len -= t; } for (i = 0; i < len; i++) { dst[idx++] = BrotliDictionary.dictionary[word + i]; } uppercase = idx - len; if (t === kUppercaseFirst) { ToUpperCase(dst, uppercase); } else if (t === kUppercaseAll) { while (len > 0) { var step = ToUpperCase(dst, uppercase); uppercase += step; len -= step; } } var suffix_pos = 0; while (suffix_pos < suffix.length) { dst[idx++] = suffix[suffix_pos++]; } return idx - start_idx; } },{"./dictionary":6}],12:[function(require,module,exports){ module.exports = require('./dec/decode').BrotliDecompressBuffer; },{"./dec/decode":3}]},{},[12])(12) }); /* eslint-enable */ /***/ }), /***/ 9681: /***/ ((module) => { var characterMap = { "À": "A", "Á": "A", "Â": "A", "Ã": "A", "Ä": "A", "Å": "A", "Ấ": "A", "Ắ": "A", "Ẳ": "A", "Ẵ": "A", "Ặ": "A", "Æ": "AE", "Ầ": "A", "Ằ": "A", "Ȃ": "A", "Ả": "A", "Ạ": "A", "Ẩ": "A", "Ẫ": "A", "Ậ": "A", "Ç": "C", "Ḉ": "C", "È": "E", "É": "E", "Ê": "E", "Ë": "E", "Ế": "E", "Ḗ": "E", "Ề": "E", "Ḕ": "E", "Ḝ": "E", "Ȇ": "E", "Ẻ": "E", "Ẽ": "E", "Ẹ": "E", "Ể": "E", "Ễ": "E", "Ệ": "E", "Ì": "I", "Í": "I", "Î": "I", "Ï": "I", "Ḯ": "I", "Ȋ": "I", "Ỉ": "I", "Ị": "I", "Ð": "D", "Ñ": "N", "Ò": "O", "Ó": "O", "Ô": "O", "Õ": "O", "Ö": "O", "Ø": "O", "Ố": "O", "Ṍ": "O", "Ṓ": "O", "Ȏ": "O", "Ỏ": "O", "Ọ": "O", "Ổ": "O", "Ỗ": "O", "Ộ": "O", "Ờ": "O", "Ở": "O", "Ỡ": "O", "Ớ": "O", "Ợ": "O", "Ù": "U", "Ú": "U", "Û": "U", "Ü": "U", "Ủ": "U", "Ụ": "U", "Ử": "U", "Ữ": "U", "Ự": "U", "Ý": "Y", "à": "a", "á": "a", "â": "a", "ã": "a", "ä": "a", "å": "a", "ấ": "a", "ắ": "a", "ẳ": "a", "ẵ": "a", "ặ": "a", "æ": "ae", "ầ": "a", "ằ": "a", "ȃ": "a", "ả": "a", "ạ": "a", "ẩ": "a", "ẫ": "a", "ậ": "a", "ç": "c", "ḉ": "c", "è": "e", "é": "e", "ê": "e", "ë": "e", "ế": "e", "ḗ": "e", "ề": "e", "ḕ": "e", "ḝ": "e", "ȇ": "e", "ẻ": "e", "ẽ": "e", "ẹ": "e", "ể": "e", "ễ": "e", "ệ": "e", "ì": "i", "í": "i", "î": "i", "ï": "i", "ḯ": "i", "ȋ": "i", "ỉ": "i", "ị": "i", "ð": "d", "ñ": "n", "ò": "o", "ó": "o", "ô": "o", "õ": "o", "ö": "o", "ø": "o", "ố": "o", "ṍ": "o", "ṓ": "o", "ȏ": "o", "ỏ": "o", "ọ": "o", "ổ": "o", "ỗ": "o", "ộ": "o", "ờ": "o", "ở": "o", "ỡ": "o", "ớ": "o", "ợ": "o", "ù": "u", "ú": "u", "û": "u", "ü": "u", "ủ": "u", "ụ": "u", "ử": "u", "ữ": "u", "ự": "u", "ý": "y", "ÿ": "y", "Ā": "A", "ā": "a", "Ă": "A", "ă": "a", "Ą": "A", "ą": "a", "Ć": "C", "ć": "c", "Ĉ": "C", "ĉ": "c", "Ċ": "C", "ċ": "c", "Č": "C", "č": "c", "C̆": "C", "c̆": "c", "Ď": "D", "ď": "d", "Đ": "D", "đ": "d", "Ē": "E", "ē": "e", "Ĕ": "E", "ĕ": "e", "Ė": "E", "ė": "e", "Ę": "E", "ę": "e", "Ě": "E", "ě": "e", "Ĝ": "G", "Ǵ": "G", "ĝ": "g", "ǵ": "g", "Ğ": "G", "ğ": "g", "Ġ": "G", "ġ": "g", "Ģ": "G", "ģ": "g", "Ĥ": "H", "ĥ": "h", "Ħ": "H", "ħ": "h", "Ḫ": "H", "ḫ": "h", "Ĩ": "I", "ĩ": "i", "Ī": "I", "ī": "i", "Ĭ": "I", "ĭ": "i", "Į": "I", "į": "i", "İ": "I", "ı": "i", "IJ": "IJ", "ij": "ij", "Ĵ": "J", "ĵ": "j", "Ķ": "K", "ķ": "k", "Ḱ": "K", "ḱ": "k", "K̆": "K", "k̆": "k", "Ĺ": "L", "ĺ": "l", "Ļ": "L", "ļ": "l", "Ľ": "L", "ľ": "l", "Ŀ": "L", "ŀ": "l", "Ł": "l", "ł": "l", "Ḿ": "M", "ḿ": "m", "M̆": "M", "m̆": "m", "Ń": "N", "ń": "n", "Ņ": "N", "ņ": "n", "Ň": "N", "ň": "n", "ʼn": "n", "N̆": "N", "n̆": "n", "Ō": "O", "ō": "o", "Ŏ": "O", "ŏ": "o", "Ő": "O", "ő": "o", "Œ": "OE", "œ": "oe", "P̆": "P", "p̆": "p", "Ŕ": "R", "ŕ": "r", "Ŗ": "R", "ŗ": "r", "Ř": "R", "ř": "r", "R̆": "R", "r̆": "r", "Ȓ": "R", "ȓ": "r", "Ś": "S", "ś": "s", "Ŝ": "S", "ŝ": "s", "Ş": "S", "Ș": "S", "ș": "s", "ş": "s", "Š": "S", "š": "s", "Ţ": "T", "ţ": "t", "ț": "t", "Ț": "T", "Ť": "T", "ť": "t", "Ŧ": "T", "ŧ": "t", "T̆": "T", "t̆": "t", "Ũ": "U", "ũ": "u", "Ū": "U", "ū": "u", "Ŭ": "U", "ŭ": "u", "Ů": "U", "ů": "u", "Ű": "U", "ű": "u", "Ų": "U", "ų": "u", "Ȗ": "U", "ȗ": "u", "V̆": "V", "v̆": "v", "Ŵ": "W", "ŵ": "w", "Ẃ": "W", "ẃ": "w", "X̆": "X", "x̆": "x", "Ŷ": "Y", "ŷ": "y", "Ÿ": "Y", "Y̆": "Y", "y̆": "y", "Ź": "Z", "ź": "z", "Ż": "Z", "ż": "z", "Ž": "Z", "ž": "z", "ſ": "s", "ƒ": "f", "Ơ": "O", "ơ": "o", "Ư": "U", "ư": "u", "Ǎ": "A", "ǎ": "a", "Ǐ": "I", "ǐ": "i", "Ǒ": "O", "ǒ": "o", "Ǔ": "U", "ǔ": "u", "Ǖ": "U", "ǖ": "u", "Ǘ": "U", "ǘ": "u", "Ǚ": "U", "ǚ": "u", "Ǜ": "U", "ǜ": "u", "Ứ": "U", "ứ": "u", "Ṹ": "U", "ṹ": "u", "Ǻ": "A", "ǻ": "a", "Ǽ": "AE", "ǽ": "ae", "Ǿ": "O", "ǿ": "o", "Þ": "TH", "þ": "th", "Ṕ": "P", "ṕ": "p", "Ṥ": "S", "ṥ": "s", "X́": "X", "x́": "x", "Ѓ": "Г", "ѓ": "г", "Ќ": "К", "ќ": "к", "A̋": "A", "a̋": "a", "E̋": "E", "e̋": "e", "I̋": "I", "i̋": "i", "Ǹ": "N", "ǹ": "n", "Ồ": "O", "ồ": "o", "Ṑ": "O", "ṑ": "o", "Ừ": "U", "ừ": "u", "Ẁ": "W", "ẁ": "w", "Ỳ": "Y", "ỳ": "y", "Ȁ": "A", "ȁ": "a", "Ȅ": "E", "ȅ": "e", "Ȉ": "I", "ȉ": "i", "Ȍ": "O", "ȍ": "o", "Ȑ": "R", "ȑ": "r", "Ȕ": "U", "ȕ": "u", "B̌": "B", "b̌": "b", "Č̣": "C", "č̣": "c", "Ê̌": "E", "ê̌": "e", "F̌": "F", "f̌": "f", "Ǧ": "G", "ǧ": "g", "Ȟ": "H", "ȟ": "h", "J̌": "J", "ǰ": "j", "Ǩ": "K", "ǩ": "k", "M̌": "M", "m̌": "m", "P̌": "P", "p̌": "p", "Q̌": "Q", "q̌": "q", "Ř̩": "R", "ř̩": "r", "Ṧ": "S", "ṧ": "s", "V̌": "V", "v̌": "v", "W̌": "W", "w̌": "w", "X̌": "X", "x̌": "x", "Y̌": "Y", "y̌": "y", "A̧": "A", "a̧": "a", "B̧": "B", "b̧": "b", "Ḑ": "D", "ḑ": "d", "Ȩ": "E", "ȩ": "e", "Ɛ̧": "E", "ɛ̧": "e", "Ḩ": "H", "ḩ": "h", "I̧": "I", "i̧": "i", "Ɨ̧": "I", "ɨ̧": "i", "M̧": "M", "m̧": "m", "O̧": "O", "o̧": "o", "Q̧": "Q", "q̧": "q", "U̧": "U", "u̧": "u", "X̧": "X", "x̧": "x", "Z̧": "Z", "z̧": "z", "й":"и", "Й":"И", "ё":"е", "Ё":"Е", }; var chars = Object.keys(characterMap).join('|'); var allAccents = new RegExp(chars, 'g'); var firstAccent = new RegExp(chars, ''); function matcher(match) { return characterMap[match]; } var removeAccents = function(string) { return string.replace(allAccents, matcher); }; var hasAccents = function(string) { return !!string.match(firstAccent); }; module.exports = removeAccents; module.exports.has = hasAccents; module.exports.remove = removeAccents; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/create fake namespace object */ /******/ (() => { /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); /******/ var leafPrototypes; /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 16: return value when it's Promise-like /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = this(value); /******/ if(mode & 8) return value; /******/ if(typeof value === 'object' && value) { /******/ if((mode & 4) && value.__esModule) return value; /******/ if((mode & 16) && typeof value.then === 'function') return value; /******/ } /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } /******/ def['default'] = () => (value); /******/ __webpack_require__.d(ns, def); /******/ return ns; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), PluginSidebar: () => (/* reexport */ PluginSidebar), PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), PluginTemplateSettingPanel: () => (/* reexport */ plugin_template_setting_panel), initializeEditor: () => (/* binding */ initializeEditor), initializePostsDashboard: () => (/* reexport */ initializePostsDashboard), reinitializeEditor: () => (/* binding */ reinitializeEditor), store: () => (/* reexport */ store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), addTemplate: () => (addTemplate), closeGeneralSidebar: () => (closeGeneralSidebar), openGeneralSidebar: () => (openGeneralSidebar), openNavigationPanelToMenu: () => (openNavigationPanelToMenu), removeTemplate: () => (removeTemplate), revertTemplate: () => (revertTemplate), setEditedEntity: () => (setEditedEntity), setEditedPostContext: () => (setEditedPostContext), setHasPageContentFocus: () => (setHasPageContentFocus), setHomeTemplateId: () => (setHomeTemplateId), setIsInserterOpened: () => (setIsInserterOpened), setIsListViewOpened: () => (setIsListViewOpened), setIsNavigationPanelOpened: () => (setIsNavigationPanelOpened), setIsSaveViewOpened: () => (setIsSaveViewOpened), setNavigationMenu: () => (setNavigationMenu), setNavigationPanelActiveMenu: () => (setNavigationPanelActiveMenu), setPage: () => (setPage), setTemplate: () => (setTemplate), setTemplatePart: () => (setTemplatePart), switchEditorMode: () => (switchEditorMode), toggleDistractionFree: () => (toggleDistractionFree), toggleFeature: () => (toggleFeature), updateSettings: () => (updateSettings) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js var private_actions_namespaceObject = {}; __webpack_require__.r(private_actions_namespaceObject); __webpack_require__.d(private_actions_namespaceObject, { registerRoute: () => (registerRoute), setEditorCanvasContainerView: () => (setEditorCanvasContainerView), unregisterRoute: () => (unregisterRoute) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), getCanUserCreateMedia: () => (getCanUserCreateMedia), getCurrentTemplateNavigationPanelSubMenu: () => (getCurrentTemplateNavigationPanelSubMenu), getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts), getEditedPostContext: () => (getEditedPostContext), getEditedPostId: () => (getEditedPostId), getEditedPostType: () => (getEditedPostType), getEditorMode: () => (getEditorMode), getHomeTemplateId: () => (getHomeTemplateId), getNavigationPanelActiveMenu: () => (getNavigationPanelActiveMenu), getPage: () => (getPage), getReusableBlocks: () => (getReusableBlocks), getSettings: () => (getSettings), hasPageContentFocus: () => (hasPageContentFocus), isFeatureActive: () => (isFeatureActive), isInserterOpened: () => (isInserterOpened), isListViewOpened: () => (isListViewOpened), isNavigationOpened: () => (isNavigationOpened), isPage: () => (isPage), isSaveViewOpened: () => (isSaveViewOpened) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js var private_selectors_namespaceObject = {}; __webpack_require__.r(private_selectors_namespaceObject); __webpack_require__.d(private_selectors_namespaceObject, { getEditorCanvasContainerView: () => (getEditorCanvasContainerView), getRoutes: () => (getRoutes) }); ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","blockLibrary"] const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","editor"] const external_wp_editor_namespaceObject = window["wp"]["editor"]; ;// external ["wp","preferences"] const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// external ["wp","widgets"] const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// ./node_modules/colord/index.mjs var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||colord_p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},colord_j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; ;// ./node_modules/colord/plugins/a11y.mjs var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-site'); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalSetting, useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); // Enable colord's a11y plugin. k([a11y]); function useColorRandomizer(name) { const [themeColors, setThemeColors] = useGlobalSetting('color.palette.theme', name); function randomizeColors() { /* eslint-disable no-restricted-syntax */ const randomRotationValue = Math.floor(Math.random() * 225); /* eslint-enable no-restricted-syntax */ const newColors = themeColors.map(colorObject => { const { color } = colorObject; const newColor = w(color).rotate(randomRotationValue).toHex(); return { ...colorObject, color: newColor }; }); setThemeColors(newColors); } return window.__experimentalEnableColorRandomizer ? [randomizeColors] : []; } function useStylesPreviewColors() { const [textColor = 'black'] = useGlobalStyle('color.text'); const [backgroundColor = 'white'] = useGlobalStyle('color.background'); const [headingColor = textColor] = useGlobalStyle('elements.h1.color.text'); const [linkColor = headingColor] = useGlobalStyle('elements.link.color.text'); const [buttonBackgroundColor = linkColor] = useGlobalStyle('elements.button.color.background'); const [coreColors] = useGlobalSetting('color.palette.core'); const [themeColors] = useGlobalSetting('color.palette.theme'); const [customColors] = useGlobalSetting('color.palette.custom'); const paletteColors = (themeColors !== null && themeColors !== void 0 ? themeColors : []).concat(customColors !== null && customColors !== void 0 ? customColors : []).concat(coreColors !== null && coreColors !== void 0 ? coreColors : []); const textColorObject = paletteColors.filter(({ color }) => color === textColor); const buttonBackgroundColorObject = paletteColors.filter(({ color }) => color === buttonBackgroundColor); const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter( // we exclude these background color because it is already visible in the preview. ({ color }) => color !== backgroundColor).slice(0, 2); return { paletteColors, highlightedColors }; } function useSupportedStyles(name, element) { const { supportedPanels } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { supportedPanels: unlock(select(external_wp_blocks_namespaceObject.store)).getSupportedStyles(name, element) }; }, [name, element]); return supportedPanels; } ;// ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js /** * Sets the value at path of object. * If a portion of path doesn’t exist, it’s created. * Arrays are created for missing index properties while objects are created * for all other missing properties. * * This function intentionally mutates the input object. * * Inspired by _.set(). * * @see https://lodash.com/docs/4.17.15#set * * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`. * * @param {Object} object Object to modify * @param {Array} path Path of the property to set. * @param {*} value Value to set. */ function setNestedValue(object, path, value) { if (!object || typeof object !== 'object') { return object; } path.reduce((acc, key, idx) => { if (acc[key] === undefined) { if (Number.isInteger(path[idx + 1])) { acc[key] = []; } else { acc[key] = {}; } } if (idx === path.length - 1) { acc[key] = value; } return acc[key]; }, object); return object; } ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js /* wp:polyfill */ /** * WordPress dependencies */ /** * Internal dependencies */ const { cleanEmptyObject, GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis); // Block Gap is a special case and isn't defined within the blocks // style properties config. We'll add it here to allow it to be pushed // to global styles as well. const STYLE_PROPERTY = { ...external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, blockGap: { value: ['spacing', 'blockGap'] } }; // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be // removed by moving PushChangesToGlobalStylesControl to // @wordpress/block-editor. const STYLE_PATH_TO_CSS_VAR_INFIX = { 'border.color': 'color', 'color.background': 'color', 'color.text': 'color', 'elements.link.color.text': 'color', 'elements.link.:hover.color.text': 'color', 'elements.link.typography.fontFamily': 'font-family', 'elements.link.typography.fontSize': 'font-size', 'elements.button.color.text': 'color', 'elements.button.color.background': 'color', 'elements.button.typography.fontFamily': 'font-family', 'elements.button.typography.fontSize': 'font-size', 'elements.caption.color.text': 'color', 'elements.heading.color': 'color', 'elements.heading.color.background': 'color', 'elements.heading.typography.fontFamily': 'font-family', 'elements.heading.gradient': 'gradient', 'elements.heading.color.gradient': 'gradient', 'elements.h1.color': 'color', 'elements.h1.color.background': 'color', 'elements.h1.typography.fontFamily': 'font-family', 'elements.h1.color.gradient': 'gradient', 'elements.h2.color': 'color', 'elements.h2.color.background': 'color', 'elements.h2.typography.fontFamily': 'font-family', 'elements.h2.color.gradient': 'gradient', 'elements.h3.color': 'color', 'elements.h3.color.background': 'color', 'elements.h3.typography.fontFamily': 'font-family', 'elements.h3.color.gradient': 'gradient', 'elements.h4.color': 'color', 'elements.h4.color.background': 'color', 'elements.h4.typography.fontFamily': 'font-family', 'elements.h4.color.gradient': 'gradient', 'elements.h5.color': 'color', 'elements.h5.color.background': 'color', 'elements.h5.typography.fontFamily': 'font-family', 'elements.h5.color.gradient': 'gradient', 'elements.h6.color': 'color', 'elements.h6.color.background': 'color', 'elements.h6.typography.fontFamily': 'font-family', 'elements.h6.color.gradient': 'gradient', 'color.gradient': 'gradient', blockGap: 'spacing', 'typography.fontSize': 'font-size', 'typography.fontFamily': 'font-family' }; // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be // removed by moving PushChangesToGlobalStylesControl to // @wordpress/block-editor. const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 'border.color': 'borderColor', 'color.background': 'backgroundColor', 'color.text': 'textColor', 'color.gradient': 'gradient', 'typography.fontSize': 'fontSize', 'typography.fontFamily': 'fontFamily' }; const SUPPORTED_STYLES = ['border', 'color', 'spacing', 'typography']; const getValueFromObjectPath = (object, path) => { let value = object; path.forEach(fieldName => { value = value?.[fieldName]; }); return value; }; const flatBorderProperties = ['borderColor', 'borderWidth', 'borderStyle']; const sides = ['top', 'right', 'bottom', 'left']; function getBorderStyleChanges(border, presetColor, userStyle) { if (!border && !presetColor) { return []; } const changes = [...getFallbackBorderStyleChange('top', border, userStyle), ...getFallbackBorderStyleChange('right', border, userStyle), ...getFallbackBorderStyleChange('bottom', border, userStyle), ...getFallbackBorderStyleChange('left', border, userStyle)]; // Handle a flat border i.e. all sides the same, CSS shorthand. const { color: customColor, style, width } = border || {}; const hasColorOrWidth = presetColor || customColor || width; if (hasColorOrWidth && !style) { // Global Styles need individual side configurations to overcome // theme.json configurations which are per side as well. sides.forEach(side => { // Only add fallback border-style if global styles don't already // have something set. if (!userStyle?.[side]?.style) { changes.push({ path: ['border', side, 'style'], value: 'solid' }); } }); } return changes; } function getFallbackBorderStyleChange(side, border, globalBorderStyle) { if (!border?.[side] || globalBorderStyle?.[side]?.style) { return []; } const { color, style, width } = border[side]; const hasColorOrWidth = color || width; if (!hasColorOrWidth || style) { return []; } return [{ path: ['border', side, 'style'], value: 'solid' }]; } function useChangesToPush(name, attributes, userConfig) { const supports = useSupportedStyles(name); const blockUserConfig = userConfig?.styles?.blocks?.[name]; return (0,external_wp_element_namespaceObject.useMemo)(() => { const changes = supports.flatMap(key => { if (!STYLE_PROPERTY[key]) { return []; } const { value: path } = STYLE_PROPERTY[key]; const presetAttributeKey = path.join('.'); const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]]; const value = presetAttributeValue ? `var:preset|${STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|${presetAttributeValue}` : getValueFromObjectPath(attributes.style, path); // Links only have a single support entry but have two element // style properties, color and hover color. The following check // will add the hover color to the changes if required. if (key === 'linkColor') { const linkChanges = value ? [{ path, value }] : []; const hoverPath = ['elements', 'link', ':hover', 'color', 'text']; const hoverValue = getValueFromObjectPath(attributes.style, hoverPath); if (hoverValue) { linkChanges.push({ path: hoverPath, value: hoverValue }); } return linkChanges; } // The shorthand border styles can't be mapped directly as global // styles requires longhand config. if (flatBorderProperties.includes(key) && value) { // The shorthand config path is included to clear the block attribute. const borderChanges = [{ path, value }]; sides.forEach(side => { const currentPath = [...path]; currentPath.splice(-1, 0, side); borderChanges.push({ path: currentPath, value }); }); return borderChanges; } return value ? [{ path, value }] : []; }); // To ensure display of a visible border, global styles require a // default border style if a border color or width is present. getBorderStyleChanges(attributes.style?.border, attributes.borderColor, blockUserConfig?.border).forEach(change => changes.push(change)); return changes; }, [supports, attributes, blockUserConfig]); } function PushChangesToGlobalStylesControl({ name, attributes, setAttributes }) { const { user: userConfig, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const changes = useChangesToPush(name, attributes, userConfig); const { __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const pushChanges = (0,external_wp_element_namespaceObject.useCallback)(() => { if (changes.length === 0) { return; } if (changes.length > 0) { const { style: blockStyles } = attributes; const newBlockStyles = structuredClone(blockStyles); const newUserConfig = structuredClone(userConfig); for (const { path, value } of changes) { setNestedValue(newBlockStyles, path, undefined); setNestedValue(newUserConfig, ['styles', 'blocks', name, ...path], value); } const newBlockAttributes = { borderColor: undefined, backgroundColor: undefined, textColor: undefined, gradient: undefined, fontSize: undefined, fontFamily: undefined, style: cleanEmptyObject(newBlockStyles) }; // @wordpress/core-data doesn't support editing multiple entity types in // a single undo level. So for now, we disable @wordpress/core-data undo // tracking and implement our own Undo button in the snackbar // notification. __unstableMarkNextChangeAsNotPersistent(); setAttributes(newBlockAttributes); setUserConfig(newUserConfig, { undoIgnore: true }); createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of the block e.g. 'Heading'. (0,external_wp_i18n_namespaceObject.__)('%s styles applied.'), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title), { type: 'snackbar', actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Undo'), onClick() { __unstableMarkNextChangeAsNotPersistent(); setAttributes(attributes); setUserConfig(userConfig, { undoIgnore: true }); } }] }); } }, [__unstableMarkNextChangeAsNotPersistent, attributes, changes, createSuccessNotice, name, setAttributes, setUserConfig, userConfig]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, className: "edit-site-push-changes-to-global-styles-control", help: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of the block e.g. 'Heading'. (0,external_wp_i18n_namespaceObject.__)('Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Styles') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", accessibleWhenDisabled: true, disabled: changes.length === 0, onClick: pushChanges, children: (0,external_wp_i18n_namespaceObject.__)('Apply globally') })] }); } function PushChangesToGlobalStyles(props) { const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []); const supportsStyles = SUPPORTED_STYLES.some(feature => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, feature)); const isDisplayed = blockEditingMode === 'default' && supportsStyles && isBlockBasedTheme; if (!isDisplayed) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStylesControl, { ...props }) }); } const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), props.isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStyles, { ...props })] })); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles); ;// ./node_modules/@wordpress/edit-site/build-module/hooks/index.js /** * Internal dependencies */ ;// ./node_modules/@wordpress/edit-site/build-module/store/reducer.js /** * WordPress dependencies */ /** * Reducer returning the settings. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function settings(state = {}, action) { switch (action.type) { case 'UPDATE_SETTINGS': return { ...state, ...action.settings }; } return state; } /** * Reducer keeping track of the currently edited Post Type, * Post Id and the context provided to fill the content of the block editor. * * @param {Object} state Current edited post. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function editedPost(state = {}, action) { switch (action.type) { case 'SET_EDITED_POST': return { postType: action.postType, id: action.id, context: action.context }; case 'SET_EDITED_POST_CONTEXT': return { ...state, context: action.context }; } return state; } /** * Reducer to set the save view panel open or closed. * * @param {Object} state Current state. * @param {Object} action Dispatched action. */ function saveViewPanel(state = false, action) { switch (action.type) { case 'SET_IS_SAVE_VIEW_OPENED': return action.isOpen; } return state; } /** * Reducer used to track the site editor canvas container view. * Default is `undefined`, denoting the default, visual block editor. * This could be, for example, `'style-book'` (the style book). * * @param {string|undefined} state Current state. * @param {Object} action Dispatched action. */ function editorCanvasContainerView(state = undefined, action) { switch (action.type) { case 'SET_EDITOR_CANVAS_CONTAINER_VIEW': return action.view; } return state; } function routes(state = [], action) { switch (action.type) { case 'REGISTER_ROUTE': return [...state, action.route]; case 'UNREGISTER_ROUTE': return state.filter(route => route.name !== action.name); } return state; } /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ settings, editedPost, saveViewPanel, editorCanvasContainerView, routes })); ;// external ["wp","patterns"] const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; ;// ./node_modules/@wordpress/edit-site/build-module/utils/constants.js /** * WordPress dependencies */ /** * Internal dependencies */ // Navigation const NAVIGATION_POST_TYPE = 'wp_navigation'; // Templates. const TEMPLATE_POST_TYPE = 'wp_template'; const TEMPLATE_PART_POST_TYPE = 'wp_template_part'; const TEMPLATE_ORIGINS = { custom: 'custom', theme: 'theme', plugin: 'plugin' }; const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized'; const TEMPLATE_PART_ALL_AREAS_CATEGORY = 'all-parts'; // Patterns. const { PATTERN_TYPES, PATTERN_DEFAULT_CATEGORY, PATTERN_USER_CATEGORY, EXCLUDED_PATTERN_SOURCES, PATTERN_SYNC_TYPES } = unlock(external_wp_patterns_namespaceObject.privateApis); // Entities that are editable in focus mode. const FOCUSABLE_ENTITIES = [TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user]; const POST_TYPE_LABELS = { [TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template'), [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template part'), [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)('Pattern'), [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Navigation') }; // DataViews constants const LAYOUT_GRID = 'grid'; const LAYOUT_TABLE = 'table'; const LAYOUT_LIST = 'list'; const OPERATOR_IS = 'is'; const OPERATOR_IS_NOT = 'isNot'; const OPERATOR_IS_ANY = 'isAny'; const OPERATOR_IS_NONE = 'isNone'; ;// ./node_modules/@wordpress/edit-site/build-module/store/actions.js /** * WordPress dependencies */ /** * Internal dependencies */ const { interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis); /** * Dispatches an action that toggles a feature flag. * * @param {string} featureName Feature name. */ function toggleFeature(featureName) { return function ({ registry }) { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleFeature( featureName )", { since: '6.0', alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )" }); registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-site', featureName); }; } /** * Action that changes the width of the editing canvas. * * @deprecated * * @param {string} deviceType * * @return {Object} Action object. */ const __experimentalSetPreviewDeviceType = deviceType => ({ registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType", { since: '6.5', version: '6.7', hint: 'registry.dispatch( editorStore ).setDeviceType' }); registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); }; /** * Action that sets a template, optionally fetching it from REST API. * * @return {Object} Action object. */ function setTemplate() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplate", { since: '6.5', version: '6.8', hint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.' }); return { type: 'NOTHING' }; } /** * Action that adds a new template and sets it as the current template. * * @param {Object} template The template. * * @deprecated * * @return {Object} Action object used to set the current template. */ const addTemplate = template => async ({ dispatch, registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).addTemplate", { since: '6.5', version: '6.8', hint: 'use saveEntityRecord directly' }); const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', TEMPLATE_POST_TYPE, template); if (template.content) { registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', TEMPLATE_POST_TYPE, newTemplate.id, { blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) }, { undoIgnore: true }); } dispatch({ type: 'SET_EDITED_POST', postType: TEMPLATE_POST_TYPE, id: newTemplate.id }); }; /** * Action that removes a template. * * @param {Object} template The template object. */ const removeTemplate = template => ({ registry }) => { return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).removeTemplates([template]); }; /** * Action that sets a template part. * * @deprecated * @param {string} templatePartId The template part ID. * * @return {Object} Action object. */ function setTemplatePart(templatePartId) { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplatePart", { since: '6.8' }); return { type: 'SET_EDITED_POST', postType: TEMPLATE_PART_POST_TYPE, id: templatePartId }; } /** * Action that sets a navigation menu. * * @deprecated * @param {string} navigationMenuId The Navigation Menu Post ID. * * @return {Object} Action object. */ function setNavigationMenu(navigationMenuId) { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationMenu", { since: '6.8' }); return { type: 'SET_EDITED_POST', postType: NAVIGATION_POST_TYPE, id: navigationMenuId }; } /** * Action that sets an edited entity. * * @deprecated * @param {string} postType The entity's post type. * @param {string} postId The entity's ID. * @param {Object} context The entity's context. * * @return {Object} Action object. */ function setEditedEntity(postType, postId, context) { return { type: 'SET_EDITED_POST', postType, id: postId, context }; } /** * @deprecated */ function setHomeTemplateId() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setHomeTemplateId", { since: '6.2', version: '6.4' }); return { type: 'NOTHING' }; } /** * Set's the current block editor context. * * @deprecated * @param {Object} context The context object. * * @return {Object} Action object. */ function setEditedPostContext(context) { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setEditedPostContext", { since: '6.8' }); return { type: 'SET_EDITED_POST_CONTEXT', context }; } /** * Resolves the template for a page and displays both. If no path is given, attempts * to use the postId to generate a path like `?p=${ postId }`. * * @deprecated * * @return {Object} Action object. */ function setPage() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setPage", { since: '6.5', version: '6.8', hint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.' }); return { type: 'NOTHING' }; } /** * Action that sets the active navigation panel menu. * * @deprecated * * @return {Object} Action object. */ function setNavigationPanelActiveMenu() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", { since: '6.2', version: '6.4' }); return { type: 'NOTHING' }; } /** * Opens the navigation panel and sets its active menu at the same time. * * @deprecated */ function openNavigationPanelToMenu() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", { since: '6.2', version: '6.4' }); return { type: 'NOTHING' }; } /** * Sets whether the navigation panel should be open. * * @deprecated */ function setIsNavigationPanelOpened() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", { since: '6.2', version: '6.4' }); return { type: 'NOTHING' }; } /** * Returns an action object used to open/close the inserter. * * @deprecated * * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false). */ const setIsInserterOpened = value => ({ registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsInserterOpened", { since: '6.5', alternative: "dispatch( 'core/editor').setIsInserterOpened" }); registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); }; /** * Returns an action object used to open/close the list view. * * @deprecated * * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. */ const setIsListViewOpened = isOpen => ({ registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsListViewOpened", { since: '6.5', alternative: "dispatch( 'core/editor').setIsListViewOpened" }); registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); }; /** * Returns an action object used to update the settings. * * @param {Object} settings New settings. * * @return {Object} Action object. */ function updateSettings(settings) { return { type: 'UPDATE_SETTINGS', settings }; } /** * Sets whether the save view panel should be open. * * @param {boolean} isOpen If true, opens the save view. If false, closes it. * It does not toggle the state, but sets it directly. */ function setIsSaveViewOpened(isOpen) { return { type: 'SET_IS_SAVE_VIEW_OPENED', isOpen }; } /** * Reverts a template to its original theme-provided file. * * @param {Object} template The template to revert. * @param {Object} [options] * @param {boolean} [options.allowUndo] Whether to allow the user to undo * reverting the template. Default true. */ const revertTemplate = (template, options) => ({ registry }) => { return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).revertTemplate(template, options); }; /** * Action that opens an editor sidebar. * * @param {?string} name Sidebar name to be opened. */ const openGeneralSidebar = name => ({ registry }) => { registry.dispatch(interfaceStore).enableComplementaryArea('core', name); }; /** * Action that closes the sidebar. */ const closeGeneralSidebar = () => ({ registry }) => { registry.dispatch(interfaceStore).disableComplementaryArea('core'); }; /** * Triggers an action used to switch editor mode. * * @deprecated * * @param {string} mode The editor mode. */ const switchEditorMode = mode => ({ registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).switchEditorMode", { since: '6.6', alternative: "dispatch( 'core/editor').switchEditorMode" }); registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode); }; /** * Sets whether or not the editor allows only page content to be edited. * * @param {boolean} hasPageContentFocus True to allow only page content to be * edited, false to allow template to be * edited. */ const setHasPageContentFocus = hasPageContentFocus => ({ dispatch, registry }) => { external_wp_deprecated_default()(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, { since: '6.5' }); if (hasPageContentFocus) { registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); } dispatch({ type: 'SET_HAS_PAGE_CONTENT_FOCUS', hasPageContentFocus }); }; /** * Action that toggles Distraction free mode. * Distraction free mode expects there are no sidebars, as due to the * z-index values set, you can't close sidebars. * * @deprecated */ const toggleDistractionFree = () => ({ registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleDistractionFree", { since: '6.6', alternative: "dispatch( 'core/editor').toggleDistractionFree" }); registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree(); }; ;// ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js /** * Action that switches the editor canvas container view. * * @param {?string} view Editor canvas container view. */ const setEditorCanvasContainerView = view => ({ dispatch }) => { dispatch({ type: 'SET_EDITOR_CANVAS_CONTAINER_VIEW', view }); }; function registerRoute(route) { return { type: 'REGISTER_ROUTE', route }; } function unregisterRoute(name) { return { type: 'UNREGISTER_ROUTE', name }; } ;// ./node_modules/@wordpress/edit-site/build-module/utils/get-filtered-template-parts.js /** * WordPress dependencies */ const EMPTY_ARRAY = []; /** * Get a flattened and filtered list of template parts and the matching block for that template part. * * Takes a list of blocks defined within a template, and a list of template parts, and returns a * flattened list of template parts and the matching block for that template part. * * @param {Array} blocks Blocks to flatten. * @param {?Array} templateParts Available template parts. * @return {Array} An array of template parts and their blocks. */ function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) { const templatePartsById = templateParts ? // Key template parts by their ID. templateParts.reduce((newTemplateParts, part) => ({ ...newTemplateParts, [part.id]: part }), {}) : {}; const result = []; // Iterate over all blocks, recursing into inner blocks. // Output will be based on a depth-first traversal. const stack = [...blocks]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); // Place inner blocks at the beginning of the stack to preserve order. stack.unshift(...innerBlocks); if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { const { attributes: { theme, slug } } = block; const templatePartId = `${theme}//${slug}`; const templatePart = templatePartsById[templatePartId]; // Only add to output if the found template part block is in the list of available template parts. if (templatePart) { result.push({ templatePart, block }); } } } return result; } ;// ./node_modules/@wordpress/edit-site/build-module/store/selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @typedef {'template'|'template_type'} TemplateType Template type. */ /** * Returns whether the given feature is enabled or not. * * @deprecated * @param {Object} state Global application state. * @param {string} featureName Feature slug. * * @return {boolean} Is active. */ const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (_, featureName) => { external_wp_deprecated_default()(`select( 'core/edit-site' ).isFeatureActive`, { since: '6.0', alternative: `select( 'core/preferences' ).get` }); return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', featureName); }); /** * Returns the current editing canvas device type. * * @deprecated * * @param {Object} state Global application state. * * @return {string} Device type. */ const __experimentalGetPreviewDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, { since: '6.5', version: '6.7', alternative: `select( 'core/editor' ).getDeviceType` }); return select(external_wp_editor_namespaceObject.store).getDeviceType(); }); /** * Returns whether the current user can create media or not. * * @param {Object} state Global application state. * * @return {Object} Whether the current user can create media or not. */ const getCanUserCreateMedia = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { external_wp_deprecated_default()(`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`, { since: '6.7', alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )` }); return select(external_wp_coreData_namespaceObject.store).canUser('create', 'media'); }); /** * Returns any available Reusable blocks. * * @param {Object} state Global application state. * * @return {Array} The available reusable blocks. */ const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { external_wp_deprecated_default()(`select( 'core/edit-site' ).getReusableBlocks()`, { since: '6.5', version: '6.8', alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )` }); const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', { per_page: -1 }) : []; }); /** * Returns the site editor settings. * * @param {Object} state Global application state. * * @return {Object} Settings. */ function getSettings(state) { // It is important that we don't inject anything into these settings locally. // The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings. // If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected. return state.settings; } /** * @deprecated */ function getHomeTemplateId() { external_wp_deprecated_default()("select( 'core/edit-site' ).getHomeTemplateId", { since: '6.2', version: '6.4' }); } /** * Returns the current edited post type (wp_template or wp_template_part). * * @deprecated * @param {Object} state Global application state. * * @return {?TemplateType} Template type. */ function getEditedPostType(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostType", { since: '6.8', alternative: "select( 'core/editor' ).getCurrentPostType" }); return state.editedPost.postType; } /** * Returns the ID of the currently edited template or template part. * * @deprecated * @param {Object} state Global application state. * * @return {?string} Post ID. */ function getEditedPostId(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostId", { since: '6.8', alternative: "select( 'core/editor' ).getCurrentPostId" }); return state.editedPost.id; } /** * Returns the edited post's context object. * * @deprecated * @param {Object} state Global application state. * * @return {Object} Page. */ function getEditedPostContext(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostContext", { since: '6.8' }); return state.editedPost.context; } /** * Returns the current page object. * * @deprecated * @param {Object} state Global application state. * * @return {Object} Page. */ function getPage(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).getPage", { since: '6.8' }); return { context: state.editedPost.context }; } /** * Returns true if the inserter is opened. * * @deprecated * * @param {Object} state Global application state. * * @return {boolean} Whether the inserter is opened. */ const isInserterOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { external_wp_deprecated_default()(`select( 'core/edit-site' ).isInserterOpened`, { since: '6.5', alternative: `select( 'core/editor' ).isInserterOpened` }); return select(external_wp_editor_namespaceObject.store).isInserterOpened(); }); /** * Get the insertion point for the inserter. * * @deprecated * * @param {Object} state Global application state. * * @return {Object} The root client ID, index to insert at and starting filter value. */ const __experimentalGetInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetInsertionPoint`, { since: '6.5', version: '6.7' }); return unlock(select(external_wp_editor_namespaceObject.store)).getInserter(); }); /** * Returns true if the list view is opened. * * @param {Object} state Global application state. * * @return {boolean} Whether the list view is opened. */ const isListViewOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { external_wp_deprecated_default()(`select( 'core/edit-site' ).isListViewOpened`, { since: '6.5', alternative: `select( 'core/editor' ).isListViewOpened` }); return select(external_wp_editor_namespaceObject.store).isListViewOpened(); }); /** * Returns the current opened/closed state of the save panel. * * @param {Object} state Global application state. * * @return {boolean} True if the save panel should be open; false if closed. */ function isSaveViewOpened(state) { return state.saveViewPanel; } function getBlocksAndTemplateParts(select) { const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { per_page: -1 }); const { getBlocksByName, getBlocksByClientId } = select(external_wp_blockEditor_namespaceObject.store); const clientIds = getBlocksByName('core/template-part'); const blocks = getBlocksByClientId(clientIds); return [blocks, templateParts]; } /** * Returns the template parts and their blocks for the current edited template. * * @deprecated * @param {Object} state Global application state. * @return {Array} Template parts and their blocks in an array. */ const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(() => { external_wp_deprecated_default()(`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`, { since: '6.7', version: '6.9', alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )` }); return getFilteredTemplatePartBlocks(...getBlocksAndTemplateParts(select)); }, () => getBlocksAndTemplateParts(select))); /** * Returns the current editing mode. * * @param {Object} state Global application state. * * @return {string} Editing mode. */ const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { return select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode'); }); /** * @deprecated */ function getCurrentTemplateNavigationPanelSubMenu() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", { since: '6.2', version: '6.4' }); } /** * @deprecated */ function getNavigationPanelActiveMenu() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", { since: '6.2', version: '6.4' }); } /** * @deprecated */ function isNavigationOpened() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).isNavigationOpened", { since: '6.2', version: '6.4' }); } /** * Whether or not the editor has a page loaded into it. * * @see setPage * @deprecated * @param {Object} state Global application state. * * @return {boolean} Whether or not the editor has a page loaded into it. */ function isPage(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).isPage", { since: '6.8', alternative: "select( 'core/editor' ).getCurrentPostType" }); return !!state.editedPost.context?.postId; } /** * Whether or not the editor allows only page content to be edited. * * @deprecated * * @return {boolean} Whether or not focus is on editing page content. */ function hasPageContentFocus() { external_wp_deprecated_default()(`select( 'core/edit-site' ).hasPageContentFocus`, { since: '6.5' }); return false; } ;// ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js /** * Returns the editor canvas container view. * * @param {Object} state Global application state. * * @return {string} Editor canvas container view. */ function getEditorCanvasContainerView(state) { return state.editorCanvasContainerView; } function getRoutes(state) { return state.routes; } ;// ./node_modules/@wordpress/edit-site/build-module/store/constants.js /** * The identifier for the data store. * * @type {string} */ const STORE_NAME = 'core/edit-site'; ;// ./node_modules/@wordpress/edit-site/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const storeConfig = { reducer: reducer, actions: actions_namespaceObject, selectors: selectors_namespaceObject }; const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); (0,external_wp_data_namespaceObject.register)(store); unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); unlock(store).registerPrivateActions(private_actions_namespaceObject); ;// external ["wp","router"] const external_wp_router_namespaceObject = window["wp"]["router"]; ;// ./node_modules/clsx/dist/clsx.mjs function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// external ["wp","commands"] const external_wp_commands_namespaceObject = window["wp"]["commands"]; ;// external ["wp","coreCommands"] const external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; ;// external ["wp","plugins"] const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/search.js /** * WordPress dependencies */ const search = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); /* harmony default export */ const library_search = (search); ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js /** * WordPress dependencies */ const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) }); /* harmony default export */ const library_wordpress = (wordpress); ;// ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js /** * External dependencies */ /** * WordPress dependencies */ function SiteIcon({ className }) { const { isRequestingSite, siteIconUrl } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteData = getEntityRecord('root', '__unstableBase', undefined); return { isRequestingSite: !siteData, siteIconUrl: siteData?.site_icon_url }; }, []); if (isRequestingSite && !siteIconUrl) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-icon__image" }); } const icon = siteIconUrl ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { className: "edit-site-site-icon__image", alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), src: siteIconUrl }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "edit-site-site-icon__icon", icon: library_wordpress, size: 48 }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, 'edit-site-site-icon'), children: icon }); } /* harmony default export */ const site_icon = (SiteIcon); ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js /** * External dependencies */ /** * WordPress dependencies */ const SidebarNavigationContext = (0,external_wp_element_namespaceObject.createContext)(() => {}); // Focus a sidebar element after a navigation. The element to focus is either // specified by `focusSelector` (when navigating back) or it is the first // tabbable element (usually the "Back" button). function focusSidebarElement(el, direction, focusSelector) { let elementToFocus; if (direction === 'back' && focusSelector) { elementToFocus = el.querySelector(focusSelector); } if (direction !== null && !elementToFocus) { const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(el); elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : el; } elementToFocus?.focus(); } // Navigation state that is updated when navigating back or forward. Helps us // manage the animations and also focus. function createNavState() { let state = { direction: null, focusSelector: null }; return { get() { return state; }, navigate(direction, focusSelector = null) { state = { direction, focusSelector: direction === 'forward' && focusSelector ? focusSelector : state.focusSelector }; } }; } function SidebarContentWrapper({ children, shouldAnimate }) { const navState = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(); const [navAnimation, setNavAnimation] = (0,external_wp_element_namespaceObject.useState)(null); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const { direction, focusSelector } = navState.get(); focusSidebarElement(wrapperRef.current, direction, focusSelector); setNavAnimation(direction); }, [navState]); const wrapperCls = dist_clsx('edit-site-sidebar__screen-wrapper', /* * Some panes do not have sub-panes and therefore * should not animate when clicked on. */ shouldAnimate ? { 'slide-from-left': navAnimation === 'back', 'slide-from-right': navAnimation === 'forward' } : {}); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: wrapperRef, className: wrapperCls, children: children }); } function SidebarNavigationProvider({ children }) { const [navState] = (0,external_wp_element_namespaceObject.useState)(createNavState); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationContext.Provider, { value: navState, children: children }); } function SidebarContent({ routeKey, shouldAnimate, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar__content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContentWrapper, { shouldAnimate: shouldAnimate, children: children }, routeKey) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation, useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const SiteHub = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({ isTransparent }, ref) => { const { dashboardLink, homeUrl, siteTitle } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = unlock(select(store)); const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const _site = getEntityRecord('root', 'site'); return { dashboardLink: getSettings().__experimentalDashboardLink, homeUrl: getEntityRecord('root', '__unstableBase')?.home, siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title }; }, []); const { open: openCommandCenter } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', { 'has-transparent-background': isTransparent }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref: ref, href: dashboardLink, label: (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), className: "edit-site-layout__view-mode-toggle", style: { transform: 'scale(0.5333) translateX(-4px)', // Offset to position the icon 12px from viewport edge borderRadius: 4 }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { className: "edit-site-layout__view-mode-toggle-icon" }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", href: homeUrl, target: "_blank", children: [(0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: /* translators: accessibility text */ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, expanded: false, className: "edit-site-site-hub__actions", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", className: "edit-site-site-hub_toggle-command-center", icon: library_search, onClick: () => openCommandCenter(), label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') }) })] })] }) }); })); /* harmony default export */ const site_hub = (SiteHub); const SiteHubMobile = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({ isTransparent }, ref) => { const { path } = useLocation(); const history = useHistory(); const { navigate } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); const { dashboardLink, homeUrl, siteTitle, isBlockTheme, isClassicThemeWithStyleBookSupport } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = unlock(select(store)); const { getEntityRecord, getCurrentTheme } = select(external_wp_coreData_namespaceObject.store); const _site = getEntityRecord('root', 'site'); const currentTheme = getCurrentTheme(); const settings = getSettings(); const supportsEditorStyles = currentTheme.theme_supports['editor-styles']; // This is a temp solution until the has_theme_json value is available for the current theme. const hasThemeJson = settings.supportsLayout; return { dashboardLink: settings.__experimentalDashboardLink, homeUrl: getEntityRecord('root', '__unstableBase')?.home, siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title, isBlockTheme: currentTheme?.is_block_theme, isClassicThemeWithStyleBookSupport: !currentTheme?.is_block_theme && (supportsEditorStyles || hasThemeJson) }; }, []); const { open: openCommandCenter } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); let backPath; // If the current path is not the root page, find a page to back to. if (path !== '/') { if (isBlockTheme || isClassicThemeWithStyleBookSupport) { // If the current theme is a block theme or a classic theme that supports StyleBook, // back to the Design screen. backPath = '/'; } else if (path !== '/pattern') { // If the current theme is a classic theme that does not support StyleBook, // back to the Patterns page. backPath = '/pattern'; } } const backButtonProps = { href: !!backPath ? undefined : dashboardLink, label: !!backPath ? (0,external_wp_i18n_namespaceObject.__)('Go to Site Editor') : (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), onClick: !!backPath ? () => { history.navigate(backPath); navigate('back'); } : undefined }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', { 'has-transparent-background': isTransparent }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref: ref, className: "edit-site-layout__view-mode-toggle", style: { transform: 'scale(0.5)', borderRadius: 4 }, ...backButtonProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { className: "edit-site-layout__view-mode-toggle-icon" }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", href: homeUrl, target: "_blank", label: (0,external_wp_i18n_namespaceObject.__)('View site (opens in a new tab)'), children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, expanded: false, className: "edit-site-site-hub__actions", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "edit-site-site-hub_toggle-command-center", icon: library_search, onClick: () => openCommandCenter(), label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') }) })] })] }) }); })); ;// ./node_modules/@wordpress/edit-site/build-module/components/resizable-frame/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: resizable_frame_useLocation, useHistory: resizable_frame_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); // Removes the inline styles in the drag handles. const HANDLE_STYLES_OVERRIDE = { position: undefined, userSelect: undefined, cursor: undefined, width: undefined, height: undefined, top: undefined, right: undefined, bottom: undefined, left: undefined }; // The minimum width of the frame (in px) while resizing. const FRAME_MIN_WIDTH = 320; // The reference width of the frame (in px) used to calculate the aspect ratio. const FRAME_REFERENCE_WIDTH = 1300; // 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing. const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5; // The minimum distance (in px) between the frame resize handle and the // viewport's edge. If the frame is resized to be closer to the viewport's edge // than this distance, then "canvas mode" will be enabled. const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200; // Default size for the `frameSize` state. const INITIAL_FRAME_SIZE = { width: '100%', height: '100%' }; function calculateNewHeight(width, initialAspectRatio) { const lerp = (a, b, amount) => { return a + (b - a) * amount; }; // Calculate the intermediate aspect ratio based on the current width. const lerpFactor = 1 - Math.max(0, Math.min(1, (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH))); // Calculate the height based on the intermediate aspect ratio // ensuring the frame arrives at the target aspect ratio. const intermediateAspectRatio = lerp(initialAspectRatio, FRAME_TARGET_ASPECT_RATIO, lerpFactor); return width / intermediateAspectRatio; } function ResizableFrame({ isFullWidth, isOversized, setIsOversized, isReady, children, /** The default (unresized) width/height of the frame, based on the space available in the viewport. */ defaultSize, innerContentStyle }) { const history = resizable_frame_useHistory(); const { path, query } = resizable_frame_useLocation(); const { canvas = 'view' } = query; const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const [frameSize, setFrameSize] = (0,external_wp_element_namespaceObject.useState)(INITIAL_FRAME_SIZE); // The width of the resizable frame when a new resize gesture starts. const [startingWidth, setStartingWidth] = (0,external_wp_element_namespaceObject.useState)(); const [isResizing, setIsResizing] = (0,external_wp_element_namespaceObject.useState)(false); const [shouldShowHandle, setShouldShowHandle] = (0,external_wp_element_namespaceObject.useState)(false); const [resizeRatio, setResizeRatio] = (0,external_wp_element_namespaceObject.useState)(1); const FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 }; const frameRef = (0,external_wp_element_namespaceObject.useRef)(null); const resizableHandleHelpId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResizableFrame, 'edit-site-resizable-frame-handle-help'); const defaultAspectRatio = defaultSize.width / defaultSize.height; const isBlockTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentTheme } = select(external_wp_coreData_namespaceObject.store); return getCurrentTheme()?.is_block_theme; }, []); const handleResizeStart = (_event, _direction, ref) => { // Remember the starting width so we don't have to get `ref.offsetWidth` on // every resize event thereafter, which will cause layout thrashing. setStartingWidth(ref.offsetWidth); setIsResizing(true); }; // Calculate the frame size based on the window width as its resized. const handleResize = (_event, _direction, _ref, delta) => { const normalizedDelta = delta.width / resizeRatio; const deltaAbs = Math.abs(normalizedDelta); const maxDoubledDelta = delta.width < 0 // is shrinking ? deltaAbs : (defaultSize.width - startingWidth) / 2; const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta); const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs; const singleSegment = 1 - doubleSegment; setResizeRatio(singleSegment + doubleSegment * 2); const updatedWidth = startingWidth + delta.width; setIsOversized(updatedWidth > defaultSize.width); // Width will be controlled by the library (via `resizeRatio`), // so we only need to update the height. setFrameSize({ height: isOversized ? '100%' : calculateNewHeight(updatedWidth, defaultAspectRatio) }); }; const handleResizeStop = (_event, _direction, ref) => { setIsResizing(false); if (!isOversized) { return; } setIsOversized(false); const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth; if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD || !isBlockTheme) { // Reset the initial aspect ratio if the frame is resized slightly // above the sidebar but not far enough to trigger full screen. setFrameSize(INITIAL_FRAME_SIZE); } else { // Trigger full screen if the frame is resized far enough to the left. history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: 'edit' }), { transition: 'canvas-mode-edit-transition' }); } }; // Handle resize by arrow keys const handleResizableHandleKeyDown = event => { if (!['ArrowLeft', 'ArrowRight'].includes(event.key)) { return; } event.preventDefault(); const step = 20 * (event.shiftKey ? 5 : 1); const delta = step * (event.key === 'ArrowLeft' ? 1 : -1) * ((0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1); const newWidth = Math.min(Math.max(FRAME_MIN_WIDTH, frameRef.current.resizable.offsetWidth + delta), defaultSize.width); setFrameSize({ width: newWidth, height: calculateNewHeight(newWidth, defaultAspectRatio) }); }; const frameAnimationVariants = { default: { flexGrow: 0, height: frameSize.height }, fullWidth: { flexGrow: 1, height: frameSize.height } }; const resizeHandleVariants = { hidden: { opacity: 0, ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { right: 0 } : { left: 0 }) }, visible: { opacity: 1, // Account for the handle's width. ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 }) }, active: { opacity: 1, // Account for the handle's width. ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 }), scaleY: 1.3 } }; const currentResizeHandleVariant = (() => { if (isResizing) { return 'active'; } return shouldShowHandle ? 'visible' : 'hidden'; })(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { as: external_wp_components_namespaceObject.__unstableMotion.div, ref: frameRef, initial: false, variants: frameAnimationVariants, animate: isFullWidth ? 'fullWidth' : 'default', onAnimationComplete: definition => { if (definition === 'fullWidth') { setFrameSize({ width: '100%', height: '100%' }); } }, whileHover: canvas === 'view' && isBlockTheme ? { scale: 1.005, transition: { duration: disableMotion ? 0 : 0.5, ease: 'easeOut' } } : {}, transition: FRAME_TRANSITION, size: frameSize, enable: { top: false, bottom: false, // Resizing will be disabled until the editor content is loaded. ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { right: isReady, left: false } : { left: isReady, right: false }), topRight: false, bottomRight: false, bottomLeft: false, topLeft: false }, resizeRatio: resizeRatio, handleClasses: undefined, handleStyles: { left: HANDLE_STYLES_OVERRIDE, right: HANDLE_STYLES_OVERRIDE }, minWidth: FRAME_MIN_WIDTH, maxWidth: isFullWidth ? '100%' : '150%', maxHeight: "100%", onFocus: () => setShouldShowHandle(true), onBlur: () => setShouldShowHandle(false), onMouseOver: () => setShouldShowHandle(true), onMouseOut: () => setShouldShowHandle(false), handleComponent: { [(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: canvas === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.button, { role: "separator", "aria-orientation": "vertical", className: dist_clsx('edit-site-resizable-frame__handle', { 'is-resizing': isResizing }), variants: resizeHandleVariants, animate: currentResizeHandleVariant, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), "aria-describedby": resizableHandleHelpId, "aria-valuenow": frameRef.current?.resizable?.offsetWidth || undefined, "aria-valuemin": FRAME_MIN_WIDTH, "aria-valuemax": defaultSize.width, onKeyDown: handleResizableHandleKeyDown, initial: "hidden", exit: "hidden", whileFocus: "active", whileHover: "active" }, "handle") }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, id: resizableHandleHelpId, children: (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.') })] }) }, onResizeStart: handleResizeStart, onResize: handleResize, onResizeStop: handleResizeStop, className: dist_clsx('edit-site-resizable-frame__inner', { 'is-resizing': isResizing }), showHandle: false // Do not show the default handle, as we're using a custom one. , children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-resizable-frame__inner-content", style: innerContentStyle, children: children }) }); } /* harmony default export */ const resizable_frame = (ResizableFrame); ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/save-keyboard-shortcut/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const shortcutName = 'core/edit-site/save'; /** * Register the save keyboard shortcut in view mode. * * @return {null} Returns null. */ function SaveKeyboardShortcut() { const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); const { hasNonPostEntityChanges, isPostSavingLocked } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); const { savePost } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); const { setIsSaveViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { registerShortcut, unregisterShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: shortcutName, category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), keyCombination: { modifier: 'primary', character: 's' } }); return () => { unregisterShortcut(shortcutName); }; }, [registerShortcut, unregisterShortcut]); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => { event.preventDefault(); const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); const hasDirtyEntities = !!dirtyEntityRecords.length; const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); if (!hasDirtyEntities || isSaving) { return; } if (hasNonPostEntityChanges()) { setIsSaveViewOpened(true); } else if (!isPostSavingLocked()) { savePost(); } }); return null; } ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/hooks.js /** * WordPress dependencies */ const MAX_LOADING_TIME = 10000; // 10 seconds function useIsSiteEditorLoading() { const [loaded, setLoaded] = (0,external_wp_element_namespaceObject.useState)(false); const inLoadingPause = (0,external_wp_data_namespaceObject.useSelect)(select => { const hasResolvingSelectors = select(external_wp_coreData_namespaceObject.store).hasResolvingSelectors(); return !loaded && !hasResolvingSelectors; }, [loaded]); /* * If the maximum expected loading time has passed, we're marking the * editor as loaded, in order to prevent any failed requests from blocking * the editor canvas from appearing. */ (0,external_wp_element_namespaceObject.useEffect)(() => { let timeout; if (!loaded) { timeout = setTimeout(() => { setLoaded(true); }, MAX_LOADING_TIME); } return () => { clearTimeout(timeout); }; }, [loaded]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (inLoadingPause) { /* * We're using an arbitrary 100ms timeout here to catch brief * moments without any resolving selectors that would result in * displaying brief flickers of loading state and loaded state. * * It's worth experimenting with different values, since this also * adds 100ms of artificial delay after loading has finished. */ const ARTIFICIAL_DELAY = 100; const timeout = setTimeout(() => { setLoaded(true); }, ARTIFICIAL_DELAY); return () => { clearTimeout(timeout); }; } }, [inLoadingPause]); return !loaded; } ;// ./node_modules/@react-spring/rafz/dist/esm/index.js var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}}; // EXTERNAL MODULE: external "React" var external_React_ = __webpack_require__(1609); var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2); ;// ./node_modules/@react-spring/shared/dist/esm/index.js var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`${n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba(${r}, ${n}, ${f}, ${o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`(${O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba(${Math.round(t)}, ${Math.round(r)}, ${Math.round(n)}, ${f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`(${Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`${f[s++](o)}${i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`${Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`${Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`${Z}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll${f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e}; ;// ./node_modules/@react-spring/animated/dist/esm/index.js var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated(${m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null; ;// ./node_modules/@react-spring/core/dist/esm/index.js function dist_esm_I(t,...e){return dist_esm_l.fun(t)?t(...e):t}var esm_te=(t,e)=>t===!0||!!(e&&t&&(dist_esm_l.fun(t)?t(e):ht(t).includes(e))),et=(t,e)=>dist_esm_l.obj(t)?e&&t[e]:t;var esm_ke=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,nn=t=>t,dist_esm_ne=(t,e=nn)=>{let n=rn;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));let r={};for(let o of n){let s=e(t[o],o);dist_esm_l.und(s)||(r[o]=s)}return r},rn=["config","onProps","onStart","onChange","onPause","onResume","onRest"],on={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function sn(t){let e={},n=0;if(xt(t,(r,o)=>{on[o]||(e[o]=r,n++)}),n)return e}function esm_de(t){let e=sn(t);if(e){let n={to:e};return xt(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function esm_me(t){return t=ve(t),dist_esm_l.arr(t)?t.map(esm_me):esm_or(t)?dist_esm_p.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function esm_Ue(t){for(let e in t)return!0;return!1}function esm_Ee(t){return dist_esm_l.fun(t)||dist_esm_l.arr(t)&&dist_esm_l.obj(t[0])}function esm_xe(t,e){t.ref?.delete(t),e?.delete(t)}function esm_he(t,e){e&&t.ref!==e&&(t.ref?.delete(t),e.add(t),t.ref=e)}function wr(t,e,n=1e3){an(()=>{if(e){let r=0;ge(t,(o,s)=>{let a=o.current;if(a.length){let i=n*e[s];isNaN(i)?i=r:r=i,ge(a,u=>{ge(u.queue,p=>{let f=p.delay;p.delay=d=>i+dist_esm_I(f||0,d)})}),o.start()}})}else{let r=Promise.resolve();ge(t,o=>{let s=o.current;if(s.length){let a=s.map(i=>{let u=i.queue;return i.queue=[],u});r=r.then(()=>(ge(s,(i,u)=>ge(a[u]||[],p=>i.queue.push(p))),Promise.all(o.start())))}})}})}var esm_mt={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};var tt={...esm_mt.default,mass:1,damping:1,easing:Lt.linear,clamp:!1},esm_we=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,tt)}};function gt(t,e,n){n&&(n={...n},esm_ht(n,e),e={...n,...e}),esm_ht(t,e),Object.assign(t,e);for(let a in tt)t[a]==null&&(t[a]=tt[a]);let{mass:r,frequency:o,damping:s}=t;return dist_esm_l.und(o)||(o<.01&&(o=.01),s<0&&(s=0),t.tension=Math.pow(2*Math.PI/o,2)*r,t.friction=4*Math.PI*s*r/o),t}function esm_ht(t,e){if(!dist_esm_l.und(e.decay))t.duration=void 0;else{let n=!dist_esm_l.und(e.tension)||!dist_esm_l.und(e.friction);(n||!dist_esm_l.und(e.frequency)||!dist_esm_l.und(e.damping)||!dist_esm_l.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var esm_yt=[],dist_esm_Le=class{changed=!1;values=esm_yt;toValues=null;fromValues=esm_yt;to;from;config=new esm_we;immediate=!1};function esm_Me(t,{key:e,props:n,defaultProps:r,state:o,actions:s}){return new Promise((a,i)=>{let u,p,f=esm_te(n.cancel??r?.cancel,e);if(f)b();else{dist_esm_l.und(n.pause)||(o.paused=esm_te(n.pause,e));let c=r?.pause;c!==!0&&(c=o.paused||esm_te(c,e)),u=dist_esm_I(n.delay||0,e),c?(o.resumeQueue.add(m),s.pause()):(s.resume(),m())}function d(){o.resumeQueue.add(m),o.timeouts.delete(p),p.cancel(),u=p.time-esm_n.now()}function m(){u>0&&!dist_esm_p.skipAnimation?(o.delayed=!0,p=esm_n.setTimeout(b,u),o.pauseQueue.add(d),o.timeouts.add(p)):b()}function b(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(d),o.timeouts.delete(p),t<=(o.cancelId||0)&&(f=!0);try{s.start({...n,callId:t,cancel:f},a)}catch(c){i(c)}}})}var esm_be=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?esm_q(t.get()):e.every(n=>n.noop)?nt(t.get()):dist_esm_E(t.get(),e.every(n=>n.finished)),nt=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),dist_esm_E=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),esm_q=t=>({value:t,cancelled:!0,finished:!1});function esm_De(t,e,n,r){let{callId:o,parentId:s,onRest:a}=e,{asyncTo:i,promise:u}=n;return!s&&t===i&&!e.reset?u:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;let p=dist_esm_ne(e,(l,h)=>h==="onRest"?void 0:l),f,d,m=new Promise((l,h)=>(f=l,d=h)),b=l=>{let h=o<=(n.cancelId||0)&&esm_q(r)||o!==n.asyncId&&dist_esm_E(r,!1);if(h)throw l.result=h,d(l),l},c=(l,h)=>{let g=new esm_Ae,x=new esm_Ne;return(async()=>{if(dist_esm_p.skipAnimation)throw esm_oe(n),x.result=dist_esm_E(r,!1),d(x),x;b(g);let S=dist_esm_l.obj(l)?{...l}:{...h,to:l};S.parentId=o,xt(p,(V,_)=>{dist_esm_l.und(S[_])&&(S[_]=V)});let A=await r.start(S);return b(g),n.paused&&await new Promise(V=>{n.resumeQueue.add(V)}),A})()},P;if(dist_esm_p.skipAnimation)return esm_oe(n),dist_esm_E(r,!1);try{let l;dist_esm_l.arr(t)?l=(async h=>{for(let g of h)await c(g)})(t):l=Promise.resolve(t(c,r.stop.bind(r))),await Promise.all([l.then(f),m]),P=dist_esm_E(r.get(),!0,!1)}catch(l){if(l instanceof esm_Ae)P=l.result;else if(l instanceof esm_Ne)P=l.result;else throw l}finally{o==n.asyncId&&(n.asyncId=s,n.asyncTo=s?i:void 0,n.promise=s?u:void 0)}return dist_esm_l.fun(a)&&esm_n.batchedUpdates(()=>{a(P,r,r.item)}),P})()}function esm_oe(t,e){Pe(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var esm_Ae=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},esm_Ne=class extends Error{result;constructor(){super("SkipAnimationSignal")}};var esm_Re=t=>t instanceof esm_X,Sn=1,esm_X=class extends esm_ge{id=Sn++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=dist_esm_k(this);return e&&e.getValue()}to(...e){return dist_esm_p.to(this,e)}interpolate(...e){return Jt(),dist_esm_p.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,n=!1){$t(this,{type:"change",parent:this,value:e,idle:n})}_onPriorityChange(e){this.idle||qe.sort(this),$t(this,{type:"priority",parent:this,priority:e})}};var esm_se=Symbol.for("SpringPhase"),esm_bt=1,rt=2,ot=4,esm_qe=t=>(t[esm_se]&esm_bt)>0,dist_esm_Q=t=>(t[esm_se]&rt)>0,esm_ye=t=>(t[esm_se]&ot)>0,st=(t,e)=>e?t[esm_se]|=rt|esm_bt:t[esm_se]&=~rt,esm_it=(t,e)=>e?t[esm_se]|=ot:t[esm_se]&=~ot;var esm_ue=class extends esm_X{key;animation=new dist_esm_Le;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,n){if(super(),!dist_esm_l.und(e)||!dist_esm_l.und(n)){let r=dist_esm_l.obj(e)?{...e}:{...n,from:e};dist_esm_l.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(dist_esm_Q(this)||this._state.asyncTo)||esm_ye(this)}get goal(){return ve(this.animation.to)}get velocity(){let e=dist_esm_k(this);return e instanceof animated_dist_esm_l?e.lastVelocity||0:e.getPayload().map(n=>n.lastVelocity||0)}get hasAnimated(){return esm_qe(this)}get isAnimating(){return dist_esm_Q(this)}get isPaused(){return esm_ye(this)}get isDelayed(){return this._state.delayed}advance(e){let n=!0,r=!1,o=this.animation,{config:s,toValues:a}=o,i=F(o.to);!i&&Pt(o.to)&&(a=ht(ve(o.to))),o.values.forEach((f,d)=>{if(f.done)return;let m=f.constructor==animated_dist_esm_d?1:i?i[d].lastPosition:a[d],b=o.immediate,c=m;if(!b){if(c=f.lastPosition,s.tension<=0){f.done=!0;return}let P=f.elapsedTime+=e,l=o.fromValues[d],h=f.v0!=null?f.v0:f.v0=dist_esm_l.arr(s.velocity)?s.velocity[d]:s.velocity,g,x=s.precision||(l==m?.005:Math.min(1,Math.abs(m-l)*.001));if(dist_esm_l.und(s.duration))if(s.decay){let S=s.decay===!0?.998:s.decay,A=Math.exp(-(1-S)*P);c=l+h/(1-S)*(1-A),b=Math.abs(f.lastPosition-c)<=x,g=h*A}else{g=f.lastVelocity==null?h:f.lastVelocity;let S=s.restVelocity||x/10,A=s.clamp?0:s.bounce,V=!dist_esm_l.und(A),_=l==m?f.v0>0:l<m,v,w=!1,C=1,$=Math.ceil(e/C);for(let L=0;L<$&&(v=Math.abs(g)>S,!(!v&&(b=Math.abs(m-c)<=x,b)));++L){V&&(w=c==m||c>m==_,w&&(g=-g*A,c=m));let N=-s.tension*1e-6*(c-m),y=-s.friction*.001*g,T=(N+y)/s.mass;g=g+T*C,c=c+g*C}}else{let S=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,f.durationProgress>0&&(f.elapsedTime=s.duration*f.durationProgress,P=f.elapsedTime+=e)),S=(s.progress||0)+P/this._memoizedDuration,S=S>1?1:S<0?0:S,f.durationProgress=S),c=l+s.easing(S)*(m-l),g=(c-f.lastPosition)/e,b=S==1}f.lastVelocity=g,Number.isNaN(c)&&(console.warn("Got NaN while animating:",this),b=!0)}i&&!i[d].done&&(b=!1),b?f.done=!0:n=!1,f.setValue(c,s.round)&&(r=!0)});let u=dist_esm_k(this),p=u.getValue();if(n){let f=ve(o.to);(p!==f||r)&&!s.decay?(u.setValue(f),this._onChange(f)):r&&s.decay&&this._onChange(p),this._stop()}else r&&this._onChange(p)}set(e){return esm_n.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(dist_esm_Q(this)){let{to:e,config:n}=this.animation;esm_n.batchedUpdates(()=>{this._onStart(),n.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,n){let r;return dist_esm_l.und(e)?(r=this.queue||[],this.queue=[]):r=[dist_esm_l.obj(e)?e:{...n,to:e}],Promise.all(r.map(o=>this._update(o))).then(o=>esm_be(this,o))}stop(e){let{to:n}=this.animation;return this._focus(this.get()),esm_oe(this._state,e&&this._lastCallId),esm_n.batchedUpdates(()=>this._stop(n,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){let n=this.key||"",{to:r,from:o}=e;r=dist_esm_l.obj(r)?r[n]:r,(r==null||esm_Ee(r))&&(r=void 0),o=dist_esm_l.obj(o)?o[n]:o,o==null&&(o=void 0);let s={to:r,from:o};return esm_qe(this)||(e.reverse&&([r,o]=[o,r]),o=ve(o),dist_esm_l.und(o)?dist_esm_k(this)||this._set(r):this._set(o)),s}_update({...e},n){let{key:r,defaultProps:o}=this;e.default&&Object.assign(o,dist_esm_ne(e,(i,u)=>/^on/.test(u)?et(i,r):i)),_t(this,e,"onProps"),esm_Ie(this,"onProps",e,this);let s=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return esm_Me(++this._lastCallId,{key:r,props:e,defaultProps:o,state:a,actions:{pause:()=>{esm_ye(this)||(esm_it(this,!0),yt(a.pauseQueue),esm_Ie(this,"onPause",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},resume:()=>{esm_ye(this)&&(esm_it(this,!1),dist_esm_Q(this)&&this._resume(),yt(a.resumeQueue),esm_Ie(this,"onResume",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(i=>{if(e.loop&&i.finished&&!(n&&i.noop)){let u=at(e);if(u)return this._update(u,!0)}return i})}_merge(e,n,r){if(n.cancel)return this.stop(!0),r(esm_q(this));let o=!dist_esm_l.und(e.to),s=!dist_esm_l.und(e.from);if(o||s)if(n.callId>this._lastToId)this._lastToId=n.callId;else return r(esm_q(this));let{key:a,defaultProps:i,animation:u}=this,{to:p,from:f}=u,{to:d=p,from:m=f}=e;s&&!o&&(!n.default||dist_esm_l.und(d))&&(d=m),n.reverse&&([d,m]=[m,d]);let b=!bt(m,f);b&&(u.from=m),m=ve(m);let c=!bt(d,p);c&&this._focus(d);let P=esm_Ee(n.to),{config:l}=u,{decay:h,velocity:g}=l;(o||s)&&(l.velocity=0),n.config&&!P&>(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between ${x.constructor.name} and ${L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var _n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance; ;// external "ReactDOM" const external_ReactDOM_namespaceObject = window["ReactDOM"]; ;// ./node_modules/@react-spring/web/dist/esm/index.js var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d(${a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d(${m},${o},${p},${web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`${n}(${m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated; ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/animation.js /** * External dependencies */ /** * WordPress dependencies */ function getAbsolutePosition(element) { return { top: element.offsetTop, left: element.offsetLeft }; } const ANIMATION_DURATION = 400; /** * Hook used to compute the styles required to move a div into a new position. * * The way this animation works is the following: * - It first renders the element as if there was no animation. * - It takes a snapshot of the position of the block to use it * as a destination point for the animation. * - It restores the element to the previous position using a CSS transform * - It uses the "resetAnimation" flag to reset the animation * from the beginning in order to animate to the new destination point. * * @param {Object} $1 Options * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes. */ function useMovingAnimation({ triggerAnimationOnChange }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); // Whenever the trigger changes, we need to take a snapshot of the current // position of the block to use it as a destination point for the animation. const { previous, prevRect } = (0,external_wp_element_namespaceObject.useMemo)(() => ({ previous: ref.current && getAbsolutePosition(ref.current), prevRect: ref.current && ref.current.getBoundingClientRect() }), [triggerAnimationOnChange]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!previous || !ref.current) { return; } // We disable the animation if the user has a preference for reduced // motion. const disableAnimation = window.matchMedia('(prefers-reduced-motion: reduce)').matches; if (disableAnimation) { return; } const controller = new esm_le({ x: 0, y: 0, width: prevRect.width, height: prevRect.height, config: { duration: ANIMATION_DURATION, easing: Lt.easeInOutQuint }, onChange({ value }) { if (!ref.current) { return; } let { x, y, width, height } = value; x = Math.round(x); y = Math.round(y); width = Math.round(width); height = Math.round(height); const finishedMoving = x === 0 && y === 0; ref.current.style.transformOrigin = 'center center'; ref.current.style.transform = finishedMoving ? null // Set to `null` to explicitly remove the transform. : `translate3d(${x}px,${y}px,0)`; ref.current.style.width = finishedMoving ? null : `${width}px`; ref.current.style.height = finishedMoving ? null : `${height}px`; } }); ref.current.style.transform = undefined; const destination = ref.current.getBoundingClientRect(); const x = Math.round(prevRect.left - destination.left); const y = Math.round(prevRect.top - destination.top); const width = destination.width; const height = destination.height; controller.start({ x: 0, y: 0, width, height, from: { x, y, width: prevRect.width, height: prevRect.height } }); return () => { controller.stop(); controller.set({ x: 0, y: 0, width: prevRect.width, height: prevRect.height }); }; }, [previous, prevRect]); return ref; } /* harmony default export */ const animation = (useMovingAnimation); ;// ./node_modules/@wordpress/icons/build-module/library/check.js /** * WordPress dependencies */ const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" }) }); /* harmony default export */ const library_check = (check); ;// ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js /** * WordPress dependencies */ function isPreviewingTheme() { return !!(0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview'); } function currentlyPreviewingTheme() { if (isPreviewingTheme()) { return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview'); } return null; } ;// ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: save_button_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function SaveButton({ className = 'edit-site-save-button__button', variant = 'primary', showTooltip = true, showReviewMessage, icon, size, __next40pxDefaultSize = false }) { const { params } = save_button_useLocation(); const { setIsSaveViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { saveDirtyEntities } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store)); const { dirtyEntityRecords } = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); const { isSaving, isSaveViewOpen, previewingThemeName } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isSavingEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const { isSaveViewOpened } = select(store); const isActivatingTheme = isResolving('activateTheme'); const currentlyPreviewingThemeId = currentlyPreviewingTheme(); return { isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme, isSaveViewOpen: isSaveViewOpened(), // Do not call `getTheme` with null, it will cause a request to // the server. previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined }; }, [dirtyEntityRecords]); const hasDirtyEntities = !!dirtyEntityRecords.length; let isOnlyCurrentEntityDirty; // Check if the current entity is the only entity with changes. // We have some extra logic for `wp_global_styles` for now, that // is used in navigation sidebar. if (dirtyEntityRecords.length === 1) { if (params.postId) { isOnlyCurrentEntityDirty = `${dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType; } else if (params.path?.includes('wp_global_styles')) { isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === 'globalStyles'; } } const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme(); const getLabel = () => { if (isPreviewingTheme()) { if (isSaving) { return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The name of theme to be activated. */ (0,external_wp_i18n_namespaceObject.__)('Activating %s'), previewingThemeName); } else if (disabled) { return (0,external_wp_i18n_namespaceObject.__)('Saved'); } else if (hasDirtyEntities) { return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The name of theme to be activated. */ (0,external_wp_i18n_namespaceObject.__)('Activate %s & Save'), previewingThemeName); } return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The name of theme to be activated. */ (0,external_wp_i18n_namespaceObject.__)('Activate %s'), previewingThemeName); } if (isSaving) { return (0,external_wp_i18n_namespaceObject.__)('Saving'); } if (disabled) { return (0,external_wp_i18n_namespaceObject.__)('Saved'); } if (!isOnlyCurrentEntityDirty && showReviewMessage) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: number of unsaved changes (number). (0,external_wp_i18n_namespaceObject._n)('Review %d change…', 'Review %d changes…', dirtyEntityRecords.length), dirtyEntityRecords.length); } return (0,external_wp_i18n_namespaceObject.__)('Save'); }; const label = getLabel(); const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ dirtyEntityRecords }) : () => setIsSaveViewOpened(true); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: variant, className: className, "aria-disabled": disabled, "aria-expanded": isSaveViewOpen, isBusy: isSaving, onClick: disabled ? undefined : onClick, label: label /* * We want the tooltip to show the keyboard shortcut only when the * button does something, i.e. when it's not disabled. */, shortcut: disabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s') /* * Displaying the keyboard shortcut conditionally makes the tooltip * itself show conditionally. This would trigger a full-rerendering * of the button that we want to avoid. By setting `showTooltip`, * the tooltip is always rendered even when there's no keyboard shortcut. */, showTooltip: showTooltip, icon: icon, __next40pxDefaultSize: __next40pxDefaultSize, size: size, children: label }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function SaveHub() { const { isDisabled, isSaving } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); const _isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); return { isSaving: _isSaving, isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme() }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { className: "edit-site-save-hub", alignment: "right", spacing: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { className: "edit-site-save-hub__button", variant: isDisabled ? null : 'primary', showTooltip: false, icon: isDisabled && !isSaving ? library_check : null, showReviewMessage: true, __next40pxDefaultSize: true }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: use_activate_theme_useHistory, useLocation: use_activate_theme_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); /** * This should be refactored to use the REST API, once the REST API can activate themes. * * @return {Function} A function that activates the theme. */ function useActivateTheme() { const history = use_activate_theme_useHistory(); const { path } = use_activate_theme_useLocation(); const { startResolution, finishResolution } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return async () => { if (isPreviewingTheme()) { const activationURL = 'themes.php?action=activate&stylesheet=' + currentlyPreviewingTheme() + '&_wpnonce=' + window.WP_BLOCK_THEME_ACTIVATE_NONCE; startResolution('activateTheme'); await window.fetch(activationURL); finishResolution('activateTheme'); // Remove the wp_theme_preview query param: we've finished activating // the queue and are switching to normal Site Editor. history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { wp_theme_preview: '' })); } }; } ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js /** * WordPress dependencies */ const ACTIVE_THEMES_URL = '/wp/v2/themes?status=active'; function useActualCurrentTheme() { const [currentTheme, setCurrentTheme] = (0,external_wp_element_namespaceObject.useState)(); (0,external_wp_element_namespaceObject.useEffect)(() => { // Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware. const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, { context: 'edit', wp_theme_preview: '' }); external_wp_apiFetch_default()({ path }).then(activeThemes => setCurrentTheme(activeThemes[0])) // Do nothing .catch(() => {}); }, []); return currentTheme; } ;// ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { EntitiesSavedStatesExtensible, NavigableRegion } = unlock(external_wp_editor_namespaceObject.privateApis); const { useLocation: save_panel_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const EntitiesSavedStatesForPreview = ({ onClose, renderDialog, variant }) => { var _currentTheme$name$re, _previewingTheme$name; const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); let activateSaveLabel; if (isDirtyProps.isDirty) { activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate & Save'); } else { activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate'); } const currentTheme = useActualCurrentTheme(); const previewingTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), []); const additionalPrompt = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: The name of active theme, 2: The name of theme to be activated. */ (0,external_wp_i18n_namespaceObject.__)('Saving your changes will change your active theme from %1$s to %2$s.'), (_currentTheme$name$re = currentTheme?.name?.rendered) !== null && _currentTheme$name$re !== void 0 ? _currentTheme$name$re : '...', (_previewingTheme$name = previewingTheme?.name?.rendered) !== null && _previewingTheme$name !== void 0 ? _previewingTheme$name : '...') }); const activateTheme = useActivateTheme(); const onSave = async values => { await activateTheme(); return values; }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, { ...isDirtyProps, additionalPrompt, close: onClose, onSave, saveEnabled: true, saveLabel: activateSaveLabel, renderDialog, variant }); }; const _EntitiesSavedStates = ({ onClose, renderDialog, variant }) => { if (isPreviewingTheme()) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesForPreview, { onClose: onClose, renderDialog: renderDialog, variant: variant }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EntitiesSavedStates, { close: onClose, renderDialog: renderDialog, variant: variant }); }; function SavePanel() { const { query } = save_panel_useLocation(); const { canvas = 'view' } = query; const { isSaveViewOpen, isDirty, isSaving } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); const isActivatingTheme = isResolving('activateTheme'); const { isSaveViewOpened } = unlock(select(store)); // The currently selected entity to display. // Typically template or template part in the site editor. return { isSaveViewOpen: isSaveViewOpened(), isDirty: dirtyEntityRecords.length > 0, isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme }; }, []); const { setIsSaveViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onClose = () => setIsSaveViewOpened(false); (0,external_wp_element_namespaceObject.useEffect)(() => { setIsSaveViewOpened(false); }, [canvas, setIsSaveViewOpened]); if (canvas === 'view') { return isSaveViewOpen ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { className: "edit-site-save-panel__modal", onRequestClose: onClose, title: (0,external_wp_i18n_namespaceObject.__)('Review changes'), size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose: onClose, variant: "inline" }) }) : null; } const activateSaveEnabled = isPreviewingTheme() || isDirty; const disabled = isSaving || !activateSaveEnabled; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(NavigableRegion, { className: dist_clsx('edit-site-layout__actions', { 'is-entity-save-view-open': isSaveViewOpen }), ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Save panel'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('edit-site-editor__toggle-save-panel', { 'screen-reader-text': isSaveViewOpen }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", className: "edit-site-editor__toggle-save-panel-button", onClick: () => setIsSaveViewOpened(true), "aria-haspopup": "dialog", disabled: disabled, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Open save panel') }) }), isSaveViewOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose: onClose, renderDialog: true })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useCommands } = unlock(external_wp_coreCommands_namespaceObject.privateApis); const { useGlobalStyle: layout_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { NavigableRegion: layout_NavigableRegion, GlobalStylesProvider } = unlock(external_wp_editor_namespaceObject.privateApis); const { useLocation: layout_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const layout_ANIMATION_DURATION = 0.3; function Layout() { const { query, name: routeKey, areas, widths } = layout_useLocation(); const { canvas = 'view' } = query; useCommands(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const toggleRef = (0,external_wp_element_namespaceObject.useRef)(); const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const [canvasResizer, canvasSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const isEditorLoading = useIsSiteEditorLoading(); const [isResizableFrameOversized, setIsResizableFrameOversized] = (0,external_wp_element_namespaceObject.useState)(false); const animationRef = animation({ triggerAnimationOnChange: routeKey + '-' + canvas }); const { showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels') }; }); const [backgroundColor] = layout_useGlobalStyle('color.background'); const [gradientValue] = layout_useGlobalStyle('color.gradient'); const previousCanvaMode = (0,external_wp_compose_namespaceObject.usePrevious)(canvas); (0,external_wp_element_namespaceObject.useEffect)(() => { if (previousCanvaMode === 'edit') { toggleRef.current?.focus(); } // Should not depend on the previous canvas mode value but the next. }, [canvas]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_commands_namespaceObject.CommandMenu, {}), canvas === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveKeyboardShortcut, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...navigateRegionsProps, ref: navigateRegionsProps.ref, className: dist_clsx('edit-site-layout', navigateRegionsProps.className, { 'is-full-canvas': canvas === 'edit', 'show-icon-labels': showIconLabels }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__content", children: [(!isMobileViewport || !areas.mobile) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout_NavigableRegion, { ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation'), className: "edit-site-layout__sidebar-region", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: canvas === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { type: 'tween', duration: // Disable transition in mobile to emulate a full page transition. disableMotion || isMobileViewport ? 0 : layout_ANIMATION_DURATION, ease: 'easeOut' }, className: "edit-site-layout__sidebar", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_hub, { ref: toggleRef, isTransparent: isResizableFrameOversized }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { shouldAnimate: routeKey !== 'styles', routeKey: routeKey, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.sidebar }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})] }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}), isMobileViewport && areas.mobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-layout__mobile", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { children: canvas !== 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteHubMobile, { ref: toggleRef, isTransparent: isResizableFrameOversized }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { routeKey: routeKey, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})] }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }) }), !isMobileViewport && areas.content && canvas !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-layout__area", style: { maxWidth: widths?.content }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.content }) }), !isMobileViewport && areas.edit && canvas !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-layout__area", style: { maxWidth: widths?.edit }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.edit }) }), !isMobileViewport && areas.preview && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__canvas-container", children: [canvasResizer, !!canvasSize.width && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('edit-site-layout__canvas', { 'is-right-aligned': isResizableFrameOversized }), ref: animationRef, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_frame, { isReady: !isEditorLoading, isFullWidth: canvas === 'edit', defaultSize: { width: canvasSize.width - 24 /* $canvas-padding */, height: canvasSize.height }, isOversized: isResizableFrameOversized, setIsOversized: setIsResizableFrameOversized, innerContentStyle: { background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor }, children: areas.preview }) }) })] })] }) })] }); } function LayoutWithGlobalStylesProvider(props) { const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); function onPluginAreaError(name) { createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: plugin name */ (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { onError: onPluginAreaError }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { ...props })] }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/styles.js /** * WordPress dependencies */ const styles = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z" }) }); /* harmony default export */ const library_styles = (styles); ;// ./node_modules/@wordpress/icons/build-module/library/help.js /** * WordPress dependencies */ const help = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z" }) }); /* harmony default export */ const library_help = (help); ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js /** * WordPress dependencies */ const rotateRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) }); /* harmony default export */ const rotate_right = (rotateRight); ;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js /** * WordPress dependencies */ const rotateLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) }); /* harmony default export */ const rotate_left = (rotateLeft); ;// ./node_modules/@wordpress/icons/build-module/library/brush.js /** * WordPress dependencies */ const brush = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z" }) }); /* harmony default export */ const library_brush = (brush); ;// ./node_modules/@wordpress/icons/build-module/library/backup.js /** * WordPress dependencies */ const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) }); /* harmony default export */ const library_backup = (backup); ;// ./node_modules/@wordpress/icons/build-module/library/external.js /** * WordPress dependencies */ const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); /* harmony default export */ const library_external = (external); ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { useHistory: use_common_commands_useHistory, useLocation: use_common_commands_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const getGlobalStylesOpenStylesCommands = () => function useGlobalStylesOpenStylesCommands() { const { openGeneralSidebar } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const { params } = use_common_commands_useLocation(); const { canvas = 'view' } = params; const history = use_common_commands_useHistory(); const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; }, []); const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!isBlockBasedTheme) { return []; } return [{ name: 'core/edit-site/open-styles', label: (0,external_wp_i18n_namespaceObject.__)('Open styles'), callback: ({ close }) => { close(); if (canvas !== 'edit') { history.navigate('/styles?canvas=edit', { transition: 'canvas-mode-edit-transition' }); } openGeneralSidebar('edit-site/global-styles'); }, icon: library_styles }]; }, [history, openGeneralSidebar, canvas, isBlockBasedTheme]); return { isLoading: false, commands }; }; const getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() { const { openGeneralSidebar } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const { params } = use_common_commands_useLocation(); const { canvas = 'view' } = params; const { set } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const history = use_common_commands_useHistory(); const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; }, []); const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!isBlockBasedTheme) { return []; } return [{ name: 'core/edit-site/toggle-styles-welcome-guide', label: (0,external_wp_i18n_namespaceObject.__)('Learn about styles'), callback: ({ close }) => { close(); if (canvas !== 'edit') { history.navigate('/styles?canvas=edit', { transition: 'canvas-mode-edit-transition' }); } openGeneralSidebar('edit-site/global-styles'); set('core/edit-site', 'welcomeGuideStyles', true); // sometimes there's a focus loss that happens after some time // that closes the modal, we need to force reopening it. setTimeout(() => { set('core/edit-site', 'welcomeGuideStyles', true); }, 500); }, icon: library_help }]; }, [history, openGeneralSidebar, canvas, isBlockBasedTheme, set]); return { isLoading: false, commands }; }; const getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() { const [canReset, onReset] = useGlobalStylesReset(); const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!canReset) { return []; } return [{ name: 'core/edit-site/reset-global-styles', label: (0,external_wp_i18n_namespaceObject.__)('Reset styles'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right : rotate_left, callback: ({ close }) => { close(); onReset(); } }]; }, [canReset, onReset]); return { isLoading: false, commands }; }; const getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() { const { openGeneralSidebar, setEditorCanvasContainerView } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const { params } = use_common_commands_useLocation(); const { canvas = 'view' } = params; const history = use_common_commands_useHistory(); const { canEditCSS } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; return { canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] }; }, []); const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!canEditCSS) { return []; } return [{ name: 'core/edit-site/open-styles-css', label: (0,external_wp_i18n_namespaceObject.__)('Customize CSS'), icon: library_brush, callback: ({ close }) => { close(); if (canvas !== 'edit') { history.navigate('/styles?canvas=edit', { transition: 'canvas-mode-edit-transition' }); } openGeneralSidebar('edit-site/global-styles'); setEditorCanvasContainerView('global-styles-css'); } }]; }, [history, openGeneralSidebar, setEditorCanvasContainerView, canEditCSS, canvas]); return { isLoading: false, commands }; }; const getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() { const { openGeneralSidebar, setEditorCanvasContainerView } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const { params } = use_common_commands_useLocation(); const { canvas = 'view' } = params; const history = use_common_commands_useHistory(); const hasRevisions = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; return !!globalStyles?._links?.['version-history']?.[0]?.count; }, []); const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!hasRevisions) { return []; } return [{ name: 'core/edit-site/open-global-styles-revisions', label: (0,external_wp_i18n_namespaceObject.__)('Style revisions'), icon: library_backup, callback: ({ close }) => { close(); if (canvas !== 'edit') { history.navigate('/styles?canvas=edit', { transition: 'canvas-mode-edit-transition' }); } openGeneralSidebar('edit-site/global-styles'); setEditorCanvasContainerView('global-styles-revisions'); } }]; }, [hasRevisions, history, openGeneralSidebar, setEditorCanvasContainerView, canvas]); return { isLoading: false, commands }; }; function useCommonCommands() { const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { // Site index. return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; }, []); (0,external_wp_commands_namespaceObject.useCommand)({ name: 'core/edit-site/view-site', label: (0,external_wp_i18n_namespaceObject.__)('View site'), callback: ({ close }) => { close(); window.open(homeUrl, '_blank'); }, icon: library_external }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/open-styles', hook: getGlobalStylesOpenStylesCommands() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/toggle-styles-welcome-guide', hook: getGlobalStylesToggleWelcomeGuideCommands() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/reset-global-styles', hook: getGlobalStylesResetCommands() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/open-styles-css', hook: getGlobalStylesOpenCssCommands() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/open-styles-revisions', hook: getGlobalStylesOpenRevisionsCommands() }); } ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js /** * WordPress dependencies */ const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); /* harmony default export */ const close_small = (closeSmall); ;// ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { EditorContentSlotFill, ResizableEditor } = unlock(external_wp_editor_namespaceObject.privateApis); /** * Returns a translated string for the title of the editor canvas container. * * @param {string} view Editor canvas container view. * * @return {Object} Translated string for the view title and associated icon, both defaulting to ''. */ function getEditorCanvasContainerTitle(view) { switch (view) { case 'style-book': return (0,external_wp_i18n_namespaceObject.__)('Style Book'); case 'global-styles-revisions': case 'global-styles-revisions:style-book': return (0,external_wp_i18n_namespaceObject.__)('Style Revisions'); default: return ''; } } function EditorCanvasContainer({ children, closeButtonLabel, onClose, enableResizing = false }) { const { editorCanvasContainerView, showListViewByDefault } = (0,external_wp_data_namespaceObject.useSelect)(select => { const _editorCanvasContainerView = unlock(select(store)).getEditorCanvasContainerView(); const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); return { editorCanvasContainerView: _editorCanvasContainerView, showListViewByDefault: _showListViewByDefault }; }, []); const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); const { setEditorCanvasContainerView } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const { setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); function onCloseContainer() { setIsListViewOpened(showListViewByDefault); setEditorCanvasContainerView(undefined); setIsClosed(true); if (typeof onClose === 'function') { onClose(); } } function closeOnEscape(event) { if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { event.preventDefault(); onCloseContainer(); } } const childrenWithProps = Array.isArray(children) ? external_wp_element_namespaceObject.Children.map(children, (child, index) => index === 0 ? (0,external_wp_element_namespaceObject.cloneElement)(child, { ref: sectionFocusReturnRef }) : child) : (0,external_wp_element_namespaceObject.cloneElement)(children, { ref: sectionFocusReturnRef }); if (isClosed) { return null; } const title = getEditorCanvasContainerTitle(editorCanvasContainerView); const shouldShowCloseButton = onClose || closeButtonLabel; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorContentSlotFill.Fill, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-editor-canvas-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizableEditor, { enableResizing: enableResizing, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { className: "edit-site-editor-canvas-container__section", ref: shouldShowCloseButton ? focusOnMountRef : null, onKeyDown: closeOnEscape, "aria-label": title, children: [shouldShowCloseButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", className: "edit-site-editor-canvas-container__close-button", icon: close_small, label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close'), onClick: onCloseContainer }), childrenWithProps] }) }) }) }); } function useHasEditorCanvasContainer() { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.name); return !!fills?.length; } /* harmony default export */ const editor_canvas_container = (EditorCanvasContainer); ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-set-command-context.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useCommandContext } = unlock(external_wp_commands_namespaceObject.privateApis); const { useLocation: use_set_command_context_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); /** * React hook used to set the correct command context based on the current state. */ function useSetCommandContext() { const { query = {} } = use_set_command_context_useLocation(); const { canvas = 'view' } = query; const hasBlockSelected = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(); }, []); const hasEditorCanvasContainer = useHasEditorCanvasContainer(); // Sets the right context for the command palette let commandContext = 'site-editor'; if (canvas === 'edit') { commandContext = 'entity-edit'; } if (hasBlockSelected) { commandContext = 'block-selection-edit'; } if (hasEditorCanvasContainer) { /* * The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context * to remove the suggested commands that may not make sense with Style Book or Style Revisions open. * See https://github.com/WordPress/gutenberg/issues/62216. */ commandContext = ''; } useCommandContext(commandContext); } ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js /** * WordPress dependencies */ const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) }); /* harmony default export */ const library_navigation = (navigation); ;// ./node_modules/@wordpress/icons/build-module/library/page.js /** * WordPress dependencies */ const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" })] }); /* harmony default export */ const library_page = (page); ;// ./node_modules/@wordpress/icons/build-module/library/layout.js /** * WordPress dependencies */ const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); /* harmony default export */ const library_layout = (layout); ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js /** * WordPress dependencies */ const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); /* harmony default export */ const library_symbol = (symbol); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js /** * WordPress dependencies */ const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); /* harmony default export */ const chevron_right = (chevronRight); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js /** * WordPress dependencies */ const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); /* harmony default export */ const chevron_left = (chevronLeft); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js /** * External dependencies */ /** * WordPress dependencies */ function SidebarButton(props) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", ...props, className: dist_clsx('edit-site-sidebar-button', props.className) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: sidebar_navigation_screen_useHistory, useLocation: sidebar_navigation_screen_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function SidebarNavigationScreen({ isRoot, title, actions, content, footer, description, backPath: backPathProp }) { const { dashboardLink, dashboardLinkText, previewingThemeName } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = unlock(select(store)); const currentlyPreviewingThemeId = currentlyPreviewingTheme(); return { dashboardLink: getSettings().__experimentalDashboardLink, dashboardLinkText: getSettings().__experimentalDashboardLinkText, // Do not call `getTheme` with null, it will cause a request to // the server. previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined }; }, []); const location = sidebar_navigation_screen_useLocation(); const history = sidebar_navigation_screen_useHistory(); const { navigate } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); const backPath = backPathProp !== null && backPathProp !== void 0 ? backPathProp : location.state?.backPath; const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: dist_clsx('edit-site-sidebar-navigation-screen__main', { 'has-footer': !!footer }), spacing: 0, justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, alignment: "flex-start", className: "edit-site-sidebar-navigation-screen__title-icon", children: [!isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { onClick: () => { history.navigate(backPath); navigate('back'); }, icon: icon, label: (0,external_wp_i18n_namespaceObject.__)('Back'), showTooltip: false }), isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { icon: icon, label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), href: dashboardLink }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { className: "edit-site-sidebar-navigation-screen__title", color: '#e0e0e0' /* $gray-200 */, level: 1, size: 20, children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: theme name. 2: title */ (0,external_wp_i18n_namespaceObject.__)('Previewing %1$s: %2$s'), previewingThemeName, title) }), actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__actions", children: actions })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-sidebar-navigation-screen__content", children: [description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__description", children: description }), content] })] }), footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", { className: "edit-site-sidebar-navigation-screen__footer", children: footer })] }); } ;// ./node_modules/@wordpress/icons/build-module/icon/index.js /** * WordPress dependencies */ /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ /** * Return an SVG icon. * * @param {IconProps} props icon is the SVG component to render * size is a number specifying the icon size in pixels * Other props will be passed to wrapped SVG component * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. * * @return {JSX.Element} Icon component */ function Icon({ icon, size = 24, ...props }, ref) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } /* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js /** * WordPress dependencies */ const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); /* harmony default export */ const chevron_left_small = (chevronLeftSmall); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js /** * WordPress dependencies */ const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); /* harmony default export */ const chevron_right_small = (chevronRightSmall); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: sidebar_navigation_item_useHistory, useLink } = unlock(external_wp_router_namespaceObject.privateApis); function SidebarNavigationItem({ className, icon, withChevron = false, suffix, uid, to, onClick, children, ...props }) { const history = sidebar_navigation_item_useHistory(); const { navigate } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); // If there is no custom click handler, create one that navigates to `params`. function handleClick(e) { if (onClick) { onClick(e); navigate('forward'); } else if (to) { e.preventDefault(); history.navigate(to); navigate('forward', `[id="${uid}"]`); } } const linkProps = useLink(to); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { className: dist_clsx('edit-site-sidebar-navigation-item', { 'with-suffix': !withChevron && suffix }, className), id: uid, onClick: handleClick, href: to ? linkProps.href : undefined, ...props, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { style: { fill: 'currentcolor' }, icon: icon, size: 24 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: children }), withChevron && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small, className: "edit-site-sidebar-navigation-item__drilldown-indicator", size: 24 }), !withChevron && suffix] }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js /** * WordPress dependencies */ /** * Internal dependencies */ const SITE_EDITOR_AUTHORS_QUERY = { per_page: -1, _fields: 'id,name,avatar_urls', context: 'view', capabilities: ['edit_theme_options'] }; const DEFAULT_QUERY = { per_page: 100, page: 1 }; const use_global_styles_revisions_EMPTY_ARRAY = []; const { GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function useGlobalStylesRevisions({ query } = {}) { const { user: userConfig } = (0,external_wp_element_namespaceObject.useContext)(use_global_styles_revisions_GlobalStylesContext); const _query = { ...DEFAULT_QUERY, ...query }; const { authors, currentUser, isDirty, revisions, isLoadingGlobalStylesRevisions, revisionsCount } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _globalStyles$_links$; const { __experimentalGetDirtyEntityRecords, getCurrentUser, getUsers, getRevisions, __experimentalGetCurrentGlobalStylesId, getEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); const _currentUser = getCurrentUser(); const _isDirty = dirtyEntityRecords.length > 0; const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; const _revisionsCount = (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0; const globalStylesRevisions = getRevisions('root', 'globalStyles', globalStylesId, _query) || use_global_styles_revisions_EMPTY_ARRAY; const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY; const _isResolving = isResolving('getRevisions', ['root', 'globalStyles', globalStylesId, _query]); return { authors: _authors, currentUser: _currentUser, isDirty: _isDirty, revisions: globalStylesRevisions, isLoadingGlobalStylesRevisions: _isResolving, revisionsCount: _revisionsCount }; }, [query]); return (0,external_wp_element_namespaceObject.useMemo)(() => { if (!authors.length || isLoadingGlobalStylesRevisions) { return { revisions: use_global_styles_revisions_EMPTY_ARRAY, hasUnsavedChanges: isDirty, isLoading: true, revisionsCount }; } // Adds author details to each revision. const _modifiedRevisions = revisions.map(revision => { return { ...revision, author: authors.find(author => author.id === revision.author) }; }); const fetchedRevisionsCount = revisions.length; if (fetchedRevisionsCount) { // Flags the most current saved revision. if (_modifiedRevisions[0].id !== 'unsaved' && _query.page === 1) { _modifiedRevisions[0].isLatest = true; } // Adds an item for unsaved changes. if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) { const unsavedRevision = { id: 'unsaved', styles: userConfig?.styles, settings: userConfig?.settings, _links: userConfig?._links, author: { name: currentUser?.name, avatar_urls: currentUser?.avatar_urls }, modified: new Date() }; _modifiedRevisions.unshift(unsavedRevision); } if (_query.page === Math.ceil(revisionsCount / _query.per_page)) { // Adds an item for the default theme styles. _modifiedRevisions.push({ id: 'parent', styles: {}, settings: {} }); } } return { revisions: _modifiedRevisions, hasUnsavedChanges: isDirty, isLoading: false, revisionsCount }; }, [isDirty, revisions, currentUser, authors, userConfig, isLoadingGlobalStylesRevisions]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function SidebarNavigationScreenDetailsFooter({ record, revisionsCount, ...otherProps }) { var _record$_links$predec; /* * There might be other items in the future, * but for now it's just modified date. * Later we might render a list of items and isolate * the following logic. */ const hrefProps = {}; const lastRevisionId = (_record$_links$predec = record?._links?.['predecessor-version']?.[0]?.id) !== null && _record$_links$predec !== void 0 ? _record$_links$predec : null; // Use incoming prop first, then the record's version history, if available. revisionsCount = revisionsCount || record?._links?.['version-history']?.[0]?.count || 0; /* * Enable the revisions link if there is a last revision and there is more than one revision. * This link is used for theme assets, e.g., templates, which have no database record until they're edited. * For these files there's only a "revision" after they're edited twice, * which means the revision.php page won't display a proper diff. * See: https://github.com/WordPress/gutenberg/issues/49164. */ if (lastRevisionId && revisionsCount > 1) { hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { revision: record?._links['predecessor-version'][0].id }); hrefProps.as = 'a'; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { size: "large", className: "edit-site-sidebar-navigation-screen-details-footer", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { icon: library_backup, ...hrefProps, ...otherProps, children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of Styles revisions. */ (0,external_wp_i18n_namespaceObject._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount) }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: sidebar_navigation_screen_global_styles_useLocation, useHistory: sidebar_navigation_screen_global_styles_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function SidebarNavigationItemGlobalStyles(props) { const { name } = sidebar_navigation_screen_global_styles_useLocation(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { ...props, "aria-current": name === 'styles' }); } function SidebarNavigationScreenGlobalStyles() { const history = sidebar_navigation_screen_global_styles_useHistory(); const { path } = sidebar_navigation_screen_global_styles_useLocation(); const { revisions, isLoading: isLoadingRevisions, revisionsCount } = useGlobalStylesRevisions(); const { openGeneralSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { setEditorCanvasContainerView } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const openGlobalStyles = (0,external_wp_element_namespaceObject.useCallback)(async () => { history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: 'edit' }), { transition: 'canvas-mode-edit-transition' }); return Promise.all([setPreference('core', 'distractionFree', false), openGeneralSidebar('edit-site/global-styles')]); }, [path, history, openGeneralSidebar, setPreference]); const openRevisions = (0,external_wp_element_namespaceObject.useCallback)(async () => { await openGlobalStyles(); // Open the global styles revisions once the canvas mode is set to edit, // and the global styles sidebar is open. The global styles UI is responsible // for redirecting to the revisions screen once the editor canvas container // has been set to 'global-styles-revisions'. setEditorCanvasContainerView('global-styles-revisions'); }, [openGlobalStyles, setEditorCanvasContainerView]); // If there are no revisions, do not render a footer. const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)('Design'), isRoot: true, description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.'), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { activeItem: "styles-navigation-item" }), footer: shouldShowGlobalStylesFooter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsFooter, { record: revisions?.[0], revisionsCount: revisionsCount, onClick: openRevisions }) }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function MainSidebarNavigationContent({ isBlockBasedTheme = true }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-main", children: [isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { uid: "navigation-navigation-item", to: "/navigation", withChevron: true, icon: library_navigation, children: (0,external_wp_i18n_namespaceObject.__)('Navigation') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItemGlobalStyles, { to: "/styles", uid: "global-styles-navigation-item", icon: library_styles, children: (0,external_wp_i18n_namespaceObject.__)('Styles') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { uid: "page-navigation-item", to: "/page", withChevron: true, icon: library_page, children: (0,external_wp_i18n_namespaceObject.__)('Pages') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { uid: "template-navigation-item", to: "/template", withChevron: true, icon: library_layout, children: (0,external_wp_i18n_namespaceObject.__)('Templates') })] }), !isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { uid: "stylebook-navigation-item", to: "/stylebook", withChevron: true, icon: library_styles, children: (0,external_wp_i18n_namespaceObject.__)('Styles') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { uid: "patterns-navigation-item", to: "/pattern", withChevron: true, icon: library_symbol, children: (0,external_wp_i18n_namespaceObject.__)('Patterns') })] }); } function SidebarNavigationScreenMain({ customDescription }) { const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []); const { setEditorCanvasContainerView } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); // Clear the editor canvas container view when accessing the main navigation screen. (0,external_wp_element_namespaceObject.useEffect)(() => { setEditorCanvasContainerView(undefined); }, [setEditorCanvasContainerView]); let description; if (customDescription) { description = customDescription; } else if (isBlockBasedTheme) { description = (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.'); } else { description = (0,external_wp_i18n_namespaceObject.__)('Explore block styles and patterns to refine your site.'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { isRoot: true, title: (0,external_wp_i18n_namespaceObject.__)('Design'), description: description, content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { isBlockBasedTheme: isBlockBasedTheme }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-unsupported/index.js /** * WordPress dependencies */ function SidebarNavigationScreenUnsupported() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { padding: 3, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)('The theme you are currently using does not support this screen.') }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up-left.js /** * WordPress dependencies */ const arrowUpLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" }) }); /* harmony default export */ const arrow_up_left = (arrowUpLeft); ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { className: "edit-site-welcome-guide__image", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { srcSet: nonAnimatedSrc, media: "(prefers-reduced-motion: reduce)" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js /** * WordPress dependencies */ /** * Internal dependencies */ function WelcomeGuideEditor() { const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const { isActive, isBlockBasedTheme } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'), isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme }; }, []); if (!isActive || !isBlockBasedTheme) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { className: "edit-site-welcome-guide guide-editor", contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'), finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), onFinish: () => toggle('core/edit-site', 'welcomeGuide'), pages: [{ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)('Edit your site') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'), { StylesIconImage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { alt: (0,external_wp_i18n_namespaceObject.__)('styles'), src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A" }) }) })] }) }] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js /** * WordPress dependencies */ /** * Internal dependencies */ const { interfaceStore: styles_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis); function WelcomeGuideStyles() { const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const { isActive, isStylesOpen } = (0,external_wp_data_namespaceObject.useSelect)(select => { const sidebar = select(styles_interfaceStore).getActiveComplementaryArea('core'); return { isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'), isStylesOpen: sidebar === 'edit-site/global-styles' }; }, []); if (!isActive || !isStylesOpen) { return null; } const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { className: "edit-site-welcome-guide guide-styles", contentLabel: welcomeLabel, finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'), pages: [{ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1", animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: welcomeLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)('Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.') })] }) }, { image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1", animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)('Set the design') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)('You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!') })] }) }, { image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1", animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)('Personalize blocks') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)('You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.') })] }) }, { image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)('Learn more') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "edit-site-welcome-guide__text", children: [(0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site?'), ' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/styles-overview/'), children: (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.') })] })] }) }] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js /** * WordPress dependencies */ function WelcomeGuidePage() { const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { const isPageActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuidePage'); const isEditorActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'); return isPageActive && !isEditorActive; }, []); if (!isVisible) { return null; } const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a page'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { className: "edit-site-welcome-guide guide-page", contentLabel: heading, finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'), onFinish: () => toggle('core/edit-site', 'welcomeGuidePage'), pages: [{ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { className: "edit-site-welcome-guide__video", autoPlay: true, loop: true, muted: true, width: "312", height: "240", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { src: "https://s.w.org/images/block-editor/editing-your-page.mp4", type: "video/mp4" }) }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 'It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.') })] }) }] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js /** * WordPress dependencies */ function WelcomeGuideTemplate() { const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const { isActive, hasPreviousEntity } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditorSettings } = select(external_wp_editor_namespaceObject.store); const { get } = select(external_wp_preferences_namespaceObject.store); return { isActive: get('core/edit-site', 'welcomeGuideTemplate'), hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord }; }, []); const isVisible = isActive && hasPreviousEntity; if (!isVisible) { return null; } const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a template'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { className: "edit-site-welcome-guide guide-template", contentLabel: heading, finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'), onFinish: () => toggle('core/edit-site', 'welcomeGuideTemplate'), pages: [{ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { className: "edit-site-welcome-guide__video", autoPlay: true, loop: true, muted: true, width: "312", height: "240", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { src: "https://s.w.org/images/block-editor/editing-your-template.mp4", type: "video/mp4" }) }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)('Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.') })] }) }] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js /** * Internal dependencies */ function WelcomeGuide({ postType }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideEditor, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideStyles, {}), postType === 'page' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuidePage, {}), postType === 'wp_template' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {})] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStylesOutput } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function useGlobalStylesRenderer(disableRootPadding) { const [styles, settings] = useGlobalStylesOutput(disableRootPadding); const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(store); const { updateSettings } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { var _currentStoreSettings; if (!styles || !settings) { return; } const currentStoreSettings = getSettings(); const nonGlobalStyles = Object.values((_currentStoreSettings = currentStoreSettings.styles) !== null && _currentStoreSettings !== void 0 ? _currentStoreSettings : []).filter(style => !style.isGlobalStyles); updateSettings({ ...currentStoreSettings, styles: [...nonGlobalStyles, ...styles], __experimentalFeatures: settings }); }, [styles, settings, updateSettings, getSettings]); } function GlobalStylesRenderer({ disableRootPadding }) { useGlobalStylesRenderer(disableRootPadding); return null; } ;// ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Theme } = unlock(external_wp_components_namespaceObject.privateApis); const { useGlobalStyle: canvas_loader_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function CanvasLoader({ id }) { var _highlightedColors$0$; const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle('color.text'); const [backgroundColor] = canvas_loader_useGlobalStyle('color.background'); const { highlightedColors } = useStylesPreviewColors(); const indicatorColor = (_highlightedColors$0$ = highlightedColors[0]?.color) !== null && _highlightedColors$0$ !== void 0 ? _highlightedColors$0$ : fallbackIndicatorColor; const { elapsed, total } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _selectorsByStatus$re, _selectorsByStatus$fi; const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus(); const resolving = (_selectorsByStatus$re = selectorsByStatus.resolving) !== null && _selectorsByStatus$re !== void 0 ? _selectorsByStatus$re : 0; const finished = (_selectorsByStatus$fi = selectorsByStatus.finished) !== null && _selectorsByStatus$fi !== void 0 ? _selectorsByStatus$fi : 0; return { elapsed: finished, total: finished + resolving }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-canvas-loader", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Theme, { accent: indicatorColor, background: backgroundColor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, { id: id, max: total, value: elapsed }) }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: use_navigate_to_entity_record_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function useNavigateToEntityRecord() { const history = use_navigate_to_entity_record_useHistory(); const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => { history.navigate(`/${params.postType}/${params.postId}?canvas=edit&focusMode=true`); }, [history]); return onNavigateToEntityRecord; } ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: use_site_editor_settings_useLocation, useHistory: use_site_editor_settings_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function useNavigateToPreviousEntityRecord() { const location = use_site_editor_settings_useLocation(); const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location); const history = use_site_editor_settings_useHistory(); const goBack = (0,external_wp_element_namespaceObject.useMemo)(() => { const isFocusMode = location.query.focusMode || location?.params?.postId && FOCUSABLE_ENTITIES.includes(location?.params?.postType); const didComeFromEditorCanvas = previousLocation?.query.canvas === 'edit'; const showBackButton = isFocusMode && didComeFromEditorCanvas; return showBackButton ? () => history.back() : undefined; // `previousLocation` changes when the component updates for any reason, not // just when location changes. Until this is fixed we can't add it to deps. See // https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465. }, [location, history]); return goBack; } function useSpecificEditorSettings() { const { query } = use_site_editor_settings_useLocation(); const { canvas = 'view' } = query; const onNavigateToEntityRecord = useNavigateToEntityRecord(); const { settings } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(store); return { settings: getSettings() }; }, []); const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord(); const defaultEditorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { return { ...settings, richEditingEnabled: true, supportsTemplateMode: true, focusMode: canvas !== 'view', onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, isPreviewMode: canvas === 'view' }; }, [settings, canvas, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]); return defaultEditorSettings; } ;// ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js /** * Defines an extensibility slot for the Template sidebar. */ /** * WordPress dependencies */ const { Fill, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginTemplateSettingPanel'); const PluginTemplateSettingPanel = ({ children }) => { external_wp_deprecated_default()('wp.editSite.PluginTemplateSettingPanel', { since: '6.6', version: '6.8', alternative: 'wp.editor.PluginDocumentSettingPanel' }); const isCurrentEntityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', []); if (!isCurrentEntityTemplate) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: children }); }; PluginTemplateSettingPanel.Slot = Slot; /** * Renders items in the Template Sidebar below the main information * like the Template Card. * * @deprecated since 6.6. Use `wp.editor.PluginDocumentSettingPanel` instead. * * @example * ```jsx * // Using ESNext syntax * import { PluginTemplateSettingPanel } from '@wordpress/edit-site'; * * const MyTemplateSettingTest = () => ( * <PluginTemplateSettingPanel> * <p>Hello, World!</p> * </PluginTemplateSettingPanel> * ); * ``` * * @return {Component} The component to be rendered. */ /* harmony default export */ const plugin_template_setting_panel = (PluginTemplateSettingPanel); ;// ./node_modules/@wordpress/icons/build-module/library/seen.js /** * WordPress dependencies */ const seen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) }); /* harmony default export */ const library_seen = (seen); ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js /** * WordPress dependencies */ const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); /* harmony default export */ const more_vertical = (moreVertical); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js /** * External dependencies */ /** * WordPress dependencies */ function IconWithCurrentColor({ className, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: dist_clsx(className, 'edit-site-global-styles-icon-with-current-color'), ...props }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js /** * WordPress dependencies */ /** * Internal dependencies */ function GenericNavigationButton({ icon, children, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItem, { ...props, children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { icon: icon, size: 24 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: children })] }), !icon && children] }); } function NavigationButtonAsItem(props) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Button, { as: GenericNavigationButton, ...props }); } function NavigationBackButtonAsItem(props) { return /*#__PURE__*/_jsx(Navigator.BackButton, { as: GenericNavigationButton, ...props }); } ;// ./node_modules/@wordpress/icons/build-module/library/typography.js /** * WordPress dependencies */ const typography = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z" }) }); /* harmony default export */ const library_typography = (typography); ;// ./node_modules/@wordpress/icons/build-module/library/color.js /** * WordPress dependencies */ const color = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" }) }); /* harmony default export */ const library_color = (color); ;// ./node_modules/@wordpress/icons/build-module/library/background.js /** * WordPress dependencies */ const background = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z" }) }); /* harmony default export */ const library_background = (background); ;// ./node_modules/@wordpress/icons/build-module/library/shadow.js /** * WordPress dependencies */ const shadow = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" }) }); /* harmony default export */ const library_shadow = (shadow); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHasDimensionsPanel, useHasTypographyPanel, useHasColorPanel, useGlobalSetting: root_menu_useGlobalSetting, useSettingsForBlockElement, useHasBackgroundPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function RootMenu() { const [rawSettings] = root_menu_useGlobalSetting(''); const settings = useSettingsForBlockElement(rawSettings); /* * Use the raw settings to determine if the background panel should be displayed, * as the background panel is not dependent on the block element settings. */ const hasBackgroundPanel = useHasBackgroundPanel(rawSettings); const hasTypographyPanel = useHasTypographyPanel(settings); const hasColorPanel = useHasColorPanel(settings); const hasShadowPanel = true; // useHasShadowPanel( settings ); const hasDimensionsPanel = useHasDimensionsPanel(settings); const hasLayoutPanel = hasDimensionsPanel; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: [hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: library_typography, path: "/typography", children: (0,external_wp_i18n_namespaceObject.__)('Typography') }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: library_color, path: "/colors", children: (0,external_wp_i18n_namespaceObject.__)('Colors') }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: library_background, path: "/background", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Background styles'), children: (0,external_wp_i18n_namespaceObject.__)('Background') }), hasShadowPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: library_shadow, path: "/shadows", children: (0,external_wp_i18n_namespaceObject.__)('Shadows') }), hasLayoutPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: library_layout, path: "/layout", children: (0,external_wp_i18n_namespaceObject.__)('Layout') })] }) }); } /* harmony default export */ const root_menu = (RootMenu); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js function findNearest(input, numbers) { // If the numbers array is empty, return null if (numbers.length === 0) { return null; } // Sort the array based on the absolute difference with the input numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b)); // Return the first element (which will be the nearest) from the sorted array return numbers[0]; } function extractFontWeights(fontFaces) { const result = []; fontFaces.forEach(face => { const weights = String(face.fontWeight).split(' '); if (weights.length === 2) { const start = parseInt(weights[0]); const end = parseInt(weights[1]); for (let i = start; i <= end; i += 100) { result.push(i); } } else if (weights.length === 1) { result.push(parseInt(weights[0])); } }); return result; } /* * Format the font family to use in the CSS font-family property of a CSS rule. * * The input can be a string with the font family name or a string with multiple font family names separated by commas. * It follows the recommendations from the CSS Fonts Module Level 4. * https://www.w3.org/TR/css-fonts-4/#font-family-prop * * @param {string} input - The font family. * @return {string} The formatted font family. * * Example: * formatFontFamily( "Open Sans, Font+Name, sans-serif" ) => '"Open Sans", "Font+Name", sans-serif' * formatFontFamily( "'Open Sans', generic(kai), sans-serif" ) => '"Open Sans", sans-serif' * formatFontFamily( "DotGothic16, Slabo 27px, serif" ) => '"DotGothic16","Slabo 27px",serif' * formatFontFamily( "Mine's, Moe's Typography" ) => `"mine's","Moe's Typography"` */ function formatFontFamily(input) { // Matches strings that are not exclusively alphabetic characters or hyphens, and do not exactly follow the pattern generic(alphabetic characters or hyphens). const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/; const output = input.trim(); const formatItem = item => { item = item.trim(); if (item.match(regex)) { // removes leading and trailing quotes. item = item.replace(/^["']|["']$/g, ''); return `"${item}"`; } return item; }; if (output.includes(',')) { return output.split(',').map(formatItem).filter(item => item !== '').join(', '); } return formatItem(output); } /* * Format the font face name to use in the font-family property of a font face. * * The input can be a string with the font face name or a string with multiple font face names separated by commas. * It removes the leading and trailing quotes from the font face name. * * @param {string} input - The font face name. * @return {string} The formatted font face name. * * Example: * formatFontFaceName("Open Sans") => "Open Sans" * formatFontFaceName("'Open Sans', sans-serif") => "Open Sans" * formatFontFaceName(", 'Open Sans', 'Helvetica Neue', sans-serif") => "Open Sans" */ function formatFontFaceName(input) { if (!input) { return ''; } let output = input.trim(); if (output.includes(',')) { output = output.split(',') // finds the first item that is not an empty string. .find(item => item.trim() !== '').trim(); } // removes leading and trailing quotes. output = output.replace(/^["']|["']$/g, ''); // Firefox needs the font name to be wrapped in double quotes meanwhile other browsers don't. if (window.navigator.userAgent.toLowerCase().includes('firefox')) { output = `"${output}"`; } return output; } function getFamilyPreviewStyle(family) { const style = { fontFamily: formatFontFamily(family.fontFamily) }; if (!Array.isArray(family.fontFace)) { style.fontWeight = '400'; style.fontStyle = 'normal'; return style; } if (family.fontFace) { //get all the font faces with normal style const normalFaces = family.fontFace.filter(face => face?.fontStyle && face.fontStyle.toLowerCase() === 'normal'); if (normalFaces.length > 0) { style.fontStyle = 'normal'; const normalWeights = extractFontWeights(normalFaces); const nearestWeight = findNearest(400, normalWeights); style.fontWeight = String(nearestWeight) || '400'; } else { style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || 'normal'; style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || '400'; } } return style; } function getFacePreviewStyle(face) { return { fontFamily: formatFontFamily(face.fontFamily), fontStyle: face.fontStyle || 'normal', fontWeight: face.fontWeight || '400' }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js /** * * @param {string} variation The variation name. * * @return {string} The variation class name. */ function getVariationClassName(variation) { if (!variation) { return ''; } return `is-style-${variation}`; } /** * Iterates through the presets array and searches for slugs that start with the specified * slugPrefix followed by a numerical suffix. It identifies the highest numerical suffix found * and returns one greater than the highest found suffix, ensuring that the new index is unique. * * @param {Array} presets The array of preset objects, each potentially containing a slug property. * @param {string} slugPrefix The prefix to look for in the preset slugs. * * @return {number} The next available index for a preset with the specified slug prefix, or 1 if no matching slugs are found. */ function getNewIndexFromPresets(presets, slugPrefix) { const nameRegex = new RegExp(`^${slugPrefix}([\\d]+)$`); const highestPresetValue = presets.reduce((currentHighest, preset) => { if (typeof preset?.slug === 'string') { const matches = preset?.slug.match(nameRegex); if (matches) { const id = parseInt(matches[1], 10); if (id > currentHighest) { return id; } } } return currentHighest; }, 0); return highestPresetValue + 1; } function getFontFamilyFromSetting(fontFamilies, setting) { if (!Array.isArray(fontFamilies) || !setting) { return null; } const fontFamilyVariable = setting.replace('var(', '').replace(')', ''); const fontFamilySlug = fontFamilyVariable?.split('--').slice(-1)[0]; return fontFamilies.find(fontFamily => fontFamily.slug === fontFamilySlug); } function getFontFamilies(themeJson) { const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom; let fontFamilies = []; if (themeFontFamilies && customFontFamilies) { fontFamilies = [...themeFontFamilies, ...customFontFamilies]; } else if (themeFontFamilies) { fontFamilies = themeFontFamilies; } else if (customFontFamilies) { fontFamilies = customFontFamilies; } const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily; const bodyFontFamily = getFontFamilyFromSetting(fontFamilies, bodyFontFamilySetting); const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily; let headingFontFamily; if (!headingFontFamilySetting) { headingFontFamily = bodyFontFamily; } else { headingFontFamily = getFontFamilyFromSetting(fontFamilies, themeJson?.styles?.elements?.heading?.typography?.fontFamily); } return [bodyFontFamily, headingFontFamily]; } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-example.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: typography_example_useGlobalStyle, GlobalStylesContext: typography_example_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); function PreviewTypography({ fontSize, variation }) { const { base } = (0,external_wp_element_namespaceObject.useContext)(typography_example_GlobalStylesContext); let config = base; if (variation) { config = mergeBaseAndUserConfigs(base, variation); } const [textColor] = typography_example_useGlobalStyle('color.text'); const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config); const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {}; const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {}; if (textColor) { bodyPreviewStyle.color = textColor; headingPreviewStyle.color = textColor; } if (fontSize) { bodyPreviewStyle.fontSize = fontSize; headingPreviewStyle.fontSize = fontSize; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { animate: { scale: 1, opacity: 1 }, initial: { scale: 0.1, opacity: 0 }, transition: { delay: 0.3, type: 'tween' }, style: { textAlign: 'center', lineHeight: 1 }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: headingPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)('A', 'Uppercase letter A') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: bodyPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)('a', 'Lowercase letter A') })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/highlighted-colors.js /** * WordPress dependencies */ /** * Internal dependencies */ function HighlightedColors({ normalizedColorSwatchSize, ratio }) { const { highlightedColors } = useStylesPreviewColors(); const scaledSwatchSize = normalizedColorSwatchSize * ratio; return highlightedColors.map(({ slug, color }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { style: { height: scaledSwatchSize, width: scaledSwatchSize, background: color, borderRadius: scaledSwatchSize / 2 }, animate: { scale: 1, opacity: 1 }, initial: { scale: 0.1, opacity: 0 }, transition: { delay: index === 1 ? 0.2 : 0.1 } }, `${slug}-${index}`)); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-wrapper.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: preview_wrapper_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const normalizedWidth = 248; const normalizedHeight = 152; // Throttle options for useThrottle. Must be defined outside of the component, // so that the object reference is the same on each render. const THROTTLE_OPTIONS = { leading: true, trailing: true }; function PreviewWrapper({ children, label, isFocused, withHoverView }) { const [backgroundColor = 'white'] = preview_wrapper_useGlobalStyle('color.background'); const [gradientValue] = preview_wrapper_useGlobalStyle('color.gradient'); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); const [containerResizeListener, { width }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_namespaceObject.useState)(width); const [ratioState, setRatioState] = (0,external_wp_element_namespaceObject.useState)(); const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)(setThrottledWidthState, 250, THROTTLE_OPTIONS); // Must use useLayoutEffect to avoid a flash of the container at the wrong // size before the width is set. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (width) { setThrottledWidth(width); } }, [width, setThrottledWidth]); // Must use useLayoutEffect to avoid a flash of the container at the wrong // size before the width is set. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1; const ratioDiff = newRatio - (ratioState || 0); // Only update the ratio state if the difference is big enough // or if the ratio state is not yet set. This is to avoid an // endless loop of updates at particular viewport heights when the // presence of a scrollbar causes the width to change slightly. const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1; if (isRatioDiffBigEnough || !ratioState) { setRatioState(newRatio); } }, [throttledWidth, ratioState]); // Set a fallbackRatio to use before the throttled ratio has been set. const fallbackRatio = width ? width / normalizedWidth : 1; /* * Use the throttled ratio if it has been calculated, otherwise * use the fallback ratio. The throttled ratio is used to avoid * an endless loop of updates at particular viewport heights. * See: https://github.com/WordPress/gutenberg/issues/55112 */ const ratio = ratioState ? ratioState : fallbackRatio; const isReady = !!width; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { position: 'relative' }, children: containerResizeListener }), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-preview__wrapper", style: { height: normalizedHeight * ratio }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), tabIndex: -1, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { style: { height: normalizedHeight * ratio, width: '100%', background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, cursor: withHoverView ? 'pointer' : undefined }, initial: "start", animate: (isHovered || isFocused) && !disableMotion && label ? 'hover' : 'start', children: [].concat(children) // This makes sure children is always an array. .map((child, key) => child({ ratio, key })) }) })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-styles.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: preview_styles_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const firstFrameVariants = { start: { scale: 1, opacity: 1 }, hover: { scale: 0, opacity: 0 } }; const midFrameVariants = { hover: { opacity: 1 }, start: { opacity: 0.5 } }; const secondFrameVariants = { hover: { scale: 1, opacity: 1 }, start: { scale: 0, opacity: 0 } }; const PreviewStyles = ({ label, isFocused, withHoverView, variation }) => { const [fontWeight] = preview_styles_useGlobalStyle('typography.fontWeight'); const [fontFamily = 'serif'] = preview_styles_useGlobalStyle('typography.fontFamily'); const [headingFontFamily = fontFamily] = preview_styles_useGlobalStyle('elements.h1.typography.fontFamily'); const [headingFontWeight = fontWeight] = preview_styles_useGlobalStyle('elements.h1.typography.fontWeight'); const [textColor = 'black'] = preview_styles_useGlobalStyle('color.text'); const [headingColor = textColor] = preview_styles_useGlobalStyle('elements.h1.color.text'); const { paletteColors } = useStylesPreviewColors(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreviewWrapper, { label: label, isFocused: isFocused, withHoverView: withHoverView, children: [({ ratio, key }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: firstFrameVariants, style: { height: '100%', overflow: 'hidden' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 10 * ratio, justify: "center", style: { height: '100%', overflow: 'hidden' }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, { fontSize: 65 * ratio, variation: variation }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4 * ratio, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HighlightedColors, { normalizedColorSwatchSize: 32, ratio: ratio }) })] }) }, key), ({ key }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: withHoverView && midFrameVariants, style: { height: '100%', width: '100%', position: 'absolute', top: 0, overflow: 'hidden', filter: 'blur(60px)', opacity: 0.1 }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, justify: "flex-start", style: { height: '100%', overflow: 'hidden' }, children: paletteColors.slice(0, 4).map(({ color }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { height: '100%', background: color, flexGrow: 1 } }, index)) }) }, key), ({ ratio, key }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: secondFrameVariants, style: { height: '100%', width: '100%', overflow: 'hidden', position: 'absolute', top: 0 }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3 * ratio, justify: "center", style: { height: '100%', overflow: 'hidden', padding: 10 * ratio, boxSizing: 'border-box' }, children: label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { fontSize: 40 * ratio, fontFamily: headingFontFamily, color: headingColor, fontWeight: headingFontWeight, lineHeight: '1em', textAlign: 'center' }, children: label }) }) }, key)] }); }; /* harmony default export */ const preview_styles = (PreviewStyles); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: screen_root_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenRoot() { const [customCSS] = screen_root_useGlobalStyle('css'); const { hasVariations, canEditCSS } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, __experimentalGetCurrentGlobalStylesId, __experimentalGetCurrentThemeGlobalStylesVariations } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; return { hasVariations: !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length, canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { size: "small", isBorderless: true, className: "edit-site-global-styles-screen-root", isRounded: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { className: "edit-site-global-styles-screen-root__active-style-tile", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardMedia, { className: "edit-site-global-styles-screen-root__active-style-tile-preview", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, {}) }) }), hasVariations && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/variations", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)('Browse styles') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right })] }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(root_menu, {})] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { as: "p", paddingTop: 2 /* * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border). * This is an ad hoc override for this instance and the Additional CSS option below. Other options for matching the * the nav button inset should be looked at before reusing further. */, paddingX: "13px", marginBottom: 4, children: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks for the whole site.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/blocks", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)('Blocks') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right })] }) }) })] }), canEditCSS && !!customCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { as: "p", paddingTop: 2, paddingX: "13px", marginBottom: 4, children: (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/css", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right })] }) }) })] })] })] }); } /* harmony default export */ const screen_root = (ScreenRoot); ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: variations_panel_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); // Only core block styles (source === block) or block styles with a matching // theme.json style variation will be configurable via Global Styles. function getFilteredBlockStyles(blockStyles, variations) { return blockStyles?.filter(style => style.source === 'block' || variations.includes(style.name)); } function useBlockVariations(name) { const blockStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); return getBlockStyles(name); }, [name]); const [variations] = variations_panel_useGlobalStyle('variations', name); const variationNames = Object.keys(variations !== null && variations !== void 0 ? variations : {}); return getFilteredBlockStyles(blockStyles, variationNames); } function VariationsPanel({ name }) { const coreBlockStyles = useBlockVariations(name); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: coreBlockStyles.map((style, index) => { if (style?.isDefault) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(style.name), children: style.label }, index); }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js /** * WordPress dependencies */ function ScreenHeader({ title, description, onBack }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 0, paddingX: 4, paddingY: 3, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, size: "small", label: (0,external_wp_i18n_namespaceObject.__)('Back'), onClick: onBack }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { className: "edit-site-global-styles-header", level: 2, size: 13, children: title }) })] }) }) }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-header__description", children: description })] }); } /* harmony default export */ const header = (ScreenHeader); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHasDimensionsPanel: screen_block_list_useHasDimensionsPanel, useHasTypographyPanel: screen_block_list_useHasTypographyPanel, useHasBorderPanel, useGlobalSetting: screen_block_list_useGlobalSetting, useSettingsForBlockElement: screen_block_list_useSettingsForBlockElement, useHasColorPanel: screen_block_list_useHasColorPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function useSortedBlockTypes() { const blockItems = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []); // Ensure core blocks are prioritized in the returned results, // because third party blocks can be registered earlier than // the core blocks (usually by using the `init` action), // thus affecting the display order. // We don't sort reusable blocks as they are handled differently. const groupByType = (blocks, block) => { const { core, noncore } = blocks; const type = block.name.startsWith('core/') ? core : noncore; type.push(block); return blocks; }; const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(groupByType, { core: [], noncore: [] }); return [...coreItems, ...nonCoreItems]; } function useBlockHasGlobalStyles(blockName) { const [rawSettings] = screen_block_list_useGlobalSetting('', blockName); const settings = screen_block_list_useSettingsForBlockElement(rawSettings, blockName); const hasTypographyPanel = screen_block_list_useHasTypographyPanel(settings); const hasColorPanel = screen_block_list_useHasColorPanel(settings); const hasBorderPanel = useHasBorderPanel(settings); const hasDimensionsPanel = screen_block_list_useHasDimensionsPanel(settings); const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; const hasVariationsPanel = !!useBlockVariations(blockName)?.length; const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel; return hasGlobalStyles; } function BlockMenuItem({ block }) { const hasBlockMenuItem = useBlockHasGlobalStyles(block.name); if (!hasBlockMenuItem) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: '/blocks/' + encodeURIComponent(block.name), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: block.icon }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: block.title })] }) }); } function BlockList({ filterValue }) { const sortedBlockTypes = useSortedBlockTypes(); const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const { isMatchingSearchTerm } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter(blockType => isMatchingSearchTerm(blockType, filterValue)); const blockTypesListRef = (0,external_wp_element_namespaceObject.useRef)(); // Announce search results on change (0,external_wp_element_namespaceObject.useEffect)(() => { if (!filterValue) { return; } // We extract the results from the wrapper div's `ref` because // filtered items can contain items that will eventually not // render and there is no reliable way to detect when a child // will return `null`. // TODO: We should find a better way of handling this as it's // fragile and depends on the number of rendered elements of `BlockMenuItem`, // which is now one. // @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116 const count = blockTypesListRef.current.childElementCount; const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); debouncedSpeak(resultsFoundMessage, count); }, [filterValue, debouncedSpeak]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: blockTypesListRef, className: "edit-site-block-types-item-list" // By default, BlockMenuItem has a role=listitem so this div must have a list role. , role: "list", children: filteredBlockTypes.length === 0 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { align: "center", as: "p", children: (0,external_wp_i18n_namespaceObject.__)('No blocks found.') }) : filteredBlockTypes.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMenuItem, { block: block }, 'menu-itemblock-' + block.name)) }); } const MemoizedBlockList = (0,external_wp_element_namespaceObject.memo)(BlockList); function ScreenBlockList() { const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); const deferredFilterValue = (0,external_wp_element_namespaceObject.useDeferredValue)(filterValue); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('Blocks'), description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, className: "edit-site-block-types-search", onChange: setFilterValue, value: filterValue, label: (0,external_wp_i18n_namespaceObject.__)('Search'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { filterValue: deferredFilterValue })] }); } /* harmony default export */ const screen_block_list = (ScreenBlockList); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/block-preview-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const BlockPreviewPanel = ({ name, variation = '' }) => { var _blockExample$viewpor; const blockExample = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.example; const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!blockExample) { return null; } const example = { ...blockExample, attributes: { ...blockExample.attributes, style: undefined, className: variation ? getVariationClassName(variation) : blockExample.attributes?.className } }; return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example); }, [name, blockExample, variation]); const viewportWidth = (_blockExample$viewpor = blockExample?.viewportWidth) !== null && _blockExample$viewpor !== void 0 ? _blockExample$viewpor : 500; // Same as height of InserterPreviewPanel. const previewHeight = 144; const sidebarWidth = 235; const scale = sidebarWidth / viewportWidth; const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight; if (!blockExample) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles__block-preview-panel", style: { maxHeight: previewHeight, boxSizing: 'initial' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { blocks: blocks, viewportWidth: viewportWidth, minHeight: previewHeight, additionalStyles: //We want this CSS to be in sync with the one in InserterPreviewPanel. [{ css: ` body{ padding: 24px; min-height:${Math.round(minHeight)}px; display:flex; align-items:center; } .is-root-container { width: 100%; } ` }] }) }) }); }; /* harmony default export */ const block_preview_panel = (BlockPreviewPanel); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js /** * WordPress dependencies */ function Subtitle({ children, level }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { className: "edit-site-global-styles-subtitle", level: level !== null && level !== void 0 ? level : 2, children: children }); } /* harmony default export */ const subtitle = (Subtitle); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js /* wp:polyfill */ /** * WordPress dependencies */ /** * Internal dependencies */ // Initial control values. const BACKGROUND_BLOCK_DEFAULT_VALUES = { backgroundSize: 'cover', backgroundPosition: '50% 50%' // used only when backgroundSize is 'contain'. }; function applyFallbackStyle(border) { if (!border) { return border; } const hasColorOrWidth = border.color || border.width; if (!border.style && hasColorOrWidth) { return { ...border, style: 'solid' }; } if (border.style && !hasColorOrWidth) { return undefined; } return border; } function applyAllFallbackStyles(border) { if (!border) { return border; } if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border)) { return { top: applyFallbackStyle(border.top), right: applyFallbackStyle(border.right), bottom: applyFallbackStyle(border.bottom), left: applyFallbackStyle(border.left) }; } return applyFallbackStyle(border); } const { useHasDimensionsPanel: screen_block_useHasDimensionsPanel, useHasTypographyPanel: screen_block_useHasTypographyPanel, useHasBorderPanel: screen_block_useHasBorderPanel, useGlobalSetting: screen_block_useGlobalSetting, useSettingsForBlockElement: screen_block_useSettingsForBlockElement, useHasColorPanel: screen_block_useHasColorPanel, useHasFiltersPanel, useHasImageSettingsPanel, useGlobalStyle: screen_block_useGlobalStyle, useHasBackgroundPanel: screen_block_useHasBackgroundPanel, BackgroundPanel: StylesBackgroundPanel, BorderPanel: StylesBorderPanel, ColorPanel: StylesColorPanel, TypographyPanel: StylesTypographyPanel, DimensionsPanel: StylesDimensionsPanel, FiltersPanel: StylesFiltersPanel, ImageSettingsPanel, AdvancedPanel: StylesAdvancedPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenBlock({ name, variation }) { let prefixParts = []; if (variation) { prefixParts = ['variations', variation].concat(prefixParts); } const prefix = prefixParts.join('.'); const [style] = screen_block_useGlobalStyle(prefix, name, 'user', { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = screen_block_useGlobalStyle(prefix, name, 'all', { shouldDecodeEncode: false }); const [userSettings] = screen_block_useGlobalSetting('', name, 'user'); const [rawSettings, setSettings] = screen_block_useGlobalSetting('', name); const settingsForBlockElement = screen_block_useSettingsForBlockElement(rawSettings, name); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); // Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied. let disableBlockGap = false; if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(spacingType => spacingType === 'blockGap'))) { disableBlockGap = true; } // Only allow `aspectRatio` support if the block is not the grouping block. // The grouping block allows the user to use Group, Row and Stack variations, // and it is highly likely that the user will not want to set an aspect ratio // for all three at once. Until there is the ability to set a different aspect // ratio for each variation, we disable the aspect ratio controls for the // grouping block in global styles. let disableAspectRatio = false; if (settingsForBlockElement?.dimensions?.aspectRatio && name === 'core/group') { disableAspectRatio = true; } const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { const updatedSettings = structuredClone(settingsForBlockElement); if (disableBlockGap) { updatedSettings.spacing.blockGap = false; } if (disableAspectRatio) { updatedSettings.dimensions.aspectRatio = false; } return updatedSettings; }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]); const blockVariations = useBlockVariations(name); const hasBackgroundPanel = screen_block_useHasBackgroundPanel(settings); const hasTypographyPanel = screen_block_useHasTypographyPanel(settings); const hasColorPanel = screen_block_useHasColorPanel(settings); const hasBorderPanel = screen_block_useHasBorderPanel(settings); const hasDimensionsPanel = screen_block_useHasDimensionsPanel(settings); const hasFiltersPanel = useHasFiltersPanel(settings); const hasImageSettingsPanel = useHasImageSettingsPanel(name, userSettings, settings); const hasVariationsPanel = !!blockVariations?.length && !variation; const { canEditCSS } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; return { canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] }; }, []); const currentBlockStyle = variation ? blockVariations.find(s => s.name === variation) : null; // These intermediary objects are needed because the "layout" property is stored // in settings rather than styles. const inheritedStyleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { return { ...inheritedStyle, layout: settings.layout }; }, [inheritedStyle, settings.layout]); const styleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { return { ...style, layout: userSettings.layout }; }, [style, userSettings.layout]); const onChangeDimensions = newStyle => { const updatedStyle = { ...newStyle }; delete updatedStyle.layout; setStyle(updatedStyle); if (newStyle.layout !== userSettings.layout) { setSettings({ ...userSettings, layout: newStyle.layout }); } }; const onChangeLightbox = newSetting => { // If the newSetting is undefined, this means that the user has deselected // (reset) the lightbox setting. if (newSetting === undefined) { setSettings({ ...rawSettings, lightbox: undefined }); // Otherwise, we simply set the lightbox setting to the new value but // taking care of not overriding the other lightbox settings. } else { setSettings({ ...rawSettings, lightbox: { ...rawSettings.lightbox, ...newSetting } }); } }; const onChangeBorders = newStyle => { if (!newStyle?.border) { setStyle(newStyle); return; } // As Global Styles can't conditionally generate styles based on if // other style properties have been set, we need to force split // border definitions for user set global border styles. Border // radius is derived from the same property i.e. `border.radius` if // it is a string that is used. The longhand border radii styles are // only generated if that property is an object. // // For borders (color, style, and width) those are all properties on // the `border` style property. This means if the theme.json defined // split borders and the user condenses them into a flat border or // vice-versa we'd get both sets of styles which would conflict. const { radius, ...newBorder } = newStyle.border; const border = applyAllFallbackStyles(newBorder); const updatedBorder = !(0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border) ? { top: border, right: border, bottom: border, left: border } : { color: null, style: null, width: null, ...border }; setStyle({ ...newStyle, border: { ...updatedBorder, radius } }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: variation ? currentBlockStyle?.label : blockType.title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_panel, { name: name, variation: variation }), hasVariationsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-variations", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { children: (0,external_wp_i18n_namespaceObject.__)('Style Variations') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(VariationsPanel, { name: name })] }) }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesColorPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings: settings }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBackgroundPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings: settings, defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES }), hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesTypographyPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings: settings }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesDimensionsPanel, { inheritedValue: inheritedStyleWithLayout, value: styleWithLayout, onChange: onChangeDimensions, settings: settings, includeLayoutControls: true }), hasBorderPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBorderPanel, { inheritedValue: inheritedStyle, value: style, onChange: onChangeBorders, settings: settings }), hasFiltersPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesFiltersPanel, { inheritedValue: inheritedStyleWithLayout, value: styleWithLayout, onChange: setStyle, settings: settings, includeLayoutControls: true }), hasImageSettingsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageSettingsPanel, { onChange: onChangeLightbox, value: userSettings, inheritedValue: settings }), canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Advanced'), initialOpen: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: is the name of a block e.g., 'Image' or 'Table'. (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'), blockType?.title) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesAdvancedPanel, { value: style, onChange: setStyle, inheritedValue: inheritedStyle })] })] }); } /* harmony default export */ const screen_block = (ScreenBlock); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-elements.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: typography_elements_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ElementItem({ parentMenu, element, label }) { var _ref; const prefix = element === 'text' || !element ? '' : `elements.${element}.`; const extraStyles = element === 'link' ? { textDecoration: 'underline' } : {}; const [fontFamily] = typography_elements_useGlobalStyle(prefix + 'typography.fontFamily'); const [fontStyle] = typography_elements_useGlobalStyle(prefix + 'typography.fontStyle'); const [fontWeight] = typography_elements_useGlobalStyle(prefix + 'typography.fontWeight'); const [backgroundColor] = typography_elements_useGlobalStyle(prefix + 'color.background'); const [fallbackBackgroundColor] = typography_elements_useGlobalStyle('color.background'); const [gradientValue] = typography_elements_useGlobalStyle(prefix + 'color.gradient'); const [color] = typography_elements_useGlobalStyle(prefix + 'color.text'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: parentMenu + '/typography/' + element, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles-screen-typography__indicator", style: { fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor, color, fontStyle, fontWeight, ...extraStyles }, "aria-hidden": "true", children: (0,external_wp_i18n_namespaceObject.__)('Aa') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: label })] }) }); } function TypographyElements() { const parentMenu = ''; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)('Elements') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { parentMenu: parentMenu, element: "text", label: (0,external_wp_i18n_namespaceObject.__)('Text') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { parentMenu: parentMenu, element: "link", label: (0,external_wp_i18n_namespaceObject.__)('Links') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { parentMenu: parentMenu, element: "heading", label: (0,external_wp_i18n_namespaceObject.__)('Headings') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { parentMenu: parentMenu, element: "caption", label: (0,external_wp_i18n_namespaceObject.__)('Captions') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { parentMenu: parentMenu, element: "button", label: (0,external_wp_i18n_namespaceObject.__)('Buttons') })] })] }); } /* harmony default export */ const typography_elements = (TypographyElements); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-typography.js /** * WordPress dependencies */ /** * Internal dependencies */ const StylesPreviewTypography = ({ variation, isFocused, withHoverView }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewWrapper, { label: variation.title, isFocused: isFocused, withHoverView: withHoverView, children: ({ ratio, key }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 10 * ratio, justify: "center", style: { height: '100%', overflow: 'hidden' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, { variation: variation, fontSize: 85 * ratio }) }, key) }); }; /* harmony default export */ const preview_typography = (StylesPreviewTypography); ;// ./node_modules/@wordpress/edit-site/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js /* wp:polyfill */ /** * WordPress dependencies */ /** * Internal dependencies */ const use_theme_style_variations_by_property_EMPTY_ARRAY = []; const { GlobalStylesContext: use_theme_style_variations_by_property_GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { mergeBaseAndUserConfigs: use_theme_style_variations_by_property_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); /** * Removes all instances of properties from an object. * * @param {Object} object The object to remove the properties from. * @param {string[]} properties The properties to remove. * @return {Object} The modified object. */ function removePropertiesFromObject(object, properties) { if (!properties?.length) { return object; } if (typeof object !== 'object' || !object || !Object.keys(object).length) { return object; } for (const key in object) { if (properties.includes(key)) { delete object[key]; } else if (typeof object[key] === 'object') { removePropertiesFromObject(object[key], properties); } } return object; } /** * Checks whether a style variation is empty. * * @param {Object} variation A style variation object. * @param {string} variation.title The title of the variation. * @param {Object} variation.settings The settings of the variation. * @param {Object} variation.styles The styles of the variation. * @return {boolean} Whether the variation is empty. */ function hasThemeVariation({ title, settings, styles }) { return title === (0,external_wp_i18n_namespaceObject.__)('Default') || // Always preserve the default variation. Object.keys(settings).length > 0 || Object.keys(styles).length > 0; } /** * Fetches the current theme style variations that contain only the specified properties * and merges them with the user config. * * @param {string[]} properties The properties to filter by. * @return {Object[]|*} The merged object. */ function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) { const { variationsFromTheme } = (0,external_wp_data_namespaceObject.useSelect)(select => { const _variationsFromTheme = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations(); return { variationsFromTheme: _variationsFromTheme || use_theme_style_variations_by_property_EMPTY_ARRAY }; }, []); const { user: userVariation } = (0,external_wp_element_namespaceObject.useContext)(use_theme_style_variations_by_property_GlobalStylesContext); const propertiesAsString = properties.toString(); return (0,external_wp_element_namespaceObject.useMemo)(() => { const clonedUserVariation = structuredClone(userVariation); // Get user variation and remove the settings for the given property. const userVariationWithoutProperties = removePropertiesFromObject(clonedUserVariation, properties); userVariationWithoutProperties.title = (0,external_wp_i18n_namespaceObject.__)('Default'); const variationsWithPropertiesAndBase = variationsFromTheme.filter(variation => { return isVariationWithProperties(variation, properties); }).map(variation => { return use_theme_style_variations_by_property_mergeBaseAndUserConfigs(userVariationWithoutProperties, variation); }); const variationsByProperties = [userVariationWithoutProperties, ...variationsWithPropertiesAndBase]; /* * Filter out variations with no settings or styles. */ return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : []; }, [propertiesAsString, userVariation, variationsFromTheme]); } /** * Returns a new object, with properties specified in `properties` array., * maintain the original object tree structure. * The function is recursive, so it will perform a deep search for the given properties. * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`. * * @param {Object} object The object to filter * @param {string[]} properties The properties to filter by * @return {Object} The merged object. */ const filterObjectByProperties = (object, properties) => { if (!object || !properties?.length) { return {}; } const newObject = {}; Object.keys(object).forEach(key => { if (properties.includes(key)) { newObject[key] = object[key]; } else if (typeof object[key] === 'object') { const newFilter = filterObjectByProperties(object[key], properties); if (Object.keys(newFilter).length) { newObject[key] = newFilter; } } }); return newObject; }; /** * Compares a style variation to the same variation filtered by the specified properties. * Returns true if the variation contains only the properties specified. * * @param {Object} variation The variation to compare. * @param {string[]} properties The properties to compare. * @return {boolean} Whether the variation contains only the specified properties. */ function isVariationWithProperties(variation, properties) { const variationWithProperties = filterObjectByProperties(structuredClone(variation), properties); return areGlobalStyleConfigsEqual(variationWithProperties, variation); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variation.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { mergeBaseAndUserConfigs: variation_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); const { GlobalStylesContext: variation_GlobalStylesContext, areGlobalStyleConfigsEqual: variation_areGlobalStyleConfigsEqual } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function Variation({ variation, children, isPill, properties, showTooltip }) { const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); const { base, user, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(variation_GlobalStylesContext); const context = (0,external_wp_element_namespaceObject.useMemo)(() => { let merged = variation_mergeBaseAndUserConfigs(base, variation); if (properties) { merged = filterObjectByProperties(merged, properties); } return { user: variation, base, merged, setUserConfig: () => {} }; }, [variation, base, properties]); const selectVariation = () => setUserConfig(variation); const selectOnEnter = event => { if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { event.preventDefault(); selectVariation(); } }; const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => variation_areGlobalStyleConfigsEqual(user, variation), [user, variation]); let label = variation?.title; if (variation?.description) { label = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: variation title. 2: variation description. */ (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'variation label'), variation?.title, variation?.description); } const content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('edit-site-global-styles-variations_item', { 'is-active': isActive }), role: "button", onClick: selectVariation, onKeyDown: selectOnEnter, tabIndex: "0", "aria-label": label, "aria-current": isActive, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('edit-site-global-styles-variations_item-preview', { 'is-pill': isPill }), children: children(isFocused) }) }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(variation_GlobalStylesContext.Provider, { value: context, children: showTooltip ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: variation?.title, children: content }) : content }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-typography.js /** * WordPress dependencies */ /** * Internal dependencies */ function TypographyVariations({ title, gap = 2 }) { const propertiesToFilter = ['typography']; const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); // Return null if there is only one variation (the default). if (typographyVariations?.length <= 1) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 3, gap: gap, className: "edit-site-global-styles-style-variations-container", children: typographyVariations.map((variation, index) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { variation: variation, properties: propertiesToFilter, showTooltip: true, children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_typography, { variation: variation }) }, index); }) })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes-count.js /** * WordPress dependencies */ /** * Internal dependencies */ function FontSizes() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)('Font Sizes') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/typography/font-sizes", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { direction: "row", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)('Font size presets') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right })] }) }) })] }); } /* harmony default export */ const font_sizes_count = (FontSizes); ;// ./node_modules/@wordpress/icons/build-module/library/settings.js /** * WordPress dependencies */ const settings_settings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" })] }); /* harmony default export */ const library_settings = (settings_settings); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/resolvers.js /** * WordPress dependencies */ const FONT_FAMILIES_URL = '/wp/v2/font-families'; const FONT_COLLECTIONS_URL = '/wp/v2/font-collections'; async function fetchInstallFontFamily(data) { const config = { path: FONT_FAMILIES_URL, method: 'POST', body: data }; const response = await external_wp_apiFetch_default()(config); return { id: response.id, ...response.font_family_settings, fontFace: [] }; } async function fetchInstallFontFace(fontFamilyId, data) { const config = { path: `${FONT_FAMILIES_URL}/${fontFamilyId}/font-faces`, method: 'POST', body: data }; const response = await external_wp_apiFetch_default()(config); return { id: response.id, ...response.font_face_settings }; } async function fetchGetFontFamilyBySlug(slug) { const config = { path: `${FONT_FAMILIES_URL}?slug=${slug}&_embed=true`, method: 'GET' }; const response = await external_wp_apiFetch_default()(config); if (!response || response.length === 0) { return null; } const fontFamilyPost = response[0]; return { id: fontFamilyPost.id, ...fontFamilyPost.font_family_settings, fontFace: fontFamilyPost?._embedded?.font_faces.map(face => face.font_face_settings) || [] }; } async function fetchUninstallFontFamily(fontFamilyId) { const config = { path: `${FONT_FAMILIES_URL}/${fontFamilyId}?force=true`, method: 'DELETE' }; return await external_wp_apiFetch_default()(config); } async function fetchFontCollections() { const config = { path: `${FONT_COLLECTIONS_URL}?_fields=slug,name,description`, method: 'GET' }; return await external_wp_apiFetch_default()(config); } async function fetchFontCollection(id) { const config = { path: `${FONT_COLLECTIONS_URL}/${id}`, method: 'GET' }; return await external_wp_apiFetch_default()(config); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/constants.js /** * WordPress dependencies */ const ALLOWED_FILE_EXTENSIONS = ['otf', 'ttf', 'woff', 'woff2']; const FONT_WEIGHTS = { 100: (0,external_wp_i18n_namespaceObject._x)('Thin', 'font weight'), 200: (0,external_wp_i18n_namespaceObject._x)('Extra-light', 'font weight'), 300: (0,external_wp_i18n_namespaceObject._x)('Light', 'font weight'), 400: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font weight'), 500: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font weight'), 600: (0,external_wp_i18n_namespaceObject._x)('Semi-bold', 'font weight'), 700: (0,external_wp_i18n_namespaceObject._x)('Bold', 'font weight'), 800: (0,external_wp_i18n_namespaceObject._x)('Extra-bold', 'font weight'), 900: (0,external_wp_i18n_namespaceObject._x)('Black', 'font weight') }; const FONT_STYLES = { normal: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font style'), italic: (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style') }; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Browser dependencies */ const { File } = window; const { kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function setUIValuesNeeded(font, extraValues = {}) { if (!font.name && (font.fontFamily || font.slug)) { font.name = font.fontFamily || font.slug; } return { ...font, ...extraValues }; } function isUrlEncoded(url) { if (typeof url !== 'string') { return false; } return url !== decodeURIComponent(url); } function getFontFaceVariantName(face) { const weightName = FONT_WEIGHTS[face.fontWeight] || face.fontWeight; const styleName = face.fontStyle === 'normal' ? '' : FONT_STYLES[face.fontStyle] || face.fontStyle; return `${weightName} ${styleName}`; } function mergeFontFaces(existing = [], incoming = []) { const map = new Map(); for (const face of existing) { map.set(`${face.fontWeight}${face.fontStyle}`, face); } for (const face of incoming) { // This will overwrite if the src already exists, keeping it unique. map.set(`${face.fontWeight}${face.fontStyle}`, face); } return Array.from(map.values()); } function mergeFontFamilies(existing = [], incoming = []) { const map = new Map(); // Add the existing array to the map. for (const font of existing) { map.set(font.slug, { ...font }); } // Add the incoming array to the map, overwriting existing values excepting fontFace that need to be merged. for (const font of incoming) { if (map.has(font.slug)) { const { fontFace: incomingFontFaces, ...restIncoming } = font; const existingFont = map.get(font.slug); // Merge the fontFaces existing with the incoming fontFaces. const mergedFontFaces = mergeFontFaces(existingFont.fontFace, incomingFontFaces); // Except for the fontFace key all the other keys are overwritten with the incoming values. map.set(font.slug, { ...restIncoming, fontFace: mergedFontFaces }); } else { map.set(font.slug, { ...font }); } } return Array.from(map.values()); } /* * Loads the font face from a URL and adds it to the browser. * It also adds it to the iframe document. */ async function loadFontFaceInBrowser(fontFace, source, addTo = 'all') { let dataSource; if (typeof source === 'string') { dataSource = `url(${source})`; // eslint-disable-next-line no-undef } else if (source instanceof File) { dataSource = await source.arrayBuffer(); } else { return; } const newFont = new window.FontFace(formatFontFaceName(fontFace.fontFamily), dataSource, { style: fontFace.fontStyle, weight: fontFace.fontWeight }); const loadedFace = await newFont.load(); if (addTo === 'document' || addTo === 'all') { document.fonts.add(loadedFace); } if (addTo === 'iframe' || addTo === 'all') { const iframeDocument = document.querySelector('iframe[name="editor-canvas"]').contentDocument; iframeDocument.fonts.add(loadedFace); } } /* * Unloads the font face and remove it from the browser. * It also removes it from the iframe document. * * Note that Font faces that were added to the set using the CSS @font-face rule * remain connected to the corresponding CSS, and cannot be deleted. * * @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete. */ function unloadFontFaceInBrowser(fontFace, removeFrom = 'all') { const unloadFontFace = fonts => { fonts.forEach(f => { if (f.family === formatFontFaceName(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) { fonts.delete(f); } }); }; if (removeFrom === 'document' || removeFrom === 'all') { unloadFontFace(document.fonts); } if (removeFrom === 'iframe' || removeFrom === 'all') { const iframeDocument = document.querySelector('iframe[name="editor-canvas"]').contentDocument; unloadFontFace(iframeDocument.fonts); } } /** * Retrieves the display source from a font face src. * * @param {string|string[]} input - The font face src. * @return {string|undefined} The display source or undefined if the input is invalid. */ function getDisplaySrcFromFontFace(input) { if (!input) { return; } let src; if (Array.isArray(input)) { src = input[0]; } else { src = input; } // It's expected theme fonts will already be loaded in the browser. if (src.startsWith('file:.')) { return; } if (!isUrlEncoded(src)) { src = encodeURI(src); } return src; } function makeFontFamilyFormData(fontFamily) { const formData = new FormData(); const { fontFace, category, ...familyWithValidParameters } = fontFamily; const fontFamilySettings = { ...familyWithValidParameters, slug: kebabCase(fontFamily.slug) }; formData.append('font_family_settings', JSON.stringify(fontFamilySettings)); return formData; } function makeFontFacesFormData(font) { if (font?.fontFace) { const fontFacesFormData = font.fontFace.map((item, faceIndex) => { const face = { ...item }; const formData = new FormData(); if (face.file) { // Normalize to an array, since face.file may be a single file or an array of files. const files = Array.isArray(face.file) ? face.file : [face.file]; const src = []; files.forEach((file, key) => { // Slugified file name because the it might contain spaces or characters treated differently on the server. const fileId = `file-${faceIndex}-${key}`; // Add the files to the formData formData.append(fileId, file, file.name); src.push(fileId); }); face.src = src.length === 1 ? src[0] : src; delete face.file; formData.append('font_face_settings', JSON.stringify(face)); } else { formData.append('font_face_settings', JSON.stringify(face)); } return formData; }); return fontFacesFormData; } } async function batchInstallFontFaces(fontFamilyId, fontFacesData) { const responses = []; /* * Uses the same response format as Promise.allSettled, but executes requests in sequence to work * around a race condition that can cause an error when the fonts directory doesn't exist yet. */ for (const faceData of fontFacesData) { try { const response = await fetchInstallFontFace(fontFamilyId, faceData); responses.push({ status: 'fulfilled', value: response }); } catch (error) { responses.push({ status: 'rejected', reason: error }); } } const results = { errors: [], successes: [] }; responses.forEach((result, index) => { if (result.status === 'fulfilled') { const response = result.value; if (response.id) { results.successes.push(response); } else { results.errors.push({ data: fontFacesData[index], message: `Error: ${response.message}` }); } } else { // Handle network errors or other fetch-related errors results.errors.push({ data: fontFacesData[index], message: result.reason.message }); } }); return results; } /* * Downloads a font face asset from a URL to the client and returns a File object. */ async function downloadFontFaceAssets(src) { // Normalize to an array, since `src` could be a string or array. src = Array.isArray(src) ? src : [src]; const files = await Promise.all(src.map(async url => { return fetch(new Request(url)).then(response => { if (!response.ok) { throw new Error(`Error downloading font face asset from ${url}. Server responded with status: ${response.status}`); } return response.blob(); }).then(blob => { const filename = url.split('/').pop(); const file = new File([blob], filename, { type: blob.type }); return file; }); })); // If we only have one file return it (not the array). Otherwise return all of them in the array. return files.length === 1 ? files[0] : files; } /* * Determine if a given Font Face is present in a given collection. * We determine that a font face has been installed by comparing the fontWeight and fontStyle * * @param {Object} fontFace The Font Face to seek * @param {Array} collection The Collection to seek in * @returns True if the font face is found in the collection. Otherwise False. */ function checkFontFaceInstalled(fontFace, collection) { return -1 !== collection.findIndex(collectionFontFace => { return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle; }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/toggleFont.js /** * Toggles the activation of a given font or font variant within a list of custom fonts. * * - If only the font is provided (without face), the entire font family's activation is toggled. * - If both font and face are provided, the activation of the specific font variant is toggled. * * @param {Object} font - The font to be toggled. * @param {string} font.slug - The unique identifier for the font. * @param {Array} [font.fontFace] - The list of font variants (faces) associated with the font. * * @param {Object} [face] - The specific font variant to be toggled. * @param {string} face.fontWeight - The weight of the font variant. * @param {string} face.fontStyle - The style of the font variant. * * @param {Array} initialfonts - The initial list of custom fonts. * * @return {Array} - The updated list of custom fonts with the font/font variant toggled. * * @example * const customFonts = [ * { slug: 'roboto', fontFace: [{ fontWeight: '400', fontStyle: 'normal' }] } * ]; * * toggleFont({ slug: 'roboto' }, null, customFonts); * // This will remove 'roboto' from customFonts * * toggleFont({ slug: 'roboto' }, { fontWeight: '400', fontStyle: 'normal' }, customFonts); * // This will remove the specified face from 'roboto' in customFonts * * toggleFont({ slug: 'roboto' }, { fontWeight: '500', fontStyle: 'normal' }, customFonts); * // This will add the specified face to 'roboto' in customFonts */ function toggleFont(font, face, initialfonts) { // Helper to check if a font is activated based on its slug const isFontActivated = f => f.slug === font.slug; // Helper to get the activated font from a list of fonts const getActivatedFont = fonts => fonts.find(isFontActivated); // Toggle the activation status of an entire font family const toggleEntireFontFamily = activatedFont => { if (!activatedFont) { // If the font is not active, activate the entire font family return [...initialfonts, font]; } // If the font is already active, deactivate the entire font family return initialfonts.filter(f => !isFontActivated(f)); }; // Toggle the activation status of a specific font variant const toggleFontVariant = activatedFont => { const isFaceActivated = f => f.fontWeight === face.fontWeight && f.fontStyle === face.fontStyle; if (!activatedFont) { // If the font family is not active, activate the font family with the font variant return [...initialfonts, { ...font, fontFace: [face] }]; } let newFontFaces = activatedFont.fontFace || []; if (newFontFaces.find(isFaceActivated)) { // If the font variant is active, deactivate it newFontFaces = newFontFaces.filter(f => !isFaceActivated(f)); } else { // If the font variant is not active, activate it newFontFaces = [...newFontFaces, face]; } // If there are no more font faces, deactivate the font family if (newFontFaces.length === 0) { return initialfonts.filter(f => !isFontActivated(f)); } // Return updated fonts list with toggled font variant return initialfonts.map(f => isFontActivated(f) ? { ...f, fontFace: newFontFaces } : f); }; const activatedFont = getActivatedFont(initialfonts); if (!face) { return toggleEntireFontFamily(activatedFont); } return toggleFontVariant(activatedFont); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalSetting: context_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const FontLibraryContext = (0,external_wp_element_namespaceObject.createContext)({}); function FontLibraryProvider({ children }) { const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { globalStylesId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); return { globalStylesId: __experimentalGetCurrentGlobalStylesId() }; }); const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId); const [isInstalling, setIsInstalling] = (0,external_wp_element_namespaceObject.useState)(false); const [refreshKey, setRefreshKey] = (0,external_wp_element_namespaceObject.useState)(0); const refreshLibrary = () => { setRefreshKey(Date.now()); }; const { records: libraryPosts = [], isResolving: isResolvingLibrary } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'wp_font_family', { refreshKey, _embed: true }); const libraryFonts = (libraryPosts || []).map(fontFamilyPost => { return { id: fontFamilyPost.id, ...fontFamilyPost.font_family_settings, fontFace: fontFamilyPost?._embedded?.font_faces.map(face => face.font_face_settings) || [] }; }) || []; // Global Styles (settings) font families const [fontFamilies, setFontFamilies] = context_useGlobalSetting('typography.fontFamilies'); /* * Save the font families to the database. * This function is called when the user activates or deactivates a font family. * It only updates the global styles post content in the database for new font families. * This avoids saving other styles/settings changed by the user using other parts of the editor. * * It uses the font families from the param to avoid using the font families from an outdated state. * * @param {Array} fonts - The font families that will be saved to the database. */ const saveFontFamilies = async fonts => { // Gets the global styles database post content. const updatedGlobalStyles = globalStyles.record; // Updates the database version of global styles with the edited font families in the client. setNestedValue(updatedGlobalStyles, ['settings', 'typography', 'fontFamilies'], fonts); // Saves a new version of the global styles in the database. await saveEntityRecord('root', 'globalStyles', updatedGlobalStyles); }; // Library Fonts const [modalTabOpen, setModalTabOpen] = (0,external_wp_element_namespaceObject.useState)(false); const [libraryFontSelected, setLibraryFontSelected] = (0,external_wp_element_namespaceObject.useState)(null); // Themes Fonts are the fonts defined in the global styles (database persisted theme.json data). const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, { source: 'theme' })).sort((a, b) => a.name.localeCompare(b.name)) : []; const customFonts = fontFamilies?.custom ? fontFamilies.custom.map(f => setUIValuesNeeded(f, { source: 'custom' })).sort((a, b) => a.name.localeCompare(b.name)) : []; const baseCustomFonts = libraryFonts ? libraryFonts.map(f => setUIValuesNeeded(f, { source: 'custom' })).sort((a, b) => a.name.localeCompare(b.name)) : []; (0,external_wp_element_namespaceObject.useEffect)(() => { if (!modalTabOpen) { setLibraryFontSelected(null); } }, [modalTabOpen]); const handleSetLibraryFontSelected = font => { // If font is null, reset the selected font if (!font) { setLibraryFontSelected(null); return; } const fonts = font.source === 'theme' ? themeFonts : baseCustomFonts; // Tries to find the font in the installed fonts const fontSelected = fonts.find(f => f.slug === font.slug); // If the font is not found (it is only defined in custom styles), use the font from custom styles setLibraryFontSelected({ ...(fontSelected || font), source: font.source }); }; // Demo const [loadedFontUrls] = (0,external_wp_element_namespaceObject.useState)(new Set()); const getAvailableFontsOutline = availableFontFamilies => { const outline = availableFontFamilies.reduce((acc, font) => { const availableFontFaces = font?.fontFace && font.fontFace?.length > 0 ? font?.fontFace.map(face => `${face.fontStyle + face.fontWeight}`) : ['normal400']; // If the font doesn't have fontFace, we assume it is a system font and we add the defaults: normal 400 acc[font.slug] = availableFontFaces; return acc; }, {}); return outline; }; const getActivatedFontsOutline = source => { switch (source) { case 'theme': return getAvailableFontsOutline(themeFonts); case 'custom': default: return getAvailableFontsOutline(customFonts); } }; const isFontActivated = (slug, style, weight, source) => { if (!style && !weight) { return !!getActivatedFontsOutline(source)[slug]; } return !!getActivatedFontsOutline(source)[slug]?.includes(style + weight); }; const getFontFacesActivated = (slug, source) => { return getActivatedFontsOutline(source)[slug] || []; }; async function installFonts(fontFamiliesToInstall) { setIsInstalling(true); try { const fontFamiliesToActivate = []; let installationErrors = []; for (const fontFamilyToInstall of fontFamiliesToInstall) { let isANewFontFamily = false; // Get the font family if it already exists. let installedFontFamily = await fetchGetFontFamilyBySlug(fontFamilyToInstall.slug); // Otherwise create it. if (!installedFontFamily) { isANewFontFamily = true; // Prepare font family form data to install. installedFontFamily = await fetchInstallFontFamily(makeFontFamilyFormData(fontFamilyToInstall)); } // Collect font faces that have already been installed (to be activated later) const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter(fontFaceToInstall => checkFontFaceInstalled(fontFaceToInstall, fontFamilyToInstall.fontFace)) : []; // Filter out Font Faces that have already been installed (so that they are not re-installed) if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) { fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter(fontFaceToInstall => !checkFontFaceInstalled(fontFaceToInstall, installedFontFamily.fontFace)); } // Install the fonts (upload the font files to the server and create the post in the database). let successfullyInstalledFontFaces = []; let unsuccessfullyInstalledFontFaces = []; if (fontFamilyToInstall?.fontFace?.length > 0) { const response = await batchInstallFontFaces(installedFontFamily.id, makeFontFacesFormData(fontFamilyToInstall)); successfullyInstalledFontFaces = response?.successes; unsuccessfullyInstalledFontFaces = response?.errors; } // Use the successfully installed font faces // As well as any font faces that were already installed (those will be activated) if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) { // Use font data from REST API not from client to ensure // correct font information is used. installedFontFamily.fontFace = [...successfullyInstalledFontFaces]; fontFamiliesToActivate.push(installedFontFamily); } // If it's a system font but was installed successfully, activate it. if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) { fontFamiliesToActivate.push(installedFontFamily); } // If the font family is new and is not a system font, delete it to avoid having font families without font faces. if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && successfullyInstalledFontFaces?.length === 0) { await fetchUninstallFontFamily(installedFontFamily.id); } installationErrors = installationErrors.concat(unsuccessfullyInstalledFontFaces); } installationErrors = installationErrors.reduce((unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], []); if (fontFamiliesToActivate.length > 0) { // Activate the font family (add the font family to the global styles). const activeFonts = activateCustomFontFamilies(fontFamiliesToActivate); // Save the global styles to the database. await saveFontFamilies(activeFonts); refreshLibrary(); } if (installationErrors.length > 0) { const installError = new Error((0,external_wp_i18n_namespaceObject.__)('There was an error installing fonts.')); installError.installationErrors = installationErrors; throw installError; } } finally { setIsInstalling(false); } } async function uninstallFontFamily(fontFamilyToUninstall) { try { // Uninstall the font family. // (Removes the font files from the server and the posts from the database). const uninstalledFontFamily = await fetchUninstallFontFamily(fontFamilyToUninstall.id); // Deactivate the font family if delete request is successful // (Removes the font family from the global styles). if (uninstalledFontFamily.deleted) { const activeFonts = deactivateFontFamily(fontFamilyToUninstall); // Save the global styles to the database. await saveFontFamilies(activeFonts); } // Refresh the library (the library font families from database). refreshLibrary(); return uninstalledFontFamily; } catch (error) { // eslint-disable-next-line no-console console.error(`There was an error uninstalling the font family:`, error); throw error; } } const deactivateFontFamily = font => { var _fontFamilies$font$so; // If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts // We want to save as active all the theme fonts at the beginning const initialCustomFonts = (_fontFamilies$font$so = fontFamilies?.[font.source]) !== null && _fontFamilies$font$so !== void 0 ? _fontFamilies$font$so : []; const newCustomFonts = initialCustomFonts.filter(f => f.slug !== font.slug); const activeFonts = { ...fontFamilies, [font.source]: newCustomFonts }; setFontFamilies(activeFonts); if (font.fontFace) { font.fontFace.forEach(face => { unloadFontFaceInBrowser(face, 'all'); }); } return activeFonts; }; const activateCustomFontFamilies = fontsToAdd => { const fontsToActivate = cleanFontsForSave(fontsToAdd); const activeFonts = { ...fontFamilies, // Merge the existing custom fonts with the new fonts. custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate) }; // Activate the fonts by set the new custom fonts array. setFontFamilies(activeFonts); loadFontsInBrowser(fontsToActivate); return activeFonts; }; // Removes the id from the families and faces to avoid saving that to global styles post content. const cleanFontsForSave = fonts => { return fonts.map(({ id: _familyDbId, fontFace, ...font }) => ({ ...font, ...(fontFace && fontFace.length > 0 ? { fontFace: fontFace.map(({ id: _faceDbId, ...face }) => face) } : {}) })); }; const loadFontsInBrowser = fonts => { // Add custom fonts to the browser. fonts.forEach(font => { if (font.fontFace) { font.fontFace.forEach(face => { // Load font faces just in the iframe because they already are in the document. loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face.src), 'all'); }); } }); }; const toggleActivateFont = (font, face) => { var _fontFamilies$font$so2; // If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts // We want to save as active all the theme fonts at the beginning const initialFonts = (_fontFamilies$font$so2 = fontFamilies?.[font.source]) !== null && _fontFamilies$font$so2 !== void 0 ? _fontFamilies$font$so2 : []; // Toggles the received font family or font face const newFonts = toggleFont(font, face, initialFonts); // Updates the font families activated in global settings: setFontFamilies({ ...fontFamilies, [font.source]: newFonts }); const isFaceActivated = isFontActivated(font.slug, face?.fontStyle, face?.fontWeight, font.source); if (isFaceActivated) { unloadFontFaceInBrowser(face, 'all'); } else { loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face?.src), 'all'); } }; const loadFontFaceAsset = async fontFace => { // If the font doesn't have a src, don't load it. if (!fontFace.src) { return; } // Get the src of the font. const src = getDisplaySrcFromFontFace(fontFace.src); // If the font is already loaded, don't load it again. if (!src || loadedFontUrls.has(src)) { return; } // Load the font in the browser. loadFontFaceInBrowser(fontFace, src, 'document'); // Add the font to the loaded fonts list. loadedFontUrls.add(src); }; // Font Collections const [collections, setFontCollections] = (0,external_wp_element_namespaceObject.useState)([]); const getFontCollections = async () => { const response = await fetchFontCollections(); setFontCollections(response); }; const getFontCollection = async slug => { try { const hasData = !!collections.find(collection => collection.slug === slug)?.font_families; if (hasData) { return; } const response = await fetchFontCollection(slug); const updatedCollections = collections.map(collection => collection.slug === slug ? { ...collection, ...response } : collection); setFontCollections(updatedCollections); } catch (e) { // eslint-disable-next-line no-console console.error(e); throw e; } }; (0,external_wp_element_namespaceObject.useEffect)(() => { getFontCollections(); }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontLibraryContext.Provider, { value: { libraryFontSelected, handleSetLibraryFontSelected, fontFamilies, baseCustomFonts, isFontActivated, getFontFacesActivated, loadFontFaceAsset, installFonts, uninstallFontFamily, toggleActivateFont, getAvailableFontsOutline, modalTabOpen, setModalTabOpen, refreshLibrary, saveFontFamilies, isResolvingLibrary, isInstalling, collections, getFontCollection }, children: children }); } /* harmony default export */ const context = (FontLibraryProvider); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js /** * WordPress dependencies */ /** * Internal dependencies */ function getPreviewUrl(fontFace) { if (fontFace.preview) { return fontFace.preview; } if (fontFace.src) { return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src; } } function getDisplayFontFace(font) { // if this IS a font face return it if (font.fontStyle || font.fontWeight) { return font; } // if this is a font family with a collection of font faces // return the first one that is normal and 400 OR just the first one if (font.fontFace && font.fontFace.length) { return font.fontFace.find(face => face.fontStyle === 'normal' && face.fontWeight === '400') || font.fontFace[0]; } // This must be a font family with no font faces // return a fake font face return { fontStyle: 'normal', fontWeight: '400', fontFamily: font.fontFamily, fake: true }; } function FontDemo({ font, text }) { const ref = (0,external_wp_element_namespaceObject.useRef)(null); const fontFace = getDisplayFontFace(font); const style = getFamilyPreviewStyle(font); text = text || font.name; const customPreviewUrl = font.preview; const [isIntersecting, setIsIntersecting] = (0,external_wp_element_namespaceObject.useState)(false); const [isAssetLoaded, setIsAssetLoaded] = (0,external_wp_element_namespaceObject.useState)(false); const { loadFontFaceAsset } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); const previewUrl = customPreviewUrl !== null && customPreviewUrl !== void 0 ? customPreviewUrl : getPreviewUrl(fontFace); const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i); const faceStyles = getFacePreviewStyle(fontFace); const textDemoStyle = { fontSize: '18px', lineHeight: 1, opacity: isAssetLoaded ? '1' : '0', ...style, ...faceStyles }; (0,external_wp_element_namespaceObject.useEffect)(() => { const observer = new window.IntersectionObserver(([entry]) => { setIsIntersecting(entry.isIntersecting); }, {}); observer.observe(ref.current); return () => observer.disconnect(); }, [ref]); (0,external_wp_element_namespaceObject.useEffect)(() => { const loadAsset = async () => { if (isIntersecting) { if (!isPreviewImage && fontFace.src) { await loadFontFaceAsset(fontFace); } setIsAssetLoaded(true); } }; loadAsset(); }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, children: isPreviewImage ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: previewUrl, loading: "lazy", alt: text, className: "font-library-modal__font-variant_demo-image" }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { style: textDemoStyle, className: "font-library-modal__font-variant_demo-text", children: text }) }); } /* harmony default export */ const font_demo = (FontDemo); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-card.js /** * WordPress dependencies */ /** * Internal dependencies */ function FontCard({ font, onClick, variantsText, navigatorPath }) { const variantsCount = font.fontFace?.length || 1; const style = { cursor: !!onClick ? 'pointer' : 'default' }; const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: () => { onClick(); if (navigatorPath) { navigator.goTo(navigatorPath); } }, style: style, className: "font-library-modal__font-card", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "space-between", wrap: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { font: font }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-end", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "font-library-modal__font-card__count", children: variantsText || (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of font variants. */ (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right }) })] })] }) }); } /* harmony default export */ const font_card = (FontCard); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/library-font-variant.js /** * WordPress dependencies */ /** * Internal dependencies */ function LibraryFontVariant({ face, font }) { const { isFontActivated, toggleActivateFont } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); const isInstalled = font?.fontFace?.length > 0 ? isFontActivated(font.slug, face.fontStyle, face.fontWeight, font.source) : isFontActivated(font.slug, null, null, font.source); const handleToggleActivation = () => { if (font?.fontFace?.length > 0) { toggleActivateFont(font, face); return; } toggleActivateFont(font); }; const displayName = font.name + ' ' + getFontFaceVariantName(face); const checkboxId = (0,external_wp_element_namespaceObject.useId)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__font-card", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { checked: isInstalled, onChange: handleToggleActivation, __nextHasNoMarginBottom: true, id: checkboxId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { font: face, text: displayName, onClick: handleToggleActivation }) })] }) }); } /* harmony default export */ const library_font_variant = (LibraryFontVariant); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js function getNumericFontWeight(value) { switch (value) { case 'normal': return 400; case 'bold': return 700; case 'bolder': return 500; case 'lighter': return 300; default: return parseInt(value, 10); } } function sortFontFaces(faces) { return faces.sort((a, b) => { // Ensure 'normal' fontStyle is always first if (a.fontStyle === 'normal' && b.fontStyle !== 'normal') { return -1; } if (b.fontStyle === 'normal' && a.fontStyle !== 'normal') { return 1; } // If both fontStyles are the same, sort by fontWeight if (a.fontStyle === b.fontStyle) { return getNumericFontWeight(a.fontWeight) - getNumericFontWeight(b.fontWeight); } // Sort other fontStyles alphabetically return a.fontStyle.localeCompare(b.fontStyle); }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/installed-fonts.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalSetting: installed_fonts_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function InstalledFonts() { var _libraryFontSelected$; const { baseCustomFonts, libraryFontSelected, handleSetLibraryFontSelected, refreshLibrary, uninstallFontFamily, isResolvingLibrary, isInstalling, saveFontFamilies, getFontFacesActivated } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); const [fontFamilies, setFontFamilies] = installed_fonts_useGlobalSetting('typography.fontFamilies'); const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_namespaceObject.useState)(false); const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); const [baseFontFamilies] = installed_fonts_useGlobalSetting('typography.fontFamilies', undefined, 'base'); const globalStylesId = (0,external_wp_data_namespaceObject.useSelect)(select => { const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); return __experimentalGetCurrentGlobalStylesId(); }); const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId); const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies; const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, { source: 'theme' })).sort((a, b) => a.name.localeCompare(b.name)) : []; const themeFontsSlugs = new Set(themeFonts.map(f => f.slug)); const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(baseFontFamilies.theme.filter(f => !themeFontsSlugs.has(f.slug)).map(f => setUIValuesNeeded(f, { source: 'theme' })).sort((a, b) => a.name.localeCompare(b.name))) : []; const customFontFamilyId = libraryFontSelected?.source === 'custom' && libraryFontSelected?.id; const canUserDelete = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canUser } = select(external_wp_coreData_namespaceObject.store); return customFontFamilyId && canUser('delete', { kind: 'postType', name: 'wp_font_family', id: customFontFamilyId }); }, [customFontFamilyId]); const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== 'theme' && canUserDelete; const handleUninstallClick = () => { setIsConfirmDeleteOpen(true); }; const handleUpdate = async () => { setNotice(null); try { await saveFontFamilies(fontFamilies); setNotice({ type: 'success', message: (0,external_wp_i18n_namespaceObject.__)('Font family updated successfully.') }); } catch (error) { setNotice({ type: 'error', message: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message */ (0,external_wp_i18n_namespaceObject.__)('There was an error updating the font family. %s'), error.message) }); } }; const getFontFacesToDisplay = font => { if (!font) { return []; } if (!font.fontFace || !font.fontFace.length) { return [{ fontFamily: font.fontFamily, fontStyle: 'normal', fontWeight: '400' }]; } return sortFontFaces(font.fontFace); }; const getFontCardVariantsText = font => { const variantsInstalled = font?.fontFace?.length > 0 ? font.fontFace.length : 1; const variantsActive = getFontFacesActivated(font.slug, font.source).length; return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Active font variants, 2: Total font variants. */ (0,external_wp_i18n_namespaceObject.__)('%1$s/%2$s variants active'), variantsActive, variantsInstalled); }; (0,external_wp_element_namespaceObject.useEffect)(() => { handleSetLibraryFontSelected(libraryFontSelected); refreshLibrary(); }, []); // Get activated fonts count. const activeFontsCount = libraryFontSelected ? getFontFacesActivated(libraryFontSelected.slug, libraryFontSelected.source).length : 0; const selectedFontsCount = (_libraryFontSelected$ = libraryFontSelected?.fontFace?.length) !== null && _libraryFontSelected$ !== void 0 ? _libraryFontSelected$ : libraryFontSelected?.fontFamily ? 1 : 0; // Check if any fonts are selected. const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount; // Check if all fonts are selected. const isSelectAllChecked = activeFontsCount === selectedFontsCount; // Toggle select all fonts. const toggleSelectAll = () => { var _fontFamilies$library; const initialFonts = (_fontFamilies$library = fontFamilies?.[libraryFontSelected.source]?.filter(f => f.slug !== libraryFontSelected.slug)) !== null && _fontFamilies$library !== void 0 ? _fontFamilies$library : []; const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected]; setFontFamilies({ ...fontFamilies, [libraryFontSelected.source]: newFonts }); if (libraryFontSelected.fontFace) { libraryFontSelected.fontFace.forEach(face => { if (isSelectAllChecked) { unloadFontFaceInBrowser(face, 'all'); } else { loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face?.src), 'all'); } }); } }; const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__loading", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }), !isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { initialPath: libraryFontSelected ? '/fontFamily' : '/', children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "8", children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: notice.type, onRemove: () => setNotice(null), children: notice.message }), !hasFonts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)('No fonts installed.') }), baseThemeFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "font-library-modal__fonts-title", children: /* translators: Heading for a list of fonts provided by the theme. */ (0,external_wp_i18n_namespaceObject._x)('Theme', 'font source') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { role: "list", className: "font-library-modal__fonts-list", children: baseThemeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "font-library-modal__fonts-list-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { font: font, navigatorPath: "/fontFamily", variantsText: getFontCardVariantsText(font), onClick: () => { setNotice(null); handleSetLibraryFontSelected(font); } }) }, font.slug)) })] }), baseCustomFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "font-library-modal__fonts-title", children: /* translators: Heading for a list of fonts installed by the user. */ (0,external_wp_i18n_namespaceObject._x)('Custom', 'font source') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { role: "list", className: "font-library-modal__fonts-list", children: baseCustomFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "font-library-modal__fonts-list-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { font: font, navigatorPath: "/fontFamily", variantsText: getFontCardVariantsText(font), onClick: () => { setNotice(null); handleSetLibraryFontSelected(font); } }) }, font.slug)) })] })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConfirmDeleteDialog, { font: libraryFontSelected, isOpen: isConfirmDeleteOpen, setIsOpen: setIsConfirmDeleteOpen, setNotice: setNotice, uninstallFontFamily: uninstallFontFamily, handleSetLibraryFontSelected: handleSetLibraryFontSelected }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, size: "small", onClick: () => { handleSetLibraryFontSelected(null); setNotice(null); }, label: (0,external_wp_i18n_namespaceObject.__)('Back') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, className: "edit-site-global-styles-header", children: libraryFontSelected?.name })] }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: notice.type, onRemove: () => setNotice(null), children: notice.message }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('Choose font variants. Keep in mind that too many variants could make your site slower.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { className: "font-library-modal__select-all", label: (0,external_wp_i18n_namespaceObject.__)('Select all'), checked: isSelectAllChecked, onChange: toggleSelectAll, indeterminate: isIndeterminate, __nextHasNoMarginBottom: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 8 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { role: "list", className: "font-library-modal__fonts-list", children: getFontFacesToDisplay(libraryFontSelected).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "font-library-modal__fonts-list-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(library_font_variant, { font: libraryFontSelected, face: face }, `face${i}`) }, `face${i}`)) })] })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-end", className: "font-library-modal__footer", children: [isInstalling && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}), shouldDisplayDeleteButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, isDestructive: true, variant: "tertiary", onClick: handleUninstallClick, children: (0,external_wp_i18n_namespaceObject.__)('Delete') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: handleUpdate, disabled: !fontFamiliesHasChanges, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Update') })] })] })] }); } function ConfirmDeleteDialog({ font, isOpen, setIsOpen, setNotice, uninstallFontFamily, handleSetLibraryFontSelected }) { const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); const handleConfirmUninstall = async () => { setNotice(null); setIsOpen(false); try { await uninstallFontFamily(font); navigator.goBack(); handleSetLibraryFontSelected(null); setNotice({ type: 'success', message: (0,external_wp_i18n_namespaceObject.__)('Font family uninstalled successfully.') }); } catch (error) { setNotice({ type: 'error', message: (0,external_wp_i18n_namespaceObject.__)('There was an error uninstalling the font family.') + error.message }); } }; const handleCancelUninstall = () => { setIsOpen(false); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: isOpen, cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), onCancel: handleCancelUninstall, onConfirm: handleConfirmUninstall, size: "medium", children: font && (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the font. */ (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font and all its variants and assets?'), font.name) }); } /* harmony default export */ const installed_fonts = (InstalledFonts); ;// ./node_modules/@wordpress/icons/build-module/library/next.js /** * WordPress dependencies */ const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) }); /* harmony default export */ const library_next = (next); ;// ./node_modules/@wordpress/icons/build-module/library/previous.js /** * WordPress dependencies */ const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) }); /* harmony default export */ const library_previous = (previous); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js /** * Filters a list of fonts based on the specified filters. * * This function filters a given array of fonts based on the criteria provided in the filters object. * It supports filtering by category and a search term. If the category is provided and not equal to 'all', * the function filters the fonts array to include only those fonts that belong to the specified category. * Additionally, if a search term is provided, it filters the fonts array to include only those fonts * whose name includes the search term, case-insensitively. * * @param {Array} fonts Array of font objects in font-collection schema fashion to be filtered. Each font object should have a 'categories' property and a 'font_family_settings' property with a 'name' key. * @param {Object} filters Object containing the filter criteria. It should have a 'category' key and/or a 'search' key. * The 'category' key is a string representing the category to filter by. * The 'search' key is a string representing the search term to filter by. * @return {Array} Array of filtered font objects based on the provided criteria. */ function filterFonts(fonts, filters) { const { category, search } = filters; let filteredFonts = fonts || []; if (category && category !== 'all') { filteredFonts = filteredFonts.filter(font => font.categories.indexOf(category) !== -1); } if (search) { filteredFonts = filteredFonts.filter(font => font.font_family_settings.name.toLowerCase().includes(search.toLowerCase())); } return filteredFonts; } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js function getFontsOutline(fonts) { return fonts.reduce((acc, font) => ({ ...acc, [font.slug]: (font?.fontFace || []).reduce((faces, face) => ({ ...faces, [`${face.fontStyle}-${face.fontWeight}`]: true }), {}) }), {}); } function isFontFontFaceInOutline(slug, face, outline) { if (!face) { return !!outline[slug]; } return !!outline[slug]?.[`${face.fontStyle}-${face.fontWeight}`]; } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js /** * WordPress dependencies */ function GoogleFontsConfirmDialog() { const handleConfirm = () => { // eslint-disable-next-line no-undef window.localStorage.setItem('wp-font-library-google-fonts-permission', 'true'); window.dispatchEvent(new Event('storage')); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library__google-fonts-confirm", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, children: (0,external_wp_i18n_namespaceObject.__)('Connect to Google Fonts') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)('To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)('You can alternatively upload files directly on the Upload tab.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: handleConfirm, children: (0,external_wp_i18n_namespaceObject.__)('Allow access to Google Fonts') })] }) }) }); } /* harmony default export */ const google_fonts_confirm_dialog = (GoogleFontsConfirmDialog); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/collection-font-variant.js /** * WordPress dependencies */ /** * Internal dependencies */ function CollectionFontVariant({ face, font, handleToggleVariant, selected }) { const handleToggleActivation = () => { if (font?.fontFace) { handleToggleVariant(font, face); return; } handleToggleVariant(font); }; const displayName = font.name + ' ' + getFontFaceVariantName(face); const checkboxId = (0,external_wp_element_namespaceObject.useId)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__font-card", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { checked: selected, onChange: handleToggleActivation, __nextHasNoMarginBottom: true, id: checkboxId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { font: face, text: displayName, onClick: handleToggleActivation }) })] }) }); } /* harmony default export */ const collection_font_variant = (CollectionFontVariant); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-collection.js /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_CATEGORY = { slug: 'all', name: (0,external_wp_i18n_namespaceObject._x)('All', 'font categories') }; const LOCAL_STORAGE_ITEM = 'wp-font-library-google-fonts-permission'; const MIN_WINDOW_HEIGHT = 500; function FontCollection({ slug }) { var _selectedCollection$c; const requiresPermission = slug === 'google-fonts'; const getGoogleFontsPermissionFromStorage = () => { return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === 'true'; }; const [selectedFont, setSelectedFont] = (0,external_wp_element_namespaceObject.useState)(null); const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_namespaceObject.useState)([]); const [page, setPage] = (0,external_wp_element_namespaceObject.useState)(1); const [filters, setFilters] = (0,external_wp_element_namespaceObject.useState)({}); const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(requiresPermission && !getGoogleFontsPermissionFromStorage()); const { collections, getFontCollection, installFonts, isInstalling } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); const selectedCollection = collections.find(collection => collection.slug === slug); (0,external_wp_element_namespaceObject.useEffect)(() => { const handleStorage = () => { setRenderConfirmDialog(requiresPermission && !getGoogleFontsPermissionFromStorage()); }; handleStorage(); window.addEventListener('storage', handleStorage); return () => window.removeEventListener('storage', handleStorage); }, [slug, requiresPermission]); const revokeAccess = () => { window.localStorage.setItem(LOCAL_STORAGE_ITEM, 'false'); window.dispatchEvent(new Event('storage')); }; (0,external_wp_element_namespaceObject.useEffect)(() => { const fetchFontCollection = async () => { try { await getFontCollection(slug); resetFilters(); } catch (e) { if (!notice) { setNotice({ type: 'error', message: e?.message }); } } }; fetchFontCollection(); }, [slug, getFontCollection, setNotice, notice]); (0,external_wp_element_namespaceObject.useEffect)(() => { setSelectedFont(null); }, [slug]); (0,external_wp_element_namespaceObject.useEffect)(() => { // If the selected fonts change, reset the selected fonts to install setFontsToInstall([]); }, [selectedFont]); const collectionFonts = (0,external_wp_element_namespaceObject.useMemo)(() => { var _selectedCollection$f; return (_selectedCollection$f = selectedCollection?.font_families) !== null && _selectedCollection$f !== void 0 ? _selectedCollection$f : []; }, [selectedCollection]); const collectionCategories = (_selectedCollection$c = selectedCollection?.categories) !== null && _selectedCollection$c !== void 0 ? _selectedCollection$c : []; const categories = [DEFAULT_CATEGORY, ...collectionCategories]; const fonts = (0,external_wp_element_namespaceObject.useMemo)(() => filterFonts(collectionFonts, filters), [collectionFonts, filters]); const isLoading = !selectedCollection?.font_families && !notice; // NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px // The height of each font family item is 61px. const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT); const pageSize = Math.floor((windowHeight - 417) / 61); const totalPages = Math.ceil(fonts.length / pageSize); const itemsStart = (page - 1) * pageSize; const itemsLimit = page * pageSize; const items = fonts.slice(itemsStart, itemsLimit); const handleCategoryFilter = category => { setFilters({ ...filters, category }); setPage(1); }; const handleUpdateSearchInput = value => { setFilters({ ...filters, search: value }); setPage(1); }; const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300); const resetFilters = () => { setFilters({}); setPage(1); }; const handleToggleVariant = (font, face) => { const newFontsToInstall = toggleFont(font, face, fontsToInstall); setFontsToInstall(newFontsToInstall); }; const fontToInstallOutline = getFontsOutline(fontsToInstall); const resetFontsToInstall = () => { setFontsToInstall([]); }; const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length : 0; // Check if any fonts are selected. const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length; // Check if all fonts are selected. const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length; // Toggle select all fonts. const toggleSelectAll = () => { const newFonts = isSelectAllChecked ? [] : [selectedFont]; setFontsToInstall(newFonts); }; const handleInstall = async () => { setNotice(null); const fontFamily = fontsToInstall[0]; try { if (fontFamily?.fontFace) { await Promise.all(fontFamily.fontFace.map(async fontFace => { if (fontFace.src) { fontFace.file = await downloadFontFaceAssets(fontFace.src); } })); } } catch (error) { // If any of the fonts fail to download, // show an error notice and stop the request from being sent. setNotice({ type: 'error', message: (0,external_wp_i18n_namespaceObject.__)('Error installing the fonts, could not be downloaded.') }); return; } try { await installFonts([fontFamily]); setNotice({ type: 'success', message: (0,external_wp_i18n_namespaceObject.__)('Fonts were installed successfully.') }); } catch (error) { setNotice({ type: 'error', message: error.message }); } resetFontsToInstall(); }; const getSortedFontFaces = fontFamily => { if (!fontFamily) { return []; } if (!fontFamily.fontFace || !fontFamily.fontFace.length) { return [{ fontFamily: fontFamily.fontFamily, fontStyle: 'normal', fontWeight: '400' }]; } return sortFontFaces(fontFamily.fontFace); }; if (renderConfirmDialog) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(google_fonts_confirm_dialog, {}); } const ActionsComponent = () => { if (slug !== 'google-fonts' || renderConfirmDialog || selectedFont) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Actions'), popoverProps: { position: 'bottom left' }, controls: [{ title: (0,external_wp_i18n_namespaceObject.__)('Revoke access to Google Fonts'), onClick: revokeAccess }] }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__loading", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { initialPath: "/", className: "font-library-modal__tabpanel-layout", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: selectedCollection.name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: selectedCollection.description })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsComponent, {})] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { className: "font-library-modal__search", value: filters.search, placeholder: (0,external_wp_i18n_namespaceObject.__)('Font name…'), label: (0,external_wp_i18n_namespaceObject.__)('Search'), onChange: debouncedUpdateSearchInput, __nextHasNoMarginBottom: true, hideLabelFromVision: false }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Category'), value: filters.category, onChange: handleCategoryFilter, children: categories && categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("option", { value: category.slug, children: category.name }, category.slug)) }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), !!selectedCollection?.font_families?.length && !fonts.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('No fonts found. Try with a different search term') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__fonts-grid__main", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { role: "list", className: "font-library-modal__fonts-list", children: items.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "font-library-modal__fonts-list-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { font: font.font_family_settings, navigatorPath: "/fontFamily", onClick: () => { setSelectedFont(font.font_family_settings); } }) }, font.font_family_settings.slug)) }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, size: "small", onClick: () => { setSelectedFont(null); setNotice(null); }, label: (0,external_wp_i18n_namespaceObject.__)('Back') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, className: "edit-site-global-styles-header", children: selectedFont?.name })] }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: notice.type, onRemove: () => setNotice(null), children: notice.message }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('Select font variants to install.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { className: "font-library-modal__select-all", label: (0,external_wp_i18n_namespaceObject.__)('Select all'), checked: isSelectAllChecked, onChange: toggleSelectAll, indeterminate: isIndeterminate, __nextHasNoMarginBottom: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { role: "list", className: "font-library-modal__fonts-list", children: getSortedFontFaces(selectedFont).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "font-library-modal__fonts-list-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(collection_font_variant, { font: selectedFont, face: face, handleToggleVariant: handleToggleVariant, selected: isFontFontFaceInOutline(selectedFont.slug, selectedFont.fontFace ? face : null, // If the font has no fontFace, we want to check if the font is in the outline fontToInstallOutline) }) }, `face${i}`)) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 16 })] })] }), selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { justify: "flex-end", className: "font-library-modal__footer", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: handleInstall, isBusy: isInstalling, disabled: fontsToInstall.length === 0 || isInstalling, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Install') }) }), !selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, className: "font-library-modal__footer", justify: "end", spacing: 6, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", expanded: false, spacing: 1, className: "font-library-modal__page-selection", children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Current page number, 2: Total number of pages. (0,external_wp_i18n_namespaceObject._x)('<div>Page</div>%1$s<div>of %2$s</div>', 'paging'), '<CurrentPage />', totalPages), { div: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": true }), CurrentPage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'), value: page, options: [...Array(totalPages)].map((e, i) => { return { label: i + 1, value: i + 1 }; }), onChange: newPage => setPage(parseInt(newPage)), size: "small", __nextHasNoMarginBottom: true, variant: "minimal" }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: () => setPage(page - 1), disabled: page === 1, accessibleWhenDisabled: true, label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, showTooltip: true, size: "compact", tooltipPosition: "top" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: () => setPage(page + 1), disabled: page === totalPages, accessibleWhenDisabled: true, label: (0,external_wp_i18n_namespaceObject.__)('Next page'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, showTooltip: true, size: "compact", tooltipPosition: "top" })] })] })] })] }); } /* harmony default export */ const font_collection = (FontCollection); // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/unbrotli.js var unbrotli = __webpack_require__(8572); var unbrotli_default = /*#__PURE__*/__webpack_require__.n(unbrotli); // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/inflate.js var inflate = __webpack_require__(4660); var inflate_default = /*#__PURE__*/__webpack_require__.n(inflate); ;// ./node_modules/@wordpress/edit-site/lib/lib-font.browser.js /** * Credits: * * lib-font * https://github.com/Pomax/lib-font * https://github.com/Pomax/lib-font/blob/master/lib-font.browser.js * * The MIT License (MIT) * * Copyright (c) 2020 pomax@nihongoresources.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* eslint eslint-comments/no-unlimited-disable: 0 */ /* eslint-disable */ // import pako from 'pako'; let fetchFunction = globalThis.fetch; // if ( ! fetchFunction ) { // let backlog = []; // fetchFunction = globalThis.fetch = ( ...args ) => // new Promise( ( resolve, reject ) => { // backlog.push( { args: args, resolve: resolve, reject: reject } ); // } ); // import( 'fs' ) // .then( ( fs ) => { // fetchFunction = globalThis.fetch = async function ( path ) { // return new Promise( ( resolve, reject ) => { // fs.readFile( path, ( err, data ) => { // if ( err ) return reject( err ); // resolve( { ok: true, arrayBuffer: () => data.buffer } ); // } ); // } ); // }; // while ( backlog.length ) { // let instruction = backlog.shift(); // fetchFunction( ...instruction.args ) // .then( ( data ) => instruction.resolve( data ) ) // .catch( ( err ) => instruction.reject( err ) ); // } // } ) // .catch( ( err ) => { // console.error( err ); // throw new Error( // `lib-font cannot run unless either the Fetch API or Node's filesystem module is available.` // ); // } ); // } class lib_font_browser_Event { constructor( type, detail = {}, msg ) { this.type = type; this.detail = detail; this.msg = msg; Object.defineProperty( this, `__mayPropagate`, { enumerable: false, writable: true, } ); this.__mayPropagate = true; } preventDefault() {} stopPropagation() { this.__mayPropagate = false; } valueOf() { return this; } toString() { return this.msg ? `[${ this.type } event]: ${ this.msg }` : `[${ this.type } event]`; } } class EventManager { constructor() { this.listeners = {}; } addEventListener( type, listener, useCapture ) { let bin = this.listeners[ type ] || []; if ( useCapture ) bin.unshift( listener ); else bin.push( listener ); this.listeners[ type ] = bin; } removeEventListener( type, listener ) { let bin = this.listeners[ type ] || []; let pos = bin.findIndex( ( e ) => e === listener ); if ( pos > -1 ) { bin.splice( pos, 1 ); this.listeners[ type ] = bin; } } dispatch( event ) { let bin = this.listeners[ event.type ]; if ( bin ) { for ( let l = 0, e = bin.length; l < e; l++ ) { if ( ! event.__mayPropagate ) break; bin[ l ]( event ); } } } } const startDate = new Date( `1904-01-01T00:00:00+0000` ).getTime(); function asText( data ) { return Array.from( data ) .map( ( v ) => String.fromCharCode( v ) ) .join( `` ); } class Parser { constructor( dict, dataview, name ) { this.name = ( name || dict.tag || `` ).trim(); this.length = dict.length; this.start = dict.offset; this.offset = 0; this.data = dataview; [ `getInt8`, `getUint8`, `getInt16`, `getUint16`, `getInt32`, `getUint32`, `getBigInt64`, `getBigUint64`, ].forEach( ( name ) => { let fn = name.replace( /get(Big)?/, '' ).toLowerCase(); let increment = parseInt( name.replace( /[^\d]/g, '' ) ) / 8; Object.defineProperty( this, fn, { get: () => this.getValue( name, increment ), } ); } ); } get currentPosition() { return this.start + this.offset; } set currentPosition( position ) { this.start = position; this.offset = 0; } skip( n = 0, bits = 8 ) { this.offset += ( n * bits ) / 8; } getValue( type, increment ) { let pos = this.start + this.offset; this.offset += increment; try { return this.data[ type ]( pos ); } catch ( e ) { console.error( `parser`, type, increment, this ); console.error( `parser`, this.start, this.offset ); throw e; } } flags( n ) { if ( n === 8 || n === 16 || n === 32 || n === 64 ) { return this[ `uint${ n }` ] .toString( 2 ) .padStart( n, 0 ) .split( `` ) .map( ( v ) => v === '1' ); } console.error( `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long` ); console.trace(); } get tag() { const t = this.uint32; return asText( [ ( t >> 24 ) & 255, ( t >> 16 ) & 255, ( t >> 8 ) & 255, t & 255, ] ); } get fixed() { let major = this.int16; let minor = Math.round( ( 1e3 * this.uint16 ) / 65356 ); return major + minor / 1e3; } get legacyFixed() { let major = this.uint16; let minor = this.uint16.toString( 16 ).padStart( 4, 0 ); return parseFloat( `${ major }.${ minor }` ); } get uint24() { return ( this.uint8 << 16 ) + ( this.uint8 << 8 ) + this.uint8; } get uint128() { let value = 0; for ( let i = 0; i < 5; i++ ) { let byte = this.uint8; value = value * 128 + ( byte & 127 ); if ( byte < 128 ) break; } return value; } get longdatetime() { return new Date( startDate + 1e3 * parseInt( this.int64.toString() ) ); } get fword() { return this.int16; } get ufword() { return this.uint16; } get Offset16() { return this.uint16; } get Offset32() { return this.uint32; } get F2DOT14() { const bits = p.uint16; const integer = [ 0, 1, -2, -1 ][ bits >> 14 ]; const fraction = bits & 16383; return integer + fraction / 16384; } verifyLength() { if ( this.offset != this.length ) { console.error( `unexpected parsed table size (${ this.offset }) for "${ this.name }" (expected ${ this.length })` ); } } readBytes( n = 0, position = 0, bits = 8, signed = false ) { n = n || this.length; if ( n === 0 ) return []; if ( position ) this.currentPosition = position; const fn = `${ signed ? `` : `u` }int${ bits }`, slice = []; while ( n-- ) slice.push( this[ fn ] ); return slice; } } class ParsedData { constructor( parser ) { const pGetter = { enumerable: false, get: () => parser }; Object.defineProperty( this, `parser`, pGetter ); const start = parser.currentPosition; const startGetter = { enumerable: false, get: () => start }; Object.defineProperty( this, `start`, startGetter ); } load( struct ) { Object.keys( struct ).forEach( ( p ) => { let props = Object.getOwnPropertyDescriptor( struct, p ); if ( props.get ) { this[ p ] = props.get.bind( this ); } else if ( props.value !== undefined ) { this[ p ] = props.value; } } ); if ( this.parser.length ) { this.parser.verifyLength(); } } } class SimpleTable extends ParsedData { constructor( dict, dataview, name ) { const { parser: parser, start: start } = super( new Parser( dict, dataview, name ) ); const pGetter = { enumerable: false, get: () => parser }; Object.defineProperty( this, `p`, pGetter ); const startGetter = { enumerable: false, get: () => start }; Object.defineProperty( this, `tableStart`, startGetter ); } } function lazy$1( object, property, getter ) { let val; Object.defineProperty( object, property, { get: () => { if ( val ) return val; val = getter(); return val; }, enumerable: true, } ); } class SFNT extends SimpleTable { constructor( font, dataview, createTable ) { const { p: p } = super( { offset: 0, length: 12 }, dataview, `sfnt` ); this.version = p.uint32; this.numTables = p.uint16; this.searchRange = p.uint16; this.entrySelector = p.uint16; this.rangeShift = p.uint16; p.verifyLength(); this.directory = [ ...new Array( this.numTables ) ].map( ( _ ) => new TableRecord( p ) ); this.tables = {}; this.directory.forEach( ( entry ) => { const getter = () => createTable( this.tables, { tag: entry.tag, offset: entry.offset, length: entry.length, }, dataview ); lazy$1( this.tables, entry.tag.trim(), getter ); } ); } } class TableRecord { constructor( p ) { this.tag = p.tag; this.checksum = p.uint32; this.offset = p.uint32; this.length = p.uint32; } } const gzipDecode = (inflate_default()).inflate || undefined; let nativeGzipDecode = undefined; // if ( ! gzipDecode ) { // import( 'zlib' ).then( ( zlib ) => { // nativeGzipDecode = ( buffer ) => zlib.unzipSync( buffer ); // } ); // } class WOFF$1 extends SimpleTable { constructor( font, dataview, createTable ) { const { p: p } = super( { offset: 0, length: 44 }, dataview, `woff` ); this.signature = p.tag; this.flavor = p.uint32; this.length = p.uint32; this.numTables = p.uint16; p.uint16; this.totalSfntSize = p.uint32; this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.metaOffset = p.uint32; this.metaLength = p.uint32; this.metaOrigLength = p.uint32; this.privOffset = p.uint32; this.privLength = p.uint32; p.verifyLength(); this.directory = [ ...new Array( this.numTables ) ].map( ( _ ) => new WoffTableDirectoryEntry( p ) ); buildWoffLazyLookups( this, dataview, createTable ); } } class WoffTableDirectoryEntry { constructor( p ) { this.tag = p.tag; this.offset = p.uint32; this.compLength = p.uint32; this.origLength = p.uint32; this.origChecksum = p.uint32; } } function buildWoffLazyLookups( woff, dataview, createTable ) { woff.tables = {}; woff.directory.forEach( ( entry ) => { lazy$1( woff.tables, entry.tag.trim(), () => { let offset = 0; let view = dataview; if ( entry.compLength !== entry.origLength ) { const data = dataview.buffer.slice( entry.offset, entry.offset + entry.compLength ); let unpacked; if ( gzipDecode ) { unpacked = gzipDecode( new Uint8Array( data ) ); } else if ( nativeGzipDecode ) { unpacked = nativeGzipDecode( new Uint8Array( data ) ); } else { const msg = `no brotli decoder available to decode WOFF2 font`; if ( font.onerror ) font.onerror( msg ); throw new Error( msg ); } view = new DataView( unpacked.buffer ); } else { offset = entry.offset; } return createTable( woff.tables, { tag: entry.tag, offset: offset, length: entry.origLength }, view ); } ); } ); } const brotliDecode = (unbrotli_default()); let nativeBrotliDecode = undefined; // if ( ! brotliDecode ) { // import( 'zlib' ).then( ( zlib ) => { // nativeBrotliDecode = ( buffer ) => zlib.brotliDecompressSync( buffer ); // } ); // } class WOFF2$1 extends SimpleTable { constructor( font, dataview, createTable ) { const { p: p } = super( { offset: 0, length: 48 }, dataview, `woff2` ); this.signature = p.tag; this.flavor = p.uint32; this.length = p.uint32; this.numTables = p.uint16; p.uint16; this.totalSfntSize = p.uint32; this.totalCompressedSize = p.uint32; this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.metaOffset = p.uint32; this.metaLength = p.uint32; this.metaOrigLength = p.uint32; this.privOffset = p.uint32; this.privLength = p.uint32; p.verifyLength(); this.directory = [ ...new Array( this.numTables ) ].map( ( _ ) => new Woff2TableDirectoryEntry( p ) ); let dictOffset = p.currentPosition; this.directory[ 0 ].offset = 0; this.directory.forEach( ( e, i ) => { let next = this.directory[ i + 1 ]; if ( next ) { next.offset = e.offset + ( e.transformLength !== undefined ? e.transformLength : e.origLength ); } } ); let decoded; let buffer = dataview.buffer.slice( dictOffset ); if ( brotliDecode ) { decoded = brotliDecode( new Uint8Array( buffer ) ); } else if ( nativeBrotliDecode ) { decoded = new Uint8Array( nativeBrotliDecode( buffer ) ); } else { const msg = `no brotli decoder available to decode WOFF2 font`; if ( font.onerror ) font.onerror( msg ); throw new Error( msg ); } buildWoff2LazyLookups( this, decoded, createTable ); } } class Woff2TableDirectoryEntry { constructor( p ) { this.flags = p.uint8; const tagNumber = ( this.tagNumber = this.flags & 63 ); if ( tagNumber === 63 ) { this.tag = p.tag; } else { this.tag = getWOFF2Tag( tagNumber ); } const transformVersion = ( this.transformVersion = ( this.flags & 192 ) >> 6 ); let hasTransforms = transformVersion !== 0; if ( this.tag === `glyf` || this.tag === `loca` ) { hasTransforms = this.transformVersion !== 3; } this.origLength = p.uint128; if ( hasTransforms ) { this.transformLength = p.uint128; } } } function buildWoff2LazyLookups( woff2, decoded, createTable ) { woff2.tables = {}; woff2.directory.forEach( ( entry ) => { lazy$1( woff2.tables, entry.tag.trim(), () => { const start = entry.offset; const end = start + ( entry.transformLength ? entry.transformLength : entry.origLength ); const data = new DataView( decoded.slice( start, end ).buffer ); try { return createTable( woff2.tables, { tag: entry.tag, offset: 0, length: entry.origLength }, data ); } catch ( e ) { console.error( e ); } } ); } ); } function getWOFF2Tag( flag ) { return [ `cmap`, `head`, `hhea`, `hmtx`, `maxp`, `name`, `OS/2`, `post`, `cvt `, `fpgm`, `glyf`, `loca`, `prep`, `CFF `, `VORG`, `EBDT`, `EBLC`, `gasp`, `hdmx`, `kern`, `LTSH`, `PCLT`, `VDMX`, `vhea`, `vmtx`, `BASE`, `GDEF`, `GPOS`, `GSUB`, `EBSC`, `JSTF`, `MATH`, `CBDT`, `CBLC`, `COLR`, `CPAL`, `SVG `, `sbix`, `acnt`, `avar`, `bdat`, `bloc`, `bsln`, `cvar`, `fdsc`, `feat`, `fmtx`, `fvar`, `gvar`, `hsty`, `just`, `lcar`, `mort`, `morx`, `opbd`, `prop`, `trak`, `Zapf`, `Silf`, `Glat`, `Gloc`, `Feat`, `Sill`, ][ flag & 63 ]; } const tableClasses = {}; let tableClassesLoaded = false; Promise.all( [ Promise.resolve().then( function () { return cmap$1; } ), Promise.resolve().then( function () { return head$1; } ), Promise.resolve().then( function () { return hhea$1; } ), Promise.resolve().then( function () { return hmtx$1; } ), Promise.resolve().then( function () { return maxp$1; } ), Promise.resolve().then( function () { return name$1; } ), Promise.resolve().then( function () { return OS2$1; } ), Promise.resolve().then( function () { return post$1; } ), Promise.resolve().then( function () { return BASE$1; } ), Promise.resolve().then( function () { return GDEF$1; } ), Promise.resolve().then( function () { return GSUB$1; } ), Promise.resolve().then( function () { return GPOS$1; } ), Promise.resolve().then( function () { return SVG$1; } ), Promise.resolve().then( function () { return fvar$1; } ), Promise.resolve().then( function () { return cvt$1; } ), Promise.resolve().then( function () { return fpgm$1; } ), Promise.resolve().then( function () { return gasp$1; } ), Promise.resolve().then( function () { return glyf$1; } ), Promise.resolve().then( function () { return loca$1; } ), Promise.resolve().then( function () { return prep$1; } ), Promise.resolve().then( function () { return CFF$1; } ), Promise.resolve().then( function () { return CFF2$1; } ), Promise.resolve().then( function () { return VORG$1; } ), Promise.resolve().then( function () { return EBLC$1; } ), Promise.resolve().then( function () { return EBDT$1; } ), Promise.resolve().then( function () { return EBSC$1; } ), Promise.resolve().then( function () { return CBLC$1; } ), Promise.resolve().then( function () { return CBDT$1; } ), Promise.resolve().then( function () { return sbix$1; } ), Promise.resolve().then( function () { return COLR$1; } ), Promise.resolve().then( function () { return CPAL$1; } ), Promise.resolve().then( function () { return DSIG$1; } ), Promise.resolve().then( function () { return hdmx$1; } ), Promise.resolve().then( function () { return kern$1; } ), Promise.resolve().then( function () { return LTSH$1; } ), Promise.resolve().then( function () { return MERG$1; } ), Promise.resolve().then( function () { return meta$1; } ), Promise.resolve().then( function () { return PCLT$1; } ), Promise.resolve().then( function () { return VDMX$1; } ), Promise.resolve().then( function () { return vhea$1; } ), Promise.resolve().then( function () { return vmtx$1; } ), ] ).then( ( data ) => { data.forEach( ( e ) => { let name = Object.keys( e )[ 0 ]; tableClasses[ name ] = e[ name ]; } ); tableClassesLoaded = true; } ); function createTable( tables, dict, dataview ) { let name = dict.tag.replace( /[^\w\d]/g, `` ); let Type = tableClasses[ name ]; if ( Type ) return new Type( dict, dataview, tables ); console.warn( `lib-font has no definition for ${ name }. The table was skipped.` ); return {}; } function loadTableClasses() { let count = 0; function checkLoaded( resolve, reject ) { if ( ! tableClassesLoaded ) { if ( count > 10 ) { return reject( new Error( `loading took too long` ) ); } count++; return setTimeout( () => checkLoaded( resolve ), 250 ); } resolve( createTable ); } return new Promise( ( resolve, reject ) => checkLoaded( resolve ) ); } function getFontCSSFormat( path, errorOnStyle ) { let pos = path.lastIndexOf( `.` ); let ext = ( path.substring( pos + 1 ) || `` ).toLowerCase(); let format = { ttf: `truetype`, otf: `opentype`, woff: `woff`, woff2: `woff2`, }[ ext ]; if ( format ) return format; let msg = { eot: `The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.`, svg: `The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.`, fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`, ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`, }[ ext ]; if ( ! msg ) msg = `${ path } is not a known webfont format.`; if ( errorOnStyle ) { throw new Error( msg ); } else { console.warn( `Could not load font: ${ msg }` ); } } async function setupFontFace( name, url, options = {} ) { if ( ! globalThis.document ) return; let format = getFontCSSFormat( url, options.errorOnStyle ); if ( ! format ) return; let style = document.createElement( `style` ); style.className = `injected-by-Font-js`; let rules = []; if ( options.styleRules ) { rules = Object.entries( options.styleRules ).map( ( [ key, value ] ) => `${ key }: ${ value };` ); } style.textContent = `\n@font-face {\n font-family: "${ name }";\n ${ rules.join( `\n\t` ) }\n src: url("${ url }") format("${ format }");\n}`; globalThis.document.head.appendChild( style ); return style; } const TTF = [ 0, 1, 0, 0 ]; const OTF = [ 79, 84, 84, 79 ]; const WOFF = [ 119, 79, 70, 70 ]; const WOFF2 = [ 119, 79, 70, 50 ]; function match( ar1, ar2 ) { if ( ar1.length !== ar2.length ) return; for ( let i = 0; i < ar1.length; i++ ) { if ( ar1[ i ] !== ar2[ i ] ) return; } return true; } function validFontFormat( dataview ) { const LEAD_BYTES = [ dataview.getUint8( 0 ), dataview.getUint8( 1 ), dataview.getUint8( 2 ), dataview.getUint8( 3 ), ]; if ( match( LEAD_BYTES, TTF ) || match( LEAD_BYTES, OTF ) ) return `SFNT`; if ( match( LEAD_BYTES, WOFF ) ) return `WOFF`; if ( match( LEAD_BYTES, WOFF2 ) ) return `WOFF2`; } function checkFetchResponseStatus( response ) { if ( ! response.ok ) { throw new Error( `HTTP ${ response.status } - ${ response.statusText }` ); } return response; } class Font extends EventManager { constructor( name, options = {} ) { super(); this.name = name; this.options = options; this.metrics = false; } get src() { return this.__src; } set src( src ) { this.__src = src; ( async () => { if ( globalThis.document && ! this.options.skipStyleSheet ) { await setupFontFace( this.name, src, this.options ); } this.loadFont( src ); } )(); } async loadFont( url, filename ) { fetch( url ) .then( ( response ) => checkFetchResponseStatus( response ) && response.arrayBuffer() ) .then( ( buffer ) => this.fromDataBuffer( buffer, filename || url ) ) .catch( ( err ) => { const evt = new lib_font_browser_Event( `error`, err, `Failed to load font at ${ filename || url }` ); this.dispatch( evt ); if ( this.onerror ) this.onerror( evt ); } ); } async fromDataBuffer( buffer, filenameOrUrL ) { this.fontData = new DataView( buffer ); let type = validFontFormat( this.fontData ); if ( ! type ) { throw new Error( `${ filenameOrUrL } is either an unsupported font format, or not a font at all.` ); } await this.parseBasicData( type ); const evt = new lib_font_browser_Event( 'load', { font: this } ); this.dispatch( evt ); if ( this.onload ) this.onload( evt ); } async parseBasicData( type ) { return loadTableClasses().then( ( createTable ) => { if ( type === `SFNT` ) { this.opentype = new SFNT( this, this.fontData, createTable ); } if ( type === `WOFF` ) { this.opentype = new WOFF$1( this, this.fontData, createTable ); } if ( type === `WOFF2` ) { this.opentype = new WOFF2$1( this, this.fontData, createTable ); } return this.opentype; } ); } getGlyphId( char ) { return this.opentype.tables.cmap.getGlyphId( char ); } reverse( glyphid ) { return this.opentype.tables.cmap.reverse( glyphid ); } supports( char ) { return this.getGlyphId( char ) !== 0; } supportsVariation( variation ) { return ( this.opentype.tables.cmap.supportsVariation( variation ) !== false ); } measureText( text, size = 16 ) { if ( this.__unloaded ) throw new Error( 'Cannot measure text: font was unloaded. Please reload before calling measureText()' ); let d = document.createElement( 'div' ); d.textContent = text; d.style.fontFamily = this.name; d.style.fontSize = `${ size }px`; d.style.color = `transparent`; d.style.background = `transparent`; d.style.top = `0`; d.style.left = `0`; d.style.position = `absolute`; document.body.appendChild( d ); let bbox = d.getBoundingClientRect(); document.body.removeChild( d ); const OS2 = this.opentype.tables[ 'OS/2' ]; bbox.fontSize = size; bbox.ascender = OS2.sTypoAscender; bbox.descender = OS2.sTypoDescender; return bbox; } unload() { if ( this.styleElement.parentNode ) { this.styleElement.parentNode.removeElement( this.styleElement ); const evt = new lib_font_browser_Event( 'unload', { font: this } ); this.dispatch( evt ); if ( this.onunload ) this.onunload( evt ); } this._unloaded = true; } load() { if ( this.__unloaded ) { delete this.__unloaded; document.head.appendChild( this.styleElement ); const evt = new lib_font_browser_Event( 'load', { font: this } ); this.dispatch( evt ); if ( this.onload ) this.onload( evt ); } } } globalThis.Font = Font; class Subtable extends ParsedData { constructor( p, plaformID, encodingID ) { super( p ); this.plaformID = plaformID; this.encodingID = encodingID; } } class Format0 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 0; this.length = p.uint16; this.language = p.uint16; this.glyphIdArray = [ ...new Array( 256 ) ].map( ( _ ) => p.uint8 ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.` ); } return 0 <= charCode && charCode <= 255; } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 0` ); return {}; } getSupportedCharCodes() { return [ { start: 1, end: 256 } ]; } } class Format2 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 2; this.length = p.uint16; this.language = p.uint16; this.subHeaderKeys = [ ...new Array( 256 ) ].map( ( _ ) => p.uint16 ); const subHeaderCount = Math.max( ...this.subHeaderKeys ); const subHeaderOffset = p.currentPosition; lazy$1( this, `subHeaders`, () => { p.currentPosition = subHeaderOffset; return [ ...new Array( subHeaderCount ) ].map( ( _ ) => new SubHeader( p ) ); } ); const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8; lazy$1( this, `glyphIndexArray`, () => { p.currentPosition = glyphIndexOffset; return [ ...new Array( subHeaderCount ) ].map( ( _ ) => p.uint16 ); } ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.` ); } const low = charCode && 255; const high = charCode && 65280; const subHeaderKey = this.subHeaders[ high ]; const subheader = this.subHeaders[ subHeaderKey ]; const first = subheader.firstCode; const last = first + subheader.entryCount; return first <= low && low <= last; } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 2` ); return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) { return this.subHeaders.map( ( h ) => ( { firstCode: h.firstCode, lastCode: h.lastCode, } ) ); } return this.subHeaders.map( ( h ) => ( { start: h.firstCode, end: h.lastCode, } ) ); } } class SubHeader { constructor( p ) { this.firstCode = p.uint16; this.entryCount = p.uint16; this.lastCode = this.first + this.entryCount; this.idDelta = p.int16; this.idRangeOffset = p.uint16; } } class Format4 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 4; this.length = p.uint16; this.language = p.uint16; this.segCountX2 = p.uint16; this.segCount = this.segCountX2 / 2; this.searchRange = p.uint16; this.entrySelector = p.uint16; this.rangeShift = p.uint16; const endCodePosition = p.currentPosition; lazy$1( this, `endCode`, () => p.readBytes( this.segCount, endCodePosition, 16 ) ); const startCodePosition = endCodePosition + 2 + this.segCountX2; lazy$1( this, `startCode`, () => p.readBytes( this.segCount, startCodePosition, 16 ) ); const idDeltaPosition = startCodePosition + this.segCountX2; lazy$1( this, `idDelta`, () => p.readBytes( this.segCount, idDeltaPosition, 16, true ) ); const idRangePosition = idDeltaPosition + this.segCountX2; lazy$1( this, `idRangeOffset`, () => p.readBytes( this.segCount, idRangePosition, 16 ) ); const glyphIdArrayPosition = idRangePosition + this.segCountX2; const glyphIdArrayLength = this.length - ( glyphIdArrayPosition - this.tableStart ); lazy$1( this, `glyphIdArray`, () => p.readBytes( glyphIdArrayLength, glyphIdArrayPosition, 16 ) ); lazy$1( this, `segments`, () => this.buildSegments( idRangePosition, glyphIdArrayPosition, p ) ); } buildSegments( idRangePosition, glyphIdArrayPosition, p ) { const build = ( _, i ) => { let startCode = this.startCode[ i ], endCode = this.endCode[ i ], idDelta = this.idDelta[ i ], idRangeOffset = this.idRangeOffset[ i ], idRangeOffsetPointer = idRangePosition + 2 * i, glyphIDs = []; if ( idRangeOffset === 0 ) { for ( let i = startCode + idDelta, e = endCode + idDelta; i <= e; i++ ) { glyphIDs.push( i ); } } else { for ( let i = 0, e = endCode - startCode; i <= e; i++ ) { p.currentPosition = idRangeOffsetPointer + idRangeOffset + i * 2; glyphIDs.push( p.uint16 ); } } return { startCode: startCode, endCode: endCode, idDelta: idDelta, idRangeOffset: idRangeOffset, glyphIDs: glyphIDs, }; }; return [ ...new Array( this.segCount ) ].map( build ); } reverse( glyphID ) { let s = this.segments.find( ( v ) => v.glyphIDs.includes( glyphID ) ); if ( ! s ) return {}; const code = s.startCode + s.glyphIDs.indexOf( glyphID ); return { code: code, unicode: String.fromCodePoint( code ) }; } getGlyphId( charCode ) { if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); if ( 55296 <= charCode && charCode <= 57343 ) return 0; if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) return 0; let segment = this.segments.find( ( s ) => s.startCode <= charCode && charCode <= s.endCode ); if ( ! segment ) return 0; return segment.glyphIDs[ charCode - segment.startCode ]; } supports( charCode ) { return this.getGlyphId( charCode ) !== 0; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) return this.segments; return this.segments.map( ( v ) => ( { start: v.startCode, end: v.endCode, } ) ); } } class Format6 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 6; this.length = p.uint16; this.language = p.uint16; this.firstCode = p.uint16; this.entryCount = p.uint16; this.lastCode = this.firstCode + this.entryCount - 1; const getter = () => [ ...new Array( this.entryCount ) ].map( ( _ ) => p.uint16 ); lazy$1( this, `glyphIdArray`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.` ); } if ( charCode < this.firstCode ) return {}; if ( charCode > this.firstCode + this.entryCount ) return {}; const code = charCode - this.firstCode; return { code: code, unicode: String.fromCodePoint( code ) }; } reverse( glyphID ) { let pos = this.glyphIdArray.indexOf( glyphID ); if ( pos > -1 ) return this.firstCode + pos; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) { return [ { firstCode: this.firstCode, lastCode: this.lastCode } ]; } return [ { start: this.firstCode, end: this.lastCode } ]; } } class Format8 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 8; p.uint16; this.length = p.uint32; this.language = p.uint32; this.is32 = [ ...new Array( 8192 ) ].map( ( _ ) => p.uint8 ); this.numGroups = p.uint32; const getter = () => [ ...new Array( this.numGroups ) ].map( ( _ ) => new SequentialMapGroup$1( p ) ); lazy$1( this, `groups`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.` ); } return ( this.groups.findIndex( ( s ) => s.startcharCode <= charCode && charCode <= s.endcharCode ) !== -1 ); } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 8` ); return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) return this.groups; return this.groups.map( ( v ) => ( { start: v.startcharCode, end: v.endcharCode, } ) ); } } class SequentialMapGroup$1 { constructor( p ) { this.startcharCode = p.uint32; this.endcharCode = p.uint32; this.startGlyphID = p.uint32; } } class Format10 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 10; p.uint16; this.length = p.uint32; this.language = p.uint32; this.startCharCode = p.uint32; this.numChars = p.uint32; this.endCharCode = this.startCharCode + this.numChars; const getter = () => [ ...new Array( this.numChars ) ].map( ( _ ) => p.uint16 ); lazy$1( this, `glyphs`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.` ); } if ( charCode < this.startCharCode ) return false; if ( charCode > this.startCharCode + this.numChars ) return false; return charCode - this.startCharCode; } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 10` ); return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) { return [ { startCharCode: this.startCharCode, endCharCode: this.endCharCode, }, ]; } return [ { start: this.startCharCode, end: this.endCharCode } ]; } } class Format12 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 12; p.uint16; this.length = p.uint32; this.language = p.uint32; this.numGroups = p.uint32; const getter = () => [ ...new Array( this.numGroups ) ].map( ( _ ) => new SequentialMapGroup( p ) ); lazy$1( this, `groups`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); if ( 55296 <= charCode && charCode <= 57343 ) return 0; if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) return 0; return ( this.groups.findIndex( ( s ) => s.startCharCode <= charCode && charCode <= s.endCharCode ) !== -1 ); } reverse( glyphID ) { for ( let group of this.groups ) { let start = group.startGlyphID; if ( start > glyphID ) continue; if ( start === glyphID ) return group.startCharCode; let end = start + ( group.endCharCode - group.startCharCode ); if ( end < glyphID ) continue; const code = group.startCharCode + ( glyphID - start ); return { code: code, unicode: String.fromCodePoint( code ) }; } return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) return this.groups; return this.groups.map( ( v ) => ( { start: v.startCharCode, end: v.endCharCode, } ) ); } } class SequentialMapGroup { constructor( p ) { this.startCharCode = p.uint32; this.endCharCode = p.uint32; this.startGlyphID = p.uint32; } } class Format13 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 13; p.uint16; this.length = p.uint32; this.language = p.uint32; this.numGroups = p.uint32; const getter = [ ...new Array( this.numGroups ) ].map( ( _ ) => new ConstantMapGroup( p ) ); lazy$1( this, `groups`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); return ( this.groups.findIndex( ( s ) => s.startCharCode <= charCode && charCode <= s.endCharCode ) !== -1 ); } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 13` ); return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) return this.groups; return this.groups.map( ( v ) => ( { start: v.startCharCode, end: v.endCharCode, } ) ); } } class ConstantMapGroup { constructor( p ) { this.startCharCode = p.uint32; this.endCharCode = p.uint32; this.glyphID = p.uint32; } } class Format14 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.subTableStart = p.currentPosition; this.format = 14; this.length = p.uint32; this.numVarSelectorRecords = p.uint32; lazy$1( this, `varSelectors`, () => [ ...new Array( this.numVarSelectorRecords ) ].map( ( _ ) => new VariationSelector( p ) ) ); } supports() { console.warn( `supports not implemented for cmap subtable format 14` ); return 0; } getSupportedCharCodes() { console.warn( `getSupportedCharCodes not implemented for cmap subtable format 14` ); return []; } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 14` ); return {}; } supportsVariation( variation ) { let v = this.varSelector.find( ( uvs ) => uvs.varSelector === variation ); return v ? v : false; } getSupportedVariations() { return this.varSelectors.map( ( v ) => v.varSelector ); } } class VariationSelector { constructor( p ) { this.varSelector = p.uint24; this.defaultUVSOffset = p.Offset32; this.nonDefaultUVSOffset = p.Offset32; } } function createSubTable( parser, platformID, encodingID ) { const format = parser.uint16; if ( format === 0 ) return new Format0( parser, platformID, encodingID ); if ( format === 2 ) return new Format2( parser, platformID, encodingID ); if ( format === 4 ) return new Format4( parser, platformID, encodingID ); if ( format === 6 ) return new Format6( parser, platformID, encodingID ); if ( format === 8 ) return new Format8( parser, platformID, encodingID ); if ( format === 10 ) return new Format10( parser, platformID, encodingID ); if ( format === 12 ) return new Format12( parser, platformID, encodingID ); if ( format === 13 ) return new Format13( parser, platformID, encodingID ); if ( format === 14 ) return new Format14( parser, platformID, encodingID ); return {}; } class cmap extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numTables = p.uint16; this.encodingRecords = [ ...new Array( this.numTables ) ].map( ( _ ) => new EncodingRecord( p, this.tableStart ) ); } getSubTable( tableID ) { return this.encodingRecords[ tableID ].table; } getSupportedEncodings() { return this.encodingRecords.map( ( r ) => ( { platformID: r.platformID, encodingId: r.encodingID, } ) ); } getSupportedCharCodes( platformID, encodingID ) { const recordID = this.encodingRecords.findIndex( ( r ) => r.platformID === platformID && r.encodingID === encodingID ); if ( recordID === -1 ) return false; const subtable = this.getSubTable( recordID ); return subtable.getSupportedCharCodes(); } reverse( glyphid ) { for ( let i = 0; i < this.numTables; i++ ) { let code = this.getSubTable( i ).reverse( glyphid ); if ( code ) return code; } } getGlyphId( char ) { let last = 0; this.encodingRecords.some( ( _, tableID ) => { let t = this.getSubTable( tableID ); if ( ! t.getGlyphId ) return false; last = t.getGlyphId( char ); return last !== 0; } ); return last; } supports( char ) { return this.encodingRecords.some( ( _, tableID ) => { const t = this.getSubTable( tableID ); return t.supports && t.supports( char ) !== false; } ); } supportsVariation( variation ) { return this.encodingRecords.some( ( _, tableID ) => { const t = this.getSubTable( tableID ); return ( t.supportsVariation && t.supportsVariation( variation ) !== false ); } ); } } class EncodingRecord { constructor( p, tableStart ) { const platformID = ( this.platformID = p.uint16 ); const encodingID = ( this.encodingID = p.uint16 ); const offset = ( this.offset = p.Offset32 ); lazy$1( this, `table`, () => { p.currentPosition = tableStart + offset; return createSubTable( p, platformID, encodingID ); } ); } } var cmap$1 = Object.freeze( { __proto__: null, cmap: cmap } ); class head extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.load( { majorVersion: p.uint16, minorVersion: p.uint16, fontRevision: p.fixed, checkSumAdjustment: p.uint32, magicNumber: p.uint32, flags: p.flags( 16 ), unitsPerEm: p.uint16, created: p.longdatetime, modified: p.longdatetime, xMin: p.int16, yMin: p.int16, xMax: p.int16, yMax: p.int16, macStyle: p.flags( 16 ), lowestRecPPEM: p.uint16, fontDirectionHint: p.uint16, indexToLocFormat: p.uint16, glyphDataFormat: p.uint16, } ); } } var head$1 = Object.freeze( { __proto__: null, head: head } ); class hhea extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.ascender = p.fword; this.descender = p.fword; this.lineGap = p.fword; this.advanceWidthMax = p.ufword; this.minLeftSideBearing = p.fword; this.minRightSideBearing = p.fword; this.xMaxExtent = p.fword; this.caretSlopeRise = p.int16; this.caretSlopeRun = p.int16; this.caretOffset = p.int16; p.int16; p.int16; p.int16; p.int16; this.metricDataFormat = p.int16; this.numberOfHMetrics = p.uint16; p.verifyLength(); } } var hhea$1 = Object.freeze( { __proto__: null, hhea: hhea } ); class hmtx extends SimpleTable { constructor( dict, dataview, tables ) { const { p: p } = super( dict, dataview ); const numberOfHMetrics = tables.hhea.numberOfHMetrics; const numGlyphs = tables.maxp.numGlyphs; const metricsStart = p.currentPosition; lazy$1( this, `hMetrics`, () => { p.currentPosition = metricsStart; return [ ...new Array( numberOfHMetrics ) ].map( ( _ ) => new LongHorMetric( p.uint16, p.int16 ) ); } ); if ( numberOfHMetrics < numGlyphs ) { const lsbStart = metricsStart + numberOfHMetrics * 4; lazy$1( this, `leftSideBearings`, () => { p.currentPosition = lsbStart; return [ ...new Array( numGlyphs - numberOfHMetrics ) ].map( ( _ ) => p.int16 ); } ); } } } class LongHorMetric { constructor( w, b ) { this.advanceWidth = w; this.lsb = b; } } var hmtx$1 = Object.freeze( { __proto__: null, hmtx: hmtx } ); class maxp extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.legacyFixed; this.numGlyphs = p.uint16; if ( this.version === 1 ) { this.maxPoints = p.uint16; this.maxContours = p.uint16; this.maxCompositePoints = p.uint16; this.maxCompositeContours = p.uint16; this.maxZones = p.uint16; this.maxTwilightPoints = p.uint16; this.maxStorage = p.uint16; this.maxFunctionDefs = p.uint16; this.maxInstructionDefs = p.uint16; this.maxStackElements = p.uint16; this.maxSizeOfInstructions = p.uint16; this.maxComponentElements = p.uint16; this.maxComponentDepth = p.uint16; } p.verifyLength(); } } var maxp$1 = Object.freeze( { __proto__: null, maxp: maxp } ); class lib_font_browser_name extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.format = p.uint16; this.count = p.uint16; this.stringOffset = p.Offset16; this.nameRecords = [ ...new Array( this.count ) ].map( ( _ ) => new NameRecord( p, this ) ); if ( this.format === 1 ) { this.langTagCount = p.uint16; this.langTagRecords = [ ...new Array( this.langTagCount ) ].map( ( _ ) => new LangTagRecord( p.uint16, p.Offset16 ) ); } this.stringStart = this.tableStart + this.stringOffset; } get( nameID ) { let record = this.nameRecords.find( ( record ) => record.nameID === nameID ); if ( record ) return record.string; } } class LangTagRecord { constructor( length, offset ) { this.length = length; this.offset = offset; } } class NameRecord { constructor( p, nameTable ) { this.platformID = p.uint16; this.encodingID = p.uint16; this.languageID = p.uint16; this.nameID = p.uint16; this.length = p.uint16; this.offset = p.Offset16; lazy$1( this, `string`, () => { p.currentPosition = nameTable.stringStart + this.offset; return decodeString( p, this ); } ); } } function decodeString( p, record ) { const { platformID: platformID, length: length } = record; if ( length === 0 ) return ``; if ( platformID === 0 || platformID === 3 ) { const str = []; for ( let i = 0, e = length / 2; i < e; i++ ) str[ i ] = String.fromCharCode( p.uint16 ); return str.join( `` ); } const bytes = p.readBytes( length ); const str = []; bytes.forEach( function ( b, i ) { str[ i ] = String.fromCharCode( b ); } ); return str.join( `` ); } var name$1 = Object.freeze( { __proto__: null, name: lib_font_browser_name } ); class OS2 extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.xAvgCharWidth = p.int16; this.usWeightClass = p.uint16; this.usWidthClass = p.uint16; this.fsType = p.uint16; this.ySubscriptXSize = p.int16; this.ySubscriptYSize = p.int16; this.ySubscriptXOffset = p.int16; this.ySubscriptYOffset = p.int16; this.ySuperscriptXSize = p.int16; this.ySuperscriptYSize = p.int16; this.ySuperscriptXOffset = p.int16; this.ySuperscriptYOffset = p.int16; this.yStrikeoutSize = p.int16; this.yStrikeoutPosition = p.int16; this.sFamilyClass = p.int16; this.panose = [ ...new Array( 10 ) ].map( ( _ ) => p.uint8 ); this.ulUnicodeRange1 = p.flags( 32 ); this.ulUnicodeRange2 = p.flags( 32 ); this.ulUnicodeRange3 = p.flags( 32 ); this.ulUnicodeRange4 = p.flags( 32 ); this.achVendID = p.tag; this.fsSelection = p.uint16; this.usFirstCharIndex = p.uint16; this.usLastCharIndex = p.uint16; this.sTypoAscender = p.int16; this.sTypoDescender = p.int16; this.sTypoLineGap = p.int16; this.usWinAscent = p.uint16; this.usWinDescent = p.uint16; if ( this.version === 0 ) return p.verifyLength(); this.ulCodePageRange1 = p.flags( 32 ); this.ulCodePageRange2 = p.flags( 32 ); if ( this.version === 1 ) return p.verifyLength(); this.sxHeight = p.int16; this.sCapHeight = p.int16; this.usDefaultChar = p.uint16; this.usBreakChar = p.uint16; this.usMaxContext = p.uint16; if ( this.version <= 4 ) return p.verifyLength(); this.usLowerOpticalPointSize = p.uint16; this.usUpperOpticalPointSize = p.uint16; if ( this.version === 5 ) return p.verifyLength(); } } var OS2$1 = Object.freeze( { __proto__: null, OS2: OS2 } ); class post extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.legacyFixed; this.italicAngle = p.fixed; this.underlinePosition = p.fword; this.underlineThickness = p.fword; this.isFixedPitch = p.uint32; this.minMemType42 = p.uint32; this.maxMemType42 = p.uint32; this.minMemType1 = p.uint32; this.maxMemType1 = p.uint32; if ( this.version === 1 || this.version === 3 ) return p.verifyLength(); this.numGlyphs = p.uint16; if ( this.version === 2 ) { this.glyphNameIndex = [ ...new Array( this.numGlyphs ) ].map( ( _ ) => p.uint16 ); this.namesOffset = p.currentPosition; this.glyphNameOffsets = [ 1 ]; for ( let i = 0; i < this.numGlyphs; i++ ) { let index = this.glyphNameIndex[ i ]; if ( index < macStrings.length ) { this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] ); continue; } let bytelength = p.int8; p.skip( bytelength ); this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] + bytelength + 1 ); } } if ( this.version === 2.5 ) { this.offset = [ ...new Array( this.numGlyphs ) ].map( ( _ ) => p.int8 ); } } getGlyphName( glyphid ) { if ( this.version !== 2 ) { console.warn( `post table version ${ this.version } does not support glyph name lookups` ); return ``; } let index = this.glyphNameIndex[ glyphid ]; if ( index < 258 ) return macStrings[ index ]; let offset = this.glyphNameOffsets[ glyphid ]; let next = this.glyphNameOffsets[ glyphid + 1 ]; let len = next - offset - 1; if ( len === 0 ) return `.notdef.`; this.parser.currentPosition = this.namesOffset + offset; const data = this.parser.readBytes( len, this.namesOffset + offset, 8, true ); return data.map( ( b ) => String.fromCharCode( b ) ).join( `` ); } } const macStrings = [ `.notdef`, `.null`, `nonmarkingreturn`, `space`, `exclam`, `quotedbl`, `numbersign`, `dollar`, `percent`, `ampersand`, `quotesingle`, `parenleft`, `parenright`, `asterisk`, `plus`, `comma`, `hyphen`, `period`, `slash`, `zero`, `one`, `two`, `three`, `four`, `five`, `six`, `seven`, `eight`, `nine`, `colon`, `semicolon`, `less`, `equal`, `greater`, `question`, `at`, `A`, `B`, `C`, `D`, `E`, `F`, `G`, `H`, `I`, `J`, `K`, `L`, `M`, `N`, `O`, `P`, `Q`, `R`, `S`, `T`, `U`, `V`, `W`, `X`, `Y`, `Z`, `bracketleft`, `backslash`, `bracketright`, `asciicircum`, `underscore`, `grave`, `a`, `b`, `c`, `d`, `e`, `f`, `g`, `h`, `i`, `j`, `k`, `l`, `m`, `n`, `o`, `p`, `q`, `r`, `s`, `t`, `u`, `v`, `w`, `x`, `y`, `z`, `braceleft`, `bar`, `braceright`, `asciitilde`, `Adieresis`, `Aring`, `Ccedilla`, `Eacute`, `Ntilde`, `Odieresis`, `Udieresis`, `aacute`, `agrave`, `acircumflex`, `adieresis`, `atilde`, `aring`, `ccedilla`, `eacute`, `egrave`, `ecircumflex`, `edieresis`, `iacute`, `igrave`, `icircumflex`, `idieresis`, `ntilde`, `oacute`, `ograve`, `ocircumflex`, `odieresis`, `otilde`, `uacute`, `ugrave`, `ucircumflex`, `udieresis`, `dagger`, `degree`, `cent`, `sterling`, `section`, `bullet`, `paragraph`, `germandbls`, `registered`, `copyright`, `trademark`, `acute`, `dieresis`, `notequal`, `AE`, `Oslash`, `infinity`, `plusminus`, `lessequal`, `greaterequal`, `yen`, `mu`, `partialdiff`, `summation`, `product`, `pi`, `integral`, `ordfeminine`, `ordmasculine`, `Omega`, `ae`, `oslash`, `questiondown`, `exclamdown`, `logicalnot`, `radical`, `florin`, `approxequal`, `Delta`, `guillemotleft`, `guillemotright`, `ellipsis`, `nonbreakingspace`, `Agrave`, `Atilde`, `Otilde`, `OE`, `oe`, `endash`, `emdash`, `quotedblleft`, `quotedblright`, `quoteleft`, `quoteright`, `divide`, `lozenge`, `ydieresis`, `Ydieresis`, `fraction`, `currency`, `guilsinglleft`, `guilsinglright`, `fi`, `fl`, `daggerdbl`, `periodcentered`, `quotesinglbase`, `quotedblbase`, `perthousand`, `Acircumflex`, `Ecircumflex`, `Aacute`, `Edieresis`, `Egrave`, `Iacute`, `Icircumflex`, `Idieresis`, `Igrave`, `Oacute`, `Ocircumflex`, `apple`, `Ograve`, `Uacute`, `Ucircumflex`, `Ugrave`, `dotlessi`, `circumflex`, `tilde`, `macron`, `breve`, `dotaccent`, `ring`, `cedilla`, `hungarumlaut`, `ogonek`, `caron`, `Lslash`, `lslash`, `Scaron`, `scaron`, `Zcaron`, `zcaron`, `brokenbar`, `Eth`, `eth`, `Yacute`, `yacute`, `Thorn`, `thorn`, `minus`, `multiply`, `onesuperior`, `twosuperior`, `threesuperior`, `onehalf`, `onequarter`, `threequarters`, `franc`, `Gbreve`, `gbreve`, `Idotaccent`, `Scedilla`, `scedilla`, `Cacute`, `cacute`, `Ccaron`, `ccaron`, `dcroat`, ]; var post$1 = Object.freeze( { __proto__: null, post: post } ); class BASE extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.horizAxisOffset = p.Offset16; this.vertAxisOffset = p.Offset16; lazy$1( this, `horizAxis`, () => new AxisTable( { offset: dict.offset + this.horizAxisOffset }, dataview ) ); lazy$1( this, `vertAxis`, () => new AxisTable( { offset: dict.offset + this.vertAxisOffset }, dataview ) ); if ( this.majorVersion === 1 && this.minorVersion === 1 ) { this.itemVarStoreOffset = p.Offset32; lazy$1( this, `itemVarStore`, () => new AxisTable( { offset: dict.offset + this.itemVarStoreOffset }, dataview ) ); } } } class AxisTable extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview, `AxisTable` ); this.baseTagListOffset = p.Offset16; this.baseScriptListOffset = p.Offset16; lazy$1( this, `baseTagList`, () => new BaseTagListTable( { offset: dict.offset + this.baseTagListOffset }, dataview ) ); lazy$1( this, `baseScriptList`, () => new BaseScriptListTable( { offset: dict.offset + this.baseScriptListOffset }, dataview ) ); } } class BaseTagListTable extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview, `BaseTagListTable` ); this.baseTagCount = p.uint16; this.baselineTags = [ ...new Array( this.baseTagCount ) ].map( ( _ ) => p.tag ); } } class BaseScriptListTable extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview, `BaseScriptListTable` ); this.baseScriptCount = p.uint16; const recordStart = p.currentPosition; lazy$1( this, `baseScriptRecords`, () => { p.currentPosition = recordStart; return [ ...new Array( this.baseScriptCount ) ].map( ( _ ) => new BaseScriptRecord( this.start, p ) ); } ); } } class BaseScriptRecord { constructor( baseScriptListTableStart, p ) { this.baseScriptTag = p.tag; this.baseScriptOffset = p.Offset16; lazy$1( this, `baseScriptTable`, () => { p.currentPosition = baseScriptListTableStart + this.baseScriptOffset; return new BaseScriptTable( p ); } ); } } class BaseScriptTable { constructor( p ) { this.start = p.currentPosition; this.baseValuesOffset = p.Offset16; this.defaultMinMaxOffset = p.Offset16; this.baseLangSysCount = p.uint16; this.baseLangSysRecords = [ ...new Array( this.baseLangSysCount ) ].map( ( _ ) => new BaseLangSysRecord( this.start, p ) ); lazy$1( this, `baseValues`, () => { p.currentPosition = this.start + this.baseValuesOffset; return new BaseValuesTable( p ); } ); lazy$1( this, `defaultMinMax`, () => { p.currentPosition = this.start + this.defaultMinMaxOffset; return new MinMaxTable( p ); } ); } } class BaseLangSysRecord { constructor( baseScriptTableStart, p ) { this.baseLangSysTag = p.tag; this.minMaxOffset = p.Offset16; lazy$1( this, `minMax`, () => { p.currentPosition = baseScriptTableStart + this.minMaxOffset; return new MinMaxTable( p ); } ); } } class BaseValuesTable { constructor( p ) { this.parser = p; this.start = p.currentPosition; this.defaultBaselineIndex = p.uint16; this.baseCoordCount = p.uint16; this.baseCoords = [ ...new Array( this.baseCoordCount ) ].map( ( _ ) => p.Offset16 ); } getTable( id ) { this.parser.currentPosition = this.start + this.baseCoords[ id ]; return new BaseCoordTable( this.parser ); } } class MinMaxTable { constructor( p ) { this.minCoord = p.Offset16; this.maxCoord = p.Offset16; this.featMinMaxCount = p.uint16; const recordStart = p.currentPosition; lazy$1( this, `featMinMaxRecords`, () => { p.currentPosition = recordStart; return [ ...new Array( this.featMinMaxCount ) ].map( ( _ ) => new FeatMinMaxRecord( p ) ); } ); } } class FeatMinMaxRecord { constructor( p ) { this.featureTableTag = p.tag; this.minCoord = p.Offset16; this.maxCoord = p.Offset16; } } class BaseCoordTable { constructor( p ) { this.baseCoordFormat = p.uint16; this.coordinate = p.int16; if ( this.baseCoordFormat === 2 ) { this.referenceGlyph = p.uint16; this.baseCoordPoint = p.uint16; } if ( this.baseCoordFormat === 3 ) { this.deviceTable = p.Offset16; } } } var BASE$1 = Object.freeze( { __proto__: null, BASE: BASE } ); class ClassDefinition { constructor( p ) { this.classFormat = p.uint16; if ( this.classFormat === 1 ) { this.startGlyphID = p.uint16; this.glyphCount = p.uint16; this.classValueArray = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } if ( this.classFormat === 2 ) { this.classRangeCount = p.uint16; this.classRangeRecords = [ ...new Array( this.classRangeCount ), ].map( ( _ ) => new ClassRangeRecord( p ) ); } } } class ClassRangeRecord { constructor( p ) { this.startGlyphID = p.uint16; this.endGlyphID = p.uint16; this.class = p.uint16; } } class CoverageTable extends ParsedData { constructor( p ) { super( p ); this.coverageFormat = p.uint16; if ( this.coverageFormat === 1 ) { this.glyphCount = p.uint16; this.glyphArray = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } if ( this.coverageFormat === 2 ) { this.rangeCount = p.uint16; this.rangeRecords = [ ...new Array( this.rangeCount ) ].map( ( _ ) => new CoverageRangeRecord( p ) ); } } } class CoverageRangeRecord { constructor( p ) { this.startGlyphID = p.uint16; this.endGlyphID = p.uint16; this.startCoverageIndex = p.uint16; } } class ItemVariationStoreTable { constructor( table, p ) { this.table = table; this.parser = p; this.start = p.currentPosition; this.format = p.uint16; this.variationRegionListOffset = p.Offset32; this.itemVariationDataCount = p.uint16; this.itemVariationDataOffsets = [ ...new Array( this.itemVariationDataCount ), ].map( ( _ ) => p.Offset32 ); } } class GDEF extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.glyphClassDefOffset = p.Offset16; lazy$1( this, `glyphClassDefs`, () => { if ( this.glyphClassDefOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.glyphClassDefOffset; return new ClassDefinition( p ); } ); this.attachListOffset = p.Offset16; lazy$1( this, `attachList`, () => { if ( this.attachListOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.attachListOffset; return new AttachList( p ); } ); this.ligCaretListOffset = p.Offset16; lazy$1( this, `ligCaretList`, () => { if ( this.ligCaretListOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.ligCaretListOffset; return new LigCaretList( p ); } ); this.markAttachClassDefOffset = p.Offset16; lazy$1( this, `markAttachClassDef`, () => { if ( this.markAttachClassDefOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.markAttachClassDefOffset; return new ClassDefinition( p ); } ); if ( this.minorVersion >= 2 ) { this.markGlyphSetsDefOffset = p.Offset16; lazy$1( this, `markGlyphSetsDef`, () => { if ( this.markGlyphSetsDefOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.markGlyphSetsDefOffset; return new MarkGlyphSetsTable( p ); } ); } if ( this.minorVersion === 3 ) { this.itemVarStoreOffset = p.Offset32; lazy$1( this, `itemVarStore`, () => { if ( this.itemVarStoreOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.itemVarStoreOffset; return new ItemVariationStoreTable( p ); } ); } } } class AttachList extends ParsedData { constructor( p ) { super( p ); this.coverageOffset = p.Offset16; this.glyphCount = p.uint16; this.attachPointOffsets = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.Offset16 ); } getPoint( pointID ) { this.parser.currentPosition = this.start + this.attachPointOffsets[ pointID ]; return new AttachPoint( this.parser ); } } class AttachPoint { constructor( p ) { this.pointCount = p.uint16; this.pointIndices = [ ...new Array( this.pointCount ) ].map( ( _ ) => p.uint16 ); } } class LigCaretList extends ParsedData { constructor( p ) { super( p ); this.coverageOffset = p.Offset16; lazy$1( this, `coverage`, () => { p.currentPosition = this.start + this.coverageOffset; return new CoverageTable( p ); } ); this.ligGlyphCount = p.uint16; this.ligGlyphOffsets = [ ...new Array( this.ligGlyphCount ) ].map( ( _ ) => p.Offset16 ); } getLigGlyph( ligGlyphID ) { this.parser.currentPosition = this.start + this.ligGlyphOffsets[ ligGlyphID ]; return new LigGlyph( this.parser ); } } class LigGlyph extends ParsedData { constructor( p ) { super( p ); this.caretCount = p.uint16; this.caretValueOffsets = [ ...new Array( this.caretCount ) ].map( ( _ ) => p.Offset16 ); } getCaretValue( caretID ) { this.parser.currentPosition = this.start + this.caretValueOffsets[ caretID ]; return new CaretValue( this.parser ); } } class CaretValue { constructor( p ) { this.caretValueFormat = p.uint16; if ( this.caretValueFormat === 1 ) { this.coordinate = p.int16; } if ( this.caretValueFormat === 2 ) { this.caretValuePointIndex = p.uint16; } if ( this.caretValueFormat === 3 ) { this.coordinate = p.int16; this.deviceOffset = p.Offset16; } } } class MarkGlyphSetsTable extends ParsedData { constructor( p ) { super( p ); this.markGlyphSetTableFormat = p.uint16; this.markGlyphSetCount = p.uint16; this.coverageOffsets = [ ...new Array( this.markGlyphSetCount ) ].map( ( _ ) => p.Offset32 ); } getMarkGlyphSet( markGlyphSetID ) { this.parser.currentPosition = this.start + this.coverageOffsets[ markGlyphSetID ]; return new CoverageTable( this.parser ); } } var GDEF$1 = Object.freeze( { __proto__: null, GDEF: GDEF } ); class ScriptList extends ParsedData { static EMPTY = { scriptCount: 0, scriptRecords: [] }; constructor( p ) { super( p ); this.scriptCount = p.uint16; this.scriptRecords = [ ...new Array( this.scriptCount ) ].map( ( _ ) => new ScriptRecord( p ) ); } } class ScriptRecord { constructor( p ) { this.scriptTag = p.tag; this.scriptOffset = p.Offset16; } } class ScriptTable extends ParsedData { constructor( p ) { super( p ); this.defaultLangSys = p.Offset16; this.langSysCount = p.uint16; this.langSysRecords = [ ...new Array( this.langSysCount ) ].map( ( _ ) => new LangSysRecord( p ) ); } } class LangSysRecord { constructor( p ) { this.langSysTag = p.tag; this.langSysOffset = p.Offset16; } } class LangSysTable { constructor( p ) { this.lookupOrder = p.Offset16; this.requiredFeatureIndex = p.uint16; this.featureIndexCount = p.uint16; this.featureIndices = [ ...new Array( this.featureIndexCount ) ].map( ( _ ) => p.uint16 ); } } class FeatureList extends ParsedData { static EMPTY = { featureCount: 0, featureRecords: [] }; constructor( p ) { super( p ); this.featureCount = p.uint16; this.featureRecords = [ ...new Array( this.featureCount ) ].map( ( _ ) => new FeatureRecord( p ) ); } } class FeatureRecord { constructor( p ) { this.featureTag = p.tag; this.featureOffset = p.Offset16; } } class FeatureTable extends ParsedData { constructor( p ) { super( p ); this.featureParams = p.Offset16; this.lookupIndexCount = p.uint16; this.lookupListIndices = [ ...new Array( this.lookupIndexCount ) ].map( ( _ ) => p.uint16 ); } getFeatureParams() { if ( this.featureParams > 0 ) { const p = this.parser; p.currentPosition = this.start + this.featureParams; const tag = this.featureTag; if ( tag === `size` ) return new Size( p ); if ( tag.startsWith( `cc` ) ) return new CharacterVariant( p ); if ( tag.startsWith( `ss` ) ) return new StylisticSet( p ); } } } class CharacterVariant { constructor( p ) { this.format = p.uint16; this.featUiLabelNameId = p.uint16; this.featUiTooltipTextNameId = p.uint16; this.sampleTextNameId = p.uint16; this.numNamedParameters = p.uint16; this.firstParamUiLabelNameId = p.uint16; this.charCount = p.uint16; this.character = [ ...new Array( this.charCount ) ].map( ( _ ) => p.uint24 ); } } class Size { constructor( p ) { this.designSize = p.uint16; this.subfamilyIdentifier = p.uint16; this.subfamilyNameID = p.uint16; this.smallEnd = p.uint16; this.largeEnd = p.uint16; } } class StylisticSet { constructor( p ) { this.version = p.uint16; this.UINameID = p.uint16; } } function undoCoverageOffsetParsing( instance ) { instance.parser.currentPosition -= 2; delete instance.coverageOffset; delete instance.getCoverageTable; } class LookupType$1 extends ParsedData { constructor( p ) { super( p ); this.substFormat = p.uint16; this.coverageOffset = p.Offset16; } getCoverageTable() { let p = this.parser; p.currentPosition = this.start + this.coverageOffset; return new CoverageTable( p ); } } class SubstLookupRecord { constructor( p ) { this.glyphSequenceIndex = p.uint16; this.lookupListIndex = p.uint16; } } class LookupType1$1 extends LookupType$1 { constructor( p ) { super( p ); this.deltaGlyphID = p.int16; } } class LookupType2$1 extends LookupType$1 { constructor( p ) { super( p ); this.sequenceCount = p.uint16; this.sequenceOffsets = [ ...new Array( this.sequenceCount ) ].map( ( _ ) => p.Offset16 ); } getSequence( index ) { let p = this.parser; p.currentPosition = this.start + this.sequenceOffsets[ index ]; return new SequenceTable( p ); } } class SequenceTable { constructor( p ) { this.glyphCount = p.uint16; this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } } class LookupType3$1 extends LookupType$1 { constructor( p ) { super( p ); this.alternateSetCount = p.uint16; this.alternateSetOffsets = [ ...new Array( this.alternateSetCount ), ].map( ( _ ) => p.Offset16 ); } getAlternateSet( index ) { let p = this.parser; p.currentPosition = this.start + this.alternateSetOffsets[ index ]; return new AlternateSetTable( p ); } } class AlternateSetTable { constructor( p ) { this.glyphCount = p.uint16; this.alternateGlyphIDs = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } } class LookupType4$1 extends LookupType$1 { constructor( p ) { super( p ); this.ligatureSetCount = p.uint16; this.ligatureSetOffsets = [ ...new Array( this.ligatureSetCount ) ].map( ( _ ) => p.Offset16 ); } getLigatureSet( index ) { let p = this.parser; p.currentPosition = this.start + this.ligatureSetOffsets[ index ]; return new LigatureSetTable( p ); } } class LigatureSetTable extends ParsedData { constructor( p ) { super( p ); this.ligatureCount = p.uint16; this.ligatureOffsets = [ ...new Array( this.ligatureCount ) ].map( ( _ ) => p.Offset16 ); } getLigature( index ) { let p = this.parser; p.currentPosition = this.start + this.ligatureOffsets[ index ]; return new LigatureTable( p ); } } class LigatureTable { constructor( p ) { this.ligatureGlyph = p.uint16; this.componentCount = p.uint16; this.componentGlyphIDs = [ ...new Array( this.componentCount - 1 ), ].map( ( _ ) => p.uint16 ); } } class LookupType5$1 extends LookupType$1 { constructor( p ) { super( p ); if ( this.substFormat === 1 ) { this.subRuleSetCount = p.uint16; this.subRuleSetOffsets = [ ...new Array( this.subRuleSetCount ), ].map( ( _ ) => p.Offset16 ); } if ( this.substFormat === 2 ) { this.classDefOffset = p.Offset16; this.subClassSetCount = p.uint16; this.subClassSetOffsets = [ ...new Array( this.subClassSetCount ), ].map( ( _ ) => p.Offset16 ); } if ( this.substFormat === 3 ) { undoCoverageOffsetParsing( this ); this.glyphCount = p.uint16; this.substitutionCount = p.uint16; this.coverageOffsets = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.Offset16 ); this.substLookupRecords = [ ...new Array( this.substitutionCount ), ].map( ( _ ) => new SubstLookupRecord( p ) ); } } getSubRuleSet( index ) { if ( this.substFormat !== 1 ) throw new Error( `lookup type 5.${ this.substFormat } has no subrule sets.` ); let p = this.parser; p.currentPosition = this.start + this.subRuleSetOffsets[ index ]; return new SubRuleSetTable( p ); } getSubClassSet( index ) { if ( this.substFormat !== 2 ) throw new Error( `lookup type 5.${ this.substFormat } has no subclass sets.` ); let p = this.parser; p.currentPosition = this.start + this.subClassSetOffsets[ index ]; return new SubClassSetTable( p ); } getCoverageTable( index ) { if ( this.substFormat !== 3 && ! index ) return super.getCoverageTable(); if ( ! index ) throw new Error( `lookup type 5.${ this.substFormat } requires an coverage table index.` ); let p = this.parser; p.currentPosition = this.start + this.coverageOffsets[ index ]; return new CoverageTable( p ); } } class SubRuleSetTable extends ParsedData { constructor( p ) { super( p ); this.subRuleCount = p.uint16; this.subRuleOffsets = [ ...new Array( this.subRuleCount ) ].map( ( _ ) => p.Offset16 ); } getSubRule( index ) { let p = this.parser; p.currentPosition = this.start + this.subRuleOffsets[ index ]; return new SubRuleTable( p ); } } class SubRuleTable { constructor( p ) { this.glyphCount = p.uint16; this.substitutionCount = p.uint16; this.inputSequence = [ ...new Array( this.glyphCount - 1 ) ].map( ( _ ) => p.uint16 ); this.substLookupRecords = [ ...new Array( this.substitutionCount ), ].map( ( _ ) => new SubstLookupRecord( p ) ); } } class SubClassSetTable extends ParsedData { constructor( p ) { super( p ); this.subClassRuleCount = p.uint16; this.subClassRuleOffsets = [ ...new Array( this.subClassRuleCount ), ].map( ( _ ) => p.Offset16 ); } getSubClass( index ) { let p = this.parser; p.currentPosition = this.start + this.subClassRuleOffsets[ index ]; return new SubClassRuleTable( p ); } } class SubClassRuleTable extends SubRuleTable { constructor( p ) { super( p ); } } class LookupType6$1 extends LookupType$1 { constructor( p ) { super( p ); if ( this.substFormat === 1 ) { this.chainSubRuleSetCount = p.uint16; this.chainSubRuleSetOffsets = [ ...new Array( this.chainSubRuleSetCount ), ].map( ( _ ) => p.Offset16 ); } if ( this.substFormat === 2 ) { this.backtrackClassDefOffset = p.Offset16; this.inputClassDefOffset = p.Offset16; this.lookaheadClassDefOffset = p.Offset16; this.chainSubClassSetCount = p.uint16; this.chainSubClassSetOffsets = [ ...new Array( this.chainSubClassSetCount ), ].map( ( _ ) => p.Offset16 ); } if ( this.substFormat === 3 ) { undoCoverageOffsetParsing( this ); this.backtrackGlyphCount = p.uint16; this.backtrackCoverageOffsets = [ ...new Array( this.backtrackGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.inputGlyphCount = p.uint16; this.inputCoverageOffsets = [ ...new Array( this.inputGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.lookaheadGlyphCount = p.uint16; this.lookaheadCoverageOffsets = [ ...new Array( this.lookaheadGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.seqLookupCount = p.uint16; this.seqLookupRecords = [ ...new Array( this.substitutionCount ), ].map( ( _ ) => new SequenceLookupRecord( p ) ); } } getChainSubRuleSet( index ) { if ( this.substFormat !== 1 ) throw new Error( `lookup type 6.${ this.substFormat } has no chainsubrule sets.` ); let p = this.parser; p.currentPosition = this.start + this.chainSubRuleSetOffsets[ index ]; return new ChainSubRuleSetTable( p ); } getChainSubClassSet( index ) { if ( this.substFormat !== 2 ) throw new Error( `lookup type 6.${ this.substFormat } has no chainsubclass sets.` ); let p = this.parser; p.currentPosition = this.start + this.chainSubClassSetOffsets[ index ]; return new ChainSubClassSetTable( p ); } getCoverageFromOffset( offset ) { if ( this.substFormat !== 3 ) throw new Error( `lookup type 6.${ this.substFormat } does not use contextual coverage offsets.` ); let p = this.parser; p.currentPosition = this.start + offset; return new CoverageTable( p ); } } class ChainSubRuleSetTable extends ParsedData { constructor( p ) { super( p ); this.chainSubRuleCount = p.uint16; this.chainSubRuleOffsets = [ ...new Array( this.chainSubRuleCount ), ].map( ( _ ) => p.Offset16 ); } getSubRule( index ) { let p = this.parser; p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; return new ChainSubRuleTable( p ); } } class ChainSubRuleTable { constructor( p ) { this.backtrackGlyphCount = p.uint16; this.backtrackSequence = [ ...new Array( this.backtrackGlyphCount ), ].map( ( _ ) => p.uint16 ); this.inputGlyphCount = p.uint16; this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( ( _ ) => p.uint16 ); this.lookaheadGlyphCount = p.uint16; this.lookAheadSequence = [ ...new Array( this.lookAheadGlyphCount ), ].map( ( _ ) => p.uint16 ); this.substitutionCount = p.uint16; this.substLookupRecords = [ ...new Array( this.SubstCount ) ].map( ( _ ) => new SubstLookupRecord( p ) ); } } class ChainSubClassSetTable extends ParsedData { constructor( p ) { super( p ); this.chainSubClassRuleCount = p.uint16; this.chainSubClassRuleOffsets = [ ...new Array( this.chainSubClassRuleCount ), ].map( ( _ ) => p.Offset16 ); } getSubClass( index ) { let p = this.parser; p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; return new ChainSubClassRuleTable( p ); } } class ChainSubClassRuleTable { constructor( p ) { this.backtrackGlyphCount = p.uint16; this.backtrackSequence = [ ...new Array( this.backtrackGlyphCount ), ].map( ( _ ) => p.uint16 ); this.inputGlyphCount = p.uint16; this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( ( _ ) => p.uint16 ); this.lookaheadGlyphCount = p.uint16; this.lookAheadSequence = [ ...new Array( this.lookAheadGlyphCount ), ].map( ( _ ) => p.uint16 ); this.substitutionCount = p.uint16; this.substLookupRecords = [ ...new Array( this.substitutionCount ), ].map( ( _ ) => new SequenceLookupRecord( p ) ); } } class SequenceLookupRecord extends ParsedData { constructor( p ) { super( p ); this.sequenceIndex = p.uint16; this.lookupListIndex = p.uint16; } } class LookupType7$1 extends ParsedData { constructor( p ) { super( p ); this.substFormat = p.uint16; this.extensionLookupType = p.uint16; this.extensionOffset = p.Offset32; } } class LookupType8$1 extends LookupType$1 { constructor( p ) { super( p ); this.backtrackGlyphCount = p.uint16; this.backtrackCoverageOffsets = [ ...new Array( this.backtrackGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.lookaheadGlyphCount = p.uint16; this.lookaheadCoverageOffsets = [ new Array( this.lookaheadGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.glyphCount = p.uint16; this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } } var GSUBtables = { buildSubtable: function ( type, p ) { const subtable = new [ undefined, LookupType1$1, LookupType2$1, LookupType3$1, LookupType4$1, LookupType5$1, LookupType6$1, LookupType7$1, LookupType8$1, ][ type ]( p ); subtable.type = type; return subtable; }, }; class LookupType extends ParsedData { constructor( p ) { super( p ); } } class LookupType1 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 1` ); } } class LookupType2 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 2` ); } } class LookupType3 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 3` ); } } class LookupType4 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 4` ); } } class LookupType5 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 5` ); } } class LookupType6 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 6` ); } } class LookupType7 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 7` ); } } class LookupType8 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 8` ); } } class LookupType9 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 9` ); } } var GPOStables = { buildSubtable: function ( type, p ) { const subtable = new [ undefined, LookupType1, LookupType2, LookupType3, LookupType4, LookupType5, LookupType6, LookupType7, LookupType8, LookupType9, ][ type ]( p ); subtable.type = type; return subtable; }, }; class LookupList extends ParsedData { static EMPTY = { lookupCount: 0, lookups: [] }; constructor( p ) { super( p ); this.lookupCount = p.uint16; this.lookups = [ ...new Array( this.lookupCount ) ].map( ( _ ) => p.Offset16 ); } } class LookupTable extends ParsedData { constructor( p, type ) { super( p ); this.ctType = type; this.lookupType = p.uint16; this.lookupFlag = p.uint16; this.subTableCount = p.uint16; this.subtableOffsets = [ ...new Array( this.subTableCount ) ].map( ( _ ) => p.Offset16 ); this.markFilteringSet = p.uint16; } get rightToLeft() { return this.lookupFlag & ( 1 === 1 ); } get ignoreBaseGlyphs() { return this.lookupFlag & ( 2 === 2 ); } get ignoreLigatures() { return this.lookupFlag & ( 4 === 4 ); } get ignoreMarks() { return this.lookupFlag & ( 8 === 8 ); } get useMarkFilteringSet() { return this.lookupFlag & ( 16 === 16 ); } get markAttachmentType() { return this.lookupFlag & ( 65280 === 65280 ); } getSubTable( index ) { const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables; this.parser.currentPosition = this.start + this.subtableOffsets[ index ]; return builder.buildSubtable( this.lookupType, this.parser ); } } class CommonLayoutTable extends SimpleTable { constructor( dict, dataview, name ) { const { p: p, tableStart: tableStart } = super( dict, dataview, name ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.scriptListOffset = p.Offset16; this.featureListOffset = p.Offset16; this.lookupListOffset = p.Offset16; if ( this.majorVersion === 1 && this.minorVersion === 1 ) { this.featureVariationsOffset = p.Offset32; } const no_content = ! ( this.scriptListOffset || this.featureListOffset || this.lookupListOffset ); lazy$1( this, `scriptList`, () => { if ( no_content ) return ScriptList.EMPTY; p.currentPosition = tableStart + this.scriptListOffset; return new ScriptList( p ); } ); lazy$1( this, `featureList`, () => { if ( no_content ) return FeatureList.EMPTY; p.currentPosition = tableStart + this.featureListOffset; return new FeatureList( p ); } ); lazy$1( this, `lookupList`, () => { if ( no_content ) return LookupList.EMPTY; p.currentPosition = tableStart + this.lookupListOffset; return new LookupList( p ); } ); if ( this.featureVariationsOffset ) { lazy$1( this, `featureVariations`, () => { if ( no_content ) return FeatureVariations.EMPTY; p.currentPosition = tableStart + this.featureVariationsOffset; return new FeatureVariations( p ); } ); } } getSupportedScripts() { return this.scriptList.scriptRecords.map( ( r ) => r.scriptTag ); } getScriptTable( scriptTag ) { let record = this.scriptList.scriptRecords.find( ( r ) => r.scriptTag === scriptTag ); this.parser.currentPosition = this.scriptList.start + record.scriptOffset; let table = new ScriptTable( this.parser ); table.scriptTag = scriptTag; return table; } ensureScriptTable( arg ) { if ( typeof arg === 'string' ) { return this.getScriptTable( arg ); } return arg; } getSupportedLangSys( scriptTable ) { scriptTable = this.ensureScriptTable( scriptTable ); const hasDefault = scriptTable.defaultLangSys !== 0; const supported = scriptTable.langSysRecords.map( ( l ) => l.langSysTag ); if ( hasDefault ) supported.unshift( `dflt` ); return supported; } getDefaultLangSysTable( scriptTable ) { scriptTable = this.ensureScriptTable( scriptTable ); let offset = scriptTable.defaultLangSys; if ( offset !== 0 ) { this.parser.currentPosition = scriptTable.start + offset; let table = new LangSysTable( this.parser ); table.langSysTag = ``; table.defaultForScript = scriptTable.scriptTag; return table; } } getLangSysTable( scriptTable, langSysTag = `dflt` ) { if ( langSysTag === `dflt` ) return this.getDefaultLangSysTable( scriptTable ); scriptTable = this.ensureScriptTable( scriptTable ); let record = scriptTable.langSysRecords.find( ( l ) => l.langSysTag === langSysTag ); this.parser.currentPosition = scriptTable.start + record.langSysOffset; let table = new LangSysTable( this.parser ); table.langSysTag = langSysTag; return table; } getFeatures( langSysTable ) { return langSysTable.featureIndices.map( ( index ) => this.getFeature( index ) ); } getFeature( indexOrTag ) { let record; if ( parseInt( indexOrTag ) == indexOrTag ) { record = this.featureList.featureRecords[ indexOrTag ]; } else { record = this.featureList.featureRecords.find( ( f ) => f.featureTag === indexOrTag ); } if ( ! record ) return; this.parser.currentPosition = this.featureList.start + record.featureOffset; let table = new FeatureTable( this.parser ); table.featureTag = record.featureTag; return table; } getLookups( featureTable ) { return featureTable.lookupListIndices.map( ( index ) => this.getLookup( index ) ); } getLookup( lookupIndex, type ) { let lookupOffset = this.lookupList.lookups[ lookupIndex ]; this.parser.currentPosition = this.lookupList.start + lookupOffset; return new LookupTable( this.parser, type ); } } class GSUB extends CommonLayoutTable { constructor( dict, dataview ) { super( dict, dataview, `GSUB` ); } getLookup( lookupIndex ) { return super.getLookup( lookupIndex, `GSUB` ); } } var GSUB$1 = Object.freeze( { __proto__: null, GSUB: GSUB } ); class GPOS extends CommonLayoutTable { constructor( dict, dataview ) { super( dict, dataview, `GPOS` ); } getLookup( lookupIndex ) { return super.getLookup( lookupIndex, `GPOS` ); } } var GPOS$1 = Object.freeze( { __proto__: null, GPOS: GPOS } ); class SVG extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.offsetToSVGDocumentList = p.Offset32; p.currentPosition = this.tableStart + this.offsetToSVGDocumentList; this.documentList = new SVGDocumentList( p ); } } class SVGDocumentList extends ParsedData { constructor( p ) { super( p ); this.numEntries = p.uint16; this.documentRecords = [ ...new Array( this.numEntries ) ].map( ( _ ) => new SVGDocumentRecord( p ) ); } getDocument( documentID ) { let record = this.documentRecords[ documentID ]; if ( ! record ) return ''; let offset = this.start + record.svgDocOffset; this.parser.currentPosition = offset; return this.parser.readBytes( record.svgDocLength ); } getDocumentForGlyph( glyphID ) { let id = this.documentRecords.findIndex( ( d ) => d.startGlyphID <= glyphID && glyphID <= d.endGlyphID ); if ( id === -1 ) return ''; return this.getDocument( id ); } } class SVGDocumentRecord { constructor( p ) { this.startGlyphID = p.uint16; this.endGlyphID = p.uint16; this.svgDocOffset = p.Offset32; this.svgDocLength = p.uint32; } } var SVG$1 = Object.freeze( { __proto__: null, SVG: SVG } ); class fvar extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.axesArrayOffset = p.Offset16; p.uint16; this.axisCount = p.uint16; this.axisSize = p.uint16; this.instanceCount = p.uint16; this.instanceSize = p.uint16; const axisStart = this.tableStart + this.axesArrayOffset; lazy$1( this, `axes`, () => { p.currentPosition = axisStart; return [ ...new Array( this.axisCount ) ].map( ( _ ) => new VariationAxisRecord( p ) ); } ); const instanceStart = axisStart + this.axisCount * this.axisSize; lazy$1( this, `instances`, () => { let instances = []; for ( let i = 0; i < this.instanceCount; i++ ) { p.currentPosition = instanceStart + i * this.instanceSize; instances.push( new InstanceRecord( p, this.axisCount, this.instanceSize ) ); } return instances; } ); } getSupportedAxes() { return this.axes.map( ( a ) => a.tag ); } getAxis( name ) { return this.axes.find( ( a ) => a.tag === name ); } } class VariationAxisRecord { constructor( p ) { this.tag = p.tag; this.minValue = p.fixed; this.defaultValue = p.fixed; this.maxValue = p.fixed; this.flags = p.flags( 16 ); this.axisNameID = p.uint16; } } class InstanceRecord { constructor( p, axisCount, size ) { let start = p.currentPosition; this.subfamilyNameID = p.uint16; p.uint16; this.coordinates = [ ...new Array( axisCount ) ].map( ( _ ) => p.fixed ); if ( p.currentPosition - start < size ) { this.postScriptNameID = p.uint16; } } } var fvar$1 = Object.freeze( { __proto__: null, fvar: fvar } ); class cvt extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); const n = dict.length / 2; lazy$1( this, `items`, () => [ ...new Array( n ) ].map( ( _ ) => p.fword ) ); } } var cvt$1 = Object.freeze( { __proto__: null, cvt: cvt } ); class fpgm extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); lazy$1( this, `instructions`, () => [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) ); } } var fpgm$1 = Object.freeze( { __proto__: null, fpgm: fpgm } ); class gasp extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numRanges = p.uint16; const getter = () => [ ...new Array( this.numRanges ) ].map( ( _ ) => new GASPRange( p ) ); lazy$1( this, `gaspRanges`, getter ); } } class GASPRange { constructor( p ) { this.rangeMaxPPEM = p.uint16; this.rangeGaspBehavior = p.uint16; } } var gasp$1 = Object.freeze( { __proto__: null, gasp: gasp } ); class glyf extends SimpleTable { constructor( dict, dataview ) { super( dict, dataview ); } getGlyphData( offset, length ) { this.parser.currentPosition = this.tableStart + offset; return this.parser.readBytes( length ); } } var glyf$1 = Object.freeze( { __proto__: null, glyf: glyf } ); class loca extends SimpleTable { constructor( dict, dataview, tables ) { const { p: p } = super( dict, dataview ); const n = tables.maxp.numGlyphs + 1; if ( tables.head.indexToLocFormat === 0 ) { this.x2 = true; lazy$1( this, `offsets`, () => [ ...new Array( n ) ].map( ( _ ) => p.Offset16 ) ); } else { lazy$1( this, `offsets`, () => [ ...new Array( n ) ].map( ( _ ) => p.Offset32 ) ); } } getGlyphDataOffsetAndLength( glyphID ) { let offset = this.offsets[ glyphID ] * this.x2 ? 2 : 1; let nextOffset = this.offsets[ glyphID + 1 ] * this.x2 ? 2 : 1; return { offset: offset, length: nextOffset - offset }; } } var loca$1 = Object.freeze( { __proto__: null, loca: loca } ); class prep extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); lazy$1( this, `instructions`, () => [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) ); } } var prep$1 = Object.freeze( { __proto__: null, prep: prep } ); class CFF extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); lazy$1( this, `data`, () => p.readBytes() ); } } var CFF$1 = Object.freeze( { __proto__: null, CFF: CFF } ); class CFF2 extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); lazy$1( this, `data`, () => p.readBytes() ); } } var CFF2$1 = Object.freeze( { __proto__: null, CFF2: CFF2 } ); class VORG extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.defaultVertOriginY = p.int16; this.numVertOriginYMetrics = p.uint16; lazy$1( this, `vertORiginYMetrics`, () => [ ...new Array( this.numVertOriginYMetrics ) ].map( ( _ ) => new VertOriginYMetric( p ) ) ); } } class VertOriginYMetric { constructor( p ) { this.glyphIndex = p.uint16; this.vertOriginY = p.int16; } } var VORG$1 = Object.freeze( { __proto__: null, VORG: VORG } ); class BitmapSize { constructor( p ) { this.indexSubTableArrayOffset = p.Offset32; this.indexTablesSize = p.uint32; this.numberofIndexSubTables = p.uint32; this.colorRef = p.uint32; this.hori = new SbitLineMetrics( p ); this.vert = new SbitLineMetrics( p ); this.startGlyphIndex = p.uint16; this.endGlyphIndex = p.uint16; this.ppemX = p.uint8; this.ppemY = p.uint8; this.bitDepth = p.uint8; this.flags = p.int8; } } class BitmapScale { constructor( p ) { this.hori = new SbitLineMetrics( p ); this.vert = new SbitLineMetrics( p ); this.ppemX = p.uint8; this.ppemY = p.uint8; this.substitutePpemX = p.uint8; this.substitutePpemY = p.uint8; } } class SbitLineMetrics { constructor( p ) { this.ascender = p.int8; this.descender = p.int8; this.widthMax = p.uint8; this.caretSlopeNumerator = p.int8; this.caretSlopeDenominator = p.int8; this.caretOffset = p.int8; this.minOriginSB = p.int8; this.minAdvanceSB = p.int8; this.maxBeforeBL = p.int8; this.minAfterBL = p.int8; this.pad1 = p.int8; this.pad2 = p.int8; } } class EBLC extends SimpleTable { constructor( dict, dataview, name ) { const { p: p } = super( dict, dataview, name ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.numSizes = p.uint32; lazy$1( this, `bitMapSizes`, () => [ ...new Array( this.numSizes ) ].map( ( _ ) => new BitmapSize( p ) ) ); } } var EBLC$1 = Object.freeze( { __proto__: null, EBLC: EBLC } ); class EBDT extends SimpleTable { constructor( dict, dataview, name ) { const { p: p } = super( dict, dataview, name ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; } } var EBDT$1 = Object.freeze( { __proto__: null, EBDT: EBDT } ); class EBSC extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.numSizes = p.uint32; lazy$1( this, `bitmapScales`, () => [ ...new Array( this.numSizes ) ].map( ( _ ) => new BitmapScale( p ) ) ); } } var EBSC$1 = Object.freeze( { __proto__: null, EBSC: EBSC } ); class CBLC extends EBLC { constructor( dict, dataview ) { super( dict, dataview, `CBLC` ); } } var CBLC$1 = Object.freeze( { __proto__: null, CBLC: CBLC } ); class CBDT extends EBDT { constructor( dict, dataview ) { super( dict, dataview, `CBDT` ); } } var CBDT$1 = Object.freeze( { __proto__: null, CBDT: CBDT } ); class sbix extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.flags = p.flags( 16 ); this.numStrikes = p.uint32; lazy$1( this, `strikeOffsets`, () => [ ...new Array( this.numStrikes ) ].map( ( _ ) => p.Offset32 ) ); } } var sbix$1 = Object.freeze( { __proto__: null, sbix: sbix } ); class COLR extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numBaseGlyphRecords = p.uint16; this.baseGlyphRecordsOffset = p.Offset32; this.layerRecordsOffset = p.Offset32; this.numLayerRecords = p.uint16; } getBaseGlyphRecord( glyphID ) { let start = this.tableStart + this.baseGlyphRecordsOffset; this.parser.currentPosition = start; let first = new BaseGlyphRecord( this.parser ); let firstID = first.gID; let end = this.tableStart + this.layerRecordsOffset - 6; this.parser.currentPosition = end; let last = new BaseGlyphRecord( this.parser ); let lastID = last.gID; if ( firstID === glyphID ) return first; if ( lastID === glyphID ) return last; while ( true ) { if ( start === end ) break; let mid = start + ( end - start ) / 12; this.parser.currentPosition = mid; let middle = new BaseGlyphRecord( this.parser ); let midID = middle.gID; if ( midID === glyphID ) return middle; else if ( midID > glyphID ) { end = mid; } else if ( midID < glyphID ) { start = mid; } } return false; } getLayers( glyphID ) { let record = this.getBaseGlyphRecord( glyphID ); this.parser.currentPosition = this.tableStart + this.layerRecordsOffset + 4 * record.firstLayerIndex; return [ ...new Array( record.numLayers ) ].map( ( _ ) => new LayerRecord( p ) ); } } class BaseGlyphRecord { constructor( p ) { this.gID = p.uint16; this.firstLayerIndex = p.uint16; this.numLayers = p.uint16; } } class LayerRecord { constructor( p ) { this.gID = p.uint16; this.paletteIndex = p.uint16; } } var COLR$1 = Object.freeze( { __proto__: null, COLR: COLR } ); class CPAL extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numPaletteEntries = p.uint16; const numPalettes = ( this.numPalettes = p.uint16 ); this.numColorRecords = p.uint16; this.offsetFirstColorRecord = p.Offset32; this.colorRecordIndices = [ ...new Array( this.numPalettes ) ].map( ( _ ) => p.uint16 ); lazy$1( this, `colorRecords`, () => { p.currentPosition = this.tableStart + this.offsetFirstColorRecord; return [ ...new Array( this.numColorRecords ) ].map( ( _ ) => new ColorRecord( p ) ); } ); if ( this.version === 1 ) { this.offsetPaletteTypeArray = p.Offset32; this.offsetPaletteLabelArray = p.Offset32; this.offsetPaletteEntryLabelArray = p.Offset32; lazy$1( this, `paletteTypeArray`, () => { p.currentPosition = this.tableStart + this.offsetPaletteTypeArray; return new PaletteTypeArray( p, numPalettes ); } ); lazy$1( this, `paletteLabelArray`, () => { p.currentPosition = this.tableStart + this.offsetPaletteLabelArray; return new PaletteLabelsArray( p, numPalettes ); } ); lazy$1( this, `paletteEntryLabelArray`, () => { p.currentPosition = this.tableStart + this.offsetPaletteEntryLabelArray; return new PaletteEntryLabelArray( p, numPalettes ); } ); } } } class ColorRecord { constructor( p ) { this.blue = p.uint8; this.green = p.uint8; this.red = p.uint8; this.alpha = p.uint8; } } class PaletteTypeArray { constructor( p, numPalettes ) { this.paletteTypes = [ ...new Array( numPalettes ) ].map( ( _ ) => p.uint32 ); } } class PaletteLabelsArray { constructor( p, numPalettes ) { this.paletteLabels = [ ...new Array( numPalettes ) ].map( ( _ ) => p.uint16 ); } } class PaletteEntryLabelArray { constructor( p, numPalettes ) { this.paletteEntryLabels = [ ...new Array( numPalettes ) ].map( ( _ ) => p.uint16 ); } } var CPAL$1 = Object.freeze( { __proto__: null, CPAL: CPAL } ); class DSIG extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint32; this.numSignatures = p.uint16; this.flags = p.uint16; this.signatureRecords = [ ...new Array( this.numSignatures ) ].map( ( _ ) => new SignatureRecord( p ) ); } getData( signatureID ) { const record = this.signatureRecords[ signatureID ]; this.parser.currentPosition = this.tableStart + record.offset; return new SignatureBlockFormat1( this.parser ); } } class SignatureRecord { constructor( p ) { this.format = p.uint32; this.length = p.uint32; this.offset = p.Offset32; } } class SignatureBlockFormat1 { constructor( p ) { p.uint16; p.uint16; this.signatureLength = p.uint32; this.signature = p.readBytes( this.signatureLength ); } } var DSIG$1 = Object.freeze( { __proto__: null, DSIG: DSIG } ); class hdmx extends SimpleTable { constructor( dict, dataview, tables ) { const { p: p } = super( dict, dataview ); const numGlyphs = tables.hmtx.numGlyphs; this.version = p.uint16; this.numRecords = p.int16; this.sizeDeviceRecord = p.int32; this.records = [ ...new Array( numRecords ) ].map( ( _ ) => new DeviceRecord( p, numGlyphs ) ); } } class DeviceRecord { constructor( p, numGlyphs ) { this.pixelSize = p.uint8; this.maxWidth = p.uint8; this.widths = p.readBytes( numGlyphs ); } } var hdmx$1 = Object.freeze( { __proto__: null, hdmx: hdmx } ); class kern extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.nTables = p.uint16; lazy$1( this, `tables`, () => { let offset = this.tableStart + 4; const tables = []; for ( let i = 0; i < this.nTables; i++ ) { p.currentPosition = offset; let subtable = new KernSubTable( p ); tables.push( subtable ); offset += subtable; } return tables; } ); } } class KernSubTable { constructor( p ) { this.version = p.uint16; this.length = p.uint16; this.coverage = p.flags( 8 ); this.format = p.uint8; if ( this.format === 0 ) { this.nPairs = p.uint16; this.searchRange = p.uint16; this.entrySelector = p.uint16; this.rangeShift = p.uint16; lazy$1( this, `pairs`, () => [ ...new Array( this.nPairs ) ].map( ( _ ) => new Pair( p ) ) ); } if ( this.format === 2 ) { console.warn( `Kern subtable format 2 is not supported: this parser currently only parses universal table data.` ); } } get horizontal() { return this.coverage[ 0 ]; } get minimum() { return this.coverage[ 1 ]; } get crossstream() { return this.coverage[ 2 ]; } get override() { return this.coverage[ 3 ]; } } class Pair { constructor( p ) { this.left = p.uint16; this.right = p.uint16; this.value = p.fword; } } var kern$1 = Object.freeze( { __proto__: null, kern: kern } ); class LTSH extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numGlyphs = p.uint16; this.yPels = p.readBytes( this.numGlyphs ); } } var LTSH$1 = Object.freeze( { __proto__: null, LTSH: LTSH } ); class MERG extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.mergeClassCount = p.uint16; this.mergeDataOffset = p.Offset16; this.classDefCount = p.uint16; this.offsetToClassDefOffsets = p.Offset16; lazy$1( this, `mergeEntryMatrix`, () => [ ...new Array( this.mergeClassCount ) ].map( ( _ ) => p.readBytes( this.mergeClassCount ) ) ); console.warn( `Full MERG parsing is currently not supported.` ); console.warn( `If you need this table parsed, please file an issue, or better yet, a PR.` ); } } var MERG$1 = Object.freeze( { __proto__: null, MERG: MERG } ); class meta extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint32; this.flags = p.uint32; p.uint32; this.dataMapsCount = p.uint32; this.dataMaps = [ ...new Array( this.dataMapsCount ) ].map( ( _ ) => new DataMap( this.tableStart, p ) ); } } class DataMap { constructor( tableStart, p ) { this.tableStart = tableStart; this.parser = p; this.tag = p.tag; this.dataOffset = p.Offset32; this.dataLength = p.uint32; } getData() { this.parser.currentField = this.tableStart + this.dataOffset; return this.parser.readBytes( this.dataLength ); } } var meta$1 = Object.freeze( { __proto__: null, meta: meta } ); class PCLT extends SimpleTable { constructor( dict, dataview ) { super( dict, dataview ); console.warn( `This font uses a PCLT table, which is currently not supported by this parser.` ); console.warn( `If you need this table parsed, please file an issue, or better yet, a PR.` ); } } var PCLT$1 = Object.freeze( { __proto__: null, PCLT: PCLT } ); class VDMX extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numRecs = p.uint16; this.numRatios = p.uint16; this.ratRanges = [ ...new Array( this.numRatios ) ].map( ( _ ) => new RatioRange( p ) ); this.offsets = [ ...new Array( this.numRatios ) ].map( ( _ ) => p.Offset16 ); this.VDMXGroups = [ ...new Array( this.numRecs ) ].map( ( _ ) => new VDMXGroup( p ) ); } } class RatioRange { constructor( p ) { this.bCharSet = p.uint8; this.xRatio = p.uint8; this.yStartRatio = p.uint8; this.yEndRatio = p.uint8; } } class VDMXGroup { constructor( p ) { this.recs = p.uint16; this.startsz = p.uint8; this.endsz = p.uint8; this.records = [ ...new Array( this.recs ) ].map( ( _ ) => new vTable( p ) ); } } class vTable { constructor( p ) { this.yPelHeight = p.uint16; this.yMax = p.int16; this.yMin = p.int16; } } var VDMX$1 = Object.freeze( { __proto__: null, VDMX: VDMX } ); class vhea extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.fixed; this.ascent = this.vertTypoAscender = p.int16; this.descent = this.vertTypoDescender = p.int16; this.lineGap = this.vertTypoLineGap = p.int16; this.advanceHeightMax = p.int16; this.minTopSideBearing = p.int16; this.minBottomSideBearing = p.int16; this.yMaxExtent = p.int16; this.caretSlopeRise = p.int16; this.caretSlopeRun = p.int16; this.caretOffset = p.int16; this.reserved = p.int16; this.reserved = p.int16; this.reserved = p.int16; this.reserved = p.int16; this.metricDataFormat = p.int16; this.numOfLongVerMetrics = p.uint16; p.verifyLength(); } } var vhea$1 = Object.freeze( { __proto__: null, vhea: vhea } ); class vmtx extends SimpleTable { constructor( dict, dataview, tables ) { super( dict, dataview ); const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics; const numGlyphs = tables.maxp.numGlyphs; const metricsStart = p.currentPosition; lazy( this, `vMetrics`, () => { p.currentPosition = metricsStart; return [ ...new Array( numOfLongVerMetrics ) ].map( ( _ ) => new LongVertMetric( p.uint16, p.int16 ) ); } ); if ( numOfLongVerMetrics < numGlyphs ) { const tsbStart = metricsStart + numOfLongVerMetrics * 4; lazy( this, `topSideBearings`, () => { p.currentPosition = tsbStart; return [ ...new Array( numGlyphs - numOfLongVerMetrics ) ].map( ( _ ) => p.int16 ); } ); } } } class LongVertMetric { constructor( h, b ) { this.advanceHeight = h; this.topSideBearing = b; } } var vmtx$1 = Object.freeze( { __proto__: null, vmtx: vmtx } ); /* eslint-enable */ ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js /** * WordPress dependencies */ /** * Internal dependencies */ const { kebabCase: make_families_from_faces_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function makeFamiliesFromFaces(fontFaces) { const fontFamiliesObject = fontFaces.reduce((acc, item) => { if (!acc[item.fontFamily]) { acc[item.fontFamily] = { name: item.fontFamily, fontFamily: item.fontFamily, slug: make_families_from_faces_kebabCase(item.fontFamily.toLowerCase()), fontFace: [] }; } acc[item.fontFamily].fontFace.push(item); return acc; }, {}); return Object.values(fontFamiliesObject); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/upload-fonts.js /** * WordPress dependencies */ /** * Internal dependencies */ function UploadFonts() { const { installFonts } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); const handleDropZone = files => { handleFilesUpload(files); }; const onFilesUpload = event => { handleFilesUpload(event.target.files); }; /** * Filters the selected files to only allow the ones with the allowed extensions * * @param {Array} files The files to be filtered * @return {void} */ const handleFilesUpload = async files => { setNotice(null); setIsUploading(true); const uniqueFilenames = new Set(); const selectedFiles = [...files]; let hasInvalidFiles = false; // Use map to create a promise for each file check, then filter with Promise.all. const checkFilesPromises = selectedFiles.map(async file => { const isFont = await isFontFile(file); if (!isFont) { hasInvalidFiles = true; return null; // Return null for invalid files. } // Check for duplicates if (uniqueFilenames.has(file.name)) { return null; // Return null for duplicates. } // Check if the file extension is allowed. const fileExtension = file.name.split('.').pop().toLowerCase(); if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) { uniqueFilenames.add(file.name); return file; // Return the file if it passes all checks. } return null; // Return null for disallowed file extensions. }); // Filter out the nulls after all promises have resolved. const allowedFiles = (await Promise.all(checkFilesPromises)).filter(file => null !== file); if (allowedFiles.length > 0) { loadFiles(allowedFiles); } else { const message = hasInvalidFiles ? (0,external_wp_i18n_namespaceObject.__)('Sorry, you are not allowed to upload this file type.') : (0,external_wp_i18n_namespaceObject.__)('No fonts found to install.'); setNotice({ type: 'error', message }); setIsUploading(false); } }; /** * Loads the selected files and reads the font metadata * * @param {Array} files The files to be loaded * @return {void} */ const loadFiles = async files => { const fontFacesLoaded = await Promise.all(files.map(async fontFile => { const fontFaceData = await getFontFaceMetadata(fontFile); await loadFontFaceInBrowser(fontFaceData, fontFaceData.file, 'all'); return fontFaceData; })); handleInstall(fontFacesLoaded); }; /** * Checks if a file is a valid Font file. * * @param {File} file The file to be checked. * @return {boolean} Whether the file is a valid font file. */ async function isFontFile(file) { const font = new Font('Uploaded Font'); try { const buffer = await readFileAsArrayBuffer(file); await font.fromDataBuffer(buffer, 'font'); return true; } catch (error) { return false; } } // Create a function to read the file as array buffer async function readFileAsArrayBuffer(file) { return new Promise((resolve, reject) => { const reader = new window.FileReader(); reader.readAsArrayBuffer(file); reader.onload = () => resolve(reader.result); reader.onerror = reject; }); } const getFontFaceMetadata = async fontFile => { const buffer = await readFileAsArrayBuffer(fontFile); const fontObj = new Font('Uploaded Font'); fontObj.fromDataBuffer(buffer, fontFile.name); // Assuming that fromDataBuffer triggers onload event and returning a Promise const onloadEvent = await new Promise(resolve => fontObj.onload = resolve); const font = onloadEvent.detail.font; const { name } = font.opentype.tables; const fontName = name.get(16) || name.get(1); const isItalic = name.get(2).toLowerCase().includes('italic'); const fontWeight = font.opentype.tables['OS/2'].usWeightClass || 'normal'; const isVariable = !!font.opentype.tables.fvar; const weightAxis = isVariable && font.opentype.tables.fvar.axes.find(({ tag }) => tag === 'wght'); const weightRange = weightAxis ? `${weightAxis.minValue} ${weightAxis.maxValue}` : null; return { file: fontFile, fontFamily: fontName, fontStyle: isItalic ? 'italic' : 'normal', fontWeight: weightRange || fontWeight }; }; /** * Creates the font family definition and sends it to the server * * @param {Array} fontFaces The font faces to be installed * @return {void} */ const handleInstall = async fontFaces => { const fontFamilies = makeFamiliesFromFaces(fontFaces); try { await installFonts(fontFamilies); setNotice({ type: 'success', message: (0,external_wp_i18n_namespaceObject.__)('Fonts were installed successfully.') }); } catch (error) { setNotice({ type: 'error', message: error.message, errors: error?.installationErrors }); } setIsUploading(false); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: handleDropZone }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "font-library-modal__local-fonts", children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Notice, { status: notice.type, __unstableHTML: true, onRemove: () => setNotice(null), children: [notice.message, notice.errors && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { children: notice.errors.map((error, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: error }, index)) })] }), isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__upload-area", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }) }), !isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { accept: ALLOWED_FILE_EXTENSIONS.map(ext => `.${ext}`).join(','), multiple: true, onChange: onFilesUpload, render: ({ openFileDialog }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "font-library-modal__upload-area", onClick: openFileDialog, children: (0,external_wp_i18n_namespaceObject.__)('Upload font') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 2 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "font-library-modal__upload-area__text", children: (0,external_wp_i18n_namespaceObject.__)('Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.') })] })] }); } /* harmony default export */ const upload_fonts = (UploadFonts); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const DEFAULT_TAB = { id: 'installed-fonts', title: (0,external_wp_i18n_namespaceObject._x)('Library', 'Font library') }; const UPLOAD_TAB = { id: 'upload-fonts', title: (0,external_wp_i18n_namespaceObject._x)('Upload', 'noun') }; const tabsFromCollections = collections => collections.map(({ slug, name }) => ({ id: slug, title: collections.length === 1 && slug === 'google-fonts' ? (0,external_wp_i18n_namespaceObject.__)('Install Fonts') : name })); function FontLibraryModal({ onRequestClose, defaultTabId = 'installed-fonts' }) { const { collections } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); const canUserCreate = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: 'wp_font_family' }); }, []); const tabs = [DEFAULT_TAB]; if (canUserCreate) { tabs.push(UPLOAD_TAB); tabs.push(...tabsFromCollections(collections || [])); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Fonts'), onRequestClose: onRequestClose, isFullScreen: true, className: "font-library-modal", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { defaultTabId: defaultTabId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__tablist-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, { children: tabs.map(({ id, title }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: id, children: title }, id)) }) }), tabs.map(({ id }) => { let contents; switch (id) { case 'upload-fonts': contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(upload_fonts, {}); break; case 'installed-fonts': contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(installed_fonts, {}); break; default: contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_collection, { slug: id }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { tabId: id, focusable: false, children: contents }, id); })] }) }); } /* harmony default export */ const font_library_modal = (FontLibraryModal); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-family-item.js /** * WordPress dependencies */ /** * Internal dependencies */ function FontFamilyItem({ font }) { const { handleSetLibraryFontSelected, setModalTabOpen } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); const variantsCount = font?.fontFace?.length || 1; const handleClick = () => { handleSetLibraryFontSelected(font); setModalTabOpen('installed-fonts'); }; const previewStyle = getFamilyPreviewStyle(font); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { onClick: handleClick, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: previewStyle, children: font.name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles-screen-typography__font-variants-count", children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of font variants. */ (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount) })] }) }); } /* harmony default export */ const font_family_item = (FontFamilyItem); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-families.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalSetting: font_families_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); /** * Maps the fonts with the source, if available. * * @param {Array} fonts The fonts to map. * @param {string} source The source of the fonts. * @return {Array} The mapped fonts. */ function mapFontsWithSource(fonts, source) { return fonts ? fonts.map(f => setUIValuesNeeded(f, { source })) : []; } function FontFamilies() { const { baseCustomFonts, modalTabOpen, setModalTabOpen } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); const [fontFamilies] = font_families_useGlobalSetting('typography.fontFamilies'); const [baseFontFamilies] = font_families_useGlobalSetting('typography.fontFamilies', undefined, 'base'); const themeFonts = mapFontsWithSource(fontFamilies?.theme, 'theme'); const customFonts = mapFontsWithSource(fontFamilies?.custom, 'custom'); const activeFonts = [...themeFonts, ...customFonts].sort((a, b) => a.name.localeCompare(b.name)); const hasFonts = 0 < activeFonts.length; const hasInstalledFonts = hasFonts || baseFontFamilies?.theme?.length > 0 || baseCustomFonts?.length > 0; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!!modalTabOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_library_modal, { onRequestClose: () => setModalTabOpen(null), defaultTabId: modalTabOpen }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)('Fonts') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: () => setModalTabOpen('installed-fonts'), label: (0,external_wp_i18n_namespaceObject.__)('Manage fonts'), icon: library_settings, size: "small" })] }), activeFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { size: "large", isBordered: true, isSeparated: true, children: activeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_family_item, { font: font }, font.slug)) }) }), !hasFonts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)('No fonts activated.') : (0,external_wp_i18n_namespaceObject.__)('No fonts installed.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "edit-site-global-styles-font-families__manage-fonts", variant: "secondary", __next40pxDefaultSize: true, onClick: () => { setModalTabOpen(hasInstalledFonts ? 'installed-fonts' : 'upload-fonts'); }, children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)('Manage fonts') : (0,external_wp_i18n_namespaceObject.__)('Add fonts') })] })] })] }); } /* harmony default export */ const font_families = (({ ...props }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(context, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilies, { ...props }) })); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js /** * WordPress dependencies */ /** * Internal dependencies */ function ScreenTypography() { const fontLibraryEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getEditorSettings().fontLibraryEnabled, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('Typography'), description: (0,external_wp_i18n_namespaceObject.__)('Available fonts, typographic styles, and the application of those styles.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 7, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)('Typesets') }), fontLibraryEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_families, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_elements, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_count, {})] }) })] }); } /* harmony default export */ const screen_typography = (ScreenTypography); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: typography_panel_useGlobalStyle, useGlobalSetting: typography_panel_useGlobalSetting, useSettingsForBlockElement: typography_panel_useSettingsForBlockElement, TypographyPanel: typography_panel_StylesTypographyPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function TypographyPanel({ element, headingLevel }) { let prefixParts = []; if (element === 'heading') { prefixParts = prefixParts.concat(['elements', headingLevel]); } else if (element && element !== 'text') { prefixParts = prefixParts.concat(['elements', element]); } const prefix = prefixParts.join('.'); const [style] = typography_panel_useGlobalStyle(prefix, undefined, 'user', { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = typography_panel_useGlobalStyle(prefix, undefined, 'all', { shouldDecodeEncode: false }); const [rawSettings] = typography_panel_useGlobalSetting(''); const usedElement = element === 'heading' ? headingLevel : element; const settings = typography_panel_useSettingsForBlockElement(rawSettings, undefined, usedElement); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_panel_StylesTypographyPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings: settings }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-preview.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: typography_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function TypographyPreview({ name, element, headingLevel }) { var _ref; let prefix = ''; if (element === 'heading') { prefix = `elements.${headingLevel}.`; } else if (element && element !== 'text') { prefix = `elements.${element}.`; } const [fontFamily] = typography_preview_useGlobalStyle(prefix + 'typography.fontFamily', name); const [gradientValue] = typography_preview_useGlobalStyle(prefix + 'color.gradient', name); const [backgroundColor] = typography_preview_useGlobalStyle(prefix + 'color.background', name); const [fallbackBackgroundColor] = typography_preview_useGlobalStyle('color.background'); const [color] = typography_preview_useGlobalStyle(prefix + 'color.text', name); const [fontSize] = typography_preview_useGlobalStyle(prefix + 'typography.fontSize', name); const [fontStyle] = typography_preview_useGlobalStyle(prefix + 'typography.fontStyle', name); const [fontWeight] = typography_preview_useGlobalStyle(prefix + 'typography.fontWeight', name); const [letterSpacing] = typography_preview_useGlobalStyle(prefix + 'typography.letterSpacing', name); const extraStyles = element === 'link' ? { textDecoration: 'underline' } : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-typography-preview", style: { fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor, color, fontSize, fontStyle, fontWeight, letterSpacing, ...extraStyles }, children: "Aa" }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js /** * WordPress dependencies */ /** * Internal dependencies */ const screen_typography_element_elements = { text: { description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'), title: (0,external_wp_i18n_namespaceObject.__)('Text') }, link: { description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on the links.'), title: (0,external_wp_i18n_namespaceObject.__)('Links') }, heading: { description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on headings.'), title: (0,external_wp_i18n_namespaceObject.__)('Headings') }, caption: { description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on captions.'), title: (0,external_wp_i18n_namespaceObject.__)('Captions') }, button: { description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on buttons.'), title: (0,external_wp_i18n_namespaceObject.__)('Buttons') } }; function ScreenTypographyElement({ element }) { const [headingLevel, setHeadingLevel] = (0,external_wp_element_namespaceObject.useState)('heading'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: screen_typography_element_elements[element].title, description: screen_typography_element_elements[element].description }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPreview, { element: element, headingLevel: headingLevel }) }), element === 'heading' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: "1em", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { label: (0,external_wp_i18n_namespaceObject.__)('Select heading level'), hideLabelFromVision: true, value: headingLevel, onChange: setHeadingLevel, isBlock: true, size: "__unstable-large", __nextHasNoMarginBottom: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "heading", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)('All headings'), label: (0,external_wp_i18n_namespaceObject._x)('All', 'heading levels') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h1", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 1'), label: (0,external_wp_i18n_namespaceObject.__)('H1') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h2", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 2'), label: (0,external_wp_i18n_namespaceObject.__)('H2') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h3", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 3'), label: (0,external_wp_i18n_namespaceObject.__)('H3') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h4", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 4'), label: (0,external_wp_i18n_namespaceObject.__)('H4') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h5", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 5'), label: (0,external_wp_i18n_namespaceObject.__)('H5') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h6", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 6'), label: (0,external_wp_i18n_namespaceObject.__)('H6') })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPanel, { element: element, headingLevel: headingLevel })] }); } /* harmony default export */ const screen_typography_element = (ScreenTypographyElement); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size-preview.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: font_size_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function FontSizePreview({ fontSize }) { var _font$fontFamily; const [font] = font_size_preview_useGlobalStyle('typography'); const input = fontSize?.fluid?.min && fontSize?.fluid?.max ? { minimumFontSize: fontSize.fluid.min, maximumFontSize: fontSize.fluid.max } : { fontSize: fontSize.size }; const computedFontSize = (0,external_wp_blockEditor_namespaceObject.getComputedFluidTypographyValue)(input); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-typography-preview", style: { fontSize: computedFontSize, fontFamily: (_font$fontFamily = font?.fontFamily) !== null && _font$fontFamily !== void 0 ? _font$fontFamily : 'serif' }, children: (0,external_wp_i18n_namespaceObject.__)('Aa') }); } /* harmony default export */ const font_size_preview = (FontSizePreview); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js /** * WordPress dependencies */ function ConfirmDeleteFontSizeDialog({ fontSize, isOpen, toggleOpen, handleRemoveFontSize }) { const handleConfirm = async () => { toggleOpen(); handleRemoveFontSize(fontSize); }; const handleCancel = () => { toggleOpen(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: isOpen, cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), onCancel: handleCancel, onConfirm: handleConfirm, size: "medium", children: fontSize && (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the font size preset. */ (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font size preset?'), fontSize.name) }); } /* harmony default export */ const confirm_delete_font_size_dialog = (ConfirmDeleteFontSizeDialog); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js /** * WordPress dependencies */ function RenameFontSizeDialog({ fontSize, toggleOpen, handleRename }) { const [newName, setNewName] = (0,external_wp_element_namespaceObject.useState)(fontSize.name); const handleConfirm = () => { // If the new name is not empty, call the handleRename function if (newName.trim()) { handleRename(newName); } toggleOpen(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { onRequestClose: toggleOpen, focusOnMount: "firstContentElement", title: (0,external_wp_i18n_namespaceObject.__)('Rename'), size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: event => { event.preventDefault(); handleConfirm(); toggleOpen(); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, autoComplete: "off", value: newName, onChange: setNewName, label: (0,external_wp_i18n_namespaceObject.__)('Name'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Font size preset name') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: toggleOpen, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)('Save') })] })] }) }) }); } /* harmony default export */ const rename_font_size_dialog = (RenameFontSizeDialog); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/size-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_UNITS = ['px', 'em', 'rem', 'vw', 'vh']; function SizeControl({ // Do not allow manipulation of margin bottom __nextHasNoMarginBottom, ...props }) { const { baseControlProps } = (0,external_wp_components_namespaceObject.useBaseControlProps)(props); const { value, onChange, fallbackValue, disabled, label } = props; const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: DEFAULT_UNITS }); const [valueQuantity, valueUnit = 'px'] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value, units); const isValueUnitRelative = !!valueUnit && ['em', 'rem', 'vw', 'vh'].includes(valueUnit); // Receives the new value from the UnitControl component as a string containing the value and unit. const handleUnitControlChange = newValue => { onChange(newValue); }; // Receives the new value from the RangeControl component as a number. const handleRangeControlChange = newValue => { onChange?.(newValue + valueUnit); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { ...baseControlProps, __nextHasNoMarginBottom: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: label, hideLabelFromVision: true, value: value, onChange: handleUnitControlChange, units: units, min: 0, disabled: disabled }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 2, marginBottom: 0, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: label, hideLabelFromVision: true, value: valueQuantity, initialPosition: fallbackValue, withInputField: false, onChange: handleRangeControlChange, min: 0, max: isValueUnitRelative ? 10 : 100, step: isValueUnitRelative ? 0.1 : 1, disabled: disabled }) }) })] }) }); } /* harmony default export */ const size_control = (SizeControl); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Menu } = unlock(external_wp_components_namespaceObject.privateApis); const { useGlobalSetting: font_size_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function FontSize() { var _fontSizes$origin; const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = (0,external_wp_element_namespaceObject.useState)(false); const [isRenameDialogOpen, setIsRenameDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); const { params: { origin, slug }, goBack } = (0,external_wp_components_namespaceObject.useNavigator)(); const [fontSizes, setFontSizes] = font_size_useGlobalSetting('typography.fontSizes'); const [globalFluid] = font_size_useGlobalSetting('typography.fluid'); // Get the font sizes from the origin, default to empty array. const sizes = (_fontSizes$origin = fontSizes[origin]) !== null && _fontSizes$origin !== void 0 ? _fontSizes$origin : []; // Get the font size by slug. const fontSize = sizes.find(size => size.slug === slug); // Navigate to the font sizes list if the font size is not available. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!!slug && !fontSize) { goBack(); } }, [slug, fontSize, goBack]); if (!origin || !slug || !fontSize) { return null; } // Whether the font size is fluid. If not defined, use the global fluid value of the theme. const isFluid = fontSize?.fluid !== undefined ? !!fontSize.fluid : !!globalFluid; // Whether custom fluid values are used. const isCustomFluid = typeof fontSize?.fluid === 'object'; const handleNameChange = value => { updateFontSize('name', value); }; const handleFontSizeChange = value => { updateFontSize('size', value); }; const handleFluidChange = value => { updateFontSize('fluid', value); }; const handleCustomFluidValues = value => { if (value) { // If custom values are used, init the values with the current ones. updateFontSize('fluid', { min: fontSize.size, max: fontSize.size }); } else { // If custom fluid values are disabled, set fluid to true. updateFontSize('fluid', true); } }; const handleMinChange = value => { updateFontSize('fluid', { ...fontSize.fluid, min: value }); }; const handleMaxChange = value => { updateFontSize('fluid', { ...fontSize.fluid, max: value }); }; const updateFontSize = (key, value) => { const newFontSizes = sizes.map(size => { if (size.slug === slug) { return { ...size, [key]: value }; // Create a new object with updated key } return size; }); setFontSizes({ ...fontSizes, [origin]: newFontSizes }); }; const handleRemoveFontSize = () => { const newFontSizes = sizes.filter(size => size.slug !== slug); setFontSizes({ ...fontSizes, [origin]: newFontSizes }); }; const toggleDeleteConfirm = () => { setIsDeleteConfirmOpen(!isDeleteConfirmOpen); }; const toggleRenameDialog = () => { setIsRenameDialogOpen(!isRenameDialogOpen); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_delete_font_size_dialog, { fontSize: fontSize, isOpen: isDeleteConfirmOpen, toggleOpen: toggleDeleteConfirm, handleRemoveFontSize: handleRemoveFontSize }), isRenameDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_font_size_dialog, { fontSize: fontSize, toggleOpen: toggleRenameDialog, handleRename: handleNameChange }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", align: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: fontSize.name, description: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: font size preset name. */ (0,external_wp_i18n_namespaceObject.__)('Manage the font size %s.'), fontSize.name) }), origin === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginTop: 3, marginBottom: 0, paddingX: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Font size options') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu.Popover, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { onClick: toggleRenameDialog, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Rename') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { onClick: toggleDeleteConfirm, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Delete') }) })] })] }) }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { paddingX: 4, marginBottom: 0, paddingBottom: 6, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_preview, { fontSize: fontSize }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { label: (0,external_wp_i18n_namespaceObject.__)('Size'), value: !isCustomFluid ? fontSize.size : '', onChange: handleFontSizeChange, disabled: isCustomFluid }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { label: (0,external_wp_i18n_namespaceObject.__)('Fluid typography'), help: (0,external_wp_i18n_namespaceObject.__)('Scale the font size dynamically to fit the screen or viewport.'), checked: isFluid, onChange: handleFluidChange, __nextHasNoMarginBottom: true }), isFluid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { label: (0,external_wp_i18n_namespaceObject.__)('Custom fluid values'), help: (0,external_wp_i18n_namespaceObject.__)('Set custom min and max values for the fluid font size.'), checked: isCustomFluid, onChange: handleCustomFluidValues, __nextHasNoMarginBottom: true }), isCustomFluid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { label: (0,external_wp_i18n_namespaceObject.__)('Minimum'), value: fontSize.fluid?.min, onChange: handleMinChange }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { label: (0,external_wp_i18n_namespaceObject.__)('Maximum'), value: fontSize.fluid?.max, onChange: handleMaxChange })] })] }) }) })] })] }); } /* harmony default export */ const font_size = (FontSize); ;// ./node_modules/@wordpress/icons/build-module/library/plus.js /** * WordPress dependencies */ const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); /* harmony default export */ const library_plus = (plus); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js /** * WordPress dependencies */ function ConfirmResetFontSizesDialog({ text, confirmButtonText, isOpen, toggleOpen, onConfirm }) { const handleConfirm = async () => { toggleOpen(); onConfirm(); }; const handleCancel = () => { toggleOpen(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: isOpen, cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), confirmButtonText: confirmButtonText, onCancel: handleCancel, onConfirm: handleConfirm, size: "medium", children: text }); } /* harmony default export */ const confirm_reset_font_sizes_dialog = (ConfirmResetFontSizesDialog); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Menu: font_sizes_Menu } = unlock(external_wp_components_namespaceObject.privateApis); const { useGlobalSetting: font_sizes_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function FontSizeGroup({ label, origin, sizes, handleAddFontSize, handleResetFontSizes }) { const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); const resetDialogText = origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to remove all custom font size presets?') : (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to reset all font size presets to their default values?'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isResetDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_reset_font_sizes_dialog, { text: resetDialogText, confirmButtonText: origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Remove') : (0,external_wp_i18n_namespaceObject.__)('Reset'), isOpen: isResetDialogOpen, toggleOpen: toggleResetDialog, onConfirm: handleResetFontSizes }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", align: "center", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { children: [origin === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { label: (0,external_wp_i18n_namespaceObject.__)('Add font size'), icon: library_plus, size: "small", onClick: handleAddFontSize }), !!handleResetFontSizes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(font_sizes_Menu, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Font size presets options') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Popover, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Item, { onClick: toggleResetDialog, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.ItemLabel, { children: origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Remove font size presets') : (0,external_wp_i18n_namespaceObject.__)('Reset font size presets') }) }) })] })] })] }), !!sizes.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: sizes.map(size => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: `/typography/font-sizes/${origin}/${size.slug}`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-font-size__item", children: size.name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { display: "flex", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right }) })] }) }, size.slug)) })] })] }); } function font_sizes_FontSizes() { const [themeFontSizes, setThemeFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.theme'); const [baseThemeFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.theme', null, 'base'); const [defaultFontSizes, setDefaultFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.default'); const [baseDefaultFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.default', null, 'base'); const [customFontSizes = [], setCustomFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.custom'); const [defaultFontSizesEnabled] = font_sizes_useGlobalSetting('typography.defaultFontSizes'); const handleAddFontSize = () => { const index = getNewIndexFromPresets(customFontSizes, 'custom-'); const newFontSize = { /* translators: %d: font size index */ name: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('New Font Size %d'), index), size: '16px', slug: `custom-${index}` }; setCustomFontSizes([...customFontSizes, newFontSize]); }; const hasSameSizeValues = (arr1, arr2) => arr1.map(item => item.size).join('') === arr2.map(item => item.size).join(''); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('Font size presets'), description: (0,external_wp_i18n_namespaceObject.__)('Create and edit the presets used for font sizes across the site.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { paddingX: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 8, children: [!!themeFontSizes?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Theme'), origin: "theme", sizes: themeFontSizes, baseSizes: baseThemeFontSizes, handleAddFontSize: handleAddFontSize, handleResetFontSizes: hasSameSizeValues(themeFontSizes, baseThemeFontSizes) ? null : () => setThemeFontSizes(baseThemeFontSizes) }), defaultFontSizesEnabled && !!defaultFontSizes?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Default'), origin: "default", sizes: defaultFontSizes, baseSizes: baseDefaultFontSizes, handleAddFontSize: handleAddFontSize, handleResetFontSizes: hasSameSizeValues(defaultFontSizes, baseDefaultFontSizes) ? null : () => setDefaultFontSizes(baseDefaultFontSizes) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Custom'), origin: "custom", sizes: customFontSizes, handleAddFontSize: handleAddFontSize, handleResetFontSizes: customFontSizes.length > 0 ? () => setCustomFontSizes([]) : null })] }) }) })] }); } /* harmony default export */ const font_sizes = (font_sizes_FontSizes); ;// ./node_modules/@wordpress/icons/build-module/library/shuffle.js /** * WordPress dependencies */ const shuffle = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/SVG", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z" }) }); /* harmony default export */ const library_shuffle = (shuffle); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js /** * External dependencies */ /** * WordPress dependencies */ function ColorIndicatorWrapper({ className, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: dist_clsx('edit-site-global-styles__color-indicator-wrapper', className), ...props }); } /* harmony default export */ const color_indicator_wrapper = (ColorIndicatorWrapper); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalSetting: palette_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const EMPTY_COLORS = []; function Palette({ name }) { const [customColors] = palette_useGlobalSetting('color.palette.custom'); const [themeColors] = palette_useGlobalSetting('color.palette.theme'); const [defaultColors] = palette_useGlobalSetting('color.palette.default'); const [defaultPaletteEnabled] = palette_useGlobalSetting('color.defaultPalette', name); const [randomizeThemeColors] = useColorRandomizer(); const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]); const screenPath = !name ? '/colors/palette' : '/blocks/' + encodeURIComponent(name) + '/colors/palette'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)('Palette') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: screenPath, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { direction: "row", children: [colors.length > 0 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: colors.slice(0, 5).map(({ color }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_indicator_wrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { colorValue: color }) }, `${color}-${index}`)) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: (0,external_wp_i18n_namespaceObject.__)('Edit palette') })] }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)('Add colors') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right })] }) }) }), window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", icon: library_shuffle, onClick: randomizeThemeColors, children: (0,external_wp_i18n_namespaceObject.__)('Randomize colors') })] }); } /* harmony default export */ const palette = (Palette); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: screen_colors_useGlobalStyle, useGlobalSetting: screen_colors_useGlobalSetting, useSettingsForBlockElement: screen_colors_useSettingsForBlockElement, ColorPanel: screen_colors_StylesColorPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenColors() { const [style] = screen_colors_useGlobalStyle('', undefined, 'user', { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = screen_colors_useGlobalStyle('', undefined, 'all', { shouldDecodeEncode: false }); const [rawSettings] = screen_colors_useGlobalSetting(''); const settings = screen_colors_useSettingsForBlockElement(rawSettings); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('Colors'), description: (0,external_wp_i18n_namespaceObject.__)('Palette colors and the application of those colors on site elements.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 7, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(palette, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors_StylesColorPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings: settings })] }) })] }); } /* harmony default export */ const screen_colors = (ScreenColors); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preset-colors.js /** * Internal dependencies */ function PresetColors() { const { paletteColors } = useStylesPreviewColors(); return paletteColors.slice(0, 4).map(({ slug, color }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { flexGrow: 1, height: '100%', background: color } }, `${slug}-${index}`)); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-colors.js /** * WordPress dependencies */ /** * Internal dependencies */ const preview_colors_firstFrameVariants = { start: { scale: 1, opacity: 1 }, hover: { scale: 0, opacity: 0 } }; const StylesPreviewColors = ({ label, isFocused, withHoverView }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewWrapper, { label: label, isFocused: isFocused, withHoverView: withHoverView, children: ({ key }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: preview_colors_firstFrameVariants, style: { height: '100%', overflow: 'hidden' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, justify: "center", style: { height: '100%', overflow: 'hidden' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PresetColors, {}) }) }, key) }); }; /* harmony default export */ const preview_colors = (StylesPreviewColors); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-color.js /** * WordPress dependencies */ /** * Internal dependencies */ function ColorVariations({ title, gap = 2 }) { const propertiesToFilter = ['color']; const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); // Return null if there is only one variation (the default). if (colorVariations?.length <= 1) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { spacing: gap, children: colorVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { variation: variation, isPill: true, properties: propertiesToFilter, showTooltip: true, children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_colors, {}) }, index)) })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalSetting: color_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const mobilePopoverProps = { placement: 'bottom-start', offset: 8 }; function ColorPalettePanel({ name }) { const [themeColors, setThemeColors] = color_palette_panel_useGlobalSetting('color.palette.theme', name); const [baseThemeColors] = color_palette_panel_useGlobalSetting('color.palette.theme', name, 'base'); const [defaultColors, setDefaultColors] = color_palette_panel_useGlobalSetting('color.palette.default', name); const [baseDefaultColors] = color_palette_panel_useGlobalSetting('color.palette.default', name, 'base'); const [customColors, setCustomColors] = color_palette_panel_useGlobalSetting('color.palette.custom', name); const [defaultPaletteEnabled] = color_palette_panel_useGlobalSetting('color.defaultPalette', name); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); const popoverProps = isMobileViewport ? mobilePopoverProps : undefined; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "edit-site-global-styles-color-palette-panel", spacing: 8, children: [!!themeColors && !!themeColors.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { canReset: themeColors !== baseThemeColors, canOnlyChangeValues: true, colors: themeColors, onChange: setThemeColors, paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'), paletteLabelHeadingLevel: 3, popoverProps: popoverProps }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { canReset: defaultColors !== baseDefaultColors, canOnlyChangeValues: true, colors: defaultColors, onChange: setDefaultColors, paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'), paletteLabelHeadingLevel: 3, popoverProps: popoverProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { colors: customColors, onChange: setCustomColors, paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), paletteLabelHeadingLevel: 3, slugPrefix: "custom-", popoverProps: popoverProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)('Palettes') })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalSetting: gradients_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const gradients_palette_panel_mobilePopoverProps = { placement: 'bottom-start', offset: 8 }; const noop = () => {}; function GradientPalettePanel({ name }) { const [themeGradients, setThemeGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.theme', name); const [baseThemeGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.theme', name, 'base'); const [defaultGradients, setDefaultGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.default', name); const [baseDefaultGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.default', name, 'base'); const [customGradients, setCustomGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.custom', name); const [defaultPaletteEnabled] = gradients_palette_panel_useGlobalSetting('color.defaultGradients', name); const [customDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.custom') || []; const [defaultDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.default') || []; const [themeDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.theme') || []; const [defaultDuotoneEnabled] = gradients_palette_panel_useGlobalSetting('color.defaultDuotone'); const duotonePalette = [...(customDuotone || []), ...(themeDuotone || []), ...(defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [])]; const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); const popoverProps = isMobileViewport ? gradients_palette_panel_mobilePopoverProps : undefined; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "edit-site-global-styles-gradient-palette-panel", spacing: 8, children: [!!themeGradients && !!themeGradients.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { canReset: themeGradients !== baseThemeGradients, canOnlyChangeValues: true, gradients: themeGradients, onChange: setThemeGradients, paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'), paletteLabelHeadingLevel: 3, popoverProps: popoverProps }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { canReset: defaultGradients !== baseDefaultGradients, canOnlyChangeValues: true, gradients: defaultGradients, onChange: setDefaultGradients, paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'), paletteLabelLevel: 3, popoverProps: popoverProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { gradients: customGradients, onChange: setCustomGradients, paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), paletteLabelLevel: 3, slugPrefix: "custom-", popoverProps: popoverProps }), !!duotonePalette && !!duotonePalette.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)('Duotone') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, { duotonePalette: duotonePalette, disableCustomDuotone: true, disableCustomColors: true, clearable: false, onChange: noop })] })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Tabs: screen_color_palette_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function ScreenColorPalette({ name }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('Edit palette'), description: (0,external_wp_i18n_namespaceObject.__)('The combination of colors used across the site and in color pickers.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs.TabList, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "color", children: (0,external_wp_i18n_namespaceObject.__)('Color') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "gradient", children: (0,external_wp_i18n_namespaceObject.__)('Gradient') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "color", focusable: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPalettePanel, { name: name }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "gradient", focusable: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientPalettePanel, { name: name }) })] })] }); } /* harmony default export */ const screen_color_palette = (ScreenColorPalette); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/background-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ // Initial control values where no block style is set. const BACKGROUND_DEFAULT_VALUES = { backgroundSize: 'auto' }; const { useGlobalStyle: background_panel_useGlobalStyle, useGlobalSetting: background_panel_useGlobalSetting, BackgroundPanel: background_panel_StylesBackgroundPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); /** * Checks if there is a current value in the background image block support * attributes. * * @param {Object} style Style attribute. * @return {boolean} Whether the block has a background image value set. */ function hasBackgroundImageValue(style) { return !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url || typeof style?.background?.backgroundImage === 'string'; } function BackgroundPanel() { const [style] = background_panel_useGlobalStyle('', undefined, 'user', { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = background_panel_useGlobalStyle('', undefined, 'all', { shouldDecodeEncode: false }); const [settings] = background_panel_useGlobalSetting(''); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(background_panel_StylesBackgroundPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings: settings, defaultValues: BACKGROUND_DEFAULT_VALUES }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHasBackgroundPanel: screen_background_useHasBackgroundPanel, useGlobalSetting: screen_background_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenBackground() { const [settings] = screen_background_useGlobalSetting(''); const hasBackgroundPanel = screen_background_useHasBackgroundPanel(settings); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('Background'), description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)('Set styles for the site’s background.') }) }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, {})] }); } /* harmony default export */ const screen_background = (ScreenBackground); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/confirm-reset-shadow-dialog.js /** * WordPress dependencies */ function ConfirmResetShadowDialog({ text, confirmButtonText, isOpen, toggleOpen, onConfirm }) { const handleConfirm = async () => { toggleOpen(); onConfirm(); }; const handleCancel = () => { toggleOpen(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: isOpen, cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), confirmButtonText: confirmButtonText, onCancel: handleCancel, onConfirm: handleConfirm, size: "medium", children: text }); } /* harmony default export */ const confirm_reset_shadow_dialog = (ConfirmResetShadowDialog); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalSetting: shadows_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { Menu: shadows_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis); const defaultShadow = '6px 6px 9px rgba(0, 0, 0, 0.2)'; function ShadowsPanel() { const [defaultShadows] = shadows_panel_useGlobalSetting('shadow.presets.default'); const [defaultShadowsEnabled] = shadows_panel_useGlobalSetting('shadow.defaultPresets'); const [themeShadows] = shadows_panel_useGlobalSetting('shadow.presets.theme'); const [customShadows, setCustomShadows] = shadows_panel_useGlobalSetting('shadow.presets.custom'); const onCreateShadow = shadow => { setCustomShadows([...(customShadows || []), shadow]); }; const handleResetShadows = () => { setCustomShadows([]); }; const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isResetDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_reset_shadow_dialog, { text: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to remove all custom shadows?'), confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Remove'), isOpen: isResetDialogOpen, toggleOpen: toggleResetDialog, onConfirm: handleResetShadows }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('Shadows'), description: (0,external_wp_i18n_namespaceObject.__)('Manage and create shadow styles for use across the site.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "edit-site-global-styles__shadows-panel", spacing: 7, children: [defaultShadowsEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { label: (0,external_wp_i18n_namespaceObject.__)('Default'), shadows: defaultShadows || [], category: "default" }), themeShadows && themeShadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { label: (0,external_wp_i18n_namespaceObject.__)('Theme'), shadows: themeShadows || [], category: "theme" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { label: (0,external_wp_i18n_namespaceObject.__)('Custom'), shadows: customShadows || [], category: "custom", canCreate: true, onCreate: onCreateShadow, onReset: toggleResetDialog })] }) })] }); } function ShadowList({ label, shadows, category, canCreate, onCreate, onReset }) { const handleAddShadow = () => { const newIndex = getNewIndexFromPresets(shadows, 'shadow-'); onCreate({ name: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: is an index for a preset */ (0,external_wp_i18n_namespaceObject.__)('Shadow %s'), newIndex), shadow: defaultShadow, slug: `shadow-${newIndex}` }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { align: "center", className: "edit-site-global-styles__shadows-panel__title", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: label }) }), canCreate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__shadows-panel__options-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: library_plus, label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'), onClick: () => { handleAddShadow(); } }) }), !!shadows?.length && category === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_panel_Menu, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Shadow options') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Popover, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Item, { onClick: onReset, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Remove all custom shadows') }) }) })] })] }), shadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadows.map(shadow => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowItem, { shadow: shadow, category: category }, shadow.slug)) })] }); } function ShadowItem({ shadow, category }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: `/shadows/edit/${category}/${shadow.slug}`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: shadow.name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right })] }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/reset.js /** * WordPress dependencies */ const reset_reset = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 11.5h10V13H7z" }) }); /* harmony default export */ const library_reset = (reset_reset); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadow-utils.js const CUSTOM_VALUE_SETTINGS = { px: { max: 20, step: 1 }, '%': { max: 100, step: 1 }, vw: { max: 100, step: 1 }, vh: { max: 100, step: 1 }, em: { max: 10, step: 0.1 }, rm: { max: 10, step: 0.1 }, svw: { max: 100, step: 1 }, lvw: { max: 100, step: 1 }, dvw: { max: 100, step: 1 }, svh: { max: 100, step: 1 }, lvh: { max: 100, step: 1 }, dvh: { max: 100, step: 1 }, vi: { max: 100, step: 1 }, svi: { max: 100, step: 1 }, lvi: { max: 100, step: 1 }, dvi: { max: 100, step: 1 }, vb: { max: 100, step: 1 }, svb: { max: 100, step: 1 }, lvb: { max: 100, step: 1 }, dvb: { max: 100, step: 1 }, vmin: { max: 100, step: 1 }, svmin: { max: 100, step: 1 }, lvmin: { max: 100, step: 1 }, dvmin: { max: 100, step: 1 }, vmax: { max: 100, step: 1 }, svmax: { max: 100, step: 1 }, lvmax: { max: 100, step: 1 }, dvmax: { max: 100, step: 1 } }; function getShadowParts(shadow) { const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || []; return shadowValues.map(value => value.trim()); } function shadowStringToObject(shadowValue) { /* * Shadow spec: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow * Shadow string format: <offset-x> <offset-y> <blur-radius> <spread-radius> <color> [inset] * * A shadow to be valid it must satisfy the following. * * 1. Should not contain "none" keyword. * 2. Values x, y, blur, spread should be in the order. Color and inset can be anywhere in the string except in between x, y, blur, spread values. * 3. Should not contain more than one set of x, y, blur, spread values. * 4. Should contain at least x and y values. Others are optional. * 5. Should not contain more than one "inset" (case insensitive) keyword. * 6. Should not contain more than one color value. */ const defaultShadow = { x: '0', y: '0', blur: '0', spread: '0', color: '#000', inset: false }; if (!shadowValue) { return defaultShadow; } // Rule 1: Should not contain "none" keyword. // if the shadow has "none" keyword, it is not a valid shadow string if (shadowValue.includes('none')) { return defaultShadow; } // Rule 2: Values x, y, blur, spread should be in the order. // Color and inset can be anywhere in the string except in between x, y, blur, spread values. // Extract length values (x, y, blur, spread) from shadow string // Regex match groups of 1 to 4 length values. const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g; const matches = shadowValue.match(lengthsRegex) || []; // Rule 3: Should not contain more than one set of x, y, blur, spread values. // if the string doesn't contain exactly 1 set of x, y, blur, spread values, // it is not a valid shadow string if (matches.length !== 1) { return defaultShadow; } // Extract length values (x, y, blur, spread) from shadow string const lengths = matches[0].split(' ').map(value => value.trim()).filter(value => value); // Rule 4: Should contain at least x and y values. Others are optional. if (lengths.length < 2) { return defaultShadow; } // Rule 5: Should not contain more than one "inset" (case insensitive) keyword. // check if the shadow string contains "inset" keyword const insets = shadowValue.match(/inset/gi) || []; if (insets.length > 1) { return defaultShadow; } // Strip lengths and inset from shadow string, leaving just color. const hasInset = insets.length === 1; let colorString = shadowValue.replace(lengthsRegex, '').trim(); if (hasInset) { colorString = colorString.replace('inset', '').replace('INSET', '').trim(); } // Rule 6: Should not contain more than one color value. // validate color string with regular expression // check if color has matching hex, rgb or hsl values const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi; let colorMatches = (colorString.match(colorRegex) || []).map(value => value?.trim()).filter(value => value); // If color string has more than one color values, it is not a valid if (colorMatches.length > 1) { return defaultShadow; } else if (colorMatches.length === 0) { // check if color string has multiple named color values separated by space colorMatches = colorString.trim().split(' ').filter(value => value); // If color string has more than one color values, it is not a valid if (colorMatches.length > 1) { return defaultShadow; } } // Return parsed shadow object. const [x, y, blur, spread] = lengths; return { x, y, blur: blur || defaultShadow.blur, spread: spread || defaultShadow.spread, inset: hasInset, color: colorString || defaultShadow.color }; } function shadowObjectToString(shadowObj) { const shadowString = `${shadowObj.x || '0px'} ${shadowObj.y || '0px'} ${shadowObj.blur || '0px'} ${shadowObj.spread || '0px'}`; return `${shadowObj.inset ? 'inset' : ''} ${shadowString} ${shadowObj.color || ''}`.trim(); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-edit-panel.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalSetting: shadows_edit_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { Menu: shadows_edit_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis); const customShadowMenuItems = [{ label: (0,external_wp_i18n_namespaceObject.__)('Rename'), action: 'rename' }, { label: (0,external_wp_i18n_namespaceObject.__)('Delete'), action: 'delete' }]; const presetShadowMenuItems = [{ label: (0,external_wp_i18n_namespaceObject.__)('Reset'), action: 'reset' }]; function ShadowsEditPanel() { const { goBack, params: { category, slug } } = (0,external_wp_components_namespaceObject.useNavigator)(); const [shadows, setShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.${category}`); (0,external_wp_element_namespaceObject.useEffect)(() => { const hasCurrentShadow = shadows?.some(shadow => shadow.slug === slug); // If the shadow being edited doesn't exist anymore in the global styles setting, navigate back // to prevent the user from editing a non-existent shadow entry. // This can happen, for example: // - when the user deletes the shadow // - when the user resets the styles while editing a custom shadow // // The check on the slug is necessary to prevent a double back navigation when the user triggers // a backward navigation by interacting with the screen's UI. if (!!slug && !hasCurrentShadow) { goBack(); } }, [shadows, slug, goBack]); const [baseShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.${category}`, undefined, 'base'); const [selectedShadow, setSelectedShadow] = (0,external_wp_element_namespaceObject.useState)(() => (shadows || []).find(shadow => shadow.slug === slug)); const baseSelectedShadow = (0,external_wp_element_namespaceObject.useMemo)(() => (baseShadows || []).find(b => b.slug === slug), [baseShadows, slug]); const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_namespaceObject.useState)(false); const [isRenameModalVisible, setIsRenameModalVisible] = (0,external_wp_element_namespaceObject.useState)(false); const [shadowName, setShadowName] = (0,external_wp_element_namespaceObject.useState)(selectedShadow.name); if (!category || !slug) { return null; } const onShadowChange = shadow => { setSelectedShadow({ ...selectedShadow, shadow }); const updatedShadows = shadows.map(s => s.slug === slug ? { ...selectedShadow, shadow } : s); setShadows(updatedShadows); }; const onMenuClick = action => { if (action === 'reset') { const updatedShadows = shadows.map(s => s.slug === slug ? baseSelectedShadow : s); setSelectedShadow(baseSelectedShadow); setShadows(updatedShadows); } else if (action === 'delete') { setIsConfirmDialogVisible(true); } else if (action === 'rename') { setIsRenameModalVisible(true); } }; const handleShadowDelete = () => { setShadows(shadows.filter(s => s.slug !== slug)); }; const handleShadowRename = newName => { if (!newName) { return; } const updatedShadows = shadows.map(s => s.slug === slug ? { ...selectedShadow, name: newName } : s); setSelectedShadow({ ...selectedShadow, name: newName }); setShadows(updatedShadows); }; return !selectedShadow ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: "" }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: selectedShadow.name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginTop: 2, marginBottom: 0, paddingX: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_edit_panel_Menu, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Menu') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Popover, { children: (category === 'custom' ? customShadowMenuItems : presetShadowMenuItems).map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Item, { onClick: () => onMenuClick(item.action), disabled: item.action === 'reset' && selectedShadow.shadow === baseSelectedShadow.shadow, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.ItemLabel, { children: item.label }) }, item.action)) })] }) }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-global-styles-screen", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPreview, { shadow: selectedShadow.shadow }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowEditor, { shadow: selectedShadow.shadow, onChange: onShadowChange })] }), isConfirmDialogVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: true, onConfirm: () => { handleShadowDelete(); setIsConfirmDialogVisible(false); }, onCancel: () => { setIsConfirmDialogVisible(false); }, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), size: "medium", children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the shadow preset. */ (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" shadow preset?'), selectedShadow.name) }), isRenameModalVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Rename'), onRequestClose: () => setIsRenameModalVisible(false), size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { onSubmit: event => { event.preventDefault(); handleShadowRename(shadowName); setIsRenameModalVisible(false); }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, autoComplete: "off", label: (0,external_wp_i18n_namespaceObject.__)('Name'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Shadow name'), value: shadowName, onChange: value => setShadowName(value) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 6 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { className: "block-editor-shadow-edit-modal__actions", justify: "flex-end", expanded: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => setIsRenameModalVisible(false), children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)('Save') }) })] })] }) })] }); } function ShadowsPreview({ shadow }) { const shadowStyle = { boxShadow: shadow }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 4, marginTop: -2, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { align: "center", justify: "center", className: "edit-site-global-styles__shadow-preview-panel", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles__shadow-preview-block", style: shadowStyle }) }) }); } function ShadowEditor({ shadow, onChange }) { const addShadowButtonRef = (0,external_wp_element_namespaceObject.useRef)(); const shadowParts = (0,external_wp_element_namespaceObject.useMemo)(() => getShadowParts(shadow), [shadow]); const onChangeShadowPart = (index, part) => { const newShadowParts = [...shadowParts]; newShadowParts[index] = part; onChange(newShadowParts.join(', ')); }; const onAddShadowPart = () => { onChange([...shadowParts, defaultShadow].join(', ')); }; const onRemoveShadowPart = index => { onChange(shadowParts.filter((p, i) => i !== index).join(', ')); addShadowButtonRef.current.focus(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { align: "center", className: "edit-site-global-styles__shadows-panel__title", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)('Shadows') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__shadows-panel__options-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: library_plus, label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'), onClick: () => { onAddShadowPart(); }, ref: addShadowButtonRef }) })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadowParts.map((part, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_ShadowItem, { shadow: part, onChange: value => onChangeShadowPart(index, value), canRemove: shadowParts.length > 1, onRemove: () => onRemoveShadowPart(index) }, index)) })] }); } function shadows_edit_panel_ShadowItem({ shadow, onChange, canRemove, onRemove }) { const popoverProps = { placement: 'left-start', offset: 36, shift: true }; const shadowObj = (0,external_wp_element_namespaceObject.useMemo)(() => shadowStringToObject(shadow), [shadow]); const onShadowChange = newShadow => { onChange(shadowObjectToString(newShadow)); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, className: "edit-site-global-styles__shadow-editor__dropdown", renderToggle: ({ onToggle, isOpen }) => { const toggleProps = { onClick: onToggle, className: dist_clsx('edit-site-global-styles__shadow-editor__dropdown-toggle', { 'is-open': isOpen }), 'aria-expanded': isOpen }; const removeButtonProps = { onClick: () => { if (isOpen) { onToggle(); } onRemove(); }, className: dist_clsx('edit-site-global-styles__shadow-editor__remove-button', { 'is-open': isOpen }), label: (0,external_wp_i18n_namespaceObject.__)('Remove shadow') }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, icon: library_shadow, ...toggleProps, children: shadowObj.inset ? (0,external_wp_i18n_namespaceObject.__)('Inner shadow') : (0,external_wp_i18n_namespaceObject.__)('Drop shadow') }), canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: library_reset, ...removeButtonProps })] }); }, renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", className: "edit-site-global-styles__shadow-editor__dropdown-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPopover, { shadowObj: shadowObj, onChange: onShadowChange }) }) }); } function ShadowPopover({ shadowObj, onChange }) { const __experimentalIsRenderedInSidebar = true; const enableAlpha = true; const onShadowChange = (key, value) => { const newShadow = { ...shadowObj, [key]: value }; onChange(newShadow); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, className: "edit-site-global-styles__shadow-editor-panel", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorPalette, { clearable: false, enableAlpha: enableAlpha, __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, value: shadowObj.color, onChange: value => onShadowChange('color', value) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, value: shadowObj.inset ? 'inset' : 'outset', isBlock: true, onChange: value => onShadowChange('inset', value === 'inset'), hideLabelFromVision: true, __next40pxDefaultSize: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "outset", label: (0,external_wp_i18n_namespaceObject.__)('Outset') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "inset", label: (0,external_wp_i18n_namespaceObject.__)('Inset') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, gap: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { label: (0,external_wp_i18n_namespaceObject.__)('X Position'), value: shadowObj.x, onChange: value => onShadowChange('x', value) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { label: (0,external_wp_i18n_namespaceObject.__)('Y Position'), value: shadowObj.y, onChange: value => onShadowChange('y', value) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { label: (0,external_wp_i18n_namespaceObject.__)('Blur'), value: shadowObj.blur, onChange: value => onShadowChange('blur', value) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { label: (0,external_wp_i18n_namespaceObject.__)('Spread'), value: shadowObj.spread, onChange: value => onShadowChange('spread', value) })] })] }); } function ShadowInputControl({ label, value, onChange }) { const onValueChange = next => { const isNumeric = next !== undefined && !isNaN(parseFloat(next)); const nextValue = isNumeric ? next : '0px'; onChange(nextValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { label: label, __next40pxDefaultSize: true, value: value, onChange: onValueChange }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-shadows.js /** * Internal dependencies */ function ScreenShadows() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPanel, {}); } function ScreenShadowsEdit() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsEditPanel, {}); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: dimensions_panel_useGlobalStyle, useGlobalSetting: dimensions_panel_useGlobalSetting, useSettingsForBlockElement: dimensions_panel_useSettingsForBlockElement, DimensionsPanel: dimensions_panel_StylesDimensionsPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const DEFAULT_CONTROLS = { contentSize: true, wideSize: true, padding: true, margin: true, blockGap: true, minHeight: true, childLayout: false }; function DimensionsPanel() { const [style] = dimensions_panel_useGlobalStyle('', undefined, 'user', { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = dimensions_panel_useGlobalStyle('', undefined, 'all', { shouldDecodeEncode: false }); const [userSettings] = dimensions_panel_useGlobalSetting('', undefined, 'user'); const [rawSettings, setSettings] = dimensions_panel_useGlobalSetting(''); const settings = dimensions_panel_useSettingsForBlockElement(rawSettings); // These intermediary objects are needed because the "layout" property is stored // in settings rather than styles. const inheritedStyleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { return { ...inheritedStyle, layout: settings.layout }; }, [inheritedStyle, settings.layout]); const styleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { return { ...style, layout: userSettings.layout }; }, [style, userSettings.layout]); const onChange = newStyle => { const updatedStyle = { ...newStyle }; delete updatedStyle.layout; setStyle(updatedStyle); if (newStyle.layout !== userSettings.layout) { const updatedSettings = { ...userSettings, layout: newStyle.layout }; // Ensure any changes to layout definitions are not persisted. if (updatedSettings.layout?.definitions) { delete updatedSettings.layout.definitions; } setSettings(updatedSettings); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_panel_StylesDimensionsPanel, { inheritedValue: inheritedStyleWithLayout, value: styleWithLayout, onChange: onChange, settings: settings, includeLayoutControls: true, defaultControls: DEFAULT_CONTROLS }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHasDimensionsPanel: screen_layout_useHasDimensionsPanel, useGlobalSetting: screen_layout_useGlobalSetting, useSettingsForBlockElement: screen_layout_useSettingsForBlockElement } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenLayout() { const [rawSettings] = screen_layout_useGlobalSetting(''); const settings = screen_layout_useSettingsForBlockElement(rawSettings); const hasDimensionsPanel = screen_layout_useHasDimensionsPanel(settings); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('Layout') }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, {})] }); } /* harmony default export */ const screen_layout = (ScreenLayout); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js /** * WordPress dependencies */ /** * Internal dependencies */ const { GlobalStylesContext: style_variations_container_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function StyleVariationsContainer({ gap = 2 }) { const { user } = (0,external_wp_element_namespaceObject.useContext)(style_variations_container_GlobalStylesContext); const userStyles = user?.styles; const variations = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations(); }, []); // Filter out variations that are color or typography variations. const fullStyleVariations = variations?.filter(variation => { return !isVariationWithProperties(variation, ['color']) && !isVariationWithProperties(variation, ['typography', 'spacing']); }); const themeVariations = (0,external_wp_element_namespaceObject.useMemo)(() => { const withEmptyVariation = [{ title: (0,external_wp_i18n_namespaceObject.__)('Default'), settings: {}, styles: {} }, ...(fullStyleVariations !== null && fullStyleVariations !== void 0 ? fullStyleVariations : [])]; return [...withEmptyVariation.map(variation => { var _variation$settings; const blockStyles = { ...variation?.styles?.blocks } || {}; // We need to copy any user custom CSS to the variation to prevent it being lost // when switching variations. if (userStyles?.blocks) { Object.keys(userStyles.blocks).forEach(blockName => { // First get any block specific custom CSS from the current user styles and merge with any custom CSS for // that block in the variation. if (userStyles.blocks[blockName].css) { const variationBlockStyles = blockStyles[blockName] || {}; const customCSS = { css: `${blockStyles[blockName]?.css || ''} ${userStyles.blocks[blockName].css.trim() || ''}` }; blockStyles[blockName] = { ...variationBlockStyles, ...customCSS }; } }); } // Now merge any global custom CSS from current user styles with global custom CSS in the variation. const css = userStyles?.css || variation.styles?.css ? { css: `${variation.styles?.css || ''} ${userStyles?.css || ''}` } : {}; const blocks = Object.keys(blockStyles).length > 0 ? { blocks: blockStyles } : {}; const styles = { ...variation.styles, ...css, ...blocks }; return { ...variation, settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {}, styles }; })]; }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]); if (!fullStyleVariations || fullStyleVariations?.length < 1) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, className: "edit-site-global-styles-style-variations-container", gap: gap, children: themeVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { variation: variation, children: isFocused => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, { label: variation?.title, withHoverView: true, isFocused: isFocused, variation: variation }) }, index)) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/content.js /** * WordPress dependencies */ /** * Internal dependencies */ function SidebarNavigationScreenGlobalStylesContent() { const gap = 3; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 10, className: "edit-site-global-styles-variation-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, { gap: gap }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)('Palettes'), gap: gap }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)('Typography'), gap: gap })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useZoomOut } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenStyleVariations() { // Style Variations should only be previewed in with // - a "zoomed out" editor (but not when in preview mode) // - "Desktop" device preview const isPreviewMode = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_blockEditor_namespaceObject.store).getSettings().isPreviewMode; }, []); const { setDeviceType } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); useZoomOut(!isPreviewMode); (0,external_wp_element_namespaceObject.useEffect)(() => { setDeviceType('desktop'); }, [setDeviceType]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'), description: (0,external_wp_i18n_namespaceObject.__)('Choose a variation to change the look of the site.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { size: "small", isBorderless: true, className: "edit-site-global-styles-screen-style-variations", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}) }) })] }); } /* harmony default export */ const screen_style_variations = (ScreenStyleVariations); ;// external ["wp","mediaUtils"] const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/constants.js /** * WordPress dependencies */ /** * Internal dependencies */ const STYLE_BOOK_COLOR_GROUPS = [{ slug: 'theme-colors', title: (0,external_wp_i18n_namespaceObject.__)('Theme Colors'), origin: 'theme', type: 'colors' }, { slug: 'theme-gradients', title: (0,external_wp_i18n_namespaceObject.__)('Theme Gradients'), origin: 'theme', type: 'gradients' }, { slug: 'custom-colors', title: (0,external_wp_i18n_namespaceObject.__)('Custom Colors'), origin: 'custom', type: 'colors' }, { slug: 'custom-gradients', title: (0,external_wp_i18n_namespaceObject.__)('Custom Gradients'), origin: 'custom', // User. type: 'gradients' }, { slug: 'duotones', title: (0,external_wp_i18n_namespaceObject.__)('Duotones'), origin: 'theme', type: 'duotones' }, { slug: 'default-colors', title: (0,external_wp_i18n_namespaceObject.__)('Default Colors'), origin: 'default', type: 'colors' }, { slug: 'default-gradients', title: (0,external_wp_i18n_namespaceObject.__)('Default Gradients'), origin: 'default', type: 'gradients' }]; const STYLE_BOOK_THEME_SUBCATEGORIES = [{ slug: 'site-identity', title: (0,external_wp_i18n_namespaceObject.__)('Site Identity'), blocks: ['core/site-logo', 'core/site-title', 'core/site-tagline'] }, { slug: 'design', title: (0,external_wp_i18n_namespaceObject.__)('Design'), blocks: ['core/navigation', 'core/avatar', 'core/post-time-to-read'], exclude: ['core/home-link', 'core/navigation-link'] }, { slug: 'posts', title: (0,external_wp_i18n_namespaceObject.__)('Posts'), blocks: ['core/post-title', 'core/post-excerpt', 'core/post-author', 'core/post-author-name', 'core/post-author-biography', 'core/post-date', 'core/post-terms', 'core/term-description', 'core/query-title', 'core/query-no-results', 'core/query-pagination', 'core/query-numbers'] }, { slug: 'comments', title: (0,external_wp_i18n_namespaceObject.__)('Comments'), blocks: ['core/comments-title', 'core/comments-pagination', 'core/comments-pagination-numbers', 'core/comments', 'core/comments-author-name', 'core/comment-content', 'core/comment-date', 'core/comment-edit-link', 'core/comment-reply-link', 'core/comment-template', 'core/post-comments-count', 'core/post-comments-link'] }]; const STYLE_BOOK_CATEGORIES = [{ slug: 'overview', title: (0,external_wp_i18n_namespaceObject.__)('Overview'), blocks: [] }, { slug: 'text', title: (0,external_wp_i18n_namespaceObject.__)('Text'), blocks: ['core/post-content', 'core/home-link', 'core/navigation-link'] }, { slug: 'colors', title: (0,external_wp_i18n_namespaceObject.__)('Colors'), blocks: [] }, { slug: 'theme', title: (0,external_wp_i18n_namespaceObject.__)('Theme'), subcategories: STYLE_BOOK_THEME_SUBCATEGORIES }, { slug: 'media', title: (0,external_wp_i18n_namespaceObject.__)('Media'), blocks: ['core/post-featured-image'] }, { slug: 'widgets', title: (0,external_wp_i18n_namespaceObject.__)('Widgets'), blocks: [] }, { slug: 'embed', title: (0,external_wp_i18n_namespaceObject.__)('Embeds'), include: [] }]; // Style book preview subcategories for all blocks section. const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [...STYLE_BOOK_THEME_SUBCATEGORIES, { slug: 'media', title: (0,external_wp_i18n_namespaceObject.__)('Media'), blocks: ['core/post-featured-image'] }, { slug: 'widgets', title: (0,external_wp_i18n_namespaceObject.__)('Widgets'), blocks: [] }, { slug: 'embed', title: (0,external_wp_i18n_namespaceObject.__)('Embeds'), include: [] }]; // Style book preview categories are organized slightly differently to the editor ones. const STYLE_BOOK_PREVIEW_CATEGORIES = [{ slug: 'overview', title: (0,external_wp_i18n_namespaceObject.__)('Overview'), blocks: [] }, { slug: 'text', title: (0,external_wp_i18n_namespaceObject.__)('Text'), blocks: ['core/post-content', 'core/home-link', 'core/navigation-link'] }, { slug: 'colors', title: (0,external_wp_i18n_namespaceObject.__)('Colors'), blocks: [] }, { slug: 'blocks', title: (0,external_wp_i18n_namespaceObject.__)('All Blocks'), blocks: [], subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES }]; // Forming a "block formatting context" to prevent margin collapsing. // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context const ROOT_CONTAINER = ` .is-root-container { display: flow-root; } `; // The content area of the Style Book is rendered within an iframe so that global styles // are applied to elements within the entire content area. To support elements that are // not part of the block previews, such as headings and layout for the block previews, // additional CSS rules need to be passed into the iframe. These are hard-coded below. // Note that button styles are unset, and then focus rules from the `Button` component are // applied to the `button` element, targeted via `.edit-site-style-book__example`. // This is to ensure that browser default styles for buttons are not applied to the previews. const STYLE_BOOK_IFRAME_STYLES = ` body { position: relative; padding: 32px !important; } ${ROOT_CONTAINER} .edit-site-style-book__examples { max-width: 1200px; margin: 0 auto; } .edit-site-style-book__example { max-width: 900px; border-radius: 2px; cursor: pointer; display: flex; flex-direction: column; gap: 40px; padding: 16px; width: 100%; box-sizing: border-box; scroll-margin-top: 32px; scroll-margin-bottom: 32px; margin: 0 auto 40px auto; } .edit-site-style-book__example.is-selected { box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); } .edit-site-style-book__example.is-disabled-example { pointer-events: none; } .edit-site-style-book__example:focus:not(:disabled) { box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); outline: 3px solid transparent; } .edit-site-style-book__duotone-example > div:first-child { display: flex; aspect-ratio: 16 / 9; grid-row: span 1; grid-column: span 2; } .edit-site-style-book__duotone-example img { width: 100%; height: 100%; object-fit: cover; } .edit-site-style-book__duotone-example > div:not(:first-child) { height: 20px; border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); } .edit-site-style-book__color-example { border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); } .edit-site-style-book__subcategory-title, .edit-site-style-book__example-title { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-size: 13px; font-weight: normal; line-height: normal; margin: 0; text-align: left; padding-top: 8px; border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent ); color: color-mix( in srgb, currentColor 60%, transparent ); } .edit-site-style-book__subcategory-title { font-size: 16px; margin-bottom: 40px; padding-bottom: 8px; } .edit-site-style-book__example-preview { width: 100%; } .edit-site-style-book__example-preview .block-editor-block-list__insertion-point, .edit-site-style-book__example-preview .block-list-appender { display: none; } :where(.is-root-container > .wp-block:first-child) { margin-top: 0; } :where(.is-root-container > .wp-block:last-child) { margin-bottom: 0; } `; ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/categories.js /** * WordPress dependencies */ // @wordpress/blocks imports are not typed. // @ts-expect-error /** * Internal dependencies */ /** * Returns category examples for a given category definition and list of examples. * @param {StyleBookCategory} categoryDefinition The category definition. * @param {BlockExample[]} examples An array of block examples. * @return {CategoryExamples|undefined} An object containing the category examples. */ function getExamplesByCategory(categoryDefinition, examples) { var _categoryDefinition$s; if (!categoryDefinition?.slug || !examples?.length) { return; } const categories = (_categoryDefinition$s = categoryDefinition?.subcategories) !== null && _categoryDefinition$s !== void 0 ? _categoryDefinition$s : []; if (categories.length) { return categories.reduce((acc, subcategoryDefinition) => { const subcategoryExamples = getExamplesByCategory(subcategoryDefinition, examples); if (subcategoryExamples) { if (!acc.subcategories) { acc.subcategories = []; } acc.subcategories = [...acc.subcategories, subcategoryExamples]; } return acc; }, { title: categoryDefinition.title, slug: categoryDefinition.slug }); } const blocksToInclude = categoryDefinition?.blocks || []; const blocksToExclude = categoryDefinition?.exclude || []; const categoryExamples = examples.filter(example => { return !blocksToExclude.includes(example.name) && (example.category === categoryDefinition.slug || blocksToInclude.includes(example.name)); }); if (!categoryExamples.length) { return; } return { title: categoryDefinition.title, slug: categoryDefinition.slug, examples: categoryExamples }; } /** * Returns category examples for a given category definition and list of examples. * * @return {StyleBookCategory[]} An array of top-level category definitions. */ function getTopLevelStyleBookCategories() { const reservedCategories = [...STYLE_BOOK_THEME_SUBCATEGORIES, ...STYLE_BOOK_CATEGORIES].map(({ slug }) => slug); const extraCategories = (0,external_wp_blocks_namespaceObject.getCategories)(); const extraCategoriesFiltered = extraCategories.filter(({ slug }) => !reservedCategories.includes(slug)); return [...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered]; } ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/color-examples.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ColorExamples = ({ colors, type, templateColumns = '1fr 1fr', itemHeight = '52px' }) => { if (!colors) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { templateColumns: templateColumns, rowGap: 8, columnGap: 16, children: colors.map(color => { const className = type === 'gradients' ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(color.slug) : (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', color.slug); const classes = dist_clsx('edit-site-style-book__color-example', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { className: classes, style: { height: itemHeight } }, color.slug); }) }); }; /* harmony default export */ const color_examples = (ColorExamples); ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/duotone-examples.js /** * WordPress dependencies */ /** * Internal dependencies */ const DuotoneExamples = ({ duotones }) => { if (!duotones) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, rowGap: 16, columnGap: 16, children: duotones.map(duotone => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { className: "edit-site-style-book__duotone-example", columns: 2, rowGap: 8, columnGap: 8, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { alt: `Duotone example: ${duotone.slug}`, src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg", style: { filter: `url(#wp-duotone-${duotone.slug})` } }) }), duotone.colors.map(color => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { className: "edit-site-style-book__color-example", style: { backgroundColor: color } }, color); })] }, duotone.slug); }) }); }; /* harmony default export */ const duotone_examples = (DuotoneExamples); ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/examples.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns examples color examples for each origin * e.g. Core (Default), Theme, and User. * * @param {MultiOriginPalettes} colors Global Styles color palettes per origin. * @return {BlockExample[]} An array of color block examples. */ function getColorExamples(colors) { if (!colors) { return []; } const examples = []; STYLE_BOOK_COLOR_GROUPS.forEach(group => { const palette = colors[group.type]; const paletteFiltered = Array.isArray(palette) ? palette.find(origin => origin.slug === group.origin) : undefined; if (paletteFiltered?.[group.type]) { const example = { name: group.slug, title: group.title, category: 'colors' }; if (group.type === 'duotones') { example.content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(duotone_examples, { duotones: paletteFiltered[group.type] }); examples.push(example); } else { example.content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_examples, { colors: paletteFiltered[group.type], type: group.type }); examples.push(example); } } }); return examples; } /** * Returns examples for the overview page. * * @param {MultiOriginPalettes} colors Global Styles color palettes per origin. * @return {BlockExample[]} An array of block examples. */ function getOverviewBlockExamples(colors) { const examples = []; // Get theme palette from colors if they exist. const themePalette = Array.isArray(colors?.colors) ? colors.colors.find(origin => origin.slug === 'theme') : undefined; if (themePalette) { const themeColorexample = { name: 'theme-colors', title: (0,external_wp_i18n_namespaceObject.__)('Colors'), category: 'overview', content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_examples, { colors: themePalette.colors, type: "colors", templateColumns: "repeat(auto-fill, minmax( 200px, 1fr ))", itemHeight: "32px" }) }; examples.push(themeColorexample); } // Get examples for typography blocks. const typographyBlockExamples = []; if ((0,external_wp_blocks_namespaceObject.getBlockType)('core/heading')) { const headingBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { content: (0,external_wp_i18n_namespaceObject.__)(`AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™`), level: 1 }); typographyBlockExamples.push(headingBlock); } if ((0,external_wp_blocks_namespaceObject.getBlockType)('core/paragraph')) { const firstParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', { content: (0,external_wp_i18n_namespaceObject.__)(`A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`) }); const secondParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', { content: (0,external_wp_i18n_namespaceObject.__)(`Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`) }); if ((0,external_wp_blocks_namespaceObject.getBlockType)('core/group')) { const groupBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/group', { layout: { type: 'grid', columnCount: 2, minimumColumnWidth: '12rem' }, style: { spacing: { blockGap: '1.5rem' } } }, [firstParagraphBlock, secondParagraphBlock]); typographyBlockExamples.push(groupBlock); } else { typographyBlockExamples.push(firstParagraphBlock); } } if (!!typographyBlockExamples.length) { examples.push({ name: 'typography', title: (0,external_wp_i18n_namespaceObject.__)('Typography'), category: 'overview', blocks: typographyBlockExamples }); } const otherBlockExamples = ['core/image', 'core/separator', 'core/buttons', 'core/pullquote', 'core/search']; // Get examples for other blocks and put them in order of above array. otherBlockExamples.forEach(blockName => { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); if (blockType && blockType.example) { const blockExample = { name: blockName, title: blockType.title, category: 'overview', /* * CSS generated from style attributes will take precedence over global styles CSS, * so remove the style attribute from the example to ensure the example * demonstrates changes to global styles. */ blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, { ...blockType.example, attributes: { ...blockType.example.attributes, style: undefined } }) }; examples.push(blockExample); } }); return examples; } /** * Returns a list of examples for registered block types. * * @param {MultiOriginPalettes} colors Global styles colors grouped by origin e.g. Core, Theme, and User. * @return {BlockExample[]} An array of block examples. */ function getExamples(colors) { const nonHeadingBlockExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => { const { name, example, supports } = blockType; return name !== 'core/heading' && !!example && supports?.inserter !== false; }).map(blockType => ({ name: blockType.name, title: blockType.title, category: blockType.category, /* * CSS generated from style attributes will take precedence over global styles CSS, * so remove the style attribute from the example to ensure the example * demonstrates changes to global styles. */ blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, { ...blockType.example, attributes: { ...blockType.example.attributes, style: undefined } }) })); const isHeadingBlockRegistered = !!(0,external_wp_blocks_namespaceObject.getBlockType)('core/heading'); if (!isHeadingBlockRegistered) { return nonHeadingBlockExamples; } // Use our own example for the Heading block so that we can show multiple // heading levels. const headingsExample = { name: 'core/heading', title: (0,external_wp_i18n_namespaceObject.__)('Headings'), category: 'text', blocks: [1, 2, 3, 4, 5, 6].map(level => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { content: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: heading level e.g: "1", "2", "3" (0,external_wp_i18n_namespaceObject.__)('Heading %d'), level), level }); }) }; const colorExamples = getColorExamples(colors); const overviewBlockExamples = getOverviewBlockExamples(colors); return [headingsExample, ...colorExamples, ...nonHeadingBlockExamples, ...overviewBlockExamples]; } ;// ./node_modules/@wordpress/edit-site/build-module/components/page/header.js /** * WordPress dependencies */ /** * Internal dependencies */ function Header({ title, subTitle, actions }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "edit-site-page-header", as: "header", spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "edit-site-page-header__page-title", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { as: "h2", level: 3, weight: 500, className: "edit-site-page-header__title", truncate: true, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-page-header__actions", children: actions })] }), subTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", as: "p", className: "edit-site-page-header__sub-title", children: subTitle })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/page/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { NavigableRegion: page_NavigableRegion } = unlock(external_wp_editor_namespaceObject.privateApis); function Page({ title, subTitle, actions, children, className, hideTitleFromUI = false }) { const classes = dist_clsx('edit-site-page', className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_NavigableRegion, { className: classes, ariaLabel: title, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-page-content", children: [!hideTitleFromUI && title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Header, { title: title, subTitle: subTitle, actions: actions }), children] }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-global-styles-wrapper/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: sidebar_global_styles_wrapper_useLocation, useHistory: sidebar_global_styles_wrapper_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const GlobalStylesPageActions = ({ isStyleBookOpened, setIsStyleBookOpened, path }) => { const history = sidebar_global_styles_wrapper_useHistory(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { isPressed: isStyleBookOpened, icon: library_seen, label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), onClick: () => { setIsStyleBookOpened(!isStyleBookOpened); const updatedPath = !isStyleBookOpened ? (0,external_wp_url_namespaceObject.addQueryArgs)(path, { preview: 'stylebook' }) : (0,external_wp_url_namespaceObject.removeQueryArgs)(path, 'preview'); // Navigate to the updated path. history.navigate(updatedPath); }, size: "compact" }); }; /** * Hook to deal with navigation and location state. * * @return {Array} The current section and a function to update it. */ const useSection = () => { const { path, query } = sidebar_global_styles_wrapper_useLocation(); const history = sidebar_global_styles_wrapper_useHistory(); return (0,external_wp_element_namespaceObject.useMemo)(() => { var _query$section; return [(_query$section = query.section) !== null && _query$section !== void 0 ? _query$section : '/', updatedSection => { history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { section: updatedSection })); }]; }, [path, query.section, history]); }; function GlobalStylesUIWrapper() { const { path } = sidebar_global_styles_wrapper_useLocation(); const [isStyleBookOpened, setIsStyleBookOpened] = (0,external_wp_element_namespaceObject.useState)(path.includes('preview=stylebook')); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const [section, onChangeSection] = useSection(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { actions: !isMobileViewport ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesPageActions, { isStyleBookOpened: isStyleBookOpened, setIsStyleBookOpened: setIsStyleBookOpened, path: path }) : null, className: "edit-site-styles", title: (0,external_wp_i18n_namespaceObject.__)('Styles'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_ui, { path: section, onPathChange: onChangeSection }) }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { ExperimentalBlockEditorProvider, useGlobalStyle: style_book_useGlobalStyle, GlobalStylesContext: style_book_GlobalStylesContext, useGlobalStylesOutputWithConfig } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); const { Tabs: style_book_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function isObjectEmpty(object) { return !object || Object.keys(object).length === 0; } /** * Scrolls to a section within an iframe. * * @param {string} anchorId The id of the element to scroll to. * @param {HTMLIFrameElement} iframe The target iframe. */ const scrollToSection = (anchorId, iframe) => { if (!anchorId || !iframe || !iframe?.contentDocument) { return; } const element = anchorId === 'top' ? iframe.contentDocument.body : iframe.contentDocument.getElementById(anchorId); if (element) { element.scrollIntoView({ behavior: 'smooth' }); } }; /** * Parses a Block Editor navigation path to build a style book navigation path. * The object can be extended to include a category, representing a style book tab/section. * * @param {string} path An internal Block Editor navigation path. * @return {null|{block: string}} An object containing the example to navigate to. */ const getStyleBookNavigationFromPath = path => { if (path && typeof path === 'string') { if (path === '/' || path.startsWith('/typography') || path.startsWith('/colors') || path.startsWith('/blocks')) { return { top: true }; } } return null; }; /** * Retrieves colors, gradients, and duotone filters from Global Styles. * The inclusion of default (Core) palettes is controlled by the relevant * theme.json property e.g. defaultPalette, defaultGradients, defaultDuotone. * * @return {Object} Object containing properties for each type of palette. */ function useMultiOriginPalettes() { const { colors, gradients } = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)(); // Add duotone filters to the palettes data. const [shouldDisplayDefaultDuotones, customDuotones, themeDuotones, defaultDuotones] = (0,external_wp_blockEditor_namespaceObject.useSettings)('color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default'); const palettes = (0,external_wp_element_namespaceObject.useMemo)(() => { const result = { colors, gradients, duotones: [] }; if (themeDuotones && themeDuotones.length) { result.duotones.push({ name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates these duotone filters come from the theme.'), slug: 'theme', duotones: themeDuotones }); } if (shouldDisplayDefaultDuotones && defaultDuotones && defaultDuotones.length) { result.duotones.push({ name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates these duotone filters come from WordPress.'), slug: 'default', duotones: defaultDuotones }); } if (customDuotones && customDuotones.length) { result.duotones.push({ name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates these doutone filters are created by the user.'), slug: 'custom', duotones: customDuotones }); } return result; }, [colors, gradients, customDuotones, themeDuotones, defaultDuotones, shouldDisplayDefaultDuotones]); return palettes; } /** * Get deduped examples for single page stylebook. * @param {Array} examples Array of examples. * @return {Array} Deduped examples. */ function getExamplesForSinglePageUse(examples) { const examplesForSinglePageUse = []; const overviewCategoryExamples = getExamplesByCategory({ slug: 'overview' }, examples); examplesForSinglePageUse.push(...overviewCategoryExamples.examples); const otherExamples = examples.filter(example => { return example.category !== 'overview' && !overviewCategoryExamples.examples.find(overviewExample => overviewExample.name === example.name); }); examplesForSinglePageUse.push(...otherExamples); return examplesForSinglePageUse; } function StyleBook({ enableResizing = true, isSelected, onClick, onSelect, showCloseButton = true, onClose, showTabs = true, userConfig = {}, path = '' }) { const [textColor] = style_book_useGlobalStyle('color.text'); const [backgroundColor] = style_book_useGlobalStyle('color.background'); const colors = useMultiOriginPalettes(); const examples = (0,external_wp_element_namespaceObject.useMemo)(() => getExamples(colors), [colors]); const tabs = (0,external_wp_element_namespaceObject.useMemo)(() => getTopLevelStyleBookCategories().filter(category => examples.some(example => example.category === category.slug)), [examples]); const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); const { base: baseConfig } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext); const goTo = getStyleBookNavigationFromPath(path); const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); } return {}; }, [baseConfig, userConfig]); // Copied from packages/edit-site/src/components/revisions/index.js // could we create a shared hook? const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...originalSettings, styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : originalSettings.styles, isPreviewMode: true }), [globalStyles, originalSettings, userConfig]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { onClose: onClose, enableResizing: enableResizing, closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)('Close') : null, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('edit-site-style-book', { 'is-button': !!onClick }), style: { color: textColor, background: backgroundColor }, children: showTabs ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-style-book__tablist-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabList, { children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.Tab, { tabId: tab.slug, children: tab.title }, tab.slug)) }) }), tabs.map(tab => { const categoryDefinition = tab.slug ? getTopLevelStyleBookCategories().find(_category => _category.slug === tab.slug) : null; const filteredExamples = categoryDefinition ? getExamplesByCategory(categoryDefinition, examples) : { examples }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabPanel, { tabId: tab.slug, focusable: false, className: "edit-site-style-book__tabpanel", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { category: tab.slug, examples: filteredExamples, isSelected: isSelected, onSelect: onSelect, settings: settings, title: tab.title, goTo: goTo }) }, tab.slug); })] }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { examples: { examples: examplesForSinglePageUse }, isSelected: isSelected, onClick: onClick, onSelect: onSelect, settings: settings, goTo: goTo }) }) }); } /** * Style Book Preview component renders the stylebook without the Editor dependency. * * @param {Object} props Component props. * @param {Object} props.userConfig User configuration. * @param {boolean} props.isStatic Whether the stylebook is static or clickable. * @return {Object} Style Book Preview component. */ const StyleBookPreview = ({ userConfig = {}, isStatic = false }) => { const siteEditorSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []); const canUserUploadMedia = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'root', name: 'media' }), []); // Update block editor settings because useMultipleOriginColorsAndGradients fetch colours from there. (0,external_wp_element_namespaceObject.useEffect)(() => { (0,external_wp_data_namespaceObject.dispatch)(external_wp_blockEditor_namespaceObject.store).updateSettings({ ...siteEditorSettings, mediaUpload: canUserUploadMedia ? external_wp_mediaUtils_namespaceObject.uploadMedia : undefined }); }, [siteEditorSettings, canUserUploadMedia]); const [section, onChangeSection] = useSection(); const isSelected = blockName => { // Match '/blocks/core%2Fbutton' and // '/blocks/core%2Fbutton/typography', but not // '/blocks/core%2Fbuttons'. return section === `/blocks/${encodeURIComponent(blockName)}` || section.startsWith(`/blocks/${encodeURIComponent(blockName)}/`); }; const onSelect = blockName => { if (STYLE_BOOK_COLOR_GROUPS.find(group => group.slug === blockName)) { // Go to color palettes Global Styles. onChangeSection('/colors/palette'); return; } if (blockName === 'typography') { // Go to typography Global Styles. onChangeSection('/typography'); return; } // Now go to the selected block. onChangeSection(`/blocks/${encodeURIComponent(blockName)}`); }; const colors = useMultiOriginPalettes(); const examples = getExamples(colors); const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); let previewCategory = null; if (section.includes('/colors')) { previewCategory = 'colors'; } else if (section.includes('/typography')) { previewCategory = 'text'; } else if (section.includes('/blocks')) { previewCategory = 'blocks'; const blockName = decodeURIComponent(section).split('/blocks/')[1]; if (blockName && examples.find(example => example.name === blockName)) { previewCategory = blockName; } } else if (!isStatic) { previewCategory = 'overview'; } const categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find(category => category.slug === previewCategory); // If there's no category definition there may be a single block. const filteredExamples = categoryDefinition ? getExamplesByCategory(categoryDefinition, examples) : { examples: [examples.find(example => example.name === previewCategory)] }; // If there's no preview category, show all examples. const displayedExamples = previewCategory ? filteredExamples : { examples: examplesForSinglePageUse }; const { base: baseConfig } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext); const goTo = getStyleBookNavigationFromPath(section); const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); } return {}; }, [baseConfig, userConfig]); const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...siteEditorSettings, styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : siteEditorSettings.styles, isPreviewMode: true }), [globalStyles, siteEditorSettings, userConfig]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-style-book", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { settings: settings, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { disableRootPadding: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { examples: displayedExamples, settings: settings, goTo: goTo, isSelected: !isStatic ? isSelected : null, onSelect: !isStatic ? onSelect : null })] }) }); }; const StyleBookBody = ({ examples, isSelected, onClick, onSelect, settings, title, goTo }) => { const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); const [hasIframeLoaded, setHasIframeLoaded] = (0,external_wp_element_namespaceObject.useState)(false); const iframeRef = (0,external_wp_element_namespaceObject.useRef)(null); // The presence of an `onClick` prop indicates that the Style Book is being used as a button. // In this case, add additional props to the iframe to make it behave like a button. const buttonModeProps = { role: 'button', onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), onKeyDown: event => { if (event.defaultPrevented) { return; } const { keyCode } = event; if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) { event.preventDefault(); onClick(event); } }, onClick: event => { if (event.defaultPrevented) { return; } if (onClick) { event.preventDefault(); onClick(event); } }, readonly: true }; const handleLoad = () => setHasIframeLoaded(true); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (hasIframeLoaded && iframeRef?.current) { if (goTo?.top) { scrollToSection('top', iframeRef?.current); } } }, [iframeRef?.current, goTo, scrollToSection, hasIframeLoaded]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { onLoad: handleLoad, ref: iframeRef, className: dist_clsx('edit-site-style-book__iframe', { 'is-focused': isFocused && !!onClick, 'is-button': !!onClick }), name: "style-book-canvas", tabIndex: 0, ...(onClick ? buttonModeProps : {}), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: settings.styles }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("style", { children: [STYLE_BOOK_IFRAME_STYLES, !!onClick && 'body { cursor: pointer; } body * { pointer-events: none; }'] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Examples, { className: "edit-site-style-book__examples", filteredExamples: examples, label: title ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Category of blocks, e.g. Text. (0,external_wp_i18n_namespaceObject.__)('Examples of blocks in the %s category'), title) : (0,external_wp_i18n_namespaceObject.__)('Examples of blocks'), isSelected: isSelected, onSelect: onSelect }, title)] }); }; const Examples = (0,external_wp_element_namespaceObject.memo)(({ className, filteredExamples, label, isSelected, onSelect }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite, { orientation: "vertical", className: className, "aria-label": label, role: "grid", children: [!!filteredExamples?.examples?.length && filteredExamples.examples.map(example => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Example, { id: `example-${example.name}`, title: example.title, content: example.content, blocks: example.blocks, isSelected: isSelected?.(example.name), onClick: !!onSelect ? () => onSelect(example.name) : null }, example.name)), !!filteredExamples?.subcategories?.length && filteredExamples.subcategories.map(subcategory => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Group, { className: "edit-site-style-book__subcategory", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.GroupLabel, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-site-style-book__subcategory-title", children: subcategory.title }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Subcategory, { examples: subcategory.examples, isSelected: isSelected, onSelect: onSelect })] }, `subcategory-${subcategory.slug}`))] }); }); const Subcategory = ({ examples, isSelected, onSelect }) => { return !!examples?.length && examples.map(example => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Example, { id: `example-${example.name}`, title: example.title, content: example.content, blocks: example.blocks, isSelected: isSelected?.(example.name), onClick: !!onSelect ? () => onSelect(example.name) : null }, example.name)); }; const disabledExamples = ['example-duotones']; const Example = ({ id, title, blocks, isSelected, onClick, content }) => { const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...originalSettings, focusMode: false, // Disable "Spotlight mode". isPreviewMode: true }), [originalSettings]); // Cache the list of blocks to avoid additional processing when the component is re-rendered. const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); const disabledProps = disabledExamples.includes(id) || !onClick ? { disabled: true, accessibleWhenDisabled: !!onClick } : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "row", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { className: dist_clsx('edit-site-style-book__example', { 'is-selected': isSelected, 'is-disabled-example': !!disabledProps?.disabled }), id: id, "aria-label": !!onClick ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of a block, e.g. Heading. (0,external_wp_i18n_namespaceObject.__)('Open %s styles in Styles panel'), title) : undefined, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), role: !!onClick ? 'button' : null, onClick: onClick, ...disabledProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-style-book__example-title", children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-style-book__example-preview", "aria-hidden": true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "edit-site-style-book__example-preview__content", children: content ? content : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalBlockEditorProvider, { value: renderedBlocks, settings: settings, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false })] }) }) })] }) }) }); }; /* harmony default export */ const style_book = (StyleBook); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: screen_css_useGlobalStyle, AdvancedPanel: screen_css_StylesAdvancedPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenCSS() { const description = (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.'); const [style] = screen_css_useGlobalStyle('', undefined, 'user', { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = screen_css_useGlobalStyle('', undefined, 'all', { shouldDecodeEncode: false }); const { setEditorCanvasContainerView } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: (0,external_wp_i18n_namespaceObject.__)('CSS'), description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [description, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://developer.wordpress.org/advanced-administration/wordpress/css/'), className: "edit-site-global-styles-screen-css-help-link", children: (0,external_wp_i18n_namespaceObject.__)('Learn more about CSS') })] }), onBack: () => { setEditorCanvasContainerView(undefined); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-css", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_StylesAdvancedPanel, { value: style, onChange: setStyle, inheritedValue: inheritedStyle }) })] }); } /* harmony default export */ const screen_css = (ScreenCSS); ;// ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider, GlobalStylesContext: revisions_GlobalStylesContext, useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig, __unstableBlockStyleVariationOverridesWithConfig } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); function revisions_isObjectEmpty(object) { return !object || Object.keys(object).length === 0; } function Revisions({ userConfig, blocks }) { const { base: baseConfig } = (0,external_wp_element_namespaceObject.useContext)(revisions_GlobalStylesContext); const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) { return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig); } return {}; }, [baseConfig, userConfig]); const renderedBlocksArray = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...originalSettings, isPreviewMode: true }), [originalSettings]); const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig); const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { title: (0,external_wp_i18n_namespaceObject.__)('Revisions'), closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions'), enableResizing: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { className: "edit-site-revisions__iframe", name: "revisions", tabIndex: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: // Forming a "block formatting context" to prevent margin collapsing. // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context `.is-root-container { display: flow-root; }` }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "edit-site-revisions__example-preview__content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(revisions_ExperimentalBlockEditorProvider, { value: renderedBlocksArray, settings: settings, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: editorStyles }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(__unstableBlockStyleVariationOverridesWithConfig, { config: mergedConfig })] }) })] }) }); } /* harmony default export */ const components_revisions = (Revisions); ;// external ["wp","date"] const external_wp_date_namespaceObject = window["wp"]["date"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js /** * WordPress dependencies */ /** * Internal dependencies */ const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24; const { getGlobalStylesChanges } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ChangesSummary({ revision, previousRevision }) { const changes = getGlobalStylesChanges(revision, previousRevision, { maxResults: 7 }); if (!changes.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { "data-testid": "global-styles-revision-changes", className: "edit-site-global-styles-screen-revisions__changes", children: changes.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: change }, change)) }); } /** * Returns a button label for the revision. * * @param {string|number} id A revision object. * @param {string} authorDisplayName Author name. * @param {string} formattedModifiedDate Revision modified date formatted. * @param {boolean} areStylesEqual Whether the revision matches the current editor styles. * @return {string} Translated label. */ function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) { if ('parent' === id) { return (0,external_wp_i18n_namespaceObject.__)('Reset the styles to the theme defaults'); } if ('unsaved' === id) { return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: author display name */ (0,external_wp_i18n_namespaceObject.__)('Unsaved changes by %s'), authorDisplayName); } return areStylesEqual ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: author display name. 2: revision creation date. (0,external_wp_i18n_namespaceObject.__)('Changes saved by %1$s on %2$s. This revision matches current editor styles.'), authorDisplayName, formattedModifiedDate) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: author display name. 2: revision creation date. (0,external_wp_i18n_namespaceObject.__)('Changes saved by %1$s on %2$s'), authorDisplayName, formattedModifiedDate); } /** * Returns a rendered list of revisions buttons. * * @typedef {Object} props * @property {Array<Object>} userRevisions A collection of user revisions. * @property {number} selectedRevisionId The id of the currently-selected revision. * @property {Function} onChange Callback fired when a revision is selected. * * @param {props} Component props. * @return {JSX.Element} The modal component. */ function RevisionsButtons({ userRevisions, selectedRevisionId, onChange, canApplyRevision, onApplyRevision }) { const { currentThemeName, currentUser } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentTheme, getCurrentUser } = select(external_wp_coreData_namespaceObject.store); const currentTheme = getCurrentTheme(); return { currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet, currentUser: getCurrentUser() }; }, []); const dateNowInMs = (0,external_wp_date_namespaceObject.getDate)().getTime(); const { datetimeAbbreviated } = (0,external_wp_date_namespaceObject.getSettings)().formats; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { orientation: "vertical", className: "edit-site-global-styles-screen-revisions__revisions-list", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Global styles revisions list'), role: "listbox", children: userRevisions.map((revision, index) => { const { id, author, modified } = revision; const isUnsaved = 'unsaved' === id; // Unsaved changes are created by the current user. const revisionAuthor = isUnsaved ? currentUser : author; const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)('User'); const authorAvatar = revisionAuthor?.avatar_urls?.['48']; const isFirstItem = index === 0; const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem; const areStylesEqual = !canApplyRevision && isSelected; const isReset = 'parent' === id; const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified); const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified); const revisionLabel = getRevisionLabel(id, authorDisplayName, (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate), areStylesEqual); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { className: "edit-site-global-styles-screen-revisions__revision-item", "aria-current": isSelected, role: "option", onKeyDown: event => { const { keyCode } = event; if (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) { onChange(revision); } }, onClick: event => { event.preventDefault(); onChange(revision); }, "aria-selected": isSelected, "aria-label": revisionLabel, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__revision-item-wrapper", children: isReset ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__description", children: [(0,external_wp_i18n_namespaceObject.__)('Default styles'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: currentThemeName })] }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__description", children: [isUnsaved ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__date", children: (0,external_wp_i18n_namespaceObject.__)('(Unsaved)') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { className: "edit-site-global-styles-screen-revisions__date", dateTime: modified, children: displayDate }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { alt: authorDisplayName, src: authorAvatar }), authorDisplayName] }), isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangesSummary, { revision: revision, previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {} })] }) }), isSelected && (areStylesEqual ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-screen-revisions__applied-text", children: (0,external_wp_i18n_namespaceObject.__)('These styles are already applied to your site.') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "primary", className: "edit-site-global-styles-screen-revisions__apply-button", onClick: onApplyRevision, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Apply the selected revision to your site.'), children: isReset ? (0,external_wp_i18n_namespaceObject.__)('Reset to defaults') : (0,external_wp_i18n_namespaceObject.__)('Apply') }))] }, id); }) }); } /* harmony default export */ const revisions_buttons = (RevisionsButtons); ;// ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js /** * External dependencies */ /** * WordPress dependencies */ function Pagination({ currentPage, numPages, changePage, totalItems, className, disabled = false, buttonVariant = 'tertiary', label = (0,external_wp_i18n_namespaceObject.__)('Pagination') }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, as: "nav", "aria-label": label, spacing: 3, justify: "flex-start", className: dist_clsx('edit-site-pagination', className), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", className: "edit-site-pagination__total", children: // translators: %s: Total number of patterns. (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Total number of patterns. (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: buttonVariant, onClick: () => changePage(1), accessibleWhenDisabled: true, disabled: disabled || currentPage === 1, label: (0,external_wp_i18n_namespaceObject.__)('First page'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, size: "compact" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: buttonVariant, onClick: () => changePage(currentPage - 1), accessibleWhenDisabled: true, disabled: disabled || currentPage === 1, label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, size: "compact" })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Current page number. 2: Total number of pages. (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: buttonVariant, onClick: () => changePage(currentPage + 1), accessibleWhenDisabled: true, disabled: disabled || currentPage === numPages, label: (0,external_wp_i18n_namespaceObject.__)('Next page'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right, size: "compact" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: buttonVariant, onClick: () => changePage(numPages), accessibleWhenDisabled: true, disabled: disabled || currentPage === numPages, label: (0,external_wp_i18n_namespaceObject.__)('Last page'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, size: "compact" })] })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { GlobalStylesContext: screen_revisions_GlobalStylesContext, areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const PAGE_SIZE = 10; function ScreenRevisions() { const { user: currentEditorGlobalStyles, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(screen_revisions_GlobalStylesContext); const { blocks, editorCanvasContainerView } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ editorCanvasContainerView: unlock(select(store)).getEditorCanvasContainerView(), blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks() }), []); const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1); const [currentRevisions, setCurrentRevisions] = (0,external_wp_element_namespaceObject.useState)([]); const { revisions, isLoading, hasUnsavedChanges, revisionsCount } = useGlobalStylesRevisions({ query: { per_page: PAGE_SIZE, page: currentPage } }); const numPages = Math.ceil(revisionsCount / PAGE_SIZE); const [currentlySelectedRevision, setCurrentlySelectedRevision] = (0,external_wp_element_namespaceObject.useState)(currentEditorGlobalStyles); const [isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges] = (0,external_wp_element_namespaceObject.useState)(false); const { setEditorCanvasContainerView } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual(currentlySelectedRevision, currentEditorGlobalStyles); // The actual code that triggers the revisions screen to navigate back // to the home screen in in `packages/edit-site/src/components/global-styles/ui.js`. const onCloseRevisions = () => { const canvasContainerView = editorCanvasContainerView === 'global-styles-revisions:style-book' ? 'style-book' : undefined; setEditorCanvasContainerView(canvasContainerView); }; const restoreRevision = revision => { setUserConfig(() => revision); setIsLoadingRevisionWithUnsavedChanges(false); onCloseRevisions(); }; (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isLoading && revisions.length) { setCurrentRevisions(revisions); } }, [revisions, isLoading]); const firstRevision = revisions[0]; const currentlySelectedRevisionId = currentlySelectedRevision?.id; const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId; (0,external_wp_element_namespaceObject.useEffect)(() => { /* * Ensure that the first item is selected and loaded into the preview pane * when no revision is selected and the selected styles don't match the current editor styles. * This is required in case editor styles are changed outside the revisions panel, * e.g., via the reset styles function of useGlobalStylesReset(). * See: https://github.com/WordPress/gutenberg/issues/55866 */ if (shouldSelectFirstItem) { setCurrentlySelectedRevision(firstRevision); } }, [shouldSelectFirstItem, firstRevision]); // Only display load button if there is a revision to load, // and it is different from the current editor styles. const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== 'unsaved' && !selectedRevisionMatchesEditorStyles; const hasRevisions = !!currentRevisions.length; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { title: revisionsCount && // translators: %s: number of revisions. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount), description: (0,external_wp_i18n_namespaceObject.__)('Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you\'re ready, use the Save button to save your changes.'), onBack: onCloseRevisions }), !hasRevisions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-global-styles-screen-revisions__loading" }), hasRevisions && (editorCanvasContainerView === 'global-styles-revisions:style-book' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { userConfig: currentlySelectedRevision, isSelected: () => {}, onClose: () => { setEditorCanvasContainerView('global-styles-revisions'); } }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_revisions, { blocks: blocks, userConfig: currentlySelectedRevision, closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions') })), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(revisions_buttons, { onChange: setCurrentlySelectedRevision, selectedRevisionId: currentlySelectedRevisionId, userRevisions: currentRevisions, canApplyRevision: isLoadButtonEnabled, onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision) }), numPages > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-revisions__footer", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { className: "edit-site-global-styles-screen-revisions__pagination", currentPage: currentPage, numPages: numPages, changePage: setCurrentPage, totalItems: revisionsCount, disabled: isLoading, label: (0,external_wp_i18n_namespaceObject.__)('Global Styles pagination') }) }), isLoadingRevisionWithUnsavedChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: isLoadingRevisionWithUnsavedChanges, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Apply'), onConfirm: () => restoreRevision(currentlySelectedRevision), onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false), size: "medium", children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to apply this revision? Any unsaved changes will be lost.') })] }); } /* harmony default export */ const screen_revisions = (ScreenRevisions); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js /** * WordPress dependencies */ /** * Internal dependencies */ const SLOT_FILL_NAME = 'GlobalStylesMenu'; const { useGlobalStylesReset: ui_useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME); function GlobalStylesActionMenu() { const [canReset, onReset] = ui_useGlobalStylesReset(); const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const { canEditCSS } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; return { canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] }; }, []); const { setEditorCanvasContainerView } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const loadCustomCSS = () => { setEditorCanvasContainerView('global-styles-css'); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('More'), toggleProps: { size: 'compact' }, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: loadCustomCSS, children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { toggle('core/edit-site', 'welcomeGuideStyles'); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { onReset(); onClose(); }, disabled: !canReset, children: (0,external_wp_i18n_namespaceObject.__)('Reset styles') }) })] }) }) }); } function GlobalStylesNavigationScreen({ className, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' '), ...props }); } function BlockStylesNavigationScreens({ parentMenu, blockStyles, blockName }) { return blockStyles.map((style, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: parentMenu + '/variations/' + style.name, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { name: blockName, variation: style.name }) }, index)); } function ContextScreens({ name, parentMenu = '' }) { const blockStyleVariations = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); return getBlockStyles(name); }, [name]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: parentMenu + '/colors/palette', children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette, { name: name }) }), !!blockStyleVariations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesNavigationScreens, { parentMenu: parentMenu, blockStyles: blockStyleVariations, blockName: name })] }); } function GlobalStylesStyleBook() { const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); const { path } = navigator.location; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { isSelected: blockName => // Match '/blocks/core%2Fbutton' and // '/blocks/core%2Fbutton/typography', but not // '/blocks/core%2Fbuttons'. path === `/blocks/${encodeURIComponent(blockName)}` || path.startsWith(`/blocks/${encodeURIComponent(blockName)}/`), onSelect: blockName => { if (STYLE_BOOK_COLOR_GROUPS.find(group => group.slug === blockName)) { // Go to color palettes Global Styles. navigator.goTo('/colors/palette'); return; } if (blockName === 'typography') { // Go to typography Global Styles. navigator.goTo('/typography'); return; } // Now go to the selected block. navigator.goTo('/blocks/' + encodeURIComponent(blockName)); } }); } function GlobalStylesBlockLink() { const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); const { selectedBlockName, selectedBlockClientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlockClientId, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); const clientId = getSelectedBlockClientId(); return { selectedBlockName: getBlockName(clientId), selectedBlockClientId: clientId }; }, []); const blockHasGlobalStyles = useBlockHasGlobalStyles(selectedBlockName); // When we're in the `Blocks` screen enable deep linking to the selected block. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!selectedBlockClientId || !blockHasGlobalStyles) { return; } const currentPath = navigator.location.path; if (currentPath !== '/blocks' && !currentPath.startsWith('/blocks/')) { return; } const newPath = '/blocks/' + encodeURIComponent(selectedBlockName); // Avoid navigating to the same path. This can happen when selecting // a new block of the same type. if (newPath !== currentPath) { navigator.goTo(newPath, { skipFocus: true }); } }, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]); } function GlobalStylesEditorCanvasContainerLink() { const { goTo, location } = (0,external_wp_components_namespaceObject.useNavigator)(); const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); const path = location?.path; const isRevisionsOpen = path === '/revisions'; // If the user switches the editor canvas container view, redirect // to the appropriate screen. This effectively allows deep linking to the // desired screens from outside the global styles navigation provider. (0,external_wp_element_namespaceObject.useEffect)(() => { switch (editorCanvasContainerView) { case 'global-styles-revisions': case 'global-styles-revisions:style-book': if (!isRevisionsOpen) { goTo('/revisions'); } break; case 'global-styles-css': goTo('/css'); break; // The stand-alone style book is open // and the revisions panel is open, // close the revisions panel. // Otherwise keep the style book open while // browsing global styles panel. // // Falling through as it matches the default scenario. case 'style-book': default: // In general, if the revision screen is in view but the // `editorCanvasContainerView` is not a revision view, close it. // This also includes the scenario when the stand-alone style // book is open, in which case we want the user to close the // revisions screen and browse global styles. if (isRevisionsOpen) { goTo('/', { isBack: true }); } break; } }, [editorCanvasContainerView, isRevisionsOpen, goTo]); } function useNavigatorSync(parentPath, onPathChange) { const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); const { path: childPath } = navigator.location; const previousParentPath = (0,external_wp_compose_namespaceObject.usePrevious)(parentPath); const previousChildPath = (0,external_wp_compose_namespaceObject.usePrevious)(childPath); (0,external_wp_element_namespaceObject.useEffect)(() => { if (parentPath !== childPath) { if (parentPath !== previousParentPath) { navigator.goTo(parentPath); } else if (childPath !== previousChildPath) { onPathChange(childPath); } } }, [onPathChange, parentPath, previousChildPath, previousParentPath, childPath, navigator]); } // This component is used to wrap the hook in order to conditionally execute it // when the parent component is used on controlled mode. function NavigationSync({ path: parentPath, onPathChange, children }) { useNavigatorSync(parentPath, onPathChange); return children; } function GlobalStylesUI({ path, onPathChange }) { const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { className: "edit-site-global-styles-sidebar__navigator-provider", initialPath: "/", children: [path && onPathChange && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationSync, { path: path, onPathChange: onPathChange }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/variations", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/blocks", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes/:origin/:slug", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/text", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { element: "text" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/link", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { element: "link" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/heading", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { element: "heading" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/caption", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { element: "caption" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/button", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { element: "button" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/colors", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows/edit/:category/:slug", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/layout", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/css", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/revisions", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/background", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_background, {}) }), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: '/blocks/' + encodeURIComponent(block.name), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { name: block.name }) }, 'menu-block-' + block.name)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, { name: block.name, parentMenu: '/blocks/' + encodeURIComponent(block.name) }, 'screens-block-' + block.name)), 'style-book' === editorCanvasContainerView && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesStyleBook, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesActionMenu, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesBlockLink, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesEditorCanvasContainerLink, {})] }); } /* harmony default export */ const global_styles_ui = (GlobalStylesUI); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js /** * WordPress dependencies */ /** * Internal dependencies */ const { ComplementaryArea, ComplementaryAreaMoreMenuItem } = unlock(external_wp_editor_namespaceObject.privateApis); function DefaultSidebar({ className, identifier, title, icon, children, closeLabel, header, headerClassName, panelClassName, isActiveByDefault }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryArea, { className: className, scope: "core", identifier: identifier, title: title, icon: icon, closeLabel: closeLabel, header: header, headerClassName: headerClassName, panelClassName: panelClassName, isActiveByDefault: isActiveByDefault, children: children }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { scope: "core", identifier: identifier, icon: icon, children: title })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { interfaceStore: global_styles_sidebar_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis); const { useLocation: global_styles_sidebar_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function GlobalStylesSidebar() { const { query } = global_styles_sidebar_useLocation(); const { canvas = 'view', name } = query; const { shouldClearCanvasContainerView, isStyleBookOpened, showListViewByDefault, hasRevisions, isRevisionsOpened, isRevisionsStyleBookOpened } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getActiveComplementaryArea } = select(global_styles_sidebar_interfaceStore); const { getEditorCanvasContainerView } = unlock(select(store)); const canvasContainerView = getEditorCanvasContainerView(); const _isVisualEditorMode = 'visual' === select(external_wp_editor_namespaceObject.store).getEditorMode(); const _isEditCanvasMode = 'edit' === canvas; const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; return { isStyleBookOpened: 'style-book' === canvasContainerView, shouldClearCanvasContainerView: 'edit-site/global-styles' !== getActiveComplementaryArea('core') || !_isVisualEditorMode || !_isEditCanvasMode, showListViewByDefault: _showListViewByDefault, hasRevisions: !!globalStyles?._links?.['version-history']?.[0]?.count, isRevisionsStyleBookOpened: 'global-styles-revisions:style-book' === canvasContainerView, isRevisionsOpened: 'global-styles-revisions' === canvasContainerView }; }, [canvas]); const { setEditorCanvasContainerView } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); (0,external_wp_element_namespaceObject.useEffect)(() => { if (shouldClearCanvasContainerView) { setEditorCanvasContainerView(undefined); } }, [shouldClearCanvasContainerView, setEditorCanvasContainerView]); const { setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); const toggleRevisions = () => { setIsListViewOpened(false); if (isRevisionsStyleBookOpened) { setEditorCanvasContainerView('style-book'); return; } if (isRevisionsOpened) { setEditorCanvasContainerView(undefined); return; } if (isStyleBookOpened) { setEditorCanvasContainerView('global-styles-revisions:style-book'); } else { setEditorCanvasContainerView('global-styles-revisions'); } }; const toggleStyleBook = () => { if (isRevisionsOpened) { setEditorCanvasContainerView('global-styles-revisions:style-book'); return; } if (isRevisionsStyleBookOpened) { setEditorCanvasContainerView('global-styles-revisions'); return; } setIsListViewOpened(isStyleBookOpened && showListViewByDefault); setEditorCanvasContainerView(isStyleBookOpened ? undefined : 'style-book'); }; const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(global_styles_sidebar_interfaceStore); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(global_styles_sidebar_interfaceStore); const previousActiveAreaRef = (0,external_wp_element_namespaceObject.useRef)(null); (0,external_wp_element_namespaceObject.useEffect)(() => { if (name === 'styles' && canvas === 'edit') { previousActiveAreaRef.current = getActiveComplementaryArea('core'); enableComplementaryArea('core', 'edit-site/global-styles'); } else if (previousActiveAreaRef.current) { enableComplementaryArea('core', previousActiveAreaRef.current); } }, [name, enableComplementaryArea, canvas, getActiveComplementaryArea]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultSidebar, { className: "edit-site-global-styles-sidebar", identifier: "edit-site/global-styles", title: (0,external_wp_i18n_namespaceObject.__)('Styles'), icon: library_styles, closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Styles'), panelClassName: "edit-site-global-styles-sidebar__panel", header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { className: "edit-site-global-styles-sidebar__header", gap: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-site-global-styles-sidebar__header-title", children: (0,external_wp_i18n_namespaceObject.__)('Styles') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-end", gap: 1, className: "edit-site-global-styles-sidebar__header-actions", children: [!isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: library_seen, label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), isPressed: isStyleBookOpened || isRevisionsStyleBookOpened, accessibleWhenDisabled: true, disabled: shouldClearCanvasContainerView, onClick: toggleStyleBook, size: "compact" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { label: (0,external_wp_i18n_namespaceObject.__)('Revisions'), icon: library_backup, onClick: toggleRevisions, accessibleWhenDisabled: true, disabled: !hasRevisions, isPressed: isRevisionsOpened || isRevisionsStyleBookOpened, size: "compact" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {})] })] }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_ui, {}) }); } ;// ./node_modules/@wordpress/icons/build-module/library/download.js /** * WordPress dependencies */ const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) }); /* harmony default export */ const library_download = (download); ;// external ["wp","blob"] const external_wp_blob_namespaceObject = window["wp"]["blob"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js /** * WordPress dependencies */ function SiteExport() { const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); async function handleExport() { try { const response = await external_wp_apiFetch_default()({ path: '/wp-block-editor/v1/export', parse: false, headers: { Accept: 'application/zip' } }); const blob = await response.blob(); const contentDisposition = response.headers.get('content-disposition'); const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export'; (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + '.zip', blob, 'application/zip'); } catch (errorResponse) { let error = {}; try { error = await errorResponse.json(); } catch (e) {} const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.'); createErrorNotice(errorMessage, { type: 'snackbar' }); } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { role: "menuitem", icon: library_download, onClick: handleExport, info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.'), children: (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item') }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js /** * WordPress dependencies */ function WelcomeGuideMenuItem() { const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => toggle('core/edit-site', 'welcomeGuide'), children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { ToolsMoreMenuGroup, PreferencesModal } = unlock(external_wp_editor_namespaceObject.privateApis); function MoreMenu() { const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { children: [isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {})] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: use_editor_iframe_props_useLocation, useHistory: use_editor_iframe_props_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function useEditorIframeProps() { const { query, path } = use_editor_iframe_props_useLocation(); const history = use_editor_iframe_props_useHistory(); const { canvas = 'view' } = query; const currentPostIsTrashed = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash'; }, []); const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (canvas === 'edit') { setIsFocused(false); } }, [canvas]); // In view mode, make the canvas iframe be perceived and behave as a button // to switch to edit mode, with a meaningful label and no title attribute. const viewModeIframeProps = { 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Edit'), 'aria-disabled': currentPostIsTrashed, title: null, role: 'button', tabIndex: 0, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), onKeyDown: event => { const { keyCode } = event; if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) { event.preventDefault(); history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: 'edit' }), { transition: 'canvas-mode-edit-transition' }); } }, onClick: () => history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: 'edit' }), { transition: 'canvas-mode-edit-transition' }), onClickCapture: event => { if (currentPostIsTrashed) { event.preventDefault(); event.stopPropagation(); } }, readonly: true }; return { className: dist_clsx('edit-site-visual-editor__editor-canvas', { 'is-focused': isFocused && canvas === 'view' }), ...(canvas === 'view' ? viewModeIframeProps : {}) }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: use_title_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function useTitle(title) { const location = use_title_useLocation(); const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')?.title, []); const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true); (0,external_wp_element_namespaceObject.useEffect)(() => { isInitialLocationRef.current = false; }, [location]); (0,external_wp_element_namespaceObject.useEffect)(() => { // Don't update or announce the title for initial page load. if (isInitialLocationRef.current) { return; } if (title && siteTitle) { // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68 const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */ (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s ‹ Editor — WordPress'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle)); document.title = formattedTitle; // Announce title on route change for screen readers. (0,external_wp_a11y_namespaceObject.speak)(title, 'assertive'); } }, [title, siteTitle, location]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js /** * WordPress dependencies */ /** * Internal dependencies */ const { getTemplateInfo } = unlock(external_wp_editor_namespaceObject.privateApis); function useEditorTitle(postType, postId) { const { title, isLoaded } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getCurrentTheme; const { getEditedEntityRecord, getCurrentTheme, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); if (!postId) { return { isLoaded: false }; } const _record = getEditedEntityRecord('postType', postType, postId); const { default_template_types: templateTypes = [] } = (_getCurrentTheme = getCurrentTheme()) !== null && _getCurrentTheme !== void 0 ? _getCurrentTheme : {}; const templateInfo = getTemplateInfo({ template: _record, templateTypes }); const _isLoaded = hasFinishedResolution('getEditedEntityRecord', ['postType', postType, postId]); return { title: templateInfo.title, isLoaded: _isLoaded }; }, [postType, postId]); let editorTitle; if (isLoaded) { var _POST_TYPE_LABELS$pos; editorTitle = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part). (0,external_wp_i18n_namespaceObject._x)('%1$s ‹ %2$s', 'breadcrumb trail'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (_POST_TYPE_LABELS$pos = POST_TYPE_LABELS[postType]) !== null && _POST_TYPE_LABELS$pos !== void 0 ? _POST_TYPE_LABELS$pos : POST_TYPE_LABELS[TEMPLATE_POST_TYPE]); } // Only announce the title once the editor is ready to prevent "Replace" // action in <URLQueryController> from double-announcing. useTitle(isLoaded && editorTitle); } /* harmony default export */ const use_editor_title = (useEditorTitle); ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-adapt-editor-to-canvas.js /** * WordPress dependencies */ function useAdaptEditorToCanvas(canvas) { const { clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { setDeviceType, closePublishSidebar, setIsListViewOpened, setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); const { get: getPreference } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches; registry.batch(() => { clearSelectedBlock(); setDeviceType('Desktop'); closePublishSidebar(); setIsInserterOpened(false); // Check if the block list view should be open by default. // If `distractionFree` mode is enabled, the block list view should not be open. // This behavior is disabled for small viewports. if (isMediumOrBigger && canvas === 'edit' && getPreference('core', 'showListViewByDefault') && !getPreference('core', 'distractionFree')) { setIsListViewOpened(true); } else { setIsListViewOpened(false); } }); }, [canvas, registry, clearSelectedBlock, setDeviceType, closePublishSidebar, setIsInserterOpened, setIsListViewOpened, getPreference]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-resolve-edited-entity.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: use_resolve_edited_entity_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const postTypesWithoutParentTemplate = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user]; const authorizedPostTypes = ['page', 'post']; function useResolveEditedEntity() { const { name, params = {}, query } = use_resolve_edited_entity_useLocation(); const { postId = query?.postId } = params; // Fallback to query param for postId for list view routes. let postType; if (name === 'navigation-item') { postType = NAVIGATION_POST_TYPE; } else if (name === 'pattern-item') { postType = PATTERN_TYPES.user; } else if (name === 'template-part-item') { postType = TEMPLATE_PART_POST_TYPE; } else if (name === 'template-item' || name === 'templates') { postType = TEMPLATE_POST_TYPE; } else if (name === 'page-item' || name === 'pages') { postType = 'page'; } else if (name === 'post-item' || name === 'posts') { postType = 'post'; } const homePage = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getHomePage } = unlock(select(external_wp_coreData_namespaceObject.store)); return getHomePage(); }, []); /** * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId * in order to match the frontend as closely as possible in the site editor. * * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution. */ const resolvedTemplateId = (0,external_wp_data_namespaceObject.useSelect)(select => { // If we're rendering a post type that doesn't have a template // no need to resolve its template. if (postTypesWithoutParentTemplate.includes(postType) && postId) { return; } // Don't trigger resolution for multi-selected posts. if (postId && postId.includes(',')) { return; } const { getTemplateId } = unlock(select(external_wp_coreData_namespaceObject.store)); // If we're rendering a specific page, we need to resolve its template. // The site editor only supports pages for now, not other CPTs. if (postType && postId && authorizedPostTypes.includes(postType)) { return getTemplateId(postType, postId); } // If we're rendering the home page, and we have a static home page, resolve its template. if (homePage?.postType === 'page') { return getTemplateId('page', homePage?.postId); } if (homePage?.postType === 'wp_template') { return homePage?.postId; } }, [homePage, postId, postType]); const context = (0,external_wp_element_namespaceObject.useMemo)(() => { if (postTypesWithoutParentTemplate.includes(postType) && postId) { return {}; } if (postType && postId && authorizedPostTypes.includes(postType)) { return { postType, postId }; } // TODO: for post types lists we should probably not render the front page, but maybe a placeholder // with a message like "Select a page" or something similar. if (homePage?.postType === 'page') { return { postType: 'page', postId: homePage?.postId }; } return {}; }, [homePage, postType, postId]); if (postTypesWithoutParentTemplate.includes(postType) && postId) { return { isReady: true, postType, postId, context }; } if (!!homePage) { return { isReady: resolvedTemplateId !== undefined, postType: TEMPLATE_POST_TYPE, postId: resolvedTemplateId, context }; } return { isReady: false }; } function useSyncDeprecatedEntityIntoState({ postType, postId, context, isReady }) { const { setEditedEntity } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isReady) { setEditedEntity(postType, postId, context); } }, [isReady, postType, postId, context, setEditedEntity]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/site-preview.js /** * WordPress dependencies */ function SitePreview() { const siteUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteData = getEntityRecord('root', '__unstableBase'); return siteData?.home; }, []); // If theme is block based, return the Editor, otherwise return the site preview. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { src: (0,external_wp_url_namespaceObject.addQueryArgs)(siteUrl, { // Parameter for hiding the admin bar. wp_site_preview: 1 }), title: (0,external_wp_i18n_namespaceObject.__)('Site Preview'), style: { display: 'block', width: '100%', height: '100%', backgroundColor: '#fff' }, onLoad: event => { // Make interactive elements unclickable. const document = event.target.contentDocument; const focusableElements = external_wp_dom_namespaceObject.focus.focusable.find(document); focusableElements.forEach(element => { element.style.pointerEvents = 'none'; element.tabIndex = -1; element.setAttribute('aria-hidden', 'true'); }); } }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Editor, BackButton } = unlock(external_wp_editor_namespaceObject.privateApis); const { useHistory: editor_useHistory, useLocation: editor_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const { BlockKeyboardShortcuts } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); const toggleHomeIconVariants = { edit: { opacity: 0, scale: 0.2 }, hover: { opacity: 1, scale: 1, clipPath: 'inset( 22% round 2px )' } }; const siteIconVariants = { edit: { clipPath: 'inset(0% round 0px)' }, hover: { clipPath: 'inset( 22% round 2px )' }, tap: { clipPath: 'inset(0% round 0px)' } }; function getListPathForPostType(postType) { switch (postType) { case 'navigation': return '/navigation'; case 'wp_block': return '/pattern?postType=wp_block'; case 'wp_template_part': return '/pattern?postType=wp_template_part'; case 'wp_template': return '/template'; case 'page': return '/page'; case 'post': return '/'; } throw 'Unknown post type'; } function getNavigationPath(location, postType) { const { path, name } = location; if (['pattern-item', 'template-part-item', 'page-item', 'template-item', 'post-item'].includes(name)) { return getListPathForPostType(postType); } return (0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: undefined }); } function EditSiteEditor({ isHomeRoute = false, isPostsList = false }) { const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const location = editor_useLocation(); const { canvas = 'view' } = location.query; const isLoading = useIsSiteEditorLoading(); useAdaptEditorToCanvas(canvas); const entity = useResolveEditedEntity(); // deprecated sync state with url useSyncDeprecatedEntityIntoState(entity); const { postType, postId, context } = entity; const { isBlockBasedTheme, editorCanvasView, currentPostIsTrashed, hasSiteIcon } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditorCanvasContainerView } = unlock(select(store)); const { getCurrentTheme, getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteData = getEntityRecord('root', '__unstableBase', undefined); return { isBlockBasedTheme: getCurrentTheme()?.is_block_theme, editorCanvasView: getEditorCanvasContainerView(), currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash', hasSiteIcon: !!siteData?.site_icon_url }; }, []); const postWithTemplate = !!context?.postId; use_editor_title(postWithTemplate ? context.postType : postType, postWithTemplate ? context.postId : postId); const _isPreviewingTheme = isPreviewingTheme(); const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer(); const iframeProps = useEditorIframeProps(); const isEditMode = canvas === 'edit'; const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)(CanvasLoader, 'edit-site-editor__loading-progress'); const settings = useSpecificEditorSettings(); const styles = (0,external_wp_element_namespaceObject.useMemo)(() => [...settings.styles, { // Forming a "block formatting context" to prevent margin collapsing. // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context css: canvas === 'view' ? `body{min-height: 100vh; ${currentPostIsTrashed ? '' : 'cursor: pointer;'}}` : undefined }], [settings.styles, canvas, currentPostIsTrashed]); const { resetZoomLevel } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const history = editor_useHistory(); const onActionPerformed = (0,external_wp_element_namespaceObject.useCallback)((actionId, items) => { switch (actionId) { case 'move-to-trash': case 'delete-post': { history.navigate(getListPathForPostType(postWithTemplate ? context.postType : postType)); } break; case 'duplicate-post': { const newItem = items[0]; const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered; createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of the created post or template, e.g: "Hello world". (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title)), { type: 'snackbar', id: 'duplicate-post-action', actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Edit'), onClick: () => { history.navigate(`/${newItem.type}/${newItem.id}?canvas=edit`); } }] }); } break; } }, [postType, context?.postType, postWithTemplate, history, createSuccessNotice]); // Replace the title and icon displayed in the DocumentBar when there's an overlay visible. const title = getEditorCanvasContainerTitle(editorCanvasView); const isReady = !isLoading; const transition = { duration: disableMotion ? 0 : 0.2 }; return !isBlockBasedTheme && isHomeRoute ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SitePreview, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { disableRootPadding: postType !== TEMPLATE_POST_TYPE }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), !isReady ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CanvasLoader, { id: loadingProgressId }) : null, isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, { postType: postWithTemplate ? context.postType : postType }), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Editor, { postType: postWithTemplate ? context.postType : postType, postId: postWithTemplate ? context.postId : postId, templateId: postWithTemplate ? postId : undefined, settings: settings, className: "edit-site-editor__editor-interface", styles: styles, customSaveButton: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { size: "compact" }), customSavePanel: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}), forceDisableBlockTools: !hasDefaultEditorCanvasView, title: title, iframeProps: iframeProps, onActionPerformed: onActionPerformed, extraSidebarPanels: !postWithTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel.Slot, {}), children: [isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, { children: ({ length }) => length <= 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { className: "edit-site-editor__view-mode-toggle", transition: transition, animate: "edit", initial: "edit", whileHover: "hover", whileTap: "tap", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Open Navigation'), showTooltip: true, tooltipPosition: "middle right", onClick: () => { resetZoomLevel(); // TODO: this is a temporary solution to navigate to the posts list if we are // come here through `posts list` and are in focus mode editing a template, template part etc.. if (isPostsList && location.query?.focusMode) { history.navigate('/', { transition: 'canvas-mode-view-transition' }); } else { history.navigate(getNavigationPath(location, postWithTemplate ? context.postType : postType), { transition: 'canvas-mode-view-transition' }); } }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: siteIconVariants, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { className: "edit-site-editor__view-mode-toggle-icon" }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { className: dist_clsx('edit-site-editor__back-icon', { 'has-site-icon': hasSiteIcon }), variants: toggleHomeIconVariants, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: arrow_up_left }) })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}), isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {})] })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/utils.js /** * Check if the classic theme supports the stylebook. * * @param {Object} siteData - The site data provided by the site editor route area resolvers. * @return {boolean} True if the stylebook is supported, false otherwise. */ function isClassicThemeWithStyleBookSupport(siteData) { const isBlockTheme = siteData.currentTheme?.is_block_theme; const supportsEditorStyles = siteData.currentTheme?.theme_supports['editor-styles']; // This is a temp solution until the has_theme_json value is available for the current theme. const hasThemeJson = siteData.editorSettings?.supportsLayout; return !isBlockTheme && (supportsEditorStyles || hasThemeJson); } ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/home.js /** * Internal dependencies */ const homeRoute = { name: 'home', path: '/', areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, preview({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isHomeRoute: true }) : undefined; }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/styles.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: styles_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function MobileGlobalStylesUI() { const { query = {} } = styles_useLocation(); const { canvas } = query; if (canvas === 'edit') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}); } const stylesRoute = { name: 'styles', path: '/styles', areas: { content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}), sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, { backPath: "/" }), preview({ query }) { const isStylebook = query.preview === 'stylebook'; return isStylebook ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); }, mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileGlobalStylesUI, {}) }, widths: { content: 380 } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js // This requested is preloaded in `gutenberg_preload_navigation_posts`. // As unbounded queries are limited to 100 by `fetchAllMiddleware` // on apiFetch this query is limited to 100. // These parameters must be kept aligned with those in // lib/compat/wordpress-6.3/navigation-block-preloading.php // and // block-library/src/navigation/constants.js const PRELOADED_NAVIGATION_MENUS_QUERY = { per_page: 100, status: ['publish', 'draft'], order: 'desc', orderby: 'date' }; ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js /** * WordPress dependencies */ const notEmptyString = testString => testString?.trim()?.length > 0; function RenameModal({ menuTitle, onClose, onSave }) { const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_namespaceObject.useState)(menuTitle); const titleHasChanged = editedMenuTitle !== menuTitle; const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Rename'), onRequestClose: onClose, focusOnMount: "firstContentElement", size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { className: "sidebar-navigation__rename-modal-form", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: editedMenuTitle, placeholder: (0,external_wp_i18n_namespaceObject.__)('Navigation title'), onChange: setEditedMenuTitle, label: (0,external_wp_i18n_namespaceObject.__)('Name') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, accessibleWhenDisabled: true, disabled: !isEditedMenuTitleValid, variant: "primary", type: "submit", onClick: e => { e.preventDefault(); if (!isEditedMenuTitleValid) { return; } onSave({ title: editedMenuTitle }); // Immediate close avoids ability to hit save multiple times. onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Save') })] })] }) }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js /** * WordPress dependencies */ function DeleteConfirmDialog({ onClose, onConfirm }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: true, onConfirm: () => { onConfirm(); // Immediate close avoids ability to hit delete multiple times. onClose(); }, onCancel: onClose, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), size: "medium", children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this Navigation Menu?') }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: more_menu_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const POPOVER_PROPS = { position: 'bottom right' }; function ScreenNavigationMoreMenu(props) { const { onDelete, onSave, onDuplicate, menuTitle, menuId } = props; const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); const history = more_menu_useHistory(); const closeModals = () => { setRenameModalOpen(false); setDeleteConfirmDialogOpen(false); }; const openRenameModal = () => setRenameModalOpen(true); const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { className: "sidebar-navigation__more-menu", label: (0,external_wp_i18n_namespaceObject.__)('Actions'), icon: more_vertical, popoverProps: POPOVER_PROPS, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { openRenameModal(); // Close the dropdown after opening the modal. onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Rename') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { history.navigate(`/wp_navigation/${menuId}?canvas=edit`); }, children: (0,external_wp_i18n_namespaceObject.__)('Edit') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { onDuplicate(); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Duplicate') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { isDestructive: true, onClick: () => { openDeleteConfirmDialog(); // Close the dropdown after opening the modal. onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Delete') })] }) }) }), deleteConfirmDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteConfirmDialog, { onClose: closeModals, onConfirm: onDelete }), renameModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameModal, { onClose: closeModals, menuTitle: menuTitle, onSave: onSave })] }); } ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js /** * WordPress dependencies */ const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); /* harmony default export */ const chevron_up = (chevronUp); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js /** * WordPress dependencies */ const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); /* harmony default export */ const chevron_down = (chevronDown); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js /** * WordPress dependencies */ const leaf_more_menu_POPOVER_PROPS = { className: 'block-editor-block-settings-menu__popover', placement: 'bottom-start' }; /** * Internal dependencies */ const { useHistory: leaf_more_menu_useHistory, useLocation: leaf_more_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function LeafMoreMenu(props) { const history = leaf_more_menu_useHistory(); const { path } = leaf_more_menu_useLocation(); const { block } = props; const { clientId } = block; const { moveBlocksDown, moveBlocksUp, removeBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Remove %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 })); const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Go to %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 })); const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store); return getBlockRootClientId(clientId); }, [clientId]); const onGoToPage = (0,external_wp_element_namespaceObject.useCallback)(selectedBlock => { const { attributes, name } = selectedBlock; if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) { history.navigate(`/${attributes.type}/${attributes.id}?canvas=edit`, { state: { backPath: path } }); } if (name === 'core/page-list-item' && attributes.id && history) { history.navigate(`/page/${attributes.id}?canvas=edit`, { state: { backPath: path } }); } }, [path, history]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Options'), className: "block-editor-block-settings-menu", popoverProps: leaf_more_menu_POPOVER_PROPS, noIcons: true, ...props, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: chevron_up, onClick: () => { moveBlocksUp([clientId], rootClientId); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Move up') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: chevron_down, onClick: () => { moveBlocksDown([clientId], rootClientId); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Move down') }), block.attributes?.type === 'page' && block.attributes?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { onGoToPage(block); onClose(); }, children: goToLabel })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { removeBlocks([clientId], false); onClose(); }, children: removeLabel }) })] }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js /** * WordPress dependencies */ /** * Internal dependencies */ const { PrivateListView } = unlock(external_wp_blockEditor_namespaceObject.privateApis); // Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js. const MAX_PAGE_COUNT = 100; const PAGES_QUERY = ['postType', 'page', { per_page: MAX_PAGE_COUNT, _fields: ['id', 'link', 'menu_order', 'parent', 'title', 'type'], // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent // sort. orderby: 'menu_order', order: 'asc' }]; function NavigationMenuContent({ rootClientId }) { const { listViewRootClientId, isLoading } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { areInnerBlocksControlled, getBlockName, getBlockCount, getBlockOrder } = select(external_wp_blockEditor_namespaceObject.store); const { isResolving } = select(external_wp_coreData_namespaceObject.store); const blockClientIds = getBlockOrder(rootClientId); const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === 'core/page-list'; const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0; const isLoadingPages = isResolving('getEntityRecords', PAGES_QUERY); return { listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId, // This is a small hack to wait for the navigation block // to actually load its inner blocks. isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages }; }, [rootClientId]); const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const offCanvasOnselect = (0,external_wp_element_namespaceObject.useCallback)(block => { if (block.name === 'core/navigation-link' && !block.attributes.url) { __unstableMarkNextChangeAsNotPersistent(); replaceBlock(block.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', block.attributes)); } }, [__unstableMarkNextChangeAsNotPersistent, replaceBlock]); // The hidden block is needed because it makes block edit side effects trigger. // For example a navigation page list load its items has an effect on edit to load its items. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateListView, { rootClientId: listViewRootClientId, onSelect: offCanvasOnselect, blockSettingsMenu: LeafMoreMenu, showAppender: false }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {}) })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js /** * WordPress dependencies */ /** * Internal dependencies */ const navigation_menu_editor_noop = () => {}; function NavigationMenuEditor({ navigationMenuId }) { const { storedSettings } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = unlock(select(store)); return { storedSettings: getSettings() }; }, []); const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!navigationMenuId) { return []; } return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', { ref: navigationMenuId })]; }, [navigationMenuId]); if (!navigationMenuId || !blocks?.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { settings: storedSettings, value: blocks, onChange: navigation_menu_editor_noop, onInput: navigation_menu_editor_noop, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContent, { rootClientId: blocks[0].clientId }) }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js /** * WordPress dependencies */ // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. function buildNavigationLabel(title, id, status) { if (!title?.rendered) { /* translators: %s: the index of the menu in the list of menus. */ return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); } if (status === 'publish') { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered); } return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'menu label'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered), status); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ function SingleNavigationMenu({ navigationMenu, backPath, handleDelete, handleDuplicate, handleSave }) { const menuTitle = navigationMenu?.title?.rendered; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { menuId: navigationMenu?.id, menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), onDelete: handleDelete, onSave: handleSave, onDuplicate: handleDuplicate }) }), backPath: backPath, title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, { navigationMenuId: navigationMenu?.id }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: sidebar_navigation_screen_navigation_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const postType = `wp_navigation`; function SidebarNavigationScreenNavigationMenu({ backPath }) { const { params: { postId } } = sidebar_navigation_screen_navigation_menu_useLocation(); const { record: navigationMenu, isResolving } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId); const { isSaving, isDeleting } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isSavingEntityRecord, isDeletingEntityRecord } = select(external_wp_coreData_namespaceObject.store); return { isSaving: isSavingEntityRecord('postType', postType, postId), isDeleting: isDeletingEntityRecord('postType', postType, postId) }; }, [postId]); const isLoading = isResolving || isSaving || isDeleting; const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers(); const _handleDelete = () => handleDelete(navigationMenu); const _handleSave = edits => handleSave(navigationMenu, edits); const _handleDuplicate = () => handleDuplicate(navigationMenu); if (isLoading) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), backPath: backPath, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) }); } if (!isLoading && !navigationMenu) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menu missing.'), backPath: backPath }); } if (!navigationMenu?.content?.raw) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { menuId: navigationMenu?.id, menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), onDelete: _handleDelete, onSave: _handleSave, onDuplicate: _handleDuplicate }), backPath: backPath, title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), description: (0,external_wp_i18n_namespaceObject.__)('This Navigation Menu is empty.') }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { navigationMenu: navigationMenu, backPath: backPath, handleDelete: _handleDelete, handleSave: _handleSave, handleDuplicate: _handleDuplicate }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: use_navigation_menu_handlers_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function useDeleteNavigationMenu() { const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const history = use_navigation_menu_handlers_useHistory(); const handleDelete = async navigationMenu => { const postId = navigationMenu?.id; try { await deleteEntityRecord('postType', postType, postId, { force: true }, { throwOnError: true }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Navigation Menu successfully deleted.'), { type: 'snackbar' }); history.navigate('/navigation'); } catch (error) { createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message describing why the navigation menu could not be deleted. */ (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`), error?.message), { type: 'snackbar' }); } }; return handleDelete; } function useSaveNavigationMenu() { const { getEditedEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedEntityRecord: getEditedEntityRecordSelector } = select(external_wp_coreData_namespaceObject.store); return { getEditedEntityRecord: getEditedEntityRecordSelector }; }, []); const { editEntityRecord, __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const handleSave = async (navigationMenu, edits) => { if (!edits) { return; } const postId = navigationMenu?.id; // Prepare for revert in case of error. const originalRecord = getEditedEntityRecord('postType', NAVIGATION_POST_TYPE, postId); // Apply the edits. editEntityRecord('postType', postType, postId, edits); const recordPropertiesToSave = Object.keys(edits); // Attempt to persist. try { await saveSpecifiedEntityEdits('postType', postType, postId, recordPropertiesToSave, { throwOnError: true }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Renamed Navigation Menu'), { type: 'snackbar' }); } catch (error) { // Revert to original in case of error. editEntityRecord('postType', postType, postId, originalRecord); createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message describing why the navigation menu could not be renamed. */ (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`), error?.message), { type: 'snackbar' }); } }; return handleSave; } function useDuplicateNavigationMenu() { const history = use_navigation_menu_handlers_useHistory(); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const handleDuplicate = async navigationMenu => { const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; try { const savedRecord = await saveEntityRecord('postType', postType, { title: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Navigation menu title */ (0,external_wp_i18n_namespaceObject._x)('%s (Copy)', 'navigation menu'), menuTitle), content: navigationMenu?.content?.raw, status: 'publish' }, { throwOnError: true }); if (savedRecord) { createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Duplicated Navigation Menu'), { type: 'snackbar' }); history.navigate(`/wp_navigation/${savedRecord.id}`); } } catch (error) { createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message describing why the navigation menu could not be deleted. */ (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`), error?.message), { type: 'snackbar' }); } }; return handleDuplicate; } function useNavigationMenuHandlers() { return { handleDelete: useDeleteNavigationMenu(), handleSave: useSaveNavigationMenu(), handleDuplicate: useDuplicateNavigationMenu() }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js /** * WordPress dependencies */ /** * Internal dependencies */ // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. function buildMenuLabel(title, id, status) { if (!title) { /* translators: %s: the index of the menu in the list of menus. */ return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); } if (status === 'publish') { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title); } return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'menu label'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status); } function SidebarNavigationScreenNavigationMenus({ backPath }) { const { records: navigationMenus, isResolving: isResolvingNavigationMenus, hasResolved: hasResolvedNavigationMenus } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', NAVIGATION_POST_TYPE, PRELOADED_NAVIGATION_MENUS_QUERY); const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus; const { getNavigationFallbackId } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store)); const isCreatingNavigationFallback = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).isResolving('getNavigationFallbackId'), []); const firstNavigationMenu = navigationMenus?.[0]; // If there is no navigation menu found // then trigger fallback algorithm to create one. if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && // Ensure a fallback navigation is created only once !isCreatingNavigationFallback) { getNavigationFallbackId(); } const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers(); const hasNavigationMenus = !!navigationMenus?.length; if (isLoading) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { backPath: backPath, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) }); } if (!isLoading && !hasNavigationMenus) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { description: (0,external_wp_i18n_namespaceObject.__)('No Navigation Menus found.'), backPath: backPath }); } // if single menu then render it if (navigationMenus?.length === 1) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { navigationMenu: firstNavigationMenu, backPath: backPath, handleDelete: () => handleDelete(firstNavigationMenu), handleDuplicate: () => handleDuplicate(firstNavigationMenu), handleSave: edits => handleSave(firstNavigationMenu, edits) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { backPath: backPath, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-navigation-menus", children: navigationMenus?.map(({ id, title, status }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavMenuItem, { postId: id, withChevron: true, icon: library_navigation, children: buildMenuLabel(title?.rendered, index + 1, status) }, id)) }) }); } function SidebarNavigationScreenWrapper({ children, actions, title, description, backPath }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { title: title || (0,external_wp_i18n_namespaceObject.__)('Navigation'), actions: actions, description: description || (0,external_wp_i18n_namespaceObject.__)('Manage your Navigation Menus.'), backPath: backPath, content: children }); } const NavMenuItem = ({ postId, ...props }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { to: `/wp_navigation/${postId}`, ...props }); }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: navigation_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function MobileNavigationView() { const { query = {} } = navigation_useLocation(); const { canvas = 'view' } = query; return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }); } const navigationRoute = { name: 'navigation', path: '/navigation', areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, preview({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : undefined; }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationView, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation-item.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: navigation_item_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function MobileNavigationItemView() { const { query = {} } = navigation_item_useLocation(); const { canvas = 'view' } = query; return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }); } const navigationItemRoute = { name: 'navigation-item', path: '/wp_navigation/:postId', areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, preview({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationItemView, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); } } }; ;// ./node_modules/@wordpress/icons/build-module/library/file.js /** * WordPress dependencies */ const file = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z" }) }); /* harmony default export */ const library_file = (file); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js /** * Internal dependencies */ function CategoryItem({ count, icon, id, isActive, label, type }) { if (!count) { return; } const queryArgs = [`postType=${type}`]; if (id) { queryArgs.push(`categoryId=${id}`); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { icon: icon, suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: count }), "aria-current": isActive ? 'true' : undefined, to: `/pattern?${queryArgs.join('&')}`, children: label }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js /** * WordPress dependencies */ /** * Internal dependencies */ function useDefaultPatternCategories() { const blockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => { var _settings$__experimen; const { getSettings } = unlock(select(store)); const settings = getSettings(); return (_settings$__experimen = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatternCategories; }); const restBlockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()); return [...(blockPatternCategories || []), ...(restBlockPatternCategories || [])]; } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js /** * WordPress dependencies */ /** * Internal dependencies */ function useThemePatterns() { const blockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getSettings$__experi; const { getSettings } = unlock(select(store)); return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns; }); const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns()); const patterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false), [blockPatterns, restBlockPatterns]); return patterns; } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js /** * WordPress dependencies */ /** * Internal dependencies */ const { extractWords, getNormalizedSearchTerms, normalizeString } = unlock(external_wp_blockEditor_namespaceObject.privateApis); /** * Internal dependencies */ // Default search helpers. const defaultGetName = item => { if (item.type === PATTERN_TYPES.user) { return item.slug; } if (item.type === TEMPLATE_PART_POST_TYPE) { return ''; } return item.name || ''; }; const defaultGetTitle = item => { if (typeof item.title === 'string') { return item.title; } if (item.title && item.title.rendered) { return item.title.rendered; } if (item.title && item.title.raw) { return item.title.raw; } return ''; }; const defaultGetDescription = item => { if (item.type === PATTERN_TYPES.user) { return item.excerpt.raw; } return item.description || ''; }; const defaultGetKeywords = item => item.keywords || []; const defaultHasCategory = () => false; const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term))); }; /** * Filters an item list given a search term. * * @param {Array} items Item list * @param {string} searchInput Search input. * @param {Object} config Search Config. * * @return {Array} Filtered item list. */ const searchItems = (items = [], searchInput = '', config = {}) => { const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); // Filter patterns by category: the default category indicates that all patterns will be shown. const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length; const searchRankConfig = { ...config, onlyFilterByCategory }; // If we aren't filtering on search terms, matching on category is satisfactory. // If we are, then we need more than a category match. const threshold = onlyFilterByCategory ? 0 : 1; const rankedItems = items.map(item => { return [item, getItemSearchRank(item, searchInput, searchRankConfig)]; }).filter(([, rank]) => rank > threshold); // If we didn't have terms to search on, there's no point sorting. if (normalizedSearchTerms.length === 0) { return rankedItems.map(([item]) => item); } rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); return rankedItems.map(([item]) => item); }; /** * Get the search rank for a given item and a specific search term. * The better the match, the higher the rank. * If the rank equals 0, it should be excluded from the results. * * @param {Object} item Item to filter. * @param {string} searchTerm Search term. * @param {Object} config Search Config. * * @return {number} Search Rank. */ function getItemSearchRank(item, searchTerm, config) { const { categoryId, getName = defaultGetName, getTitle = defaultGetTitle, getDescription = defaultGetDescription, getKeywords = defaultGetKeywords, hasCategory = defaultHasCategory, onlyFilterByCategory } = config; let rank = categoryId === PATTERN_DEFAULT_CATEGORY || categoryId === TEMPLATE_PART_ALL_AREAS_CATEGORY || categoryId === PATTERN_USER_CATEGORY && item.type === PATTERN_TYPES.user || hasCategory(item, categoryId) ? 1 : 0; // If an item doesn't belong to the current category or we don't have // search terms to filter by, return the initial rank value. if (!rank || onlyFilterByCategory) { return rank; } const name = getName(item); const title = getTitle(item); const description = getDescription(item); const keywords = getKeywords(item); const normalizedSearchInput = normalizeString(searchTerm); const normalizedTitle = normalizeString(title); // Prefers exact matches // Then prefers if the beginning of the title matches the search term // name, keywords, description matches come later. if (normalizedSearchInput === normalizedTitle) { rank += 30; } else if (normalizedTitle.startsWith(normalizedSearchInput)) { rank += 20; } else { const terms = [name, title, description, ...keywords].join(' '); const normalizedSearchTerms = extractWords(normalizedSearchInput); const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms); if (unmatchedTerms.length === 0) { rank += 10; } } return rank; } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js /** * WordPress dependencies */ /** * Internal dependencies */ const EMPTY_PATTERN_LIST = []; const selectTemplateParts = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, search = '') => { var _getEntityRecords; const { getEntityRecords, getCurrentTheme, isResolving: isResolvingSelector } = select(external_wp_coreData_namespaceObject.store); const query = { per_page: -1 }; const templateParts = (_getEntityRecords = getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, query)) !== null && _getEntityRecords !== void 0 ? _getEntityRecords : EMPTY_PATTERN_LIST; // In the case where a custom template part area has been removed we need // the current list of areas to cross check against so orphaned template // parts can be treated as uncategorized. const knownAreas = getCurrentTheme()?.default_template_part_areas || []; const templatePartAreas = knownAreas.map(area => area.area); const templatePartHasCategory = (item, category) => { if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) { return item.area === category; } return item.area === category || !templatePartAreas.includes(item.area); }; const isResolving = isResolvingSelector('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, query]); const patterns = searchItems(templateParts, search, { categoryId, hasCategory: templatePartHasCategory }); return { patterns, isResolving }; }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { per_page: -1 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, { per_page: -1 }]), select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas]); const selectThemePatterns = (0,external_wp_data_namespaceObject.createSelector)(select => { var _settings$__experimen; const { getSettings } = unlock(select(store)); const { isResolving: isResolvingSelector } = select(external_wp_coreData_namespaceObject.store); const settings = getSettings(); const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns; const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns(); const patterns = [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false).map(pattern => ({ ...pattern, keywords: pattern.keywords || [], type: PATTERN_TYPES.theme, blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { __unstableSkipMigrationLogs: true }) })); return { patterns, isResolving: isResolvingSelector('getBlockPatterns') }; }, select => [select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), select(external_wp_coreData_namespaceObject.store).isResolving('getBlockPatterns'), unlock(select(store)).getSettings()]); const selectPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, syncStatus, search = '') => { const { patterns: themePatterns, isResolving: isResolvingThemePatterns } = selectThemePatterns(select); const { patterns: userPatterns, isResolving: isResolvingUserPatterns, categories: userPatternCategories } = selectUserPatterns(select); let patterns = [...(themePatterns || []), ...(userPatterns || [])]; if (syncStatus) { // User patterns can have their sync statuses checked directly // Non-user patterns are all unsynced for the time being. patterns = patterns.filter(pattern => { return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced; }); } if (categoryId) { patterns = searchItems(patterns, search, { categoryId, hasCategory: (item, currentCategory) => { if (item.type === PATTERN_TYPES.user) { return item.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId)?.slug === currentCategory); } return item.categories?.includes(currentCategory); } }); } else { patterns = searchItems(patterns, search, { hasCategory: item => { if (item.type === PATTERN_TYPES.user) { return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId))); } return !item.hasOwnProperty('categories'); } }); } return { patterns, isResolving: isResolvingThemePatterns || isResolvingUserPatterns }; }, select => [selectThemePatterns(select), selectUserPatterns(select)]); const selectUserPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, syncStatus, search = '') => { const { getEntityRecords, isResolving: isResolvingSelector, getUserPatternCategories } = select(external_wp_coreData_namespaceObject.store); const query = { per_page: -1 }; const patternPosts = getEntityRecords('postType', PATTERN_TYPES.user, query); const userPatternCategories = getUserPatternCategories(); const categories = new Map(); userPatternCategories.forEach(userCategory => categories.set(userCategory.id, userCategory)); let patterns = patternPosts !== null && patternPosts !== void 0 ? patternPosts : EMPTY_PATTERN_LIST; const isResolving = isResolvingSelector('getEntityRecords', ['postType', PATTERN_TYPES.user, query]); if (syncStatus) { patterns = patterns.filter(pattern => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus); } patterns = searchItems(patterns, search, { // We exit user pattern retrieval early if we aren't in the // catch-all category for user created patterns, so it has // to be in the category. hasCategory: () => true }); return { patterns, isResolving, categories: userPatternCategories }; }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', PATTERN_TYPES.user, { per_page: -1 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', PATTERN_TYPES.user, { per_page: -1 }]), select(external_wp_coreData_namespaceObject.store).getUserPatternCategories()]); function useAugmentPatternsWithPermissions(patterns) { const idsAndTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { var _patterns$filter$map; return (_patterns$filter$map = patterns?.filter(record => record.type !== PATTERN_TYPES.theme).map(record => [record.type, record.id])) !== null && _patterns$filter$map !== void 0 ? _patterns$filter$map : []; }, [patterns]); const permissions = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecordPermissions } = unlock(select(external_wp_coreData_namespaceObject.store)); return idsAndTypes.reduce((acc, [type, id]) => { acc[id] = getEntityRecordPermissions('postType', type, id); return acc; }, {}); }, [idsAndTypes]); return (0,external_wp_element_namespaceObject.useMemo)(() => { var _patterns$map; return (_patterns$map = patterns?.map(record => { var _permissions$record$i; return { ...record, permissions: (_permissions$record$i = permissions?.[record.id]) !== null && _permissions$record$i !== void 0 ? _permissions$record$i : {} }; })) !== null && _patterns$map !== void 0 ? _patterns$map : []; }, [patterns, permissions]); } const usePatterns = (postType, categoryId, { search = '', syncStatus } = {}) => { return (0,external_wp_data_namespaceObject.useSelect)(select => { if (postType === TEMPLATE_PART_POST_TYPE) { return selectTemplateParts(select, categoryId, search); } else if (postType === PATTERN_TYPES.user && !!categoryId) { const appliedCategory = categoryId === 'uncategorized' ? '' : categoryId; return selectPatterns(select, appliedCategory, syncStatus, search); } else if (postType === PATTERN_TYPES.user) { return selectUserPatterns(select, syncStatus, search); } return { patterns: EMPTY_PATTERN_LIST, isResolving: false }; }, [categoryId, postType, search, syncStatus]); }; /* harmony default export */ const use_patterns = (usePatterns); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js /** * WordPress dependencies */ /** * Internal dependencies */ function usePatternCategories() { const defaultCategories = useDefaultPatternCategories(); defaultCategories.push({ name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY, label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') }); const themePatterns = useThemePatterns(); const { patterns: userPatterns, categories: userPatternCategories } = use_patterns(PATTERN_TYPES.user); const patternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { const categoryMap = {}; const categoriesWithCounts = []; // Create a map for easier counting of patterns in categories. defaultCategories.forEach(category => { if (!categoryMap[category.name]) { categoryMap[category.name] = { ...category, count: 0 }; } }); userPatternCategories.forEach(category => { if (!categoryMap[category.name]) { categoryMap[category.name] = { ...category, count: 0 }; } }); // Update the category counts to reflect theme registered patterns. themePatterns.forEach(pattern => { pattern.categories?.forEach(category => { if (categoryMap[category]) { categoryMap[category].count += 1; } }); // If the pattern has no categories, add it to uncategorized. if (!pattern.categories?.length) { categoryMap.uncategorized.count += 1; } }); // Update the category counts to reflect user registered patterns. userPatterns.forEach(pattern => { pattern.wp_pattern_category?.forEach(catId => { const category = userPatternCategories.find(cat => cat.id === catId)?.name; if (categoryMap[category]) { categoryMap[category].count += 1; } }); // If the pattern has no categories, add it to uncategorized. if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId))) { categoryMap.uncategorized.count += 1; } }); // Filter categories so we only have those containing patterns. [...defaultCategories, ...userPatternCategories].forEach(category => { if (categoryMap[category.name].count && !categoriesWithCounts.find(cat => cat.name === category.name)) { categoriesWithCounts.push(categoryMap[category.name]); } }); const sortedCategories = categoriesWithCounts.sort((a, b) => a.label.localeCompare(b.label)); sortedCategories.unshift({ name: PATTERN_USER_CATEGORY, label: (0,external_wp_i18n_namespaceObject.__)('My patterns'), count: userPatterns.length }); sortedCategories.unshift({ name: PATTERN_DEFAULT_CATEGORY, label: (0,external_wp_i18n_namespaceObject.__)('All patterns'), description: (0,external_wp_i18n_namespaceObject.__)('A list of all patterns from all sources.'), count: themePatterns.length + userPatterns.length }); return sortedCategories; }, [defaultCategories, themePatterns, userPatternCategories, userPatterns]); return { patternCategories, hasPatterns: !!patternCategories.length }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js /** * WordPress dependencies */ /** * Internal dependencies */ const useTemplatePartsGroupedByArea = items => { const allItems = items || []; const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [], []); // Create map of template areas ensuring that default areas are displayed before // any custom registered template part areas. const knownAreas = { header: {}, footer: {}, sidebar: {}, uncategorized: {} }; templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = { ...templatePartArea, templateParts: [] }); const groupedByArea = allItems.reduce((accumulator, item) => { const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY; accumulator[key]?.templateParts?.push(item); return accumulator; }, knownAreas); return groupedByArea; }; function useTemplatePartAreas() { const { records: templateParts, isResolving: isLoading } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { per_page: -1 }); return { hasTemplateParts: templateParts ? !!templateParts.length : false, isLoading, templatePartAreas: useTemplatePartsGroupedByArea(templateParts) }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: sidebar_navigation_screen_patterns_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function CategoriesGroup({ templatePartAreas, patternCategories, currentCategory, currentType }) { const [allPatterns, ...otherPatterns] = patternCategories; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { count: Object.values(templatePartAreas).map(({ templateParts }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0), icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)() /* no name, so it provides the fallback icon */, label: (0,external_wp_i18n_namespaceObject.__)('All template parts'), id: TEMPLATE_PART_ALL_AREAS_CATEGORY, type: TEMPLATE_PART_POST_TYPE, isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE }, "all"), Object.entries(templatePartAreas).map(([area, { label, templateParts }]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { count: templateParts?.length, icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area), label: label, id: area, type: TEMPLATE_PART_POST_TYPE, isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE }, area)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-patterns__divider" }), allPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { count: allPatterns.count, label: allPatterns.label, icon: library_file, id: allPatterns.name, type: PATTERN_TYPES.user, isActive: currentCategory === `${allPatterns.name}` && currentType === PATTERN_TYPES.user }, allPatterns.name), otherPatterns.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { count: category.count, label: category.label, icon: library_file, id: category.name, type: PATTERN_TYPES.user, isActive: currentCategory === `${category.name}` && currentType === PATTERN_TYPES.user }, category.name))] }); } function SidebarNavigationScreenPatterns({ backPath }) { const { query: { postType = 'wp_block', categoryId } } = sidebar_navigation_screen_patterns_useLocation(); const currentCategory = categoryId || (postType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY); const { templatePartAreas, hasTemplateParts, isLoading } = useTemplatePartAreas(); const { patternCategories, hasPatterns } = usePatternCategories(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)('Patterns'), description: (0,external_wp_i18n_namespaceObject.__)('Manage what patterns are available when editing the site.'), isRoot: !backPath, backPath: backPath, content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isLoading && (0,external_wp_i18n_namespaceObject.__)('Loading items…'), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!hasTemplateParts && !hasPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { children: (0,external_wp_i18n_namespaceObject.__)('No items found') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoriesGroup, { templatePartAreas: templatePartAreas, patternCategories: patternCategories, currentCategory: currentCategory, currentType: postType })] })] }) }); } // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up.js /** * WordPress dependencies */ const arrowUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) }); /* harmony default export */ const arrow_up = (arrowUp); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js /** * WordPress dependencies */ const arrowDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) }); /* harmony default export */ const arrow_down = (arrowDown); ;// ./node_modules/@wordpress/dataviews/build-module/constants.js /** * WordPress dependencies */ /** * Internal dependencies */ // Filter operators. const constants_OPERATOR_IS = 'is'; const constants_OPERATOR_IS_NOT = 'isNot'; const constants_OPERATOR_IS_ANY = 'isAny'; const constants_OPERATOR_IS_NONE = 'isNone'; const OPERATOR_IS_ALL = 'isAll'; const OPERATOR_IS_NOT_ALL = 'isNotAll'; const ALL_OPERATORS = [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL]; const OPERATORS = { [constants_OPERATOR_IS]: { key: 'is-filter', label: (0,external_wp_i18n_namespaceObject.__)('Is') }, [constants_OPERATOR_IS_NOT]: { key: 'is-not-filter', label: (0,external_wp_i18n_namespaceObject.__)('Is not') }, [constants_OPERATOR_IS_ANY]: { key: 'is-any-filter', label: (0,external_wp_i18n_namespaceObject.__)('Is any') }, [constants_OPERATOR_IS_NONE]: { key: 'is-none-filter', label: (0,external_wp_i18n_namespaceObject.__)('Is none') }, [OPERATOR_IS_ALL]: { key: 'is-all-filter', label: (0,external_wp_i18n_namespaceObject.__)('Is all') }, [OPERATOR_IS_NOT_ALL]: { key: 'is-not-all-filter', label: (0,external_wp_i18n_namespaceObject.__)('Is not all') } }; const SORTING_DIRECTIONS = ['asc', 'desc']; const sortArrows = { asc: '↑', desc: '↓' }; const sortValues = { asc: 'ascending', desc: 'descending' }; const sortLabels = { asc: (0,external_wp_i18n_namespaceObject.__)('Sort ascending'), desc: (0,external_wp_i18n_namespaceObject.__)('Sort descending') }; const sortIcons = { asc: arrow_up, desc: arrow_down }; // View layouts. const constants_LAYOUT_TABLE = 'table'; const constants_LAYOUT_GRID = 'grid'; const constants_LAYOUT_LIST = 'list'; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js /** * Internal dependencies */ function sort(a, b, direction) { return direction === 'asc' ? a - b : b - a; } function isValid(value, context) { // TODO: this implicitly means the value is required. if (value === '') { return false; } if (!Number.isInteger(Number(value))) { return false; } if (context?.elements) { const validValues = context?.elements.map(f => f.value); if (!validValues.includes(Number(value))) { return false; } } return true; } /* harmony default export */ const integer = ({ sort, isValid, Edit: 'integer' }); ;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js /** * Internal dependencies */ function text_sort(valueA, valueB, direction) { return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); } function text_isValid(value, context) { if (context?.elements) { const validValues = context?.elements?.map(f => f.value); if (!validValues.includes(value)) { return false; } } return true; } /* harmony default export */ const field_types_text = ({ sort: text_sort, isValid: text_isValid, Edit: 'text' }); ;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js /** * Internal dependencies */ function datetime_sort(a, b, direction) { const timeA = new Date(a).getTime(); const timeB = new Date(b).getTime(); return direction === 'asc' ? timeA - timeB : timeB - timeA; } function datetime_isValid(value, context) { if (context?.elements) { const validValues = context?.elements.map(f => f.value); if (!validValues.includes(value)) { return false; } } return true; } /* harmony default export */ const datetime = ({ sort: datetime_sort, isValid: datetime_isValid, Edit: 'datetime' }); ;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js /** * Internal dependencies */ /** * * @param {FieldType} type The field type definition to get. * * @return A field type definition. */ function getFieldTypeDefinition(type) { if ('integer' === type) { return integer; } if ('text' === type) { return field_types_text; } if ('datetime' === type) { return datetime; } return { sort: (a, b, direction) => { if (typeof a === 'number' && typeof b === 'number') { return direction === 'asc' ? a - b : b - a; } return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a); }, isValid: (value, context) => { if (context?.elements) { const validValues = context?.elements?.map(f => f.value); if (!validValues.includes(value)) { return false; } } return true; }, Edit: () => null }; } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js /** * WordPress dependencies */ /** * Internal dependencies */ function DateTime({ data, field, onChange, hideLabelFromVision }) { const { id, label } = field; const value = field.getValue({ item: data }); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "dataviews-controls__datetime", children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: label }), hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TimePicker, { currentTime: value, onChange: onChangeControl, hideLabelFromVision: true })] }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js /** * WordPress dependencies */ /** * Internal dependencies */ function Integer({ data, field, onChange, hideLabelFromVision }) { var _field$getValue; const { id, label, description } = field; const value = (_field$getValue = field.getValue({ item: data })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: Number(newValue) }), [id, onChange]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { label: label, help: description, value: value, onChange: onChangeControl, __next40pxDefaultSize: true, hideLabelFromVision: hideLabelFromVision }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js /** * WordPress dependencies */ /** * Internal dependencies */ function Radio({ data, field, onChange, hideLabelFromVision }) { const { id, label } = field; const value = field.getValue({ item: data }); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); if (field.elements) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { label: label, onChange: onChangeControl, options: field.elements, selected: value, hideLabelFromVision: hideLabelFromVision }); } return null; } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js /** * WordPress dependencies */ /** * Internal dependencies */ function Select({ data, field, onChange, hideLabelFromVision }) { var _field$getValue, _field$elements; const { id, label } = field; const value = (_field$getValue = field.getValue({ item: data })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); const elements = [ /* * Value can be undefined when: * * - the field is not required * - in bulk editing * */ { label: (0,external_wp_i18n_namespaceObject.__)('Select item'), value: '' }, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { label: label, value: value, options: elements, onChange: onChangeControl, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, hideLabelFromVision: hideLabelFromVision }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js /** * WordPress dependencies */ /** * Internal dependencies */ function Text({ data, field, onChange, hideLabelFromVision }) { const { id, label, placeholder } = field; const value = field.getValue({ item: data }); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ [id]: newValue }), [id, onChange]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { label: label, placeholder: placeholder, value: value !== null && value !== void 0 ? value : '', onChange: onChangeControl, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, hideLabelFromVision: hideLabelFromVision }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js /** * External dependencies */ /** * Internal dependencies */ const FORM_CONTROLS = { datetime: DateTime, integer: Integer, radio: Radio, select: Select, text: Text }; function getControl(field, fieldTypeDefinition) { if (typeof field.Edit === 'function') { return field.Edit; } if (typeof field.Edit === 'string') { return getControlByType(field.Edit); } if (field.elements) { return getControlByType('select'); } if (typeof fieldTypeDefinition.Edit === 'string') { return getControlByType(fieldTypeDefinition.Edit); } return fieldTypeDefinition.Edit; } function getControlByType(type) { if (Object.keys(FORM_CONTROLS).includes(type)) { return FORM_CONTROLS[type]; } throw 'Control ' + type + ' not found'; } ;// ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js /** * Internal dependencies */ const getValueFromId = id => ({ item }) => { const path = id.split('.'); let value = item; for (const segment of path) { if (value.hasOwnProperty(segment)) { value = value[segment]; } else { value = undefined; } } return value; }; /** * Apply default values and normalize the fields config. * * @param fields Fields config. * @return Normalized fields config. */ function normalizeFields(fields) { return fields.map(field => { var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting; const fieldTypeDefinition = getFieldTypeDefinition(field.type); const getValue = field.getValue || getValueFromId(field.id); const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) { return fieldTypeDefinition.sort(getValue({ item: a }), getValue({ item: b }), direction); }; const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) { return fieldTypeDefinition.isValid(getValue({ item }), context); }; const Edit = getControl(field, fieldTypeDefinition); const renderFromElements = ({ item }) => { const value = getValue({ item }); return field?.elements?.find(element => element.value === value)?.label || getValue({ item }); }; const render = field.render || (field.elements ? renderFromElements : getValue); return { ...field, label: field.label || field.id, header: field.header || field.label || field.id, getValue, render, sort, isValid, Edit, enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true, enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true }; }); } ;// ./node_modules/@wordpress/dataviews/build-module/filter-and-sort-data-view.js /** * External dependencies */ /** * Internal dependencies */ function normalizeSearchInput(input = '') { return remove_accents_default()(input.trim().toLowerCase()); } const filter_and_sort_data_view_EMPTY_ARRAY = []; /** * Applies the filtering, sorting and pagination to the raw data based on the view configuration. * * @param data Raw data. * @param view View config. * @param fields Fields config. * * @return Filtered, sorted and paginated data. */ function filterSortAndPaginate(data, view, fields) { if (!data) { return { data: filter_and_sort_data_view_EMPTY_ARRAY, paginationInfo: { totalItems: 0, totalPages: 0 } }; } const _fields = normalizeFields(fields); let filteredData = [...data]; // Handle global search. if (view.search) { const normalizedSearch = normalizeSearchInput(view.search); filteredData = filteredData.filter(item => { return _fields.filter(field => field.enableGlobalSearch).map(field => { return normalizeSearchInput(field.getValue({ item })); }).some(field => field.includes(normalizedSearch)); }); } if (view.filters && view.filters?.length > 0) { view.filters.forEach(filter => { const field = _fields.find(_field => _field.id === filter.field); if (field) { if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) { filteredData = filteredData.filter(item => { const fieldValue = field.getValue({ item }); if (Array.isArray(fieldValue)) { return filter.value.some(filterValue => fieldValue.includes(filterValue)); } else if (typeof fieldValue === 'string') { return filter.value.includes(fieldValue); } return false; }); } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) { filteredData = filteredData.filter(item => { const fieldValue = field.getValue({ item }); if (Array.isArray(fieldValue)) { return !filter.value.some(filterValue => fieldValue.includes(filterValue)); } else if (typeof fieldValue === 'string') { return !filter.value.includes(fieldValue); } return false; }); } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) { filteredData = filteredData.filter(item => { return filter.value.every(value => { return field.getValue({ item })?.includes(value); }); }); } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) { filteredData = filteredData.filter(item => { return filter.value.every(value => { return !field.getValue({ item })?.includes(value); }); }); } else if (filter.operator === constants_OPERATOR_IS) { filteredData = filteredData.filter(item => { return filter.value === field.getValue({ item }); }); } else if (filter.operator === constants_OPERATOR_IS_NOT) { filteredData = filteredData.filter(item => { return filter.value !== field.getValue({ item }); }); } } }); } // Handle sorting. if (view.sort) { const fieldId = view.sort.field; const fieldToSort = _fields.find(field => { return field.id === fieldId; }); if (fieldToSort) { filteredData.sort((a, b) => { var _view$sort$direction; return fieldToSort.sort(a, b, (_view$sort$direction = view.sort?.direction) !== null && _view$sort$direction !== void 0 ? _view$sort$direction : 'desc'); }); } } // Handle pagination. let totalItems = filteredData.length; let totalPages = 1; if (view.page !== undefined && view.perPage !== undefined) { const start = (view.page - 1) * view.perPage; totalItems = filteredData?.length || 0; totalPages = Math.ceil(totalItems / view.perPage); filteredData = filteredData?.slice(start, start + view.perPage); } return { data: filteredData, paginationInfo: { totalItems, totalPages } }; } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-context/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const DataViewsContext = (0,external_wp_element_namespaceObject.createContext)({ view: { type: constants_LAYOUT_TABLE }, onChangeView: () => {}, fields: [], data: [], paginationInfo: { totalItems: 0, totalPages: 0 }, selection: [], onChangeSelection: () => {}, setOpenedFilter: () => {}, openedFilter: null, getItemId: item => item.id, isItemClickable: () => true, containerWidth: 0 }); /* harmony default export */ const dataviews_context = (DataViewsContext); ;// ./node_modules/@wordpress/icons/build-module/library/funnel.js /** * WordPress dependencies */ const funnel = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) }); /* harmony default export */ const library_funnel = (funnel); ;// ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js "use client"; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var _3YLGPPWQ_spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __objRest = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop]; } return target; }; ;// ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js "use client"; var _3YLGPPWQ_defProp = Object.defineProperty; var _3YLGPPWQ_defProps = Object.defineProperties; var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors; var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols; var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty; var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable; var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var _chunks_3YLGPPWQ_spreadValues = (a, b) => { for (var prop in b || (b = {})) if (_3YLGPPWQ_hasOwnProp.call(b, prop)) _3YLGPPWQ_defNormalProp(a, prop, b[prop]); if (_3YLGPPWQ_getOwnPropSymbols) for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) { if (_3YLGPPWQ_propIsEnum.call(b, prop)) _3YLGPPWQ_defNormalProp(a, prop, b[prop]); } return a; }; var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b)); var _3YLGPPWQ_objRest = (source, exclude) => { var target = {}; for (var prop in source) if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && _3YLGPPWQ_getOwnPropSymbols) for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) { if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop)) target[prop] = source[prop]; } return target; }; ;// ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js "use client"; // src/utils/misc.ts function PBFD2E7P_noop(..._) { } function shallowEqual(a, b) { if (a === b) return true; if (!a) return false; if (!b) return false; if (typeof a !== "object") return false; if (typeof b !== "object") return false; const aKeys = Object.keys(a); const bKeys = Object.keys(b); const { length } = aKeys; if (bKeys.length !== length) return false; for (const key of aKeys) { if (a[key] !== b[key]) { return false; } } return true; } function applyState(argument, currentValue) { if (isUpdater(argument)) { const value = isLazyValue(currentValue) ? currentValue() : currentValue; return argument(value); } return argument; } function isUpdater(argument) { return typeof argument === "function"; } function isLazyValue(value) { return typeof value === "function"; } function isObject(arg) { return typeof arg === "object" && arg != null; } function isEmpty(arg) { if (Array.isArray(arg)) return !arg.length; if (isObject(arg)) return !Object.keys(arg).length; if (arg == null) return true; if (arg === "") return true; return false; } function isInteger(arg) { if (typeof arg === "number") { return Math.floor(arg) === arg; } return String(Math.floor(Number(arg))) === arg; } function PBFD2E7P_hasOwnProperty(object, prop) { if (typeof Object.hasOwn === "function") { return Object.hasOwn(object, prop); } return Object.prototype.hasOwnProperty.call(object, prop); } function chain(...fns) { return (...args) => { for (const fn of fns) { if (typeof fn === "function") { fn(...args); } } }; } function cx(...args) { return args.filter(Boolean).join(" ") || void 0; } function PBFD2E7P_normalizeString(str) { return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); } function omit(object, keys) { const result = _chunks_3YLGPPWQ_spreadValues({}, object); for (const key of keys) { if (PBFD2E7P_hasOwnProperty(result, key)) { delete result[key]; } } return result; } function pick(object, paths) { const result = {}; for (const key of paths) { if (PBFD2E7P_hasOwnProperty(object, key)) { result[key] = object[key]; } } return result; } function identity(value) { return value; } function beforePaint(cb = PBFD2E7P_noop) { const raf = requestAnimationFrame(cb); return () => cancelAnimationFrame(raf); } function afterPaint(cb = PBFD2E7P_noop) { let raf = requestAnimationFrame(() => { raf = requestAnimationFrame(cb); }); return () => cancelAnimationFrame(raf); } function invariant(condition, message) { if (condition) return; if (typeof message !== "string") throw new Error("Invariant failed"); throw new Error(message); } function getKeys(obj) { return Object.keys(obj); } function isFalsyBooleanCallback(booleanOrCallback, ...args) { const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; if (result == null) return false; return !result; } function disabledFromProps(props) { return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; } function removeUndefinedValues(obj) { const result = {}; for (const key in obj) { if (obj[key] !== void 0) { result[key] = obj[key]; } } return result; } function defaultValue(...values) { for (const value of values) { if (value !== void 0) return value; } return void 0; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js "use client"; // src/utils/misc.ts function setRef(ref, value) { if (typeof ref === "function") { ref(value); } else if (ref) { ref.current = value; } } function isValidElementWithRef(element) { if (!element) return false; if (!(0,external_React_.isValidElement)(element)) return false; if ("ref" in element.props) return true; if ("ref" in element) return true; return false; } function getRefProperty(element) { if (!isValidElementWithRef(element)) return null; const props = _3YLGPPWQ_spreadValues({}, element.props); return props.ref || element.ref; } function mergeProps(base, overrides) { const props = _3YLGPPWQ_spreadValues({}, base); for (const key in overrides) { if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue; if (key === "className") { const prop = "className"; props[prop] = base[prop] ? `${base[prop]} ${overrides[prop]}` : overrides[prop]; continue; } if (key === "style") { const prop = "style"; props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop]; continue; } const overrideValue = overrides[key]; if (typeof overrideValue === "function" && key.startsWith("on")) { const baseValue = base[key]; if (typeof baseValue === "function") { props[key] = (...args) => { overrideValue(...args); baseValue(...args); }; continue; } } props[key] = overrideValue; } return props; } ;// ./node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js "use client"; // src/utils/dom.ts var DTR5TSDJ_canUseDOM = checkIsBrowser(); function checkIsBrowser() { var _a; return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); } function getDocument(node) { if (!node) return document; if ("self" in node) return node.document; return node.ownerDocument || document; } function getWindow(node) { if (!node) return self; if ("self" in node) return node.self; return getDocument(node).defaultView || window; } function DTR5TSDJ_getActiveElement(node, activeDescendant = false) { const { activeElement } = getDocument(node); if (!(activeElement == null ? void 0 : activeElement.nodeName)) { return null; } if (DTR5TSDJ_isFrame(activeElement) && activeElement.contentDocument) { return DTR5TSDJ_getActiveElement( activeElement.contentDocument.body, activeDescendant ); } if (activeDescendant) { const id = activeElement.getAttribute("aria-activedescendant"); if (id) { const element = getDocument(activeElement).getElementById(id); if (element) { return element; } } } return activeElement; } function contains(parent, child) { return parent === child || parent.contains(child); } function DTR5TSDJ_isFrame(element) { return element.tagName === "IFRAME"; } function isButton(element) { const tagName = element.tagName.toLowerCase(); if (tagName === "button") return true; if (tagName === "input" && element.type) { return buttonInputTypes.indexOf(element.type) !== -1; } return false; } var buttonInputTypes = [ "button", "color", "file", "image", "reset", "submit" ]; function isVisible(element) { if (typeof element.checkVisibility === "function") { return element.checkVisibility(); } const htmlElement = element; return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; } function isTextField(element) { try { const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; const isTextArea = element.tagName === "TEXTAREA"; return isTextInput || isTextArea || false; } catch (error) { return false; } } function isTextbox(element) { return element.isContentEditable || isTextField(element); } function getTextboxValue(element) { if (isTextField(element)) { return element.value; } if (element.isContentEditable) { const range = getDocument(element).createRange(); range.selectNodeContents(element); return range.toString(); } return ""; } function getTextboxSelection(element) { let start = 0; let end = 0; if (isTextField(element)) { start = element.selectionStart || 0; end = element.selectionEnd || 0; } else if (element.isContentEditable) { const selection = getDocument(element).getSelection(); if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) { const range = selection.getRangeAt(0); const nextRange = range.cloneRange(); nextRange.selectNodeContents(element); nextRange.setEnd(range.startContainer, range.startOffset); start = nextRange.toString().length; nextRange.setEnd(range.endContainer, range.endOffset); end = nextRange.toString().length; } } return { start, end }; } function getPopupRole(element, fallback) { const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; const role = element == null ? void 0 : element.getAttribute("role"); if (role && allowedPopupRoles.indexOf(role) !== -1) { return role; } return fallback; } function getPopupItemRole(element, fallback) { var _a; const itemRoleByPopupRole = { menu: "menuitem", listbox: "option", tree: "treeitem" }; const popupRole = getPopupRole(element); if (!popupRole) return fallback; const key = popupRole; return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback; } function scrollIntoViewIfNeeded(element, arg) { if (isPartiallyHidden(element) && "scrollIntoView" in element) { element.scrollIntoView(arg); } } function getScrollingElement(element) { if (!element) return null; const isScrollableOverflow = (overflow) => { if (overflow === "auto") return true; if (overflow === "scroll") return true; return false; }; if (element.clientHeight && element.scrollHeight > element.clientHeight) { const { overflowY } = getComputedStyle(element); if (isScrollableOverflow(overflowY)) return element; } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { const { overflowX } = getComputedStyle(element); if (isScrollableOverflow(overflowX)) return element; } return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; } function isPartiallyHidden(element) { const elementRect = element.getBoundingClientRect(); const scroller = getScrollingElement(element); if (!scroller) return false; const scrollerRect = scroller.getBoundingClientRect(); const isHTML = scroller.tagName === "HTML"; const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top; const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom; const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left; const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right; const top = elementRect.top < scrollerTop; const left = elementRect.left < scrollerLeft; const bottom = elementRect.bottom > scrollerBottom; const right = elementRect.right > scrollerRight; return top || left || bottom || right; } function setSelectionRange(element, ...args) { if (/text|search|password|tel|url/i.test(element.type)) { element.setSelectionRange(...args); } } function sortBasedOnDOMPosition(items, getElement) { const pairs = items.map((item, index) => [index, item]); let isOrderDifferent = false; pairs.sort(([indexA, a], [indexB, b]) => { const elementA = getElement(a); const elementB = getElement(b); if (elementA === elementB) return 0; if (!elementA || !elementB) return 0; if (isElementPreceding(elementA, elementB)) { if (indexA > indexB) { isOrderDifferent = true; } return -1; } if (indexA < indexB) { isOrderDifferent = true; } return 1; }); if (isOrderDifferent) { return pairs.map(([_, item]) => item); } return items; } function isElementPreceding(a, b) { return Boolean( b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING ); } ;// ./node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js "use client"; // src/utils/platform.ts function isTouchDevice() { return DTR5TSDJ_canUseDOM && !!navigator.maxTouchPoints; } function isApple() { if (!DTR5TSDJ_canUseDOM) return false; return /mac|iphone|ipad|ipod/i.test(navigator.platform); } function isSafari() { return DTR5TSDJ_canUseDOM && isApple() && /apple/i.test(navigator.vendor); } function isFirefox() { return DTR5TSDJ_canUseDOM && /firefox\//i.test(navigator.userAgent); } function isMac() { return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice(); } ;// ./node_modules/@ariakit/core/esm/utils/events.js "use client"; // src/utils/events.ts function isPortalEvent(event) { return Boolean( event.currentTarget && !contains(event.currentTarget, event.target) ); } function isSelfTarget(event) { return event.target === event.currentTarget; } function isOpeningInNewTab(event) { const element = event.currentTarget; if (!element) return false; const isAppleDevice = isApple(); if (isAppleDevice && !event.metaKey) return false; if (!isAppleDevice && !event.ctrlKey) return false; const tagName = element.tagName.toLowerCase(); if (tagName === "a") return true; if (tagName === "button" && element.type === "submit") return true; if (tagName === "input" && element.type === "submit") return true; return false; } function isDownloading(event) { const element = event.currentTarget; if (!element) return false; const tagName = element.tagName.toLowerCase(); if (!event.altKey) return false; if (tagName === "a") return true; if (tagName === "button" && element.type === "submit") return true; if (tagName === "input" && element.type === "submit") return true; return false; } function fireEvent(element, type, eventInit) { const event = new Event(type, eventInit); return element.dispatchEvent(event); } function fireBlurEvent(element, eventInit) { const event = new FocusEvent("blur", eventInit); const defaultAllowed = element.dispatchEvent(event); const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true }); element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); return defaultAllowed; } function fireFocusEvent(element, eventInit) { const event = new FocusEvent("focus", eventInit); const defaultAllowed = element.dispatchEvent(event); const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true }); element.dispatchEvent(new FocusEvent("focusin", bubbleInit)); return defaultAllowed; } function fireKeyboardEvent(element, type, eventInit) { const event = new KeyboardEvent(type, eventInit); return element.dispatchEvent(event); } function fireClickEvent(element, eventInit) { const event = new MouseEvent("click", eventInit); return element.dispatchEvent(event); } function isFocusEventOutside(event, container) { const containerElement = container || event.currentTarget; const relatedTarget = event.relatedTarget; return !relatedTarget || !contains(containerElement, relatedTarget); } function getInputType(event) { const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event; if (!nativeEvent) return; if (!("inputType" in nativeEvent)) return; if (typeof nativeEvent.inputType !== "string") return; return nativeEvent.inputType; } function queueBeforeEvent(element, type, callback, timeout) { const createTimer = (callback2) => { if (timeout) { const timerId2 = setTimeout(callback2, timeout); return () => clearTimeout(timerId2); } const timerId = requestAnimationFrame(callback2); return () => cancelAnimationFrame(timerId); }; const cancelTimer = createTimer(() => { element.removeEventListener(type, callSync, true); callback(); }); const callSync = () => { cancelTimer(); callback(); }; element.addEventListener(type, callSync, { once: true, capture: true }); return cancelTimer; } function addGlobalEventListener(type, listener, options, scope = window) { const children = []; try { scope.document.addEventListener(type, listener, options); for (const frame of Array.from(scope.frames)) { children.push(addGlobalEventListener(type, listener, options, frame)); } } catch (e) { } const removeEventListener = () => { try { scope.document.removeEventListener(type, listener, options); } catch (e) { } for (const remove of children) { remove(); } }; return removeEventListener; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js "use client"; // src/utils/hooks.ts var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject); var useReactId = _React.useId; var useReactDeferredValue = _React.useDeferredValue; var useReactInsertionEffect = _React.useInsertionEffect; var useSafeLayoutEffect = DTR5TSDJ_canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect; function useInitialValue(value) { const [initialValue] = (0,external_React_.useState)(value); return initialValue; } function useLazyValue(init) { const ref = useRef(); if (ref.current === void 0) { ref.current = init(); } return ref.current; } function useLiveRef(value) { const ref = (0,external_React_.useRef)(value); useSafeLayoutEffect(() => { ref.current = value; }); return ref; } function usePreviousValue(value) { const [previousValue, setPreviousValue] = useState(value); if (value !== previousValue) { setPreviousValue(value); } return previousValue; } function useEvent(callback) { const ref = (0,external_React_.useRef)(() => { throw new Error("Cannot call an event handler while rendering."); }); if (useReactInsertionEffect) { useReactInsertionEffect(() => { ref.current = callback; }); } else { ref.current = callback; } return (0,external_React_.useCallback)((...args) => { var _a; return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); }, []); } function useTransactionState(callback) { const [state, setState] = (0,external_React_.useState)(null); useSafeLayoutEffect(() => { if (state == null) return; if (!callback) return; let prevState = null; callback((prev) => { prevState = prev; return state; }); return () => { callback(prevState); }; }, [state, callback]); return [state, setState]; } function useMergeRefs(...refs) { return (0,external_React_.useMemo)(() => { if (!refs.some(Boolean)) return; return (value) => { for (const ref of refs) { setRef(ref, value); } }; }, refs); } function useId(defaultId) { if (useReactId) { const reactId = useReactId(); if (defaultId) return defaultId; return reactId; } const [id, setId] = (0,external_React_.useState)(defaultId); useSafeLayoutEffect(() => { if (defaultId || id) return; const random = Math.random().toString(36).slice(2, 8); setId(`id-${random}`); }, [defaultId, id]); return defaultId || id; } function useDeferredValue(value) { if (useReactDeferredValue) { return useReactDeferredValue(value); } const [deferredValue, setDeferredValue] = useState(value); useEffect(() => { const raf = requestAnimationFrame(() => setDeferredValue(value)); return () => cancelAnimationFrame(raf); }, [value]); return deferredValue; } function useTagName(refOrElement, type) { const stringOrUndefined = (type2) => { if (typeof type2 !== "string") return; return type2; }; const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type)); useSafeLayoutEffect(() => { const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); }, [refOrElement, type]); return tagName; } function useAttribute(refOrElement, attributeName, defaultValue) { const initialValue = useInitialValue(defaultValue); const [attribute, setAttribute] = (0,external_React_.useState)(initialValue); (0,external_React_.useEffect)(() => { const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; if (!element) return; const callback = () => { const value = element.getAttribute(attributeName); setAttribute(value == null ? initialValue : value); }; const observer = new MutationObserver(callback); observer.observe(element, { attributeFilter: [attributeName] }); callback(); return () => observer.disconnect(); }, [refOrElement, attributeName, initialValue]); return attribute; } function useUpdateEffect(effect, deps) { const mounted = (0,external_React_.useRef)(false); (0,external_React_.useEffect)(() => { if (mounted.current) { return effect(); } mounted.current = true; }, deps); (0,external_React_.useEffect)( () => () => { mounted.current = false; }, [] ); } function useUpdateLayoutEffect(effect, deps) { const mounted = (0,external_React_.useRef)(false); useSafeLayoutEffect(() => { if (mounted.current) { return effect(); } mounted.current = true; }, deps); useSafeLayoutEffect( () => () => { mounted.current = false; }, [] ); } function useForceUpdate() { return (0,external_React_.useReducer)(() => [], []); } function useBooleanEvent(booleanOrCallback) { return useEvent( typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback ); } function useWrapElement(props, callback, deps = []) { const wrapElement = (0,external_React_.useCallback)( (element) => { if (props.wrapElement) { element = props.wrapElement(element); } return callback(element); }, [...deps, props.wrapElement] ); return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement }); } function usePortalRef(portalProp = false, portalRefProp) { const [portalNode, setPortalNode] = useState(null); const portalRef = useMergeRefs(setPortalNode, portalRefProp); const domReady = !portalProp || portalNode; return { portalRef, portalNode, domReady }; } function useMetadataProps(props, key, value) { const parent = props.onLoadedMetadataCapture; const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => { return Object.assign(() => { }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value })); }, [parent, key, value]); return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }]; } function useIsMouseMoving() { (0,external_React_.useEffect)(() => { addGlobalEventListener("mousemove", setMouseMoving, true); addGlobalEventListener("mousedown", resetMouseMoving, true); addGlobalEventListener("mouseup", resetMouseMoving, true); addGlobalEventListener("keydown", resetMouseMoving, true); addGlobalEventListener("scroll", resetMouseMoving, true); }, []); const isMouseMoving = useEvent(() => mouseMoving); return isMouseMoving; } var mouseMoving = false; var previousScreenX = 0; var previousScreenY = 0; function hasMouseMovement(event) { const movementX = event.movementX || event.screenX - previousScreenX; const movementY = event.movementY || event.screenY - previousScreenY; previousScreenX = event.screenX; previousScreenY = event.screenY; return movementX || movementY || "production" === "test"; } function setMouseMoving(event) { if (!hasMouseMovement(event)) return; mouseMoving = true; } function resetMouseMoving() { mouseMoving = false; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js "use client"; // src/utils/system.tsx function forwardRef2(render) { const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref }))); Role.displayName = render.displayName || render.name; return Role; } function memo2(Component, propsAreEqual) { return external_React_.memo(Component, propsAreEqual); } function createElement(Type, props) { const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]); const mergedRef = useMergeRefs(props.ref, getRefProperty(render)); let element; if (external_React_.isValidElement(render)) { const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef }); element = external_React_.cloneElement(render, mergeProps(rest, renderProps)); } else if (render) { element = render(rest); } else { element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest)); } if (wrapElement) { return wrapElement(element); } return element; } function createHook(useProps) { const useRole = (props = {}) => { return useProps(props); }; useRole.displayName = useProps.name; return useRole; } function createStoreContext(providers = [], scopedProviders = []) { const context = external_React_.createContext(void 0); const scopedContext = external_React_.createContext(void 0); const useContext2 = () => external_React_.useContext(context); const useScopedContext = (onlyScoped = false) => { const scoped = external_React_.useContext(scopedContext); const store = useContext2(); if (onlyScoped) return scoped; return scoped || store; }; const useProviderContext = () => { const scoped = external_React_.useContext(scopedContext); const store = useContext2(); if (scoped && scoped === store) return; return store; }; const ContextProvider = (props) => { return providers.reduceRight( (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props)) ); }; const ScopedContextProvider = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight( (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props)) ) })); }; return { context, scopedContext, useContext: useContext2, useScopedContext, useProviderContext, ContextProvider, ScopedContextProvider }; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js "use client"; // src/collection/collection-context.tsx var ctx = createStoreContext(); var useCollectionContext = ctx.useContext; var useCollectionScopedContext = ctx.useScopedContext; var useCollectionProviderContext = ctx.useProviderContext; var CollectionContextProvider = ctx.ContextProvider; var CollectionScopedContextProvider = ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js "use client"; // src/composite/composite-context.tsx var P7GR5CS5_ctx = createStoreContext( [CollectionContextProvider], [CollectionScopedContextProvider] ); var useCompositeContext = P7GR5CS5_ctx.useContext; var useCompositeScopedContext = P7GR5CS5_ctx.useScopedContext; var useCompositeProviderContext = P7GR5CS5_ctx.useProviderContext; var CompositeContextProvider = P7GR5CS5_ctx.ContextProvider; var CompositeScopedContextProvider = P7GR5CS5_ctx.ScopedContextProvider; var CompositeItemContext = (0,external_React_.createContext)( void 0 ); var CompositeRowContext = (0,external_React_.createContext)( void 0 ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/3XAVFTCA.js "use client"; // src/tag/tag-context.tsx var TagValueContext = (0,external_React_.createContext)(null); var TagRemoveIdContext = (0,external_React_.createContext)( null ); var _3XAVFTCA_ctx = createStoreContext( [CompositeContextProvider], [CompositeScopedContextProvider] ); var useTagContext = _3XAVFTCA_ctx.useContext; var useTagScopedContext = _3XAVFTCA_ctx.useScopedContext; var useTagProviderContext = _3XAVFTCA_ctx.useProviderContext; var TagContextProvider = _3XAVFTCA_ctx.ContextProvider; var TagScopedContextProvider = _3XAVFTCA_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js "use client"; // src/utils/store.ts function getInternal(store, key) { const internals = store.__unstableInternals; invariant(internals, "Invalid store"); return internals[key]; } function createStore(initialState, ...stores) { let state = initialState; let prevStateBatch = state; let lastUpdate = Symbol(); let destroy = PBFD2E7P_noop; const instances = /* @__PURE__ */ new Set(); const updatedKeys = /* @__PURE__ */ new Set(); const setups = /* @__PURE__ */ new Set(); const listeners = /* @__PURE__ */ new Set(); const batchListeners = /* @__PURE__ */ new Set(); const disposables = /* @__PURE__ */ new WeakMap(); const listenerKeys = /* @__PURE__ */ new WeakMap(); const storeSetup = (callback) => { setups.add(callback); return () => setups.delete(callback); }; const storeInit = () => { const initialized = instances.size; const instance = Symbol(); instances.add(instance); const maybeDestroy = () => { instances.delete(instance); if (instances.size) return; destroy(); }; if (initialized) return maybeDestroy; const desyncs = getKeys(state).map( (key) => chain( ...stores.map((store) => { var _a; const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store); if (!storeState) return; if (!PBFD2E7P_hasOwnProperty(storeState, key)) return; return sync(store, [key], (state2) => { setState( key, state2[key], // @ts-expect-error - Not public API. This is just to prevent // infinite loops. true ); }); }) ) ); const teardowns = []; for (const setup2 of setups) { teardowns.push(setup2()); } const cleanups = stores.map(init); destroy = chain(...desyncs, ...teardowns, ...cleanups); return maybeDestroy; }; const sub = (keys, listener, set = listeners) => { set.add(listener); listenerKeys.set(listener, keys); return () => { var _a; (_a = disposables.get(listener)) == null ? void 0 : _a(); disposables.delete(listener); listenerKeys.delete(listener); set.delete(listener); }; }; const storeSubscribe = (keys, listener) => sub(keys, listener); const storeSync = (keys, listener) => { disposables.set(listener, listener(state, state)); return sub(keys, listener); }; const storeBatch = (keys, listener) => { disposables.set(listener, listener(state, prevStateBatch)); return sub(keys, listener, batchListeners); }; const storePick = (keys) => createStore(pick(state, keys), finalStore); const storeOmit = (keys) => createStore(omit(state, keys), finalStore); const getState = () => state; const setState = (key, value, fromStores = false) => { var _a; if (!PBFD2E7P_hasOwnProperty(state, key)) return; const nextValue = applyState(value, state[key]); if (nextValue === state[key]) return; if (!fromStores) { for (const store of stores) { (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue); } } const prevState = state; state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue }); const thisUpdate = Symbol(); lastUpdate = thisUpdate; updatedKeys.add(key); const run = (listener, prev, uKeys) => { var _a2; const keys = listenerKeys.get(listener); const updated = (k) => uKeys ? uKeys.has(k) : k === key; if (!keys || keys.some(updated)) { (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); disposables.set(listener, listener(state, prev)); } }; for (const listener of listeners) { run(listener, prevState); } queueMicrotask(() => { if (lastUpdate !== thisUpdate) return; const snapshot = state; for (const listener of batchListeners) { run(listener, prevStateBatch, updatedKeys); } prevStateBatch = snapshot; updatedKeys.clear(); }); }; const finalStore = { getState, setState, __unstableInternals: { setup: storeSetup, init: storeInit, subscribe: storeSubscribe, sync: storeSync, batch: storeBatch, pick: storePick, omit: storeOmit } }; return finalStore; } function setup(store, ...args) { if (!store) return; return getInternal(store, "setup")(...args); } function init(store, ...args) { if (!store) return; return getInternal(store, "init")(...args); } function subscribe(store, ...args) { if (!store) return; return getInternal(store, "subscribe")(...args); } function sync(store, ...args) { if (!store) return; return getInternal(store, "sync")(...args); } function batch(store, ...args) { if (!store) return; return getInternal(store, "batch")(...args); } function omit2(store, ...args) { if (!store) return; return getInternal(store, "omit")(...args); } function pick2(store, ...args) { if (!store) return; return getInternal(store, "pick")(...args); } function mergeStore(...stores) { const initialState = stores.reduce((state, store2) => { var _a; const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); if (!nextState) return state; return Object.assign(state, nextState); }, {}); const store = createStore(initialState, ...stores); return Object.assign({}, ...stores, store); } function throwOnConflictingProps(props, store) { if (true) return; if (!store) return; const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { var _a; const stateKey = key.replace("default", ""); return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`; }); if (!defaultKeys.length) return; const storeState = store.getState(); const conflictingProps = defaultKeys.filter( (key) => PBFD2E7P_hasOwnProperty(storeState, key) ); if (!conflictingProps.length) return; throw new Error( `Passing a store prop in conjunction with a default state is not supported. const store = useSelectStore(); <SelectProvider store={store} defaultValue="Apple" /> ^ ^ Instead, pass the default state to the topmost store: const store = useSelectStore({ defaultValue: "Apple" }); <SelectProvider store={store} /> See https://github.com/ariakit/ariakit/pull/2745 for more details. If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit ` ); } // EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js var shim = __webpack_require__(422); ;// ./node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js "use client"; // src/utils/store.tsx var { useSyncExternalStore } = shim; var noopSubscribe = () => () => { }; function useStoreState(store, keyOrSelector = identity) { const storeSubscribe = external_React_.useCallback( (callback) => { if (!store) return noopSubscribe(); return subscribe(store, null, callback); }, [store] ); const getSnapshot = () => { const key = typeof keyOrSelector === "string" ? keyOrSelector : null; const selector = typeof keyOrSelector === "function" ? keyOrSelector : null; const state = store == null ? void 0 : store.getState(); if (selector) return selector(state); if (!state) return; if (!key) return; if (!PBFD2E7P_hasOwnProperty(state, key)) return; return state[key]; }; return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); } function useStoreStateObject(store, object) { const objRef = external_React_.useRef( {} ); const storeSubscribe = external_React_.useCallback( (callback) => { if (!store) return noopSubscribe(); return subscribe(store, null, callback); }, [store] ); const getSnapshot = () => { const state = store == null ? void 0 : store.getState(); let updated = false; const obj = objRef.current; for (const prop in object) { const keyOrSelector = object[prop]; if (typeof keyOrSelector === "function") { const value = keyOrSelector(state); if (value !== obj[prop]) { obj[prop] = value; updated = true; } } if (typeof keyOrSelector === "string") { if (!state) continue; if (!PBFD2E7P_hasOwnProperty(state, keyOrSelector)) continue; const value = state[keyOrSelector]; if (value !== obj[prop]) { obj[prop] = value; updated = true; } } } if (updated) { objRef.current = _3YLGPPWQ_spreadValues({}, obj); } return objRef.current; }; return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); } function useStoreProps(store, props, key, setKey) { const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0; const setValue = setKey ? props[setKey] : void 0; const propsRef = useLiveRef({ value, setValue }); useSafeLayoutEffect(() => { return sync(store, [key], (state, prev) => { const { value: value2, setValue: setValue2 } = propsRef.current; if (!setValue2) return; if (state[key] === prev[key]) return; if (state[key] === value2) return; setValue2(state[key]); }); }, [store, key]); useSafeLayoutEffect(() => { if (value === void 0) return; store.setState(key, value); return batch(store, [key], () => { if (value === void 0) return; store.setState(key, value); }); }); } function YV4JVR4I_useStore(createStore, props) { const [store, setStore] = external_React_.useState(() => createStore(props)); useSafeLayoutEffect(() => init(store), [store]); const useState2 = external_React_.useCallback( (keyOrSelector) => useStoreState(store, keyOrSelector), [store] ); const memoizedStore = external_React_.useMemo( () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }), [store, useState2] ); const updateStore = useEvent(() => { setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState()))); }); return [memoizedStore, updateStore]; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js "use client"; // src/collection/collection-store.ts function useCollectionStoreProps(store, update, props) { useUpdateEffect(update, [props.store]); useStoreProps(store, props, "items", "setItems"); return store; } function useCollectionStore(props = {}) { const [store, update] = useStore(Core.createCollectionStore, props); return useCollectionStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js "use client"; // src/composite/composite-store.ts function useCompositeStoreOptions(props) { const id = useId(props.id); return _3YLGPPWQ_spreadValues({ id }, props); } function useCompositeStoreProps(store, update, props) { store = useCollectionStoreProps(store, update, props); useStoreProps(store, props, "activeId", "setActiveId"); useStoreProps(store, props, "includesBaseElement"); useStoreProps(store, props, "virtualFocus"); useStoreProps(store, props, "orientation"); useStoreProps(store, props, "rtl"); useStoreProps(store, props, "focusLoop"); useStoreProps(store, props, "focusWrap"); useStoreProps(store, props, "focusShift"); return store; } function useCompositeStore(props = {}) { props = useCompositeStoreOptions(props); const [store, update] = useStore(Core.createCompositeStore, props); return useCompositeStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js "use client"; // src/disclosure/disclosure-store.ts function useDisclosureStoreProps(store, update, props) { useUpdateEffect(update, [props.store, props.disclosure]); useStoreProps(store, props, "open", "setOpen"); useStoreProps(store, props, "mounted", "setMounted"); useStoreProps(store, props, "animated"); return Object.assign(store, { disclosure: props.disclosure }); } function useDisclosureStore(props = {}) { const [store, update] = useStore(Core.createDisclosureStore, props); return useDisclosureStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js "use client"; // src/dialog/dialog-store.ts function useDialogStoreProps(store, update, props) { return useDisclosureStoreProps(store, update, props); } function useDialogStore(props = {}) { const [store, update] = useStore(Core.createDialogStore, props); return useDialogStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js "use client"; // src/popover/popover-store.ts function usePopoverStoreProps(store, update, props) { useUpdateEffect(update, [props.popover]); useStoreProps(store, props, "placement"); return useDialogStoreProps(store, update, props); } function usePopoverStore(props = {}) { const [store, update] = useStore(Core.createPopoverStore, props); return usePopoverStoreProps(store, update, props); } ;// ./node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js "use client"; // src/collection/collection-store.ts function getCommonParent(items) { var _a; const firstItem = items.find((item) => !!item.element); const lastItem = [...items].reverse().find((item) => !!item.element); let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { const parent = parentElement; if (lastItem && parent.contains(lastItem.element)) { return parentElement; } parentElement = parentElement.parentElement; } return getDocument(parentElement).body; } function getPrivateStore(store) { return store == null ? void 0 : store.__unstablePrivateStore; } function createCollectionStore(props = {}) { var _a; throwOnConflictingProps(props, props.store); const syncState = (_a = props.store) == null ? void 0 : _a.getState(); const items = defaultValue( props.items, syncState == null ? void 0 : syncState.items, props.defaultItems, [] ); const itemsMap = new Map(items.map((item) => [item.id, item])); const initialState = { items, renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) }; const syncPrivateStore = getPrivateStore(props.store); const privateStore = createStore( { items, renderedItems: initialState.renderedItems }, syncPrivateStore ); const collection = createStore(initialState, props.store); const sortItems = (renderedItems) => { const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element); privateStore.setState("renderedItems", sortedItems); collection.setState("renderedItems", sortedItems); }; setup(collection, () => init(privateStore)); setup(privateStore, () => { return batch(privateStore, ["items"], (state) => { collection.setState("items", state.items); }); }); setup(privateStore, () => { return batch(privateStore, ["renderedItems"], (state) => { let firstRun = true; let raf = requestAnimationFrame(() => { const { renderedItems } = collection.getState(); if (state.renderedItems === renderedItems) return; sortItems(state.renderedItems); }); if (typeof IntersectionObserver !== "function") { return () => cancelAnimationFrame(raf); } const ioCallback = () => { if (firstRun) { firstRun = false; return; } cancelAnimationFrame(raf); raf = requestAnimationFrame(() => sortItems(state.renderedItems)); }; const root = getCommonParent(state.renderedItems); const observer = new IntersectionObserver(ioCallback, { root }); for (const item of state.renderedItems) { if (!item.element) continue; observer.observe(item.element); } return () => { cancelAnimationFrame(raf); observer.disconnect(); }; }); }); const mergeItem = (item, setItems, canDeleteFromMap = false) => { let prevItem; setItems((items2) => { const index = items2.findIndex(({ id }) => id === item.id); const nextItems = items2.slice(); if (index !== -1) { prevItem = items2[index]; const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item); nextItems[index] = nextItem; itemsMap.set(item.id, nextItem); } else { nextItems.push(item); itemsMap.set(item.id, item); } return nextItems; }); const unmergeItem = () => { setItems((items2) => { if (!prevItem) { if (canDeleteFromMap) { itemsMap.delete(item.id); } return items2.filter(({ id }) => id !== item.id); } const index = items2.findIndex(({ id }) => id === item.id); if (index === -1) return items2; const nextItems = items2.slice(); nextItems[index] = prevItem; itemsMap.set(item.id, prevItem); return nextItems; }); }; return unmergeItem; }; const registerItem = (item) => mergeItem( item, (getItems) => privateStore.setState("items", getItems), true ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), { registerItem, renderItem: (item) => chain( registerItem(item), mergeItem( item, (getItems) => privateStore.setState("renderedItems", getItems) ) ), item: (id) => { if (!id) return null; let item = itemsMap.get(id); if (!item) { const { items: items2 } = privateStore.getState(); item = items2.find((item2) => item2.id === id); if (item) { itemsMap.set(id, item); } } return item || null; }, // @ts-expect-error Internal __unstablePrivateStore: privateStore }); } ;// ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js "use client"; // src/utils/array.ts function toArray(arg) { if (Array.isArray(arg)) { return arg; } return typeof arg !== "undefined" ? [arg] : []; } function addItemToArray(array, item, index = -1) { if (!(index in array)) { return [...array, item]; } return [...array.slice(0, index), item, ...array.slice(index)]; } function flatten2DArray(array) { const flattened = []; for (const row of array) { flattened.push(...row); } return flattened; } function reverseArray(array) { return array.slice().reverse(); } ;// ./node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js "use client"; // src/composite/composite-store.ts var NULL_ITEM = { id: null }; function findFirstEnabledItem(items, excludeId) { return items.find((item) => { if (excludeId) { return !item.disabled && item.id !== excludeId; } return !item.disabled; }); } function getEnabledItems(items, excludeId) { return items.filter((item) => { if (excludeId) { return !item.disabled && item.id !== excludeId; } return !item.disabled; }); } function getItemsInRow(items, rowId) { return items.filter((item) => item.rowId === rowId); } function flipItems(items, activeId, shouldInsertNullItem = false) { const index = items.findIndex((item) => item.id === activeId); return [ ...items.slice(index + 1), ...shouldInsertNullItem ? [NULL_ITEM] : [], ...items.slice(0, index) ]; } function groupItemsByRows(items) { const rows = []; for (const item of items) { const row = rows.find((currentRow) => { var _a; return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; }); if (row) { row.push(item); } else { rows.push([item]); } } return rows; } function getMaxRowLength(array) { let maxLength = 0; for (const { length } of array) { if (length > maxLength) { maxLength = length; } } return maxLength; } function createEmptyItem(rowId) { return { id: "__EMPTY_ITEM__", disabled: true, rowId }; } function normalizeRows(rows, activeId, focusShift) { const maxLength = getMaxRowLength(rows); for (const row of rows) { for (let i = 0; i < maxLength; i += 1) { const item = row[i]; if (!item || focusShift && item.disabled) { const isFirst = i === 0; const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1]; row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); } } } return rows; } function verticalizeItems(items) { const rows = groupItemsByRows(items); const maxLength = getMaxRowLength(rows); const verticalized = []; for (let i = 0; i < maxLength; i += 1) { for (const row of rows) { const item = row[i]; if (item) { verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), { // If there's no rowId, it means that it's not a grid composite, but // a single row instead. So, instead of verticalizing it, that is, // assigning a different rowId based on the column index, we keep it // undefined so they will be part of the same row. This is useful // when using up/down on one-dimensional composites. rowId: item.rowId ? `${i}` : void 0 })); } } } return verticalized; } function createCompositeStore(props = {}) { var _a; const syncState = (_a = props.store) == null ? void 0 : _a.getState(); const collection = createCollectionStore(props); const activeId = defaultValue( props.activeId, syncState == null ? void 0 : syncState.activeId, props.defaultActiveId ); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), { id: defaultValue( props.id, syncState == null ? void 0 : syncState.id, `id-${Math.random().toString(36).slice(2, 8)}` ), activeId, baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), includesBaseElement: defaultValue( props.includesBaseElement, syncState == null ? void 0 : syncState.includesBaseElement, activeId === null ), moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), orientation: defaultValue( props.orientation, syncState == null ? void 0 : syncState.orientation, "both" ), rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), virtualFocus: defaultValue( props.virtualFocus, syncState == null ? void 0 : syncState.virtualFocus, false ), focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) }); const composite = createStore(initialState, collection, props.store); setup( composite, () => sync(composite, ["renderedItems", "activeId"], (state) => { composite.setState("activeId", (activeId2) => { var _a2; if (activeId2 !== void 0) return activeId2; return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id; }); }) ); const getNextId = (direction = "next", options = {}) => { var _a2, _b; const defaultState = composite.getState(); const { skip = 0, activeId: activeId2 = defaultState.activeId, focusShift = defaultState.focusShift, focusLoop = defaultState.focusLoop, focusWrap = defaultState.focusWrap, includesBaseElement = defaultState.includesBaseElement, renderedItems = defaultState.renderedItems, rtl = defaultState.rtl } = options; const isVerticalDirection = direction === "up" || direction === "down"; const isNextDirection = direction === "next" || direction === "down"; const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; const canShift = focusShift && !skip; let items = !isVerticalDirection ? renderedItems : flatten2DArray( normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift) ); items = canReverse ? reverseArray(items) : items; items = isVerticalDirection ? verticalizeItems(items) : items; if (activeId2 == null) { return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id; } const activeItem = items.find((item) => item.id === activeId2); if (!activeItem) { return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id; } const isGrid = items.some((item) => item.rowId); const activeIndex = items.indexOf(activeItem); const nextItems = items.slice(activeIndex + 1); const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); if (skip) { const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; return nextItem2 == null ? void 0 : nextItem2.id; } const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false; if (canLoop) { const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId); const sortedItems = flipItems(loopItems, activeId2, hasNullItem); const nextItem2 = findFirstEnabledItem(sortedItems, activeId2); return nextItem2 == null ? void 0 : nextItem2.id; } if (canWrap) { const nextItem2 = findFirstEnabledItem( // We can use nextItems, which contains all the next items, including // items from other rows, to wrap between rows. However, if there is a // null item (the composite container), we'll only use the next items in // the row. So moving next from the last item will focus on the // composite container. On grid composites, horizontal navigation never // focuses on the composite container, only vertical. hasNullItem ? nextItemsInRow : nextItems, activeId2 ); const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; return nextId; } const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); if (!nextItem && hasNullItem) { return null; } return nextItem == null ? void 0 : nextItem.id; }; return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), { setBaseElement: (element) => composite.setState("baseElement", element), setActiveId: (id) => composite.setState("activeId", id), move: (id) => { if (id === void 0) return; composite.setState("activeId", id); composite.setState("moves", (moves) => moves + 1); }, first: () => { var _a2; return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id; }, last: () => { var _a2; return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; }, next: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("next", options); }, previous: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("previous", options); }, down: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("down", options); }, up: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("up", options); } }); } ;// ./node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js "use client"; // src/disclosure/disclosure-store.ts function createDisclosureStore(props = {}) { const store = mergeStore( props.store, omit2(props.disclosure, ["contentElement", "disclosureElement"]) ); throwOnConflictingProps(props, store); const syncState = store == null ? void 0 : store.getState(); const open = defaultValue( props.open, syncState == null ? void 0 : syncState.open, props.defaultOpen, false ); const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); const initialState = { open, animated, animating: !!animated && open, mounted: open, contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) }; const disclosure = createStore(initialState, store); setup( disclosure, () => sync(disclosure, ["animated", "animating"], (state) => { if (state.animated) return; disclosure.setState("animating", false); }) ); setup( disclosure, () => subscribe(disclosure, ["open"], () => { if (!disclosure.getState().animated) return; disclosure.setState("animating", true); }) ); setup( disclosure, () => sync(disclosure, ["open", "animating"], (state) => { disclosure.setState("mounted", state.open || state.animating); }) ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), { disclosure: props.disclosure, setOpen: (value) => disclosure.setState("open", value), show: () => disclosure.setState("open", true), hide: () => disclosure.setState("open", false), toggle: () => disclosure.setState("open", (open2) => !open2), stopAnimation: () => disclosure.setState("animating", false), setContentElement: (value) => disclosure.setState("contentElement", value), setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) }); } ;// ./node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js "use client"; // src/dialog/dialog-store.ts function createDialogStore(props = {}) { return createDisclosureStore(props); } ;// ./node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js "use client"; // src/popover/popover-store.ts function createPopoverStore(_a = {}) { var _b = _a, { popover: otherPopover } = _b, props = _3YLGPPWQ_objRest(_b, [ "popover" ]); const store = mergeStore( props.store, omit2(otherPopover, [ "arrowElement", "anchorElement", "contentElement", "popoverElement", "disclosureElement" ]) ); throwOnConflictingProps(props, store); const syncState = store == null ? void 0 : store.getState(); const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store })); const placement = defaultValue( props.placement, syncState == null ? void 0 : syncState.placement, "bottom" ); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), { placement, currentPlacement: placement, anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), rendered: Symbol("rendered") }); const popover = createStore(initialState, dialog, store); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), { setAnchorElement: (element) => popover.setState("anchorElement", element), setPopoverElement: (element) => popover.setState("popoverElement", element), setArrowElement: (element) => popover.setState("arrowElement", element), render: () => popover.setState("rendered", Symbol("rendered")) }); } ;// ./node_modules/@ariakit/core/esm/combobox/combobox-store.js "use client"; // src/combobox/combobox-store.ts var isTouchSafari = isSafari() && isTouchDevice(); function createComboboxStore(_a = {}) { var _b = _a, { tag } = _b, props = _3YLGPPWQ_objRest(_b, [ "tag" ]); const store = mergeStore(props.store, pick2(tag, ["value", "rtl"])); throwOnConflictingProps(props, store); const tagState = tag == null ? void 0 : tag.getState(); const syncState = store == null ? void 0 : store.getState(); const activeId = defaultValue( props.activeId, syncState == null ? void 0 : syncState.activeId, props.defaultActiveId, null ); const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { activeId, includesBaseElement: defaultValue( props.includesBaseElement, syncState == null ? void 0 : syncState.includesBaseElement, true ), orientation: defaultValue( props.orientation, syncState == null ? void 0 : syncState.orientation, "vertical" ), focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true), focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true), virtualFocus: defaultValue( props.virtualFocus, syncState == null ? void 0 : syncState.virtualFocus, true ) })); const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { placement: defaultValue( props.placement, syncState == null ? void 0 : syncState.placement, "bottom-start" ) })); const value = defaultValue( props.value, syncState == null ? void 0 : syncState.value, props.defaultValue, "" ); const selectedValue = defaultValue( props.selectedValue, syncState == null ? void 0 : syncState.selectedValue, tagState == null ? void 0 : tagState.values, props.defaultSelectedValue, "" ); const multiSelectable = Array.isArray(selectedValue); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), { value, selectedValue, resetValueOnSelect: defaultValue( props.resetValueOnSelect, syncState == null ? void 0 : syncState.resetValueOnSelect, multiSelectable ), resetValueOnHide: defaultValue( props.resetValueOnHide, syncState == null ? void 0 : syncState.resetValueOnHide, multiSelectable && !tag ), activeValue: syncState == null ? void 0 : syncState.activeValue }); const combobox = createStore(initialState, composite, popover, store); if (isTouchSafari) { setup( combobox, () => sync(combobox, ["virtualFocus"], () => { combobox.setState("virtualFocus", false); }) ); } setup(combobox, () => { if (!tag) return; return chain( sync(combobox, ["selectedValue"], (state) => { if (!Array.isArray(state.selectedValue)) return; tag.setValues(state.selectedValue); }), sync(tag, ["values"], (state) => { combobox.setState("selectedValue", state.values); }) ); }); setup( combobox, () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => { if (!state.resetValueOnHide) return; if (state.mounted) return; combobox.setState("value", value); }) ); setup( combobox, () => sync(combobox, ["open"], (state) => { if (state.open) return; combobox.setState("activeId", activeId); combobox.setState("moves", 0); }) ); setup( combobox, () => sync(combobox, ["moves", "activeId"], (state, prevState) => { if (state.moves === prevState.moves) { combobox.setState("activeValue", void 0); } }) ); setup( combobox, () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { if (state.moves === prev.moves) return; const { activeId: activeId2 } = combobox.getState(); const activeItem = composite.item(activeId2); combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value); }) ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), composite), combobox), { tag, setValue: (value2) => combobox.setState("value", value2), resetValue: () => combobox.setState("value", initialState.value), setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/FEOFMWBY.js "use client"; // src/combobox/combobox-store.ts function useComboboxStoreOptions(props) { const tag = useTagContext(); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { tag: props.tag !== void 0 ? props.tag : tag }); return useCompositeStoreOptions(props); } function useComboboxStoreProps(store, update, props) { useUpdateEffect(update, [props.tag]); useStoreProps(store, props, "value", "setValue"); useStoreProps(store, props, "selectedValue", "setSelectedValue"); useStoreProps(store, props, "resetValueOnHide"); useStoreProps(store, props, "resetValueOnSelect"); return Object.assign( useCompositeStoreProps( usePopoverStoreProps(store, update, props), update, props ), { tag: props.tag } ); } function useComboboxStore(props = {}) { props = useComboboxStoreOptions(props); const [store, update] = YV4JVR4I_useStore(createComboboxStore, props); return useComboboxStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js "use client"; // src/disclosure/disclosure-context.tsx var S6EF7IVO_ctx = createStoreContext(); var useDisclosureContext = S6EF7IVO_ctx.useContext; var useDisclosureScopedContext = S6EF7IVO_ctx.useScopedContext; var useDisclosureProviderContext = S6EF7IVO_ctx.useProviderContext; var DisclosureContextProvider = S6EF7IVO_ctx.ContextProvider; var DisclosureScopedContextProvider = S6EF7IVO_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js "use client"; // src/dialog/dialog-context.tsx var RS7LB2H4_ctx = createStoreContext( [DisclosureContextProvider], [DisclosureScopedContextProvider] ); var useDialogContext = RS7LB2H4_ctx.useContext; var useDialogScopedContext = RS7LB2H4_ctx.useScopedContext; var useDialogProviderContext = RS7LB2H4_ctx.useProviderContext; var DialogContextProvider = RS7LB2H4_ctx.ContextProvider; var DialogScopedContextProvider = RS7LB2H4_ctx.ScopedContextProvider; var DialogHeadingContext = (0,external_React_.createContext)(void 0); var DialogDescriptionContext = (0,external_React_.createContext)(void 0); ;// ./node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js "use client"; // src/popover/popover-context.tsx var MTZPJQMC_ctx = createStoreContext( [DialogContextProvider], [DialogScopedContextProvider] ); var usePopoverContext = MTZPJQMC_ctx.useContext; var usePopoverScopedContext = MTZPJQMC_ctx.useScopedContext; var usePopoverProviderContext = MTZPJQMC_ctx.useProviderContext; var PopoverContextProvider = MTZPJQMC_ctx.ContextProvider; var PopoverScopedContextProvider = MTZPJQMC_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js "use client"; // src/combobox/combobox-context.tsx var ComboboxListRoleContext = (0,external_React_.createContext)( void 0 ); var VEVQD5MH_ctx = createStoreContext( [PopoverContextProvider, CompositeContextProvider], [PopoverScopedContextProvider, CompositeScopedContextProvider] ); var useComboboxContext = VEVQD5MH_ctx.useContext; var useComboboxScopedContext = VEVQD5MH_ctx.useScopedContext; var useComboboxProviderContext = VEVQD5MH_ctx.useProviderContext; var ComboboxContextProvider = VEVQD5MH_ctx.ContextProvider; var ComboboxScopedContextProvider = VEVQD5MH_ctx.ScopedContextProvider; var ComboboxItemValueContext = (0,external_React_.createContext)( void 0 ); var ComboboxItemCheckedContext = (0,external_React_.createContext)(false); ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js "use client"; // src/combobox/combobox-provider.tsx function ComboboxProvider(props = {}) { const store = useComboboxStore(props); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children }); } ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-label.js "use client"; // src/combobox/combobox-label.tsx var TagName = "label"; var useComboboxLabel = createHook( function useComboboxLabel2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useComboboxProviderContext(); store = store || context; invariant( store, false && 0 ); const comboboxId = store.useState((state) => { var _a2; return (_a2 = state.baseElement) == null ? void 0 : _a2.id; }); props = _3YLGPPWQ_spreadValues({ htmlFor: comboboxId }, props); return removeUndefinedValues(props); } ); var ComboboxLabel = memo2( forwardRef2(function ComboboxLabel2(props) { const htmlProps = useComboboxLabel(props); return createElement(TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js "use client"; // src/popover/popover-anchor.tsx var OMU7RWRV_TagName = "div"; var usePopoverAnchor = createHook( function usePopoverAnchor2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = usePopoverProviderContext(); store = store || context; props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref) }); return props; } ); var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) { const htmlProps = usePopoverAnchor(props); return createElement(OMU7RWRV_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js "use client"; // src/composite/utils.ts var _5VQZOHHZ_NULL_ITEM = { id: null }; function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) { const index = items.findIndex((item) => item.id === activeId); return [ ...items.slice(index + 1), ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [], ...items.slice(0, index) ]; } function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) { return items.find((item) => { if (excludeId) { return !item.disabled && item.id !== excludeId; } return !item.disabled; }); } function getEnabledItem(store, id) { if (!id) return null; return store.item(id) || null; } function _5VQZOHHZ_groupItemsByRows(items) { const rows = []; for (const item of items) { const row = rows.find((currentRow) => { var _a; return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; }); if (row) { row.push(item); } else { rows.push([item]); } } return rows; } function selectTextField(element, collapseToEnd = false) { if (isTextField(element)) { element.setSelectionRange( collapseToEnd ? element.value.length : 0, element.value.length ); } else if (element.isContentEditable) { const selection = getDocument(element).getSelection(); selection == null ? void 0 : selection.selectAllChildren(element); if (collapseToEnd) { selection == null ? void 0 : selection.collapseToEnd(); } } } var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY"); function focusSilently(element) { element[FOCUS_SILENTLY] = true; element.focus({ preventScroll: true }); } function silentlyFocused(element) { const isSilentlyFocused = element[FOCUS_SILENTLY]; delete element[FOCUS_SILENTLY]; return isSilentlyFocused; } function isItem(store, element, exclude) { if (!element) return false; if (element === exclude) return false; const item = store.item(element.id); if (!item) return false; if (exclude && item.element === exclude) return false; return true; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js "use client"; // src/focusable/focusable-context.tsx var FocusableContext = (0,external_React_.createContext)(true); ;// ./node_modules/@ariakit/core/esm/utils/focus.js "use client"; // src/utils/focus.ts var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])"; function hasNegativeTabIndex(element) { const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10); return tabIndex < 0; } function isFocusable(element) { if (!element.matches(selector)) return false; if (!isVisible(element)) return false; if (element.closest("[inert]")) return false; return true; } function isTabbable(element) { if (!isFocusable(element)) return false; if (hasNegativeTabIndex(element)) return false; if (!("form" in element)) return true; if (!element.form) return true; if (element.checked) return true; if (element.type !== "radio") return true; const radioGroup = element.form.elements.namedItem(element.name); if (!radioGroup) return true; if (!("length" in radioGroup)) return true; const activeElement = getActiveElement(element); if (!activeElement) return true; if (activeElement === element) return true; if (!("form" in activeElement)) return true; if (activeElement.form !== element.form) return true; if (activeElement.name !== element.name) return true; return false; } function getAllFocusableIn(container, includeContainer) { const elements = Array.from( container.querySelectorAll(selector) ); if (includeContainer) { elements.unshift(container); } const focusableElements = elements.filter(isFocusable); focusableElements.forEach((element, i) => { if (isFrame(element) && element.contentDocument) { const frameBody = element.contentDocument.body; focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody)); } }); return focusableElements; } function getAllFocusable(includeBody) { return getAllFocusableIn(document.body, includeBody); } function getFirstFocusableIn(container, includeContainer) { const [first] = getAllFocusableIn(container, includeContainer); return first || null; } function getFirstFocusable(includeBody) { return getFirstFocusableIn(document.body, includeBody); } function getAllTabbableIn(container, includeContainer, fallbackToFocusable) { const elements = Array.from( container.querySelectorAll(selector) ); const tabbableElements = elements.filter(isTabbable); if (includeContainer && isTabbable(container)) { tabbableElements.unshift(container); } tabbableElements.forEach((element, i) => { if (isFrame(element) && element.contentDocument) { const frameBody = element.contentDocument.body; const allFrameTabbable = getAllTabbableIn( frameBody, false, fallbackToFocusable ); tabbableElements.splice(i, 1, ...allFrameTabbable); } }); if (!tabbableElements.length && fallbackToFocusable) { return elements; } return tabbableElements; } function getAllTabbable(fallbackToFocusable) { return getAllTabbableIn(document.body, false, fallbackToFocusable); } function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) { const [first] = getAllTabbableIn( container, includeContainer, fallbackToFocusable ); return first || null; } function getFirstTabbable(fallbackToFocusable) { return getFirstTabbableIn(document.body, false, fallbackToFocusable); } function getLastTabbableIn(container, includeContainer, fallbackToFocusable) { const allTabbable = getAllTabbableIn( container, includeContainer, fallbackToFocusable ); return allTabbable[allTabbable.length - 1] || null; } function getLastTabbable(fallbackToFocusable) { return getLastTabbableIn(document.body, false, fallbackToFocusable); } function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) { const activeElement = getActiveElement(container); const allFocusable = getAllFocusableIn(container, includeContainer); const activeIndex = allFocusable.indexOf(activeElement); const nextFocusableElements = allFocusable.slice(activeIndex + 1); return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null; } function getNextTabbable(fallbackToFirst, fallbackToFocusable) { return getNextTabbableIn( document.body, false, fallbackToFirst, fallbackToFocusable ); } function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) { const activeElement = getActiveElement(container); const allFocusable = getAllFocusableIn(container, includeContainer).reverse(); const activeIndex = allFocusable.indexOf(activeElement); const previousFocusableElements = allFocusable.slice(activeIndex + 1); return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null; } function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) { return getPreviousTabbableIn( document.body, false, fallbackToFirst, fallbackToFocusable ); } function getClosestFocusable(element) { while (element && !isFocusable(element)) { element = element.closest(selector); } return element || null; } function hasFocus(element) { const activeElement = DTR5TSDJ_getActiveElement(element); if (!activeElement) return false; if (activeElement === element) return true; const activeDescendant = activeElement.getAttribute("aria-activedescendant"); if (!activeDescendant) return false; return activeDescendant === element.id; } function hasFocusWithin(element) { const activeElement = DTR5TSDJ_getActiveElement(element); if (!activeElement) return false; if (contains(element, activeElement)) return true; const activeDescendant = activeElement.getAttribute("aria-activedescendant"); if (!activeDescendant) return false; if (!("id" in element)) return false; if (activeDescendant === element.id) return true; return !!element.querySelector(`#${CSS.escape(activeDescendant)}`); } function focusIfNeeded(element) { if (!hasFocusWithin(element) && isFocusable(element)) { element.focus(); } } function disableFocus(element) { var _a; const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : ""; element.setAttribute("data-tabindex", currentTabindex); element.setAttribute("tabindex", "-1"); } function disableFocusIn(container, includeContainer) { const tabbableElements = getAllTabbableIn(container, includeContainer); for (const element of tabbableElements) { disableFocus(element); } } function restoreFocusIn(container) { const elements = container.querySelectorAll("[data-tabindex]"); const restoreTabIndex = (element) => { const tabindex = element.getAttribute("data-tabindex"); element.removeAttribute("data-tabindex"); if (tabindex) { element.setAttribute("tabindex", tabindex); } else { element.removeAttribute("tabindex"); } }; if (container.hasAttribute("data-tabindex")) { restoreTabIndex(container); } for (const element of elements) { restoreTabIndex(element); } } function focusIntoView(element, options) { if (!("scrollIntoView" in element)) { element.focus(); } else { element.focus({ preventScroll: true }); element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options)); } } ;// ./node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js "use client"; // src/focusable/focusable.tsx var LVA2YJMS_TagName = "div"; var isSafariBrowser = isSafari(); var alwaysFocusVisibleInputTypes = [ "text", "search", "url", "tel", "email", "password", "number", "date", "month", "week", "time", "datetime", "datetime-local" ]; var safariFocusAncestorSymbol = Symbol("safariFocusAncestor"); function isSafariFocusAncestor(element) { if (!element) return false; return !!element[safariFocusAncestorSymbol]; } function markSafariFocusAncestor(element, value) { if (!element) return; element[safariFocusAncestorSymbol] = value; } function isAlwaysFocusVisible(element) { const { tagName, readOnly, type } = element; if (tagName === "TEXTAREA" && !readOnly) return true; if (tagName === "SELECT" && !readOnly) return true; if (tagName === "INPUT" && !readOnly) { return alwaysFocusVisibleInputTypes.includes(type); } if (element.isContentEditable) return true; const role = element.getAttribute("role"); if (role === "combobox" && element.dataset.name) { return true; } return false; } function getLabels(element) { if ("labels" in element) { return element.labels; } return null; } function isNativeCheckboxOrRadio(element) { const tagName = element.tagName.toLowerCase(); if (tagName === "input" && element.type) { return element.type === "radio" || element.type === "checkbox"; } return false; } function isNativeTabbable(tagName) { if (!tagName) return true; return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; } function supportsDisabledAttribute(tagName) { if (!tagName) return true; return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; } function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { if (!focusable) { return tabIndexProp; } if (trulyDisabled) { if (nativeTabbable && !supportsDisabled) { return -1; } return; } if (nativeTabbable) { return tabIndexProp; } return tabIndexProp || 0; } function useDisableEvent(onEvent, disabled) { return useEvent((event) => { onEvent == null ? void 0 : onEvent(event); if (event.defaultPrevented) return; if (disabled) { event.stopPropagation(); event.preventDefault(); } }); } var isKeyboardModality = true; function onGlobalMouseDown(event) { const target = event.target; if (target && "hasAttribute" in target) { if (!target.hasAttribute("data-focus-visible")) { isKeyboardModality = false; } } } function onGlobalKeyDown(event) { if (event.metaKey) return; if (event.ctrlKey) return; if (event.altKey) return; isKeyboardModality = true; } var useFocusable = createHook( function useFocusable2(_a) { var _b = _a, { focusable = true, accessibleWhenDisabled, autoFocus, onFocusVisible } = _b, props = __objRest(_b, [ "focusable", "accessibleWhenDisabled", "autoFocus", "onFocusVisible" ]); const ref = (0,external_React_.useRef)(null); (0,external_React_.useEffect)(() => { if (!focusable) return; addGlobalEventListener("mousedown", onGlobalMouseDown, true); addGlobalEventListener("keydown", onGlobalKeyDown, true); }, [focusable]); if (isSafariBrowser) { (0,external_React_.useEffect)(() => { if (!focusable) return; const element = ref.current; if (!element) return; if (!isNativeCheckboxOrRadio(element)) return; const labels = getLabels(element); if (!labels) return; const onMouseUp = () => queueMicrotask(() => element.focus()); for (const label of labels) { label.addEventListener("mouseup", onMouseUp); } return () => { for (const label of labels) { label.removeEventListener("mouseup", onMouseUp); } }; }, [focusable]); } const disabled = focusable && disabledFromProps(props); const trulyDisabled = !!disabled && !accessibleWhenDisabled; const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false); (0,external_React_.useEffect)(() => { if (!focusable) return; if (trulyDisabled && focusVisible) { setFocusVisible(false); } }, [focusable, trulyDisabled, focusVisible]); (0,external_React_.useEffect)(() => { if (!focusable) return; if (!focusVisible) return; const element = ref.current; if (!element) return; if (typeof IntersectionObserver === "undefined") return; const observer = new IntersectionObserver(() => { if (!isFocusable(element)) { setFocusVisible(false); } }); observer.observe(element); return () => observer.disconnect(); }, [focusable, focusVisible]); const onKeyPressCapture = useDisableEvent( props.onKeyPressCapture, disabled ); const onMouseDownCapture = useDisableEvent( props.onMouseDownCapture, disabled ); const onClickCapture = useDisableEvent(props.onClickCapture, disabled); const onMouseDownProp = props.onMouseDown; const onMouseDown = useEvent((event) => { onMouseDownProp == null ? void 0 : onMouseDownProp(event); if (event.defaultPrevented) return; if (!focusable) return; const element = event.currentTarget; if (!isSafariBrowser) return; if (isPortalEvent(event)) return; if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; let receivedFocus = false; const onFocus = () => { receivedFocus = true; }; const options = { capture: true, once: true }; element.addEventListener("focusin", onFocus, options); const focusableContainer = getClosestFocusable(element.parentElement); markSafariFocusAncestor(focusableContainer, true); queueBeforeEvent(element, "mouseup", () => { element.removeEventListener("focusin", onFocus, true); markSafariFocusAncestor(focusableContainer, false); if (receivedFocus) return; focusIfNeeded(element); }); }); const handleFocusVisible = (event, currentTarget) => { if (currentTarget) { event.currentTarget = currentTarget; } if (!focusable) return; const element = event.currentTarget; if (!element) return; if (!hasFocus(element)) return; onFocusVisible == null ? void 0 : onFocusVisible(event); if (event.defaultPrevented) return; element.dataset.focusVisible = "true"; setFocusVisible(true); }; const onKeyDownCaptureProp = props.onKeyDownCapture; const onKeyDownCapture = useEvent((event) => { onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); if (event.defaultPrevented) return; if (!focusable) return; if (focusVisible) return; if (event.metaKey) return; if (event.altKey) return; if (event.ctrlKey) return; if (!isSelfTarget(event)) return; const element = event.currentTarget; const applyFocusVisible = () => handleFocusVisible(event, element); queueBeforeEvent(element, "focusout", applyFocusVisible); }); const onFocusCaptureProp = props.onFocusCapture; const onFocusCapture = useEvent((event) => { onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); if (event.defaultPrevented) return; if (!focusable) return; if (!isSelfTarget(event)) { setFocusVisible(false); return; } const element = event.currentTarget; const applyFocusVisible = () => handleFocusVisible(event, element); if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { queueBeforeEvent(event.target, "focusout", applyFocusVisible); } else { setFocusVisible(false); } }); const onBlurProp = props.onBlur; const onBlur = useEvent((event) => { onBlurProp == null ? void 0 : onBlurProp(event); if (!focusable) return; if (!isFocusEventOutside(event)) return; setFocusVisible(false); }); const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext); const autoFocusRef = useEvent((element) => { if (!focusable) return; if (!autoFocus) return; if (!element) return; if (!autoFocusOnShow) return; queueMicrotask(() => { if (hasFocus(element)) return; if (!isFocusable(element)) return; element.focus(); }); }); const tagName = useTagName(ref); const nativeTabbable = focusable && isNativeTabbable(tagName); const supportsDisabled = focusable && supportsDisabledAttribute(tagName); const styleProp = props.style; const style = (0,external_React_.useMemo)(() => { if (trulyDisabled) { return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp); } return styleProp; }, [trulyDisabled, styleProp]); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ "data-focus-visible": focusable && focusVisible || void 0, "data-autofocus": autoFocus || void 0, "aria-disabled": disabled || void 0 }, props), { ref: useMergeRefs(ref, autoFocusRef, props.ref), style, tabIndex: getTabIndex( focusable, trulyDisabled, nativeTabbable, supportsDisabled, props.tabIndex ), disabled: supportsDisabled && trulyDisabled ? true : void 0, // TODO: Test Focusable contentEditable. contentEditable: disabled ? void 0 : props.contentEditable, onKeyPressCapture, onClickCapture, onMouseDownCapture, onMouseDown, onKeyDownCapture, onFocusCapture, onBlur }); return removeUndefinedValues(props); } ); var Focusable = forwardRef2(function Focusable2(props) { const htmlProps = useFocusable(props); return createElement(LVA2YJMS_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/ITI7HKP4.js "use client"; // src/composite/composite.tsx var ITI7HKP4_TagName = "div"; function isGrid(items) { return items.some((item) => !!item.rowId); } function isPrintableKey(event) { const target = event.target; if (target && !isTextField(target)) return false; return event.key.length === 1 && !event.ctrlKey && !event.metaKey; } function isModifierKey(event) { return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; } function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) { return useEvent((event) => { var _a; onKeyboardEvent == null ? void 0 : onKeyboardEvent(event); if (event.defaultPrevented) return; if (event.isPropagationStopped()) return; if (!isSelfTarget(event)) return; if (isModifierKey(event)) return; if (isPrintableKey(event)) return; const state = store.getState(); const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element; if (!activeElement) return; const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]); const previousElement = previousElementRef == null ? void 0 : previousElementRef.current; if (activeElement !== previousElement) { activeElement.focus(); } if (!fireKeyboardEvent(activeElement, event.type, eventInit)) { event.preventDefault(); } if (event.currentTarget.contains(activeElement)) { event.stopPropagation(); } }); } function findFirstEnabledItemInTheLastRow(items) { return _5VQZOHHZ_findFirstEnabledItem( flatten2DArray(reverseArray(_5VQZOHHZ_groupItemsByRows(items))) ); } function useScheduleFocus(store) { const [scheduled, setScheduled] = (0,external_React_.useState)(false); const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []); const activeItem = store.useState( (state) => getEnabledItem(store, state.activeId) ); (0,external_React_.useEffect)(() => { const activeElement = activeItem == null ? void 0 : activeItem.element; if (!scheduled) return; if (!activeElement) return; setScheduled(false); activeElement.focus({ preventScroll: true }); }, [activeItem, scheduled]); return schedule; } var useComposite = createHook( function useComposite2(_a) { var _b = _a, { store, composite = true, focusOnMove = composite, moveOnKeyPress = true } = _b, props = __objRest(_b, [ "store", "composite", "focusOnMove", "moveOnKeyPress" ]); const context = useCompositeProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const previousElementRef = (0,external_React_.useRef)(null); const scheduleFocus = useScheduleFocus(store); const moves = store.useState("moves"); const [, setBaseElement] = useTransactionState( composite ? store.setBaseElement : null ); (0,external_React_.useEffect)(() => { var _a2; if (!store) return; if (!moves) return; if (!composite) return; if (!focusOnMove) return; const { activeId: activeId2 } = store.getState(); const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; if (!itemElement) return; focusIntoView(itemElement); }, [store, moves, composite, focusOnMove]); useSafeLayoutEffect(() => { if (!store) return; if (!moves) return; if (!composite) return; const { baseElement, activeId: activeId2 } = store.getState(); const isSelfAcive = activeId2 === null; if (!isSelfAcive) return; if (!baseElement) return; const previousElement = previousElementRef.current; previousElementRef.current = null; if (previousElement) { fireBlurEvent(previousElement, { relatedTarget: baseElement }); } if (!hasFocus(baseElement)) { baseElement.focus(); } }, [store, moves, composite]); const activeId = store.useState("activeId"); const virtualFocus = store.useState("virtualFocus"); useSafeLayoutEffect(() => { var _a2; if (!store) return; if (!composite) return; if (!virtualFocus) return; const previousElement = previousElementRef.current; previousElementRef.current = null; if (!previousElement) return; const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element; const relatedTarget = activeElement || DTR5TSDJ_getActiveElement(previousElement); if (relatedTarget === previousElement) return; fireBlurEvent(previousElement, { relatedTarget }); }, [store, activeId, virtualFocus, composite]); const onKeyDownCapture = useKeyboardEventProxy( store, props.onKeyDownCapture, previousElementRef ); const onKeyUpCapture = useKeyboardEventProxy( store, props.onKeyUpCapture, previousElementRef ); const onFocusCaptureProp = props.onFocusCapture; const onFocusCapture = useEvent((event) => { onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); if (event.defaultPrevented) return; if (!store) return; const { virtualFocus: virtualFocus2 } = store.getState(); if (!virtualFocus2) return; const previousActiveElement = event.relatedTarget; const isSilentlyFocused = silentlyFocused(event.currentTarget); if (isSelfTarget(event) && isSilentlyFocused) { event.stopPropagation(); previousElementRef.current = previousActiveElement; } }); const onFocusProp = props.onFocus; const onFocus = useEvent((event) => { onFocusProp == null ? void 0 : onFocusProp(event); if (event.defaultPrevented) return; if (!composite) return; if (!store) return; const { relatedTarget } = event; const { virtualFocus: virtualFocus2 } = store.getState(); if (virtualFocus2) { if (isSelfTarget(event) && !isItem(store, relatedTarget)) { queueMicrotask(scheduleFocus); } } else if (isSelfTarget(event)) { store.setActiveId(null); } }); const onBlurCaptureProp = props.onBlurCapture; const onBlurCapture = useEvent((event) => { var _a2; onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); if (event.defaultPrevented) return; if (!store) return; const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState(); if (!virtualFocus2) return; const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; const nextActiveElement = event.relatedTarget; const nextActiveElementIsItem = isItem(store, nextActiveElement); const previousElement = previousElementRef.current; previousElementRef.current = null; if (isSelfTarget(event) && nextActiveElementIsItem) { if (nextActiveElement === activeElement) { if (previousElement && previousElement !== nextActiveElement) { fireBlurEvent(previousElement, event); } } else if (activeElement) { fireBlurEvent(activeElement, event); } else if (previousElement) { fireBlurEvent(previousElement, event); } event.stopPropagation(); } else { const targetIsItem = isItem(store, event.target); if (!targetIsItem && activeElement) { fireBlurEvent(activeElement, event); } } }); const onKeyDownProp = props.onKeyDown; const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); const onKeyDown = useEvent((event) => { var _a2; onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (event.defaultPrevented) return; if (!store) return; if (!isSelfTarget(event)) return; const { orientation, renderedItems, activeId: activeId2 } = store.getState(); const activeItem = getEnabledItem(store, activeId2); if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return; const isVertical = orientation !== "horizontal"; const isHorizontal = orientation !== "vertical"; const grid = isGrid(renderedItems); const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End"; if (isHorizontalKey && isTextField(event.currentTarget)) return; const up = () => { if (grid) { const item = findFirstEnabledItemInTheLastRow(renderedItems); return item == null ? void 0 : item.id; } return store == null ? void 0 : store.last(); }; const keyMap = { ArrowUp: (grid || isVertical) && up, ArrowRight: (grid || isHorizontal) && store.first, ArrowDown: (grid || isVertical) && store.first, ArrowLeft: (grid || isHorizontal) && store.last, Home: store.first, End: store.last, PageUp: store.first, PageDown: store.last }; const action = keyMap[event.key]; if (action) { const id = action(); if (id !== void 0) { if (!moveOnKeyPressProp(event)) return; event.preventDefault(); store.move(id); } } }); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }), [store] ); const activeDescendant = store.useState((state) => { var _a2; if (!store) return; if (!composite) return; if (!state.virtualFocus) return; return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id; }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ "aria-activedescendant": activeDescendant }, props), { ref: useMergeRefs(ref, setBaseElement, props.ref), onKeyDownCapture, onKeyUpCapture, onFocusCapture, onFocus, onBlurCapture, onKeyDown }); const focusable = store.useState( (state) => composite && (state.virtualFocus || state.activeId === null) ); props = useFocusable(_3YLGPPWQ_spreadValues({ focusable }, props)); return props; } ); var Composite = forwardRef2(function Composite2(props) { const htmlProps = useComposite(props); return createElement(ITI7HKP4_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox.js "use client"; // src/combobox/combobox.tsx var combobox_TagName = "input"; function isFirstItemAutoSelected(items, activeValue, autoSelect) { if (!autoSelect) return false; const firstItem = items.find((item) => !item.disabled && item.value); return (firstItem == null ? void 0 : firstItem.value) === activeValue; } function hasCompletionString(value, activeValue) { if (!activeValue) return false; if (value == null) return false; value = PBFD2E7P_normalizeString(value); return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0; } function isInputEvent(event) { return event.type === "input"; } function isAriaAutoCompleteValue(value) { return value === "inline" || value === "list" || value === "both" || value === "none"; } function getDefaultAutoSelectId(items) { const item = items.find((item2) => { var _a; if (item2.disabled) return false; return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab"; }); return item == null ? void 0 : item.id; } var useCombobox = createHook( function useCombobox2(_a) { var _b = _a, { store, focusable = true, autoSelect: autoSelectProp = false, getAutoSelectId, setValueOnChange, showMinLength = 0, showOnChange, showOnMouseDown, showOnClick = showOnMouseDown, showOnKeyDown, showOnKeyPress = showOnKeyDown, blurActiveItemOnClick, setValueOnClick = true, moveOnKeyPress = true, autoComplete = "list" } = _b, props = __objRest(_b, [ "store", "focusable", "autoSelect", "getAutoSelectId", "setValueOnChange", "showMinLength", "showOnChange", "showOnMouseDown", "showOnClick", "showOnKeyDown", "showOnKeyPress", "blurActiveItemOnClick", "setValueOnClick", "moveOnKeyPress", "autoComplete" ]); const context = useComboboxProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const [valueUpdated, forceValueUpdate] = useForceUpdate(); const canAutoSelectRef = (0,external_React_.useRef)(false); const composingRef = (0,external_React_.useRef)(false); const autoSelect = store.useState( (state) => state.virtualFocus && autoSelectProp ); const inline = autoComplete === "inline" || autoComplete === "both"; const [canInline, setCanInline] = (0,external_React_.useState)(inline); useUpdateLayoutEffect(() => { if (!inline) return; setCanInline(true); }, [inline]); const storeValue = store.useState("value"); const prevSelectedValueRef = (0,external_React_.useRef)(); (0,external_React_.useEffect)(() => { return sync(store, ["selectedValue", "activeId"], (_, prev) => { prevSelectedValueRef.current = prev.selectedValue; }); }, []); const inlineActiveValue = store.useState((state) => { var _a2; if (!inline) return; if (!canInline) return; if (state.activeValue && Array.isArray(state.selectedValue)) { if (state.selectedValue.includes(state.activeValue)) return; if ((_a2 = prevSelectedValueRef.current) == null ? void 0 : _a2.includes(state.activeValue)) return; } return state.activeValue; }); const items = store.useState("renderedItems"); const open = store.useState("open"); const contentElement = store.useState("contentElement"); const value = (0,external_React_.useMemo)(() => { if (!inline) return storeValue; if (!canInline) return storeValue; const firstItemAutoSelected = isFirstItemAutoSelected( items, inlineActiveValue, autoSelect ); if (firstItemAutoSelected) { if (hasCompletionString(storeValue, inlineActiveValue)) { const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || ""; return storeValue + slice; } return storeValue; } return inlineActiveValue || storeValue; }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]); (0,external_React_.useEffect)(() => { const element = ref.current; if (!element) return; const onCompositeItemMove = () => setCanInline(true); element.addEventListener("combobox-item-move", onCompositeItemMove); return () => { element.removeEventListener("combobox-item-move", onCompositeItemMove); }; }, []); (0,external_React_.useEffect)(() => { if (!inline) return; if (!canInline) return; if (!inlineActiveValue) return; const firstItemAutoSelected = isFirstItemAutoSelected( items, inlineActiveValue, autoSelect ); if (!firstItemAutoSelected) return; if (!hasCompletionString(storeValue, inlineActiveValue)) return; let cleanup = PBFD2E7P_noop; queueMicrotask(() => { const element = ref.current; if (!element) return; const { start: prevStart, end: prevEnd } = getTextboxSelection(element); const nextStart = storeValue.length; const nextEnd = inlineActiveValue.length; setSelectionRange(element, nextStart, nextEnd); cleanup = () => { if (!hasFocus(element)) return; const { start, end } = getTextboxSelection(element); if (start !== nextStart) return; if (end !== nextEnd) return; setSelectionRange(element, prevStart, prevEnd); }; }); return () => cleanup(); }, [ valueUpdated, inline, canInline, inlineActiveValue, items, autoSelect, storeValue ]); const scrollingElementRef = (0,external_React_.useRef)(null); const getAutoSelectIdProp = useEvent(getAutoSelectId); const autoSelectIdRef = (0,external_React_.useRef)(null); (0,external_React_.useEffect)(() => { if (!open) return; if (!contentElement) return; const scrollingElement = getScrollingElement(contentElement); if (!scrollingElement) return; scrollingElementRef.current = scrollingElement; const onUserScroll = () => { canAutoSelectRef.current = false; }; const onScroll = () => { if (!store) return; if (!canAutoSelectRef.current) return; const { activeId } = store.getState(); if (activeId === null) return; if (activeId === autoSelectIdRef.current) return; canAutoSelectRef.current = false; }; const options = { passive: true, capture: true }; scrollingElement.addEventListener("wheel", onUserScroll, options); scrollingElement.addEventListener("touchmove", onUserScroll, options); scrollingElement.addEventListener("scroll", onScroll, options); return () => { scrollingElement.removeEventListener("wheel", onUserScroll, true); scrollingElement.removeEventListener("touchmove", onUserScroll, true); scrollingElement.removeEventListener("scroll", onScroll, true); }; }, [open, contentElement, store]); useSafeLayoutEffect(() => { if (!storeValue) return; if (composingRef.current) return; canAutoSelectRef.current = true; }, [storeValue]); useSafeLayoutEffect(() => { if (autoSelect !== "always" && open) return; canAutoSelectRef.current = open; }, [autoSelect, open]); const resetValueOnSelect = store.useState("resetValueOnSelect"); useUpdateEffect(() => { var _a2, _b2; const canAutoSelect = canAutoSelectRef.current; if (!store) return; if (!open) return; if (!canAutoSelect && !resetValueOnSelect) return; const { baseElement, contentElement: contentElement2, activeId } = store.getState(); if (baseElement && !hasFocus(baseElement)) return; if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) { const observer = new MutationObserver(forceValueUpdate); observer.observe(contentElement2, { attributeFilter: ["data-placing"] }); return () => observer.disconnect(); } if (autoSelect && canAutoSelect) { const userAutoSelectId = getAutoSelectIdProp(items); const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a2 = getDefaultAutoSelectId(items)) != null ? _a2 : store.first(); autoSelectIdRef.current = autoSelectId; store.move(autoSelectId != null ? autoSelectId : null); } else { const element = (_b2 = store.item(activeId || store.first())) == null ? void 0 : _b2.element; if (element && "scrollIntoView" in element) { element.scrollIntoView({ block: "nearest", inline: "nearest" }); } } return; }, [ store, open, valueUpdated, storeValue, autoSelect, resetValueOnSelect, getAutoSelectIdProp, items ]); (0,external_React_.useEffect)(() => { if (!inline) return; const combobox = ref.current; if (!combobox) return; const elements = [combobox, contentElement].filter( (value2) => !!value2 ); const onBlur2 = (event) => { if (elements.every((el) => isFocusEventOutside(event, el))) { store == null ? void 0 : store.setValue(value); } }; for (const element of elements) { element.addEventListener("focusout", onBlur2); } return () => { for (const element of elements) { element.removeEventListener("focusout", onBlur2); } }; }, [inline, contentElement, store, value]); const canShow = (event) => { const currentTarget = event.currentTarget; return currentTarget.value.length >= showMinLength; }; const onChangeProp = props.onChange; const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow); const setValueOnChangeProp = useBooleanEvent( // If the combobox is combined with tags, the value will be set by the tag // input component. setValueOnChange != null ? setValueOnChange : !store.tag ); const onChange = useEvent((event) => { onChangeProp == null ? void 0 : onChangeProp(event); if (event.defaultPrevented) return; if (!store) return; const currentTarget = event.currentTarget; const { value: value2, selectionStart, selectionEnd } = currentTarget; const nativeEvent = event.nativeEvent; canAutoSelectRef.current = true; if (isInputEvent(nativeEvent)) { if (nativeEvent.isComposing) { canAutoSelectRef.current = false; composingRef.current = true; } if (inline) { const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; const caretAtEnd = selectionStart === value2.length; setCanInline(textInserted && caretAtEnd); } } if (setValueOnChangeProp(event)) { const isSameValue = value2 === store.getState().value; store.setValue(value2); queueMicrotask(() => { setSelectionRange(currentTarget, selectionStart, selectionEnd); }); if (inline && autoSelect && isSameValue) { forceValueUpdate(); } } if (showOnChangeProp(event)) { store.show(); } if (!autoSelect || !canAutoSelectRef.current) { store.setActiveId(null); } }); const onCompositionEndProp = props.onCompositionEnd; const onCompositionEnd = useEvent((event) => { canAutoSelectRef.current = true; composingRef.current = false; onCompositionEndProp == null ? void 0 : onCompositionEndProp(event); if (event.defaultPrevented) return; if (!autoSelect) return; forceValueUpdate(); }); const onMouseDownProp = props.onMouseDown; const blurActiveItemOnClickProp = useBooleanEvent( blurActiveItemOnClick != null ? blurActiveItemOnClick : () => !!(store == null ? void 0 : store.getState().includesBaseElement) ); const setValueOnClickProp = useBooleanEvent(setValueOnClick); const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow); const onMouseDown = useEvent((event) => { onMouseDownProp == null ? void 0 : onMouseDownProp(event); if (event.defaultPrevented) return; if (event.button) return; if (event.ctrlKey) return; if (!store) return; if (blurActiveItemOnClickProp(event)) { store.setActiveId(null); } if (setValueOnClickProp(event)) { store.setValue(value); } if (showOnClickProp(event)) { queueBeforeEvent(event.currentTarget, "mouseup", store.show); } }); const onKeyDownProp = props.onKeyDown; const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow); const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (!event.repeat) { canAutoSelectRef.current = false; } if (event.defaultPrevented) return; if (event.ctrlKey) return; if (event.altKey) return; if (event.shiftKey) return; if (event.metaKey) return; if (!store) return; const { open: open2 } = store.getState(); if (open2) return; if (event.key === "ArrowUp" || event.key === "ArrowDown") { if (showOnKeyPressProp(event)) { event.preventDefault(); store.show(); } } }); const onBlurProp = props.onBlur; const onBlur = useEvent((event) => { canAutoSelectRef.current = false; onBlurProp == null ? void 0 : onBlurProp(event); if (event.defaultPrevented) return; }); const id = useId(props.id); const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; const isActiveItem = store.useState((state) => state.activeId === null); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, role: "combobox", "aria-autocomplete": ariaAutoComplete, "aria-haspopup": getPopupRole(contentElement, "listbox"), "aria-expanded": open, "aria-controls": contentElement == null ? void 0 : contentElement.id, "data-active-item": isActiveItem || void 0, value }, props), { ref: useMergeRefs(ref, props.ref), onChange, onCompositionEnd, onMouseDown, onKeyDown, onBlur }); props = useComposite(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store, focusable }, props), { // Enable inline autocomplete when the user moves from the combobox input // to an item. moveOnKeyPress: (event) => { if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; if (inline) setCanInline(true); return true; } })); props = usePopoverAnchor(_3YLGPPWQ_spreadValues({ store }, props)); return _3YLGPPWQ_spreadValues({ autoComplete: "off" }, props); } ); var Combobox = forwardRef2(function Combobox2(props) { const htmlProps = useCombobox(props); return createElement(combobox_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/VGCJ63VH.js "use client"; // src/disclosure/disclosure-content.tsx var VGCJ63VH_TagName = "div"; function afterTimeout(timeoutMs, cb) { const timeoutId = setTimeout(cb, timeoutMs); return () => clearTimeout(timeoutId); } function VGCJ63VH_afterPaint(cb) { let raf = requestAnimationFrame(() => { raf = requestAnimationFrame(cb); }); return () => cancelAnimationFrame(raf); } function parseCSSTime(...times) { return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => { const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3; const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier; if (currentTime > longestTime) return currentTime; return longestTime; }, 0); } function isHidden(mounted, hidden, alwaysVisible) { return !alwaysVisible && hidden !== false && (!mounted || !!hidden); } var useDisclosureContent = createHook(function useDisclosureContent2(_a) { var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); const context = useDisclosureProviderContext(); store = store || context; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const id = useId(props.id); const [transition, setTransition] = (0,external_React_.useState)(null); const open = store.useState("open"); const mounted = store.useState("mounted"); const animated = store.useState("animated"); const contentElement = store.useState("contentElement"); const otherElement = useStoreState(store.disclosure, "contentElement"); useSafeLayoutEffect(() => { if (!ref.current) return; store == null ? void 0 : store.setContentElement(ref.current); }, [store]); useSafeLayoutEffect(() => { let previousAnimated; store == null ? void 0 : store.setState("animated", (animated2) => { previousAnimated = animated2; return true; }); return () => { if (previousAnimated === void 0) return; store == null ? void 0 : store.setState("animated", previousAnimated); }; }, [store]); useSafeLayoutEffect(() => { if (!animated) return; if (!(contentElement == null ? void 0 : contentElement.isConnected)) { setTransition(null); return; } return VGCJ63VH_afterPaint(() => { setTransition(open ? "enter" : mounted ? "leave" : null); }); }, [animated, contentElement, open, mounted]); useSafeLayoutEffect(() => { if (!store) return; if (!animated) return; if (!transition) return; if (!contentElement) return; const stopAnimation = () => store == null ? void 0 : store.setState("animating", false); const stopAnimationSync = () => (0,external_ReactDOM_namespaceObject.flushSync)(stopAnimation); if (transition === "leave" && open) return; if (transition === "enter" && !open) return; if (typeof animated === "number") { const timeout2 = animated; return afterTimeout(timeout2, stopAnimationSync); } const { transitionDuration, animationDuration, transitionDelay, animationDelay } = getComputedStyle(contentElement); const { transitionDuration: transitionDuration2 = "0", animationDuration: animationDuration2 = "0", transitionDelay: transitionDelay2 = "0", animationDelay: animationDelay2 = "0" } = otherElement ? getComputedStyle(otherElement) : {}; const delay = parseCSSTime( transitionDelay, animationDelay, transitionDelay2, animationDelay2 ); const duration = parseCSSTime( transitionDuration, animationDuration, transitionDuration2, animationDuration2 ); const timeout = delay + duration; if (!timeout) { if (transition === "enter") { store.setState("animated", false); } stopAnimation(); return; } const frameRate = 1e3 / 60; const maxTimeout = Math.max(timeout - frameRate, 0); return afterTimeout(maxTimeout, stopAnimationSync); }, [store, animated, contentElement, otherElement, open, transition]); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }), [store] ); const hidden = isHidden(mounted, props.hidden, alwaysVisible); const styleProp = props.style; const style = (0,external_React_.useMemo)(() => { if (hidden) { return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, styleProp), { display: "none" }); } return styleProp; }, [hidden, styleProp]); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, "data-open": open || void 0, "data-enter": transition === "enter" || void 0, "data-leave": transition === "leave" || void 0, hidden }, props), { ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref), style }); return removeUndefinedValues(props); }); var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) { const htmlProps = useDisclosureContent(props); return createElement(VGCJ63VH_TagName, htmlProps); }); var DisclosureContent = forwardRef2(function DisclosureContent2(_a) { var _b = _a, { unmountOnHide } = _b, props = __objRest(_b, [ "unmountOnHide" ]); const context = useDisclosureProviderContext(); const store = props.store || context; const mounted = useStoreState( store, (state) => !unmountOnHide || (state == null ? void 0 : state.mounted) ); if (mounted === false) return null; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _3YLGPPWQ_spreadValues({}, props)); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/HUWAI7RB.js "use client"; // src/combobox/combobox-list.tsx var HUWAI7RB_TagName = "div"; var useComboboxList = createHook( function useComboboxList2(_a) { var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); const scopedContext = useComboboxScopedContext(true); const context = useComboboxContext(); store = store || context; const scopedContextSameStore = !!store && store === scopedContext; invariant( store, false && 0 ); const ref = (0,external_React_.useRef)(null); const id = useId(props.id); const mounted = store.useState("mounted"); const hidden = isHidden(mounted, props.hidden, alwaysVisible); const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style; const multiSelectable = store.useState( (state) => Array.isArray(state.selectedValue) ); const role = useAttribute(ref, "role", props.role); const isCompositeRole = role === "listbox" || role === "tree" || role === "grid"; const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0; const [hasListboxInside, setHasListboxInside] = (0,external_React_.useState)(false); const contentElement = store.useState("contentElement"); useSafeLayoutEffect(() => { if (!mounted) return; const element = ref.current; if (!element) return; if (contentElement !== element) return; const callback = () => { setHasListboxInside(!!element.querySelector("[role='listbox']")); }; const observer = new MutationObserver(callback); observer.observe(element, { subtree: true, childList: true, attributeFilter: ["role"] }); callback(); return () => observer.disconnect(); }, [mounted, contentElement]); if (!hasListboxInside) { props = _3YLGPPWQ_spreadValues({ role: "listbox", "aria-multiselectable": ariaMultiSelectable }, props); } props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }), [store, role] ); const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null; props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, hidden }, props), { ref: useMergeRefs(setContentElement, ref, props.ref), style }); return removeUndefinedValues(props); } ); var ComboboxList = forwardRef2(function ComboboxList2(props) { const htmlProps = useComboboxList(props); return createElement(HUWAI7RB_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/UQQRIHDV.js "use client"; // src/composite/composite-hover.tsx var UQQRIHDV_TagName = "div"; function getMouseDestination(event) { const relatedTarget = event.relatedTarget; if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) { return relatedTarget; } return null; } function hoveringInside(event) { const nextElement = getMouseDestination(event); if (!nextElement) return false; return contains(event.currentTarget, nextElement); } var UQQRIHDV_symbol = Symbol("composite-hover"); function movingToAnotherItem(event) { let dest = getMouseDestination(event); if (!dest) return false; do { if (PBFD2E7P_hasOwnProperty(dest, UQQRIHDV_symbol) && dest[UQQRIHDV_symbol]) return true; dest = dest.parentElement; } while (dest); return false; } var useCompositeHover = createHook( function useCompositeHover2(_a) { var _b = _a, { store, focusOnHover = true, blurOnHoverEnd = !!focusOnHover } = _b, props = __objRest(_b, [ "store", "focusOnHover", "blurOnHoverEnd" ]); const context = useCompositeContext(); store = store || context; invariant( store, false && 0 ); const isMouseMoving = useIsMouseMoving(); const onMouseMoveProp = props.onMouseMove; const focusOnHoverProp = useBooleanEvent(focusOnHover); const onMouseMove = useEvent((event) => { onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); if (event.defaultPrevented) return; if (!isMouseMoving()) return; if (!focusOnHoverProp(event)) return; if (!hasFocusWithin(event.currentTarget)) { const baseElement = store == null ? void 0 : store.getState().baseElement; if (baseElement && !hasFocus(baseElement)) { baseElement.focus(); } } store == null ? void 0 : store.setActiveId(event.currentTarget.id); }); const onMouseLeaveProp = props.onMouseLeave; const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); const onMouseLeave = useEvent((event) => { var _a2; onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event); if (event.defaultPrevented) return; if (!isMouseMoving()) return; if (hoveringInside(event)) return; if (movingToAnotherItem(event)) return; if (!focusOnHoverProp(event)) return; if (!blurOnHoverEndProp(event)) return; store == null ? void 0 : store.setActiveId(null); (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus(); }); const ref = (0,external_React_.useCallback)((element) => { if (!element) return; element[UQQRIHDV_symbol] = true; }, []); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(ref, props.ref), onMouseMove, onMouseLeave }); return removeUndefinedValues(props); } ); var CompositeHover = memo2( forwardRef2(function CompositeHover2(props) { const htmlProps = useCompositeHover(props); return createElement(UQQRIHDV_TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/RZ4GPYOB.js "use client"; // src/collection/collection-item.tsx var RZ4GPYOB_TagName = "div"; var useCollectionItem = createHook( function useCollectionItem2(_a) { var _b = _a, { store, shouldRegisterItem = true, getItem = identity, element: element } = _b, props = __objRest(_b, [ "store", "shouldRegisterItem", "getItem", // @ts-expect-error This prop may come from a collection renderer. "element" ]); const context = useCollectionContext(); store = store || context; const id = useId(props.id); const ref = (0,external_React_.useRef)(element); (0,external_React_.useEffect)(() => { const element2 = ref.current; if (!id) return; if (!element2) return; if (!shouldRegisterItem) return; const item = getItem({ id, element: element2 }); return store == null ? void 0 : store.renderItem(item); }, [id, shouldRegisterItem, getItem, store]); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(ref, props.ref) }); return removeUndefinedValues(props); } ); var CollectionItem = forwardRef2(function CollectionItem2(props) { const htmlProps = useCollectionItem(props); return createElement(RZ4GPYOB_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/KUU7WJ55.js "use client"; // src/command/command.tsx var KUU7WJ55_TagName = "button"; function isNativeClick(event) { if (!event.isTrusted) return false; const element = event.currentTarget; if (event.key === "Enter") { return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; } if (event.key === " ") { return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; } return false; } var KUU7WJ55_symbol = Symbol("command"); var useCommand = createHook( function useCommand2(_a) { var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]); const ref = (0,external_React_.useRef)(null); const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)(false); (0,external_React_.useEffect)(() => { if (!ref.current) return; setIsNativeButton(isButton(ref.current)); }, []); const [active, setActive] = (0,external_React_.useState)(false); const activeRef = (0,external_React_.useRef)(false); const disabled = disabledFromProps(props); const [isDuplicate, metadataProps] = useMetadataProps(props, KUU7WJ55_symbol, true); const onKeyDownProp = props.onKeyDown; const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); const element = event.currentTarget; if (event.defaultPrevented) return; if (isDuplicate) return; if (disabled) return; if (!isSelfTarget(event)) return; if (isTextField(element)) return; if (element.isContentEditable) return; const isEnter = clickOnEnter && event.key === "Enter"; const isSpace = clickOnSpace && event.key === " "; const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; const shouldPreventSpace = event.key === " " && !clickOnSpace; if (shouldPreventEnter || shouldPreventSpace) { event.preventDefault(); return; } if (isEnter || isSpace) { const nativeClick = isNativeClick(event); if (isEnter) { if (!nativeClick) { event.preventDefault(); const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); const click = () => fireClickEvent(element, eventInit); if (isFirefox()) { queueBeforeEvent(element, "keyup", click); } else { queueMicrotask(click); } } } else if (isSpace) { activeRef.current = true; if (!nativeClick) { event.preventDefault(); setActive(true); } } } }); const onKeyUpProp = props.onKeyUp; const onKeyUp = useEvent((event) => { onKeyUpProp == null ? void 0 : onKeyUpProp(event); if (event.defaultPrevented) return; if (isDuplicate) return; if (disabled) return; if (event.metaKey) return; const isSpace = clickOnSpace && event.key === " "; if (activeRef.current && isSpace) { activeRef.current = false; if (!isNativeClick(event)) { event.preventDefault(); setActive(false); const element = event.currentTarget; const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); queueMicrotask(() => fireClickEvent(element, eventInit)); } } }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({ "data-active": active || void 0, type: isNativeButton ? "button" : void 0 }, metadataProps), props), { ref: useMergeRefs(ref, props.ref), onKeyDown, onKeyUp }); props = useFocusable(props); return props; } ); var Command = forwardRef2(function Command2(props) { const htmlProps = useCommand(props); return createElement(KUU7WJ55_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/P2CTZE2T.js "use client"; // src/composite/composite-item.tsx var P2CTZE2T_TagName = "button"; function isEditableElement(element) { if (isTextbox(element)) return true; return element.tagName === "INPUT" && !isButton(element); } function getNextPageOffset(scrollingElement, pageUp = false) { const height = scrollingElement.clientHeight; const { top } = scrollingElement.getBoundingClientRect(); const pageSize = Math.max(height * 0.875, height - 40) * 1.5; const pageOffset = pageUp ? height - pageSize + top : pageSize + top; if (scrollingElement.tagName === "HTML") { return pageOffset + scrollingElement.scrollTop; } return pageOffset; } function getItemOffset(itemElement, pageUp = false) { const { top } = itemElement.getBoundingClientRect(); if (pageUp) { return top + itemElement.clientHeight; } return top; } function findNextPageItemId(element, store, next, pageUp = false) { var _a; if (!store) return; if (!next) return; const { renderedItems } = store.getState(); const scrollingElement = getScrollingElement(element); if (!scrollingElement) return; const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); let id; let prevDifference; for (let i = 0; i < renderedItems.length; i += 1) { const previousId = id; id = next(i); if (!id) break; if (id === previousId) continue; const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element; if (!itemElement) continue; const itemOffset = getItemOffset(itemElement, pageUp); const difference = itemOffset - nextPageOffset; const absDifference = Math.abs(difference); if (pageUp && difference <= 0 || !pageUp && difference >= 0) { if (prevDifference !== void 0 && prevDifference < absDifference) { id = previousId; } break; } prevDifference = absDifference; } return id; } function targetIsAnotherItem(event, store) { if (isSelfTarget(event)) return false; return isItem(store, event.target); } var useCompositeItem = createHook( function useCompositeItem2(_a) { var _b = _a, { store, rowId: rowIdProp, preventScrollOnKeyDown = false, moveOnKeyPress = true, tabbable = false, getItem: getItemProp, "aria-setsize": ariaSetSizeProp, "aria-posinset": ariaPosInSetProp } = _b, props = __objRest(_b, [ "store", "rowId", "preventScrollOnKeyDown", "moveOnKeyPress", "tabbable", "getItem", "aria-setsize", "aria-posinset" ]); const context = useCompositeContext(); store = store || context; const id = useId(props.id); const ref = (0,external_React_.useRef)(null); const row = (0,external_React_.useContext)(CompositeRowContext); const disabled = disabledFromProps(props); const trulyDisabled = disabled && !props.accessibleWhenDisabled; const { rowId, baseElement, isActiveItem, ariaSetSize, ariaPosInSet, isTabbable } = useStoreStateObject(store, { rowId(state) { if (rowIdProp) return rowIdProp; if (!state) return; if (!(row == null ? void 0 : row.baseElement)) return; if (row.baseElement !== state.baseElement) return; return row.id; }, baseElement(state) { return (state == null ? void 0 : state.baseElement) || void 0; }, isActiveItem(state) { return !!state && state.activeId === id; }, ariaSetSize(state) { if (ariaSetSizeProp != null) return ariaSetSizeProp; if (!state) return; if (!(row == null ? void 0 : row.ariaSetSize)) return; if (row.baseElement !== state.baseElement) return; return row.ariaSetSize; }, ariaPosInSet(state) { if (ariaPosInSetProp != null) return ariaPosInSetProp; if (!state) return; if (!(row == null ? void 0 : row.ariaPosInSet)) return; if (row.baseElement !== state.baseElement) return; const itemsInRow = state.renderedItems.filter( (item) => item.rowId === rowId ); return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); }, isTabbable(state) { if (!(state == null ? void 0 : state.renderedItems.length)) return true; if (state.virtualFocus) return false; if (tabbable) return true; if (state.activeId === null) return false; const item = store == null ? void 0 : store.item(state.activeId); if (item == null ? void 0 : item.disabled) return true; if (!(item == null ? void 0 : item.element)) return true; return state.activeId === id; } }); const getItem = (0,external_React_.useCallback)( (item) => { var _a2; const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { id: id || item.id, rowId, disabled: !!trulyDisabled, children: (_a2 = item.element) == null ? void 0 : _a2.textContent }); if (getItemProp) { return getItemProp(nextItem); } return nextItem; }, [id, rowId, trulyDisabled, getItemProp] ); const onFocusProp = props.onFocus; const hasFocusedComposite = (0,external_React_.useRef)(false); const onFocus = useEvent((event) => { onFocusProp == null ? void 0 : onFocusProp(event); if (event.defaultPrevented) return; if (isPortalEvent(event)) return; if (!id) return; if (!store) return; if (targetIsAnotherItem(event, store)) return; const { virtualFocus, baseElement: baseElement2 } = store.getState(); store.setActiveId(id); if (isTextbox(event.currentTarget)) { selectTextField(event.currentTarget); } if (!virtualFocus) return; if (!isSelfTarget(event)) return; if (isEditableElement(event.currentTarget)) return; if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return; if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) { event.currentTarget.scrollIntoView({ block: "nearest", inline: "nearest" }); } hasFocusedComposite.current = true; const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget); if (fromComposite) { focusSilently(baseElement2); } else { baseElement2.focus(); } }); const onBlurCaptureProp = props.onBlurCapture; const onBlurCapture = useEvent((event) => { onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); if (event.defaultPrevented) return; const state = store == null ? void 0 : store.getState(); if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) { hasFocusedComposite.current = false; event.preventDefault(); event.stopPropagation(); } }); const onKeyDownProp = props.onKeyDown; const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (event.defaultPrevented) return; if (!isSelfTarget(event)) return; if (!store) return; const { currentTarget } = event; const state = store.getState(); const item = store.item(id); const isGrid = !!(item == null ? void 0 : item.rowId); const isVertical = state.orientation !== "horizontal"; const isHorizontal = state.orientation !== "vertical"; const canHomeEnd = () => { if (isGrid) return true; if (isHorizontal) return true; if (!state.baseElement) return true; if (!isTextField(state.baseElement)) return true; return false; }; const keyMap = { ArrowUp: (isGrid || isVertical) && store.up, ArrowRight: (isGrid || isHorizontal) && store.next, ArrowDown: (isGrid || isVertical) && store.down, ArrowLeft: (isGrid || isHorizontal) && store.previous, Home: () => { if (!canHomeEnd()) return; if (!isGrid || event.ctrlKey) { return store == null ? void 0 : store.first(); } return store == null ? void 0 : store.previous(-1); }, End: () => { if (!canHomeEnd()) return; if (!isGrid || event.ctrlKey) { return store == null ? void 0 : store.last(); } return store == null ? void 0 : store.next(-1); }, PageUp: () => { return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true); }, PageDown: () => { return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down); } }; const action = keyMap[event.key]; if (action) { if (isTextbox(currentTarget)) { const selection = getTextboxSelection(currentTarget); const isLeft = isHorizontal && event.key === "ArrowLeft"; const isRight = isHorizontal && event.key === "ArrowRight"; const isUp = isVertical && event.key === "ArrowUp"; const isDown = isVertical && event.key === "ArrowDown"; if (isRight || isDown) { const { length: valueLength } = getTextboxValue(currentTarget); if (selection.end !== valueLength) return; } else if ((isLeft || isUp) && selection.start !== 0) return; } const nextId = action(); if (preventScrollOnKeyDownProp(event) || nextId !== void 0) { if (!moveOnKeyPressProp(event)) return; event.preventDefault(); store.move(nextId); } } }); const providerValue = (0,external_React_.useMemo)( () => ({ id, baseElement }), [id, baseElement] ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }), [providerValue] ); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, "data-active-item": isActiveItem || void 0 }, props), { ref: useMergeRefs(ref, props.ref), tabIndex: isTabbable ? props.tabIndex : -1, onFocus, onBlurCapture, onKeyDown }); props = useCommand(props); props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store }, props), { getItem, shouldRegisterItem: id ? props.shouldRegisterItem : false })); return removeUndefinedValues(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { "aria-setsize": ariaSetSize, "aria-posinset": ariaPosInSet })); } ); var CompositeItem = memo2( forwardRef2(function CompositeItem2(props) { const htmlProps = useCompositeItem(props); return createElement(P2CTZE2T_TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/ZTDSJLD6.js "use client"; // src/combobox/combobox-item.tsx var ZTDSJLD6_TagName = "div"; function isSelected(storeValue, itemValue) { if (itemValue == null) return; if (storeValue == null) return false; if (Array.isArray(storeValue)) { return storeValue.includes(itemValue); } return storeValue === itemValue; } function getItemRole(popupRole) { var _a; const itemRoleByPopupRole = { menu: "menuitem", listbox: "option", tree: "treeitem" }; const key = popupRole; return (_a = itemRoleByPopupRole[key]) != null ? _a : "option"; } var useComboboxItem = createHook( function useComboboxItem2(_a) { var _b = _a, { store, value, hideOnClick, setValueOnClick, selectValueOnClick = true, resetValueOnSelect, focusOnHover = false, moveOnKeyPress = true, getItem: getItemProp } = _b, props = __objRest(_b, [ "store", "value", "hideOnClick", "setValueOnClick", "selectValueOnClick", "resetValueOnSelect", "focusOnHover", "moveOnKeyPress", "getItem" ]); var _a2; const context = useComboboxScopedContext(); store = store || context; invariant( store, false && 0 ); const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, { resetValueOnSelectState: "resetValueOnSelect", multiSelectable(state) { return Array.isArray(state.selectedValue); }, selected(state) { return isSelected(state.selectedValue, value); } }); const getItem = (0,external_React_.useCallback)( (item) => { const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { value }); if (getItemProp) { return getItemProp(nextItem); } return nextItem; }, [value, getItemProp] ); setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable; hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable; const onClickProp = props.onClick; const setValueOnClickProp = useBooleanEvent(setValueOnClick); const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); const resetValueOnSelectProp = useBooleanEvent( (_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable ); const hideOnClickProp = useBooleanEvent(hideOnClick); const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; if (isDownloading(event)) return; if (isOpeningInNewTab(event)) return; if (value != null) { if (selectValueOnClickProp(event)) { if (resetValueOnSelectProp(event)) { store == null ? void 0 : store.resetValue(); } store == null ? void 0 : store.setSelectedValue((prevValue) => { if (!Array.isArray(prevValue)) return value; if (prevValue.includes(value)) { return prevValue.filter((v) => v !== value); } return [...prevValue, value]; }); } if (setValueOnClickProp(event)) { store == null ? void 0 : store.setValue(value); } } if (hideOnClickProp(event)) { store == null ? void 0 : store.hide(); } }); const onKeyDownProp = props.onKeyDown; const onKeyDown = useEvent((event) => { onKeyDownProp == null ? void 0 : onKeyDownProp(event); if (event.defaultPrevented) return; const baseElement = store == null ? void 0 : store.getState().baseElement; if (!baseElement) return; if (hasFocus(baseElement)) return; const printable = event.key.length === 1; if (printable || event.key === "Backspace" || event.key === "Delete") { queueMicrotask(() => baseElement.focus()); if (isTextField(baseElement)) { store == null ? void 0 : store.setValue(baseElement.value); } } }); if (multiSelectable && selected != null) { props = _3YLGPPWQ_spreadValues({ "aria-selected": selected }, props); } props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }), [value, selected] ); const popupRole = (0,external_React_.useContext)(ComboboxListRoleContext); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ role: getItemRole(popupRole), children: value }, props), { onClick, onKeyDown }); const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); props = useCompositeItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ store }, props), { getItem, // Dispatch a custom event on the combobox input when moving to an item // with the keyboard so the Combobox component can enable inline // autocompletion. moveOnKeyPress: (event) => { if (!moveOnKeyPressProp(event)) return false; const moveEvent = new Event("combobox-item-move"); const baseElement = store == null ? void 0 : store.getState().baseElement; baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent); return true; } })); props = useCompositeHover(_3YLGPPWQ_spreadValues({ store, focusOnHover }, props)); return props; } ); var ComboboxItem = memo2( forwardRef2(function ComboboxItem2(props) { const htmlProps = useComboboxItem(props); return createElement(ZTDSJLD6_TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js "use client"; // src/combobox/combobox-item-value.tsx var combobox_item_value_TagName = "span"; function normalizeValue(value) { return PBFD2E7P_normalizeString(value).toLowerCase(); } function getOffsets(string, values) { const offsets = []; for (const value of values) { let pos = 0; const length = value.length; while (string.indexOf(value, pos) !== -1) { const index = string.indexOf(value, pos); if (index !== -1) { offsets.push([index, length]); } pos = index + 1; } } return offsets; } function filterOverlappingOffsets(offsets) { return offsets.filter(([offset, length], i, arr) => { return !arr.some( ([o, l], j) => j !== i && o <= offset && o + l >= offset + length ); }); } function sortOffsets(offsets) { return offsets.sort(([a], [b]) => a - b); } function splitValue(itemValue, userValue) { if (!itemValue) return itemValue; if (!userValue) return itemValue; const userValues = toArray(userValue).filter(Boolean).map(normalizeValue); const parts = []; const span = (value, autocomplete = false) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { "data-autocomplete-value": autocomplete ? "" : void 0, "data-user-value": autocomplete ? void 0 : "", children: value }, parts.length ); const offsets = sortOffsets( filterOverlappingOffsets( // Convert userValues into a set to avoid duplicates getOffsets(normalizeValue(itemValue), new Set(userValues)) ) ); if (!offsets.length) { parts.push(span(itemValue, true)); return parts; } const [firstOffset] = offsets[0]; const values = [ itemValue.slice(0, firstOffset), ...offsets.flatMap(([offset, length], i) => { var _a; const value = itemValue.slice(offset, offset + length); const nextOffset = (_a = offsets[i + 1]) == null ? void 0 : _a[0]; const nextValue = itemValue.slice(offset + length, nextOffset); return [value, nextValue]; }) ]; values.forEach((value, i) => { if (!value) return; parts.push(span(value, i % 2 === 0)); }); return parts; } var useComboboxItemValue = createHook(function useComboboxItemValue2(_a) { var _b = _a, { store, value, userValue } = _b, props = __objRest(_b, ["store", "value", "userValue"]); const context = useComboboxScopedContext(); store = store || context; const itemContext = (0,external_React_.useContext)(ComboboxItemValueContext); const itemValue = value != null ? value : itemContext; const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value); const children = (0,external_React_.useMemo)(() => { if (!itemValue) return; if (!inputValue) return itemValue; return splitValue(itemValue, inputValue); }, [itemValue, inputValue]); props = _3YLGPPWQ_spreadValues({ children }, props); return removeUndefinedValues(props); }); var ComboboxItemValue = forwardRef2(function ComboboxItemValue2(props) { const htmlProps = useComboboxItemValue(props); return createElement(combobox_item_value_TagName, htmlProps); }); ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/search-widget.js /** * External dependencies */ // eslint-disable-next-line no-restricted-imports /** * WordPress dependencies */ /** * Internal dependencies */ const radioCheck = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Circle, { cx: 12, cy: 12, r: 3 }) }); function search_widget_normalizeSearchInput(input = '') { return remove_accents_default()(input.trim().toLowerCase()); } const search_widget_EMPTY_ARRAY = []; const getCurrentValue = (filterDefinition, currentFilter) => { if (filterDefinition.singleSelection) { return currentFilter?.value; } if (Array.isArray(currentFilter?.value)) { return currentFilter.value; } if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { return [currentFilter.value]; } return search_widget_EMPTY_ARRAY; }; const getNewValue = (filterDefinition, currentFilter, value) => { if (filterDefinition.singleSelection) { return value; } if (Array.isArray(currentFilter?.value)) { return currentFilter.value.includes(value) ? currentFilter.value.filter(v => v !== value) : [...currentFilter.value, value]; } return [value]; }; function generateFilterElementCompositeItemId(prefix, filterElementValue) { return `${prefix}-${filterElementValue}`; } function ListBox({ view, filter, onChangeView }) { const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListBox, 'dataviews-filter-list-box'); const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)( // When there are one or less operators, the first item is set as active // (by setting the initial `activeId` to `undefined`). // With 2 or more operators, the focus is moved on the operators control // (by setting the initial `activeId` to `null`), meaning that there won't // be an active item initially. Focus is then managed via the // `onFocusVisible` callback. filter.operators?.length === 1 ? undefined : null); const currentFilter = view.filters?.find(f => f.field === filter.field); const currentValue = getCurrentValue(filter, currentFilter); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { virtualFocus: true, focusLoop: true, activeId: activeCompositeId, setActiveId: setActiveCompositeId, role: "listbox", className: "dataviews-filters__search-widget-listbox", "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ (0,external_wp_i18n_namespaceObject.__)('List of: %1$s'), filter.name), onFocusVisible: () => { // `onFocusVisible` needs the `Composite` component to be focusable, // which is implicitly achieved via the `virtualFocus` prop. if (!activeCompositeId && filter.elements.length) { setActiveCompositeId(generateFilterElementCompositeItemId(baseId, filter.elements[0].value)); } }, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Typeahead, {}), children: filter.elements.map(element => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Hover, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { id: generateFilterElementCompositeItemId(baseId, element.value), render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-label": element.label, role: "option", className: "dataviews-filters__search-widget-listitem" }), onClick: () => { var _view$filters, _view$filters2; const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { if (_filter.field === filter.field) { return { ..._filter, operator: currentFilter.operator || filter.operators[0], value: getNewValue(filter, currentFilter, element.value) }; } return _filter; })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { field: filter.field, operator: filter.operators[0], value: getNewValue(filter, currentFilter, element.value) }]; onChangeView({ ...view, page: 1, filters: newFilters }); } }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-filters__search-widget-listitem-check", children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: radioCheck }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: library_check })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: element.label })] }, element.value)) }); } function search_widget_ComboboxList({ view, filter, onChangeView }) { const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(''); const deferredSearchValue = (0,external_wp_element_namespaceObject.useDeferredValue)(searchValue); const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); const currentValue = getCurrentValue(filter, currentFilter); const matches = (0,external_wp_element_namespaceObject.useMemo)(() => { const normalizedSearch = search_widget_normalizeSearchInput(deferredSearchValue); return filter.elements.filter(item => search_widget_normalizeSearchInput(item.label).includes(normalizedSearch)); }, [filter.elements, deferredSearchValue]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxProvider, { selectedValue: currentValue, setSelectedValue: value => { var _view$filters3, _view$filters4; const newFilters = currentFilter ? [...((_view$filters3 = view.filters) !== null && _view$filters3 !== void 0 ? _view$filters3 : []).map(_filter => { if (_filter.field === filter.field) { return { ..._filter, operator: currentFilter.operator || filter.operators[0], value }; } return _filter; })] : [...((_view$filters4 = view.filters) !== null && _view$filters4 !== void 0 ? _view$filters4 : []), { field: filter.field, operator: filter.operators[0], value }]; onChangeView({ ...view, page: 1, filters: newFilters }); }, setValue: setSearchValue, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxLabel, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)('Search items') }), children: (0,external_wp_i18n_namespaceObject.__)('Search items') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Combobox, { autoSelect: "always", placeholder: (0,external_wp_i18n_namespaceObject.__)('Search'), className: "dataviews-filters__search-widget-filter-combobox__input" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: library_search }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxList, { className: "dataviews-filters__search-widget-filter-combobox-list", alwaysVisible: true, children: [matches.map(element => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxItem, { resetValueOnSelect: false, value: element.value, className: "dataviews-filters__search-widget-listitem", hideOnClick: false, setValueOnClick: false, focusOnHover: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-filters__search-widget-listitem-check", children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: radioCheck }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: library_check })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValue, { className: "dataviews-filters__search-widget-filter-combobox-item-value", value: element.label }), !!element.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description })] })] }, element.value); }), !matches.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('No results found') })] })] }); } function SearchWidget(props) { const Widget = props.filter.elements.length > 10 ? search_widget_ComboboxList : ListBox; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Widget, { ...props }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filter-summary.js /** * External dependencies */ /** * WordPress dependencies */ const ENTER = 'Enter'; const SPACE = ' '; /** * Internal dependencies */ const FilterText = ({ activeElements, filterInView, filter }) => { if (activeElements === undefined || activeElements.length === 0) { return filter.name; } const filterTextWrappers = { Name: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }), Value: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" }) }; if (filterInView?.operator === constants_OPERATOR_IS_ANY) { return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is any: Admin, Editor". */ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is any: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); } if (filterInView?.operator === constants_OPERATOR_IS_NONE) { return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is none: Admin, Editor". */ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is none: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); } if (filterInView?.operator === OPERATOR_IS_ALL) { return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is all: Admin, Editor". */ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); } if (filterInView?.operator === OPERATOR_IS_NOT_ALL) { return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not all: Admin, Editor". */ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); } if (filterInView?.operator === constants_OPERATOR_IS) { return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is: Admin". */ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); } if (filterInView?.operator === constants_OPERATOR_IS_NOT) { return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not: Admin". */ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); } return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name e.g.: "Unknown status for Author". */ (0,external_wp_i18n_namespaceObject.__)('Unknown status for %1$s'), filter.name); }; function OperatorSelector({ filter, view, onChangeView }) { const operatorOptions = filter.operators?.map(operator => ({ value: operator, label: OPERATORS[operator]?.label })); const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); const value = currentFilter?.operator || filter.operators[0]; return operatorOptions.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, justify: "flex-start", className: "dataviews-filters__summary-operators-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { label: (0,external_wp_i18n_namespaceObject.__)('Conditions'), value: value, options: operatorOptions, onChange: newValue => { var _view$filters, _view$filters2; const operator = newValue; const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { if (_filter.field === filter.field) { return { ..._filter, operator }; } return _filter; })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { field: filter.field, operator, value: undefined }]; onChangeView({ ...view, page: 1, filters: newFilters }); }, size: "small", __nextHasNoMarginBottom: true, hideLabelFromVision: true })] }); } function FilterSummary({ addFilterRef, openedFilter, ...commonProps }) { const toggleRef = (0,external_wp_element_namespaceObject.useRef)(null); const { filter, view, onChangeView } = commonProps; const filterInView = view.filters?.find(f => f.field === filter.field); const activeElements = filter.elements.filter(element => { if (filter.singleSelection) { return element.value === filterInView?.value; } return filterInView?.value?.includes(element.value); }); const isPrimary = filter.isPrimary; const hasValues = filterInView?.value !== undefined; const canResetOrRemove = !isPrimary || hasValues; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { defaultOpen: openedFilter === filter.field, contentClassName: "dataviews-filters__summary-popover", popoverProps: { placement: 'bottom-start', role: 'dialog' }, onClose: () => { toggleRef.current?.focus(); }, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. */ (0,external_wp_i18n_namespaceObject.__)('Filter by: %1$s'), filter.name.toLowerCase()), placement: "top", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('dataviews-filters__summary-chip', { 'has-reset': canResetOrRemove, 'has-values': hasValues }), role: "button", tabIndex: 0, onClick: onToggle, onKeyDown: event => { if ([ENTER, SPACE].includes(event.key)) { onToggle(); event.preventDefault(); } }, "aria-pressed": isOpen, "aria-expanded": isOpen, ref: toggleRef, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterText, { activeElements: activeElements, filterInView: filterInView, filter: filter }) }) }), canResetOrRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)('Reset') : (0,external_wp_i18n_namespaceObject.__)('Remove'), placement: "top", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { className: dist_clsx('dataviews-filters__summary-chip-remove', { 'has-values': hasValues }), onClick: () => { onChangeView({ ...view, page: 1, filters: view.filters?.filter(_filter => _filter.field !== filter.field) }); // If the filter is not primary and can be removed, it will be added // back to the available filters from `Add filter` component. if (!isPrimary) { addFilterRef.current?.focus(); } else { // If is primary, focus the toggle button. toggleRef.current?.focus(); } }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: close_small }) }) })] }), renderContent: () => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OperatorSelector, { ...commonProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchWidget, { ...commonProps })] }); } }); } ;// ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/dataviews'); ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/add-filter.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Menu: add_filter_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function AddFilterMenu({ filters, view, onChangeView, setOpenedFilter, triggerProps }) { const inactiveFilters = filters.filter(filter => !filter.isVisible); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(add_filter_Menu, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.TriggerButton, { ...triggerProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Popover, { children: inactiveFilters.map(filter => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Item, { onClick: () => { setOpenedFilter(filter.field); onChangeView({ ...view, page: 1, filters: [...(view.filters || []), { field: filter.field, value: undefined, operator: filter.operators[0] }] }); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.ItemLabel, { children: filter.name }) }, filter.field); }) })] }); } function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) { if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) { return null; } const inactiveFilters = filters.filter(filter => !filter.isVisible); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterMenu, { triggerProps: { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { accessibleWhenDisabled: true, size: "compact", className: "dataviews-filters-button", variant: "tertiary", disabled: !inactiveFilters.length, ref: ref }), children: (0,external_wp_i18n_namespaceObject.__)('Add filter') }, filters, view, onChangeView, setOpenedFilter }); } /* harmony default export */ const add_filter = ((0,external_wp_element_namespaceObject.forwardRef)(AddFilter)); ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/reset-filters.js /** * WordPress dependencies */ /** * Internal dependencies */ function ResetFilter({ filters, view, onChangeView }) { const isPrimary = field => filters.some(_filter => _filter.field === field && _filter.isPrimary); const isDisabled = !view.search && !view.filters?.some(_filter => _filter.value !== undefined || !isPrimary(_filter.field)); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { disabled: isDisabled, accessibleWhenDisabled: true, size: "compact", variant: "tertiary", className: "dataviews-filters__reset-button", onClick: () => { onChangeView({ ...view, page: 1, search: '', filters: [] }); }, children: (0,external_wp_i18n_namespaceObject.__)('Reset') }); } ;// ./node_modules/@wordpress/dataviews/build-module/utils.js /** * Internal dependencies */ function sanitizeOperators(field) { let operators = field.filterBy?.operators; // Assign default values. if (!operators || !Array.isArray(operators)) { operators = [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE]; } // Make sure only valid operators are used. operators = operators.filter(operator => ALL_OPERATORS.includes(operator)); // Do not allow mixing single & multiselection operators. // Remove multiselection operators if any of the single selection ones is present. if (operators.includes(constants_OPERATOR_IS) || operators.includes(constants_OPERATOR_IS_NOT)) { operators = operators.filter(operator => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(operator)); } return operators; } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function useFilters(fields, view) { return (0,external_wp_element_namespaceObject.useMemo)(() => { const filters = []; fields.forEach(field => { if (!field.elements?.length) { return; } const operators = sanitizeOperators(field); if (operators.length === 0) { return; } const isPrimary = !!field.filterBy?.isPrimary; filters.push({ field: field.id, name: field.label, elements: field.elements, singleSelection: operators.some(op => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(op)), operators, isVisible: isPrimary || !!view.filters?.some(f => f.field === field.id && ALL_OPERATORS.includes(f.operator)), isPrimary }); }); // Sort filters by primary property. We need the primary filters to be first. // Then we sort by name. filters.sort((a, b) => { if (a.isPrimary && !b.isPrimary) { return -1; } if (!a.isPrimary && b.isPrimary) { return 1; } return a.name.localeCompare(b.name); }); return filters; }, [fields, view]); } function FiltersToggle({ filters, view, onChangeView, setOpenedFilter, isShowingFilter, setIsShowingFilter }) { const buttonRef = (0,external_wp_element_namespaceObject.useRef)(null); const onChangeViewWithFilterVisibility = (0,external_wp_element_namespaceObject.useCallback)(_view => { onChangeView(_view); setIsShowingFilter(true); }, [onChangeView, setIsShowingFilter]); const visibleFilters = filters.filter(filter => filter.isVisible); const hasVisibleFilters = !!visibleFilters.length; if (filters.length === 0) { return null; } const addFilterButtonProps = { label: (0,external_wp_i18n_namespaceObject.__)('Add filter'), 'aria-expanded': false, isPressed: false }; const toggleFiltersButtonProps = { label: (0,external_wp_i18n_namespaceObject._x)('Filter', 'verb'), 'aria-expanded': isShowingFilter, isPressed: isShowingFilter, onClick: () => { if (!isShowingFilter) { setOpenedFilter(null); } setIsShowingFilter(!isShowingFilter); } }; const buttonComponent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ref: buttonRef, className: "dataviews-filters__visibility-toggle", size: "compact", icon: library_funnel, ...(hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps) }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterMenu, { filters: filters, view: view, onChangeView: onChangeViewWithFilterVisibility, setOpenedFilter: setOpenedFilter, triggerProps: { render: buttonComponent } }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterVisibilityToggle, { buttonRef: buttonRef, filtersCount: view.filters?.length, children: buttonComponent }) }); } function FilterVisibilityToggle({ buttonRef, filtersCount, children }) { // Focus the `add filter` button when unmounts. (0,external_wp_element_namespaceObject.useEffect)(() => () => { buttonRef.current?.focus(); }, [buttonRef]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [children, !!filtersCount && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount })] }); } function Filters() { const { fields, view, onChangeView, openedFilter, setOpenedFilter } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const addFilterRef = (0,external_wp_element_namespaceObject.useRef)(null); const filters = useFilters(fields, view); const addFilter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter, { filters: filters, view: view, onChangeView: onChangeView, ref: addFilterRef, setOpenedFilter: setOpenedFilter }, "add-filter"); const visibleFilters = filters.filter(filter => filter.isVisible); if (visibleFilters.length === 0) { return null; } const filterComponents = [...visibleFilters.map(filter => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterSummary, { filter: filter, view: view, onChangeView: onChangeView, addFilterRef: addFilterRef, openedFilter: openedFilter }, filter.field); }), addFilter]; filterComponents.push(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetFilter, { filters: filters, view: view, onChangeView: onChangeView }, "reset-filters")); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", style: { width: 'fit-content' }, className: "dataviews-filters__container", wrap: true, children: filterComponents }); } /* harmony default export */ const dataviews_filters = ((0,external_wp_element_namespaceObject.memo)(Filters)); ;// ./node_modules/@wordpress/icons/build-module/library/block-table.js /** * WordPress dependencies */ const blockTable = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" }) }); /* harmony default export */ const block_table = (blockTable); ;// ./node_modules/@wordpress/icons/build-module/library/category.js /** * WordPress dependencies */ const category = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z", fillRule: "evenodd", clipRule: "evenodd" }) }); /* harmony default export */ const library_category = (category); ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js /** * WordPress dependencies */ const formatListBulletsRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) }); /* harmony default export */ const format_list_bullets_rtl = (formatListBulletsRTL); ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js /** * WordPress dependencies */ const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); /* harmony default export */ const format_list_bullets = (formatListBullets); ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-selection-checkbox/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function DataViewsSelectionCheckbox({ selection, onChangeSelection, item, getItemId, titleField, disabled }) { const id = getItemId(item); const checked = !disabled && selection.includes(id); // Fallback label to ensure accessibility const selectionLabel = titleField?.getValue?.({ item }) || (0,external_wp_i18n_namespaceObject.__)('(no title)'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { className: "dataviews-selection-checkbox", __nextHasNoMarginBottom: true, "aria-label": selectionLabel, "aria-disabled": disabled, checked: checked, onChange: () => { if (disabled) { return; } onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); } }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-item-actions/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Menu: dataviews_item_actions_Menu, kebabCase: dataviews_item_actions_kebabCase } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function ButtonTrigger({ action, onClick, items }) { const label = typeof action.label === 'string' ? action.label : action.label(items); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { label: label, icon: action.icon, disabled: !!action.disabled, accessibleWhenDisabled: true, isDestructive: action.isDestructive, size: "compact", onClick: onClick }); } function MenuItemTrigger({ action, onClick, items }) { const label = typeof action.label === 'string' ? action.label : action.label(items); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Item, { disabled: action.disabled, onClick: onClick, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.ItemLabel, { children: label }) }); } function ActionModal({ action, items, closeModal }) { const label = typeof action.label === 'string' ? action.label : action.label(items); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: action.modalHeader || label, __experimentalHideHeader: !!action.hideModalHeader, onRequestClose: closeModal, focusOnMount: "firstContentElement", size: "medium", overlayClassName: `dataviews-action-modal dataviews-action-modal__${dataviews_item_actions_kebabCase(action.id)}`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { items: items, closeModal: closeModal }) }); } function ActionsMenuGroup({ actions, item, registry, setActiveModalAction }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Group, { children: actions.map(action => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuItemTrigger, { action: action, onClick: () => { if ('RenderModal' in action) { setActiveModalAction(action); return; } action.callback([item], { registry }); }, items: [item] }, action.id)) }); } function ItemActions({ item, actions, isCompact }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { primaryActions, eligibleActions } = (0,external_wp_element_namespaceObject.useMemo)(() => { // If an action is eligible for all items, doesn't need // to provide the `isEligible` function. const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); return { primaryActions: _primaryActions, eligibleActions: _eligibleActions }; }, [actions, item]); if (isCompact) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { item: item, actions: eligibleActions, isSmall: true, registry: registry }); } // If all actions are primary, there is no need to render the dropdown. if (primaryActions.length === eligibleActions.length) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActions, { item: item, actions: primaryActions, registry: registry }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 1, justify: "flex-end", className: "dataviews-item-actions", style: { flexShrink: '0', width: 'auto' }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActions, { item: item, actions: primaryActions, registry: registry }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { item: item, actions: eligibleActions, registry: registry })] }); } function CompactItemActions({ item, actions, isSmall, registry }) { const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_item_actions_Menu, { placement: "bottom-end", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: isSmall ? 'small' : 'compact', icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Actions'), accessibleWhenDisabled: true, disabled: !actions.length, className: "dataviews-all-actions-button" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Popover, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsMenuGroup, { actions: actions, item: item, registry: registry, setActiveModalAction: setActiveModalAction }) })] }), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { action: activeModalAction, items: [item], closeModal: () => setActiveModalAction(null) })] }); } function PrimaryActions({ item, actions, registry }) { const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); if (!Array.isArray(actions) || actions.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [actions.map(action => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ButtonTrigger, { action: action, onClick: () => { if ('RenderModal' in action) { setActiveModalAction(action); return; } action.callback([item], { registry }); }, items: [item] }, action.id)), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { action: activeModalAction, items: [item], closeModal: () => setActiveModalAction(null) })] }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-bulk-actions/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ActionWithModal({ action, items, ActionTriggerComponent }) { const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); const actionTriggerProps = { action, onClick: () => { setIsModalOpen(true); }, items }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTriggerComponent, { ...actionTriggerProps }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { action: action, items: items, closeModal: () => setIsModalOpen(false) })] }); } function useHasAPossibleBulkAction(actions, item) { return (0,external_wp_element_namespaceObject.useMemo)(() => { return actions.some(action => { return action.supportsBulk && (!action.isEligible || action.isEligible(item)); }); }, [actions, item]); } function useSomeItemHasAPossibleBulkAction(actions, data) { return (0,external_wp_element_namespaceObject.useMemo)(() => { return data.some(item => { return actions.some(action => { return action.supportsBulk && (!action.isEligible || action.isEligible(item)); }); }); }, [actions, data]); } function BulkSelectionCheckbox({ selection, onChangeSelection, data, actions, getItemId }) { const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return data.filter(item => { return actions.some(action => action.supportsBulk && (!action.isEligible || action.isEligible(item))); }); }, [data, actions]); const selectedItems = data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); const areAllSelected = selectedItems.length === selectableItems.length; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { className: "dataviews-view-table-selection-checkbox", __nextHasNoMarginBottom: true, checked: areAllSelected, indeterminate: !areAllSelected && !!selectedItems.length, onChange: () => { if (areAllSelected) { onChangeSelection([]); } else { onChangeSelection(selectableItems.map(item => getItemId(item))); } }, "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)('Deselect all') : (0,external_wp_i18n_namespaceObject.__)('Select all') }); } function ActionTrigger({ action, onClick, isBusy, items }) { const label = typeof action.label === 'string' ? action.label : action.label(items); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { disabled: isBusy, accessibleWhenDisabled: true, label: label, icon: action.icon, isDestructive: action.isDestructive, size: "compact", onClick: onClick, isBusy: isBusy, tooltipPosition: "top" }); } const dataviews_bulk_actions_EMPTY_ARRAY = []; function ActionButton({ action, selectedItems, actionInProgress, setActionInProgress }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const selectedEligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return selectedItems.filter(item => { return !action.isEligible || action.isEligible(item); }); }, [action, selectedItems]); if ('RenderModal' in action) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { action: action, items: selectedEligibleItems, ActionTriggerComponent: ActionTrigger }, action.id); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, { action: action, onClick: async () => { setActionInProgress(action.id); await action.callback(selectedItems, { registry }); setActionInProgress(null); }, items: selectedEligibleItems, isBusy: actionInProgress === action.id }, action.id); } function renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) { const message = selectedItems.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of items. */ (0,external_wp_i18n_namespaceObject._n)('%d Item selected', '%d Items selected', selectedItems.length), selectedItems.length) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of items. */ (0,external_wp_i18n_namespaceObject._n)('%d Item', '%d Items', data.length), data.length); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, className: "dataviews-bulk-actions-footer__container", spacing: 3, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { selection: selection, onChangeSelection: onChangeSelection, data: data, actions: actions, getItemId: getItemId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-bulk-actions-footer__action-buttons", expanded: false, spacing: 1, children: [actionsToShow.map(action => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionButton, { action: action, selectedItems: selectedItems, actionInProgress: actionInProgress, setActionInProgress: setActionInProgress }, action.id); }), selectedItems.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: close_small, showTooltip: true, tooltipPosition: "top", size: "compact", label: (0,external_wp_i18n_namespaceObject.__)('Cancel'), disabled: !!actionInProgress, accessibleWhenDisabled: false, onClick: () => { onChangeSelection(dataviews_bulk_actions_EMPTY_ARRAY); } })] })] }); } function FooterContent({ selection, actions, onChangeSelection, data, getItemId }) { const [actionInProgress, setActionInProgress] = (0,external_wp_element_namespaceObject.useState)(null); const footerContentRef = (0,external_wp_element_namespaceObject.useRef)(null); const bulkActions = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => action.supportsBulk), [actions]); const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return data.filter(item => { return bulkActions.some(action => !action.isEligible || action.isEligible(item)); }); }, [data, bulkActions]); const selectedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); }, [selection, data, getItemId, selectableItems]); const actionsToShow = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => { return action.supportsBulk && action.icon && selectedItems.some(item => !action.isEligible || action.isEligible(item)); }), [actions, selectedItems]); if (!actionInProgress) { if (footerContentRef.current) { footerContentRef.current = null; } return renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); } else if (!footerContentRef.current) { footerContentRef.current = renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); } return footerContentRef.current; } function BulkActionsFooter() { const { data, selection, actions = dataviews_bulk_actions_EMPTY_ARRAY, onChangeSelection, getItemId } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FooterContent, { selection: selection, onChangeSelection: onChangeSelection, data: data, actions: actions, getItemId: getItemId }); } ;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js /** * WordPress dependencies */ const arrowLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) }); /* harmony default export */ const arrow_left = (arrowLeft); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js /** * WordPress dependencies */ const arrowRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); /* harmony default export */ const arrow_right = (arrowRight); ;// ./node_modules/@wordpress/icons/build-module/library/unseen.js /** * WordPress dependencies */ const unseen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) }); /* harmony default export */ const library_unseen = (unseen); ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-header-menu.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Menu: column_header_menu_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function WithMenuSeparators({ children }) { return external_wp_element_namespaceObject.Children.toArray(children).filter(Boolean).map((child, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { children: [i > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Separator, {}), child] }, i)); } const _HeaderMenu = (0,external_wp_element_namespaceObject.forwardRef)(function HeaderMenu({ fieldId, view, fields, onChangeView, onHide, setOpenedFilter, canMove = true }, ref) { var _view$fields; const visibleFieldIds = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; const index = visibleFieldIds?.indexOf(fieldId); const isSorted = view.sort?.field === fieldId; let isHidable = false; let isSortable = false; let canAddFilter = false; let operators = []; const field = fields.find(f => f.id === fieldId); if (!field) { // No combined or regular field found. return null; } isHidable = field.enableHiding !== false; isSortable = field.enableSorting !== false; const header = field.header; operators = sanitizeOperators(field); // Filter can be added: // 1. If the field is not already part of a view's filters. // 2. If the field meets the type and operator requirements. // 3. If it's not primary. If it is, it should be already visible. canAddFilter = !view.filters?.some(_filter => fieldId === _filter.field) && !!field.elements?.length && !!operators.length && !field.filterBy?.isPrimary; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", className: "dataviews-view-table-header-button", ref: ref, variant: "tertiary" }), children: [header, view.sort && isSorted && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Popover, { style: { minWidth: '240px' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithMenuSeparators, { children: [isSortable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: SORTING_DIRECTIONS.map(direction => { const isChecked = view.sort && isSorted && view.sort.direction === direction; const value = `${fieldId}-${direction}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.RadioItem, { // All sorting radio items share the same name, so that // selecting a sorting option automatically deselects the // previously selected one, even if it is displayed in // another submenu. The field and direction are passed via // the `value` prop. name: "view-table-sorting", value: value, checked: isChecked, onChange: () => { onChangeView({ ...view, sort: { field: fieldId, direction }, showLevels: false }); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: sortLabels[direction] }) }, value); }) }), canAddFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: library_funnel }), onClick: () => { setOpenedFilter(fieldId); onChangeView({ ...view, page: 1, filters: [...(view.filters || []), { field: fieldId, value: undefined, operator: operators[0] }] }); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Add filter') }) }) }), (canMove || isHidable) && field && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.Group, { children: [canMove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_left }), disabled: index < 1, onClick: () => { var _visibleFieldIds$slic; onChangeView({ ...view, fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), fieldId, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] }); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Move left') }) }), canMove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_right }), disabled: index >= visibleFieldIds.length - 1, onClick: () => { var _visibleFieldIds$slic2; onChangeView({ ...view, fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], fieldId, ...visibleFieldIds.slice(index + 2)] }); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Move right') }) }), isHidable && field && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: library_unseen }), onClick: () => { onHide(field); onChangeView({ ...view, fields: visibleFieldIds.filter(id => id !== fieldId) }); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Hide column') }) })] })] }) })] }); }); // @ts-expect-error Lift the `Item` type argument through the forwardRef. const ColumnHeaderMenu = _HeaderMenu; /* harmony default export */ const column_header_menu = (ColumnHeaderMenu); ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/get-clickable-item-props.js function getClickableItemProps({ item, isItemClickable, onClickItem, className }) { if (!isItemClickable(item) || !onClickItem) { return { className }; } return { className: className ? `${className} ${className}--clickable` : undefined, role: 'button', tabIndex: 0, onClick: event => { // Prevents onChangeSelection from triggering. event.stopPropagation(); onClickItem(item); }, onKeyDown: event => { if (event.key === 'Enter' || event.key === '' || event.key === ' ') { // Prevents onChangeSelection from triggering. event.stopPropagation(); onClickItem(item); } } }; } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-primary.js /** * WordPress dependencies */ /** * Internal dependencies */ function ColumnPrimary({ item, level, titleField, mediaField, descriptionField, onClickItem, isItemClickable }) { const clickableProps = getClickableItemProps({ item, isItemClickable, onClickItem, className: 'dataviews-view-table__cell-content-wrapper dataviews-title-field' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "flex-start", children: [mediaField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { item: item }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [titleField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...clickableProps, children: [level !== undefined && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-view-table__level", children: ['—'.repeat(level), "\xA0"] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item: item })] }), descriptionField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(descriptionField.render, { item: item })] })] }); } /* harmony default export */ const column_primary = (ColumnPrimary); ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function TableColumnField({ item, fields, column }) { const field = fields.find(f => f.id === column); if (!field) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { item }) }); } function TableRow({ hasBulkActions, item, level, actions, fields, id, view, titleField, mediaField, descriptionField, selection, getItemId, isItemClickable, onClickItem, onChangeSelection }) { var _view$fields; const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); const isSelected = hasPossibleBulkAction && selection.includes(id); const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); const { showTitle = true, showMedia = true, showDescription = true } = view; const handleMouseEnter = () => { setIsHovered(true); }; const handleMouseLeave = () => { setIsHovered(false); }; // Will be set to true if `onTouchStart` fires. This happens before // `onClick` and can be used to exclude touchscreen devices from certain // behaviours. const isTouchDeviceRef = (0,external_wp_element_namespaceObject.useRef)(false); const columns = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { className: dist_clsx('dataviews-view-table__row', { 'is-selected': hasPossibleBulkAction && isSelected, 'is-hovered': isHovered, 'has-bulk-actions': hasPossibleBulkAction }), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onTouchStart: () => { isTouchDeviceRef.current = true; }, onClick: () => { if (!hasPossibleBulkAction) { return; } if (!isTouchDeviceRef.current && document.getSelection()?.type !== 'Range') { onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [id]); } }, children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { item: item, selection: selection, onChangeSelection: onChangeSelection, getItemId: getItemId, titleField: titleField, disabled: !hasPossibleBulkAction }) }) }), hasPrimaryColumn && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_primary, { item: item, level: level, titleField: showTitle ? titleField : undefined, mediaField: showMedia ? mediaField : undefined, descriptionField: showDescription ? descriptionField : undefined, isItemClickable: isItemClickable, onClickItem: onClickItem }) }), columns.map(column => { var _view$layout$styles$c; // Explicit picks the supported styles. const { width, maxWidth, minWidth } = (_view$layout$styles$c = view.layout?.styles?.[column]) !== null && _view$layout$styles$c !== void 0 ? _view$layout$styles$c : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { style: { width, maxWidth, minWidth }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumnField, { fields: fields, item: item, column: column }) }, column); }), !!actions?.length && /*#__PURE__*/ // Disable reason: we are not making the element interactive, // but preventing any click events from bubbling up to the // table row. This allows us to add a click handler to the row // itself (to toggle row selection) without erroneously // intercepting click events from ItemActions. /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { className: "dataviews-view-table__actions-column", onClick: e => e.stopPropagation(), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { item: item, actions: actions }) }) /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */] }); } function ViewTable({ actions, data, fields, getItemId, getItemLevel, isLoading = false, onChangeView, onChangeSelection, selection, setOpenedFilter, onClickItem, isItemClickable, view }) { var _view$fields2; const headerMenuRefs = (0,external_wp_element_namespaceObject.useRef)(new Map()); const headerMenuToFocusRef = (0,external_wp_element_namespaceObject.useRef)(); const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_namespaceObject.useState)(); const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); (0,external_wp_element_namespaceObject.useEffect)(() => { if (headerMenuToFocusRef.current) { headerMenuToFocusRef.current.focus(); headerMenuToFocusRef.current = undefined; } }); const tableNoticeId = (0,external_wp_element_namespaceObject.useId)(); if (nextHeaderMenuToFocus) { // If we need to force focus, we short-circuit rendering here // to prevent any additional work while we handle that. // Clearing out the focus directive is necessary to make sure // future renders don't cause unexpected focus jumps. headerMenuToFocusRef.current = nextHeaderMenuToFocus; setNextHeaderMenuToFocus(undefined); return; } const onHide = field => { const hidden = headerMenuRefs.current.get(field.id); const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : undefined; setNextHeaderMenuToFocus(fallback?.node); }; const hasData = !!data?.length; const titleField = fields.find(field => field.id === view.titleField); const mediaField = fields.find(field => field.id === view.mediaField); const descriptionField = fields.find(field => field.id === view.descriptionField); const { showTitle = true, showMedia = true, showDescription = true } = view; const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; const columns = (_view$fields2 = view.fields) !== null && _view$fields2 !== void 0 ? _view$fields2 : []; const headerMenuRef = (column, index) => node => { if (node) { headerMenuRefs.current.set(column, { node, fallback: columns[index > 0 ? index - 1 : 1] }); } else { headerMenuRefs.current.delete(column); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("table", { className: dist_clsx('dataviews-view-table', { [`has-${view.layout?.density}-density`]: view.layout?.density && ['compact', 'comfortable'].includes(view.layout.density) }), "aria-busy": isLoading, "aria-describedby": tableNoticeId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { className: "dataviews-view-table__row", children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { className: "dataviews-view-table__checkbox-column", scope: "col", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { selection: selection, onChangeSelection: onChangeSelection, data: data, actions: actions, getItemId: getItemId }) }), hasPrimaryColumn && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { scope: "col", children: titleField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu, { ref: headerMenuRef(titleField.id, 0), fieldId: titleField.id, view: view, fields: fields, onChangeView: onChangeView, onHide: onHide, setOpenedFilter: setOpenedFilter, canMove: false }) }), columns.map((column, index) => { var _view$layout$styles$c2; // Explicit picks the supported styles. const { width, maxWidth, minWidth } = (_view$layout$styles$c2 = view.layout?.styles?.[column]) !== null && _view$layout$styles$c2 !== void 0 ? _view$layout$styles$c2 : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { style: { width, maxWidth, minWidth }, "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : undefined, scope: "col", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu, { ref: headerMenuRef(column, index), fieldId: column, view: view, fields: fields, onChangeView: onChangeView, onHide: onHide, setOpenedFilter: setOpenedFilter }) }, column); }), !!actions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { className: "dataviews-view-table__actions-column", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-table-header", children: (0,external_wp_i18n_namespaceObject.__)('Actions') }) })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { children: hasData && data.map((item, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableRow, { item: item, level: view.showLevels && typeof getItemLevel === 'function' ? getItemLevel(item) : undefined, hasBulkActions: hasBulkActions, actions: actions, fields: fields, id: getItemId(item) || index.toString(), view: view, titleField: titleField, mediaField: mediaField, descriptionField: descriptionField, selection: selection, getItemId: getItemId, onChangeSelection: onChangeSelection, onClickItem: onClickItem, isItemClickable: isItemClickable }, getItemId(item))) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx({ 'dataviews-loading': isLoading, 'dataviews-no-results': !hasData && !isLoading }), id: tableNoticeId, children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') }) })] }); } /* harmony default export */ const table = (ViewTable); ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/preview-size-picker.js /** * WordPress dependencies */ /** * Internal dependencies */ const viewportBreaks = { xhuge: { min: 3, max: 6, default: 5 }, huge: { min: 2, max: 4, default: 4 }, xlarge: { min: 2, max: 3, default: 3 }, large: { min: 1, max: 2, default: 2 }, mobile: { min: 1, max: 2, default: 2 } }; /** * Breakpoints were adjusted from media queries breakpoints to account for * the sidebar width. This was done to match the existing styles we had. */ const BREAKPOINTS = { xhuge: 1520, huge: 1140, xlarge: 780, large: 480, mobile: 0 }; function useViewPortBreakpoint() { const containerWidth = (0,external_wp_element_namespaceObject.useContext)(dataviews_context).containerWidth; for (const [key, value] of Object.entries(BREAKPOINTS)) { if (containerWidth >= value) { return key; } } return 'mobile'; } function useUpdatedPreviewSizeOnViewportChange() { const view = (0,external_wp_element_namespaceObject.useContext)(dataviews_context).view; const viewport = useViewPortBreakpoint(); return (0,external_wp_element_namespaceObject.useMemo)(() => { const previewSize = view.layout?.previewSize; let newPreviewSize; if (!previewSize) { return; } const breakValues = viewportBreaks[viewport]; if (previewSize < breakValues.min) { newPreviewSize = breakValues.min; } if (previewSize > breakValues.max) { newPreviewSize = breakValues.max; } return newPreviewSize; }, [viewport, view]); } function PreviewSizePicker() { const viewport = useViewPortBreakpoint(); const context = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const view = context.view; const breakValues = viewportBreaks[viewport]; const previewSizeToUse = view.layout?.previewSize || breakValues.default; const marks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.from({ length: breakValues.max - breakValues.min + 1 }, (_, i) => { return { value: breakValues.min + i }; }), [breakValues]); if (viewport === 'mobile') { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, showTooltip: false, label: (0,external_wp_i18n_namespaceObject.__)('Preview size'), value: breakValues.max + breakValues.min - previewSizeToUse, marks: marks, min: breakValues.min, max: breakValues.max, withInputField: false, onChange: (value = 0) => { context.onChangeView({ ...view, layout: { ...view.layout, previewSize: breakValues.max + breakValues.min - value } }); }, step: 1 }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function GridItem({ view, selection, onChangeSelection, onClickItem, isItemClickable, getItemId, item, actions, mediaField, titleField, descriptionField, regularFields, badgeFields, hasBulkActions }) { const { showTitle = true, showMedia = true, showDescription = true } = view; const hasBulkAction = useHasAPossibleBulkAction(actions, item); const id = getItemId(item); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItem); const isSelected = selection.includes(id); const renderedMediaField = mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { item: item }) : null; const renderedTitleField = showTitle && titleField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item: item }) : null; const clickableMediaItemProps = getClickableItemProps({ item, isItemClickable, onClickItem, className: 'dataviews-view-grid__media' }); const clickableTitleItemProps = getClickableItemProps({ item, isItemClickable, onClickItem, className: 'dataviews-view-grid__title-field dataviews-title-field' }); let mediaA11yProps; let titleA11yProps; if (isItemClickable(item) && onClickItem) { if (renderedTitleField) { mediaA11yProps = { 'aria-labelledby': `dataviews-view-grid__title-field-${instanceId}` }; titleA11yProps = { id: `dataviews-view-grid__title-field-${instanceId}` }; } else { mediaA11yProps = { 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Navigate to item') }; } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, className: dist_clsx('dataviews-view-grid__card', { 'is-selected': hasBulkAction && isSelected }), onClickCapture: event => { if (event.ctrlKey || event.metaKey) { event.stopPropagation(); event.preventDefault(); if (!hasBulkAction) { return; } onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); } }, children: [showMedia && renderedMediaField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...clickableMediaItemProps, ...mediaA11yProps, children: renderedMediaField }), hasBulkActions && showMedia && renderedMediaField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { item: item, selection: selection, onChangeSelection: onChangeSelection, getItemId: getItemId, titleField: titleField, disabled: !hasBulkAction }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", className: "dataviews-view-grid__title-actions", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...clickableTitleItemProps, ...titleA11yProps, children: renderedTitleField }), !!actions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { item: item, actions: actions, isCompact: true })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [showDescription && descriptionField?.render && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(descriptionField.render, { item: item }), !!badgeFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-view-grid__badge-fields", spacing: 2, wrap: true, alignment: "top", justify: "flex-start", children: badgeFields.map(field => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { className: "dataviews-view-grid__field-value", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { item: item }) }, field.id); }) }), !!regularFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-grid__fields", spacing: 1, children: regularFields.map(field => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "dataviews-view-grid__field", gap: 1, justify: "flex-start", expanded: true, style: { height: 'auto' }, direction: "row", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-grid__field-value", style: { maxHeight: 'none' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { item: item }) })] }) }, field.id); }) })] })] }, id); } function ViewGrid({ actions, data, fields, getItemId, isLoading, onChangeSelection, onClickItem, isItemClickable, selection, view }) { var _view$fields; const titleField = fields.find(field => field.id === view?.titleField); const mediaField = fields.find(field => field.id === view?.mediaField); const descriptionField = fields.find(field => field.id === view?.descriptionField); const otherFields = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; const { regularFields, badgeFields } = otherFields.reduce((accumulator, fieldId) => { const field = fields.find(f => f.id === fieldId); if (!field) { return accumulator; } // If the field is a badge field, add it to the badgeFields array // otherwise add it to the rest visibleFields array. const key = view.layout?.badgeFields?.includes(fieldId) ? 'badgeFields' : 'regularFields'; accumulator[key].push(field); return accumulator; }, { regularFields: [], badgeFields: [] }); const hasData = !!data?.length; const updatedPreviewSize = useUpdatedPreviewSizeOnViewportChange(); const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); const usedPreviewSize = updatedPreviewSize || view.layout?.previewSize; const gridStyle = usedPreviewSize ? { gridTemplateColumns: `repeat(${usedPreviewSize}, minmax(0, 1fr))` } : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { gap: 8, columns: 2, alignment: "top", className: "dataviews-view-grid", style: gridStyle, "aria-busy": isLoading, children: data.map(item => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItem, { view: view, selection: selection, onChangeSelection: onChangeSelection, onClickItem: onClickItem, isItemClickable: isItemClickable, getItemId: getItemId, item: item, actions: actions, mediaField: mediaField, titleField: titleField, descriptionField: descriptionField, regularFields: regularFields, badgeFields: badgeFields, hasBulkActions: hasBulkActions }, getItemId(item)); }) }), !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx({ 'dataviews-loading': isLoading, 'dataviews-no-results': !isLoading }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') }) })] }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/list/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Menu: list_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function generateItemWrapperCompositeId(idPrefix) { return `${idPrefix}-item-wrapper`; } function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { return `${idPrefix}-primary-action-${primaryActionId}`; } function generateDropdownTriggerCompositeId(idPrefix) { return `${idPrefix}-dropdown`; } function PrimaryActionGridCell({ idPrefix, primaryAction, item }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); const compositeItemId = generatePrimaryActionCompositeId(idPrefix, primaryAction.id); const label = typeof primaryAction.label === 'string' ? primaryAction.label : primaryAction.label([item]); return 'RenderModal' in primaryAction ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { id: compositeItemId, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { label: label, disabled: !!primaryAction.disabled, accessibleWhenDisabled: true, icon: primaryAction.icon, isDestructive: primaryAction.isDestructive, size: "small", onClick: () => setIsModalOpen(true) }), children: isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { action: primaryAction, items: [item], closeModal: () => setIsModalOpen(false) }) }) }, primaryAction.id) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { id: compositeItemId, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { label: label, disabled: !!primaryAction.disabled, accessibleWhenDisabled: true, icon: primaryAction.icon, isDestructive: primaryAction.isDestructive, size: "small", onClick: () => { primaryAction.callback([item], { registry }); } }) }) }, primaryAction.id); } function ListItem({ view, actions, idPrefix, isSelected, item, titleField, mediaField, descriptionField, onSelect, otherFields, onDropdownTriggerKeyDown }) { const { showTitle = true, showMedia = true, showDescription = true } = view; const itemRef = (0,external_wp_element_namespaceObject.useRef)(null); const labelId = `${idPrefix}-label`; const descriptionId = `${idPrefix}-description`; const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); const handleHover = ({ type }) => { const isHover = type === 'mouseenter'; setIsHovered(isHover); }; (0,external_wp_element_namespaceObject.useEffect)(() => { if (isSelected) { itemRef.current?.scrollIntoView({ behavior: 'auto', block: 'nearest', inline: 'nearest' }); } }, [isSelected]); const { primaryAction, eligibleActions } = (0,external_wp_element_namespaceObject.useMemo)(() => { // If an action is eligible for all items, doesn't need // to provide the `isEligible` function. const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); return { primaryAction: _primaryActions[0], eligibleActions: _eligibleActions }; }, [actions, item]); const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; const renderedMediaField = showMedia && mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { item: item }) }) : null; const renderedTitleField = showTitle && titleField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item: item }) : null; const usedActions = eligibleActions?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, className: "dataviews-view-list__item-actions", children: [primaryAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActionGridCell, { idPrefix: idPrefix, primaryAction: primaryAction, item: item }), !hasOnlyOnePrimaryAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { role: "gridcell", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(list_Menu, { placement: "bottom-end", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { id: generateDropdownTriggerCompositeId(idPrefix), render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Actions'), accessibleWhenDisabled: true, disabled: !actions.length, onKeyDown: onDropdownTriggerKeyDown }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.Popover, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsMenuGroup, { actions: eligibleActions, item: item, registry: registry, setActiveModalAction: setActiveModalAction }) })] }), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { action: activeModalAction, items: [item], closeModal: () => setActiveModalAction(null) })] })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Row, { ref: itemRef, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), role: "row", className: dist_clsx({ 'is-selected': isSelected, 'is-hovered': isHovered }), onMouseEnter: handleHover, onMouseLeave: handleHover, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-view-list__item-wrapper", spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { id: generateItemWrapperCompositeId(idPrefix), "aria-pressed": isSelected, "aria-labelledby": labelId, "aria-describedby": descriptionId, className: "dataviews-view-list__item", onClick: () => onSelect(item) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "start", alignment: "flex-start", children: [renderedMediaField, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, className: "dataviews-view-list__field-wrapper", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-title-field", id: labelId, children: renderedTitleField }), usedActions] }), showDescription && descriptionField?.render && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__field", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(descriptionField.render, { item: item }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__fields", id: descriptionId, children: otherFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-view-list__field", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", className: "dataviews-view-list__field-label", children: field.label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-list__field-value", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { item: item }) })] }, field.id)) })] })] })] }) }); } function isDefined(item) { return !!item; } function ViewList(props) { var _view$fields; const { actions, data, fields, getItemId, isLoading, onChangeSelection, selection, view } = props; const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, 'view-list'); const selectedItem = data?.findLast(item => selection.includes(getItemId(item))); const titleField = fields.find(field => field.id === view.titleField); const mediaField = fields.find(field => field.id === view.mediaField); const descriptionField = fields.find(field => field.id === view.descriptionField); const otherFields = ((_view$fields = view?.fields) !== null && _view$fields !== void 0 ? _view$fields : []).map(fieldId => fields.find(f => fieldId === f.id)).filter(isDefined); const onSelect = item => onChangeSelection([getItemId(item)]); const generateCompositeItemIdPrefix = (0,external_wp_element_namespaceObject.useCallback)(item => `${baseId}-${getItemId(item)}`, [baseId, getItemId]); const isActiveCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((item, idToCheck) => { // All composite items use the same prefix in their IDs. return idToCheck.startsWith(generateCompositeItemIdPrefix(item)); }, [generateCompositeItemIdPrefix]); // Controlled state for the active composite item. const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)(undefined); // Update the active composite item when the selected item changes. (0,external_wp_element_namespaceObject.useEffect)(() => { if (selectedItem) { setActiveCompositeId(generateItemWrapperCompositeId(generateCompositeItemIdPrefix(selectedItem))); } }, [selectedItem, generateCompositeItemIdPrefix]); const activeItemIndex = data.findIndex(item => isActiveCompositeItem(item, activeCompositeId !== null && activeCompositeId !== void 0 ? activeCompositeId : '')); const previousActiveItemIndex = (0,external_wp_compose_namespaceObject.usePrevious)(activeItemIndex); const isActiveIdInList = activeItemIndex !== -1; const selectCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((targetIndex, generateCompositeId) => { // Clamping between 0 and data.length - 1 to avoid out of bounds. const clampedIndex = Math.min(data.length - 1, Math.max(0, targetIndex)); if (!data[clampedIndex]) { return; } const itemIdPrefix = generateCompositeItemIdPrefix(data[clampedIndex]); const targetCompositeItemId = generateCompositeId(itemIdPrefix); setActiveCompositeId(targetCompositeItemId); document.getElementById(targetCompositeItemId)?.focus(); }, [data, generateCompositeItemIdPrefix]); // Select a new active composite item when the current active item // is removed from the list. (0,external_wp_element_namespaceObject.useEffect)(() => { const wasActiveIdInList = previousActiveItemIndex !== undefined && previousActiveItemIndex !== -1; if (!isActiveIdInList && wasActiveIdInList) { // By picking `previousActiveItemIndex` as the next item index, we are // basically picking the item that would have been after the deleted one. // If the previously active (and removed) item was the last of the list, // we will select the item before it — which is the new last item. selectCompositeItem(previousActiveItemIndex, generateItemWrapperCompositeId); } }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); // Prevent the default behavior (open dropdown menu) and instead select the // dropdown menu trigger on the previous/next row. // https://github.com/ariakit/ariakit/issues/3768 const onDropdownTriggerKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => { if (event.key === 'ArrowDown') { // Select the dropdown menu trigger item in the next row. event.preventDefault(); selectCompositeItem(activeItemIndex + 1, generateDropdownTriggerCompositeId); } if (event.key === 'ArrowUp') { // Select the dropdown menu trigger item in the previous row. event.preventDefault(); selectCompositeItem(activeItemIndex - 1, generateDropdownTriggerCompositeId); } }, [selectCompositeItem, activeItemIndex]); const hasData = data?.length; if (!hasData) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx({ 'dataviews-loading': isLoading, 'dataviews-no-results': !hasData && !isLoading }), children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') }) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { id: baseId, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), className: "dataviews-view-list", role: "grid", activeId: activeCompositeId, setActiveId: setActiveCompositeId, children: data.map(item => { const id = generateCompositeItemIdPrefix(item); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListItem, { view: view, idPrefix: id, actions: actions, item: item, isSelected: item === selectedItem, onSelect: onSelect, mediaField: mediaField, titleField: titleField, descriptionField: descriptionField, otherFields: otherFields, onDropdownTriggerKeyDown: onDropdownTriggerKeyDown }, id); }) }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/density-picker.js /** * WordPress dependencies */ /** * Internal dependencies */ function DensityPicker() { const context = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const view = context.view; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)('Density'), value: view.layout?.density || 'balanced', onChange: value => { context.onChangeView({ ...view, layout: { ...view.layout, density: value } }); }, isBlock: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "comfortable", label: (0,external_wp_i18n_namespaceObject._x)('Comfortable', 'Density option for DataView layout') }, "comfortable"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "balanced", label: (0,external_wp_i18n_namespaceObject._x)('Balanced', 'Density option for DataView layout') }, "balanced"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "compact", label: (0,external_wp_i18n_namespaceObject._x)('Compact', 'Density option for DataView layout') }, "compact")] }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const VIEW_LAYOUTS = [{ type: constants_LAYOUT_TABLE, label: (0,external_wp_i18n_namespaceObject.__)('Table'), component: table, icon: block_table, viewConfigOptions: DensityPicker }, { type: constants_LAYOUT_GRID, label: (0,external_wp_i18n_namespaceObject.__)('Grid'), component: ViewGrid, icon: library_category, viewConfigOptions: PreviewSizePicker }, { type: constants_LAYOUT_LIST, label: (0,external_wp_i18n_namespaceObject.__)('List'), component: ViewList, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl : format_list_bullets }]; ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-layout/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function DataViewsLayout() { const { actions = [], data, fields, getItemId, getItemLevel, isLoading, view, onChangeView, selection, onChangeSelection, setOpenedFilter, onClickItem, isItemClickable } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const ViewComponent = VIEW_LAYOUTS.find(v => v.type === view.type)?.component; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewComponent, { actions: actions, data: data, fields: fields, getItemId: getItemId, getItemLevel: getItemLevel, isLoading: isLoading, onChangeView: onChangeView, onChangeSelection: onChangeSelection, selection: selection, setOpenedFilter: setOpenedFilter, onClickItem: onClickItem, isItemClickable: isItemClickable, view: view }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-pagination/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function DataViewsPagination() { var _view$page; const { view, onChangeView, paginationInfo: { totalItems = 0, totalPages } } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); if (!totalItems || !totalPages) { return null; } const currentPage = (_view$page = view.page) !== null && _view$page !== void 0 ? _view$page : 1; const pageSelectOptions = Array.from(Array(totalPages)).map((_, i) => { const page = i + 1; return { value: page.toString(), label: page.toString(), 'aria-label': currentPage === page ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: Current page number in total number of pages (0,external_wp_i18n_namespaceObject.__)('Page %1$s of %2$s'), currentPage, totalPages) : page.toString() }; }); return !!totalItems && totalPages !== 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, className: "dataviews-pagination", justify: "end", spacing: 6, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", expanded: false, spacing: 1, className: "dataviews-pagination__page-select", children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Current page number, 2: Total number of pages. (0,external_wp_i18n_namespaceObject._x)('<div>Page</div>%1$s<div>of %2$s</div>', 'paging'), '<CurrentPage />', totalPages), { div: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": true }), CurrentPage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'), value: currentPage.toString(), options: pageSelectOptions, onChange: newValue => { onChangeView({ ...view, page: +newValue }); }, size: "small", __nextHasNoMarginBottom: true, variant: "minimal" }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: () => onChangeView({ ...view, page: currentPage - 1 }), disabled: currentPage === 1, accessibleWhenDisabled: true, label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, showTooltip: true, size: "compact", tooltipPosition: "top" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: () => onChangeView({ ...view, page: currentPage + 1 }), disabled: currentPage >= totalPages, accessibleWhenDisabled: true, label: (0,external_wp_i18n_namespaceObject.__)('Next page'), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, showTooltip: true, size: "compact", tooltipPosition: "top" })] })] }); } /* harmony default export */ const dataviews_pagination = ((0,external_wp_element_namespaceObject.memo)(DataViewsPagination)); ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-footer/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const dataviews_footer_EMPTY_ARRAY = []; function DataViewsFooter() { const { view, paginationInfo: { totalItems = 0, totalPages }, data, actions = dataviews_footer_EMPTY_ARRAY } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type); if (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions) { return null; } return !!totalItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, justify: "end", className: "dataviews-footer", children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionsFooter, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_pagination, {})] }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-search/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const DataViewsSearch = (0,external_wp_element_namespaceObject.memo)(function Search({ label }) { const { view, onChangeView } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(view.search); (0,external_wp_element_namespaceObject.useEffect)(() => { var _view$search; setSearch((_view$search = view.search) !== null && _view$search !== void 0 ? _view$search : ''); }, [view.search, setSearch]); const onChangeViewRef = (0,external_wp_element_namespaceObject.useRef)(onChangeView); const viewRef = (0,external_wp_element_namespaceObject.useRef)(view); (0,external_wp_element_namespaceObject.useEffect)(() => { onChangeViewRef.current = onChangeView; viewRef.current = view; }, [onChangeView, view]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (debouncedSearch !== viewRef.current?.search) { onChangeViewRef.current({ ...viewRef.current, page: 1, search: debouncedSearch }); } }, [debouncedSearch]); const searchLabel = label || (0,external_wp_i18n_namespaceObject.__)('Search'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { className: "dataviews-search", __nextHasNoMarginBottom: true, onChange: setSearch, value: search, label: searchLabel, placeholder: searchLabel, size: "compact" }); }); /* harmony default export */ const dataviews_search = (DataViewsSearch); ;// ./node_modules/@wordpress/icons/build-module/library/lock.js /** * WordPress dependencies */ const lock_lock = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" }) }); /* harmony default export */ const library_lock = (lock_lock); ;// ./node_modules/@wordpress/icons/build-module/library/cog.js /** * WordPress dependencies */ const cog = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z", clipRule: "evenodd" }) }); /* harmony default export */ const library_cog = (cog); ;// external ["wp","warning"] const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Menu: dataviews_view_config_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); const DATAVIEWS_CONFIG_POPOVER_PROPS = { className: 'dataviews-config__popover', placement: 'bottom-end', offset: 9 }; function ViewTypeMenu({ defaultLayouts = { list: {}, grid: {}, table: {} } }) { const { view, onChangeView } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const availableLayouts = Object.keys(defaultLayouts); if (availableLayouts.length <= 1) { return null; } const activeView = VIEW_LAYOUTS.find(v => view.type === v.type); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", icon: activeView?.icon, label: (0,external_wp_i18n_namespaceObject.__)('Layout') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { children: availableLayouts.map(layout => { const config = VIEW_LAYOUTS.find(v => v.type === layout); if (!config) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.RadioItem, { value: layout, name: "view-actions-available-view", checked: layout === view.type, hideOnClick: true, onChange: e => { switch (e.target.value) { case 'list': case 'grid': case 'table': const viewWithoutLayout = { ...view }; if ('layout' in viewWithoutLayout) { delete viewWithoutLayout.layout; } // @ts-expect-error return onChangeView({ ...viewWithoutLayout, type: e.target.value, ...defaultLayouts[e.target.value] }); } true ? external_wp_warning_default()('Invalid dataview') : 0; }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { children: config.label }) }, layout); }) })] }); } function SortFieldControl() { const { view, fields, onChangeView } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const orderOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { const sortableFields = fields.filter(field => field.enableSorting !== false); return sortableFields.map(field => { return { label: field.label, value: field.id }; }); }, [fields]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Sort by'), value: view.sort?.field, options: orderOptions, onChange: value => { onChangeView({ ...view, sort: { direction: view?.sort?.direction || 'desc', field: value }, showLevels: false }); } }); } function SortDirectionControl() { const { view, fields, onChangeView } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const sortableFields = fields.filter(field => field.enableSorting !== false); if (sortableFields.length === 0) { return null; } let value = view.sort?.direction; if (!value && view.sort?.field) { value = 'desc'; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { className: "dataviews-view-config__sort-direction", __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, isBlock: true, label: (0,external_wp_i18n_namespaceObject.__)('Order'), value: value, onChange: newDirection => { if (newDirection === 'asc' || newDirection === 'desc') { onChangeView({ ...view, sort: { direction: newDirection, field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field. fields.find(field => field.enableSorting !== false)?.id || '' }, showLevels: false }); return; } true ? external_wp_warning_default()('Invalid direction') : 0; }, children: SORTING_DIRECTIONS.map(direction => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: direction, icon: sortIcons[direction], label: sortLabels[direction] }, direction); }) }); } const PAGE_SIZE_VALUES = [10, 20, 50, 100]; function ItemsPerPageControl() { const { view, onChangeView } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, isBlock: true, label: (0,external_wp_i18n_namespaceObject.__)('Items per page'), value: view.perPage || 10, disabled: !view?.sort?.field, onChange: newItemsPerPage => { const newItemsPerPageNumber = typeof newItemsPerPage === 'number' || newItemsPerPage === undefined ? newItemsPerPage : parseInt(newItemsPerPage, 10); onChangeView({ ...view, perPage: newItemsPerPageNumber, page: 1 }); }, children: PAGE_SIZE_VALUES.map(value => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: value, label: value.toString() }, value); }) }); } function PreviewOptions({ previewOptions, onChangePreviewOption, onMenuOpenChange, activeOption }) { const focusPreviewOptionsField = id => { // Focus the visibility button to avoid focus loss. // Our code is safe against the component being unmounted, so we don't need to worry about cleaning the timeout. // eslint-disable-next-line @wordpress/react-no-unsafe-timeout setTimeout(() => { const element = document.querySelector(`.dataviews-field-control__field-${id} .dataviews-field-control__field-preview-options-button`); if (element instanceof HTMLElement) { element.focus(); } }, 50); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { onOpenChange: onMenuOpenChange, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "dataviews-field-control__field-preview-options-button", size: "compact", icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Preview') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { children: previewOptions?.map(({ id, label }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.RadioItem, { value: id, checked: id === activeOption, onChange: () => { onChangePreviewOption?.(id); focusPreviewOptionsField(id); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { children: label }) }, id); }) })] }); } function FieldItem({ field, label, description, isVisible, isFirst, isLast, canMove = true, onToggleVisibility, onMoveUp, onMoveDown, previewOptions, onChangePreviewOption }) { const [isChangingPreviewOption, setIsChangingPreviewOption] = (0,external_wp_element_namespaceObject.useState)(false); const focusVisibilityField = () => { // Focus the visibility button to avoid focus loss. // Our code is safe against the component being unmounted, so we don't need to worry about cleaning the timeout. // eslint-disable-next-line @wordpress/react-no-unsafe-timeout setTimeout(() => { const element = document.querySelector(`.dataviews-field-control__field-${field.id} .dataviews-field-control__field-visibility-button`); if (element instanceof HTMLElement) { element.focus(); } }, 50); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: true, className: dist_clsx('dataviews-field-control__field', `dataviews-field-control__field-${field.id}`, // The actions are hidden when the mouse is not hovering the item, or focus // is outside the item. // For actions that require a popover, a menu etc, that would mean that when the interactive element // opens and the focus goes there the actions would be hidden. // To avoid that we add a class to the item, that makes sure actions are visible while there is some // interaction with the item. { 'is-interacting': isChangingPreviewOption }), justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__icon", children: !canMove && !field.enableHiding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: library_lock }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-field-control__label-sub-label-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__label", children: label || field.label }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__sub-label", children: description })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-end", expanded: false, className: "dataviews-field-control__actions", children: [isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { disabled: isFirst || !canMove, accessibleWhenDisabled: true, size: "compact", onClick: onMoveUp, icon: chevron_up, label: isFirst || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved up") : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ (0,external_wp_i18n_namespaceObject.__)('Move %s up'), field.label) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { disabled: isLast || !canMove, accessibleWhenDisabled: true, size: "compact", onClick: onMoveDown, icon: chevron_down, label: isLast || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved down") : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ (0,external_wp_i18n_namespaceObject.__)('Move %s down'), field.label) })] }), onToggleVisibility && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "dataviews-field-control__field-visibility-button", disabled: !field.enableHiding, accessibleWhenDisabled: true, size: "compact", onClick: () => { onToggleVisibility(); focusVisibilityField(); }, icon: isVisible ? library_unseen : library_seen, label: isVisible ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ (0,external_wp_i18n_namespaceObject._x)('Hide %s', 'field'), field.label) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ (0,external_wp_i18n_namespaceObject._x)('Show %s', 'field'), field.label) }), previewOptions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewOptions, { previewOptions: previewOptions, onChangePreviewOption: onChangePreviewOption, onMenuOpenChange: setIsChangingPreviewOption, activeOption: field.id })] })] }) }); } function RegularFieldItem({ index, field, view, onChangeView }) { var _view$fields; const visibleFieldIds = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; const isVisible = index !== undefined && visibleFieldIds.includes(field.id); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { field: field, isVisible: isVisible, isFirst: index !== undefined && index < 1, isLast: index !== undefined && index === visibleFieldIds.length - 1, onToggleVisibility: () => { onChangeView({ ...view, fields: isVisible ? visibleFieldIds.filter(fieldId => fieldId !== field.id) : [...visibleFieldIds, field.id] }); }, onMoveUp: index !== undefined ? () => { var _visibleFieldIds$slic; onChangeView({ ...view, fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), field.id, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] }); } : undefined, onMoveDown: index !== undefined ? () => { var _visibleFieldIds$slic2; onChangeView({ ...view, fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], field.id, ...visibleFieldIds.slice(index + 2)] }); } : undefined }); } function dataviews_view_config_isDefined(item) { return !!item; } function FieldControl() { var _view$fields2; const { view, fields, onChangeView } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const togglableFields = [view?.titleField, view?.mediaField, view?.descriptionField].filter(Boolean); const visibleFieldIds = (_view$fields2 = view.fields) !== null && _view$fields2 !== void 0 ? _view$fields2 : []; const hiddenFields = fields.filter(f => !visibleFieldIds.includes(f.id) && !togglableFields.includes(f.id) && f.type !== 'media'); const visibleFields = visibleFieldIds.map(fieldId => fields.find(f => f.id === fieldId)).filter(dataviews_view_config_isDefined); if (!visibleFields?.length && !hiddenFields?.length) { return null; } const titleField = fields.find(f => f.id === view.titleField); const previewField = fields.find(f => f.id === view.mediaField); const descriptionField = fields.find(f => f.id === view.descriptionField); const previewFields = fields.filter(f => f.type === 'media'); let previewFieldUI; if (previewFields.length > 1) { var _view$showMedia; const isPreviewFieldVisible = dataviews_view_config_isDefined(previewField) && ((_view$showMedia = view.showMedia) !== null && _view$showMedia !== void 0 ? _view$showMedia : true); previewFieldUI = dataviews_view_config_isDefined(previewField) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { field: previewField, label: (0,external_wp_i18n_namespaceObject.__)('Preview'), description: previewField.label, isVisible: isPreviewFieldVisible, onToggleVisibility: () => { onChangeView({ ...view, showMedia: !isPreviewFieldVisible }); }, canMove: false, previewOptions: previewFields.map(field => ({ label: field.label, id: field.id })), onChangePreviewOption: newPreviewId => onChangeView({ ...view, mediaField: newPreviewId }) }, previewField.id); } const lockedFields = [{ field: titleField, isVisibleFlag: 'showTitle' }, { field: previewField, isVisibleFlag: 'showMedia', ui: previewFieldUI }, { field: descriptionField, isVisibleFlag: 'showDescription' }].filter(({ field }) => dataviews_view_config_isDefined(field)); const visibleLockedFields = lockedFields.filter(({ field, isVisibleFlag }) => { var _view$isVisibleFlag; return ( // @ts-expect-error dataviews_view_config_isDefined(field) && ((_view$isVisibleFlag = view[isVisibleFlag]) !== null && _view$isVisibleFlag !== void 0 ? _view$isVisibleFlag : true) ); }); const hiddenLockedFields = lockedFields.filter(({ field, isVisibleFlag }) => { var _view$isVisibleFlag2; return ( // @ts-expect-error dataviews_view_config_isDefined(field) && !((_view$isVisibleFlag2 = view[isVisibleFlag]) !== null && _view$isVisibleFlag2 !== void 0 ? _view$isVisibleFlag2 : true) ); }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-field-control", spacing: 6, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-config__properties", spacing: 0, children: (visibleLockedFields.length > 0 || !!visibleFields?.length) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [visibleLockedFields.map(({ field, isVisibleFlag, ui }) => { return ui !== null && ui !== void 0 ? ui : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { field: field, isVisible: true, onToggleVisibility: () => { onChangeView({ ...view, [isVisibleFlag]: false }); }, canMove: false }, field.id); }), visibleFields.map((field, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RegularFieldItem, { field: field, view: view, onChangeView: onChangeView, index: index }, field.id))] }) }), (!!hiddenFields?.length || !!hiddenLockedFields.length) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { style: { margin: 0 }, children: (0,external_wp_i18n_namespaceObject.__)('Hidden') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-config__properties", spacing: 0, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [hiddenLockedFields.length > 0 && hiddenLockedFields.map(({ field, isVisibleFlag, ui }) => { return ui !== null && ui !== void 0 ? ui : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { field: field, isVisible: false, onToggleVisibility: () => { onChangeView({ ...view, [isVisibleFlag]: true }); }, canMove: false }, field.id); }), hiddenFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RegularFieldItem, { field: field, view: view, onChangeView: onChangeView }, field.id))] }) })] })] }); } function SettingsSection({ title, description, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 12, className: "dataviews-settings-section", gap: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-settings-section__sidebar", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, className: "dataviews-settings-section__title", children: title }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", className: "dataviews-settings-section__description", children: description })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 8, gap: 4, className: "dataviews-settings-section__content", children: children })] }); } function DataviewsViewConfigDropdown() { const { view } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); const popoverId = (0,external_wp_compose_namespaceObject.useInstanceId)(_DataViewsViewConfig, 'dataviews-view-config-dropdown'); const activeLayout = VIEW_LAYOUTS.find(layout => layout.type === view.type); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { expandOnMobile: true, popoverProps: { ...DATAVIEWS_CONFIG_POPOVER_PROPS, id: popoverId }, renderToggle: ({ onToggle, isOpen }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", icon: library_cog, label: (0,external_wp_i18n_namespaceObject._x)('View options', 'View is used as a noun'), onClick: onToggle, "aria-expanded": isOpen ? 'true' : 'false', "aria-controls": popoverId }); }, renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", className: "dataviews-config__popover-content-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-config", spacing: 6, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SettingsSection, { title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: true, className: "is-divided-in-two", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortFieldControl, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortDirectionControl, {})] }), !!activeLayout?.viewConfigOptions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(activeLayout.viewConfigOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemsPerPageControl, {})] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SettingsSection, { title: (0,external_wp_i18n_namespaceObject.__)('Properties'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldControl, {}) })] }) }) }); } function _DataViewsViewConfig({ defaultLayouts = { list: {}, grid: {}, table: {} } }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewTypeMenu, { defaultLayouts: defaultLayouts }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsViewConfigDropdown, {})] }); } const DataViewsViewConfig = (0,external_wp_element_namespaceObject.memo)(_DataViewsViewConfig); /* harmony default export */ const dataviews_view_config = (DataViewsViewConfig); ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const defaultGetItemId = item => item.id; const defaultIsItemClickable = () => true; const dataviews_EMPTY_ARRAY = []; function DataViews({ view, onChangeView, fields, search = true, searchLabel = undefined, actions = dataviews_EMPTY_ARRAY, data, getItemId = defaultGetItemId, getItemLevel, isLoading = false, paginationInfo, defaultLayouts, selection: selectionProperty, onChangeSelection, onClickItem, isItemClickable = defaultIsItemClickable, header }) { const [containerWidth, setContainerWidth] = (0,external_wp_element_namespaceObject.useState)(0); const containerRef = (0,external_wp_compose_namespaceObject.useResizeObserver)(resizeObserverEntries => { setContainerWidth(resizeObserverEntries[0].borderBoxSize[0].inlineSize); }, { box: 'border-box' }); const [selectionState, setSelectionState] = (0,external_wp_element_namespaceObject.useState)([]); const isUncontrolled = selectionProperty === undefined || onChangeSelection === undefined; const selection = isUncontrolled ? selectionState : selectionProperty; const [openedFilter, setOpenedFilter] = (0,external_wp_element_namespaceObject.useState)(null); function setSelectionWithChange(value) { const newValue = typeof value === 'function' ? value(selection) : value; if (isUncontrolled) { setSelectionState(newValue); } if (onChangeSelection) { onChangeSelection(newValue); } } const _fields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); const _selection = (0,external_wp_element_namespaceObject.useMemo)(() => { return selection.filter(id => data.some(item => getItemId(item) === id)); }, [selection, data, getItemId]); const filters = useFilters(_fields, view); const [isShowingFilter, setIsShowingFilter] = (0,external_wp_element_namespaceObject.useState)(() => (filters || []).some(filter => filter.isPrimary)); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_context.Provider, { value: { view, onChangeView, fields: _fields, actions, data, isLoading, paginationInfo, selection: _selection, onChangeSelection: setSelectionWithChange, openedFilter, setOpenedFilter, getItemId, getItemLevel, isItemClickable, onClickItem, containerWidth }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-wrapper", ref: containerRef, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "top", justify: "space-between", className: "dataviews__view-actions", spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "start", expanded: false, className: "dataviews__search", children: [search && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_search, { label: searchLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FiltersToggle, { filters: filters, view: view, onChangeView: onChangeView, setOpenedFilter: setOpenedFilter, setIsShowingFilter: setIsShowingFilter, isShowingFilter: isShowingFilter })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 1, expanded: false, style: { flexShrink: 0 }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config, { defaultLayouts: defaultLayouts }), header] })] }), isShowingFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_filters, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsLayout, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsFooter, {})] }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js /** * WordPress dependencies */ /** * Internal dependencies */ function usePatternSettings() { var _storedSettings$__exp; const storedSettings = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = unlock(select(store)); return getSettings(); }, []); const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0 storedSettings.__experimentalBlockPatterns; // WP 5.9 const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), []); const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter(filterOutDuplicatesByName), [settingsBlockPatterns, restBlockPatterns]); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { const { __experimentalAdditionalBlockPatterns, ...restStoredSettings } = storedSettings; return { ...restStoredSettings, __experimentalBlockPatterns: blockPatterns, isPreviewMode: true }; }, [storedSettings, blockPatterns]); return settings; } ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js /** * WordPress dependencies */ const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); /* harmony default export */ const symbol_filled = (symbolFilled); ;// ./node_modules/@wordpress/icons/build-module/library/upload.js /** * WordPress dependencies */ const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) }); /* harmony default export */ const library_upload = (upload); ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: add_new_pattern_useHistory, useLocation: add_new_pattern_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const { CreatePatternModal, useAddPatternCategory } = unlock(external_wp_patterns_namespaceObject.privateApis); const { CreateTemplatePartModal } = unlock(external_wp_editor_namespaceObject.privateApis); function AddNewPattern() { const history = add_new_pattern_useHistory(); const location = add_new_pattern_useLocation(); const [showPatternModal, setShowPatternModal] = (0,external_wp_element_namespaceObject.useState)(false); const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_namespaceObject.useState)(false); // eslint-disable-next-line @wordpress/no-unused-vars-before-return const { createPatternFromFile } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_patterns_namespaceObject.store)); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const patternUploadInputRef = (0,external_wp_element_namespaceObject.useRef)(); const { isBlockBasedTheme, addNewPatternLabel, addNewTemplatePartLabel, canCreatePattern, canCreateTemplatePart } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCurrentTheme, getPostType, canUser } = select(external_wp_coreData_namespaceObject.store); return { isBlockBasedTheme: getCurrentTheme()?.is_block_theme, addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item, addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. canCreatePattern: canUser('create', { kind: 'postType', name: PATTERN_TYPES.user }), canCreateTemplatePart: canUser('create', { kind: 'postType', name: TEMPLATE_PART_POST_TYPE }) }; }, []); function handleCreatePattern({ pattern }) { setShowPatternModal(false); history.navigate(`/${PATTERN_TYPES.user}/${pattern.id}?canvas=edit`); } function handleCreateTemplatePart(templatePart) { setShowTemplatePartModal(false); history.navigate(`/${TEMPLATE_PART_POST_TYPE}/${templatePart.id}?canvas=edit`); } function handleError() { setShowPatternModal(false); setShowTemplatePartModal(false); } const controls = []; if (canCreatePattern) { controls.push({ icon: library_symbol, onClick: () => setShowPatternModal(true), title: addNewPatternLabel }); } if (isBlockBasedTheme && canCreateTemplatePart) { controls.push({ icon: symbol_filled, onClick: () => setShowTemplatePartModal(true), title: addNewTemplatePartLabel }); } if (canCreatePattern) { controls.push({ icon: library_upload, onClick: () => { patternUploadInputRef.current.click(); }, title: (0,external_wp_i18n_namespaceObject.__)('Import pattern from JSON') }); } const { categoryMap, findOrCreateTerm } = useAddPatternCategory(); if (controls.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [addNewPatternLabel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { controls: controls, icon: null, toggleProps: { variant: 'primary', showTooltip: false, __next40pxDefaultSize: true }, text: addNewPatternLabel, label: addNewPatternLabel }), showPatternModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModal, { onClose: () => setShowPatternModal(false), onSuccess: handleCreatePattern, onError: handleError }), showTemplatePartModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModal, { closeModal: () => setShowTemplatePartModal(false), blocks: [], onCreate: handleCreateTemplatePart, onError: handleError }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { type: "file", accept: ".json", hidden: true, ref: patternUploadInputRef, onChange: async event => { const file = event.target.files?.[0]; if (!file) { return; } try { let currentCategoryId; // When we're not handling template parts, we should // add or create the proper pattern category. if (location.query.postType !== TEMPLATE_PART_POST_TYPE) { /* * categoryMap.values() returns an iterator. * Iterator.prototype.find() is not yet widely supported. * Convert to array to use the Array.prototype.find method. */ const currentCategory = Array.from(categoryMap.values()).find(term => term.name === location.query.categoryId); if (currentCategory) { currentCategoryId = currentCategory.id || (await findOrCreateTerm(currentCategory.label)); } } const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined); // Navigate to the All patterns category for the newly created pattern // if we're not on that page already and if we're not in the `my-patterns` // category. if (!currentCategoryId && location.query.categoryId !== 'my-patterns') { history.navigate(`/pattern?categoryId=${PATTERN_DEFAULT_CATEGORY}`); } createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The imported pattern's title. (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), pattern.title.raw), { type: 'snackbar', id: 'import-pattern-success' }); } catch (err) { createErrorNotice(err.message, { type: 'snackbar', id: 'import-pattern-error' }); } finally { event.target.value = ''; } } })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/rename-category-menu-item.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Internal dependencies */ const { RenamePatternCategoryModal } = unlock(external_wp_patterns_namespaceObject.privateApis); function RenameCategoryMenuItem({ category, onClose }) { const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => setIsModalOpen(true), children: (0,external_wp_i18n_namespaceObject.__)('Rename') }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_category_menu_item_RenameModal, { category: category, onClose: () => { setIsModalOpen(false); onClose(); } })] }); } function rename_category_menu_item_RenameModal({ category, onClose }) { // User created pattern categories have their properties updated when // retrieved via `getUserPatternCategories`. The rename modal expects an // object that will match the pattern category entity. const normalizedCategory = { id: category.id, slug: category.slug, name: category.label }; // Optimization - only use pattern categories when the modal is open. const existingCategories = usePatternCategories(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternCategoryModal, { category: normalizedCategory, existingCategories: existingCategories, onClose: onClose, overlayClassName: "edit-site-list__rename-modal", focusOnMount: "firstContentElement", size: "small" }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/delete-category-menu-item.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: delete_category_menu_item_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function DeleteCategoryMenuItem({ category, onClose }) { const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); const history = delete_category_menu_item_useHistory(); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { deleteEntityRecord, invalidateResolution } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const onDelete = async () => { try { await deleteEntityRecord('taxonomy', 'wp_pattern_category', category.id, { force: true }, { throwOnError: true }); // Prevent the need to refresh the page to get up-to-date categories // and pattern categorization. invalidateResolution('getUserPatternCategories'); invalidateResolution('getEntityRecords', ['postType', PATTERN_TYPES.user, { per_page: -1 }]); createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The pattern category's name */ (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'pattern category'), category.label), { type: 'snackbar', id: 'pattern-category-delete' }); onClose?.(); history.navigate(`/pattern?categoryId=${PATTERN_DEFAULT_CATEGORY}`); } catch (error) { const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the pattern category.'); createErrorNotice(errorMessage, { type: 'snackbar', id: 'pattern-category-delete' }); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { isDestructive: true, onClick: () => setIsModalOpen(true), children: (0,external_wp_i18n_namespaceObject.__)('Delete') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: isModalOpen, onConfirm: onDelete, onCancel: () => setIsModalOpen(false), confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), className: "edit-site-patterns__delete-modal", title: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The pattern category's name. (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', 'pattern category'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)), size: "medium", __experimentalHideHeader: false, children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The pattern category's name. (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)) })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/header.js /** * WordPress dependencies */ /** * Internal dependencies */ function PatternsHeader({ categoryId, type, titleId, descriptionId }) { const { patternCategories } = usePatternCategories(); const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [], []); let title, description, patternCategory; if (type === TEMPLATE_PART_POST_TYPE) { const templatePartArea = templatePartAreas.find(area => area.area === categoryId); title = templatePartArea?.label || (0,external_wp_i18n_namespaceObject.__)('All Template Parts'); description = templatePartArea?.description || (0,external_wp_i18n_namespaceObject.__)('Includes every template part defined for any area.'); } else if (type === PATTERN_TYPES.user && !!categoryId) { patternCategory = patternCategories.find(category => category.name === categoryId); title = patternCategory?.label; description = patternCategory?.description; } if (!title) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "edit-site-patterns__section-header", spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", className: "edit-site-patterns__title", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { as: "h2", level: 3, id: titleId, weight: 500, truncate: true, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPattern, {}), !!patternCategory?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Actions'), toggleProps: { className: 'edit-site-patterns__button', description: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: pattern category name */ (0,external_wp_i18n_namespaceObject.__)('Action menu for %s pattern category'), title), size: 'compact' }, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameCategoryMenuItem, { category: patternCategory, onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteCategoryMenuItem, { category: patternCategory, onClose: onClose })] }) })] })] }), description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", as: "p", id: descriptionId, className: "edit-site-patterns__sub-title", children: description }) : null] }); } ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js /** * WordPress dependencies */ const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); /* harmony default export */ const library_pencil = (pencil); ;// ./node_modules/@wordpress/icons/build-module/library/edit.js /** * Internal dependencies */ /* harmony default export */ const edit = (library_pencil); ;// ./node_modules/@wordpress/edit-site/build-module/components/dataviews-actions/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: dataviews_actions_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const useEditPostAction = () => { const history = dataviews_actions_useHistory(); return (0,external_wp_element_namespaceObject.useMemo)(() => ({ id: 'edit-post', label: (0,external_wp_i18n_namespaceObject.__)('Edit'), isPrimary: true, icon: edit, isEligible(post) { if (post.status === 'trash') { return false; } // It's eligible for all post types except theme patterns. return post.type !== PATTERN_TYPES.theme; }, callback(items) { const post = items[0]; history.navigate(`/${post.type}/${post.id}?canvas=edit`); } }), [history]); }; ;// ./node_modules/@wordpress/icons/build-module/library/plugins.js /** * WordPress dependencies */ const plugins = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" }) }); /* harmony default export */ const library_plugins = (plugins); ;// ./node_modules/@wordpress/icons/build-module/library/globe.js /** * WordPress dependencies */ const globe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z" }) }); /* harmony default export */ const library_globe = (globe); ;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js /** * WordPress dependencies */ const commentAuthorAvatar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z", clipRule: "evenodd" }) }); /* harmony default export */ const comment_author_avatar = (commentAuthorAvatar); ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/hooks.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {'wp_template'|'wp_template_part'} TemplateType */ /** * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType * * @typedef AddedByData * @type {Object} * @property {AddedByType} type The type of the data. * @property {JSX.Element} icon The icon to display. * @property {string} [imageUrl] The optional image URL to display. * @property {string} [text] The text to display. * @property {boolean} isCustomized Whether the template has been customized. * * @param {TemplateType} postType The template post type. * @param {number} postId The template post id. * @return {AddedByData} The added by object or null. */ function useAddedBy(postType, postId) { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, getMedia, getUser, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const template = getEditedEntityRecord('postType', postType, postId); const originalSource = template?.original_source; const authorText = template?.author_text; switch (originalSource) { case 'theme': { return { type: originalSource, icon: library_layout, text: authorText, isCustomized: template.source === TEMPLATE_ORIGINS.custom }; } case 'plugin': { return { type: originalSource, icon: library_plugins, text: authorText, isCustomized: template.source === TEMPLATE_ORIGINS.custom }; } case 'site': { const siteData = getEntityRecord('root', '__unstableBase'); return { type: originalSource, icon: library_globe, imageUrl: siteData?.site_logo ? getMedia(siteData.site_logo)?.source_url : undefined, text: authorText, isCustomized: false }; } default: { const user = getUser(template.author); return { type: 'user', icon: comment_author_avatar, imageUrl: user?.avatar_urls?.[48], text: authorText, isCustomized: false }; } } }, [postType, postId]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/fields.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: fields_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function PreviewField({ item }) { const descriptionId = (0,external_wp_element_namespaceObject.useId)(); const description = item.description || item?.excerpt?.raw; const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE; const [backgroundColor] = fields_useGlobalStyle('color.background'); const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { var _item$blocks; return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : (0,external_wp_blocks_namespaceObject.parse)(item.content.raw, { __unstableSkipMigrationLogs: true }); }, [item?.content?.raw, item.blocks]); const isEmpty = !blocks?.length; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "page-patterns-preview-field", style: { backgroundColor }, "aria-describedby": !!description ? descriptionId : undefined, children: [isEmpty && isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty template part'), isEmpty && !isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty pattern'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { blocks: blocks, viewportWidth: item.viewportWidth }) }), !!description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, id: descriptionId, children: description })] }); } const previewField = { label: (0,external_wp_i18n_namespaceObject.__)('Preview'), id: 'preview', render: PreviewField, enableSorting: false }; const SYNC_FILTERS = [{ value: PATTERN_SYNC_TYPES.full, label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'), description: (0,external_wp_i18n_namespaceObject.__)('Patterns that are kept in sync across the site.') }, { value: PATTERN_SYNC_TYPES.unsynced, label: (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)'), description: (0,external_wp_i18n_namespaceObject.__)('Patterns that can be changed freely without affecting the site.') }]; const patternStatusField = { label: (0,external_wp_i18n_namespaceObject.__)('Sync status'), id: 'sync-status', render: ({ item }) => { const syncStatus = 'wp_pattern_sync_status' in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced; // User patterns can have their sync statuses checked directly. // Non-user patterns are all unsynced for the time being. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: `edit-site-patterns__field-sync-status-${syncStatus}`, children: SYNC_FILTERS.find(({ value }) => value === syncStatus).label }); }, elements: SYNC_FILTERS, filterBy: { operators: [OPERATOR_IS], isPrimary: true }, enableSorting: false }; function AuthorField({ item }) { const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); const { text, icon, imageUrl } = useAddedBy(item.type, item.id); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('page-templates-author-field__avatar', { 'is-loaded': isImageLoaded }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { onLoad: () => setIsImageLoaded(true), alt: "", src: imageUrl }) }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text })] }); } const templatePartAuthorField = { label: (0,external_wp_i18n_namespaceObject.__)('Author'), id: 'author', getValue: ({ item }) => item.author_text, render: AuthorField, filterBy: { isPrimary: true } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { ExperimentalBlockEditorProvider: page_patterns_ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { usePostActions, patternTitleField } = unlock(external_wp_editor_namespaceObject.privateApis); const { useLocation: page_patterns_useLocation, useHistory: page_patterns_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const page_patterns_EMPTY_ARRAY = []; const defaultLayouts = { [LAYOUT_TABLE]: { layout: { styles: { author: { width: '1%' } } } }, [LAYOUT_GRID]: { layout: { badgeFields: ['sync-status'] } } }; const DEFAULT_VIEW = { type: LAYOUT_GRID, search: '', page: 1, perPage: 20, titleField: 'title', mediaField: 'preview', fields: ['sync-status'], filters: [], ...defaultLayouts[LAYOUT_GRID] }; function DataviewsPatterns() { const { query: { postType = 'wp_block', categoryId: categoryIdFromURL } } = page_patterns_useLocation(); const history = page_patterns_useHistory(); const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY; const [view, setView] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_VIEW); const previousCategoryId = (0,external_wp_compose_namespaceObject.usePrevious)(categoryId); const previousPostType = (0,external_wp_compose_namespaceObject.usePrevious)(postType); const viewSyncStatus = view.filters?.find(({ field }) => field === 'sync-status')?.value; const { patterns, isResolving } = use_patterns(postType, categoryId, { search: view.search, syncStatus: viewSyncStatus }); const { records } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { per_page: -1 }); const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!records) { return page_patterns_EMPTY_ARRAY; } const authorsSet = new Set(); records.forEach(template => { authorsSet.add(template.author_text); }); return Array.from(authorsSet).map(author => ({ value: author, label: author })); }, [records]); const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { const _fields = [previewField, patternTitleField]; if (postType === PATTERN_TYPES.user) { _fields.push(patternStatusField); } else if (postType === TEMPLATE_PART_POST_TYPE) { _fields.push({ ...templatePartAuthorField, elements: authors }); } return _fields; }, [postType, authors]); // Reset the page number when the category changes. (0,external_wp_element_namespaceObject.useEffect)(() => { if (previousCategoryId !== categoryId || previousPostType !== postType) { setView(prevView => ({ ...prevView, page: 1 })); } }, [categoryId, previousCategoryId, previousPostType, postType]); const { data, paginationInfo } = (0,external_wp_element_namespaceObject.useMemo)(() => { // Search is managed server-side as well as filters for patterns. // However, the author filter in template parts is done client-side. const viewWithoutFilters = { ...view }; delete viewWithoutFilters.search; if (postType !== TEMPLATE_PART_POST_TYPE) { viewWithoutFilters.filters = []; } return filterSortAndPaginate(patterns, viewWithoutFilters, fields); }, [patterns, view, fields, postType]); const dataWithPermissions = useAugmentPatternsWithPermissions(data); const templatePartActions = usePostActions({ postType: TEMPLATE_PART_POST_TYPE, context: 'list' }); const patternActions = usePostActions({ postType: PATTERN_TYPES.user, context: 'list' }); const editAction = useEditPostAction(); const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { if (postType === TEMPLATE_PART_POST_TYPE) { return [editAction, ...templatePartActions].filter(Boolean); } return [editAction, ...patternActions].filter(Boolean); }, [editAction, postType, templatePartActions, patternActions]); const id = (0,external_wp_element_namespaceObject.useId)(); const settings = usePatternSettings(); // Wrap everything in a block editor provider. // This ensures 'styles' that are needed for the previews are synced // from the site editor store to the block editor store. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_patterns_ExperimentalBlockEditorProvider, { settings: settings, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { title: (0,external_wp_i18n_namespaceObject.__)('Patterns content'), className: "edit-site-page-patterns-dataviews", hideTitleFromUI: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsHeader, { categoryId: categoryId, type: postType, titleId: `${id}-title`, descriptionId: `${id}-description` }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { paginationInfo: paginationInfo, fields: fields, actions: actions, data: dataWithPermissions || page_patterns_EMPTY_ARRAY, getItemId: item => { var _item$name; return (_item$name = item.name) !== null && _item$name !== void 0 ? _item$name : item.id; }, isLoading: isResolving, isItemClickable: item => item.type !== PATTERN_TYPES.theme, onClickItem: item => { history.navigate(`/${item.type}/${[PATTERN_TYPES.user, TEMPLATE_PART_POST_TYPE].includes(item.type) ? item.id : item.name}?canvas=edit`); }, view: view, onChangeView: setView, defaultLayouts: defaultLayouts }, categoryId + postType)] }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/patterns.js /** * Internal dependencies */ const patternsRoute = { name: 'patterns', path: '/pattern', areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? '/' : undefined; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath: backPath }); }, content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}), mobile({ siteData, query }) { const { categoryId } = query; const isBlockTheme = siteData.currentTheme?.is_block_theme; const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? '/' : undefined; return !!categoryId ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath: backPath }); } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pattern-item.js /** * Internal dependencies */ const patternItemRoute = { name: 'pattern-item', path: '/wp_block/:postId', areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? '/' : undefined; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath: backPath }); }, mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-part-item.js /** * Internal dependencies */ const templatePartItemRoute = { name: 'template-part-item', path: '/wp_template_part/*postId', areas: { sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath: "/" }), mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: content_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const content_EMPTY_ARRAY = []; function TemplateDataviewItem({ template, isActive }) { const { text, icon } = useAddedBy(template.type, template.id); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { to: (0,external_wp_url_namespaceObject.addQueryArgs)('/template', { activeView: text }), icon: icon, "aria-current": isActive, children: text }); } function DataviewsTemplatesSidebarContent() { const { query: { activeView = 'all' } } = content_useLocation(); const { records } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_POST_TYPE, { per_page: -1 }); const firstItemPerAuthorText = (0,external_wp_element_namespaceObject.useMemo)(() => { var _ref; const firstItemPerAuthor = records?.reduce((acc, template) => { const author = template.author_text; if (author && !acc[author]) { acc[author] = template; } return acc; }, {}); return (_ref = firstItemPerAuthor && Object.values(firstItemPerAuthor)) !== null && _ref !== void 0 ? _ref : content_EMPTY_ARRAY; }, [records]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-templates-browse", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { to: "/template", icon: library_layout, "aria-current": activeView === 'all', children: (0,external_wp_i18n_namespaceObject.__)('All templates') }), firstItemPerAuthorText.map(template => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateDataviewItem, { template: template, isActive: activeView === template.author_text }, template.author_text); })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function SidebarNavigationScreenTemplatesBrowse({ backPath }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)('Templates'), description: (0,external_wp_i18n_namespaceObject.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.'), backPath: backPath, content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsTemplatesSidebarContent, {}) }); } ;// ./node_modules/@wordpress/icons/build-module/library/home.js /** * WordPress dependencies */ const home = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) }); /* harmony default export */ const library_home = (home); ;// ./node_modules/@wordpress/icons/build-module/library/verse.js /** * WordPress dependencies */ const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) }); /* harmony default export */ const library_verse = (verse); ;// ./node_modules/@wordpress/icons/build-module/library/pin.js /** * WordPress dependencies */ const pin = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" }) }); /* harmony default export */ const library_pin = (pin); ;// ./node_modules/@wordpress/icons/build-module/library/archive.js /** * WordPress dependencies */ const archive = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z" }) }); /* harmony default export */ const library_archive = (archive); ;// ./node_modules/@wordpress/icons/build-module/library/not-found.js /** * WordPress dependencies */ const notFound = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z" }) }); /* harmony default export */ const not_found = (notFound); ;// ./node_modules/@wordpress/icons/build-module/library/list.js /** * WordPress dependencies */ const list = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" }) }); /* harmony default export */ const library_list = (list); ;// ./node_modules/@wordpress/icons/build-module/library/block-meta.js /** * WordPress dependencies */ const blockMeta = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z", clipRule: "evenodd" }) }); /* harmony default export */ const block_meta = (blockMeta); ;// ./node_modules/@wordpress/icons/build-module/library/calendar.js /** * WordPress dependencies */ const calendar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z" }) }); /* harmony default export */ const library_calendar = (calendar); ;// ./node_modules/@wordpress/icons/build-module/library/tag.js /** * WordPress dependencies */ const tag = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" }) }); /* harmony default export */ const library_tag = (tag); ;// ./node_modules/@wordpress/icons/build-module/library/media.js /** * WordPress dependencies */ const media = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7 6.5 4 2.5-4 2.5z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z" })] }); /* harmony default export */ const library_media = (media); ;// ./node_modules/@wordpress/icons/build-module/library/post.js /** * WordPress dependencies */ const post_post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" }) }); /* harmony default export */ const library_post = (post_post); ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ const EMPTY_OBJECT = {}; /** * @typedef IHasNameAndId * @property {string|number} id The entity's id. * @property {string} name The entity's name. */ const utils_getValueFromObjectPath = (object, path) => { let value = object; path.split('.').forEach(fieldName => { value = value?.[fieldName]; }); return value; }; /** * Helper util to map records to add a `name` prop from a * provided path, in order to handle all entities in the same * fashion(implementing`IHasNameAndId` interface). * * @param {Object[]} entities The array of entities. * @param {string} path The path to map a `name` property from the entity. * @return {IHasNameAndId[]} An array of entities that now implement the `IHasNameAndId` interface. */ const mapToIHasNameAndId = (entities, path) => { return (entities || []).map(entity => ({ ...entity, name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path)) })); }; /** * @typedef {Object} EntitiesInfo * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..). * @property {number[]} existingEntitiesIds An array of the existing entities ids. */ const useExistingTemplates = () => { return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_POST_TYPE, { per_page: -1 }), []); }; const useDefaultTemplateTypes = () => { return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types || [], []); }; const usePublicPostTypes = () => { const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostTypes({ per_page: -1 }), []); return (0,external_wp_element_namespaceObject.useMemo)(() => { const excludedPostTypes = ['attachment']; return postTypes?.filter(({ viewable, slug }) => viewable && !excludedPostTypes.includes(slug)); }, [postTypes]); }; const usePublicTaxonomies = () => { const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTaxonomies({ per_page: -1 }), []); return (0,external_wp_element_namespaceObject.useMemo)(() => { return taxonomies?.filter(({ visibility }) => visibility?.publicly_queryable); }, [taxonomies]); }; function usePostTypeArchiveMenuItems() { const publicPostTypes = usePublicPostTypes(); const postTypesWithArchives = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.filter(postType => postType.has_archive), [publicPostTypes]); const existingTemplates = useExistingTemplates(); // We need to keep track of naming conflicts. If a conflict // occurs, we need to add slug. const postTypeLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { labels }) => { const singularName = labels.singular_name.toLowerCase(); accumulator[singularName] = (accumulator[singularName] || 0) + 1; return accumulator; }, {}), [publicPostTypes]); const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ labels, slug }) => { const singularName = labels.singular_name.toLowerCase(); return postTypeLabels[singularName] > 1 && singularName !== slug; }, [postTypeLabels]); return (0,external_wp_element_namespaceObject.useMemo)(() => postTypesWithArchives?.filter(postType => !(existingTemplates || []).some(existingTemplate => existingTemplate.slug === 'archive-' + postType.slug)).map(postType => { let title; if (needsUniqueIdentifier(postType)) { title = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". (0,external_wp_i18n_namespaceObject.__)('Archive: %1$s (%2$s)'), postType.labels.singular_name, postType.slug); } else { title = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post". (0,external_wp_i18n_namespaceObject.__)('Archive: %s'), postType.labels.singular_name); } return { slug: 'archive-' + postType.slug, description: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post". (0,external_wp_i18n_namespaceObject.__)('Displays an archive with the latest posts of type: %s.'), postType.labels.singular_name), title, // `icon` is the `menu_icon` property of a post type. We // only handle `dashicons` for now, even if the `menu_icon` // also supports urls and svg as values. icon: typeof postType.icon === 'string' && postType.icon.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive, templatePrefix: 'archive' }; }) || [], [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]); } const usePostTypeMenuItems = onClickMenuItem => { const publicPostTypes = usePublicPostTypes(); const existingTemplates = useExistingTemplates(); const defaultTemplateTypes = useDefaultTemplateTypes(); // We need to keep track of naming conflicts. If a conflict // occurs, we need to add slug. const templateLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { labels }) => { const templateName = (labels.template_name || labels.singular_name).toLowerCase(); accumulator[templateName] = (accumulator[templateName] || 0) + 1; return accumulator; }, {}), [publicPostTypes]); const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ labels, slug }) => { const templateName = (labels.template_name || labels.singular_name).toLowerCase(); return templateLabels[templateName] > 1 && templateName !== slug; }, [templateLabels]); // `page`is a special case in template hierarchy. const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { slug }) => { let suffix = slug; if (slug !== 'page') { suffix = `single-${suffix}`; } accumulator[slug] = suffix; return accumulator; }, {}), [publicPostTypes]); const postTypesInfo = useEntitiesInfo('postType', templatePrefixes); const existingTemplateSlugs = (existingTemplates || []).map(({ slug }) => slug); const menuItems = (publicPostTypes || []).reduce((accumulator, postType) => { const { slug, labels, icon } = postType; // We need to check if the general template is part of the // defaultTemplateTypes. If it is, just use that info and // augment it with the specific template functionality. const generalTemplateSlug = templatePrefixes[slug]; const defaultTemplateType = defaultTemplateTypes?.find(({ slug: _slug }) => _slug === generalTemplateSlug); const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); const _needsUniqueIdentifier = needsUniqueIdentifier(postType); let menuItemTitle = labels.template_name || (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post". (0,external_wp_i18n_namespaceObject.__)('Single item: %s'), labels.singular_name); if (_needsUniqueIdentifier) { menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book". (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'post type menu label'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book". (0,external_wp_i18n_namespaceObject._x)('Single item: %1$s (%2$s)', 'post type menu label'), labels.singular_name, slug); } const menuItem = defaultTemplateType ? { ...defaultTemplateType, templatePrefix: templatePrefixes[slug] } : { slug: generalTemplateSlug, title: menuItemTitle, description: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post". (0,external_wp_i18n_namespaceObject.__)('Displays a single item: %s.'), labels.singular_name), // `icon` is the `menu_icon` property of a post type. We // only handle `dashicons` for now, even if the `menu_icon` // also supports urls and svg as values. icon: typeof icon === 'string' && icon.startsWith('dashicons-') ? icon.slice(10) : library_post, templatePrefix: templatePrefixes[slug] }; const hasEntities = postTypesInfo?.[slug]?.hasEntities; // We have a different template creation flow only if they have entities. if (hasEntities) { menuItem.onClick = template => { onClickMenuItem({ type: 'postType', slug, config: { recordNamePath: 'title.rendered', queryArgs: ({ search }) => { return { _fields: 'id,title,slug,link', orderBy: search ? 'relevance' : 'modified', exclude: postTypesInfo[slug].existingEntitiesIds }; }, getSpecificTemplate: suggestion => { const templateSlug = `${templatePrefixes[slug]}-${suggestion.slug}`; return { title: templateSlug, slug: templateSlug, templatePrefix: templatePrefixes[slug] }; } }, labels, hasGeneralTemplate, template }); }; } // We don't need to add the menu item if there are no // entities and the general template exists. if (!hasGeneralTemplate || hasEntities) { accumulator.push(menuItem); } return accumulator; }, []); // Split menu items into two groups: one for the default post types // and one for the rest. const postTypesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, postType) => { const { slug } = postType; let key = 'postTypesMenuItems'; if (slug === 'page') { key = 'defaultPostTypesMenuItems'; } accumulator[key].push(postType); return accumulator; }, { defaultPostTypesMenuItems: [], postTypesMenuItems: [] }), [menuItems]); return postTypesMenuItems; }; const useTaxonomiesMenuItems = onClickMenuItem => { const publicTaxonomies = usePublicTaxonomies(); const existingTemplates = useExistingTemplates(); const defaultTemplateTypes = useDefaultTemplateTypes(); // `category` and `post_tag` are special cases in template hierarchy. const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicTaxonomies?.reduce((accumulator, { slug }) => { let suffix = slug; if (!['category', 'post_tag'].includes(slug)) { suffix = `taxonomy-${suffix}`; } if (slug === 'post_tag') { suffix = `tag`; } accumulator[slug] = suffix; return accumulator; }, {}), [publicTaxonomies]); // We need to keep track of naming conflicts. If a conflict // occurs, we need to add slug. const taxonomyLabels = publicTaxonomies?.reduce((accumulator, { labels }) => { const templateName = (labels.template_name || labels.singular_name).toLowerCase(); accumulator[templateName] = (accumulator[templateName] || 0) + 1; return accumulator; }, {}); const needsUniqueIdentifier = (labels, slug) => { if (['category', 'post_tag'].includes(slug)) { return false; } const templateName = (labels.template_name || labels.singular_name).toLowerCase(); return taxonomyLabels[templateName] > 1 && templateName !== slug; }; const taxonomiesInfo = useEntitiesInfo('taxonomy', templatePrefixes); const existingTemplateSlugs = (existingTemplates || []).map(({ slug }) => slug); const menuItems = (publicTaxonomies || []).reduce((accumulator, taxonomy) => { const { slug, labels } = taxonomy; // We need to check if the general template is part of the // defaultTemplateTypes. If it is, just use that info and // augment it with the specific template functionality. const generalTemplateSlug = templatePrefixes[slug]; const defaultTemplateType = defaultTemplateTypes?.find(({ slug: _slug }) => _slug === generalTemplateSlug); const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); const _needsUniqueIdentifier = needsUniqueIdentifier(labels, slug); let menuItemTitle = labels.template_name || labels.singular_name; if (_needsUniqueIdentifier) { menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Name of the template e.g: "Products by Category". 2s: Slug of the taxonomy e.g: "product_cat". (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'taxonomy template menu label'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat". (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'taxonomy menu label'), labels.singular_name, slug); } const menuItem = defaultTemplateType ? { ...defaultTemplateType, templatePrefix: templatePrefixes[slug] } : { slug: generalTemplateSlug, title: menuItemTitle, description: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the taxonomy e.g: "Product Categories". (0,external_wp_i18n_namespaceObject.__)('Displays taxonomy: %s.'), labels.singular_name), icon: block_meta, templatePrefix: templatePrefixes[slug] }; const hasEntities = taxonomiesInfo?.[slug]?.hasEntities; // We have a different template creation flow only if they have entities. if (hasEntities) { menuItem.onClick = template => { onClickMenuItem({ type: 'taxonomy', slug, config: { queryArgs: ({ search }) => { return { _fields: 'id,name,slug,link', orderBy: search ? 'name' : 'count', exclude: taxonomiesInfo[slug].existingEntitiesIds }; }, getSpecificTemplate: suggestion => { const templateSlug = `${templatePrefixes[slug]}-${suggestion.slug}`; return { title: templateSlug, slug: templateSlug, templatePrefix: templatePrefixes[slug] }; } }, labels, hasGeneralTemplate, template }); }; } // We don't need to add the menu item if there are no // entities and the general template exists. if (!hasGeneralTemplate || hasEntities) { accumulator.push(menuItem); } return accumulator; }, []); // Split menu items into two groups: one for the default taxonomies // and one for the rest. const taxonomiesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, taxonomy) => { const { slug } = taxonomy; let key = 'taxonomiesMenuItems'; if (['category', 'tag'].includes(slug)) { key = 'defaultTaxonomiesMenuItems'; } accumulator[key].push(taxonomy); return accumulator; }, { defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }), [menuItems]); return taxonomiesMenuItems; }; const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: 'author' }; const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: 'authors' } }; function useAuthorMenuItem(onClickMenuItem) { const existingTemplates = useExistingTemplates(); const defaultTemplateTypes = useDefaultTemplateTypes(); const authorInfo = useEntitiesInfo('root', USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS); let authorMenuItem = defaultTemplateTypes?.find(({ slug }) => slug === 'author'); if (!authorMenuItem) { authorMenuItem = { description: (0,external_wp_i18n_namespaceObject.__)('Displays latest posts written by a single author.'), slug: 'author', title: 'Author' }; } const hasGeneralTemplate = !!existingTemplates?.find(({ slug }) => slug === 'author'); if (authorInfo.user?.hasEntities) { authorMenuItem = { ...authorMenuItem, templatePrefix: 'author' }; authorMenuItem.onClick = template => { onClickMenuItem({ type: 'root', slug: 'user', config: { queryArgs: ({ search }) => { return { _fields: 'id,name,slug,link', orderBy: search ? 'name' : 'registered_date', exclude: authorInfo.user.existingEntitiesIds, who: 'authors' }; }, getSpecificTemplate: suggestion => { const templateSlug = `author-${suggestion.slug}`; return { title: templateSlug, slug: templateSlug, templatePrefix: 'author' }; } }, labels: { singular_name: (0,external_wp_i18n_namespaceObject.__)('Author'), search_items: (0,external_wp_i18n_namespaceObject.__)('Search Authors'), not_found: (0,external_wp_i18n_namespaceObject.__)('No authors found.'), all_items: (0,external_wp_i18n_namespaceObject.__)('All Authors') }, hasGeneralTemplate, template }); }; } if (!hasGeneralTemplate || authorInfo.user?.hasEntities) { return authorMenuItem; } } /** * Helper hook that filters all the existing templates by the given * object with the entity's slug as key and the template prefix as value. * * Example: * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ] * `templatePrefixes` is: { post_tag: 'tag' } * It will return: { post_tag: ['apple'] } * * Note: We append the `-` to the given template prefix in this function for our checks. * * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value. */ const useExistingTemplateSlugs = templatePrefixes => { const existingTemplates = useExistingTemplates(); const existingSlugs = (0,external_wp_element_namespaceObject.useMemo)(() => { return Object.entries(templatePrefixes || {}).reduce((accumulator, [slug, prefix]) => { const slugsWithTemplates = (existingTemplates || []).reduce((_accumulator, existingTemplate) => { const _prefix = `${prefix}-`; if (existingTemplate.slug.startsWith(_prefix)) { _accumulator.push(existingTemplate.slug.substring(_prefix.length)); } return _accumulator; }, []); if (slugsWithTemplates.length) { accumulator[slug] = slugsWithTemplates; } return accumulator; }, {}); }, [templatePrefixes, existingTemplates]); return existingSlugs; }; /** * Helper hook that finds the existing records with an associated template, * as they need to be excluded from the template suggestions. * * @param {string} entityName The entity's name. * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value. */ const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => { const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes); const recordsToExcludePerEntity = (0,external_wp_data_namespaceObject.useSelect)(select => { return Object.entries(slugsToExcludePerEntity || {}).reduce((accumulator, [slug, slugsWithTemplates]) => { const entitiesWithTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { _fields: 'id', context: 'view', slug: slugsWithTemplates, ...additionalQueryParameters[slug] }); if (entitiesWithTemplates?.length) { accumulator[slug] = entitiesWithTemplates; } return accumulator; }, {}); }, [slugsToExcludePerEntity]); return recordsToExcludePerEntity; }; /** * Helper hook that returns information about an entity having * records that we can create a specific template for. * * For example we can search for `terms` in `taxonomy` entity or * `posts` in `postType` entity. * * First we need to find the existing records with an associated template, * to query afterwards for any remaining record, by excluding them. * * @param {string} entityName The entity's name. * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value. */ const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => { const recordsToExcludePerEntity = useTemplatesToExclude(entityName, templatePrefixes, additionalQueryParameters); const entitiesHasRecords = (0,external_wp_data_namespaceObject.useSelect)(select => { return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ id }) => id) || []; accumulator[slug] = !!select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { per_page: 1, _fields: 'id', context: 'view', exclude: existingEntitiesIds, ...additionalQueryParameters[slug] })?.length; return accumulator; }, {}); }, [templatePrefixes, recordsToExcludePerEntity, entityName, additionalQueryParameters]); const entitiesInfo = (0,external_wp_element_namespaceObject.useMemo)(() => { return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ id }) => id) || []; accumulator[slug] = { hasEntities: entitiesHasRecords[slug], existingEntitiesIds }; return accumulator; }, {}); }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]); return entitiesInfo; }; ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js /** * WordPress dependencies */ /** * Internal dependencies */ const add_custom_template_modal_content_EMPTY_ARRAY = []; function SuggestionListItem({ suggestion, search, onSelect, entityForSuggestions }) { const baseCssClass = 'edit-site-custom-template-modal__suggestions_list__list-item'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, role: "option", className: baseCssClass, onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion)) }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { size: "body", lineHeight: 1.53846153846 // 20px , weight: 500, className: `${baseCssClass}__title`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextHighlight, { text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name), highlight: search }) }), suggestion.link && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { size: "body", lineHeight: 1.53846153846 // 20px , className: `${baseCssClass}__info`, children: suggestion.link })] }); } function useSearchSuggestions(entityForSuggestions, search) { const { config } = entityForSuggestions; const query = (0,external_wp_element_namespaceObject.useMemo)(() => ({ order: 'asc', context: 'view', search, per_page: search ? 20 : 10, ...config.queryArgs(search) }), [search, config]); const { records: searchResults, hasResolved: searchHasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(entityForSuggestions.type, entityForSuggestions.slug, query); const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(add_custom_template_modal_content_EMPTY_ARRAY); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!searchHasResolved) { return; } let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY; if (searchResults?.length) { newSuggestions = searchResults; if (config.recordNamePath) { newSuggestions = mapToIHasNameAndId(newSuggestions, config.recordNamePath); } } // Update suggestions only when the query has resolved, so as to keep // the previous results in the UI. setSuggestions(newSuggestions); }, [searchResults, searchHasResolved]); return suggestions; } function SuggestionList({ entityForSuggestions, onSelect }) { const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(); const suggestions = useSearchSuggestions(entityForSuggestions, debouncedSearch); const { labels } = entityForSuggestions; const [showSearchControl, setShowSearchControl] = (0,external_wp_element_namespaceObject.useState)(false); if (!showSearchControl && suggestions?.length > 9) { setShowSearchControl(true); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [showSearchControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, onChange: setSearch, value: search, label: labels.search_items, placeholder: labels.search_items }), !!suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { orientation: "vertical", role: "listbox", className: "edit-site-custom-template-modal__suggestions_list", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Suggestions list'), children: suggestions.map(suggestion => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionListItem, { suggestion: suggestion, search: debouncedSearch, onSelect: onSelect, entityForSuggestions: entityForSuggestions }, suggestion.slug)) }), debouncedSearch && !suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", className: "edit-site-custom-template-modal__no-results", children: labels.not_found })] }); } function AddCustomTemplateModalContent({ onSelect, entityForSuggestions }) { const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_namespaceObject.useState)(entityForSuggestions.hasGeneralTemplate); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, className: "edit-site-custom-template-modal__contents-wrapper", alignment: "left", children: [!showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)('Select whether to create a single template for all items or a specific one.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { className: "edit-site-custom-template-modal__contents", gap: "4", align: "initial", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, as: external_wp_components_namespaceObject.Button, onClick: () => { const { slug, title, description, templatePrefix } = entityForSuggestions.template; onSelect({ slug, title, description, templatePrefix }); }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "span", weight: 500, lineHeight: 1.53846153846 // 20px , children: entityForSuggestions.labels.all_items }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "span", lineHeight: 1.53846153846 // 20px , children: // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. (0,external_wp_i18n_namespaceObject.__)('For all items') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, as: external_wp_components_namespaceObject.Button, onClick: () => { setShowSearchEntities(true); }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "span", weight: 500, lineHeight: 1.53846153846 // 20px , children: entityForSuggestions.labels.singular_name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "span", lineHeight: 1.53846153846 // 20px , children: // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. (0,external_wp_i18n_namespaceObject.__)('For a specific item') })] })] })] }), showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)('This template will be used only for the specific item chosen.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionList, { entityForSuggestions: entityForSuggestions, onSelect: onSelect })] })] }); } /* harmony default export */ const add_custom_template_modal_content = (AddCustomTemplateModalContent); ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/dot-case/dist.es2015/index.js function dotCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "." }, options)); } ;// ./node_modules/param-case/dist.es2015/index.js function paramCase(input, options) { if (options === void 0) { options = {}; } return dotCase(input, __assign({ delimiter: "-" }, options)); } ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js /** * External dependencies */ /** * WordPress dependencies */ function AddCustomGenericTemplateModalContent({ onClose, createTemplate }) { const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); async function onCreateTemplate(event) { event.preventDefault(); if (isBusy) { return; } setIsBusy(true); try { await createTemplate({ slug: 'wp-custom-template-' + paramCase(title || defaultTitle), title: title || defaultTitle }, false); } finally { setIsBusy(false); } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onCreateTemplate, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 6, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Name'), value: title, onChange: setTitle, placeholder: defaultTitle, disabled: isBusy, help: (0,external_wp_i18n_namespaceObject.__)( // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "edit-site-custom-generic-template__modal-actions", justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", isBusy: isBusy, "aria-disabled": isBusy, children: (0,external_wp_i18n_namespaceObject.__)('Create') })] })] }) }); } /* harmony default export */ const add_custom_generic_template_modal_content = (AddCustomGenericTemplateModalContent); ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Internal dependencies */ const { useHistory: add_new_template_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'home', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'search', '404']; const TEMPLATE_ICONS = { 'front-page': library_home, home: library_verse, single: library_pin, page: library_page, archive: library_archive, search: library_search, 404: not_found, index: library_list, category: library_category, author: comment_author_avatar, taxonomy: block_meta, date: library_calendar, tag: library_tag, attachment: library_media }; function TemplateListItem({ title, direction, className, description, icon, onClick, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: className, onClick: onClick, label: description, showTooltip: !!description, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { as: "span", spacing: 2, align: "center", justify: "center", style: { width: '100%' }, direction: direction, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-add-new-template__template-icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "edit-site-add-new-template__template-name", alignment: "center", spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { align: "center", weight: 500, lineHeight: 1.53846153846 // 20px , children: title }), children] })] }) }); } const modalContentMap = { templatesList: 1, customTemplate: 2, customGenericTemplate: 3 }; function NewTemplateModal({ onClose }) { const [modalContent, setModalContent] = (0,external_wp_element_namespaceObject.useState)(modalContentMap.templatesList); const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_namespaceObject.useState)({}); const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); const missingTemplates = useMissingTemplates(setEntityForSuggestions, () => setModalContent(modalContentMap.customTemplate)); const history = add_new_template_useHistory(); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { // Site index. return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; }, []); const TEMPLATE_SHORT_DESCRIPTIONS = { 'front-page': homeUrl, date: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The homepage url. (0,external_wp_i18n_namespaceObject.__)('E.g. %s'), homeUrl + '/' + new Date().getFullYear()) }; async function createTemplate(template, isWPSuggestion = true) { if (isSubmitting) { return; } setIsSubmitting(true); try { const { title, description, slug } = template; const newTemplate = await saveEntityRecord('postType', TEMPLATE_POST_TYPE, { description, // Slugs need to be strings, so this is for template `404` slug: slug.toString(), status: 'publish', title, // This adds a post meta field in template that is part of `is_custom` value calculation. is_wp_suggestion: isWPSuggestion }, { throwOnError: true }); // Navigate to the created template editor. history.navigate(`/${TEMPLATE_POST_TYPE}/${newTemplate.id}?canvas=edit`); createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of the created post or template, e.g: "Hello world". (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title)), { type: 'snackbar' }); } catch (error) { const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.'); createErrorNotice(errorMessage, { type: 'snackbar' }); } finally { setIsSubmitting(false); } } const onModalClose = () => { onClose(); setModalContent(modalContentMap.templatesList); }; let modalTitle = (0,external_wp_i18n_namespaceObject.__)('Add template'); if (modalContent === modalContentMap.customTemplate) { modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post". (0,external_wp_i18n_namespaceObject.__)('Add template: %s'), entityForSuggestions.labels.singular_name); } else if (modalContent === modalContentMap.customGenericTemplate) { modalTitle = (0,external_wp_i18n_namespaceObject.__)('Create custom template'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { title: modalTitle, className: dist_clsx('edit-site-add-new-template__modal', { 'edit-site-add-new-template__modal_template_list': modalContent === modalContentMap.templatesList, 'edit-site-custom-template-modal': modalContent === modalContentMap.customTemplate }), onRequestClose: onModalClose, overlayClassName: modalContent === modalContentMap.customGenericTemplate ? 'edit-site-custom-generic-template__modal' : undefined, children: [modalContent === modalContentMap.templatesList && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: isMobile ? 2 : 3, gap: 4, align: "flex-start", justify: "center", className: "edit-site-add-new-template__template-list__contents", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "edit-site-add-new-template__template-list__prompt", children: (0,external_wp_i18n_namespaceObject.__)('Select what the new template should apply to:') }), missingTemplates.map(template => { const { title, slug, onClick } = template; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { title: title, direction: "column", className: "edit-site-add-new-template__template-button", description: TEMPLATE_SHORT_DESCRIPTIONS[slug], icon: TEMPLATE_ICONS[slug] || library_layout, onClick: () => onClick ? onClick(template) : createTemplate(template) }, slug); }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { title: (0,external_wp_i18n_namespaceObject.__)('Custom template'), direction: "row", className: "edit-site-add-new-template__custom-template-button", icon: edit, onClick: () => setModalContent(modalContentMap.customGenericTemplate), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { lineHeight: 1.53846153846 // 20px , children: (0,external_wp_i18n_namespaceObject.__)('A custom template can be manually applied to any post or page.') }) })] }), modalContent === modalContentMap.customTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_template_modal_content, { onSelect: createTemplate, entityForSuggestions: entityForSuggestions }), modalContent === modalContentMap.customGenericTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_generic_template_modal_content, { onClose: onModalClose, createTemplate: createTemplate })] }); } function NewTemplate() { const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); const { postType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { postType: getPostType(TEMPLATE_POST_TYPE) }; }, []); if (!postType) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", onClick: () => setShowModal(true), label: postType.labels.add_new_item, __next40pxDefaultSize: true, children: postType.labels.add_new_item }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NewTemplateModal, { onClose: () => setShowModal(false) })] }); } function useMissingTemplates(setEntityForSuggestions, onClick) { const existingTemplates = useExistingTemplates(); const defaultTemplateTypes = useDefaultTemplateTypes(); const existingTemplateSlugs = (existingTemplates || []).map(({ slug }) => slug); const missingDefaultTemplates = (defaultTemplateTypes || []).filter(template => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug)); const onClickMenuItem = _entityForSuggestions => { onClick?.(); setEntityForSuggestions(_entityForSuggestions); }; // We need to replace existing default template types with // the create specific template functionality. The original // info (title, description, etc.) is preserved in the // used hooks. const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates]; const { defaultTaxonomiesMenuItems, taxonomiesMenuItems } = useTaxonomiesMenuItems(onClickMenuItem); const { defaultPostTypesMenuItems, postTypesMenuItems } = usePostTypeMenuItems(onClickMenuItem); const authorMenuItem = useAuthorMenuItem(onClickMenuItem); [...defaultTaxonomiesMenuItems, ...defaultPostTypesMenuItems, authorMenuItem].forEach(menuItem => { if (!menuItem) { return; } const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(template => template.slug === menuItem.slug); // Some default template types might have been filtered above from // `missingDefaultTemplates` because they only check for the general // template. So here we either replace or append the item, augmented // with the check if it has available specific item to create a // template for. if (matchIndex > -1) { enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem; } else { enhancedMissingDefaultTemplateTypes.push(menuItem); } }); // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order. enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => { return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug); }); const missingTemplates = [...enhancedMissingDefaultTemplateTypes, ...usePostTypeArchiveMenuItems(), ...postTypesMenuItems, ...taxonomiesMenuItems]; return missingTemplates; } /* harmony default export */ const add_new_template = ((0,external_wp_element_namespaceObject.memo)(NewTemplate)); ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/fields.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useGlobalStyle: page_templates_fields_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function fields_PreviewField({ item }) { const settings = usePatternSettings(); const [backgroundColor = 'white'] = page_templates_fields_useGlobalStyle('color.background'); const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { return (0,external_wp_blocks_namespaceObject.parse)(item.content.raw); }, [item.content.raw]); const isEmpty = !blocks?.length; // Wrap everything in a block editor provider to ensure 'styles' that are needed // for the previews are synced between the site editor store and the block editor store. // Additionally we need to have the `__experimentalBlockPatterns` setting in order to // render patterns inside the previews. // TODO: Same approach is used in the patterns list and it becomes obvious that some of // the block editor settings are needed in context where we don't have the block editor. // Explore how we can solve this in a better way. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorProvider, { post: item, settings: settings, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "page-templates-preview-field", style: { backgroundColor }, children: [isEmpty && (0,external_wp_i18n_namespaceObject.__)('Empty template'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { blocks: blocks }) })] }) }); } const fields_previewField = { label: (0,external_wp_i18n_namespaceObject.__)('Preview'), id: 'preview', render: fields_PreviewField, enableSorting: false }; const descriptionField = { label: (0,external_wp_i18n_namespaceObject.__)('Description'), id: 'description', render: ({ item }) => { return item.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-description", children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description) }); }, enableSorting: false, enableGlobalSearch: true }; function fields_AuthorField({ item }) { const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); const { text, icon, imageUrl } = useAddedBy(item.type, item.id); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('page-templates-author-field__avatar', { 'is-loaded': isImageLoaded }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { onLoad: () => setIsImageLoaded(true), alt: "", src: imageUrl }) }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text })] }); } const authorField = { label: (0,external_wp_i18n_namespaceObject.__)('Author'), id: 'author', getValue: ({ item }) => item.author_text, render: fields_AuthorField }; ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { usePostActions: page_templates_usePostActions, templateTitleField } = unlock(external_wp_editor_namespaceObject.privateApis); const { useHistory: page_templates_useHistory, useLocation: page_templates_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const { useEntityRecordsWithPermissions } = unlock(external_wp_coreData_namespaceObject.privateApis); const page_templates_EMPTY_ARRAY = []; const page_templates_defaultLayouts = { [LAYOUT_TABLE]: { showMedia: false, layout: { styles: { author: { width: '1%' } } } }, [LAYOUT_GRID]: { showMedia: true }, [LAYOUT_LIST]: { showMedia: false } }; const page_templates_DEFAULT_VIEW = { type: LAYOUT_GRID, search: '', page: 1, perPage: 20, sort: { field: 'title', direction: 'asc' }, titleField: 'title', descriptionField: 'description', mediaField: 'preview', fields: ['author'], filters: [], ...page_templates_defaultLayouts[LAYOUT_GRID] }; function PageTemplates() { const { path, query } = page_templates_useLocation(); const { activeView = 'all', layout, postId } = query; const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)([postId]); const defaultView = (0,external_wp_element_namespaceObject.useMemo)(() => { const usedType = layout !== null && layout !== void 0 ? layout : page_templates_DEFAULT_VIEW.type; return { ...page_templates_DEFAULT_VIEW, type: usedType, filters: activeView !== 'all' ? [{ field: 'author', operator: 'isAny', value: [activeView] }] : [], ...page_templates_defaultLayouts[usedType] }; }, [layout, activeView]); const [view, setView] = (0,external_wp_element_namespaceObject.useState)(defaultView); // Sync the layout from the URL to the view state. (0,external_wp_element_namespaceObject.useEffect)(() => { setView(currentView => ({ ...currentView, type: layout !== null && layout !== void 0 ? layout : page_templates_DEFAULT_VIEW.type })); }, [setView, layout]); // Sync the active view from the URL to the view state. (0,external_wp_element_namespaceObject.useEffect)(() => { setView(currentView => ({ ...currentView, filters: activeView !== 'all' ? [{ field: 'author', operator: OPERATOR_IS_ANY, value: [activeView] }] : [] })); }, [setView, activeView]); const { records, isResolving: isLoadingData } = useEntityRecordsWithPermissions('postType', TEMPLATE_POST_TYPE, { per_page: -1 }); const history = page_templates_useHistory(); const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { setSelection(items); if (view?.type === LAYOUT_LIST) { history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { postId: items.length === 1 ? items[0] : undefined })); } }, [history, path, view?.type]); const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!records) { return page_templates_EMPTY_ARRAY; } const authorsSet = new Set(); records.forEach(template => { authorsSet.add(template.author_text); }); return Array.from(authorsSet).map(author => ({ value: author, label: author })); }, [records]); const fields = (0,external_wp_element_namespaceObject.useMemo)(() => [fields_previewField, templateTitleField, descriptionField, { ...authorField, elements: authors }], [authors]); const { data, paginationInfo } = (0,external_wp_element_namespaceObject.useMemo)(() => { return filterSortAndPaginate(records, view, fields); }, [records, view, fields]); const postTypeActions = page_templates_usePostActions({ postType: TEMPLATE_POST_TYPE, context: 'list' }); const editAction = useEditPostAction(); const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); const onChangeView = (0,external_wp_compose_namespaceObject.useEvent)(newView => { setView(newView); if (newView.type !== layout) { history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { layout: newView.type })); } }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { className: "edit-site-page-templates", title: (0,external_wp_i18n_namespaceObject.__)('Templates'), actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_template, {}), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { paginationInfo: paginationInfo, fields: fields, actions: actions, data: data, isLoading: isLoadingData, view: view, onChangeView: onChangeView, onChangeSelection: onChangeSelection, isItemClickable: () => true, onClickItem: ({ id }) => { history.navigate(`/wp_template/${id}?canvas=edit`); }, selection: selection, defaultLayouts: page_templates_defaultLayouts }, activeView) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/templates.js /** * Internal dependencies */ const templatesRoute = { name: 'templates', path: '/template', areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, content({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : undefined; }, preview({ query, siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; if (!isBlockTheme) { return undefined; } const isListView = query.layout === 'list'; return isListView ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : undefined; }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); } }, widths: { content({ query }) { const isListView = query.layout === 'list'; return isListView ? 380 : undefined; } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-item.js /** * Internal dependencies */ const templateItemRoute = { name: 'template-item', path: '/wp_template/*postId', areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, preview({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); } } }; ;// ./node_modules/@wordpress/icons/build-module/library/pages.js /** * WordPress dependencies */ const pages = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" })] }); /* harmony default export */ const library_pages = (pages); ;// ./node_modules/@wordpress/icons/build-module/library/published.js /** * WordPress dependencies */ const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" }) }); /* harmony default export */ const library_published = (published); ;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js /** * WordPress dependencies */ const scheduled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" }) }); /* harmony default export */ const library_scheduled = (scheduled); ;// ./node_modules/@wordpress/icons/build-module/library/drafts.js /** * WordPress dependencies */ const drafts = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z" }) }); /* harmony default export */ const library_drafts = (drafts); ;// ./node_modules/@wordpress/icons/build-module/library/pending.js /** * WordPress dependencies */ const pending = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z" }) }); /* harmony default export */ const library_pending = (pending); ;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js /** * WordPress dependencies */ const notAllowed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z" }) }); /* harmony default export */ const not_allowed = (notAllowed); ;// ./node_modules/@wordpress/icons/build-module/library/trash.js /** * WordPress dependencies */ const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" }) }); /* harmony default export */ const library_trash = (trash); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/default-views.js /** * WordPress dependencies */ /** * Internal dependencies */ const default_views_defaultLayouts = { [LAYOUT_TABLE]: {}, [LAYOUT_GRID]: {}, [LAYOUT_LIST]: {} }; const DEFAULT_POST_BASE = { type: LAYOUT_LIST, search: '', filters: [], page: 1, perPage: 20, sort: { field: 'title', direction: 'asc' }, showLevels: true, titleField: 'title', mediaField: 'featured_media', fields: ['author', 'status'], ...default_views_defaultLayouts[LAYOUT_LIST] }; function useDefaultViews({ postType }) { const labels = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getPostType } = select(external_wp_coreData_namespaceObject.store); return getPostType(postType)?.labels; }, [postType]); return (0,external_wp_element_namespaceObject.useMemo)(() => { return [{ title: labels?.all_items || (0,external_wp_i18n_namespaceObject.__)('All items'), slug: 'all', icon: library_pages, view: DEFAULT_POST_BASE }, { title: (0,external_wp_i18n_namespaceObject.__)('Published'), slug: 'published', icon: library_published, view: DEFAULT_POST_BASE, filters: [{ field: 'status', operator: OPERATOR_IS_ANY, value: 'publish' }] }, { title: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), slug: 'future', icon: library_scheduled, view: DEFAULT_POST_BASE, filters: [{ field: 'status', operator: OPERATOR_IS_ANY, value: 'future' }] }, { title: (0,external_wp_i18n_namespaceObject.__)('Drafts'), slug: 'drafts', icon: library_drafts, view: DEFAULT_POST_BASE, filters: [{ field: 'status', operator: OPERATOR_IS_ANY, value: 'draft' }] }, { title: (0,external_wp_i18n_namespaceObject.__)('Pending'), slug: 'pending', icon: library_pending, view: DEFAULT_POST_BASE, filters: [{ field: 'status', operator: OPERATOR_IS_ANY, value: 'pending' }] }, { title: (0,external_wp_i18n_namespaceObject.__)('Private'), slug: 'private', icon: not_allowed, view: DEFAULT_POST_BASE, filters: [{ field: 'status', operator: OPERATOR_IS_ANY, value: 'private' }] }, { title: (0,external_wp_i18n_namespaceObject.__)('Trash'), slug: 'trash', icon: library_trash, view: { ...DEFAULT_POST_BASE, type: LAYOUT_TABLE, layout: default_views_defaultLayouts[LAYOUT_TABLE].layout }, filters: [{ field: 'status', operator: OPERATOR_IS_ANY, value: 'trash' }] }]; }, [labels]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: dataview_item_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function DataViewItem({ title, slug, customViewId, type, icon, isActive, isCustom, suffix }) { const { path } = dataview_item_useLocation(); const iconToUse = icon || VIEW_LAYOUTS.find(v => v.type === type).icon; let activeView = isCustom ? customViewId : slug; if (activeView === 'all') { activeView = undefined; } const query = { layout: type, activeView, isCustom: isCustom ? 'true' : undefined }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", className: dist_clsx('edit-site-sidebar-dataviews-dataview-item', { 'is-selected': isActive }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { icon: iconToUse, to: (0,external_wp_url_namespaceObject.addQueryArgs)(path, query), "aria-current": isActive ? 'true' : undefined, children: title }), suffix] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/add-new-view.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: add_new_view_useLocation, useHistory: add_new_view_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function AddNewItemModalContent({ type, setIsAdding }) { const history = add_new_view_useHistory(); const { path } = add_new_view_useLocation(); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false); const defaultViews = useDefaultViews({ postType: type }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: async event => { event.preventDefault(); setIsSaving(true); const { getEntityRecords } = (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store); let dataViewTaxonomyId; const dataViewTypeRecords = await getEntityRecords('taxonomy', 'wp_dataviews_type', { slug: type }); if (dataViewTypeRecords && dataViewTypeRecords.length > 0) { dataViewTaxonomyId = dataViewTypeRecords[0].id; } else { const record = await saveEntityRecord('taxonomy', 'wp_dataviews_type', { name: type }); if (record && record.id) { dataViewTaxonomyId = record.id; } } const savedRecord = await saveEntityRecord('postType', 'wp_dataviews', { title, status: 'publish', wp_dataviews_type: dataViewTaxonomyId, content: JSON.stringify(defaultViews[0].view) }); history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { activeView: savedRecord.id, isCustom: 'true' })); setIsSaving(false); setIsAdding(false); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Name'), value: title, onChange: setTitle, placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), className: "patterns-create-modal__name-input" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { setIsAdding(false); }, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", "aria-disabled": !title || isSaving, isBusy: isSaving, children: (0,external_wp_i18n_namespaceObject.__)('Create') })] })] }) }); } function AddNewItem({ type }) { const [isAdding, setIsAdding] = (0,external_wp_element_namespaceObject.useState)(false); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { icon: library_plus, onClick: () => { setIsAdding(true); }, className: "dataviews__siderbar-content-add-new-item", children: (0,external_wp_i18n_namespaceObject.__)('New view') }), isAdding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Add new view'), onRequestClose: () => { setIsAdding(false); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItemModalContent, { type: type, setIsAdding: setIsAdding }) })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/custom-dataviews-list.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: custom_dataviews_list_useHistory, useLocation: custom_dataviews_list_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const custom_dataviews_list_EMPTY_ARRAY = []; function RenameItemModalContent({ dataviewId, currentTitle, setIsRenaming }) { const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(currentTitle); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: async event => { event.preventDefault(); await editEntityRecord('postType', 'wp_dataviews', dataviewId, { title }); setIsRenaming(false); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Name'), value: title, onChange: setTitle, placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), className: "patterns-create-modal__name-input" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", __next40pxDefaultSize: true, onClick: () => { setIsRenaming(false); }, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", type: "submit", "aria-disabled": !title, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Save') })] })] }) }); } function CustomDataViewItem({ dataviewId, isActive }) { const history = custom_dataviews_list_useHistory(); const location = custom_dataviews_list_useLocation(); const { dataview } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); return { dataview: getEditedEntityRecord('postType', 'wp_dataviews', dataviewId) }; }, [dataviewId]); const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const type = (0,external_wp_element_namespaceObject.useMemo)(() => { const viewContent = JSON.parse(dataview.content); return viewContent.type; }, [dataview.content]); const [isRenaming, setIsRenaming] = (0,external_wp_element_namespaceObject.useState)(false); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { title: dataview.title, type: type, isActive: isActive, isCustom: true, customViewId: dataviewId, suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Actions'), className: "edit-site-sidebar-dataviews-dataview-item__dropdown-menu", toggleProps: { style: { color: 'inherit' }, size: 'small' }, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { setIsRenaming(true); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Rename') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: async () => { await deleteEntityRecord('postType', 'wp_dataviews', dataview.id, { force: true }); if (isActive) { history.replace({ postType: location.query.postType }); } onClose(); }, isDestructive: true, children: (0,external_wp_i18n_namespaceObject.__)('Delete') })] }) }) }), isRenaming && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Rename'), onRequestClose: () => { setIsRenaming(false); }, focusOnMount: "firstContentElement", size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameItemModalContent, { dataviewId: dataviewId, setIsRenaming: setIsRenaming, currentTitle: dataview.title }) })] }); } function useCustomDataViews(type) { const customDataViews = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store); const dataViewTypeRecords = getEntityRecords('taxonomy', 'wp_dataviews_type', { slug: type }); if (!dataViewTypeRecords || dataViewTypeRecords.length === 0) { return custom_dataviews_list_EMPTY_ARRAY; } const dataViews = getEntityRecords('postType', 'wp_dataviews', { wp_dataviews_type: dataViewTypeRecords[0].id, orderby: 'date', order: 'asc' }); if (!dataViews) { return custom_dataviews_list_EMPTY_ARRAY; } return dataViews; }); return customDataViews; } function CustomDataViewsList({ type, activeView, isCustom }) { const customDataViews = useCustomDataViews(type); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-dataviews__group-header", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, children: (0,external_wp_i18n_namespaceObject.__)('Custom Views') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-dataviews__custom-items", children: [customDataViews.map(customViewRecord => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewItem, { dataviewId: customViewRecord.id, isActive: isCustom && Number(activeView) === customViewRecord.id }, customViewRecord.id); }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItem, { type: type })] })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: sidebar_dataviews_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function DataViewsSidebarContent({ postType }) { const { query: { activeView = 'all', isCustom = 'false' } } = sidebar_dataviews_useLocation(); const defaultViews = useDefaultViews({ postType }); if (!postType) { return null; } const isCustomBoolean = isCustom === 'true'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-dataviews", children: defaultViews.map(dataview => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { slug: dataview.slug, title: dataview.title, icon: dataview.icon, type: dataview.view.type, isActive: !isCustomBoolean && dataview.slug === activeView, isCustom: false }, dataview.slug); }) }), window?.__experimentalCustomViews && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewsList, { activeView: activeView, type: postType, isCustom: true })] }); } ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js /** * WordPress dependencies */ const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" }) }); /* harmony default export */ const drawer_right = (drawerRight); ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-post/index.js /** * WordPress dependencies */ function AddNewPostModal({ postType, onSave, onClose }) { const labels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels, [postType]); const [isCreatingPost, setIsCreatingPost] = (0,external_wp_element_namespaceObject.useState)(false); const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { resolveSelect } = (0,external_wp_data_namespaceObject.useRegistry)(); async function createPost(event) { event.preventDefault(); if (isCreatingPost) { return; } setIsCreatingPost(true); try { const postTypeObject = await resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); const newPage = await saveEntityRecord('postType', postType, { status: 'draft', title, slug: title !== null && title !== void 0 ? title : undefined, content: !!postTypeObject.template && postTypeObject.template.length ? (0,external_wp_blocks_namespaceObject.serialize)((0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)([], postTypeObject.template)) : undefined }, { throwOnError: true }); onSave(newPage); createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of the created post or template, e.g: "Hello world". (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newPage.title?.rendered || title)), { type: 'snackbar' }); } catch (error) { const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the item.'); createErrorNotice(errorMessage, { type: 'snackbar' }); } finally { setIsCreatingPost(false); } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: // translators: %s: post type singular_name label e.g: "Page". (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Draft new: %s'), labels?.singular_name), onRequestClose: onClose, focusOnMount: "firstContentElement", size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: createPost, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Title'), onChange: setTitle, placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), value: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, justify: "end", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", isBusy: isCreatingPost, "aria-disabled": isCreatingPost, children: (0,external_wp_i18n_namespaceObject.__)('Create draft') })] })] }) }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/post-list/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { usePostActions: post_list_usePostActions, usePostFields } = unlock(external_wp_editor_namespaceObject.privateApis); const { useLocation: post_list_useLocation, useHistory: post_list_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const { useEntityRecordsWithPermissions: post_list_useEntityRecordsWithPermissions } = unlock(external_wp_coreData_namespaceObject.privateApis); const post_list_EMPTY_ARRAY = []; const getDefaultView = (defaultViews, activeView) => { return defaultViews.find(({ slug }) => slug === activeView)?.view; }; const getCustomView = editedEntityRecord => { if (!editedEntityRecord?.content) { return undefined; } const content = JSON.parse(editedEntityRecord.content); if (!content) { return undefined; } return { ...content, ...default_views_defaultLayouts[content.type] }; }; /** * This function abstracts working with default & custom views by * providing a [ state, setState ] tuple based on the URL parameters. * * Consumers use the provided tuple to work with state * and don't have to deal with the specifics of default & custom views. * * @param {string} postType Post type to retrieve default views for. * @return {Array} The [ state, setState ] tuple. */ function useView(postType) { const { path, query: { activeView = 'all', isCustom = 'false', layout } } = post_list_useLocation(); const history = post_list_useHistory(); const defaultViews = useDefaultViews({ postType }); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const editedEntityRecord = (0,external_wp_data_namespaceObject.useSelect)(select => { if (isCustom !== 'true') { return undefined; } const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); return getEditedEntityRecord('postType', 'wp_dataviews', Number(activeView)); }, [activeView, isCustom]); const [view, setView] = (0,external_wp_element_namespaceObject.useState)(() => { let initialView; if (isCustom === 'true') { var _getCustomView; initialView = (_getCustomView = getCustomView(editedEntityRecord)) !== null && _getCustomView !== void 0 ? _getCustomView : { type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST }; } else { var _getDefaultView; initialView = (_getDefaultView = getDefaultView(defaultViews, activeView)) !== null && _getDefaultView !== void 0 ? _getDefaultView : { type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST }; } const type = layout !== null && layout !== void 0 ? layout : initialView.type; return { ...initialView, type, ...default_views_defaultLayouts[type] }; }); const setViewWithUrlUpdate = (0,external_wp_compose_namespaceObject.useEvent)(newView => { setView(newView); if (isCustom === 'true' && editedEntityRecord?.id) { editEntityRecord('postType', 'wp_dataviews', editedEntityRecord?.id, { content: JSON.stringify(newView) }); } const currentUrlLayout = layout !== null && layout !== void 0 ? layout : LAYOUT_LIST; if (newView.type !== currentUrlLayout) { history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { layout: newView.type })); } }); // When layout URL param changes, update the view type // without affecting any other config. const onUrlLayoutChange = (0,external_wp_compose_namespaceObject.useEvent)(() => { setView(prevView => { const newType = layout !== null && layout !== void 0 ? layout : LAYOUT_LIST; if (newType === prevView.type) { return prevView; } return { ...prevView, type: newType, ...default_views_defaultLayouts[newType] }; }); }); (0,external_wp_element_namespaceObject.useEffect)(() => { onUrlLayoutChange(); }, [onUrlLayoutChange, layout]); // When activeView or isCustom URL parameters change, reset the view. const onUrlActiveViewChange = (0,external_wp_compose_namespaceObject.useEvent)(() => { let newView; if (isCustom === 'true') { newView = getCustomView(editedEntityRecord); } else { newView = getDefaultView(defaultViews, activeView); } if (newView) { const type = layout !== null && layout !== void 0 ? layout : newView.type; setView({ ...newView, type, ...default_views_defaultLayouts[type] }); } }); (0,external_wp_element_namespaceObject.useEffect)(() => { onUrlActiveViewChange(); }, [onUrlActiveViewChange, activeView, isCustom, defaultViews, editedEntityRecord]); return [view, setViewWithUrlUpdate]; } const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'. function getItemId(item) { return item.id.toString(); } function getItemLevel(item) { return item.level; } function PostList({ postType }) { var _postId$split, _data$map, _usePrevious; const [view, setView] = useView(postType); const defaultViews = useDefaultViews({ postType }); const history = post_list_useHistory(); const location = post_list_useLocation(); const { postId, quickEdit = false, isCustom, activeView = 'all' } = location.query; const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)((_postId$split = postId?.split(',')) !== null && _postId$split !== void 0 ? _postId$split : []); const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { var _location$query$isCus; setSelection(items); if (((_location$query$isCus = location.query.isCustom) !== null && _location$query$isCus !== void 0 ? _location$query$isCus : 'false') === 'false') { history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(location.path, { postId: items.join(',') })); } }, [location.path, location.query.isCustom, history]); const getActiveViewFilters = (views, match) => { var _found$filters; const found = views.find(({ slug }) => slug === match); return (_found$filters = found?.filters) !== null && _found$filters !== void 0 ? _found$filters : []; }; const { isLoading: isLoadingFields, fields: _fields } = usePostFields({ postType }); const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { const activeViewFilters = getActiveViewFilters(defaultViews, activeView).map(({ field }) => field); return _fields.map(field => ({ ...field, elements: activeViewFilters.includes(field.id) ? [] : field.elements })); }, [_fields, defaultViews, activeView]); const queryArgs = (0,external_wp_element_namespaceObject.useMemo)(() => { const filters = {}; view.filters?.forEach(filter => { if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { filters.status = filter.value; } if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { filters.author = filter.value; } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { filters.author_exclude = filter.value; } }); // The bundled views want data filtered without displaying the filter. const activeViewFilters = getActiveViewFilters(defaultViews, activeView); activeViewFilters.forEach(filter => { if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { filters.status = filter.value; } if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { filters.author = filter.value; } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { filters.author_exclude = filter.value; } }); // We want to provide a different default item for the status filter // than the REST API provides. if (!filters.status || filters.status === '') { filters.status = DEFAULT_STATUSES; } return { per_page: view.perPage, page: view.page, _embed: 'author', order: view.sort?.direction, orderby: view.sort?.field, orderby_hierarchy: !!view.showLevels, search: view.search, ...filters }; }, [view, activeView, defaultViews]); const { records, isResolving: isLoadingData, totalItems, totalPages } = post_list_useEntityRecordsWithPermissions('postType', postType, queryArgs); // The REST API sort the authors by ID, but we want to sort them by name. const data = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!isLoadingFields && view?.sort?.field === 'author') { return filterSortAndPaginate(records, { sort: { ...view.sort } }, fields).data; } return records; }, [records, fields, isLoadingFields, view?.sort]); const ids = (_data$map = data?.map(record => getItemId(record))) !== null && _data$map !== void 0 ? _data$map : []; const prevIds = (_usePrevious = (0,external_wp_compose_namespaceObject.usePrevious)(ids)) !== null && _usePrevious !== void 0 ? _usePrevious : []; const deletedIds = prevIds.filter(id => !ids.includes(id)); const postIdWasDeleted = deletedIds.includes(postId); (0,external_wp_element_namespaceObject.useEffect)(() => { if (postIdWasDeleted) { history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(location.path, { postId: undefined })); } }, [history, postIdWasDeleted, location.path]); const paginationInfo = (0,external_wp_element_namespaceObject.useMemo)(() => ({ totalItems, totalPages }), [totalItems, totalPages]); const { labels, canCreateRecord } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getPostType, canUser } = select(external_wp_coreData_namespaceObject.store); return { labels: getPostType(postType)?.labels, canCreateRecord: canUser('create', { kind: 'postType', name: postType }) }; }, [postType]); const postTypeActions = post_list_usePostActions({ postType, context: 'list' }); const editAction = useEditPostAction(); const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); const [showAddPostModal, setShowAddPostModal] = (0,external_wp_element_namespaceObject.useState)(false); const openModal = () => setShowAddPostModal(true); const closeModal = () => setShowAddPostModal(false); const handleNewPage = ({ type, id }) => { history.navigate(`/${type}/${id}?canvas=edit`); closeModal(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { title: labels?.name, actions: labels?.add_new_item && canCreateRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", onClick: openModal, __next40pxDefaultSize: true, children: labels.add_new_item }), showAddPostModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPostModal, { postType: postType, onSave: handleNewPage, onClose: closeModal })] }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { paginationInfo: paginationInfo, fields: fields, actions: actions, data: data || post_list_EMPTY_ARRAY, isLoading: isLoadingData || isLoadingFields, view: view, onChangeView: setView, selection: selection, onChangeSelection: onChangeSelection, isItemClickable: item => item.status !== 'trash', onClickItem: ({ id }) => { history.navigate(`/${postType}/${id}?canvas=edit`); }, getItemId: getItemId, getItemLevel: getItemLevel, defaultLayouts: default_views_defaultLayouts, header: window.__experimentalQuickEditDataViews && view.type !== LAYOUT_LIST && postType === 'page' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", isPressed: quickEdit, icon: drawer_right, label: (0,external_wp_i18n_namespaceObject.__)('Details'), onClick: () => { history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(location.path, { quickEdit: quickEdit ? undefined : true })); } }) }, activeView + isCustom) }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform-context/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const DataFormContext = (0,external_wp_element_namespaceObject.createContext)({ fields: [] }); function DataFormProvider({ fields, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormContext.Provider, { value: { fields }, children: children }); } /* harmony default export */ const dataform_context = (DataFormContext); ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/is-combined-field.js /** * Internal dependencies */ function isCombinedField(field) { return field.children !== undefined; } ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/regular/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function regular_Header({ title }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-regular__header", spacing: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {})] }) }); } function FormRegularField({ data, field, onChange, hideLabelFromVision }) { var _field$labelPosition; const { fields } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); const form = (0,external_wp_element_namespaceObject.useMemo)(() => { if (isCombinedField(field)) { return { fields: field.children.map(child => { if (typeof child === 'string') { return { id: child }; } return child; }), type: 'regular' }; } return { type: 'regular', fields: [] }; }, [field]); if (isCombinedField(field)) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!hideLabelFromVision && field.label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(regular_Header, { title: field.label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { data: data, form: form, onChange: onChange })] }); } const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'top'; const fieldDefinition = fields.find(fieldDef => fieldDef.id === field.id); if (!fieldDefinition) { return null; } if (labelPosition === 'side') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataforms-layouts-regular__field", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field-label", children: fieldDefinition.label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { data: data, field: fieldDefinition, onChange: onChange, hideLabelFromVision: true }, fieldDefinition.id) })] }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { data: data, field: fieldDefinition, onChange: onChange, hideLabelFromVision: labelPosition === 'none' ? true : hideLabelFromVision }) }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function DropdownHeader({ title, onClose }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-panel__dropdown-header", spacing: 4, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { label: (0,external_wp_i18n_namespaceObject.__)('Close'), icon: close_small, onClick: onClose, size: "small" })] }) }); } function PanelDropdown({ fieldDefinition, popoverAnchor, labelPosition = 'side', data, onChange, field }) { const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; const form = (0,external_wp_element_namespaceObject.useMemo)(() => { if (isCombinedField(field)) { return { type: 'regular', fields: field.children.map(child => { if (typeof child === 'string') { return { id: child }; } return child; }) }; } // If not explicit children return the field id itself. return { type: 'regular', fields: [{ id: field.id }] }; }, [field]); // Memoize popoverProps to avoid returning a new object every time. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: 'left-start', offset: 36, shift: true }), [popoverAnchor]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { contentClassName: "dataforms-layouts-panel__field-dropdown", popoverProps: popoverProps, focusOnMount: true, toggleProps: { size: 'compact', variant: 'tertiary', tooltipPosition: 'middle left' }, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "dataforms-layouts-panel__field-control", size: "compact", variant: ['none', 'top'].includes(labelPosition) ? 'link' : 'tertiary', "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Field name. (0,external_wp_i18n_namespaceObject._x)('Edit %s', 'field'), fieldLabel), onClick: onToggle, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.render, { item: data }) }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { title: fieldLabel, onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { data: data, form: form, onChange: onChange, children: (FieldLayout, nestedField) => { var _form$fields; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { data: data, field: nestedField, onChange: onChange, hideLabelFromVision: ((_form$fields = form?.fields) !== null && _form$fields !== void 0 ? _form$fields : []).length < 2 }, nestedField.id); } })] }) }); } function FormPanelField({ data, field, onChange }) { var _field$labelPosition; const { fields } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); const fieldDefinition = fields.find(fieldDef => { // Default to the first child if it is a combined field. if (isCombinedField(field)) { const children = field.children.filter(child => typeof child === 'string' || !isCombinedField(child)); const firstChildFieldId = typeof children[0] === 'string' ? children[0] : children[0].id; return fieldDef.id === firstChildFieldId; } return fieldDef.id === field.id; }); const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'side'; // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); if (!fieldDefinition) { return null; } const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; if (labelPosition === 'top') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-panel__field", spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-label", style: { paddingBottom: 0 }, children: fieldLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { field: field, popoverAnchor: popoverAnchor, fieldDefinition: fieldDefinition, data: data, onChange: onChange, labelPosition: labelPosition }) })] }); } if (labelPosition === 'none') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { field: field, popoverAnchor: popoverAnchor, fieldDefinition: fieldDefinition, data: data, onChange: onChange, labelPosition: labelPosition }) }); } // Defaults to label position side. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { ref: setPopoverAnchor, className: "dataforms-layouts-panel__field", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-label", children: fieldLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { field: field, popoverAnchor: popoverAnchor, fieldDefinition: fieldDefinition, data: data, onChange: onChange, labelPosition: labelPosition }) })] }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/index.js /** * Internal dependencies */ const FORM_FIELD_LAYOUTS = [{ type: 'regular', component: FormRegularField }, { type: 'panel', component: FormPanelField }]; function getFormFieldLayout(type) { return FORM_FIELD_LAYOUTS.find(layout => layout.type === type); } ;// ./node_modules/@wordpress/dataviews/build-module/normalize-form-fields.js /** * Internal dependencies */ function normalizeFormFields(form) { var _form$type, _form$labelPosition, _form$fields; let layout = 'regular'; if (['regular', 'panel'].includes((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : '')) { layout = form.type; } const labelPosition = (_form$labelPosition = form.labelPosition) !== null && _form$labelPosition !== void 0 ? _form$labelPosition : layout === 'regular' ? 'top' : 'side'; return ((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(field => { var _field$layout, _field$labelPosition; if (typeof field === 'string') { return { id: field, layout, labelPosition }; } const fieldLayout = (_field$layout = field.layout) !== null && _field$layout !== void 0 ? _field$layout : layout; const fieldLabelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : fieldLayout === 'regular' ? 'top' : 'side'; return { ...field, layout: fieldLayout, labelPosition: fieldLabelPosition }; }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/data-form-layout.js /** * WordPress dependencies */ /** * Internal dependencies */ function DataFormLayout({ data, form, onChange, children }) { const { fields: fieldDefinitions } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); function getFieldDefinition(field) { const fieldId = typeof field === 'string' ? field : field.id; return fieldDefinitions.find(fieldDefinition => fieldDefinition.id === fieldId); } const normalizedFormFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFormFields(form), [form]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: normalizedFormFields.map(formField => { const FieldLayout = getFormFieldLayout(formField.layout)?.component; if (!FieldLayout) { return null; } const fieldDefinition = !isCombinedField(formField) ? getFieldDefinition(formField) : undefined; if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) { return null; } if (children) { return children(FieldLayout, formField); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { data: data, field: formField, onChange: onChange }, formField.id); }) }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function DataForm({ data, form, fields, onChange }) { const normalizedFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); if (!form.fields) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormProvider, { fields: normalizedFields, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { data: data, form: form, onChange: onChange }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/post-edit/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { usePostFields: post_edit_usePostFields, PostCardPanel } = unlock(external_wp_editor_namespaceObject.privateApis); const fieldsWithBulkEditSupport = ['title', 'status', 'date', 'author', 'comment_status']; function PostEditForm({ postType, postId }) { const ids = (0,external_wp_element_namespaceObject.useMemo)(() => postId.split(','), [postId]); const { record, hasFinishedResolution } = (0,external_wp_data_namespaceObject.useSelect)(select => { const args = ['postType', postType, ids[0]]; const { getEditedEntityRecord, hasFinishedResolution: hasFinished } = select(external_wp_coreData_namespaceObject.store); return { record: ids.length === 1 ? getEditedEntityRecord(...args) : null, hasFinishedResolution: hasFinished('getEditedEntityRecord', args) }; }, [postType, ids]); const [multiEdits, setMultiEdits] = (0,external_wp_element_namespaceObject.useState)({}); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { fields: _fields } = post_edit_usePostFields({ postType }); const fields = (0,external_wp_element_namespaceObject.useMemo)(() => _fields?.map(field => { if (field.id === 'status') { return { ...field, elements: field.elements.filter(element => element.value !== 'trash') }; } return field; }), [_fields]); const form = (0,external_wp_element_namespaceObject.useMemo)(() => ({ type: 'panel', fields: [{ id: 'featured_media', layout: 'regular' }, { id: 'status', label: (0,external_wp_i18n_namespaceObject.__)('Status & Visibility'), children: ['status', 'password'] }, 'author', 'date', 'slug', 'parent', 'comment_status', { label: (0,external_wp_i18n_namespaceObject.__)('Template'), labelPosition: 'side', id: 'template', layout: 'regular' }].filter(field => ids.length === 1 || fieldsWithBulkEditSupport.includes(field)) }), [ids]); const onChange = edits => { for (const id of ids) { if (edits.status && edits.status !== 'future' && record?.status === 'future' && new Date(record.date) > new Date()) { edits.date = null; } if (edits.status && edits.status === 'private' && record.password) { edits.password = ''; } editEntityRecord('postType', postType, id, edits); if (ids.length > 1) { setMultiEdits(prev => ({ ...prev, ...edits })); } } }; (0,external_wp_element_namespaceObject.useEffect)(() => { setMultiEdits({}); }, [ids]); const { ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const settings = usePatternSettings(); /** * The template field depends on the block editor settings. * This is a workaround to ensure that the block editor settings are available. * For more information, see: https://github.com/WordPress/gutenberg/issues/67521 */ const fieldsWithDependency = (0,external_wp_element_namespaceObject.useMemo)(() => { return fields.map(field => { if (field.id === 'template') { return { ...field, Edit: data => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { settings: settings, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { ...data }) }) }; } return field; }); }, [fields, settings]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { postType: postType, postId: ids }), hasFinishedResolution && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataForm, { data: ids.length === 1 ? record : multiEdits, fields: fieldsWithDependency, form: form, onChange: onChange })] }); } function PostEdit({ postType, postId }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { className: dist_clsx('edit-site-post-edit', { 'is-empty': !postId }), label: (0,external_wp_i18n_namespaceObject.__)('Post Edit'), children: [postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEditForm, { postType: postType, postId: postId }), !postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Select a page to edit') })] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pages.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: pages_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function MobilePagesView() { const { query = {} } = pages_useLocation(); const { canvas = 'view' } = query; return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "page" }); } const pagesRoute = { name: 'pages', path: '/page', areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)('Pages'), backPath: "/", content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "page" }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, content({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "page" }) : undefined; }, preview({ query, siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; if (!isBlockTheme) { return undefined; } const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; return isListView ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : undefined; }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePagesView, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, edit({ query }) { var _query$layout; const hasQuickEdit = ((_query$layout = query.layout) !== null && _query$layout !== void 0 ? _query$layout : 'list') !== 'list' && !!query.quickEdit; return hasQuickEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { postType: "page", postId: query.postId }) : undefined; } }, widths: { content({ query }) { const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; return isListView ? 380 : undefined; }, edit({ query }) { var _query$layout2; const hasQuickEdit = ((_query$layout2 = query.layout) !== null && _query$layout2 !== void 0 ? _query$layout2 : 'list') !== 'list' && !!query.quickEdit; return hasQuickEdit ? 380 : undefined; } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/page-item.js /** * WordPress dependencies */ /** * Internal dependencies */ const pageItemRoute = { name: 'page-item', path: '/page/:postId', areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)('Pages'), backPath: "/", content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "page" }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, preview({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/stylebook.js /** * WordPress dependencies */ /** * Internal dependencies */ const stylebookRoute = { name: 'stylebook', path: '/stylebook', areas: { sidebar({ siteData }) { return isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)('Styles'), backPath: "/", description: (0,external_wp_i18n_namespaceObject.__)(`Preview your website's visual identity: colors, typography, and blocks.`) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, preview({ siteData }) { return isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { isStatic: true }) : undefined; }, mobile({ siteData }) { return isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { isStatic: true }) : undefined; } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/notfound.js /** * WordPress dependencies */ /** * Internal dependencies */ function NotFoundError() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "error", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)('The requested page could not be found. Please check the URL.') }); } const notFoundRoute = { name: 'notfound', path: '*', areas: { sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}), mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, { customDescription: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {}) }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { padding: 2, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {}) }) } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const site_editor_routes_routes = [pageItemRoute, pagesRoute, templateItemRoute, templatesRoute, templatePartItemRoute, patternItemRoute, patternsRoute, navigationItemRoute, navigationRoute, stylesRoute, homeRoute, stylebookRoute, notFoundRoute]; function useRegisterSiteEditorRoutes() { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { registerRoute } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); (0,external_wp_element_namespaceObject.useEffect)(() => { registry.batch(() => { site_editor_routes_routes.forEach(registerRoute); }); }, [registry, registerRoute]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/app/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { RouterProvider } = unlock(external_wp_router_namespaceObject.privateApis); function AppLayout() { useCommonCommands(); useSetCommandContext(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}); } function App() { useRegisterSiteEditorRoutes(); const { routes, currentTheme, editorSettings } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { routes: unlock(select(store)).getRoutes(), currentTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), // This is a temp solution until the has_theme_json value is available for the current theme. editorSettings: select(store).getSettings() }; }, []); const beforeNavigate = (0,external_wp_element_namespaceObject.useCallback)(({ path, query }) => { if (!isPreviewingTheme()) { return { path, query }; } return { path, query: { ...query, wp_theme_preview: 'wp_theme_preview' in query ? query.wp_theme_preview : currentlyPreviewingTheme() } }; }, []); const matchResolverArgsValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ siteData: { currentTheme, editorSettings } }), [currentTheme, editorSettings]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RouterProvider, { routes: routes, pathArg: "p", beforeNavigate: beforeNavigate, matchResolverArgs: matchResolverArgsValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AppLayout, {}) }); } ;// ./node_modules/@wordpress/edit-site/build-module/deprecated.js /** * WordPress dependencies */ const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); const deprecateSlot = name => { external_wp_deprecated_default()(`wp.editPost.${name}`, { since: '6.6', alternative: `wp.editor.${name}` }); }; /* eslint-disable jsdoc/require-param */ /** * @see PluginMoreMenuItem in @wordpress/editor package. */ function PluginMoreMenuItem(props) { if (!isSiteEditor) { return null; } deprecateSlot('PluginMoreMenuItem'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { ...props }); } /** * @see PluginSidebar in @wordpress/editor package. */ function PluginSidebar(props) { if (!isSiteEditor) { return null; } deprecateSlot('PluginSidebar'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { ...props }); } /** * @see PluginSidebarMoreMenuItem in @wordpress/editor package. */ function PluginSidebarMoreMenuItem(props) { if (!isSiteEditor) { return null; } deprecateSlot('PluginSidebarMoreMenuItem'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { ...props }); } /* eslint-enable jsdoc/require-param */ ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/posts.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useLocation: posts_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function MobilePostsView() { const { query = {} } = posts_useLocation(); const { canvas = 'view' } = query; return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "post" }); } const postsRoute = { name: 'posts', path: '/', areas: { sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)('Posts'), isRoot: true, content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "post" }) }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "post" }), preview({ query }) { const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; return isListView ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }) : undefined; }, mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePostsView, {}), edit({ query }) { var _query$layout; const hasQuickEdit = ((_query$layout = query.layout) !== null && _query$layout !== void 0 ? _query$layout : 'list') === 'list' && !!query.quickEdit; return hasQuickEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { postType: "post", postId: query.postId }) : undefined; } }, widths: { content({ query }) { const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; return isListView ? 380 : undefined; }, edit({ query }) { var _query$layout2; const hasQuickEdit = ((_query$layout2 = query.layout) !== null && _query$layout2 !== void 0 ? _query$layout2 : 'list') === 'list' && !!query.quickEdit; return hasQuickEdit ? 380 : undefined; } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/post-item.js /** * WordPress dependencies */ /** * Internal dependencies */ const postItemRoute = { name: 'post-item', path: '/post/:postId', areas: { sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)('Posts'), isRoot: true, content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "post" }) }), mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }), preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }) } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const posts_app_routes_routes = [postItemRoute, postsRoute]; function useRegisterPostsAppRoutes() { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { registerRoute } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); (0,external_wp_element_namespaceObject.useEffect)(() => { registry.batch(() => { posts_app_routes_routes.forEach(registerRoute); }); }, [registry, registerRoute]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { RouterProvider: posts_app_RouterProvider } = unlock(external_wp_router_namespaceObject.privateApis); function PostsApp() { useRegisterPostsAppRoutes(); const routes = (0,external_wp_data_namespaceObject.useSelect)(select => { return unlock(select(store)).getRoutes(); }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(posts_app_RouterProvider, { routes: routes, pathArg: "p", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}) }); } ;// ./node_modules/@wordpress/edit-site/build-module/posts.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Internal dependencies */ /** * Initializes the "Posts Dashboard" * @param {string} id ID of the root element to render the screen in. * @param {Object} settings Editor settings. */ function initializePostsDashboard(id, settings) { if (true) { return; } const target = document.getElementById(id); const root = (0,external_wp_element_namespaceObject.createRoot)(target); (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ name }) => name !== 'core/freeform'); (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ inserter: false }); (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ inserter: false }); if (false) {} // We dispatch actions and update the store synchronously before rendering // so that we won't trigger unnecessary re-renders with useEffect. (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { welcomeGuide: true, welcomeGuideStyles: true, welcomeGuidePage: true, welcomeGuideTemplate: true }); (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { allowRightClickOverrides: true, distractionFree: false, editorMode: 'visual', editorTool: 'edit', fixedToolbar: false, focusMode: false, inactivePanels: [], keepCaretInsideBlock: false, openPanels: ['post-status'], showBlockBreadcrumbs: true, showListViewByDefault: false, enableChoosePatternModal: true }); (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); // Prevent the default browser action for files dropped outside of dropzones. window.addEventListener('dragover', e => e.preventDefault(), false); window.addEventListener('drop', e => e.preventDefault(), false); root.render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsApp, {}) })); return root; } ;// ./node_modules/@wordpress/edit-site/build-module/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { registerCoreBlockBindingsSources } = unlock(external_wp_editor_namespaceObject.privateApis); /** * Initializes the site editor screen. * * @param {string} id ID of the root element to render the screen in. * @param {Object} settings Editor settings. */ function initializeEditor(id, settings) { const target = document.getElementById(id); const root = (0,external_wp_element_namespaceObject.createRoot)(target); (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ name }) => name !== 'core/freeform'); (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); registerCoreBlockBindingsSources(); (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ inserter: false }); (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ inserter: false }); if (false) {} // We dispatch actions and update the store synchronously before rendering // so that we won't trigger unnecessary re-renders with useEffect. (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { welcomeGuide: true, welcomeGuideStyles: true, welcomeGuidePage: true, welcomeGuideTemplate: true }); (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { allowRightClickOverrides: true, distractionFree: false, editorMode: 'visual', editorTool: 'edit', fixedToolbar: false, focusMode: false, inactivePanels: [], keepCaretInsideBlock: false, openPanels: ['post-status'], showBlockBreadcrumbs: true, showListViewByDefault: false, enableChoosePatternModal: true }); if (window.__experimentalMediaProcessing) { (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/media', { requireApproval: true, optimizeOnUpload: true }); } (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); // Prevent the default browser action for files dropped outside of dropzones. window.addEventListener('dragover', e => e.preventDefault(), false); window.addEventListener('drop', e => e.preventDefault(), false); root.render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(App, {}) })); return root; } function reinitializeEditor() { external_wp_deprecated_default()('wp.editSite.reinitializeEditor', { since: '6.2', version: '6.3' }); } // Temporary: While the posts dashboard is being iterated on // it's being built in the same package as the site editor. })(); (window.wp = window.wp || {}).editSite = __webpack_exports__; /******/ })() ; dist/primitives.min.js 0000644 00000003167 15125140777 0011042 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=r(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}e.r(t),e.d(t,{BlockQuotation:()=>g,Circle:()=>i,Defs:()=>m,G:()=>l,HorizontalRule:()=>b,Line:()=>c,LinearGradient:()=>u,Path:()=>s,Polygon:()=>d,RadialGradient:()=>p,Rect:()=>f,SVG:()=>w,Stop:()=>y,View:()=>v});const n=function(){for(var e,t,n=0,o="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=r(e))&&(o&&(o+=" "),o+=t);return o},o=window.wp.element,a=window.ReactJSXRuntime,i=e=>(0,o.createElement)("circle",e),l=e=>(0,o.createElement)("g",e),c=e=>(0,o.createElement)("line",e),s=e=>(0,o.createElement)("path",e),d=e=>(0,o.createElement)("polygon",e),f=e=>(0,o.createElement)("rect",e),m=e=>(0,o.createElement)("defs",e),p=e=>(0,o.createElement)("radialGradient",e),u=e=>(0,o.createElement)("linearGradient",e),y=e=>(0,o.createElement)("stop",e),w=(0,o.forwardRef)((({className:e,isPressed:t,...r},o)=>{const i={...r,className:n(e,{"is-pressed":t})||void 0,"aria-hidden":!0,focusable:!1};return(0,a.jsx)("svg",{...i,ref:o})}));w.displayName="SVG";const b="hr",g="blockquote",v="div";(window.wp=window.wp||{}).primitives=t})(); dist/edit-site.min.js 0000644 00002344162 15125140777 0010543 0 ustar 00 /*! This file is auto-generated */ (()=>{var e,t,n={83:(e,t,n)=>{"use strict"; /** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var s=n(1609);var i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=s.useState,o=s.useEffect,a=s.useLayoutEffect,l=s.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),s=r({inst:{value:n,getSnapshot:t}}),i=s[0].inst,u=s[1];return a((function(){i.value=n,i.getSnapshot=t,c(i)&&u({inst:i})}),[e,n,t]),o((function(){return c(i)&&u({inst:i}),e((function(){c(i)&&u({inst:i})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==s.useSyncExternalStore?s.useSyncExternalStore:u},422:(e,t,n)=>{"use strict";e.exports=n(83)},1609:e=>{"use strict";e.exports=window.React},4660:e=>{e.exports=function(){function e(t,n,s){function i(o,a){if(!n[o]){if(!t[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,n,s)}return n[o].exports}for(var r=void 0,o=0;o<s.length;o++)i(s[o]);return i}return e}()({1:[function(e,t,n){"use strict";var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var s in n)i(n,s)&&(e[s]=n[s])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,s,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+s),i);else for(var r=0;r<s;r++)e[i+r]=t[n+r]},flattenChunks:function(e){var t,n,s,i,r,o;for(s=0,t=0,n=e.length;t<n;t++)s+=e[t].length;for(o=new Uint8Array(s),i=0,t=0,n=e.length;t<n;t++)r=e[t],o.set(r,i),i+=r.length;return o}},o={arraySet:function(e,t,n,s,i){for(var r=0;r<s;r++)e[i+r]=t[n+r]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,r)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(s)},{}],2:[function(e,t,n){"use strict";var s=e("./common"),i=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var o=new s.Buf8(256),a=0;a<256;a++)o[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&r||!e.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var n="",o=0;o<t;o++)n+=String.fromCharCode(e[o]);return n}o[254]=o[254]=1,n.string2buf=function(e){var t,n,i,r,o,a=e.length,l=0;for(r=0;r<a;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new s.Buf8(l),o=0,r=0;o<l;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new s.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,s,i,r,a=t||e.length,c=new Array(2*a);for(s=0,n=0;n<a;)if((i=e[n++])<128)c[s++]=i;else if((r=o[i])>4)c[s++]=65533,n+=r-1;else{for(i&=2===r?31:3===r?15:7;r>1&&n<a;)i=i<<6|63&e[n++],r--;r>1?c[s++]=65533:i<65536?c[s++]=i:(i-=65536,c[s++]=55296|i>>10&1023,c[s++]=56320|1023&i)}return l(c,s)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){"use strict";function s(e,t,n,s){for(var i=65535&e,r=e>>>16&65535,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{r=r+(i=i+t[s++]|0)|0}while(--o);i%=65521,r%=65521}return i|r<<16}t.exports=s},{}],4:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(e,t,n){"use strict";function s(){for(var e,t=[],n=0;n<256;n++){e=n;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var i=s();function r(e,t,n,s){var r=i,o=s+n;e^=-1;for(var a=s;a<o;a++)e=e>>>8^r[255&(e^t[a])];return~e}t.exports=r},{}],6:[function(e,t,n){"use strict";function s(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=s},{}],7:[function(e,t,n){"use strict";var s=30,i=12;t.exports=function(e,t){var n,r,o,a,l,c,u,d,h,p,f,m,g,v,x,y,b,w,_,j,S,C,k,E,P;n=e.state,r=e.next_in,E=e.input,o=r+(e.avail_in-5),a=e.next_out,P=e.output,l=a-(t-e.avail_out),c=a+(e.avail_out-257),u=n.dmax,d=n.wsize,h=n.whave,p=n.wnext,f=n.window,m=n.hold,g=n.bits,v=n.lencode,x=n.distcode,y=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;e:do{g<15&&(m+=E[r++]<<g,g+=8,m+=E[r++]<<g,g+=8),w=v[m&y];t:for(;;){if(m>>>=_=w>>>24,g-=_,0==(_=w>>>16&255))P[a++]=65535&w;else{if(!(16&_)){if(64&_){if(32&_){n.mode=i;break e}e.msg="invalid literal/length code",n.mode=s;break e}w=v[(65535&w)+(m&(1<<_)-1)];continue t}for(j=65535&w,(_&=15)&&(g<_&&(m+=E[r++]<<g,g+=8),j+=m&(1<<_)-1,m>>>=_,g-=_),g<15&&(m+=E[r++]<<g,g+=8,m+=E[r++]<<g,g+=8),w=x[m&b];;){if(m>>>=_=w>>>24,g-=_,16&(_=w>>>16&255)){if(S=65535&w,g<(_&=15)&&(m+=E[r++]<<g,(g+=8)<_&&(m+=E[r++]<<g,g+=8)),(S+=m&(1<<_)-1)>u){e.msg="invalid distance too far back",n.mode=s;break e}if(m>>>=_,g-=_,S>(_=a-l)){if((_=S-_)>h&&n.sane){e.msg="invalid distance too far back",n.mode=s;break e}if(C=0,k=f,0===p){if(C+=d-_,_<j){j-=_;do{P[a++]=f[C++]}while(--_);C=a-S,k=P}}else if(p<_){if(C+=d+p-_,(_-=p)<j){j-=_;do{P[a++]=f[C++]}while(--_);if(C=0,p<j){j-=_=p;do{P[a++]=f[C++]}while(--_);C=a-S,k=P}}}else if(C+=p-_,_<j){j-=_;do{P[a++]=f[C++]}while(--_);C=a-S,k=P}for(;j>2;)P[a++]=k[C++],P[a++]=k[C++],P[a++]=k[C++],j-=3;j&&(P[a++]=k[C++],j>1&&(P[a++]=k[C++]))}else{C=a-S;do{P[a++]=P[C++],P[a++]=P[C++],P[a++]=P[C++],j-=3}while(j>2);j&&(P[a++]=P[C++],j>1&&(P[a++]=P[C++]))}break}if(64&_){e.msg="invalid distance code",n.mode=s;break e}w=x[(65535&w)+(m&(1<<_)-1)]}}break}}while(r<o&&a<c);r-=j=g>>3,m&=(1<<(g-=j<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r<o?o-r+5:5-(r-o),e.avail_out=a<c?c-a+257:257-(a-c),n.hold=m,n.bits=g}},{}],8:[function(e,t,n){"use strict";var s=e("../utils/common"),i=e("./adler32"),r=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),l=0,c=1,u=2,d=4,h=5,p=6,f=0,m=1,g=2,v=-2,x=-3,y=-4,b=-5,w=8,_=1,j=2,S=3,C=4,k=5,E=6,P=7,I=8,T=9,O=10,A=11,N=12,M=13,V=14,F=15,R=16,B=17,D=18,L=19,z=20,G=21,H=22,U=23,W=24,q=25,Z=26,K=27,Y=28,X=29,J=30,Q=31,$=852,ee=592,te=15;function ne(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function se(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ie(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=_,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32($),t.distcode=t.distdyn=new s.Buf32(ee),t.sane=1,t.back=-1,f):v}function re(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):v}function oe(e,t){var n,s;return e&&e.state?(s=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?v:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=n,s.wbits=t,re(e))):v}function ae(e,t){var n,s;return e?(s=new se,e.state=s,s.window=null,(n=oe(e,t))!==f&&(e.state=null),n):v}function le(e){return ae(e,te)}var ce,ue,de=!0;function he(e){if(de){var t;for(ce=new s.Buf32(512),ue=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(c,e.lens,0,288,ce,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(u,e.lens,0,32,ue,0,e.work,{bits:5}),de=!1}e.lencode=ce,e.lenbits=9,e.distcode=ue,e.distbits=5}function pe(e,t,n,i){var r,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new s.Buf8(o.wsize)),i>=o.wsize?(s.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>i&&(r=i),s.arraySet(o.window,t,n-i,r,o.wnext),(i-=r)?(s.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=r))),0}function fe(e,t){var n,$,ee,te,se,ie,re,oe,ae,le,ce,ue,de,fe,me,ge,ve,xe,ye,be,we,_e,je,Se,Ce=0,ke=new s.Buf8(4),Ee=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return v;(n=e.state).mode===N&&(n.mode=M),se=e.next_out,ee=e.output,re=e.avail_out,te=e.next_in,$=e.input,ie=e.avail_in,oe=n.hold,ae=n.bits,le=ie,ce=re,_e=f;e:for(;;)switch(n.mode){case _:if(0===n.wrap){n.mode=M;break}for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if(2&n.wrap&&35615===oe){n.check=0,ke[0]=255&oe,ke[1]=oe>>>8&255,n.check=r(n.check,ke,2,0),oe=0,ae=0,n.mode=j;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&oe)<<8)+(oe>>8))%31){e.msg="incorrect header check",n.mode=J;break}if((15&oe)!==w){e.msg="unknown compression method",n.mode=J;break}if(ae-=4,we=8+(15&(oe>>>=4)),0===n.wbits)n.wbits=we;else if(we>n.wbits){e.msg="invalid window size",n.mode=J;break}n.dmax=1<<we,e.adler=n.check=1,n.mode=512&oe?O:N,oe=0,ae=0;break;case j:for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if(n.flags=oe,(255&n.flags)!==w){e.msg="unknown compression method",n.mode=J;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=J;break}n.head&&(n.head.text=oe>>8&1),512&n.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,n.check=r(n.check,ke,2,0)),oe=0,ae=0,n.mode=S;case S:for(;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}n.head&&(n.head.time=oe),512&n.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,ke[2]=oe>>>16&255,ke[3]=oe>>>24&255,n.check=r(n.check,ke,4,0)),oe=0,ae=0,n.mode=C;case C:for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}n.head&&(n.head.xflags=255&oe,n.head.os=oe>>8),512&n.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,n.check=r(n.check,ke,2,0)),oe=0,ae=0,n.mode=k;case k:if(1024&n.flags){for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}n.length=oe,n.head&&(n.head.extra_len=oe),512&n.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,n.check=r(n.check,ke,2,0)),oe=0,ae=0}else n.head&&(n.head.extra=null);n.mode=E;case E:if(1024&n.flags&&((ue=n.length)>ie&&(ue=ie),ue&&(n.head&&(we=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),s.arraySet(n.head.extra,$,te,ue,we)),512&n.flags&&(n.check=r(n.check,$,ue,te)),ie-=ue,te+=ue,n.length-=ue),n.length))break e;n.length=0,n.mode=P;case P:if(2048&n.flags){if(0===ie)break e;ue=0;do{we=$[te+ue++],n.head&&we&&n.length<65536&&(n.head.name+=String.fromCharCode(we))}while(we&&ue<ie);if(512&n.flags&&(n.check=r(n.check,$,ue,te)),ie-=ue,te+=ue,we)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=I;case I:if(4096&n.flags){if(0===ie)break e;ue=0;do{we=$[te+ue++],n.head&&we&&n.length<65536&&(n.head.comment+=String.fromCharCode(we))}while(we&&ue<ie);if(512&n.flags&&(n.check=r(n.check,$,ue,te)),ie-=ue,te+=ue,we)break e}else n.head&&(n.head.comment=null);n.mode=T;case T:if(512&n.flags){for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if(oe!==(65535&n.check)){e.msg="header crc mismatch",n.mode=J;break}oe=0,ae=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=N;break;case O:for(;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}e.adler=n.check=ne(oe),oe=0,ae=0,n.mode=A;case A:if(0===n.havedict)return e.next_out=se,e.avail_out=re,e.next_in=te,e.avail_in=ie,n.hold=oe,n.bits=ae,g;e.adler=n.check=1,n.mode=N;case N:if(t===h||t===p)break e;case M:if(n.last){oe>>>=7&ae,ae-=7&ae,n.mode=K;break}for(;ae<3;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}switch(n.last=1&oe,ae-=1,3&(oe>>>=1)){case 0:n.mode=V;break;case 1:if(he(n),n.mode=z,t===p){oe>>>=2,ae-=2;break e}break;case 2:n.mode=B;break;case 3:e.msg="invalid block type",n.mode=J}oe>>>=2,ae-=2;break;case V:for(oe>>>=7&ae,ae-=7&ae;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if((65535&oe)!=(oe>>>16^65535)){e.msg="invalid stored block lengths",n.mode=J;break}if(n.length=65535&oe,oe=0,ae=0,n.mode=F,t===p)break e;case F:n.mode=R;case R:if(ue=n.length){if(ue>ie&&(ue=ie),ue>re&&(ue=re),0===ue)break e;s.arraySet(ee,$,te,ue,se),ie-=ue,te+=ue,re-=ue,se+=ue,n.length-=ue;break}n.mode=N;break;case B:for(;ae<14;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if(n.nlen=257+(31&oe),oe>>>=5,ae-=5,n.ndist=1+(31&oe),oe>>>=5,ae-=5,n.ncode=4+(15&oe),oe>>>=4,ae-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=J;break}n.have=0,n.mode=D;case D:for(;n.have<n.ncode;){for(;ae<3;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}n.lens[Ee[n.have++]]=7&oe,oe>>>=3,ae-=3}for(;n.have<19;)n.lens[Ee[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,je={bits:n.lenbits},_e=a(l,n.lens,0,19,n.lencode,0,n.work,je),n.lenbits=je.bits,_e){e.msg="invalid code lengths set",n.mode=J;break}n.have=0,n.mode=L;case L:for(;n.have<n.nlen+n.ndist;){for(;ge=(Ce=n.lencode[oe&(1<<n.lenbits)-1])>>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if(ve<16)oe>>>=me,ae-=me,n.lens[n.have++]=ve;else{if(16===ve){for(Se=me+2;ae<Se;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if(oe>>>=me,ae-=me,0===n.have){e.msg="invalid bit length repeat",n.mode=J;break}we=n.lens[n.have-1],ue=3+(3&oe),oe>>>=2,ae-=2}else if(17===ve){for(Se=me+3;ae<Se;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}ae-=me,we=0,ue=3+(7&(oe>>>=me)),oe>>>=3,ae-=3}else{for(Se=me+7;ae<Se;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}ae-=me,we=0,ue=11+(127&(oe>>>=me)),oe>>>=7,ae-=7}if(n.have+ue>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=J;break}for(;ue--;)n.lens[n.have++]=we}}if(n.mode===J)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=J;break}if(n.lenbits=9,je={bits:n.lenbits},_e=a(c,n.lens,0,n.nlen,n.lencode,0,n.work,je),n.lenbits=je.bits,_e){e.msg="invalid literal/lengths set",n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,je={bits:n.distbits},_e=a(u,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,je),n.distbits=je.bits,_e){e.msg="invalid distances set",n.mode=J;break}if(n.mode=z,t===p)break e;case z:n.mode=G;case G:if(ie>=6&&re>=258){e.next_out=se,e.avail_out=re,e.next_in=te,e.avail_in=ie,n.hold=oe,n.bits=ae,o(e,ce),se=e.next_out,ee=e.output,re=e.avail_out,te=e.next_in,$=e.input,ie=e.avail_in,oe=n.hold,ae=n.bits,n.mode===N&&(n.back=-1);break}for(n.back=0;ge=(Ce=n.lencode[oe&(1<<n.lenbits)-1])>>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if(ge&&!(240&ge)){for(xe=me,ye=ge,be=ve;ge=(Ce=n.lencode[be+((oe&(1<<xe+ye)-1)>>xe)])>>>16&255,ve=65535&Ce,!(xe+(me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}oe>>>=xe,ae-=xe,n.back+=xe}if(oe>>>=me,ae-=me,n.back+=me,n.length=ve,0===ge){n.mode=Z;break}if(32&ge){n.back=-1,n.mode=N;break}if(64&ge){e.msg="invalid literal/length code",n.mode=J;break}n.extra=15&ge,n.mode=H;case H:if(n.extra){for(Se=n.extra;ae<Se;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}n.length+=oe&(1<<n.extra)-1,oe>>>=n.extra,ae-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=U;case U:for(;ge=(Ce=n.distcode[oe&(1<<n.distbits)-1])>>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if(!(240&ge)){for(xe=me,ye=ge,be=ve;ge=(Ce=n.distcode[be+((oe&(1<<xe+ye)-1)>>xe)])>>>16&255,ve=65535&Ce,!(xe+(me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}oe>>>=xe,ae-=xe,n.back+=xe}if(oe>>>=me,ae-=me,n.back+=me,64&ge){e.msg="invalid distance code",n.mode=J;break}n.offset=ve,n.extra=15&ge,n.mode=W;case W:if(n.extra){for(Se=n.extra;ae<Se;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}n.offset+=oe&(1<<n.extra)-1,oe>>>=n.extra,ae-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=J;break}n.mode=q;case q:if(0===re)break e;if(ue=ce-re,n.offset>ue){if((ue=n.offset-ue)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=J;break}ue>n.wnext?(ue-=n.wnext,de=n.wsize-ue):de=n.wnext-ue,ue>n.length&&(ue=n.length),fe=n.window}else fe=ee,de=se-n.offset,ue=n.length;ue>re&&(ue=re),re-=ue,n.length-=ue;do{ee[se++]=fe[de++]}while(--ue);0===n.length&&(n.mode=G);break;case Z:if(0===re)break e;ee[se++]=n.length,re--,n.mode=G;break;case K:if(n.wrap){for(;ae<32;){if(0===ie)break e;ie--,oe|=$[te++]<<ae,ae+=8}if(ce-=re,e.total_out+=ce,n.total+=ce,ce&&(e.adler=n.check=n.flags?r(n.check,ee,ce,se-ce):i(n.check,ee,ce,se-ce)),ce=re,(n.flags?oe:ne(oe))!==n.check){e.msg="incorrect data check",n.mode=J;break}oe=0,ae=0}n.mode=Y;case Y:if(n.wrap&&n.flags){for(;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<<ae,ae+=8}if(oe!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=J;break}oe=0,ae=0}n.mode=X;case X:_e=m;break e;case J:_e=x;break e;case Q:return y;default:return v}return e.next_out=se,e.avail_out=re,e.next_in=te,e.avail_in=ie,n.hold=oe,n.bits=ae,(n.wsize||ce!==e.avail_out&&n.mode<J&&(n.mode<K||t!==d))&&pe(e,e.output,e.next_out,ce-e.avail_out)?(n.mode=Q,y):(le-=e.avail_in,ce-=e.avail_out,e.total_in+=le,e.total_out+=ce,n.total+=ce,n.wrap&&ce&&(e.adler=n.check=n.flags?r(n.check,ee,ce,e.next_out-ce):i(n.check,ee,ce,e.next_out-ce)),e.data_type=n.bits+(n.last?64:0)+(n.mode===N?128:0)+(n.mode===z||n.mode===F?256:0),(0===le&&0===ce||t===d)&&_e===f&&(_e=b),_e)}function me(e){if(!e||!e.state)return v;var t=e.state;return t.window&&(t.window=null),e.state=null,f}function ge(e,t){var n;return e&&e.state&&2&(n=e.state).wrap?(n.head=t,t.done=!1,f):v}function ve(e,t){var n,s=t.length;return e&&e.state?0!==(n=e.state).wrap&&n.mode!==A?v:n.mode===A&&i(1,t,s,0)!==n.check?x:pe(e,t,s,s)?(n.mode=Q,y):(n.havedict=1,f):v}n.inflateReset=re,n.inflateReset2=oe,n.inflateResetKeep=ie,n.inflateInit=le,n.inflateInit2=ae,n.inflate=fe,n.inflateEnd=me,n.inflateGetHeader=ge,n.inflateSetDictionary=ve,n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(e,t,n){"use strict";var s=e("../utils/common"),i=15,r=852,o=592,a=0,l=1,c=2,u=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],d=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],h=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],p=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,f,m,g,v,x){var y,b,w,_,j,S,C,k,E,P=x.bits,I=0,T=0,O=0,A=0,N=0,M=0,V=0,F=0,R=0,B=0,D=null,L=0,z=new s.Buf16(i+1),G=new s.Buf16(i+1),H=null,U=0;for(I=0;I<=i;I++)z[I]=0;for(T=0;T<f;T++)z[t[n+T]]++;for(N=P,A=i;A>=1&&0===z[A];A--);if(N>A&&(N=A),0===A)return m[g++]=20971520,m[g++]=20971520,x.bits=1,0;for(O=1;O<A&&0===z[O];O++);for(N<O&&(N=O),F=1,I=1;I<=i;I++)if(F<<=1,(F-=z[I])<0)return-1;if(F>0&&(e===a||1!==A))return-1;for(G[1]=0,I=1;I<i;I++)G[I+1]=G[I]+z[I];for(T=0;T<f;T++)0!==t[n+T]&&(v[G[t[n+T]]++]=T);if(e===a?(D=H=v,S=19):e===l?(D=u,L-=257,H=d,U-=257,S=256):(D=h,H=p,S=-1),B=0,T=0,I=O,j=g,M=N,V=0,w=-1,_=(R=1<<N)-1,e===l&&R>r||e===c&&R>o)return 1;for(;;){C=I-V,v[T]<S?(k=0,E=v[T]):v[T]>S?(k=H[U+v[T]],E=D[L+v[T]]):(k=96,E=0),y=1<<I-V,O=b=1<<M;do{m[j+(B>>V)+(b-=y)]=C<<24|k<<16|E}while(0!==b);for(y=1<<I-1;B&y;)y>>=1;if(0!==y?(B&=y-1,B+=y):B=0,T++,0==--z[I]){if(I===A)break;I=t[n+v[T]]}if(I>N&&(B&_)!==w){for(0===V&&(V=N),j+=O,F=1<<(M=I-V);M+V<A&&!((F-=z[M+V])<=0);)M++,F<<=1;if(R+=1<<M,e===l&&R>r||e===c&&R>o)return 1;m[w=B&_]=N<<24|M<<16|j-g}}return 0!==B&&(m[j+B]=I-V<<24|64<<16),x.bits=N,0}},{"../utils/common":1}],10:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(e,t,n){"use strict";function s(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=s},{}],"/lib/inflate.js":[function(e,t,n){"use strict";var s=e("./zlib/inflate"),i=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),c=e("./zlib/gzheader"),u=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=s.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);if(this.header=new c,s.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=r.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=s.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[n])}function h(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}function p(e,t){return(t=t||{}).raw=!0,h(e,t)}d.prototype.push=function(e,t){var n,a,l,c,d,h=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?h.input=r.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new i.Buf8(p),h.next_out=0,h.avail_out=p),(n=s.inflate(h,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(n=s.inflateSetDictionary(this.strm,f)),n===o.Z_BUF_ERROR&&!0===m&&(n=o.Z_OK,m=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&n!==o.Z_STREAM_END&&(0!==h.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=r.utf8border(h.output,h.next_out),c=h.next_out-l,d=r.buf2string(h.output,l),h.next_out=c,h.avail_out=p-c,c&&i.arraySet(h.output,h.output,l,c,0),this.onData(d)):this.onData(i.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(m=!0)}while((h.avail_in>0||0===h.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=s.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),h.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=h,n.inflateRaw=p,n.ungzip=h},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},8572:e=>{e.exports=function(){function e(t,n,s){function i(o,a){if(!n[o]){if(!t[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,n,s)}return n[o].exports}for(var r=void 0,o=0;o<s.length;o++)i(s[o]);return i}return e}()({1:[function(e,t,n){var s=4096,i=2*s+32,r=2*s-1,o=new Uint32Array([0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215]);function a(e){this.buf_=new Uint8Array(i),this.input_=e,this.reset()}a.READ_SIZE=s,a.IBUF_MASK=r,a.prototype.reset=function(){this.buf_ptr_=0,this.val_=0,this.pos_=0,this.bit_pos_=0,this.bit_end_pos_=0,this.eos_=0,this.readMoreInput();for(var e=0;e<4;e++)this.val_|=this.buf_[this.pos_]<<8*e,++this.pos_;return this.bit_end_pos_>0},a.prototype.readMoreInput=function(){if(!(this.bit_end_pos_>256))if(this.eos_){if(this.bit_pos_>this.bit_end_pos_)throw new Error("Unexpected end of input "+this.bit_pos_+" "+this.bit_end_pos_)}else{var e=this.buf_ptr_,t=this.input_.read(this.buf_,e,s);if(t<0)throw new Error("Unexpected end of input");if(t<s){this.eos_=1;for(var n=0;n<32;n++)this.buf_[e+t+n]=0}if(0===e){for(n=0;n<32;n++)this.buf_[(s<<1)+n]=this.buf_[n];this.buf_ptr_=s}else this.buf_ptr_=0;this.bit_end_pos_+=t<<3}},a.prototype.fillBitWindow=function(){for(;this.bit_pos_>=8;)this.val_>>>=8,this.val_|=this.buf_[this.pos_&r]<<24,++this.pos_,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},a.prototype.readBits=function(e){32-this.bit_pos_<e&&this.fillBitWindow();var t=this.val_>>>this.bit_pos_&o[e];return this.bit_pos_+=e,t},t.exports=a},{}],2:[function(e,t,n){n.lookup=new Uint8Array([0,0,0,0,0,0,0,0,0,4,4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,12,16,12,12,20,12,16,24,28,12,12,32,12,36,12,44,44,44,44,44,44,44,44,44,44,32,32,24,40,28,12,12,48,52,52,52,48,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,24,12,28,12,12,12,56,60,60,60,56,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,24,12,28,12,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,40,40,40,40,41,41,41,41,42,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n.lookupOffsets=new Uint16Array([1024,1536,1280,1536,0,256,768,512])},{}],3:[function(e,t,n){var s=e("./streams").BrotliInput,i=e("./streams").BrotliOutput,r=e("./bit_reader"),o=e("./dictionary"),a=e("./huffman").HuffmanCode,l=e("./huffman").BrotliBuildHuffmanTable,c=e("./context"),u=e("./prefix"),d=e("./transform"),h=8,p=16,f=256,m=704,g=26,v=6,x=2,y=8,b=255,w=1080,_=18,j=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),S=16,C=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),k=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),E=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function P(e){var t;return 0===e.readBits(1)?16:(t=e.readBits(3))>0?17+t:(t=e.readBits(3))>0?8+t:17}function I(e){if(e.readBits(1)){var t=e.readBits(3);return 0===t?1:e.readBits(t)+(1<<t)}return 0}function T(){this.meta_block_length=0,this.input_end=0,this.is_uncompressed=0,this.is_metadata=!1}function O(e){var t,n,s,i=new T;if(i.input_end=e.readBits(1),i.input_end&&e.readBits(1))return i;if(7===(t=e.readBits(2)+4)){if(i.is_metadata=!0,0!==e.readBits(1))throw new Error("Invalid reserved bit");if(0===(n=e.readBits(2)))return i;for(s=0;s<n;s++){var r=e.readBits(8);if(s+1===n&&n>1&&0===r)throw new Error("Invalid size byte");i.meta_block_length|=r<<8*s}}else for(s=0;s<t;++s){var o=e.readBits(4);if(s+1===t&&t>4&&0===o)throw new Error("Invalid size nibble");i.meta_block_length|=o<<4*s}return++i.meta_block_length,i.input_end||i.is_metadata||(i.is_uncompressed=e.readBits(1)),i}function A(e,t,n){var s;return n.fillBitWindow(),(s=e[t+=n.val_>>>n.bit_pos_&b].bits-y)>0&&(n.bit_pos_+=y,t+=e[t].value,t+=n.val_>>>n.bit_pos_&(1<<s)-1),n.bit_pos_+=e[t].bits,e[t].value}function N(e,t,n,s){for(var i=0,r=h,o=0,c=0,u=32768,d=[],f=0;f<32;f++)d.push(new a(0,0));for(l(d,0,5,e,_);i<t&&u>0;){var m,g=0;if(s.readMoreInput(),s.fillBitWindow(),g+=s.val_>>>s.bit_pos_&31,s.bit_pos_+=d[g].bits,(m=255&d[g].value)<p)o=0,n[i++]=m,0!==m&&(r=m,u-=32768>>m);else{var v,x,y=m-14,b=0;if(m===p&&(b=r),c!==b&&(o=0,c=b),v=o,o>0&&(o-=2,o<<=y),i+(x=(o+=s.readBits(y)+3)-v)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var w=0;w<x;w++)n[i+w]=c;i+=x,0!==c&&(u-=x<<15-c)}}if(0!==u)throw new Error("[ReadHuffmanCodeLengths] space = "+u);for(;i<t;i++)n[i]=0}function M(e,t,n,s){var i,r=0,o=new Uint8Array(e);if(s.readMoreInput(),1===(i=s.readBits(2))){for(var c=e-1,u=0,d=new Int32Array(4),h=s.readBits(2)+1;c;)c>>=1,++u;for(p=0;p<h;++p)d[p]=s.readBits(u)%e,o[d[p]]=2;switch(o[d[0]]=1,h){case 1:break;case 3:if(d[0]===d[1]||d[0]===d[2]||d[1]===d[2])throw new Error("[ReadHuffmanCode] invalid symbols");break;case 2:if(d[0]===d[1])throw new Error("[ReadHuffmanCode] invalid symbols");o[d[1]]=1;break;case 4:if(d[0]===d[1]||d[0]===d[2]||d[0]===d[3]||d[1]===d[2]||d[1]===d[3]||d[2]===d[3])throw new Error("[ReadHuffmanCode] invalid symbols");s.readBits(1)?(o[d[2]]=3,o[d[3]]=3):o[d[0]]=2}}else{var p,f=new Uint8Array(_),m=32,g=0,v=[new a(2,0),new a(2,4),new a(2,3),new a(3,2),new a(2,0),new a(2,4),new a(2,3),new a(4,1),new a(2,0),new a(2,4),new a(2,3),new a(3,2),new a(2,0),new a(2,4),new a(2,3),new a(4,5)];for(p=i;p<_&&m>0;++p){var x,b=j[p],w=0;s.fillBitWindow(),w+=s.val_>>>s.bit_pos_&15,s.bit_pos_+=v[w].bits,x=v[w].value,f[b]=x,0!==x&&(m-=32>>x,++g)}if(1!==g&&0!==m)throw new Error("[ReadHuffmanCode] invalid num_codes or space");N(f,e,o,s)}if(0===(r=l(t,n,y,o,e)))throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");return r}function V(e,t,n){var s,i;return s=A(e,t,n),i=u.kBlockLengthPrefixCode[s].nbits,u.kBlockLengthPrefixCode[s].offset+n.readBits(i)}function F(e,t,n){var s;return e<S?(n+=C[e],s=t[n&=3]+k[e]):s=e-S+1,s}function R(e,t){for(var n=e[t],s=t;s;--s)e[s]=e[s-1];e[0]=n}function B(e,t){var n,s=new Uint8Array(256);for(n=0;n<256;++n)s[n]=n;for(n=0;n<t;++n){var i=e[n];e[n]=s[i],i&&R(s,i)}}function D(e,t){this.alphabet_size=e,this.num_htrees=t,this.codes=new Array(t+t*E[e+31>>>5]),this.htrees=new Uint32Array(t)}function L(e,t){var n,s,i={num_htrees:null,context_map:null},r=0;t.readMoreInput();var o=i.num_htrees=I(t)+1,l=i.context_map=new Uint8Array(e);if(o<=1)return i;for(t.readBits(1)&&(r=t.readBits(4)+1),n=[],s=0;s<w;s++)n[s]=new a(0,0);for(M(o+r,n,0,t),s=0;s<e;){var c;if(t.readMoreInput(),0===(c=A(n,0,t)))l[s]=0,++s;else if(c<=r)for(var u=1+(1<<c)+t.readBits(c);--u;){if(s>=e)throw new Error("[DecodeContextMap] i >= context_map_size");l[s]=0,++s}else l[s]=c-r,++s}return t.readBits(1)&&B(l,e),i}function z(e,t,n,s,i,r,o){var a,l=2*n,c=n,u=A(t,n*w,o);(a=0===u?i[l+(1&r[c])]:1===u?i[l+(r[c]-1&1)]+1:u-2)>=e&&(a-=e),s[n]=a,i[l+(1&r[c])]=a,++r[c]}function G(e,t,n,s,i,o){var a,l=i+1,c=n&i,u=o.pos_&r.IBUF_MASK;if(t<8||o.bit_pos_+(t<<3)<o.bit_end_pos_)for(;t-- >0;)o.readMoreInput(),s[c++]=o.readBits(8),c===l&&(e.write(s,l),c=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)s[c]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++c,--t;if(u+(a=o.bit_end_pos_-o.bit_pos_>>3)>r.IBUF_MASK){for(var d=r.IBUF_MASK+1-u,h=0;h<d;h++)s[c+h]=o.buf_[u+h];a-=d,c+=d,t-=d,u=0}for(h=0;h<a;h++)s[c+h]=o.buf_[u+h];if(t-=a,(c+=a)>=l)for(e.write(s,l),c-=l,h=0;h<c;h++)s[h]=s[l+h];for(;c+t>=l;){if(a=l-c,o.input_.read(s,c,a)<a)throw new Error("[CopyUncompressedBlockToOutput] not enough bytes");e.write(s,l),t-=a,c=0}if(o.input_.read(s,c,t)<t)throw new Error("[CopyUncompressedBlockToOutput] not enough bytes");o.reset()}}function H(e){var t=e.bit_pos_+7&-8;return 0==e.readBits(t-e.bit_pos_)}function U(e){var t=new s(e),n=new r(t);return P(n),O(n).meta_block_length}function W(e,t){var n=new s(e);null==t&&(t=U(e));var r=new Uint8Array(t),o=new i(r);return q(n,o),o.pos<o.buffer.length&&(o.buffer=o.buffer.subarray(0,o.pos)),o.buffer}function q(e,t){var n,s,i,l,h,p,y,b,_,j=0,C=0,k=0,E=0,T=[16,15,11,4],N=0,R=0,B=0,U=[new D(0,0),new D(0,0),new D(0,0)],W=128+r.READ_SIZE;s=(1<<(k=P(_=new r(e))))-16,l=(i=1<<k)-1,h=new Uint8Array(i+W+o.maxDictionaryWordLength),p=i,y=[],b=[];for(var q=0;q<3*w;q++)y[q]=new a(0,0),b[q]=new a(0,0);for(;!C;){var Z,K,Y,X,J,Q,$,ee,te,ne=0,se=[1<<28,1<<28,1<<28],ie=[0],re=[1,1,1],oe=[0,1,0,1,0,1],ae=[0],le=null,ce=null,ue=null,de=null,he=0,pe=null,fe=0,me=0,ge=0;for(n=0;n<3;++n)U[n].codes=null,U[n].htrees=null;_.readMoreInput();var ve=O(_);if(j+(ne=ve.meta_block_length)>t.buffer.length){var xe=new Uint8Array(j+ne);xe.set(t.buffer),t.buffer=xe}if(C=ve.input_end,Z=ve.is_uncompressed,ve.is_metadata)for(H(_);ne>0;--ne)_.readMoreInput(),_.readBits(8);else if(0!==ne)if(Z)_.bit_pos_=_.bit_pos_+7&-8,G(t,ne,j,h,l,_),j+=ne;else{for(n=0;n<3;++n)re[n]=I(_)+1,re[n]>=2&&(M(re[n]+2,y,n*w,_),M(g,b,n*w,_),se[n]=V(b,n*w,_),ae[n]=1);for(_.readMoreInput(),X=(1<<(K=_.readBits(2)))-1,J=(Y=S+(_.readBits(4)<<K))+(48<<K),ce=new Uint8Array(re[0]),n=0;n<re[0];++n)_.readMoreInput(),ce[n]=_.readBits(2)<<1;var ye=L(re[0]<<v,_);Q=ye.num_htrees,le=ye.context_map;var be=L(re[2]<<x,_);for($=be.num_htrees,ue=be.context_map,U[0]=new D(f,Q),U[1]=new D(m,re[1]),U[2]=new D(J,$),n=0;n<3;++n)U[n].decode(_);for(de=0,pe=0,ee=ce[ie[0]],me=c.lookupOffsets[ee],ge=c.lookupOffsets[ee+1],te=U[1].htrees[0];ne>0;){var we,_e,je,Se,Ce,ke,Ee,Pe,Ie,Te,Oe,Ae;for(_.readMoreInput(),0===se[1]&&(z(re[1],y,1,ie,oe,ae,_),se[1]=V(b,w,_),te=U[1].htrees[ie[1]]),--se[1],(_e=(we=A(U[1].codes,te,_))>>6)>=2?(_e-=2,Ee=-1):Ee=0,je=u.kInsertRangeLut[_e]+(we>>3&7),Se=u.kCopyRangeLut[_e]+(7&we),Ce=u.kInsertLengthPrefixCode[je].offset+_.readBits(u.kInsertLengthPrefixCode[je].nbits),ke=u.kCopyLengthPrefixCode[Se].offset+_.readBits(u.kCopyLengthPrefixCode[Se].nbits),R=h[j-1&l],B=h[j-2&l],Ie=0;Ie<Ce;++Ie)_.readMoreInput(),0===se[0]&&(z(re[0],y,0,ie,oe,ae,_),se[0]=V(b,0,_),de=ie[0]<<v,ee=ce[ie[0]],me=c.lookupOffsets[ee],ge=c.lookupOffsets[ee+1]),he=le[de+(c.lookup[me+R]|c.lookup[ge+B])],--se[0],B=R,R=A(U[0].codes,U[0].htrees[he],_),h[j&l]=R,(j&l)===l&&t.write(h,i),++j;if((ne-=Ce)<=0)break;if(Ee<0&&(_.readMoreInput(),0===se[2]&&(z(re[2],y,2,ie,oe,ae,_),se[2]=V(b,2*w,_),pe=ie[2]<<x),--se[2],fe=ue[pe+(255&(ke>4?3:ke-2))],(Ee=A(U[2].codes,U[2].htrees[fe],_))>=Y&&(Ae=(Ee-=Y)&X,Ee=Y+((Ne=(2+(1&(Ee>>=K))<<(Oe=1+(Ee>>1)))-4)+_.readBits(Oe)<<K)+Ae)),(Pe=F(Ee,T,N))<0)throw new Error("[BrotliDecompress] invalid distance");if(Te=j&l,Pe>(E=j<s&&E!==s?j:s)){if(!(ke>=o.minDictionaryWordLength&&ke<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+j+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);var Ne=o.offsetsByLength[ke],Me=Pe-E-1,Ve=o.sizeBitsByLength[ke],Fe=Me>>Ve;if(Ne+=(Me&(1<<Ve)-1)*ke,!(Fe<d.kNumTransforms))throw new Error("Invalid backward reference. pos: "+j+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);var Re=d.transformDictionaryWord(h,Te,Ne,ke,Fe);if(j+=Re,ne-=Re,(Te+=Re)>=p){t.write(h,i);for(var Be=0;Be<Te-p;Be++)h[Be]=h[p+Be]}}else{if(Ee>0&&(T[3&N]=Pe,++N),ke>ne)throw new Error("Invalid backward reference. pos: "+j+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);for(Ie=0;Ie<ke;++Ie)h[j&l]=h[j-Pe&l],(j&l)===l&&t.write(h,i),++j,--ne}R=h[j-1&l],B=h[j-2&l]}j&=1073741823}}t.write(h,j&l)}D.prototype.decode=function(e){var t,n=0;for(t=0;t<this.num_htrees;++t)this.htrees[t]=n,n+=M(this.alphabet_size,this.codes,n,e)},n.BrotliDecompressedSize=U,n.BrotliDecompressBuffer=W,n.BrotliDecompress=q,o.init()},{"./bit_reader":1,"./context":2,"./dictionary":6,"./huffman":7,"./prefix":9,"./streams":10,"./transform":11}],4:[function(e,t,n){var s=e("base64-js");n.init=function(){return(0,e("./decode").BrotliDecompressBuffer)(s.toByteArray(e("./dictionary.bin.js")))}},{"./decode":3,"./dictionary.bin.js":5,"base64-js":8}],5:[function(e,t,n){t.exports="W5/fcQLn5gKf2XUbAiQ1XULX+TZz6ADToDsgqk6qVfeC0e4m6OO2wcQ1J76ZBVRV1fRkEsdu//62zQsFEZWSTCnMhcsQKlS2qOhuVYYMGCkV0fXWEoMFbESXrKEZ9wdUEsyw9g4bJlEt1Y6oVMxMRTEVbCIwZzJzboK5j8m4YH02qgXYhv1V+PM435sLVxyHJihaJREEhZGqL03txGFQLm76caGO/ovxKvzCby/3vMTtX/459f0igi7WutnKiMQ6wODSoRh/8Lx1V3Q99MvKtwB6bHdERYRY0hStJoMjNeTsNX7bn+Y7e4EQ3bf8xBc7L0BsyfFPK43dGSXpL6clYC/I328h54/VYrQ5i0648FgbGtl837svJ35L3Mot/+nPlNpWgKx1gGXQYqX6n+bbZ7wuyCHKcUok12Xjqub7NXZGzqBx0SD+uziNf87t7ve42jxSKQoW3nyxVrWIGlFShhCKxjpZZ5MeGna0+lBkk+kaN8F9qFBAFgEogyMBdcX/T1W/WnMOi/7ycWUQloEBKGeC48MkiwqJkJO+12eQiOFHMmck6q/IjWW3RZlany23TBm+cNr/84/oi5GGmGBZWrZ6j+zykVozz5fT/QH/Da6WTbZYYPynVNO7kxzuNN2kxKKWche5WveitPKAecB8YcAHz/+zXLjcLzkdDSktNIDwZE9J9X+tto43oJy65wApM3mDzYtCwX9lM+N5VR3kXYo0Z3t0TtXfgBFg7gU8oN0Dgl7fZlUbhNll+0uuohRVKjrEd8egrSndy5/Tgd2gqjA4CAVuC7ESUmL3DZoGnfhQV8uwnpi8EGvAVVsowNRxPudck7+oqAUDkwZopWqFnW1riss0t1z6iCISVKreYGNvQcXv+1L9+jbP8cd/dPUiqBso2q+7ZyFBvENCkkVr44iyPbtOoOoCecWsiuqMSML5lv+vN5MzUr+Dnh73G7Q1YnRYJVYXHRJaNAOByiaK6CusgFdBPE40r0rvqXV7tksKO2DrHYXBTv8P5ysqxEx8VDXUDDqkPH6NNOV/a2WH8zlkXRELSa8P+heNyJBBP7PgsG1EtWtNef6/i+lcayzQwQCsduidpbKfhWUDgAEmyhGu/zVTacI6RS0zTABrOYueemnVa19u9fT23N/Ta6RvTpof5DWygqreCqrDAgM4LID1+1T/taU6yTFVLqXOv+/MuQOFnaF8vLMKD7tKWDoBdALgxF33zQccCcdHx8fKIVdW69O7qHtXpeGr9jbbpFA+qRMWr5hp0s67FPc7HAiLV0g0/peZlW7hJPYEhZyhpSwahnf93/tZgfqZWXFdmdXBzqxGHLrQKxoAY6fRoBhgCRPmmGueYZ5JexTVDKUIXzkG/fqp/0U3hAgQdJ9zumutK6nqWbaqvm1pgu03IYR+G+8s0jDBBz8cApZFSBeuWasyqo2OMDKAZCozS+GWSvL/HsE9rHxooe17U3s/lTE+VZAk4j3dp6uIGaC0JMiqR5CUsabPyM0dOYDR7Ea7ip4USZlya38YfPtvrX/tBlhHilj55nZ1nfN24AOAi9BVtz/Mbn8AEDJCqJgsVUa6nQnSxv2Fs7l/NlCzpfYEjmPrNyib/+t0ei2eEMjvNhLkHCZlci4WhBe7ePZTmzYqlY9+1pxtS4GB+5lM1BHT9tS270EWUDYFq1I0yY/fNiAk4bk9yBgmef/f2k6AlYQZHsNFnW8wBQxCd68iWv7/35bXfz3JZmfGligWAKRjIs3IpzxQ27vAglHSiOzCYzJ9L9A1CdiyFvyR66ucA4jKifu5ehwER26yV7HjKqn5Mfozo7Coxxt8LWWPT47BeMxX8p0Pjb7hZn+6bw7z3Lw+7653j5sI8CLu5kThpMlj1m4c2ch3jGcP1FsT13vuK3qjecKTZk2kHcOZY40UX+qdaxstZqsqQqgXz+QGF99ZJLqr3VYu4aecl1Ab5GmqS8k/GV5b95zxQ5d4EfXUJ6kTS/CXF/aiqKDOT1T7Jz5z0PwDUcwr9clLN1OJGCiKfqvah+h3XzrBOiLOW8wvn8gW6qE8vPxi+Efv+UH55T7PQFVMh6cZ1pZQlzJpKZ7P7uWvwPGJ6DTlR6wbyj3Iv2HyefnRo/dv7dNx+qaa0N38iBsR++Uil7Wd4afwDNsrzDAK4fXZwvEY/jdKuIKXlfrQd2C39dW7ntnRbIp9OtGy9pPBn/V2ASoi/2UJZfS+xuGLH8bnLuPlzdTNS6zdyk8Dt/h6sfOW5myxh1f+zf3zZ3MX/mO9cQPp5pOx967ZA6/pqHvclNfnUFF+rq+Vd7alKr6KWPcIDhpn6v2K6NlUu6LrKo8b/pYpU/Gazfvtwhn7tEOUuXht5rUJdSf6sLjYf0VTYDgwJ81yaqKTUYej/tbHckSRb/HZicwGJqh1mAHB/IuNs9dc9yuvF3D5Xocm3elWFdq5oEy70dYFit79yaLiNjPj5UUcVmZUVhQEhW5V2Z6Cm4HVH/R8qlamRYwBileuh07CbEce3TXa2JmXWBf+ozt319psboobeZhVnwhMZzOeQJzhpTDbP71Tv8HuZxxUI/+ma3XW6DFDDs4+qmpERwHGBd2edxwUKlODRdUWZ/g0GOezrbzOZauFMai4QU6GVHV6aPNBiBndHSsV4IzpvUiiYyg6OyyrL4Dj5q/Lw3N5kAwftEVl9rNd7Jk5PDij2hTH6wIXnsyXkKePxbmHYgC8A6an5Fob/KH5GtC0l4eFso+VpxedtJHdHpNm+Bvy4C79yVOkrZsLrQ3OHCeB0Ra+kBIRldUGlDCEmq2RwXnfyh6Dz+alk6eftI2n6sastRrGwbwszBeDRS/Fa/KwRJkCzTsLr/JCs5hOPE/MPLYdZ1F1fv7D+VmysX6NpOC8aU9F4Qs6HvDyUy9PvFGDKZ/P5101TYHFl8pjj6wm/qyS75etZhhfg0UEL4OYmHk6m6dO192AzoIyPSV9QedDA4Ml23rRbqxMPMxf7FJnDc5FTElVS/PyqgePzmwVZ26NWhRDQ+oaT7ly7ell4s3DypS1s0g+tOr7XHrrkZj9+x/mJBttrLx98lFIaRZzHz4aC7r52/JQ4VjHahY2/YVXZn/QC2ztQb/sY3uRlyc5vQS8nLPGT/n27495i8HPA152z7Fh5aFpyn1GPJKHuPL8Iw94DuW3KjkURAWZXn4EQy89xiKEHN1mk/tkM4gYDBxwNoYvRfE6LFqsxWJtPrDGbsnLMap3Ka3MUoytW0cvieozOmdERmhcqzG+3HmZv2yZeiIeQTKGdRT4HHNxekm1tY+/n06rGmFleqLscSERzctTKM6G9P0Pc1RmVvrascIxaO1CQCiYPE15bD7c3xSeW7gXxYjgxcrUlcbIvO0r+Yplhx0kTt3qafDOmFyMjgGxXu73rddMHpV1wMubyAGcf/v5dLr5P72Ta9lBF+fzMJrMycwv+9vnU3ANIl1cH9tfW7af8u0/HG0vV47jNFXzFTtaha1xvze/s8KMtCYucXc1nzfd/MQydUXn/b72RBt5wO/3jRcMH9BdhC/yctKBIveRYPrNpDWqBsO8VMmP+WvRaOcA4zRMR1PvSoO92rS7pYEv+fZfEfTMzEdM+6X5tLlyxExhqLRkms5EuLovLfx66de5fL2/yX02H52FPVwahrPqmN/E0oVXnsCKhbi/yRxX83nRbUKWhzYceXOntfuXn51NszJ6MO73pQf5Pl4in3ec4JU8hF7ppV34+mm9r1LY0ee/i1O1wpd8+zfLztE0cqBxggiBi5Bu95v9l3r9r/U5hweLn+TbfxowrWDqdJauKd8+q/dH8sbPkc9ttuyO94f7/XK/nHX46MPFLEb5qQlNPvhJ50/59t9ft3LXu7uVaWaO2bDrDCnRSzZyWvFKxO1+vT8MwwunR3bX0CkfPjqb4K9O19tn5X50PvmYpEwHtiW9WtzuV/s76B1zvLLNkViNd8ySxIl/3orfqP90TyTGaf7/rx8jQzeHJXdmh/N6YDvbvmTBwCdxfEQ1NcL6wNMdSIXNq7b1EUzRy1/Axsyk5p22GMG1b+GxFgbHErZh92wuvco0AuOLXct9hvw2nw/LqIcDRRmJmmZzcgUa7JpM/WV/S9IUfbF56TL2orzqwebdRD8nIYNJ41D/hz37Fo11p2Y21wzPcn713qVGhqtevStYfGH4n69OEJtPvbbLYWvscDqc3Hgnu166+tAyLnxrX0Y5zoYjV++1sI7t5kMr02KT/+uwtkc+rZLOf/qn/s3nYCf13Dg8/sB2diJgjGqjQ+TLhxbzyue2Ob7X6/9lUwW7a+lbznHzOYy8LKW1C/uRPbQY3KW/0gO9LXunHLvPL97afba9bFtc9hmz7GAttjVYlCvQAiOwAk/gC5+hkLEs6tr3AZKxLJtOEwk2dLxTYWsIB/j/ToWtIWzo906FrSG8iaqqqqqqiIiIiAgzMzMzNz+AyK+01/zi8n8S+Y1MjoRaQ80WU/G8MBlO+53VPXANrWm4wzGUVZUjjBJZVdhpcfkjsmcWaO+UEldXi1e+zq+HOsCpknYshuh8pOLISJun7TN0EIGW2xTnlOImeecnoGW4raxe2G1T3HEvfYUYMhG+gAFOAwh5nK8mZhwJMmN7r224QVsNFvZ87Z0qatvknklyPDK3Hy45PgVKXji52Wen4d4PlFVVYGnNap+fSpFbK90rYnhUc6n91Q3AY9E0tJOFrcfZtm/491XbcG/jsViUPPX76qmeuiz+qY1Hk7/1VPM405zWVuoheLUimpWYdVzCmUdKHebMdzgrYrb8mL2eeLSnRWHdonfZa8RsOU9F37w+591l5FLYHiOqWeHtE/lWrBHcRKp3uhtr8yXm8LU/5ms+NM6ZKsqu90cFZ4o58+k4rdrtB97NADFbwmEG7lXqvirhOTOqU14xuUF2myIjURcPHrPOQ4lmM3PeMg7bUuk0nnZi67bXsU6H8lhqIo8TaOrEafCO1ARK9PjC0QOoq2BxmMdgYB9G/lIb9++fqNJ2s7BHGFyBNmZAR8J3KCo012ikaSP8BCrf6VI0X5xdnbhHIO+B5rbOyB54zXkzfObyJ4ecwxfqBJMLFc7m59rNcw7hoHnFZ0b00zee+gTqvjm61Pb4xn0kcDX4jvHM0rBXZypG3DCKnD/Waa/ZtHmtFPgO5eETx+k7RrVg3aSwm2YoNXnCs3XPQDhNn+Fia6IlOOuIG6VJH7TP6ava26ehKHQa2T4N0tcZ9dPCGo3ZdnNltsHQbeYt5vPnJezV/cAeNypdml1vCHI8M81nSRP5Qi2+mI8v/sxiZru9187nRtp3f/42NemcONa+4eVC3PCZzc88aZh851CqSsshe70uPxeN/dmYwlwb3trwMrN1Gq8jbnApcVDx/yDPeYs5/7r62tsQ6lLg+DiFXTEhzR9dHqv0iT4tgj825W+H3XiRUNUZT2kR9Ri0+lp+UM3iQtS8uOE23Ly4KYtvqH13jghUntJRAewuzNLDXp8RxdcaA3cMY6TO2IeSFRXezeWIjCqyhsUdMYuCgYTZSKpBype1zRfq8FshvfBPc6BAQWl7/QxIDp3VGo1J3vn42OEs3qznws+YLRXbymyB19a9XBx6n/owcyxlEYyFWCi+kG9F+EyD/4yn80+agaZ9P7ay2Dny99aK2o91FkfEOY8hBwyfi5uwx2y5SaHmG+oq/zl1FX/8irOf8Y3vAcX/6uLP6A6nvMO24edSGPjQc827Rw2atX+z2bKq0CmW9mOtYnr5/AfDa1ZfPaXnKtlWborup7QYx+Or2uWb+N3N//2+yDcXMqIJdf55xl7/vsj4WoPPlxLxtVrkJ4w/tTe3mLdATOOYwxcq52w5Wxz5MbPdVs5O8/lhfE7dPj0bIiPQ3QV0iqm4m3YX8hRfc6jQ3fWepevMqUDJd86Z4vwM40CWHnn+WphsGHfieF02D3tmZvpWD+kBpNCFcLnZhcmmrhpGzzbdA+sQ1ar18OJD87IOKOFoRNznaHPNHUfUNhvY1iU+uhvEvpKHaUn3qK3exVVyX4joipp3um7FmYJWmA+WbIDshRpbVRx5/nqstCgy87FGbfVB8yDGCqS+2qCsnRwnSAN6zgzxfdB2nBT/vZ4/6uxb6oH8b4VBRxiIB93wLa47hG3w2SL/2Z27yOXJFwZpSJaBYyvajA7vRRYNKqljXKpt/CFD/tSMr18DKKbwB0xggBePatl1nki0yvqW5zchlyZmJ0OTxJ3D+fsYJs/mxYN5+Le5oagtcl+YsVvy8kSjI2YGvGjvmpkRS9W2dtXqWnVuxUhURm1lKtou/hdEq19VBp9OjGvHEQSmrpuf2R24mXGheil8KeiANY8fW1VERUfBImb64j12caBZmRViZHbeVMjCrPDg9A90IXrtnsYCuZtRQ0PyrKDjBNOsPfKsg1pA02gHlVr0OXiFhtp6nJqXVzcbfM0KnzC3ggOENPE9VBdmHKN6LYaijb4wXxJn5A0FSDF5j+h1ooZx885Jt3ZKzO5n7Z5WfNEOtyyPqQEnn7WLv5Fis3PdgMshjF1FRydbNyeBbyKI1oN1TRVrVK7kgsb/zjX4NDPIRMctVeaxVB38Vh1x5KbeJbU138AM5KzmZu3uny0ErygxiJF7GVXUrPzFxrlx1uFdAaZFDN9cvIb74qD9tzBMo7L7WIEYK+sla1DVMHpF0F7b3+Y6S+zjvLeDMCpapmJo1weBWuxKF3rOocih1gun4BoJh1kWnV/Jmiq6uOhK3VfKxEHEkafjLgK3oujaPzY6SXg8phhL4TNR1xvJd1Wa0aYFfPUMLrNBDCh4AuGRTbtKMc6Z1Udj8evY/ZpCuMAUefdo69DZUngoqE1P9A3PJfOf7WixCEj+Y6t7fYeHbbxUAoFV3M89cCKfma3fc1+jKRe7MFWEbQqEfyzO2x/wrO2VYH7iYdQ9BkPyI8/3kXBpLaCpU7eC0Yv/am/tEDu7HZpqg0EvHo0nf/R/gRzUWy33/HXMJQeu1GylKmOkXzlCfGFruAcPPhaGqZOtu19zsJ1SO2Jz4Ztth5cBX6mRQwWmDwryG9FUMlZzNckMdK+IoMJv1rOWnBamS2w2KHiaPMPLC15hCZm4KTpoZyj4E2TqC/P6r7/EhnDMhKicZZ1ZwxuC7DPzDGs53q8gXaI9kFTK+2LTq7bhwsTbrMV8Rsfua5lMS0FwbTitUVnVa1yTb5IX51mmYnUcP9wPr8Ji1tiYJeJV9GZTrQhF7vvdU2OTU42ogJ9FDwhmycI2LIg++03C6scYhUyUuMV5tkw6kGUoL+mjNC38+wMdWNljn6tGPpRES7veqrSn5TRuv+dh6JVL/iDHU1db4c9WK3++OrH3PqziF916UMUKn8G67nN60GfWiHrXYhUG3yVWmyYak59NHj8t1smG4UDiWz2rPHNrKnN4Zo1LBbr2/eF9YZ0n0blx2nG4X+EKFxvS3W28JESD+FWk61VCD3z/URGHiJl++7TdBwkCj6tGOH3qDb0QqcOF9Kzpj0HUb/KyFW3Yhj2VMKJqGZleFBH7vqvf7WqLC3XMuHV8q8a4sTFuxUtkD/6JIBvKaVjv96ndgruKZ1k/BHzqf2K9fLk7HGXANyLDd1vxkK/i055pnzl+zw6zLnwXlVYVtfmacJgEpRP1hbGgrYPVN6v2lG+idQNGmwcKXu/8xEj/P6qe/sB2WmwNp6pp8jaISMkwdleFXYK55NHWLTTbutSUqjBfDGWo/Yg918qQ+8BRZSAHZbfuNZz2O0sov1Ue4CWlVg3rFhM3Kljj9ksGd/NUhk4nH+a5UN2+1i8+NM3vRNp7uQ6sqexSCukEVlVZriHNqFi5rLm9TMWa4qm3idJqppQACol2l4VSuvWLfta4JcXy3bROPNbXOgdOhG47LC0CwW/dMlSx4Jf17aEU3yA1x9p+Yc0jupXgcMuYNku64iYOkGToVDuJvlbEKlJqsmiHbvNrIVZEH+yFdF8DbleZ6iNiWwMqvtMp/mSpwx5KxRrT9p3MAPTHGtMbfvdFhyj9vhaKcn3At8Lc16Ai+vBcSp1ztXi7rCJZx/ql7TXcclq6Q76UeKWDy9boS0WHIjUuWhPG8LBmW5y2rhuTpM5vsLt+HOLh1Yf0DqXa9tsfC+kaKt2htA0ai/L2i7RKoNjEwztkmRU0GfgW1TxUvPFhg0V7DdfWJk5gfrccpYv+MA9M0dkGTLECeYwUixRzjRFdmjG7zdZIl3XKB9YliNKI31lfa7i2JG5C8Ss+rHe0D7Z696/V3DEAOWHnQ9yNahMUl5kENWS6pHKKp2D1BaSrrHdE1w2qNxIztpXgUIrF0bm15YML4b6V1k+GpNysTahKMVrrS85lTVo9OGJ96I47eAy5rYWpRf/mIzeoYU1DKaQCTUVwrhHeyNoDqHel+lLxr9WKzhSYw7vrR6+V5q0pfi2k3L1zqkubY6rrd9ZLvSuWNf0uqnkY+FpTvFzSW9Fp0b9l8JA7THV9eCi/PY/SCZIUYx3BU2alj7Cm3VV6eYpios4b6WuNOJdYXUK3zTqj5CVG2FqYM4Z7CuIU0qO05XR0d71FHM0YhZmJmTRfLlXEumN82BGtzdX0S19t1e+bUieK8zRmqpa4Qc5TSjifmaQsY2ETLjhI36gMR1+7qpjdXXHiceUekfBaucHShAOiFXmv3sNmGQyU5iVgnoocuonQXEPTFwslHtS8R+A47StI9wj0iSrtbi5rMysczFiImsQ+bdFClnFjjpXXwMy6O7qfjOr8Fb0a7ODItisjnn3EQO16+ypd1cwyaAW5Yzxz5QknfMO7643fXW/I9y3U2xH27Oapqr56Z/tEzglj6IbT6HEHjopiXqeRbe5mQQvxtcbDOVverN0ZgMdzqRYRjaXtMRd56Q4cZSmdPvZJdSrhJ1D9zNXPqAEqPIavPdfubt5oke2kmv0dztIszSv2VYuoyf1UuopbsYb+uX9h6WpwjpgtZ6fNNawNJ4q8O3CFoSbioAaOSZMx2GYaPYB+rEb6qjQiNRFQ76TvwNFVKD+BhH9VhcKGsXzmMI7BptU/CNWolM7YzROvpFAntsiWJp6eR2d3GarcYShVYSUqhmYOWj5E96NK2WvmYNTeY7Zs4RUEdv9h9QT4EseKt6LzLrqEOs3hxAY1MaNWpSa6zZx8F3YOVeCYMS88W+CYHDuWe4yoc6YK+djDuEOrBR5lvh0r+Q9uM88lrjx9x9AtgpQVNE8r+3O6Gvw59D+kBF/UMXyhliYUtPjmvXGY6Dk3x+kEOW+GtdMVC4EZTqoS/jmR0P0LS75DOc/w2vnri97M4SdbZ8qeU7gg8DVbERkU5geaMQO3mYrSYyAngeUQqrN0C0/vsFmcgWNXNeidsTAj7/4MncJR0caaBUpbLK1yBCBNRjEv6KvuVSdpPnEMJdsRRtqJ+U8tN1gXA4ePHc6ZT0eviI73UOJF0fEZ8YaneAQqQdGphNvwM4nIqPnXxV0xA0fnCT+oAhJuyw/q8jO0y8CjSteZExwBpIN6SvNp6A5G/abi6egeND/1GTguhuNjaUbbnSbGd4L8937Ezm34Eyi6n1maeOBxh3PI0jzJDf5mh/BsLD7F2GOKvlA/5gtvxI3/eV4sLfKW5Wy+oio+es/u6T8UU+nsofy57Icb/JlZHPFtCgd/x+bwt3ZT+xXTtTtTrGAb4QehC6X9G+8YT+ozcLxDsdCjsuOqwPFnrdLYaFc92Ui0m4fr39lYmlCaqTit7G6O/3kWDkgtXjNH4BiEm/+jegQnihOtfffn33WxsFjhfMd48HT+f6o6X65j7XR8WLSHMFkxbvOYsrRsF1bowDuSQ18Mkxk4qz2zoGPL5fu9h2Hqmt1asl3Q3Yu3szOc+spiCmX4AETBM3pLoTYSp3sVxahyhL8eC4mPN9k2x3o0xkiixIzM3CZFzf5oR4mecQ5+ax2wCah3/crmnHoqR0+KMaOPxRif1oEFRFOO/kTPPmtww+NfMXxEK6gn6iU32U6fFruIz8Q4WgljtnaCVTBgWx7diUdshC9ZEa5yKpRBBeW12r/iNc/+EgNqmhswNB8SBoihHXeDF7rrWDLcmt3V8GYYN7pXRy4DZjj4DJuUBL5iC3DQAaoo4vkftqVTYRGLS3mHZ7gdmdTTqbgNN/PTdTCOTgXolc88MhXAEUMdX0iy1JMuk5wLsgeu0QUYlz2S4skTWwJz6pOm/8ihrmgGfFgri+ZWUK2gAPHgbWa8jaocdSuM4FJYoKicYX/ZSENkg9Q1ZzJfwScfVnR2DegOGwCvmogaWJCLQepv9WNlU6QgsmOwICquU28Mlk3d9W5E81lU/5Ez0LcX6lwKMWDNluNKfBDUy/phJgBcMnfkh9iRxrdOzgs08JdPB85Lwo+GUSb4t3nC+0byqMZtO2fQJ4U2zGIr49t/28qmmGv2RanDD7a3FEcdtutkW8twwwlUSpb8QalodddbBfNHKDQ828BdE7OBgFdiKYohLawFYqpybQoxATZrheLhdI7+0Zlu9Q1myRcd15r9UIm8K2LGJxqTegntqNVMKnf1a8zQiyUR1rxoqjiFxeHxqFcYUTHfDu7rhbWng6qOxOsI+5A1p9mRyEPdVkTlE24vY54W7bWc6jMgZvNXdfC9/9q7408KDsbdL7Utz7QFSDetz2picArzrdpL8OaCHC9V26RroemtDZ5yNM/KGkWMyTmfnInEvwtSD23UcFcjhaE3VKzkoaEMKGBft4XbIO6forTY1lmGQwVmKicBCiArDzE+1oIxE08fWeviIOD5TznqH+OoHadvoOP20drMPe5Irg3XBQziW2XDuHYzjqQQ4wySssjXUs5H+t3FWYMHppUnBHMx/nYIT5d7OmjDbgD9F6na3m4l7KdkeSO3kTEPXafiWinogag7b52taiZhL1TSvBFmEZafFq2H8khQaZXuitCewT5FBgVtPK0j4xUHPfUz3Q28eac1Z139DAP23dgki94EC8vbDPTQC97HPPSWjUNG5tWKMsaxAEMKC0665Xvo1Ntd07wCLNf8Q56mrEPVpCxlIMVlQlWRxM3oAfpgIc+8KC3rEXUog5g06vt7zgXY8grH7hhwVSaeuvC06YYRAwpbyk/Unzj9hLEZNs2oxPQB9yc+GnL6zTgq7rI++KDJwX2SP8Sd6YzTuw5lV/kU6eQxRD12omfQAW6caTR4LikYkBB1CMOrvgRr/VY75+NSB40Cni6bADAtaK+vyxVWpf9NeKJxN2KYQ8Q2xPB3K1s7fuhvWbr2XpgW044VD6DRs0qXoqKf1NFsaGvKJc47leUV3pppP/5VTKFhaGuol4Esfjf5zyCyUHmHthChcYh4hYLQF+AFWsuq4t0wJyWgdwQVOZiV0efRHPoK5+E1vjz9wTJmVkITC9oEstAsyZSgE/dbicwKr89YUxKZI+owD205Tm5lnnmDRuP/JnzxX3gMtlrcX0UesZdxyQqYQuEW4R51vmQ5xOZteUd8SJruMlTUzhtVw/Nq7eUBcqN2/HVotgfngif60yKEtoUx3WYOZlVJuJOh8u59fzSDPFYtQgqDUAGyGhQOAvKroXMcOYY0qjnStJR/G3aP+Jt1sLVlGV8POwr/6OGsqetnyF3TmTqZjENfnXh51oxe9qVUw2M78EzAJ+IM8lZ1MBPQ9ZWSVc4J3mWSrLKrMHReA5qdGoz0ODRsaA+vwxXA2cAM4qlfzBJA6581m4hzxItQw5dxrrBL3Y6kCbUcFxo1S8jyV44q//+7ASNNudZ6xeaNOSIUffqMn4A9lIjFctYn2gpEPAb3f7p3iIBN8H14FUGQ9ct2hPsL+cEsTgUrR47uJVN4n4wt/wgfwwHuOnLd4yobkofy8JvxSQTA7rMpDIc608SlZFJfZYcmbT0tAHpPE8MrtQ42siTUNWxqvWZOmvu9f0JPoQmg+6l7sZWwyfi6PXkxJnwBraUG0MYG4zYHQz3igy/XsFkx5tNQxw43qvI9dU3f0DdhOUlHKjmi1VAr2Kiy0HZwD8VeEbhh0OiDdMYspolQsYdSwjCcjeowIXNZVUPmL2wwIkYhmXKhGozdCJ4lRKbsf4NBh/XnQoS92NJEWOVOFs2YhN8c5QZFeK0pRdAG40hqvLbmoSA8xQmzOOEc7wLcme9JOsjPCEgpCwUs9E2DohMHRhUeyGIN6TFvrbny8nDuilsDpzrH5mS76APoIEJmItS67sQJ+nfwddzmjPxcBEBBCw0kWDwd0EZCkNeOD7NNQhtBm7KHL9mRxj6U1yWU2puzlIDtpYxdH4ZPeXBJkTGAJfUr/oTCz/iypY6uXaR2V1doPxJYlrw2ghH0D5gbrhFcIxzYwi4a/4hqVdf2DdxBp6vGYDjavxMAAoy+1+3aiO6S3W/QAKNVXagDtvsNtx7Ks+HKgo6U21B+QSZgIogV5Bt+BnXisdVfy9VyXV+2P5fMuvdpAjM1o/K9Z+XnE4EOCrue+kcdYHqAQ0/Y/OmNlQ6OI33jH/uD1RalPaHpJAm2av0/xtpqdXVKNDrc9F2izo23Wu7firgbURFDNX9eGGeYBhiypyXZft2j3hTvzE6PMWKsod//rEILDkzBXfi7xh0eFkfb3/1zzPK/PI5Nk3FbZyTl4mq5BfBoVoqiPHO4Q4QKZAlrQ3MdNfi3oxIjvsM3kAFv3fdufurqYR3PSwX/mpGy/GFI/B2MNPiNdOppWVbs/gjF3YH+QA9jMhlAbhvasAHstB0IJew09iAkmXHl1/TEj+jvHOpOGrPRQXbPADM+Ig2/OEcUcpgPTItMtW4DdqgfYVI/+4hAFWYjUGpOP/UwNuB7+BbKOcALbjobdgzeBQfjgNSp2GOpxzGLj70Vvq5cw2AoYENwKLUtJUX8sGRox4dVa/TN4xKwaKcl9XawQR/uNus700Hf17pyNnezrUgaY9e4MADhEDBpsJT6y1gDJs1q6wlwGhuUzGR7C8kgpjPyHWwsvrf3yn1zJEIRa5eSxoLAZOCR9xbuztxFRJW9ZmMYfCFJ0evm9F2fVnuje92Rc4Pl6A8bluN8MZyyJGZ0+sNSb//DvAFxC2BqlEsFwccWeAl6CyBcQV1bx4mQMBP1Jxqk1EUADNLeieS2dUFbQ/c/kvwItbZ7tx0st16viqd53WsRmPTKv2AD8CUnhtPWg5aUegNpsYgasaw2+EVooeNKmrW3MFtj76bYHJm5K9gpAXZXsE5U8DM8XmVOSJ1F1WnLy6nQup+jx52bAb+rCq6y9WXl2B2oZDhfDkW7H3oYfT/4xx5VncBuxMXP2lNfhUVQjSSzSRbuZFE4vFawlzveXxaYKVs8LpvAb8IRYF3ZHiRnm0ADeNPWocwxSzNseG7NrSEVZoHdKWqaGEBz1N8Pt7kFbqh3LYmAbm9i1IChIpLpM5AS6mr6OAPHMwwznVy61YpBYX8xZDN/a+lt7n+x5j4bNOVteZ8lj3hpAHSx1VR8vZHec4AHO9XFCdjZ9eRkSV65ljMmZVzaej2qFn/qt1lvWzNZEfHxK3qOJrHL6crr0CRzMox5f2e8ALBB4UGFZKA3tN6F6IXd32GTJXGQ7DTi9j/dNcLF9jCbDcWGKxoKTYblIwbLDReL00LRcDPMcQuXLMh5YzgtfjkFK1DP1iDzzYYVZz5M/kWYRlRpig1htVRjVCknm+h1M5LiEDXOyHREhvzCGpFZjHS0RsK27o2avgdilrJkalWqPW3D9gmwV37HKmfM3F8YZj2ar+vHFvf3B8CRoH4kDHIK9mrAg+owiEwNjjd9V+FsQKYR8czJrUkf7Qoi2YaW6EVDZp5zYlqiYtuXOTHk4fAcZ7qBbdLDiJq0WNV1l2+Hntk1mMWvxrYmc8kIx8G3rW36J6Ra4lLrTOCgiOihmow+YnzUT19jbV2B3RWqSHyxkhmgsBqMYWvOcUom1jDQ436+fcbu3xf2bbeqU/ca+C4DOKE+e3qvmeMqW3AxejfzBRFVcwVYPq4L0APSWWoJu+5UYX4qg5U6YTioqQGPG9XrnuZ/BkxuYpe6Li87+18EskyQW/uA+uk2rpHpr6hut2TlVbKgWkFpx+AZffweiw2+VittkEyf/ifinS/0ItRL2Jq3tQOcxPaWO2xrG68GdFoUpZgFXaP2wYVtRc6xYCfI1CaBqyWpg4bx8OHBQwsV4XWMibZZ0LYjWEy2IxQ1mZrf1/UNbYCJplWu3nZ4WpodIGVA05d+RWSS+ET9tH3RfGGmNI1cIY7evZZq7o+a0bjjygpmR3mVfalkT/SZGT27Q8QGalwGlDOS9VHCyFAIL0a1Q7JiW3saz9gqY8lqKynFrPCzxkU4SIfLc9VfCI5edgRhDXs0edO992nhTKHriREP1NJC6SROMgQ0xO5kNNZOhMOIT99AUElbxqeZF8A3xrfDJsWtDnUenAHdYWSwAbYjFqQZ+D5gi3hNK8CSxU9i6f6ClL9IGlj1OPMQAsr84YG6ijsJpCaGWj75c3yOZKBB9mNpQNPUKkK0D6wgLH8MGoyRxTX6Y05Q4AnYNXMZwXM4eij/9WpsM/9CoRnFQXGR6MEaY+FXvXEO3RO0JaStk6OXuHVATHJE+1W+TU3bSZ2ksMtqjO0zfSJCdBv7y2d8DMx6TfVme3q0ZpTKMMu4YL/t7ciTNtdDkwPogh3Cnjx7qk08SHwf+dksZ7M2vCOlfsF0hQ6J4ehPCaHTNrM/zBSOqD83dBEBCW/F/LEmeh0nOHd7oVl3/Qo/9GUDkkbj7yz+9cvvu+dDAtx8NzCDTP4iKdZvk9MWiizvtILLepysflSvTLFBZ37RLwiriqyRxYv/zrgFd/9XVHh/OmzBvDX4mitMR/lUavs2Vx6cR94lzAkplm3IRNy4TFfu47tuYs9EQPIPVta4P64tV+sZ7n3ued3cgEx2YK+QL5+xms6osk8qQbTyuKVGdaX9FQqk6qfDnT5ykxk0VK7KZ62b6DNDUfQlqGHxSMKv1P0XN5BqMeKG1P4Wp5QfZDUCEldppoX0U6ss2jIko2XpURKCIhfaOqLPfShdtS37ZrT+jFRSH2xYVV1rmT/MBtRQhxiO4MQ3iAGlaZi+9PWBEIXOVnu9jN1f921lWLZky9bqbM3J2MAAI9jmuAx3gyoEUa6P2ivs0EeNv/OR+AX6q5SW6l5HaoFuS6jr6yg9limu+P0KYKzfMXWcQSfTXzpOzKEKpwI3YGXZpSSy2LTlMgfmFA3CF6R5c9xWEtRuCg2ZPUQ2Nb6dRFTNd4TfGHrnEWSKHPuRyiJSDAZ+KX0VxmSHjGPbQTLVpqixia2uyhQ394gBMt7C3ZAmxn/DJS+l1fBsAo2Eir/C0jG9csd4+/tp12pPc/BVJGaK9mfvr7M/CeztrmCO5qY06Edi4xAGtiEhnWAbzLy2VEyazE1J5nPmgU4RpW4Sa0TnOT6w5lgt3/tMpROigHHmexBGAMY0mdcDbDxWIz41NgdD6oxgHsJRgr5RnT6wZAkTOcStU4NMOQNemSO7gxGahdEsC+NRVGxMUhQmmM0llWRbbmFGHzEqLM4Iw0H7577Kyo+Zf+2cUFIOw93gEY171vQaM0HLwpjpdRR6Jz7V0ckE7XzYJ0TmY9znLdzkva0vNrAGGT5SUZ5uaHDkcGvI0ySpwkasEgZPMseYcu85w8HPdSNi+4T6A83iAwDbxgeFcB1ZM2iGXzFcEOUlYVrEckaOyodfvaYSQ7GuB4ISE0nYJc15X/1ciDTPbPCgYJK55VkEor4LvzL9S2WDy4xj+6FOqVyTAC2ZNowheeeSI5hA/02l8UYkv4nk9iaVn+kCVEUstgk5Hyq+gJm6R9vG3rhuM904he/hFmNQaUIATB1y3vw+OmxP4X5Yi6A5I5jJufHCjF9+AGNwnEllZjUco6XhsO5T5+R3yxz5yLVOnAn0zuS+6zdj0nTJbEZCbXJdtpfYZfCeCOqJHoE2vPPFS6eRLjIJlG69X93nfR0mxSFXzp1Zc0lt/VafDaImhUMtbnqWVb9M4nGNQLN68BHP7AR8Il9dkcxzmBv8PCZlw9guY0lurbBsmNYlwJZsA/B15/HfkbjbwPddaVecls/elmDHNW2r4crAx43feNkfRwsaNq/yyJ0d/p5hZ6AZajz7DBfUok0ZU62gCzz7x8eVfJTKA8IWn45vINLSM1q+HF9CV9qF3zP6Ml21kPPL3CXzkuYUlnSqT+Ij4tI/od5KwIs+tDajDs64owN7tOAd6eucGz+KfO26iNcBFpbWA5732bBNWO4kHNpr9D955L61bvHCF/mwSrz6eQaDjfDEANqGMkFc+NGxpKZzCD2sj/JrHd+zlPQ8Iz7Q+2JVIiVCuCKoK/hlAEHzvk/Piq3mRL1rT/fEh9hoT5GJmeYswg1otiKydizJ/fS2SeKHVu6Z3JEHjiW8NaTQgP5xdBli8nC57XiN9hrquBu99hn9zqwo92+PM2JXtpeVZS0PdqR5mDyDreMMtEws+CpwaRyyzoYtfcvt9PJIW0fJVNNi/FFyRsea7peLvJrL+5b4GOXJ8tAr+ATk9f8KmiIsRhqRy0vFzwRV3Z5dZ3QqIU8JQ/uQpkJbjMUMFj2F9sCFeaBjI4+fL/oN3+LQgjI4zuAfQ+3IPIPFQBccf0clJpsfpnBxD84atwtupkGqKvrH7cGNl/QcWcSi6wcVDML6ljOgYbo+2BOAWNNjlUBPiyitUAwbnhFvLbnqw42kR3Yp2kv2dMeDdcGOX5kT4S6M44KHEB/SpCfl7xgsUvs+JNY9G3O2X/6FEt9FyAn57lrbiu+tl83sCymSvq9eZbe9mchL7MTf/Ta78e80zSf0hYY5eUU7+ff14jv7Xy8qjzfzzzvaJnrIdvFb5BLWKcWGy5/w7+vV2cvIfwHqdTB+RuJK5oj9mbt0Hy94AmjMjjwYNZlNS6uiyxNnwNyt3gdreLb64p/3+08nXkb92LTkkRgFOwk1oGEVllcOj5lv1hfAZywDows0944U8vUFw+A/nuVq/UCygsrmWIBnHyU01d0XJPwriEOvx/ISK6Pk4y2w0gmojZs7lU8TtakBAdne4v/aNxmMpK4VcGMp7si0yqsiolXRuOi1Z1P7SqD3Zmp0CWcyK4Ubmp2SXiXuI5nGLCieFHKHNRIlcY3Pys2dwMTYCaqlyWSITwr2oGXvyU3h1Pf8eQ3w1bnD7ilocVjYDkcXR3Oo1BXgMLTUjNw2xMVwjtp99NhSVc5aIWrDQT5DHPKtCtheBP4zHcw4dz2eRdTMamhlHhtfgqJJHI7NGDUw1XL8vsSeSHyKqDtqoAmrQqsYwvwi7HW3ojWyhIa5oz5xJTaq14NAzFLjVLR12rRNUQ6xohDnrWFb5bG9yf8aCD8d5phoackcNJp+Dw3Due3RM+5Rid7EuIgsnwgpX0rUWh/nqPtByMhMZZ69NpgvRTKZ62ViZ+Q7Dp5r4K0d7EfJuiy06KuIYauRh5Ecrhdt2QpTS1k1AscEHvapNbU3HL1F2TFyR33Wxb5MvH5iZsrn3SDcsxlnnshO8PLwmdGN+paWnQuORtZGX37uhFT64SeuPsx8UOokY6ON85WdQ1dki5zErsJGazcBOddWJEKqNPiJpsMD1GrVLrVY+AOdPWQneTyyP1hRX/lMM4ZogGGOhYuAdr7F/DOiAoc++cn5vlf0zkMUJ40Z1rlgv9BelPqVOpxKeOpzKdF8maK+1Vv23MO9k/8+qpLoxrIGH2EDQlnGmH8CD31G8QqlyQIcpmR5bwmSVw9/Ns6IHgulCRehvZ/+VrM60Cu/r3AontFfrljew74skYe2uyn7JKQtFQBQRJ9ryGic/zQOsbS4scUBctA8cPToQ3x6ZBQu6DPu5m1bnCtP8TllLYA0UTQNVqza5nfew3Mopy1GPUwG5jsl0OVXniPmAcmLqO5HG8Hv3nSLecE9oOjPDXcsTxoCBxYyzBdj4wmnyEV4kvFDunipS8SSkvdaMnTBN9brHUR8xdmmEAp/Pdqk9uextp1t+JrtXwpN/MG2w/qhRMpSNxQ1uhg/kKO30eQ/FyHUDkWHT8V6gGRU4DhDMxZu7xXij9Ui6jlpWmQCqJg3FkOTq3WKneCRYZxBXMNAVLQgHXSCGSqNdjebY94oyIpVjMYehAiFx/tqzBXFHZaL5PeeD74rW5OysFoUXY8sebUZleFTUa/+zBKVTFDopTReXNuZq47QjkWnxjirCommO4L/GrFtVV21EpMyw8wyThL5Y59d88xtlx1g1ttSICDwnof6lt/6zliPzgVUL8jWBjC0o2D6Kg+jNuThkAlaDJsq/AG2aKA//A76avw2KNqtv223P+Wq3StRDDNKFFgtsFukYt1GFDWooFVXitaNhb3RCyJi4cMeNjROiPEDb4k+G3+hD8tsg+5hhmSc/8t2JTSwYoCzAI75doq8QTHe+E/Tw0RQSUDlU+6uBeNN3h6jJGX/mH8oj0i3caCNsjvTnoh73BtyZpsflHLq6AfwJNCDX4S98h4+pCOhGKDhV3rtkKHMa3EG4J9y8zFWI4UsfNzC/Rl5midNn7gwoN9j23HGCQQ+OAZpTTPMdiVow740gIyuEtd0qVxMyNXhHcnuXRKdw5wDUSL358ktjMXmAkvIB73BLa1vfF9BAUZInPYJiwxqFWQQBVk7gQH4ojfUQ/KEjn+A/WR6EEe4CtbpoLe1mzHkajgTIoE0SLDHVauKhrq12zrAXBGbPPWKCt4DGedq3JyGRbmPFW32bE7T20+73BatV/qQhhBWfWBFHfhYWXjALts38FemnoT+9bn1jDBMcUMmYgSc0e7GQjv2MUBwLU8ionCpgV+Qrhg7iUIfUY6JFxR0Y+ZTCPM+rVuq0GNLyJXX6nrUTt8HzFBRY1E/FIm2EeVA9NcXrj7S6YYIChVQCWr/m2fYUjC4j0XLkzZ8GCSLfmkW3PB/xq+nlXsKVBOj7vTvqKCOMq7Ztqr3cQ+N8gBnPaAps+oGwWOkbuxnRYj/x/WjiDclVrs22xMK4qArE1Ztk1456kiJriw6abkNeRHogaPRBgbgF9Z8i/tbzWELN4CvbqtrqV9TtGSnmPS2F9kqOIBaazHYaJ9bi3AoDBvlZasMluxt0BDXfhp02Jn411aVt6S4TUB8ZgFDkI6TP6gwPY85w+oUQSsjIeXVminrwIdK2ZAawb8Se6XOJbOaliQxHSrnAeONDLuCnFejIbp4YDtBcQCwMsYiRZfHefuEJqJcwKTTJ8sx5hjHmJI1sPFHOr6W9AhZ2NAod38mnLQk1gOz2LCAohoQbgMbUK9RMEA3LkiF7Sr9tLZp6lkciIGhE2V546w3Mam53VtVkGbB9w0Yk2XiRnCmbpxmHr2k4eSC0RuNbjNsUfDIfc8DZvRvgUDe1IlKdZTzcT4ZGEb53dp8VtsoZlyXzLHOdAbsp1LPTVaHvLA0GYDFMbAW/WUBfUAdHwqLFAV+3uHvYWrCfhUOR2i89qvCBoOb48usAGdcF2M4aKn79k/43WzBZ+xR1L0uZfia70XP9soQReeuhZiUnXFDG1T8/OXNmssTSnYO+3kVLAgeiY719uDwL9FQycgLPessNihMZbAKG7qwPZyG11G1+ZA3jAX2yddpYfmaKBlmfcK/V0mwIRUDC0nJSOPUl2KB8h13F4dlVZiRhdGY5farwN+f9hEb1cRi41ZcGDn6Xe9MMSTOY81ULJyXIHSWFIQHstVYLiJEiUjktlHiGjntN5/btB8Fu+vp28zl2fZXN+dJDyN6EXhS+0yzqpl/LSJNEUVxmu7BsNdjAY0jVsAhkNuuY0E1G48ej25mSt+00yPbQ4SRCVkIwb6ISvYtmJRPz9Zt5dk76blf+lJwAPH5KDF+vHAmACLoCdG2Adii6dOHnNJnTmZtoOGO8Q1jy1veMw6gbLFToQmfJa7nT7Al89mRbRkZZQxJTKgK5Kc9INzmTJFp0tpAPzNmyL/F08bX3nhCumM/cR/2RPn9emZ3VljokttZD1zVWXlUIqEU7SLk5I0lFRU0AcENXBYazNaVzsVHA/sD3o9hm42wbHIRb/BBQTKzAi8s3+bMtpOOZgLdQzCYPfX3UUxKd1WYVkGH7lh/RBBgMZZwXzU9+GYxdBqlGs0LP+DZ5g2BWNh6FAcR944B+K/JTWI3t9YyVyRhlP4CCoUk/mmF7+r2pilVBjxXBHFaBfBtr9hbVn2zDuI0kEOG3kBx8CGdPOjX1ph1POOZJUO1JEGG0jzUy2tK4X0CgVNYhmkqqQysRNtKuPdCJqK3WW57kaV17vXgiyPrl4KEEWgiGF1euI4QkSFHFf0TDroQiLNKJiLbdhH0YBhriRNCHPxSqJmNNoketaioohqMglh6wLtEGWSM1EZbQg72h0UJAIPVFCAJOThpQGGdKfFovcwEeiBuZHN2Ob4uVM7+gwZLz1D9E7ta4RmMZ24OBBAg7Eh6dLXGofZ4U2TFOCQMKjwhVckjrydRS+YaqCw1kYt6UexuzbNEDyYLTZnrY1PzsHZJT4U+awO2xlqTSYu6n/U29O2wPXgGOEKDMSq+zTUtyc8+6iLp0ivav4FKx+xxVy4FxhIF/pucVDqpsVe2jFOfdZhTzLz2QjtzvsTCvDPU7bzDH2eXVKUV9TZ+qFtaSSxnYgYdXKwVreIgvWhT9eGDB2OvnWyPLfIIIfNnfIxU8nW7MbcH05nhlsYtaW9EZRsxWcKdEqInq1DiZPKCz7iGmAU9/ccnnQud2pNgIGFYOTAWjhIrd63aPDgfj8/sdlD4l+UTlcxTI9jbaMqqN0gQxSHs60IAcW3cH4p3V1aSciTKB29L1tz2eUQhRiTgTvmqc+sGtBNh4ky0mQJGsdycBREP+fAaSs1EREDVo5gvgi5+aCN7NECw30owbCc1mSpjiahyNVwJd1jiGgzSwfTpzf2c5XJvG/g1n0fH88KHNnf+u7ZiRMlXueSIsloJBUtW9ezvsx9grfsX/FNxnbxU1Lvg0hLxixypHKGFAaPu0xCD8oDTeFSyfRT6s8109GMUZL8m2xXp8X2dpPCWWdX84iga4BrTlOfqox4shqEgh/Ht4qRst52cA1xOIUuOxgfUivp6v5f8IVyaryEdpVk72ERAwdT4aoY1usBgmP+0m06Q216H/nubtNYxHaOIYjcach3A8Ez/zc0KcShhel0HCYjFsA0FjYqyJ5ZUH1aZw3+zWC0hLpM6GDfcAdn9fq2orPmZbW6XXrf+Krc9RtvII5jeD3dFoT1KwZJwxfUMvc5KLfn8rROW23Jw89sJ2a5dpB3qWDUBWF2iX8OCuKprHosJ2mflBR+Wqs86VvgI/XMnsqb97+VlKdPVysczPj8Jhzf+WCvGBHijAqYlavbF60soMWlHbvKT+ScvhprgeTln51xX0sF+Eadc/l2s2a5BgkVbHYyz0E85p0LstqH+gEGiR84nBRRFIn8hLSZrGwqjZ3E29cuGi+5Z5bp7EM8MWFa9ssS/vy4VrDfECSv7DSU84DaP0sXI3Ap4lWznQ65nQoTKRWU30gd7Nn8ZowUvGIx4aqyXGwmA/PB4qN8msJUODezUHEl0VP9uo+cZ8vPFodSIB4C7lQYjEFj8yu49C2KIV3qxMFYTevG8KqAr0TPlkbzHHnTpDpvpzziAiNFh8xiT7C/TiyH0EguUw4vxAgpnE27WIypV+uFN2zW7xniF/n75trs9IJ5amB1zXXZ1LFkJ6GbS/dFokzl4cc2mamVwhL4XU0Av5gDWAl+aEWhAP7t2VIwU+EpvfOPDcLASX7H7lZpXA2XQfbSlD4qU18NffNPoAKMNSccBfO9YVVgmlW4RydBqfHAV7+hrZ84WJGho6bNT0YMhxxLdOx/dwGj0oyak9aAkNJ8lRJzUuA8sR+fPyiyTgUHio5+Pp+YaKlHrhR41jY5NESPS3x+zTMe0S2HnLOKCOQPpdxKyviBvdHrCDRqO+l96HhhNBLXWv4yEMuEUYo8kXnYJM8oIgVM4XJ+xXOev4YbWeqsvgq0lmw4/PiYr9sYLt+W5EAuYSFnJEan8CwJwbtASBfLBBpJZiRPor/aCJBZsM+MhvS7ZepyHvU8m5WSmaZnxuLts8ojl6KkS8oSAHkq5GWlCB/NgJ5W3rO2Cj1MK7ahxsCrbTT3a0V/QQH+sErxV4XUWDHx0kkFy25bPmBMBQ6BU3HoHhhYcJB9JhP6NXUWKxnE0raXHB6U9KHpWdQCQI72qevp5fMzcm+AvC85rsynVQhruDA9fp9COe7N56cg1UKGSas89vrN+WlGLYTwi5W+0xYdKEGtGCeNJwXKDU0XqU5uQYnWsMwTENLGtbQMvoGjIFIEMzCRal4rnBAg7D/CSn8MsCvS+FDJJAzoiioJEhZJgAp9n2+1Yznr7H+6eT4YkJ9Mpj60ImcW4i4iHDLn9RydB8dx3QYm3rsX6n4VRrZDsYK6DCGwkwd5n3/INFEpk16fYpP6JtMQpqEMzcOfQGAHXBTEGzuLJ03GYQL9bmV2/7ExDlRf+Uvf1sM2frRtCWmal12pMgtonvSCtR4n1CLUZRdTHDHP1Otwqd+rcdlavnKjUB/OYXQHUJzpNyFoKpQK+2OgrEKpGyIgIBgn2y9QHnTJihZOpEvOKIoHAMGAXHmj21Lym39Mbiow4IF+77xNuewziNVBxr6KD5e+9HzZSBIlUa/AmsDFJFXeyrQakR3FwowTGcADJHcEfhGkXYNGSYo4dh4bxwLM+28xjiqkdn0/3R4UEkvcBrBfn/SzBc1XhKM2VPlJgKSorjDac96V2UnQYXl1/yZPT4DVelgO+soMjexXwYO58VLl5xInQUZI8jc3H2CPnCNb9X05nOxIy4MlecasTqGK6s2az4RjpF2cQP2G28R+7wDPsZDZC/kWtjdoHC7SpdPmqQrUAhMwKVuxCmYTiD9q/O7GHtZvPSN0CAUQN/rymXZNniYLlJDE70bsk6Xxsh4kDOdxe7A2wo7P9F5YvqqRDI6brf79yPCSp4I0jVoO4YnLYtX5nzspR5WB4AKOYtR1ujXbOQpPyYDvfRE3FN5zw0i7reehdi7yV0YDRKRllGCGRk5Yz+Uv1fYl2ZwrnGsqsjgAVo0xEUba8ohjaNMJNwTwZA/wBDWFSCpg1eUH8MYL2zdioxRTqgGQrDZxQyNzyBJPXZF0+oxITJAbj7oNC5JwgDMUJaM5GqlGCWc//KCIrI+aclEe4IA0uzv7cuj6GCdaJONpi13O544vbtIHBF+A+JeDFUQNy61Gki3rtyQ4aUywn6ru314/dkGiP8Iwjo0J/2Txs49ZkwEl4mx+iYUUO55I6pJzU4P+7RRs+DXZkyKUYZqVWrPF4I94m4Wx1tXeE74o9GuX977yvJ/jkdak8+AmoHVjI15V+WwBdARFV2IPirJgVMdsg1Pez2VNHqa7EHWdTkl3XTcyjG9BiueWFvQfXI8aWSkuuRmqi/HUuzqyvLJfNfs0txMqldYYflWB1BS31WkuPJGGwXUCpjiQSktkuBMWwHjSkQxeehqw1Kgz0Trzm7QbtgxiEPDVmWCNCAeCfROTphd1ZNOhzLy6XfJyG6Xgd5MCAZw4xie0Sj5AnY1/akDgNS9YFl3Y06vd6FAsg2gVQJtzG7LVq1OH2frbXNHWH/NY89NNZ4QUSJqL2yEcGADbT38X0bGdukqYlSoliKOcsSTuqhcaemUeYLLoI8+MZor2RxXTRThF1LrHfqf/5LcLAjdl4EERgUysYS2geE+yFdasU91UgUDsc2cSQ1ZoT9+uLOwdgAmifwQqF028INc2IQEDfTmUw3eZxvz7Ud1z3xc1PQfeCvfKsB9jOhRj7rFyb9XcDWLcYj0bByosychMezMLVkFiYcdBBQtvI6K0KRuOZQH2kBsYHJaXTkup8F0eIhO1/GcIwWKpr2mouB7g5TUDJNvORXPXa/mU8bh27TAZYBe2sKx4NSv5OjnHIWD2RuysCzBlUfeNXhDd2jxnHoUlheJ3jBApzURy0fwm2FwwsSU0caQGl0Kv8hopRQE211NnvtLRsmCNrhhpEDoNiZEzD2QdJWKbRRWnaFedXHAELSN0t0bfsCsMf0ktfBoXBoNA+nZN9+pSlmuzspFevmsqqcMllzzvkyXrzoA+Ryo1ePXpdGOoJvhyru+EBRsmOp7MXZ0vNUMUqHLUoKglg1p73sWeZmPc+KAw0pE2zIsFFE5H4192KwDvDxdxEYoDBDNZjbg2bmADTeUKK57IPD4fTYF4c6EnXx/teYMORBDtIhPJneiZny7Nv/zG+YmekIKCoxr6kauE2bZtBLufetNG0BtBY7f+/ImUypMBvdWu/Q7vTMRzw5aQGZWuc1V0HEsItFYMIBnoKGZ0xcarba/TYZq50kCaflFysYjA4EDKHqGdpYWdKYmm+a7TADmW35yfnOYpZYrkpVEtiqF0EujI00aeplNs2k+qyFZNeE3CDPL9P6b4PQ/kataHkVpLSEVGK7EX6rAa7IVNrvZtFvOA6okKvBgMtFDAGZOx88MeBcJ8AR3AgUUeIznAN6tjCUipGDZONm1FjWJp4A3QIzSaIOmZ7DvF/ysYYbM/fFDOV0jntAjRdapxJxL0eThpEhKOjCDDq2ks+3GrwxqIFKLe1WdOzII8XIOPGnwy6LKXVfpSDOTEfaRsGujhpS4hBIsMOqHbl16PJxc4EkaVu9wpEYlF/84NSv5Zum4drMfp9yXbzzAOJqqS4YkI4cBrFrC7bMPiCfgI3nNZAqkk3QOZqR+yyqx+nDQKBBBZ7QKrfGMCL+XpqFaBJU0wpkBdAhbR4hJsmT5aynlvkouoxm/NjD5oe6BzVIO9uktM+/5dEC5P7vZvarmuO/lKXz4sBabVPIATuKTrwbJP8XUkdM6uEctHKXICUJGjaZIWRbZp8czquQYfY6ynBUCfIU+gG6wqSIBmYIm9pZpXdaL121V7q0VjDjmQnXvMe7ysoEZnZL15B0SpxS1jjd83uNIOKZwu5MPzg2NhOx3xMOPYwEn2CUzbSrwAs5OAtrz3GAaUkJOU74XwjaYUmGJdZBS1NJVkGYrToINLKDjxcuIlyfVsKQSG/G4DyiO2SlQvJ0d0Ot1uOG5IFSAkq+PRVMgVMDvOIJMdqjeCFKUGRWBW9wigYvcbU7CQL/7meF2KZAaWl+4y9uhowAX7elogAvItAAxo2+SFxGRsHGEW9BnhlTuWigYxRcnVUBRQHV41LV+Fr5CJYV7sHfeywswx4XMtUx6EkBhR+q8AXXUA8uPJ73Pb49i9KG9fOljvXeyFj9ixgbo6CcbAJ7WHWqKHy/h+YjBwp6VcN7M89FGzQ04qbrQtgrOFybg3gQRTYG5xn73ArkfQWjCJROwy3J38Dx/D7jOa6BBNsitEw1wGq780EEioOeD+ZGp2J66ADiVGMayiHYucMk8nTK2zzT9CnEraAk95kQjy4k0GRElLL5YAKLQErJ5rp1eay9O4Fb6yJGm9U4FaMwPGxtKD6odIIHKoWnhKo1U8KIpFC+MVn59ZXmc7ZTBZfsg6FQ8W10YfTr4u0nYrpHZbZ1jXiLmooF0cOm0+mPnJBXQtepc7n0BqOipNCqI6yyloTeRShNKH04FIo0gcMk0H/xThyN4pPAWjDDkEp3lNNPRNVfpMI44CWRlRgViP64eK0JSRp0WUvCWYumlW/c58Vcz/yMwVcW5oYb9+26TEhwvbxiNg48hl1VI1UXTU//Eta+BMKnGUivctfL5wINDD0giQL1ipt6U7C9cd4+lgqY2lMUZ02Uv6Prs+ZEZer7ZfWBXVghlfOOrClwsoOFKzWEfz6RZu1eCs+K8fLvkts5+BX0gyrFYve0C3qHrn5U/Oh6D/CihmWIrY7HUZRhJaxde+tldu6adYJ+LeXupQw0XExC36RETdNFxcq9glMu4cNQSX9cqR/GQYp+IxUkIcNGWVU7ZtGa6P3XAyodRt0XeS3Tp01AnCh0ZbUh4VrSZeV9RWfSoWyxnY3hzcZ30G/InDq4wxRrEejreBxnhIQbkxenxkaxl+k7eLUQkUR6vKJ2iDFNGX3WmVA1yaOH+mvhBd+sE6vacQzFobwY5BqEAFmejwW5ne7HtVNolOUgJc8CsUxmc/LBi8N5mu9VsIA5HyErnS6zeCz7VLI9+n/hbT6hTokMXTVyXJRKSG2hd2labXTbtmK4fNH3IZBPreSA4FMeVouVN3zG5x9CiGpLw/3pceo4qGqp+rVp+z+7yQ98oEf+nyH4F3+J9IheDBa94Wi63zJbLBCIZm7P0asHGpIJt3PzE3m0S4YIWyXBCVXGikj8MudDPB/6Nm2v4IxJ5gU0ii0guy5SUHqGUYzTP0jIJU5E82RHUXtX4lDdrihBLdP1YaG1AGUC12rQKuIaGvCpMjZC9bWSCYnjDlvpWbkdXMTNeBHLKiuoozMGIvkczmP0aRJSJ8PYnLCVNhKHXBNckH79e8Z8Kc2wUej4sQZoH8qDRGkg86maW/ZQWGNnLcXmq3FlXM6ssR/3P6E/bHMvm6HLrv1yRixit25JsH3/IOr2UV4BWJhxXW5BJ6Xdr07n9kF3ZNAk6/Xpc5MSFmYJ2R7bdL8Kk7q1OU9Elg/tCxJ8giT27wSTySF0GOxg4PbYJdi/Nyia9Nn89CGDulfJemm1aiEr/eleGSN+5MRrVJ4K6lgyTTIW3i9cQ0dAi6FHt0YMbH3wDSAtGLSAccezzxHitt1QdhW36CQgPcA8vIIBh3/JNjf/Obmc2yzpk8edSlS4lVdwgW5vzbYEyFoF4GCBBby1keVNueHAH+evi+H7oOVfS3XuPQSNTXOONAbzJeSb5stwdQHl1ZjrGoE49I8+A9j3t+ahhQj74FCSWpZrj7wRSFJJnnwi1T9HL5qrCFW/JZq6P62XkMWTb+u4lGpKfmmwiJWx178GOG7KbrZGqyWwmuyKWPkNswkZ1q8uptUlviIi+AXh2bOOTOLsrtNkfqbQJeh24reebkINLkjut5r4d9GR/r8CBa9SU0UQhsnZp5cP+RqWCixRm7i4YRFbtZ4EAkhtNa6jHb6gPYQv7MKqkPLRmX3dFsK8XsRLVZ6IEVrCbmNDc8o5mqsogjAQfoC9Bc7R6gfw03m+lQpv6kTfhxscDIX6s0w+fBxtkhjXAXr10UouWCx3C/p/FYwJRS/AXRKkjOb5CLmK4XRe0+xeDDwVkJPZau52bzLEDHCqV0f44pPgKOkYKgTZJ33fmk3Tu8SdxJ02SHM8Fem5SMsWqRyi2F1ynfRJszcFKykdWlNqgDA/L9lKYBmc7Zu/q9ii1FPF47VJkqhirUob53zoiJtVVRVwMR34gV9iqcBaHbRu9kkvqk3yMpfRFG49pKKjIiq7h/VpRwPGTHoY4cg05X5028iHsLvUW/uz+kjPyIEhhcKUwCkJAwbR9pIEGOn8z6svAO8i89sJ3dL5qDWFYbS+HGPRMxYwJItFQN86YESeJQhn2urGiLRffQeLptDl8dAgb+Tp47UQPxWOw17OeChLN1WnzlkPL1T5O+O3Menpn4C3IY5LEepHpnPeZHbvuWfeVtPlkH4LZjPbBrkJT3NoRJzBt86CO0Xq59oQ+8dsm0ymRcmQyn8w71mhmcuEI5byuF+C88VPYly2sEzjlzAQ3vdn/1+Hzguw6qFNNbqenhZGbdiG6RwZaTG7jTA2X9RdXjDN9yj1uQpyO4Lx8KRAcZcbZMafp4wPOd5MdXoFY52V1A8M9hi3sso93+uprE0qYNMjkE22CvK4HuUxqN7oIz5pWuETq1lQAjqlSlqdD2Rnr/ggp/TVkQYjn9lMfYelk2sH5HPdopYo7MHwlV1or9Bxf+QCyLzm92vzG2wjiIjC/ZHEJzeroJl6bdFPTpZho5MV2U86fLQqxNlGIMqCGy+9WYhJ8ob1r0+Whxde9L2PdysETv97O+xVw+VNN1TZSQN5I6l9m5Ip6pLIqLm4a1B1ffH6gHyqT9p82NOjntRWGIofO3bJz5GhkvSWbsXueTAMaJDou99kGLqDlhwBZNEQ4mKPuDvVwSK4WmLluHyhA97pZiVe8g+JxmnJF8IkV/tCs4Jq/HgOoAEGR9tCDsDbDmi3OviUQpG5D8XmKcSAUaFLRXb2lmJTNYdhtYyfjBYZQmN5qT5CNuaD3BVnlkCk7bsMW3AtXkNMMTuW4HjUERSJnVQ0vsBGa1wo3Qh7115XGeTF3NTz8w0440AgU7c3bSXO/KMINaIWXd0oLpoq/0/QJxCQSJ9XnYy1W7TYLBJpHsVWD1ahsA7FjNvRd6mxCiHsm8g6Z0pnzqIpF1dHUtP2ITU5Z1hZHbu+L3BEEStBbL9XYvGfEakv1bmf+bOZGnoiuHEdlBnaChxYKNzB23b8sw8YyT7Ajxfk49eJIAvdbVkdFCe2J0gMefhQ0bIZxhx3fzMIysQNiN8PgOUKxOMur10LduigREDRMZyP4oGWrP1GFY4t6groASsZ421os48wAdnrbovNhLt7ScNULkwZ5AIZJTrbaKYTLjA1oJ3sIuN/aYocm/9uoQHEIlacF1s/TM1fLcPTL38O9fOsjMEIwoPKfvt7opuI9G2Hf/PR4aCLDQ7wNmIdEuXJ/QNL72k5q4NejAldPfe3UVVqzkys8YZ/jYOGOp6c+YzRCrCuq0M11y7TiN6qk7YXRMn/gukxrEimbMQjr3jwRM6dKVZ4RUfWQr8noPXLJq6yh5R3EH1IVOHESst/LItbG2D2vRsZRkAObzvQAAD3mb3/G4NzopI0FAiHfbpq0X72adg6SRj+8OHMShtFxxLZlf/nLgRLbClwl5WmaYSs+yEjkq48tY7Z2bE0N91mJwt+ua0NlRJIDh0HikF4UvSVorFj2YVu9YeS5tfvlVjPSoNu/Zu6dEUfBOT555hahBdN3Sa5Xuj2Rvau1lQNIaC944y0RWj9UiNDskAK1WoL+EfXcC6IbBXFRyVfX/WKXxPAwUyIAGW8ggZ08hcijKTt1YKnUO6QPvcrmDVAb0FCLIXn5id4fD/Jx4tw/gbXs7WF9b2RgXtPhLBG9vF5FEkdHAKrQHZAJC/HWvk7nvzzDzIXZlfFTJoC3JpGgLPBY7SQTjGlUvG577yNutZ1hTfs9/1nkSXK9zzKLRZ3VODeKUovJe0WCq1zVMYxCJMenmNzPIU2S8TA4E7wWmbNkxq9rI2dd6v0VpcAPVMxnDsvWTWFayyqvKZO7Z08a62i/oH2/jxf8rpmfO64in3FLiL1GX8IGtVE9M23yGsIqJbxDTy+LtaMWDaPqkymb5VrQdzOvqldeU0SUi6IirG8UZ3jcpRbwHa1C0Dww9G/SFX3gPvTJQE+kyz+g1BeMILKKO+olcHzctOWgzxYHnOD7dpCRtuZEXACjgqesZMasoPgnuDC4nUviAAxDc5pngjoAITIkvhKwg5d608pdrZcA+qn5TMT6Uo/QzBaOxBCLTJX3Mgk85rMfsnWx86oLxf7p2PX5ONqieTa/qM3tPw4ZXvlAp83NSD8F7+ZgctK1TpoYwtiU2h02HCGioH5tkVCqNVTMH5p00sRy2JU1qyDBP2CII/Dg4WDsIl+zgeX7589srx6YORRQMBfKbodbB743Tl4WLKOEnwWUVBsm94SOlCracU72MSyj068wdpYjyz1FwC2bjQnxnB6Mp/pZ+yyZXtguEaYB+kqhjQ6UUmwSFazOb+rhYjLaoiM+aN9/8KKn0zaCTFpN9eKwWy7/u4EHzO46TdFSNjMfn2iPSJwDPCFHc0I1+vjdAZw5ZjqR/uzi9Zn20oAa5JnLEk/EA3VRWE7J/XrupfFJPtCUuqHPpnlL7ISJtRpSVcB8qsZCm2QEkWoROtCKKxUh3yEcMbWYJwk6DlEBG0bZP6eg06FL3v6RPb7odGuwm7FN8fG4woqtB8e7M5klPpo97GoObNwt+ludTAmxyC5hmcFx+dIvEZKI6igFKHqLH01iY1o7903VzG9QGetyVx5RNmBYUU+zIuSva/yIcECUi4pRmE3VkF2avqulQEUY4yZ/wmNboBzPmAPey3+dSYtBZUjeWWT0pPwCz4Vozxp9xeClIU60qvEFMQCaPvPaA70WlOP9f/ey39macvpGCVa+zfa8gO44wbxpJUlC8GN/pRMTQtzY8Z8/hiNrU+Zq64ZfFGIkdj7m7abcK1EBtws1X4J/hnqvasPvvDSDYWN+QcQVGMqXalkDtTad5rYY0TIR1Eqox3czwPMjKPvF5sFv17Thujr1IZ1Ytl4VX1J0vjXKmLY4lmXipRAro0qVGEcXxEVMMEl54jQMd4J7RjgomU0j1ptjyxY+cLiSyXPfiEcIS2lWDK3ISAy6UZ3Hb5vnPncA94411jcy75ay6B6DSTzK6UTCZR9uDANtPBrvIDgjsfarMiwoax2OlLxaSoYn4iRgkpEGqEkwox5tyI8aKkLlfZ12lO11TxsqRMY89j5JaO55XfPJPDL1LGSnC88Re9Ai+Nu5bZjtwRrvFITUFHPR4ZmxGslQMecgbZO7nHk32qHxYkdvWpup07ojcMCaVrpFAyFZJJbNvBpZfdf39Hdo2kPtT7v0/f8R/B5Nz4f1t9/3zNM/7n6SUHfcWk5dfQFJvcJMgPolGCpOFb/WC0FGWU2asuQyT+rm88ZKZ78Cei/CAh939CH0JYbpZIPtxc2ufXqjS3pHH9lnWK4iJ7OjR/EESpCo2R3MYKyE7rHfhTvWho4cL1QdN4jFTyR6syMwFm124TVDDRXMNveI1Dp/ntwdz8k8kxw7iFSx6+Yx6O+1LzMVrN0BBzziZi9kneZSzgollBnVwBh6oSOPHXrglrOj+QmR/AESrhDpKrWT+8/AiMDxS/5wwRNuGQPLlJ9ovomhJWn8sMLVItQ8N/7IXvtD8kdOoHaw+vBSbFImQsv/OCAIui99E+YSIOMlMvBXkAt+NAZK8wB9Jf8CPtB+TOUOR+z71d/AFXpPBT6+A5FLjxMjLIEoJzrQfquvxEIi+WoUzGR1IzQFNvbYOnxb2PyQ0kGdyXKzW2axQL8lNAXPk6NEjqrRD1oZtKLlFoofrXw0dCNWASHzy+7PSzOUJ3XtaPZsxLDjr+o41fKuKWNmjiZtfkOzItvlV2MDGSheGF0ma04qE3TUEfqJMrXFm7DpK+27DSvCUVf7rbNoljPhha5W7KBqVq0ShUSTbRmuqPtQreVWH4JET5yMhuqMoSd4r/N8sDmeQiQQvi1tcZv7Moc7dT5X5AtCD6kNEGZOzVcNYlpX4AbTsLgSYYliiPyVoniuYYySxsBy5cgb3pD+EK0Gpb0wJg031dPgaL8JZt6sIvzNPEHfVPOjXmaXj4bd4voXzpZ5GApMhILgMbCEWZ2zwgdeQgjNHLbPIt+KqxRwWPLTN6HwZ0Ouijj4UF+Sg0Au8XuIKW0WxlexdrFrDcZJ8Shauat3X0XmHygqgL1nAu2hrJFb4wZXkcS+i36KMyU1yFvYv23bQUJi/3yQpqr/naUOoiEWOxckyq/gq43dFou1DVDaYMZK9tho7+IXXokBCs5GRfOcBK7g3A+jXQ39K4YA8PBRW4m5+yR0ZAxWJncjRVbITvIAPHYRt1EJ3YLiUbqIvoKHtzHKtUy1ddRUQ0AUO41vonZDUOW+mrszw+SW/6Q/IUgNpcXFjkM7F4CSSQ2ExZg85otsMs7kqsQD4OxYeBNDcSpifjMoLb7GEbGWTwasVObmB/bfPcUlq0wYhXCYEDWRW02TP5bBrYsKTGWjnWDDJ1F7zWai0zW/2XsCuvBQjPFcTYaQX3tSXRSm8hsAoDdjArK/OFp6vcWYOE7lizP0Yc+8p16i7/NiXIiiQTp7c7Xus925VEtlKAjUdFhyaiLT7VxDagprMFwix4wZ05u0qj7cDWFd0W9OYHIu3JbJKMXRJ1aYNovugg+QqRN7fNHSi26VSgBpn+JfMuPo3aeqPWik/wI5Rz3BWarPQX4i5+dM0npwVOsX+KsOhC7vDg+OJsz4Q5zlnIeflUWL6QYMbf9WDfLmosLF4Qev3mJiOuHjoor/dMeBpA9iKDkMjYBNbRo414HCxjsHrB4EXNbHzNMDHCLuNBG6Sf+J4MZ/ElVsDSLxjIiGsTPhw8BPjxbfQtskj+dyNMKOOcUYIRBEIqbazz3lmjlRQhplxq673VklMMY6597vu+d89ec/zq7Mi4gQvh87ehYbpOuZEXj5g/Q7S7BFDAAB9DzG35SC853xtWVcnZQoH54jeOqYLR9NDuwxsVthTV7V99n/B7HSbAytbEyVTz/5NhJ8gGIjG0E5j3griULUd5Rg7tQR+90hJgNQKQH2btbSfPcaTOfIexc1db1BxUOhM1vWCpLaYuKr3FdNTt/T3PWCpEUWDKEtzYrjpzlL/wri3MITKsFvtF8QVV/NhVo97aKIBgdliNc10dWdXVDpVtsNn+2UIolrgqdWA4EY8so0YvB4a+aLzMXiMAuOHQrXY0tr+CL10JbvZzgjJJuB1cRkdT7DUqTvnswVUp5kkUSFVtIIFYK05+tQxT6992HHNWVhWxUsD1PkceIrlXuUVRogwmfdhyrf6zzaL8+c0L7GXMZOteAhAVQVwdJh+7nrX7x4LaIIfz2F2v7Dg/uDfz2Fa+4gFm2zHAor8UqimJG3VTJtZEoFXhnDYXvxMJFc6ku2bhbCxzij2z5UNuK0jmp1mnvkVNUfR+SEmj1Lr94Lym75PO7Fs0MIr3GdsWXRXSfgLTVY0FLqba97u1In8NAcY7IC6TjWLigwKEIm43NxTdaVTv9mcKkzuzBkKd8x/xt1p/9BbP7Wyb4bpo1K1gnOpbLvKz58pWl3B55RJ/Z5mRDLPtNQg14jdOEs9+h/V5UVpwrAI8kGbX8KPVPDIMfIqKDjJD9UyDOPhjZ3vFAyecwyq4akUE9mDOtJEK1hpDyi6Ae87sWAClXGTiwPwN7PXWwjxaR79ArHRIPeYKTunVW24sPr/3HPz2IwH8oKH4OlWEmt4BLM6W5g4kMcYbLwj2usodD1088stZA7VOsUSpEVl4w7NMb1EUHMRxAxLF0CIV+0L3iZb+ekB1vSDSFjAZ3hfLJf7gFaXrOKn+mhR+rWw/eTXIcAgl4HvFuBg1LOmOAwJH3eoVEjjwheKA4icbrQCmvAtpQ0mXG0agYp5mj4Rb6mdQ+RV4QBPbxMqh9C7o8nP0Wko2ocnCHeRGhN1XVyT2b9ACsL+6ylUy+yC3QEnaKRIJK91YtaoSrcWZMMwxuM0E9J68Z+YyjA0g8p1PfHAAIROy6Sa04VXOuT6A351FOWhKfTGsFJ3RTJGWYPoLk5FVK4OaYR9hkJvezwF9vQN1126r6isMGXWTqFW+3HL3I/jurlIdDWIVvYY+s6yq7lrFSPAGRdnU7PVwY/SvWbZGpXzy3BQ2LmAJlrONUsZs4oGkly0V267xbD5KMY8woNNsmWG1VVgLCra8aQBBcI4DP2BlNwxhiCtHlaz6OWFoCW0vMR3ErrG7JyMjTSCnvRcsEHgmPnwA6iNpJ2DrFb4gLlhKJyZGaWkA97H6FFdwEcLT6DRQQL++fOkVC4cYGW1TG/3iK5dShRSuiBulmihqgjR45Vi03o2RbQbP3sxt90VxQ6vzdlGfkXmmKmjOi080JSHkLntjvsBJnv7gKscOaTOkEaRQqAnCA4HWtB4XnMtOhpRmH2FH8tTXrIjAGNWEmudQLCkcVlGTQ965Kh0H6ixXbgImQP6b42B49sO5C8pc7iRlgyvSYvcnH9FgQ3azLbQG2cUW96SDojTQStxkOJyOuDGTHAnnWkz29aEwN9FT8EJ4yhXOg+jLTrCPKeEoJ9a7lDXOjEr8AgX4BmnMQ668oW0zYPyQiVMPxKRHtpfnEEyaKhdzNVThlxxDQNdrHeZiUFb6NoY2KwvSb7BnRcpJy+/g/zAYx3fYSN5QEaVD2Y1VsNWxB0BSO12MRsRY8JLfAezRMz5lURuLUnG1ToKk6Q30FughqWN6gBNcFxP/nY/iv+iaUQOa+2Nuym46wtI/DvSfzSp1jEi4SdYBE7YhTiVV5cX9gwboVDMVgZp5YBQlHOQvaDNfcCoCJuYhf5kz5kwiIKPjzgpcRJHPbOhJajeoeRL53cuMahhV8Z7IRr6M4hW0JzT7mzaMUzQpm866zwM7Cs07fJYXuWvjAMkbe5O6V4bu71sOG6JQ4oL8zIeXHheFVavzxmlIyBkgc9IZlEDplMPr8xlcyss4pVUdwK1e7CK2kTsSdq7g5SHRAl3pYUB9Ko4fsh4qleOyJv1z3KFSTSvwEcRO/Ew8ozEDYZSqpfoVW9uhJfYrNAXR0Z3VmeoAD+rVWtwP/13sE/3ICX3HhDG3CMc476dEEC0K3umSAD4j+ZQLVdFOsWL2C1TH5+4KiSWH+lMibo+B55hR3Gq40G1n25sGcN0mEcoU2wN9FCVyQLBhYOu9aHVLWjEKx2JIUZi5ySoHUAI9b8hGzaLMxCZDMLhv8MkcpTqEwz9KFDpCpqQhVmsGQN8m24wyB82FAKNmjgfKRsXRmsSESovAwXjBIoMKSG51p6Um8b3i7GISs7kjTq/PZoioCfJzfKdJTN0Q45kQEQuh9H88M3yEs3DbtRTKALraM0YC8laiMiOOe6ADmTcCiREeAWZelBaEXRaSuj2lx0xHaRYqF65O0Lo5OCFU18A8cMDE4MLYm9w2QSr9NgQAIcRxZsNpA7UJR0e71JL+VU+ISWFk5I97lra8uGg7GlQYhGd4Gc6rxsLFRiIeGO4abP4S4ekQ1fiqDCy87GZHd52fn5aaDGuvOmIofrzpVwMvtbreZ/855OaXTRcNiNE0wzGZSxbjg26v8ko8L537v/XCCWP2MFaArJpvnkep0pA+O86MWjRAZPQRfznZiSIaTppy6m3p6HrNSsY7fDtz7Cl4V/DJAjQDoyiL2uwf1UHVd2AIrzBUSlJaTj4k6NL97a/GqhWKU9RUmjnYKpm2r+JYUcrkCuZKvcYvrg8pDoUKQywY9GDWg03DUFSirlUXBS5SWn/KAntnf0IdHGL/7mwXqDG+LZYjbEdQmqUqq4y54TNmWUP7IgcAw5816YBzwiNIJiE9M4lPCzeI/FGBeYy3p6IAmH4AjXXmvQ4Iy0Y82NTobcAggT2Cdqz6Mx4TdGoq9fn2etrWKUNFyatAHydQTVUQ2S5OWVUlugcNvoUrlA8cJJz9MqOa/W3iVno4zDHfE7zhoY5f5lRTVZDhrQbR8LS4eRLz8iPMyBL6o4PiLlp89FjdokQLaSBmKHUwWp0na5fE3v9zny2YcDXG/jfI9sctulHRbdkI5a4GOPJx4oAJQzVZ/yYAado8KNZUdEFs9ZPiBsausotXMNebEgr0dyopuqfScFJ3ODNPHgclACPdccwv0YJGQdsN2lhoV4HVGBxcEUeUX/alr4nqpcc1CCR3vR7g40zteQg/JvWmFlUE4mAiTpHlYGrB7w+U2KdSwQz2QJKBe/5eiixWipmfP15AFWrK8Sh1GBBYLgzki1wTMhGQmagXqJ2+FuqJ8f0XzXCVJFHQdMAw8xco11HhM347alrAu+wmX3pDFABOvkC+WPX0Uhg1Z5MVHKNROxaR84YV3s12UcM+70cJ460SzEaKLyh472vOMD3XnaK7zxZcXlWqenEvcjmgGNR2OKbI1s8U+iwiW+HotHalp3e1MGDy6BMVIvajnAzkFHbeVsgjmJUkrP9OAwnEHYXVBqYx3q7LvXjoVR0mY8h+ZaOnh053pdsGkmbqhyryN01eVHySr+CkDYkSMeZ1xjPNVM+gVLTDKu2VGsMUJqWO4TwPDP0VOg2/8ITbAUaMGb4LjL7L+Pi11lEVMXTYIlAZ/QHmTENjyx3kDkBdfcvvQt6tKk6jYFM4EG5UXDTaF5+1ZjRz6W7MdJPC+wTkbDUim4p5QQH3b9kGk2Bkilyeur8Bc20wm5uJSBO95GfYDI1EZipoRaH7uVveneqz43tlTZGRQ4a7CNmMHgXyOQQOL6WQkgMUTQDT8vh21aSdz7ERiZT1jK9F+v6wgFvuEmGngSvIUR2CJkc5tx1QygfZnAruONobB1idCLB1FCfO7N1ZdRocT8/Wye+EnDiO9pzqIpnLDl4bkaRKW+ekBVwHn46Shw1X0tclt/0ROijuUB4kIInrVJU4buWf4YITJtjOJ6iKdr1u+flgQeFH70GxKjhdgt/MrwfB4K/sXczQ+9zYcrD4dhY6qZhZ010rrxggWA8JaZyg2pYij8ieYEg1aZJkZK9O1Re7sB0iouf60rK0Gd+AYlp7soqCBCDGwfKeUQhCBn0E0o0GS6PdmjLi0TtCYZeqazqwN+yNINIA8Lk3iPDnWUiIPLGNcHmZDxfeK0iAdxm/T7LnN+gemRL61hHIc0NCAZaiYJR+OHnLWSe8sLrK905B5eEJHNlWq4RmEXIaFTmo49f8w61+NwfEUyuJAwVqZCLFcyHBKAcIVj3sNzfEOXzVKIndxHw+AR93owhbCxUZf6Gs8cz6/1VdrFEPrv330+9s6BtMVPJ3zl/Uf9rUi0Z/opexfdL3ykF76e999GPfVv8fJv/Y/+/5hEMon1tqNFyVRevV9y9/uIvsG3dbB8GRRrgaEXfhx+2xeOFt+cEn3RZanNxdEe2+B6MHpNbrRE53PlDifPvFcp4kO78ILR0T4xyW/WGPyBsqGdoA7zJJCu1TKbGfhnqgnRbxbB2B3UZoeQ2bz2sTVnUwokTcTU21RxN1PYPS3Sar7T0eRIsyCNowr9amwoMU/od9s2APtiKNL6ENOlyKADstAEWKA+sdKDhrJ6BOhRJmZ+QJbAaZ3/5Fq0/lumCgEzGEbu3yi0Y4I4EgVAjqxh4HbuQn0GrRhOWyAfsglQJAVL1y/6yezS2k8RE2MstJLh92NOB3GCYgFXznF4d25qiP4ZCyI4RYGesut6FXK6GwPpKK8WHEkhYui0AyEmr5Ml3uBFtPFdnioI8RiCooa7Z1G1WuyIi3nSNglutc+xY8BkeW3JJXPK6jd2VIMpaSxpVtFq+R+ySK9J6WG5Qvt+C+QH1hyYUOVK7857nFmyDBYgZ/o+AnibzNVqyYCJQvyDXDTK+iXdkA71bY7TL3bvuLxLBQ8kbTvTEY9aqkQ3+MiLWbEgjLzOH+lXgco1ERgzd80rDCymlpaRQbOYnKG/ODoFl46lzT0cjM5FYVvv0qLUbD5lyJtMUaC1pFlTkNONx6lliaX9o0i/1vws5bNKn5OuENQEKmLlcP4o2ZmJjD4zzd3Fk32uQ4uRWkPSUqb4LBe3EXHdORNB2BWsws5daRnMfNVX7isPSb1hMQdAJi1/qmDMfRUlCU74pmnzjbXfL8PVG8NsW6IQM2Ne23iCPIpryJjYbVnm5hCvKpMa7HLViNiNc+xTfDIaKm3jctViD8A1M9YPJNk003VVr4Zo2MuGW8vil8SLaGpPXqG7I4DLdtl8a4Rbx1Lt4w5Huqaa1XzZBtj208EJVGcmKYEuaeN27zT9EE6a09JerXdEbpaNgNqYJdhP1NdqiPKsbDRUi86XvvNC7rME5mrSQtrzAZVndtSjCMqd8BmaeGR4l4YFULGRBeXIV9Y4yxLFdyoUNpiy2IhePSWzBofYPP0eIa2q5JP4j9G8at/AqoSsLAUuRXtvgsqX/zYwsE+of6oSDbUOo4RMJw+DOUTJq+hnqwKim9Yy/napyZNTc2rCq6V9jHtJbxGPDwlzWj/Sk3zF/BHOlT/fSjSq7FqlPI1q6J+ru8Aku008SFINXZfOfnZNOvGPMtEmn2gLPt+H4QLA+/SYe4j398auzhKIp2Pok3mPC5q1IN1HgR+mnEfc4NeeHYwd2/kpszR3cBn7ni9NbIqhtSWFW8xbUJuUPVOeeXu3j0IGZmFNiwaNZ6rH4/zQ2ODz6tFxRLsUYZu1bfd1uIvfQDt4YD/efKYv8VF8bHGDgK22w2Wqwpi43vNCOXFJZCGMqWiPbL8mil6tsmOTXAWCyMCw73e2rADZj2IK6rqksM3EXF2cbLb4vjB14wa/yXK5vwU+05MzERJ5nXsXsW21o7M+gO0js2OyKciP5uF2iXyb2DiptwQeHeqygkrNsqVCSlldxBMpwHi1vfc8RKpP/4L3Lmpq6DZcvhDDfxTCE3splacTcOtXdK2g303dIWBVe2wD/Gvja1cClFQ67gw0t1ZUttsUgQ1Veky8oOpS6ksYEc4bqseCbZy766SvL3FodmnahlWJRgVCNjPxhL/fk2wyvlKhITH/VQCipOI0dNcRa5B1M5HmOBjTLeZQJy237e2mobwmDyJNHePhdDmiknvLKaDbShL+Is1XTCJuLQd2wmdJL7+mKvs294whXQD+vtd88KKk0DXP8B1Xu9J+xo69VOuFgexgTrcvI6SyltuLix9OPuE6/iRJYoBMEXxU4shQMf4Fjqwf1PtnJ/wWSZd29rhZjRmTGgiGTAUQqRz+nCdjeMfYhsBD5Lv60KILWEvNEHfmsDs2L0A252351eUoYxAysVaCJVLdH9QFWAmqJDCODUcdoo12+gd6bW2boY0pBVHWL6LQDK5bYWh1V8vFvi0cRpfwv7cJiMX3AZNJuTddHehTIdU0YQ/sQ1dLoF2xQPcCuHKiuCWOY30DHe1OwcClLAhqAKyqlnIbH/8u9ScJpcS4kgp6HKDUdiOgRaRGSiUCRBjzI5gSksMZKqy7Sd51aeg0tgJ+x0TH9YH2Mgsap9N7ENZdEB0bey2DMTrBA1hn56SErNHf3tKtqyL9b6yXEP97/rc+jgD2N1LNUH6RM9AzP3kSipr06RkKOolR7HO768jjWiH1X92jA7dkg7gcNcjqsZCgfqWw0tPXdLg20cF6vnQypg7gLtkazrHAodyYfENPQZsdfnjMZiNu4nJO97D1/sQE+3vNFzrSDOKw+keLECYf7RJwVHeP/j79833oZ0egonYB2FlFE5qj02B/LVOMJQlsB8uNg3Leg4qtZwntsOSNidR0abbZmAK4sCzvt8Yiuz2yrNCJoH5O8XvX/vLeR/BBYTWj0sOPYM/jyxRd5+/JziKAABaPcw/34UA3aj/gLZxZgRCWN6m4m3demanNgsx0P237/Q+Ew5VYnJPkyCY0cIVHoFn2Ay/e7U4P19APbPFXEHX94N6KhEMPG7iwB3+I+O1jd5n6VSgHegxgaSawO6iQCYFgDsPSMsNOcUj4q3sF6KzGaH/0u5PQoAj/8zq6Uc9MoNrGqhYeb2jQo0WlGlXjxtanZLS24/OIN5Gx/2g684BPDQpwlqnkFcxpmP/osnOXrFuu4PqifouQH0eF5qCkvITQbJw/Zvy5mAHWC9oU+cTiYhJmSfKsCyt1cGVxisKu+NymEQIAyaCgud/V09qT3nk/9s/SWsYtha7yNpzBIMM40rCSGaJ9u6lEkl00vXBiEt7p9P5IBCiavynEOv7FgLqPdeqxRiCwuFVMolSIUBcoyfUC2e2FJSAUgYdVGFf0b0Kn2EZlK97yyxrT2MVgvtRikfdaAW8RwEEfN+B7/eK8bBdp7URpbqn1xcrC6d2UjdsKbzCjBFqkKkoZt7Mrhg6YagE7spkqj0jOrWM+UGQ0MUlG2evP1uE1p2xSv4dMK0dna6ENcNUF+xkaJ7B764NdxLCpuvhblltVRAf7vK5qPttJ/9RYFUUSGcLdibnz6mf7WkPO3MkUUhR2mAOuGv8IWw5XG1ZvoVMnjSAZe6T7WYA99GENxoHkMiKxHlCuK5Gd0INrISImHQrQmv6F4mqU/TTQ8nHMDzCRivKySQ8dqkpQgnUMnwIkaAuc6/FGq1hw3b2Sba398BhUwUZSAIO8XZvnuLdY2n6hOXws+gq9BHUKcKFA6kz6FDnpxLPICa3qGhnc97bo1FT/XJk48LrkHJ2CAtBv0RtN97N21plfpXHvZ8gMJb7Zc4cfI6MbPwsW7AilCSXMFIEUEmir8XLEklA0ztYbGpTTGqttp5hpFTTIqUyaAIqvMT9A/x+Ji5ejA4Bhxb/cl1pUdOD6epd3yilIdO6j297xInoiBPuEDW2/UfslDyhGkQs7Wy253bVnlT+SWg89zYIK/9KXFl5fe+jow2rd5FXv8zDPrmfMXiUPt9QBO/iK4QGbX5j/7Rx1c1vzsY8ONbP3lVIaPrhL4+1QrECTN3nyKavGG0gBBtHvTKhGoBHgMXHStFowN+HKrPriYu+OZ05Frn8okQrPaaxoKP1ULCS/cmKFN3gcH7HQlVjraCeQmtjg1pSQxeuqXiSKgLpxc/1OiZsU4+n4lz4hpahGyWBURLi4642n1gn9qz9bIsaCeEPJ0uJmenMWp2tJmIwLQ6VSgDYErOeBCfSj9P4G/vI7oIF+l/n5fp956QgxGvur77ynawAu3G9MdFbJbu49NZnWnnFcQHjxRuhUYvg1U/e84N4JTecciDAKb/KYIFXzloyuE1eYXf54MmhjTq7B/yBToDzzpx3tJCTo3HCmVPYfmtBRe3mPYEE/6RlTIxbf4fSOcaKFGk4gbaUWe44hVk9SZzhW80yfW5QWBHxmtUzvMhfVQli4gZTktIOZd9mjJ5hsbmzttaHQB29Am3dZkmx3g/qvYocyhZ2PXAWsNQiIaf+Q8W/MWPIK7/TjvCx5q2XRp4lVWydMc2wIQkhadDB0xsnw/kSEyGjLKjI4coVIwtubTF3E7MJ6LS6UOsJKj82XVAVPJJcepfewbzE91ivXZvOvYfsmMevwtPpfMzGmC7WJlyW2j0jh7AF1JLmwEJSKYwIvu6DHc3YnyLH9ZdIBnQ+nOVDRiP+REpqv++typYHIvoJyICGA40d8bR7HR2k7do6UQTHF4oriYeIQbxKe4Th6+/l1BjUtS9hqORh3MbgvYrStXTfSwaBOmAVQZzpYNqsAmQyjY56MUqty3c/xH6GuhNvNaG9vGbG6cPtBM8UA3e8r51D0AR9kozKuGGSMgLz3nAHxDNnc7GTwpLj7/6HeWp1iksDeTjwCLpxejuMtpMnGJgsiku1sOACwQ9ukzESiDRN77YNESxR5LphOlcASXA5uIts1LnBIcn1J7BLWs49DMALSnuz95gdOrTZr0u1SeYHinno/pE58xYoXbVO/S+FEMMs5qyWkMnp8Q3ClyTlZP52Y9nq7b8fITPuVXUk9ohG5EFHw4gAEcjFxfKb3xuAsEjx2z1wxNbSZMcgS9GKyW3R6KwJONgtA64LTyxWm8Bvudp0M1FdJPEGopM4Fvg7G/hsptkhCfHFegv4ENwxPeXmYhxwZy7js+BeM27t9ODBMynVCLJ7RWcBMteZJtvjOYHb5lOnCLYWNEMKC59BA7covu1cANa2PXL05iGdufOzkgFqqHBOrgQVUmLEc+Mkz4Rq8O6WkNr7atNkH4M8d+SD1t/tSzt3oFql+neVs+AwEI5JaBJaxARtY2Z4mKoUqxds4UpZ0sv3zIbNoo0J4fihldQTX3XNcuNcZmcrB5LTWMdzeRuAtBk3cZHYQF6gTi3PNuDJ0nmR+4LPLoHvxQIxRgJ9iNNXqf2SYJhcvCtJiVWo85TsyFOuq7EyBPJrAdhEgE0cTq16FQXhYPJFqSfiVn0IQnPOy0LbU4BeG94QjdYNB0CiQ3QaxQqD2ebSMiNjaVaw8WaM4Z5WnzcVDsr4eGweSLa2DE3BWViaxhZFIcSTjgxNCAfelg+hznVOYoe5VqTYs1g7WtfTm3e4/WduC6p+qqAM8H4ZyrJCGpewThTDPe6H7CzX/zQ8Tm+r65HeZn+MsmxUciEWPlAVaK/VBaQBWfoG/aRL/jSZIQfep/89GjasWmbaWzeEZ2R1FOjvyJT37O9B8046SRSKVEnXWlBqbkb5XCS3qFeuE9xb9+frEknxWB5h1D/hruz2iVDEAS7+qkEz5Ot5agHJc7WCdY94Ws61sURcX5nG8UELGBAHZ3i+3VulAyT0nKNNz4K2LBHBWJcTBX1wzf+//u/j/9+//v87+9/l9Lbh/L/uyNYiTsWV2LwsjaA6MxTuzFMqmxW8Jw/+IppdX8t/Clgi1rI1SN0UC/r6tX/4lUc2VV1OQReSeCsjUpKZchw4XUcjHfw6ryCV3R8s6VXm67vp4n+lcPV9gJwmbKQEsmrJi9c2vkwrm8HFbVYNTaRGq8D91t9n5+U+aD/hNtN3HjC/nC/vUoGFSCkXP+NlRcmLUqLbiUBl4LYf1U/CCvwtd3ryCH8gUmGITAxiH1O5rnGTz7y1LuFjmnFGQ1UWuM7HwfXtWl2fPFKklYwNUpF2IL/TmaRETjQiM5SJacI+3Gv5MBU8lP5Io6gWkawpyzNEVGqOdx4YlO1dCvjbWFZWbCmeiFKPSlMKtKcMFLs/KQxtgAHi7NZNCQ32bBAW2mbHflVZ8wXKi1JKVHkW20bnYnl3dKWJeWJOiX3oKPBD6Zbi0ZvSIuWktUHB8qDR8DMMh1ZfkBL9FS9x5r0hBGLJ8pUCJv3NYH+Ae8p40mZWd5m5fhobFjQeQvqTT4VKWIYfRL0tfaXKiVl75hHReuTJEcqVlug+eOIIc4bdIydtn2K0iNZPsYWQvQio2qbO3OqAlPHDDOB7DfjGEfVF51FqqNacd6QmgFKJpMfLp5DHTv4wXlONKVXF9zTJpDV4m1sYZqJPhotcsliZM8yksKkCkzpiXt+EcRQvSQqmBS9WdWkxMTJXPSw94jqI3varCjQxTazjlMH8jTS8ilaW8014/vwA/LNa+YiFoyyx3s/KswP3O8QW1jtq45yTM/DX9a8M4voTVaO2ebvw1EooDw/yg6Y1faY+WwrdVs5Yt0hQ5EwRfYXSFxray1YvSM+kYmlpLG2/9mm1MfmbKHXr44Ih8nVKb1M537ZANUkCtdsPZ80JVKVKabVHCadaLXg+IV8i5GSwpZti0h6diTaKs9sdpUKEpd7jDUpYmHtiX33SKiO3tuydkaxA7pEc9XIQEOfWJlszj5YpL5bKeQyT7aZSBOamvSHl8xsWvgo26IP/bqk+0EJUz+gkkcvlUlyPp2kdKFtt7y5aCdks9ZJJcFp5ZWeaWKgtnXMN3ORwGLBE0PtkEIek5FY2aVssUZHtsWIvnljMVJtuVIjpZup/5VL1yPOHWWHkOMc6YySWMckczD5jUj2mlLVquFaMU8leGVaqeXis+aRRL8zm4WuBk6cyWfGMxgtr8useQEx7k/PvRoZyd9nde1GUCV84gMX8Ogu/BWezYPSR27llzQnA97oo0pYyxobYUJfsj+ysTm9zJ+S4pk0TGo9VTG0KjqYhTmALfoDZVKla2b5yhv241PxFaLJs3i05K0AAIdcGxCJZmT3ZdT7CliR7q+kur7WdQjygYtOWRL9B8E4s4LI8KpAj7bE0dg7DLOaX+MGeAi0hMMSSWZEz+RudXbZCsGYS0QqiXjH9XQbd8sCB+nIVTq7/T/FDS+zWY9q7Z2fdq1tdLb6v3hKKVDAw5gjj6o9r1wHFROdHc18MJp4SJ2Ucvu+iQ9EgkekW8VCM+psM6y+/2SBy8tNN4a3L1MzP+OLsyvESo5gS7IQOnIqMmviJBVc6zbVG1n8eXiA3j46kmvvtJlewwNDrxk4SbJOtP/TV/lIVK9ueShNbbMHfwnLTLLhbZuO79ec5XvfgRwLFK+w1r5ZWW15rVFZrE+wKqNRv5KqsLNfpGgnoUU6Y71NxEmN7MyqwqAQqoIULOw/LbuUB2+uE75gJt+kq1qY4LoxV+qR/zalupea3D5+WMeaRIn0sAI6DDWDh158fqUb4YhAxhREbUN0qyyJYkBU4V2KARXDT65gW3gRsiv7xSPYEKLwzgriWcWgPr0sbZnv7m1XHNFW6xPdGNZUdxFiUYlmXNjDVWuu7LCkX/nVkrXaJhiYktBISC2xgBXQnNEP+cptWl1eG62a7CPXrnrkTQ5BQASbEqUZWMDiZUisKyHDeLFOaJILUo5f6iDt4ZO8MlqaKLto0AmTHVVbkGuyPa1R/ywZsWRoRDoRdNMMHwYTsklMVnlAd2S0282bgMI8fiJpDh69OSL6K3qbo20KfpNMurnYGQSr/stFqZ7hYsxKlLnKAKhsmB8AIpEQ4bd/NrTLTXefsE6ChRmKWjXKVgpGoPs8GAicgKVw4K0qgDgy1A6hFq1WRat3fHF+FkU+b6H4NWpOU3KXTxrIb2qSHAb+qhm8hiSROi/9ofapjxhyKxxntPpge6KL5Z4+WBMYkAcE6+0Hd3Yh2zBsK2MV3iW0Y6cvOCroXlRb2MMJtdWx+3dkFzGh2Pe3DZ9QpSqpaR/rE1ImOrHqYYyccpiLC22amJIjRWVAherTfpQLmo6/K2pna85GrDuQPlH1Tsar8isAJbXLafSwOof4gg9RkAGm/oYpBQQiPUoyDk2BCQ1k+KILq48ErFo4WSRhHLq/y7mgw3+L85PpP6xWr6cgp9sOjYjKagOrxF148uhuaWtjet953fh1IQiEzgC+d2IgBCcUZqgTAICm2bR8oCjDLBsmg+ThyhfD+zBalsKBY1Ce54Y/t9cwfbLu9SFwEgphfopNA3yNxgyDafUM3mYTovZNgPGdd4ZFFOj1vtfFW3u7N+iHEN1HkeesDMXKPyoCDCGVMo4GCCD6PBhQ3dRZIHy0Y/3MaE5zU9mTCrwwnZojtE+qNpMSkJSpmGe0EzLyFelMJqhfFQ7a50uXxZ8pCc2wxtAKWgHoeamR2O7R+bq7IbPYItO0esdRgoTaY38hZLJ5y02oIVwoPokGIzxAMDuanQ1vn2WDQ00Rh6o5QOaCRu99fwDbQcN0XAuqkFpxT/cfz3slGRVokrNU0iqiMAJFEbKScZdmSkTUznC0U+MfwFOGdLgsewRyPKwBZYSmy6U325iUhBQNxbAC3FLKDV9VSOuQpOOukJ/GAmu/tyEbX9DgEp6dv1zoU0IqzpG6gssSjIYRVPGgU1QAQYRgIT8gEV0EXr1sqeh2I6rXjtmoCYyEDCe/PkFEi/Q48FuT29p557iN+LCwk5CK/CZ2WdAdfQZh2Z9QGrzPLSNRj5igUWzl9Vi0rCqH8G1Kp4QMLkuwMCAypdviDXyOIk0AHTM8HBYKh3b0/F+DxoNj4ZdoZfCpQVdnZarqoMaHWnMLNVcyevytGsrXQEoIbubqWYNo7NRHzdc0zvT21fWVirj7g36iy6pxogfvgHp1xH1Turbz8QyyHnXeBJicpYUctbzApwzZ1HT+FPEXMAgUZetgeGMwt4G+DHiDT2Lu+PT21fjJCAfV16a/Wu1PqOkUHSTKYhWW6PhhHUlNtWzFnA7MbY+r64vkwdpfNB2JfWgWXAvkzd42K4lN9x7Wrg4kIKgXCb4mcW595MCPJ/cTfPAMQMFWwnqwde4w8HZYJFpQwcSMhjVz4B8p6ncSCN1X4klxoIH4BN2J6taBMj6lHkAOs8JJAmXq5xsQtrPIPIIp/HG6i21xMGcFgqDXSRF0xQg14d2uy6HgKE13LSvQe52oShF5Jx1R6avyL4thhXQZHfC94oZzuPUBKFYf1VvDaxIrtV6dNGSx7DO0i1p6CzBkuAmEqyWceQY7F9+U0ObYDzoa1iKao/cOD/v6Q9gHrrr1uCeOk8fST9MG23Ul0KmM3r+Wn6Hi6WAcL7gEeaykicvgjzkjSwFsAXIR81Zx4QJ6oosVyJkCcT+4xAldCcihqvTf94HHUPXYp3REIaR4dhpQF6+FK1H0i9i7Pvh8owu3lO4PT1iuqu+DkL2Bj9+kdfGAg2TXw03iNHyobxofLE2ibjsYDPgeEQlRMR7afXbSGQcnPjI2D+sdtmuQ771dbASUsDndU7t58jrrNGRzISvwioAlHs5FA+cBE5Ccznkd8NMV6BR6ksnKLPZnMUawRDU1MZ/ib3xCdkTblHKu4blNiylH5n213yM0zubEie0o4JhzcfAy3H5qh2l17uLooBNLaO+gzonTH2uF8PQu9EyH+pjGsACTMy4cHzsPdymUSXYJOMP3yTkXqvO/lpvt0cX5ekDEu9PUfBeZODkFuAjXCaGdi6ew4qxJ8PmFfwmPpkgQjQlWqomFY6UkjmcnAtJG75EVR+NpzGpP1Ef5qUUbfowrC3zcSLX3BxgWEgEx/v9cP8H8u1Mvt9/rMDYf6sjwU1xSOPBgzFEeJLMRVFtKo5QHsUYT8ZRLCah27599EuqoC9PYjYO6aoAMHB8X1OHwEAYouHfHB3nyb2B+SnZxM/vw/bCtORjLMSy5aZoEpvgdGvlJfNPFUu/p7Z4VVK1hiI0/UTuB3ZPq4ohEbm7Mntgc1evEtknaosgZSwnDC2BdMmibpeg48X8Ixl+/8+xXdbshQXUPPvx8jT3fkELivHSmqbhblfNFShWAyQnJ3WBU6SMYSIpTDmHjdLVAdlADdz9gCplZw6mTiHqDwIsxbm9ErGusiVpg2w8Q3khKV/R9Oj8PFeF43hmW/nSd99nZzhyjCX3QOZkkB6BsH4H866WGyv9E0hVAzPYah2tkRfQZMmP2rinfOeQalge0ovhduBjJs9a1GBwReerceify49ctOh5/65ATYuMsAkVltmvTLBk4oHpdl6i+p8DoNj4Fb2vhdFYer2JSEilEwPd5n5zNoGBXEjreg/wh2NFnNRaIUHSOXa4eJRwygZoX6vnWnqVdCRT1ARxeFrNBJ+tsdooMwqnYhE7zIxnD8pZH+P0Nu1wWxCPTADfNWmqx626IBJJq6NeapcGeOmbtXvl0TeWG0Y7OGGV4+EHTtNBIT5Wd0Bujl7inXgZgfXTM5efD3qDTJ54O9v3Bkv+tdIRlq1kXcVD0BEMirmFxglNPt5pedb1AnxuCYMChUykwsTIWqT23XDpvTiKEru1cTcEMeniB+HQDehxPXNmkotFdwUPnilB/u4Nx5Xc6l8J9jH1EgKZUUt8t8cyoZleDBEt8oibDmJRAoMKJ5Oe9CSWS5ZMEJvacsGVdXDWjp/Ype5x0p9PXB2PAwt2LRD3d+ftNgpuyvxlP8pB84oB1i73vAVpwyrmXW72hfW6Dzn9Jkj4++0VQ4d0KSx1AsDA4OtXXDo63/w+GD+zC7w5SJaxsmnlYRQ4dgdjA7tTl2KNLnpJ+mvkoDxtt1a4oPaX3EVqj96o9sRKBQqU7ZOiupeAIyLMD+Y3YwHx30XWHB5CQiw7q3mj1EDlP2eBsZbz79ayUMbyHQ7s8gu4Lgip1LiGJj7NQj905/+rgUYKAA5qdrlHKIknWmqfuR+PB8RdBkDg/NgnlT89G72h2NvySnj7UyBwD+mi/IWs1xWbxuVwUIVXun5cMqBtFbrccI+DILjsVQg6eeq0itiRfedn89CvyFtpkxaauEvSANuZmB1p8FGPbU94J9medwsZ9HkUYjmI7OH5HuxendLbxTaYrPuIfE2ffXFKhoNBUp33HsFAXmCV/Vxpq5AYgFoRr5Ay93ZLRlgaIPjhZjXZZChT+aE5iWAXMX0oSFQEtwjiuhQQItTQX5IYrKfKB+queTNplR1Hoflo5/I6aPPmACwQCE2jTOYo5Dz1cs7Sod0KTG/3kEDGk3kUaUCON19xSJCab3kNpWZhSWkO8l+SpW70Wn3g0ciOIJO5JXma6dbos6jyisuxXwUUhj2+1uGhcvuliKtWwsUTw4gi1c/diEEpZHoKoxTBeMDmhPhKTx7TXWRakV8imJR355DcIHkR9IREHxohP4TbyR5LtFU24umRPRmEYHbpe1LghyxPx7YgUHjNbbQFRQhh4KeU1EabXx8FS3JAxp2rwRDoeWkJgWRUSKw6gGP5U2PuO9V4ZuiKXGGzFQuRuf+tkSSsbBtRJKhCi3ENuLlXhPbjTKD4djXVnfXFds6Zb+1XiUrRfyayGxJq1+SYBEfbKlgjiSmk0orgTqzSS+DZ5rTqsJbttiNtp+KMqGE2AHGFw6jQqM5vD6vMptmXV9OAjq49Uf/Lx9Opam+Hn5O9p8qoBBAQixzQZ4eNVkO9sPzJAMyR1y4/RCQQ1s0pV5KAU5sKLw3tkcFbI/JqrjCsK4Mw+W8aod4lioYuawUiCyVWBE/qPaFi5bnkgpfu/ae47174rI1fqQoTbW0HrU6FAejq7ByM0V4zkZTg02/YJK2N7hUQRCeZ4BIgSEqgD8XsjzG6LIsSbuHoIdz/LhFzbNn1clci1NHWJ0/6/O8HJMdIpEZbqi1RrrFfoo/rI/7ufm2MPG5lUI0IYJ4MAiHRTSOFJ2oTverFHYXThkYFIoyFx6rMYFgaOKM4xNWdlOnIcKb/suptptgTOTdVIf4YgdaAjJnIAm4qNNHNQqqAzvi53GkyRCEoseUBrHohZsjUbkR8gfKtc/+Oa72lwxJ8Mq6HDfDATbfbJhzeIuFQJSiw1uZprHlzUf90WgqG76zO0eCB1WdPv1IT6sNxxh91GEL2YpgC97ikFHyoaH92ndwduqZ6IYjkg20DX33MWdoZk7QkcKUCgisIYslOaaLyvIIqRKWQj16jE1DlQWJJaPopWTJjXfixEjRJJo8g4++wuQjbq+WVYjsqCuNIQW3YjnxKe2M5ZKEqq+cX7ZVgnkbsU3RWIyXA1rxv4kGersYJjD//auldXGmcEbcfTeF16Y1708FB1HIfmWv6dSFi6oD4E+RIjCsEZ+kY7dKnwReJJw3xCjKvi3kGN42rvyhUlIz0Bp+fNSV5xwFiuBzG296e5s/oHoFtUyUplmPulIPl+e1CQIQVtjlzLzzzbV+D/OVQtYzo5ixtMi5BmHuG4N/uKfJk5UIREp7+12oZlKtPBomXSzAY0KgtbPzzZoHQxujnREUgBU+O/jKKhgxVhRPtbqyHiUaRwRpHv7pgRPyUrnE7fYkVblGmfTY28tFCvlILC04Tz3ivkNWVazA+OsYrxvRM/hiNn8Fc4bQBeUZABGx5S/xFf9Lbbmk298X7iFg2yeimvsQqqJ+hYbt6uq+Zf9jC+Jcwiccd61NKQtFvGWrgJiHB5lwi6fR8KzYS7EaEHf/ka9EC7H8D+WEa3TEACHBkNSj/cXxFeq4RllC+fUFm2xtstYLL2nos1DfzsC9vqDDdRVcPA3Ho95aEQHvExVThXPqym65llkKlfRXbPTRiDepdylHjmV9YTWAEjlD9DdQnCem7Aj/ml58On366392214B5zrmQz/9ySG2mFqEwjq5sFl5tYJPw5hNz8lyZPUTsr5E0F2C9VMPnZckWP7+mbwp/BiN7f4kf7vtGnZF2JGvjK/sDX1RtcFY5oPQnE4lIAYV49U3C9SP0LCY/9i/WIFK9ORjzM9kG/KGrAuwFmgdEpdLaiqQNpCTGZVuAO65afkY1h33hrqyLjZy92JK3/twdj9pafFcwfXONmPQWldPlMe7jlP24Js0v9m8bIJ9TgS2IuRvE9ZVRaCwSJYOtAfL5H/YS4FfzKWKbek+GFulheyKtDNlBtrdmr+KU+ibHTdalzFUmMfxw3f36x+3cQbJLItSilW9cuvZEMjKw987jykZRlsH/UI+HlKfo2tLwemBEeBFtmxF2xmItA/dAIfQ+rXnm88dqvXa+GapOYVt/2waFimXFx3TC2MUiOi5/Ml+3rj/YU6Ihx2hXgiDXFsUeQkRAD6wF3SCPi2flk7XwKAA4zboqynuELD312EJ88lmDEVOMa1W/K/a8tGylZRMrMoILyoMQzzbDJHNZrhH77L9qSC42HVmKiZ5S0016UTp83gOhCwz9XItK9fgXfK3F5d7nZCBUekoLxrutQaPHa16Rjsa0gTrzyjqTnmcIcrxg6X6dkKiucudc0DD5W4pJPf0vuDW8r5/uw24YfMuxFRpD2ovT2mFX79xH6Jf+MVdv2TYqR6/955QgVPe3JCD/WjAYcLA9tpXgFiEjge2J5ljeI/iUzg91KQuHkII4mmHZxC3XQORLAC6G7uFn5LOmlnXkjFdoO976moNTxElS8HdxWoPAkjjocDR136m2l+f5t6xaaNgdodOvTu0rievnhNAB79WNrVs6EsPgkgfahF9gSFzzAd+rJSraw5Mllit7vUP5YxA843lUpu6/5jAR0RvH4rRXkSg3nE+O5GFyfe+L0s5r3k05FyghSFnKo4TTgs07qj4nTLqOYj6qaW9knJTDkF5OFMYbmCP+8H16Ty482OjvERV6OFyw043L9w3hoJi408sR+SGo1WviXUu8d7qS+ehKjpKwxeCthsm2LBFSFeetx0x4AaKPxtp3CxdWqCsLrB1s/j5TAhc1jNZsXWl6tjo/WDoewxzg8T8NnhZ1niUwL/nhfygLanCnRwaFGDyLw+sfZhyZ1UtYTp8TYB6dE7R3VsKKH95CUxJ8u8N+9u2/9HUNKHW3x3w5GQrfOPafk2w5qZq8MaHT0ebeY3wIsp3rN9lrpIsW9c1ws3VNV+JwNz0Lo9+V7zZr6GD56We6gWVIvtmam5GPPkVAbr74r6SwhuL+TRXtW/0pgyX16VNl4/EAD50TnUPuwrW6OcUO2VlWXS0inq872kk7GUlW6o/ozFKq+Sip6LcTtSDfDrPTcCHhx75H8BeRon+KG2wRwzfDgWhALmiWOMO6h3pm1UCZEPEjScyk7tdLx6WrdA2N1QTPENvNnhCQjW6kl057/qv7IwRryHrZBCwVSbLLnFRiHdTwk8mlYixFt1slEcPD7FVht13HyqVeyD55HOXrh2ElAxJyinGeoFzwKA91zfrdLvDxJSjzmImfvTisreI25EDcVfGsmxLVbfU8PGe/7NmWWKjXcdTJ11jAlVIY/Bv/mcxg/Q10vCHwKG1GW/XbJq5nxDhyLqiorn7Wd7VEVL8UgVzpHMjQ+Z8DUgSukiVwWAKkeTlVVeZ7t1DGnCgJVIdBPZAEK5f8CDyDNo7tK4/5DBjdD5MPV86TaEhGsLVFPQSI68KlBYy84FievdU9gWh6XZrugvtCZmi9vfd6db6V7FmoEcRHnG36VZH8N4aZaldq9zZawt1uBFgxYYx+Gs/qW1jwANeFy+LCoymyM6zgG7j8bGzUyLhvrbJkTYAEdICEb4kMKusKT9V3eIwMLsjdUdgijMc+7iKrr+TxrVWG0U+W95SGrxnxGrE4eaJFfgvAjUM4SAy8UaRwE9j6ZQH5qYAWGtXByvDiLSDfOD0yFA3UCMKSyQ30fyy1mIRg4ZcgZHLNHWl+c9SeijOvbOJxoQy7lTN2r3Y8p6ovxvUY74aOYbuVezryqXA6U+fcp6wSV9X5/OZKP18tB56Ua0gMyxJI7XyNT7IrqN8GsB9rL/kP5KMrjXxgqKLDa+V5OCH6a5hmOWemMUsea9vQl9t5Oce76PrTyTv50ExOqngE3PHPfSL//AItPdB7kGnyTRhVUUFNdJJ2z7RtktZwgmQzhBG/G7QsjZmJfCE7k75EmdIKH7xlnmDrNM/XbTT6FzldcH/rcRGxlPrv4qDScqE7JSmQABJWqRT/TUcJSwoQM+1jvDigvrjjH8oeK2in1S+/yO1j8xAws/T5u0VnIvAPqaE1atNuN0cuRliLcH2j0nTL4JpcR7w9Qya0JoaHgsOiALLCCzRkl1UUESz+ze/gIXHGtDwgYrK6pCFKJ1webSDog4zTlPkgXZqxlQDiYMjhDpwTtBW2WxthWbov9dt2X9XFLFmcF+eEc1UaQ74gqZiZsdj63pH1qcv3Vy8JYciogIVKsJ8Yy3J9w/GhjWVSQAmrS0BPOWK+RKV+0lWqXgYMnIFwpcZVD7zPSp547i9HlflB8gVnSTGmmq1ClO081OW/UH11pEQMfkEdDFzjLC1Cdo/BdL3s7cXb8J++Hzz1rhOUVZFIPehRiZ8VYu6+7Er7j5PSZu9g/GBdmNzJmyCD9wiswj9BZw+T3iBrg81re36ihMLjoVLoWc+62a1U/7qVX5CpvTVF7rocSAKwv4cBVqZm7lLDS/qoXs4fMs/VQi6BtVbNA3uSzKpQfjH1o3x4LrvkOn40zhm6hjduDglzJUwA0POabgdXIndp9fzhOo23Pe+Rk9GSLX0d71Poqry8NQDTzNlsa+JTNG9+UrEf+ngxCjGEsDCc0bz+udVRyHQI1jmEO3S+IOQycEq7XwB6z3wfMfa73m8PVRp+iOgtZfeSBl01xn03vMaQJkyj7vnhGCklsCWVRUl4y+5oNUzQ63B2dbjDF3vikd/3RUMifPYnX5Glfuk2FsV/7RqjI9yKTbE8wJY+74p7qXO8+dIYgjtLD/N8TJtRh04N9tXJA4H59IkMmLElgvr0Q5OCeVfdAt+5hkh4pQgfRMHpL74XatLQpPiOyHRs/OdmHtBf8nOZcxVKzdGclIN16lE7kJ+pVMjspOI+5+TqLRO6m0ZpNXJoZRv9MPDRcAfJUtNZHyig/s2wwReakFgPPJwCQmu1I30/tcBbji+Na53i1W1N+BqoY7Zxo+U/M9XyJ4Ok2SSkBtoOrwuhAY3a03Eu6l8wFdIG1cN+e8hopTkiKF093KuH/BcB39rMiGDLn6XVhGKEaaT/vqb/lufuAdpGExevF1+J9itkFhCfymWr9vGb3BTK4j598zRH7+e+MU9maruZqb0pkGxRDRE1CD4Z8LV4vhgPidk5w2Bq816g3nHw1//j3JStz7NR9HIWELO8TMn3QrP/zZp//+Dv9p429/ogv+GATR+n/UdF+ns9xNkXZQJXY4t9jMkJNUFygAtzndXwjss+yWH9HAnLQQfhAskdZS2l01HLWv7L7us5uTH409pqitvfSOQg/c+Zt7k879P3K9+WV68n7+3cZfuRd/dDPP/03rn+d+/nBvWfgDlt8+LzjqJ/vx3CnNOwiXhho778C96iD+1TBvRZYeP+EH81LE0vVwOOrmCLB3iKzI1x+vJEsrPH4uF0UB4TJ4X3uDfOCo3PYpYe0MF4bouh0DQ/l43fxUF7Y+dpWuvTSffB0yO2UQUETI/LwCZE3BvnevJ7c9zUlY3H58xzke6DNFDQG8n0WtDN4LAYN4nogKav1ezOfK/z+t6tsCTp+dhx4ymjWuCJk1dEUifDP+HyS4iP/Vg9B2jTo9L4NbiBuDS4nuuHW6H+JDQn2JtqRKGkEQPEYE7uzazXIkcxIAqUq1esasZBETlEZY7y7Jo+RoV/IsjY9eIMkUvr42Hc0xqtsavZvhz1OLwSxMOTuqzlhb0WbdOwBH9EYiyBjatz40bUxTHbiWxqJ0uma19qhPruvcWJlbiSSH48OLDDpaHPszvyct41ZfTu10+vjox6kOqK6v0K/gEPphEvMl/vwSv+A4Hhm36JSP9IXTyCZDm4kKsqD5ay8b1Sad/vaiyO5N/sDfEV6Z4q95E+yfjxpqBoBETW2C7xl4pIO2bDODDFurUPwE7EWC2Uplq+AHmBHvir2PSgkR12/Ry65O0aZtQPeXi9mTlF/Wj5GQ+vFkYyhXsLTjrBSP9hwk4GPqDP5rBn5/l8b0mLRAvRSzXHc293bs3s8EsdE3m2exxidWVB4joHR+S+dz5/W+v00K3TqN14CDBth8eWcsTbiwXPsygHdGid0PEdy6HHm2v/IUuV5RVapYmzGsX90mpnIdNGcOOq64Dbc5GUbYpD9M7S+6cLY//QmjxFLP5cuTFRm3vA5rkFZroFnO3bjHF35uU3s8mvL7Tp9nyTc4mymTJ5sLIp7umSnGkO23faehtz3mmTS7fbVx5rP7x3HXIjRNeq/A3xCs9JNB08c9S9BF2O3bOur0ItslFxXgRPdaapBIi4dRpKGxVz7ir69t/bc9qTxjvtOyGOfiLGDhR4fYywHv1WdOplxIV87TpLBy3Wc0QP0P9s4G7FBNOdITS/tep3o3h1TEa5XDDii7fWtqRzUEReP2fbxz7bHWWJdbIOxOUJZtItNZpTFRfj6vm9sYjRxQVO+WTdiOhdPeTJ+8YirPvoeL88l5iLYOHd3b/Imkq+1ZN1El3UikhftuteEYxf1Wujof8Pr4ICTu5ezZyZ4tHQMxlzUHLYO2VMOoNMGL/20S5i2o2obfk+8qqdR7xzbRDbgU0lnuIgz4LelQ5XS7xbLuSQtNS95v3ZUOdaUx/Qd8qxCt6xf2E62yb/HukLO6RyorV8KgYl5YNc75y+KvefrxY+lc/64y9kvWP0a0bDz/rojq+RWjO06WeruWqNFU7r3HPIcLWRql8ICZsz2Ls/qOm/CLn6++X+Qf7mGspYCrZod/lpl6Rw4xN/yuq8gqV4B6aHk1hVE1SfILxWu5gvXqbfARYQpspcxKp1F/c8XOPzkZvmoSw+vEqBLdrq1fr3wAPv5NnM9i8F+jdAuxkP5Z71c6uhK3enlnGymr7UsWZKC12qgUiG8XXGQ9mxnqz4GSIlybF9eXmbqj2sHX+a1jf0gRoONHRdRSrIq03Ty89eQ1GbV/Bk+du4+V15zls+vvERvZ4E7ZbnxWTVjDjb4o/k8jlw44pTIrUGxxuJvBeO+heuhOjpFsO6lVJ/aXnJDa/bM0Ql1cLbXE/Pbv3EZ3vj3iVrB5irjupZTzlnv677NrI9UNYNqbPgp/HZXS+lJmk87wec+7YOxTDo2aw2l3NfDr34VNlvqWJBknuK7oSlZ6/T10zuOoPZOeoIk81N+sL843WJ2Q4Z0fZ3scsqC/JV2fuhWi1jGURSKZV637lf53Xnnx16/vKEXY89aVJ0fv91jGdfG+G4+sniwHes4hS+udOr4RfhFhG/F5gUG35QaU+McuLmclb5ZWmR+sG5V6nf+PxYzlrnFGxpZaK8eqqVo0NfmAWoGfXDiT/FnUbWvzGDOTr8aktOZWg4BYvz5YH12ZbfCcGtNk+dDAZNGWvHov+PIOnY9Prjg8h/wLRrT69suaMVZ5bNuK00lSVpnqSX1NON/81FoP92rYndionwgOiA8WMf4vc8l15KqEEG4yAm2+WAN5Brfu1sq9suWYqgoajgOYt/JCk1gC8wPkK+XKCtRX6TAtgvrnuBgNRmn6I8lVDipOVB9kX6Oxkp4ZKyd1M6Gj8/v2U7k+YQBL95Kb9PQENucJb0JlW3b5tObN7m/Z1j1ev388d7o15zgXsI9CikAGAViR6lkJv7nb4Ak40M2G8TJ447kN+pvfHiOFjSUSP6PM+QfbAywKJCBaxSVxpizHseZUyUBhq59vFwrkyGoRiHbo0apweEZeSLuNiQ+HAekOnarFg00dZNXaPeoHPTRR0FmEyqYExOVaaaO8c0uFUh7U4e/UxdBmthlBDgg257Q33j1hA7HTxSeTTSuVnPZbgW1nodwmG16aKBDKxEetv7D9OjO0JhrbJTnoe+kcGoDJazFSO8/fUN9Jy/g4XK5PUkw2dgPDGpJqBfhe7GA+cjzfE/EGsMM+FV9nj9IAhrSfT/J3QE5TEIYyk5UjsI6ZZcCPr6A8FZUF4g9nnpVmjX90MLSQysIPD0nFzqwCcSJmIb5mYv2Cmk+C1MDFkZQyCBq4c/Yai9LJ6xYkGS/x2s5/frIW2vmG2Wrv0APpCdgCA9snFvfpe8uc0OwdRs4G9973PGEBnQB5qKrCQ6m6X/H7NInZ7y/1674/ZXOVp7OeuCRk8JFS516VHrnH1HkIUIlTIljjHaQtEtkJtosYul77cVwjk3gW1Ajaa6zWeyHGLlpk3VHE2VFzT2yI/EvlGUSz2H9zYE1s4nsKMtMqNyKNtL/59CpFJki5Fou6VXGm8vWATEPwrUVOLvoA8jLuwOzVBCgHB2Cr5V6OwEWtJEKokJkfc87h+sNHTvMb0KVTp5284QTPupoWvQVUwUeogZR3kBMESYo0mfukewRVPKh5+rzLQb7HKjFFIgWhj1w3yN/qCNoPI8XFiUgBNT1hCHBsAz8L7Oyt8wQWUFj92ONn/APyJFg8hzueqoJdNj57ROrFbffuS/XxrSXLTRgj5uxZjpgQYceeMc2wJrahReSKpm3QjHfqExTLAB2ipVumE8pqcZv8LYXQiPHHsgb5BMW8zM5pvQit+mQx8XGaVDcfVbLyMTlY8xcfmm/RSAT/H09UQol5gIz7rESDmnrQ4bURIB4iRXMDQwxgex1GgtDxKp2HayIkR+E/aDmCttNm2C6lytWdfOVzD6X2SpDWjQDlMRvAp1symWv4my1bPCD+E1EmGnMGWhNwmycJnDV2WrQNxO45ukEb08AAffizYKVULp15I4vbNK5DzWwCSUADfmKhfGSUqii1L2UsE8rB7mLuHuUJZOx4+WiizHBJ/hwboaBzhpNOVvgFTf5cJsHef7L1HCI9dOUUbb+YxUJWn6dYOLz+THi91kzY5dtO5c+grX7v0jEbsuoOGnoIreDIg/sFMyG+TyCLIcAWd1IZ1UNFxE8Uie13ucm40U2fcxC0u3WLvLOxwu+F7MWUsHsdtFQZ7W+nlfCASiAKyh8rnP3EyDByvtJb6Kax6/HkLzT9SyEyTMVM1zPtM0MJY14DmsWh4MgD15Ea9Hd00AdkTZ0EiG5NAGuIBzQJJ0JR0na+OB7lQA6UKxMfihIQ7GCCnVz694QvykWXTxpS2soDu+smru1UdIxSvAszBFD1c8c6ZOobA8bJiJIvuycgIXBQIXWwhyTgZDQxJTRXgEwRNAawGSXO0a1DKjdihLVNp/taE/xYhsgwe+VpKEEB4LlraQyE84gEihxCnbfoyOuJIEXy2FIYw+JjRusybKlU2g/vhTSGTydvCvXhYBdtAXtS2v7LkHtmXh/8fly1do8FI/D0f8UbzVb5h+KRhMGSAmR2mhi0YG/uj7wgxcfzCrMvdjitUIpXDX8ae2JcF/36qUWIMwN6JsjaRGNj+jEteGDcFyTUb8X/NHSucKMJp7pduxtD6KuxVlyxxwaeiC1FbGBESO84lbyrAugYxdl+2N8/6AgWpo/IeoAOcsG35IA/b3AuSyoa55L7llBLlaWlEWvuCFd8f8NfcTUgzJv6CbB+6ohWwodlk9nGWFpBAOaz5uEW5xBvmjnHFeDsb0mXwayj3mdYq5gxxNf3H3/tnCgHwjSrpSgVxLmiTtuszdRUFIsn6LiMPjL808vL1uQhDbM7aA43mISXReqjSskynIRcHCJ9qeFopJfx9tqyUoGbSwJex/0aDE3plBPGtNBYgWbdLom3+Q/bjdizR2/AS/c/dH/d3G7pyl1qDXgtOFtEqidwLqxPYtrNEveasWq3vPUUtqTeu8gpov4bdOQRI2kneFvRNMrShyVeEupK1PoLDPMSfWMIJcs267mGB8X9CehQCF0gIyhpP10mbyM7lwW1e6TGvHBV1sg/UyTghHPGRqMyaebC6pbB1WKNCQtlai1GGvmq9zUKaUzLaXsXEBYtHxmFbEZ2kJhR164LhWW2Tlp1dhsGE7ZgIWRBOx3Zcu2DxgH+G83WTPceKG0TgQKKiiNNOlWgvqNEbnrk6fVD+AqRam2OguZb0YWSTX88N+i/ELSxbaUUpPx4vJUzYg/WonSeA8xUK6u7DPHgpqWpEe6D4cXg5uK9FIYVba47V/nb+wyOtk+zG8RrS4EA0ouwa04iByRLSvoJA2FzaobbZtXnq8GdbfqEp5I2dpfpj59TCVif6+E75p665faiX8gS213RqBxTZqfHP46nF6NSenOneuT+vgbLUbdTH2/t0REFXZJOEB6DHvx6N6g9956CYrY/AYcm9gELJXYkrSi+0F0geKDZgOCIYkLU/+GOW5aGj8mvLFgtFH5+XC8hvAE3CvHRfl4ofM/Qwk4x2A+R+nyc9gNu/9Tem7XW4XRnyRymf52z09cTOdr+PG6+P/Vb4QiXlwauc5WB1z3o+IJjlbxI8MyWtSzT+k4sKVbhF3xa+vDts3NxXa87iiu+xRH9cAprnOL2h6vV54iQRXuOAj1s8nLFK8gZ70ThIQcWdF19/2xaJmT0efrkNDkWbpAQPdo92Z8+Hn/aLjbOzB9AI/k12fPs9HhUNDJ1u6ax2VxD3R6PywN7BrLJ26z6s3QoMp76qzzwetrDABKSGkfW5PwS1GvYNUbK6uRqxfyVGNyFB0E+OugMM8kKwmJmupuRWO8XkXXXQECyRVw9UyIrtCtcc4oNqXqr7AURBmKn6Khz3eBN96LwIJrAGP9mr/59uTOSx631suyT+QujDd4beUFpZ0kJEEnjlP+X/Kr2kCKhnENTg4BsMTOmMqlj2WMFLRUlVG0fzdCBgUta9odrJfpVdFomTi6ak0tFjXTcdqqvWBAzjY6hVrH9sbt3Z9gn+AVDpTcQImefbB4edirjzrsNievve4ZT4EUZWV3TxEsIW+9MT/RJoKfZZYSRGfC1CwPG/9rdMOM8qR/LUYvw5f/emUSoD7YSFuOoqchdUg2UePd1eCtFSKgxLSZ764oy4lvRCIH6bowPxZWwxNFctksLeil47pfevcBipkkBIc4ngZG+kxGZ71a72KQ7VaZ6MZOZkQJZXM6kb/Ac0/XkJx8dvyfJcWbI3zONEaEPIW8GbkYjsZcwy+eMoKrYjDmvEEixHzkCSCRPRzhOfJZuLdcbx19EL23MA8rnjTZZ787FGMnkqnpuzB5/90w1gtUSRaWcb0eta8198VEeZMUSfIhyuc4/nywFQ9uqn7jdqXh+5wwv+RK9XouNPbYdoEelNGo34KyySwigsrfCe0v/PlWPvQvQg8R0KgHO18mTVThhQrlbEQ0Kp/JxPdjHyR7E1QPw/ut0r+HDDG7BwZFm9IqEUZRpv2WpzlMkOemeLcAt5CsrzskLGaVOAxyySzZV/D2EY7ydNZMf8e8VhHcKGHAWNszf1EOq8fNstijMY4JXyATwTdncFFqcNDfDo+mWFvxJJpc4sEZtjXyBdoFcxbUmniCoKq5jydUHNjYJxMqN1KzYV62MugcELVhS3Bnd+TLLOh7dws/zSXWzxEb4Nj4aFun5x4kDWLK5TUF/yCXB/cZYvI9kPgVsG2jShtXkxfgT+xzjJofXqPEnIXIQ1lnIdmVzBOM90EXvJUW6a0nZ/7XjJGl8ToO3H/fdxnxmTNKBZxnkpXLVgLXCZywGT3YyS75w/PAH5I/jMuRspej8xZObU9kREbRA+kqjmKRFaKGWAmFQspC+QLbKPf0RaK3OXvBSWqo46p70ws/eZpu6jCtZUgQy6r4tHMPUdAgWGGUYNbuv/1a6K+MVFsd3T183+T8capSo6m0+Sh57fEeG/95dykGJBQMj09DSW2bY0mUonDy9a8trLnnL5B5LW3Nl8rJZNysO8Zb+80zXxqUGFpud3Qzwb7bf+8mq6x0TAnJU9pDQR9YQmZhlna2xuxJt0aCO/f1SU8gblOrbIyMsxTlVUW69VJPzYU2HlRXcqE2lLLxnObZuz2tT9CivfTAUYfmzJlt/lOPgsR6VN64/xQd4Jlk/RV7UKVv2Gx/AWsmTAuCWKhdwC+4HmKEKYZh2Xis4KsUR1BeObs1c13wqFRnocdmuheaTV30gvVXZcouzHKK5zwrN52jXJEuX6dGx3BCpV/++4f3hyaW/cQJLFKqasjsMuO3B3WlMq2gyYfdK1e7L2pO/tRye2mwzwZPfdUMrl5wdLqdd2Kv/wVtnpyWYhd49L6rsOV+8HXPrWH2Kup89l2tz6bf80iYSd+V4LROSOHeamvexR524q4r43rTmtFzQvArpvWfLYFZrbFspBsXNUqqenjxNNsFXatZvlIhk7teUPfK+YL32F8McTnjv0BZNppb+vshoCrtLXjIWq3EJXpVXIlG6ZNL0dh6qEm2WMwDjD3LfOfkGh1/czYc/0qhiD2ozNnH4882MVVt3JbVFkbwowNCO3KL5IoYW5wlVeGCViOuv1svZx7FbzxKzA4zGqBlRRaRWCobXaVq4yYCWbZf8eiJwt3OY+MFiSJengcFP2t0JMfzOiJ7cECvpx7neg1Rc5x+7myPJOXt2FohVRyXtD+/rDoTOyGYInJelZMjolecVHUhUNqvdZWg2J2t0jPmiLFeRD/8fOT4o+NGILb+TufCo9ceBBm3JLVn+MO2675n7qiEX/6W+188cYg3Zn5NSTjgOKfWFSAANa6raCxSoVU851oJLY11WIoYK0du0ec5E4tCnAPoKh71riTsjVIp3gKvBbEYQiNYrmH22oLQWA2AdwMnID6PX9b58dR2QKo4qag1D1Z+L/FwEKTR7osOZPWECPJIHQqPUsM5i/CH5YupVPfFA5pHUBcsesh8eO5YhyWnaVRPZn/BmdXVumZWPxMP5e28zm2uqHgFoT9CymHYNNrzrrjlXZM06HnzDxYNlI5b/QosxLmmrqDFqmogQdqk0WLkUceoAvQxHgkIyvWU69BPFr24VB6+lx75Rna6dGtrmOxDnvBojvi1/4dHjVeg8owofPe1cOnxU1ioh016s/Vudv9mhV9f35At+Sh28h1bpp8xhr09+vf47Elx3Ms6hyp6QvB3t0vnLbOhwo660cp7K0vvepabK7YJfxEWWfrC2YzJfYOjygPwfwd/1amTqa0hZ5ueebhWYVMubRTwIjj+0Oq0ohU3zfRfuL8gt59XsHdwKtxTQQ4Y2qz6gisxnm2UdlmpEkgOsZz7iEk6QOt8BuPwr+NR01LTqXmJo1C76o1N274twJvl+I069TiLpenK/miRxhyY8jvYV6W1WuSwhH9q7kuwnJMtm7IWcqs7HsnyHSqWXLSpYtZGaR1V3t0gauninFPZGtWskF65rtti48UV9uV9KM8kfDYs0pgB00S+TlzTXV6P8mxq15b9En8sz3jWSszcifZa/NuufPNnNTb031pptt0+sRSH/7UG8pzbsgtt3OG3ut7B9JzDMt2mTZuyRNIV8D54TuTrpNcHtgmMlYJeiY9XS83NYJicjRjtJSf9BZLsQv629QdDsKQhTK5CnXhpk7vMNkHzPhm0ExW/VCGApHfPyBagtZQTQmPHx7g5IXXsrQDPzIVhv2LB6Ih138iSDww1JNHrDvzUxvp73MsQBVhW8EbrReaVUcLB1R3PUXyaYG4HpJUcLVxMgDxcPkVRQpL7VTAGabDzbKcvg12t5P8TSGQkrj/gOrpnbiDHwluA73xbXts/L7u468cRWSWRtgTwlQnA47EKg0OiZDgFxAKQQUcsbGomITgeXUAAyKe03eA7Mp4gnyKQmm0LXJtEk6ddksMJCuxDmmHzmVhO+XaN2A54MIh3niw5CF7PwiXFZrnA8wOdeHLvvhdoqIDG9PDI7UnWWHq526T8y6ixJPhkuVKZnoUruOpUgOOp3iIKBjk+yi1vHo5cItHXb1PIKzGaZlRS0g5d3MV2pD8FQdGYLZ73aae/eEIUePMc4NFz8pIUfLCrrF4jVWH5gQneN3S8vANBmUXrEcKGn6hIUN95y1vpsvLwbGpzV9L0ZKTan6TDXM05236uLJcIEMKVAxKNT0K8WljuwNny3BNQRfzovA85beI9zr1AGNYnYCVkR1aGngWURUrgqR+gRrQhxW81l3CHevjvGEPzPMTxdsIfB9dfGRbZU0cg/1mcubtECX4tvaedmNAvTxCJtc2QaoUalGfENCGK7IS/O8CRpdOVca8EWCRwv2sSWE8CJPW5PCugjCXPd3h6U60cPD+bdhtXZuYB6stcoveE7Sm5MM2yvfUHXFSW7KzLmi7/EeEWL0wqcOH9MOSKjhCHHmw+JGLcYE/7SBZQCRggox0ZZTAxrlzNNXYXL5fNIjkdT4YMqVUz6p8YDt049v4OXGdg3qTrtLBUXOZf7ahPlZAY/O+7Sp0bvGSHdyQ8B1LOsplqMb9Se8VAE7gIdSZvxbRSrfl+Lk5Qaqi5QJceqjitdErcHXg/3MryljPSIAMaaloFm1cVwBJ8DNmkDqoGROSHFetrgjQ5CahuKkdH5pRPigMrgTtlFI8ufJPJSUlGgTjbBSvpRc0zypiUn6U5KZqcRoyrtzhmJ7/caeZkmVRwJQeLOG8LY6vP5ChpKhc8Js0El+n6FXqbx9ItdtLtYP92kKfaTLtCi8StLZdENJa9Ex1nOoz1kQ7qxoiZFKRyLf4O4CHRT0T/0W9F8epNKVoeyxUXhy3sQMMsJjQJEyMOjmOhMFgOmmlscV4eFi1CldU92yjwleirEKPW3bPAuEhRZV7JsKV3Lr5cETAiFuX5Nw5UlF7d2HZ96Bh0sgFIL5KGaKSoVYVlvdKpZJVP5+NZ7xDEkQhmDgsDKciazJCXJ6ZN2B3FY2f6VZyGl/t4aunGIAk/BHaS+i+SpdRfnB/OktOvyjinWNfM9Ksr6WwtCa1hCmeRI6icpFM4o8quCLsikU0tMoZI/9EqXRMpKGaWzofl4nQuVQm17d5fU5qXCQeCDqVaL9XJ9qJ08n3G3EFZS28SHEb3cdRBdtO0YcTzil3QknNKEe/smQ1fTb0XbpyNB5xAeuIlf+5KWlEY0DqJbsnzJlQxJPOVyHiKMx5Xu9FcEv1Fbg6Fhm4t+Jyy5JC1W3YO8dYLsO0PXPbxodBgttTbH3rt9Cp1lJIk2r3O1Zqu94eRbnIz2f50lWolYzuKsj4PMok4abHLO8NAC884hiXx5Fy5pWKO0bWL7uEGXaJCtznhP67SlQ4xjWIfgq6EpZ28QMtuZK7JC0RGbl9nA4XtFLug/NLMoH1pGt9IonAJqcEDLyH6TDROcbsmGPaGIxMo41IUAnQVPMPGByp4mOmh9ZQMkBAcksUK55LsZj7E5z5XuZoyWCKu6nHmDq22xI/9Z8YdxJy4kWpD16jLVrpwGLWfyOD0Wd+cBzFBxVaGv7S5k9qwh/5t/LQEXsRqI3Q9Rm3QIoaZW9GlsDaKOUyykyWuhNOprSEi0s1G4rgoiX1V743EELti+pJu5og6X0g6oTynUqlhH9k6ezyRi05NGZHz0nvp3HOJr7ebrAUFrDjbkFBObEvdQWkkUbL0pEvMU46X58vF9j9F3j6kpyetNUBItrEubW9ZvMPM4qNqLlsSBJqOH3XbNwv/cXDXNxN8iFLzUhteisYY+RlHYOuP29/Cb+L+xv+35Rv7xudnZ6ohK4cMPfCG8KI7dNmjNk/H4e84pOxn/sZHK9psfvj8ncA8qJz7O8xqbxESDivGJOZzF7o5PJLQ7g34qAWoyuA+x3btU98LT6ZyGyceIXjrqob2CAVql4VOTQPUQYvHV/g4zAuCZGvYQBtf0wmd5lilrvuEn1BXLny01B4h4SMDlYsnNpm9d7m9h578ufpef9Z4WplqWQvqo52fyUA7J24eZD5av6SyGIV9kpmHNqyvdfzcpEMw97BvknV2fq+MFHun9BT3Lsf8pbzvisWiIQvYkng+8Vxk1V+dli1u56kY50LRjaPdotvT5BwqtwyF+emo/z9J3yVUVGfKrxQtJMOAQWoQii/4dp9wgybSa5mkucmRLtEQZ/pz0tL/NVcgWAd95nEQ3Tg6tNbuyn3Iepz65L3huMUUBntllWuu4DbtOFSMSbpILV4fy6wlM0SOvi6CpLh81c1LreIvKd61uEWBcDw1lUBUW1I0Z+m/PaRlX+PQ/oxg0Ye6KUiIiTF4ADNk59Ydpt5/rkxmq9tV5Kcp/eQLUVVmBzQNVuytQCP6Ezd0G8eLxWyHpmZWJ3bAzkWTtg4lZlw42SQezEmiUPaJUuR/qklVA/87S4ArFCpALdY3QRdUw3G3XbWUp6aq9z0zUizcPa7351p9JXOZyfdZBFnqt90VzQndXB/mwf8LC9STj5kenVpNuqOQQP3mIRJj7eV21FxG8VAxKrEn3c+XfmZ800EPb9/5lIlijscUbB6da0RQaMook0zug1G0tKi/JBC4rw7/D3m4ARzAkzMcVrDcT2SyFtUdWAsFlsPDFqV3N+EjyXaoEePwroaZCiLqEzb8MW+PNE9TmTC01EzWli51PzZvUqkmyuROU+V6ik+Le/9qT6nwzUzf9tP68tYei0YaDGx6kAd7jn1cKqOCuYbiELH9zYqcc4MnRJjkeGiqaGwLImhyeKs+xKJMBlOJ05ow9gGCKZ1VpnMKoSCTbMS+X+23y042zOb5MtcY/6oBeAo1Vy89OTyhpavFP78jXCcFH0t7Gx24hMEOm2gsEfGabVpQgvFqbQKMsknFRRmuPHcZu0Su/WMFphZvB2r/EGbG72rpGGho3h+Msz0uGzJ7hNK2uqQiE1qmn0zgacKYYZBCqsxV+sjbpoVdSilW/b94n2xNb648VmNIoizqEWhBnsen+d0kbCPmRItfWqSBeOd9Wne3c6bcd6uvXOJ6WdiSsuXq0ndhqrQ4QoWUjCjYtZ0EAhnSOP1m44xkf0O7jXghrzSJWxP4a/t72jU29Vu2rvu4n7HfHkkmQOMGSS+NPeLGO5I73mC2B7+lMiBQQZRM9/9liLIfowupUFAbPBbR+lxDM6M8Ptgh1paJq5Rvs7yEuLQv/7d1oU2woFSb3FMPWQOKMuCuJ7pDDjpIclus5TeEoMBy2YdVB4fxmesaCeMNsEgTHKS5WDSGyNUOoEpcC2OFWtIRf0w27ck34/DjxRTVIcc9+kqZE6iMSiVDsiKdP/Xz5XfEhm/sBhO50p1rvJDlkyyxuJ9SPgs7YeUJBjXdeAkE+P9OQJm6SZnn1svcduI78dYmbkE2mtziPrcjVisXG78spLvbZaSFx/Rks9zP4LKn0Cdz/3JsetkT06A8f/yCgMO6Mb1Hme0JJ7b2wZz1qleqTuKBGokhPVUZ0dVu+tnQYNEY1fmkZSz6+EGZ5EzL7657mreZGR3jUfaEk458PDniBzsSmBKhDRzfXameryJv9/D5m6HIqZ0R+ouCE54Dzp4IJuuD1e4Dc5i+PpSORJfG23uVgqixAMDvchMR0nZdH5brclYwRoJRWv/rlxGRI5ffD5NPGmIDt7vDE1434pYdVZIFh89Bs94HGGJbTwrN8T6lh1HZFTOB4lWzWj6EVqxSMvC0/ljWBQ3F2kc/mO2b6tWonT2JEqEwFts8rz2h+oWNds9ceR2cb7zZvJTDppHaEhK5avWqsseWa2Dt5BBhabdWSktS80oMQrL4TvAM9b5HMmyDnO+OkkbMXfUJG7eXqTIG6lqSOEbqVR+qYdP7uWb57WEJqzyh411GAVsDinPs7KvUeXItlcMdOUWzXBH6zscymV1LLVCtc8IePojzXHF9m5b5zGwBRdzcyUJkiu938ApmAayRdJrX1PmVguWUvt2ThQ62czItTyWJMW2An/hdDfMK7SiFQlGIdAbltHz3ycoh7j9V7GxNWBpbtcSdqm4XxRwTawc3cbZ+xfSv9qQfEkDKfZTwCkqWGI/ur250ItXlMlh6vUNWEYIg9A3GzbgmbqvTN8js2YMo87CU5y6nZ4dbJLDQJj9fc7yM7tZzJDZFtqOcU8+mZjYlq4VmifI23iHb1ZoT9E+kT2dolnP1AfiOkt7PQCSykBiXy5mv637IegWSKj9IKrYZf4Lu9+I7ub+mkRdlvYzehh/jaJ9n7HUH5b2IbgeNdkY7wx1yVzxS7pbvky6+nmVUtRllEFfweUQ0/nG017WoUYSxs+j2B4FV/F62EtHlMWZXYrjGHpthnNb1x66LKZ0Qe92INWHdfR/vqp02wMS8r1G4dJqHok8KmQ7947G13a4YXbsGgHcBvRuVu1eAi4/A5+ZixmdSXM73LupB/LH7O9yxLTVXJTyBbI1S49TIROrfVCOb/czZ9pM4JsZx8kUz8dQGv7gUWKxXvTH7QM/3J2OuXXgciUhqY+cgtaOliQQVOYthBLV3xpESZT3rmfEYNZxmpBbb24CRao86prn+i9TNOh8VxRJGXJfXHATJHs1T5txgc/opYrY8XjlGQQbRcoxIBcnVsMjmU1ymmIUL4dviJXndMAJ0Yet+c7O52/p98ytlmAsGBaTAmMhimAnvp1TWNGM9BpuitGj+t810CU2UhorrjPKGtThVC8WaXw04WFnT5fTjqmPyrQ0tN3CkLsctVy2xr0ZWgiWVZ1OrlFjjxJYsOiZv2cAoOvE+7sY0I/TwWcZqMoyIKNOftwP7w++Rfg67ljfovKYa50if3fzE/8aPYVey/Nq35+nH2sLPh/fP5TsylSKGOZ4k69d2PnH43+kq++sRXHQqGArWdwhx+hpwQC6JgT2uxehYU4Zbw7oNb6/HLikPyJROGK2ouyr+vzseESp9G50T4AyFrSqOQ0rroCYP4sMDFBrHn342EyZTMlSyk47rHSq89Y9/nI3zG5lX16Z5lxphguLOcZUndL8wNcrkyjH82jqg8Bo8OYkynrxZvbFno5lUS3OPr8Ko3mX9NoRPdYOKKjD07bvgFgpZ/RF+YzkWvJ/Hs/tUbfeGzGWLxNAjfDzHHMVSDwB5SabQLsIZHiBp43FjGkaienYoDd18hu2BGwOK7U3o70K/WY/kuuKdmdrykIBUdG2mvE91L1JtTbh20mOLbk1vCAamu7utlXeGU2ooVikbU/actcgmsC1FKk2qmj3GWeIWbj4tGIxE7BLcBWUvvcnd/lYxsMV4F917fWeFB/XbINN3qGvIyTpCalz1lVewdIGqeAS/gB8Mi+sA+BqDiX3VGD2eUunTRbSY+AuDy4E3Qx3hAhwnSXX+B0zuj3eQ1miS8Vux2z/l6/BkWtjKGU72aJkOCWhGcSf3+kFkkB15vGOsQrSdFr6qTj0gBYiOlnBO41170gOWHSUoBVRU2JjwppYdhIFDfu7tIRHccSNM5KZOFDPz0TGMAjzzEpeLwTWp+kn201kU6NjbiMQJx83+LX1e1tZ10kuChJZ/XBUQ1dwaBHjTDJDqOympEk8X2M3VtVw21JksChA8w1tTefO3RJ1FMbqZ01bHHkudDB/OhLfe7P5GOHaI28ZXKTMuqo0hLWQ4HabBsGG7NbP1RiXtETz074er6w/OerJWEqjmkq2y51q1BVI+JUudnVa3ogBpzdhFE7fC7kybrAt2Z6RqDjATAUEYeYK45WMupBKQRtQlU+uNsjnzj6ZmGrezA+ASrWxQ6LMkHRXqXwNq7ftv28dUx/ZSJciDXP2SWJsWaN0FjPX9Yko6LobZ7aYW/IdUktI9apTLyHS8DyWPyuoZyxN1TK/vtfxk3HwWh6JczZC8Ftn0bIJay2g+n5wd7lm9rEsKO+svqVmi+c1j88hSCxbzrg4+HEP0Nt1/B6YW1XVm09T1CpAKjc9n18hjqsaFGdfyva1ZG0Xu3ip6N6JGpyTSqY5h4BOlpLPaOnyw45PdXTN+DtAKg7DLrLFTnWusoSBHk3s0d7YouJHq85/R09Tfc37ENXZF48eAYLnq9GLioNcwDZrC6FW6godB8JnqYUPvn0pWLfQz0lM0Yy8Mybgn84Ds3Q9bDP10bLyOV+qzxa4Rd9Dhu7cju8mMaONXK3UqmBQ9qIg7etIwEqM/kECk/Dzja4Bs1xR+Q/tCbc8IKrSGsTdJJ0vge7IG20W687uVmK6icWQ6cD3lwFzgNMGtFvO5qyJeKflGLAAcQZOrkxVwy3cWvqlGpvjmf9Qe6Ap20MPbV92DPV0OhFM4kz8Yr0ffC2zLWSQ1kqY6QdQrttR3kh1YLtQd1kCEv5hVoPIRWl5ERcUTttBIrWp6Xs5Ehh5OUUwI5aEBvuiDmUoENmnVw1FohCrbRp1A1E+XSlWVOTi7ADW+5Ohb9z1vK4qx5R5lPdGCPBJZ00mC+Ssp8VUbgpGAvXWMuWQQRbCqI6Rr2jtxZxtfP7W/8onz+yz0Gs76LaT5HX9ecyiZCB/ZR/gFtMxPsDwohoeCRtiuLxE1GM1vUEUgBv86+eehL58/P56QFGQ/MqOe/vC76L63jzmeax4exd/OKTUvkXg+fOJUHych9xt/9goJMrapSgvXrj8+8vk/N80f22Sewj6cyGqt1B6mztoeklVHHraouhvHJaG/OuBz6DHKMpFmQULU1bRWlyYE0RPXYYkUycIemN7TLtgNCJX6BqdyxDKkegO7nJK5xQ7OVYDZTMf9bVHidtk6DQX9Et+V9M7esgbsYBdEeUpsB0Xvw2kd9+rI7V+m47u+O/tq7mw7262HU1WlS9uFzsV6JxIHNmUCy0QS9e077JGRFbG65z3/dOKB/Zk+yDdKpUmdXjn/aS3N5nv4fK7bMHHmPlHd4E2+iTbV5rpzScRnxk6KARuDTJ8Q1LpK2mP8gj1EbuJ9RIyY+EWK4hCiIDBAS1Tm2IEXAFfgKPgdL9O6mAa06wjCcUAL6EsxPQWO9VNegBPm/0GgkZbDxCynxujX/92vmGcjZRMAY45puak2sFLCLSwXpEsyy5fnF0jGJBhm+fNSHKKUUfy+276A7/feLOFxxUuHRNJI2Osenxyvf8DAGObT60pfTTlhEg9u/KKkhJqm5U1/+BEcSkpFDA5XeCqxwXmPac1jcuZ3JWQ+p0NdWzb/5v1ZvF8GtMTFFEdQjpLO0bwPb0BHNWnip3liDXI2fXf05jjvfJ0NpjLCUgfTh9CMFYVFKEd4Z/OG/2C+N435mnK+9t1gvCiVcaaH7rK4+PjCvpVNiz+t2QyqH1O8x3JKZVl6Q+Lp/XK8wMjVMslOq9FdSw5FtUs/CptXH9PW+wbWHgrV17R5jTVOtGtKFu3nb80T+E0tv9QkzW3J2dbaw/8ddAKZ0pxIaEqLjlPrji3VgJ3GvdFvlqD8075woxh4fVt0JZE0KVFsAvqhe0dqN9b35jtSpnYMXkU+vZq+IAHad3IHc2s/LYrnD1anfG46IFiMIr9oNbZDWvwthqYNqOigaKd/XlLU4XHfk/PXIjPsLy/9/kAtQ+/wKH+hI/IROWj5FPvTZAT9f7j4ZXQyG4M0TujMAFXYkKvEHv1xhySekgXGGqNxWeWKlf8dDAlLuB1cb/qOD+rk7cmwt+1yKpk9cudqBanTi6zTbXRtV8qylNtjyOVKy1HTz0GW9rjt6sSjAZcT5R+KdtyYb0zyqG9pSLuCw5WBwAn7fjBjKLLoxLXMI+52L9cLwIR2B6OllJZLHJ8vDxmWdtF+QJnmt1rsHPIWY20lftk8fYePkAIg6Hgn532QoIpegMxiWgAOfe5/U44APR8Ac0NeZrVh3gEhs12W+tVSiWiUQekf/YBECUy5fdYbA08dd7VzPAP9aiVcIB9k6tY7WdJ1wNV+bHeydNtmC6G5ICtFC1ZwmJU/j8hf0I8TRVKSiz5oYIa93EpUI78X8GYIAZabx47/n8LDAAJ0nNtP1rpROprqKMBRecShca6qXuTSI3jZBLOB3Vp381B5rCGhjSvh/NSVkYp2qIdP/Bg="},{}],6:[function(e,t,n){var s=e("./dictionary-browser");n.init=function(){n.dictionary=s.init()},n.offsetsByLength=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),n.sizeBitsByLength=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),n.minDictionaryWordLength=4,n.maxDictionaryWordLength=24},{"./dictionary-browser":4}],7:[function(e,t,n){function s(e,t){this.bits=e,this.value=t}n.HuffmanCode=s;var i=15;function r(e,t){for(var n=1<<t-1;e&n;)n>>=1;return(e&n-1)+n}function o(e,t,n,i,r){do{e[t+(i-=n)]=new s(r.bits,r.value)}while(i>0)}function a(e,t,n){for(var s=1<<t-n;t<i&&!((s-=e[t])<=0);)++t,s<<=1;return t-n}n.BrotliBuildHuffmanTable=function(e,t,n,l,c){var u,d,h,p,f,m,g,v,x,y,b=t,w=new Int32Array(i+1),_=new Int32Array(i+1);for(y=new Int32Array(c),d=0;d<c;d++)w[l[d]]++;for(_[1]=0,u=1;u<i;u++)_[u+1]=_[u]+w[u];for(d=0;d<c;d++)0!==l[d]&&(y[_[l[d]]++]=d);if(x=v=1<<(g=n),1===_[i]){for(h=0;h<x;++h)e[t+h]=new s(0,65535&y[0]);return x}for(h=0,d=0,u=1,p=2;u<=n;++u,p<<=1)for(;w[u]>0;--w[u])o(e,t+h,p,v,new s(255&u,65535&y[d++])),h=r(h,u);for(m=x-1,f=-1,u=n+1,p=2;u<=i;++u,p<<=1)for(;w[u]>0;--w[u])(h&m)!==f&&(t+=v,x+=v=1<<(g=a(w,u,n)),e[b+(f=h&m)]=new s(g+n&255,t-b-f&65535)),o(e,t+(h>>n),p,v,new s(u-n&255,65535&y[d++])),h=r(h,u);return x}},{}],8:[function(e,t,n){"use strict";n.byteLength=u,n.toByteArray=h,n.fromByteArray=m;for(var s=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=o.length;a<l;++a)s[a]=o[a],i[o.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e){var t=c(e),n=t[0],s=t[1];return 3*(n+s)/4-s}function d(e,t,n){return 3*(t+n)/4-n}function h(e){for(var t,n=c(e),s=n[0],o=n[1],a=new r(d(e,s,o)),l=0,u=o>0?s-4:s,h=0;h<u;h+=4)t=i[e.charCodeAt(h)]<<18|i[e.charCodeAt(h+1)]<<12|i[e.charCodeAt(h+2)]<<6|i[e.charCodeAt(h+3)],a[l++]=t>>16&255,a[l++]=t>>8&255,a[l++]=255&t;return 2===o&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[l++]=255&t),1===o&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t),a}function p(e){return s[e>>18&63]+s[e>>12&63]+s[e>>6&63]+s[63&e]}function f(e,t,n){for(var s,i=[],r=t;r<n;r+=3)s=(e[r]<<16&16711680)+(e[r+1]<<8&65280)+(255&e[r+2]),i.push(p(s));return i.join("")}function m(e){for(var t,n=e.length,i=n%3,r=[],o=16383,a=0,l=n-i;a<l;a+=o)r.push(f(e,a,a+o>l?l:a+o));return 1===i?(t=e[n-1],r.push(s[t>>2]+s[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],r.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"=")),r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],9:[function(e,t,n){function s(e,t){this.offset=e,this.nbits=t}n.kBlockLengthPrefixCode=[new s(1,2),new s(5,2),new s(9,2),new s(13,2),new s(17,3),new s(25,3),new s(33,3),new s(41,3),new s(49,4),new s(65,4),new s(81,4),new s(97,4),new s(113,5),new s(145,5),new s(177,5),new s(209,5),new s(241,6),new s(305,6),new s(369,7),new s(497,8),new s(753,9),new s(1265,10),new s(2289,11),new s(4337,12),new s(8433,13),new s(16625,24)],n.kInsertLengthPrefixCode=[new s(0,0),new s(1,0),new s(2,0),new s(3,0),new s(4,0),new s(5,0),new s(6,1),new s(8,1),new s(10,2),new s(14,2),new s(18,3),new s(26,3),new s(34,4),new s(50,4),new s(66,5),new s(98,5),new s(130,6),new s(194,7),new s(322,8),new s(578,9),new s(1090,10),new s(2114,12),new s(6210,14),new s(22594,24)],n.kCopyLengthPrefixCode=[new s(2,0),new s(3,0),new s(4,0),new s(5,0),new s(6,0),new s(7,0),new s(8,0),new s(9,0),new s(10,1),new s(12,1),new s(14,2),new s(18,2),new s(22,3),new s(30,3),new s(38,4),new s(54,4),new s(70,5),new s(102,5),new s(134,6),new s(198,7),new s(326,8),new s(582,9),new s(1094,10),new s(2118,24)],n.kInsertRangeLut=[0,0,8,8,0,16,8,16,16],n.kCopyRangeLut=[0,8,0,8,16,0,16,8,16]},{}],10:[function(e,t,n){function s(e){this.buffer=e,this.pos=0}function i(e){this.buffer=e,this.pos=0}s.prototype.read=function(e,t,n){this.pos+n>this.buffer.length&&(n=this.buffer.length-this.pos);for(var s=0;s<n;s++)e[t+s]=this.buffer[this.pos+s];return this.pos+=n,n},n.BrotliInput=s,i.prototype.write=function(e,t){if(this.pos+t>this.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(e.subarray(0,t),this.pos),this.pos+=t,t},n.BrotliOutput=i},{}],11:[function(e,t,n){var s=e("./dictionary"),i=0,r=1,o=2,a=3,l=4,c=5,u=6,d=7,h=8,p=9,f=10,m=11,g=12,v=13,x=14,y=15,b=16,w=17,_=18,j=20;function S(e,t,n){this.prefix=new Uint8Array(e.length),this.transform=t,this.suffix=new Uint8Array(n.length);for(var s=0;s<e.length;s++)this.prefix[s]=e.charCodeAt(s);for(s=0;s<n.length;s++)this.suffix[s]=n.charCodeAt(s)}var C=[new S("",i,""),new S("",i," "),new S(" ",i," "),new S("",g,""),new S("",f," "),new S("",i," the "),new S(" ",i,""),new S("s ",i," "),new S("",i," of "),new S("",f,""),new S("",i," and "),new S("",v,""),new S("",r,""),new S(", ",i," "),new S("",i,", "),new S(" ",f," "),new S("",i," in "),new S("",i," to "),new S("e ",i," "),new S("",i,'"'),new S("",i,"."),new S("",i,'">'),new S("",i,"\n"),new S("",a,""),new S("",i,"]"),new S("",i," for "),new S("",x,""),new S("",o,""),new S("",i," a "),new S("",i," that "),new S(" ",f,""),new S("",i,". "),new S(".",i,""),new S(" ",i,", "),new S("",y,""),new S("",i," with "),new S("",i,"'"),new S("",i," from "),new S("",i," by "),new S("",b,""),new S("",w,""),new S(" the ",i,""),new S("",l,""),new S("",i,". The "),new S("",m,""),new S("",i," on "),new S("",i," as "),new S("",i," is "),new S("",d,""),new S("",r,"ing "),new S("",i,"\n\t"),new S("",i,":"),new S(" ",i,". "),new S("",i,"ed "),new S("",j,""),new S("",_,""),new S("",u,""),new S("",i,"("),new S("",f,", "),new S("",h,""),new S("",i," at "),new S("",i,"ly "),new S(" the ",i," of "),new S("",c,""),new S("",p,""),new S(" ",f,", "),new S("",f,'"'),new S(".",i,"("),new S("",m," "),new S("",f,'">'),new S("",i,'="'),new S(" ",i,"."),new S(".com/",i,""),new S(" the ",i," of the "),new S("",f,"'"),new S("",i,". This "),new S("",i,","),new S(".",i," "),new S("",f,"("),new S("",f,"."),new S("",i," not "),new S(" ",i,'="'),new S("",i,"er "),new S(" ",m," "),new S("",i,"al "),new S(" ",m,""),new S("",i,"='"),new S("",m,'"'),new S("",f,". "),new S(" ",i,"("),new S("",i,"ful "),new S(" ",f,". "),new S("",i,"ive "),new S("",i,"less "),new S("",m,"'"),new S("",i,"est "),new S(" ",f,"."),new S("",m,'">'),new S(" ",i,"='"),new S("",f,","),new S("",i,"ize "),new S("",m,"."),new S(" ",i,""),new S(" ",i,","),new S("",f,'="'),new S("",m,'="'),new S("",i,"ous "),new S("",m,", "),new S("",f,"='"),new S(" ",f,","),new S(" ",m,'="'),new S(" ",m,", "),new S("",m,","),new S("",m,"("),new S("",m,". "),new S(" ",m,"."),new S("",m,"='"),new S(" ",m,". "),new S(" ",f,'="'),new S(" ",m,"='"),new S(" ",f,"='")];function k(e,t){return e[t]<192?(e[t]>=97&&e[t]<=122&&(e[t]^=32),1):e[t]<224?(e[t+1]^=32,2):(e[t+2]^=5,3)}n.kTransforms=C,n.kNumTransforms=C.length,n.transformDictionaryWord=function(e,t,n,i,r){var o,a=C[r].prefix,l=C[r].suffix,c=C[r].transform,u=c<g?0:c-(g-1),d=0,h=t;u>i&&(u=i);for(var v=0;v<a.length;)e[t++]=a[v++];for(n+=u,i-=u,c<=p&&(i-=c),d=0;d<i;d++)e[t++]=s.dictionary[n+d];if(o=t-i,c===f)k(e,o);else if(c===m)for(;i>0;){var x=k(e,o);o+=x,i-=x}for(var y=0;y<l.length;)e[t++]=l[y++];return t-h}},{"./dictionary":6}],12:[function(e,t,n){t.exports=e("./dec/decode").BrotliDecompressBuffer},{"./dec/decode":3}]},{},[12])(12)},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),s=new RegExp(n,"g"),i=new RegExp(n,"");function r(e){return t[e]}var o=function(e){return e.replace(s,r)};e.exports=o,e.exports.has=function(e){return!!e.match(i)},e.exports.remove=o}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,s){if(1&s&&(n=this(n)),8&s)return n;if("object"==typeof n&&n){if(4&s&&n.__esModule)return n;if(16&s&&"function"==typeof n.then)return n}var r=Object.create(null);i.r(r);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&s&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>n[e]));return o.default=()=>n,i.d(r,o),r},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";i.r(r),i.d(r,{PluginMoreMenuItem:()=>HE,PluginSidebar:()=>UE,PluginSidebarMoreMenuItem:()=>WE,PluginTemplateSettingPanel:()=>La,initializeEditor:()=>QE,initializePostsDashboard:()=>XE,reinitializeEditor:()=>$E,store:()=>zt});var e={};i.r(e),i.d(e,{__experimentalSetPreviewDeviceType:()=>He,addTemplate:()=>We,closeGeneralSidebar:()=>lt,openGeneralSidebar:()=>at,openNavigationPanelToMenu:()=>et,removeTemplate:()=>qe,revertTemplate:()=>ot,setEditedEntity:()=>Ye,setEditedPostContext:()=>Je,setHasPageContentFocus:()=>ut,setHomeTemplateId:()=>Xe,setIsInserterOpened:()=>nt,setIsListViewOpened:()=>st,setIsNavigationPanelOpened:()=>tt,setIsSaveViewOpened:()=>rt,setNavigationMenu:()=>Ke,setNavigationPanelActiveMenu:()=>$e,setPage:()=>Qe,setTemplate:()=>Ue,setTemplatePart:()=>Ze,switchEditorMode:()=>ct,toggleDistractionFree:()=>dt,toggleFeature:()=>Ge,updateSettings:()=>it});var t={};i.r(t),i.d(t,{registerRoute:()=>pt,setEditorCanvasContainerView:()=>ht,unregisterRoute:()=>ft});var n={};i.r(n),i.d(n,{__experimentalGetInsertionPoint:()=>Et,__experimentalGetPreviewDeviceType:()=>vt,getCanUserCreateMedia:()=>xt,getCurrentTemplateNavigationPanelSubMenu:()=>Nt,getCurrentTemplateTemplateParts:()=>Ot,getEditedPostContext:()=>St,getEditedPostId:()=>jt,getEditedPostType:()=>_t,getEditorMode:()=>At,getHomeTemplateId:()=>wt,getNavigationPanelActiveMenu:()=>Mt,getPage:()=>Ct,getReusableBlocks:()=>yt,getSettings:()=>bt,hasPageContentFocus:()=>Rt,isFeatureActive:()=>gt,isInserterOpened:()=>kt,isListViewOpened:()=>Pt,isNavigationOpened:()=>Vt,isPage:()=>Ft,isSaveViewOpened:()=>It});var s={};i.r(s),i.d(s,{getEditorCanvasContainerView:()=>Bt,getRoutes:()=>Dt});const o=window.wp.blocks,a=window.wp.blockLibrary,l=window.wp.data,c=window.wp.deprecated;var u=i.n(c);const d=window.wp.element,h=window.wp.editor,f=window.wp.preferences,m=window.wp.widgets,g=window.wp.hooks,v=window.wp.compose,x=window.wp.blockEditor,y=window.wp.components,b=window.wp.i18n,w=window.wp.notices,_=window.wp.coreData;var j={grad:.9,turn:360,rad:360/(2*Math.PI)},S=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},C=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},k=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},E=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},P=function(e){return{r:k(e.r,0,255),g:k(e.g,0,255),b:k(e.b,0,255),a:k(e.a)}},I=function(e){return{r:C(e.r),g:C(e.g),b:C(e.b),a:C(e.a,3)}},T=/^#([0-9a-f]{3,8})$/i,O=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},A=function(e){var t=e.r,n=e.g,s=e.b,i=e.a,r=Math.max(t,n,s),o=r-Math.min(t,n,s),a=o?r===t?(n-s)/o:r===n?2+(s-t)/o:4+(t-n)/o:0;return{h:60*(a<0?a+6:a),s:r?o/r*100:0,v:r/255*100,a:i}},N=function(e){var t=e.h,n=e.s,s=e.v,i=e.a;t=t/360*6,n/=100,s/=100;var r=Math.floor(t),o=s*(1-n),a=s*(1-(t-r)*n),l=s*(1-(1-t+r)*n),c=r%6;return{r:255*[s,a,o,o,l,s][c],g:255*[l,s,s,a,o,o][c],b:255*[o,o,l,s,s,a][c],a:i}},M=function(e){return{h:E(e.h),s:k(e.s,0,100),l:k(e.l,0,100),a:k(e.a)}},V=function(e){return{h:C(e.h),s:C(e.s),l:C(e.l),a:C(e.a,3)}},F=function(e){return N((n=(t=e).s,{h:t.h,s:(n*=((s=t.l)<50?s:100-s)/100)>0?2*n/(s+n)*100:0,v:s+n,a:t.a}));var t,n,s},R=function(e){return{h:(t=A(e)).h,s:(i=(200-(n=t.s))*(s=t.v)/100)>0&&i<200?n*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,s,i},B=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,L=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,z=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,G={string:[[function(e){var t=T.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?C(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?C(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=L.exec(e)||z.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:P({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=B.exec(e)||D.exec(e);if(!t)return null;var n,s,i=M({h:(n=t[1],s=t[2],void 0===s&&(s="deg"),Number(n)*(j[s]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return F(i)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,s=e.b,i=e.a,r=void 0===i?1:i;return S(t)&&S(n)&&S(s)?P({r:Number(t),g:Number(n),b:Number(s),a:Number(r)}):null},"rgb"],[function(e){var t=e.h,n=e.s,s=e.l,i=e.a,r=void 0===i?1:i;if(!S(t)||!S(n)||!S(s))return null;var o=M({h:Number(t),s:Number(n),l:Number(s),a:Number(r)});return F(o)},"hsl"],[function(e){var t=e.h,n=e.s,s=e.v,i=e.a,r=void 0===i?1:i;if(!S(t)||!S(n)||!S(s))return null;var o=function(e){return{h:E(e.h),s:k(e.s,0,100),v:k(e.v,0,100),a:k(e.a)}}({h:Number(t),s:Number(n),v:Number(s),a:Number(r)});return N(o)},"hsv"]]},H=function(e,t){for(var n=0;n<t.length;n++){var s=t[n][0](e);if(s)return[s,t[n][1]]}return[null,void 0]},U=function(e){return"string"==typeof e?H(e.trim(),G.string):"object"==typeof e&&null!==e?H(e,G.object):[null,void 0]},W=function(e,t){var n=R(e);return{h:n.h,s:k(n.s+100*t,0,100),l:n.l,a:n.a}},q=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Z=function(e,t){var n=R(e);return{h:n.h,s:n.s,l:k(n.l+100*t,0,100),a:n.a}},K=function(){function e(e){this.parsed=U(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return C(q(this.rgba),2)},e.prototype.isDark=function(){return q(this.rgba)<.5},e.prototype.isLight=function(){return q(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=I(this.rgba)).r,n=e.g,s=e.b,r=(i=e.a)<1?O(C(255*i)):"","#"+O(t)+O(n)+O(s)+r;var e,t,n,s,i,r},e.prototype.toRgb=function(){return I(this.rgba)},e.prototype.toRgbString=function(){return t=(e=I(this.rgba)).r,n=e.g,s=e.b,(i=e.a)<1?"rgba("+t+", "+n+", "+s+", "+i+")":"rgb("+t+", "+n+", "+s+")";var e,t,n,s,i},e.prototype.toHsl=function(){return V(R(this.rgba))},e.prototype.toHslString=function(){return t=(e=V(R(this.rgba))).h,n=e.s,s=e.l,(i=e.a)<1?"hsla("+t+", "+n+"%, "+s+"%, "+i+")":"hsl("+t+", "+n+"%, "+s+"%)";var e,t,n,s,i},e.prototype.toHsv=function(){return e=A(this.rgba),{h:C(e.h),s:C(e.s),v:C(e.v),a:C(e.a,3)};var e},e.prototype.invert=function(){return Y({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Y(W(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Y(W(this.rgba,-e))},e.prototype.grayscale=function(){return Y(W(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Y(Z(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Y(Z(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Y({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):C(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=R(this.rgba);return"number"==typeof e?Y({h:e,s:t.s,l:t.l,a:t.a}):C(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Y(e).toHex()},e}(),Y=function(e){return e instanceof K?e:new K(e)},X=[],J=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},Q=function(e){return.2126*J(e.r)+.7152*J(e.g)+.0722*J(e.b)};const $=window.wp.privateApis,{lock:ee,unlock:te}=(0,$.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-site"),{useGlobalSetting:ne,useGlobalStyle:se}=te(x.privateApis);function ie(){const[e="black"]=se("color.text"),[t="white"]=se("color.background"),[n=e]=se("elements.h1.color.text"),[s=n]=se("elements.link.color.text"),[i=s]=se("elements.button.color.background"),[r]=ne("color.palette.core"),[o]=ne("color.palette.theme"),[a]=ne("color.palette.custom"),l=(null!=o?o:[]).concat(null!=a?a:[]).concat(null!=r?r:[]),c=l.filter((({color:t})=>t===e)),u=l.filter((({color:e})=>e===i)),d=c.concat(u).concat(l).filter((({color:e})=>e!==t)).slice(0,2);return{paletteColors:l,highlightedColors:d}}function re(e,t,n){return e&&"object"==typeof e?(t.reduce(((e,s,i)=>(void 0===e[s]&&(Number.isInteger(t[i+1])?e[s]=[]:e[s]={}),i===t.length-1&&(e[s]=n),e[s])),e),e):e}!function(e){e.forEach((function(e){X.indexOf(e)<0&&(e(K,G),X.push(e))}))}([function(e){e.prototype.luminance=function(){return e=Q(this.rgba),void 0===(t=2)&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0;var e,t,n},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var n,s,i,r,o,a,l,c=t instanceof e?t:new e(t);return r=this.rgba,o=c.toRgb(),n=(a=Q(r))>(l=Q(o))?(a+.05)/(l+.05):(l+.05)/(a+.05),void 0===(s=2)&&(s=0),void 0===i&&(i=Math.pow(10,s)),Math.floor(i*n)/i+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(o=void 0===(r=(n=t).size)?"normal":r,"AAA"===(i=void 0===(s=n.level)?"AA":s)&&"normal"===o?7:"AA"===i&&"large"===o?3:4.5);var n,s,i,r,o}}]);const oe=window.ReactJSXRuntime,{cleanEmptyObject:ae,GlobalStylesContext:le}=te(x.privateApis),ce={...o.__EXPERIMENTAL_STYLE_PROPERTY,blockGap:{value:["spacing","blockGap"]}},ue={"border.color":"color","color.background":"color","color.text":"color","elements.link.color.text":"color","elements.link.:hover.color.text":"color","elements.link.typography.fontFamily":"font-family","elements.link.typography.fontSize":"font-size","elements.button.color.text":"color","elements.button.color.background":"color","elements.button.typography.fontFamily":"font-family","elements.button.typography.fontSize":"font-size","elements.caption.color.text":"color","elements.heading.color":"color","elements.heading.color.background":"color","elements.heading.typography.fontFamily":"font-family","elements.heading.gradient":"gradient","elements.heading.color.gradient":"gradient","elements.h1.color":"color","elements.h1.color.background":"color","elements.h1.typography.fontFamily":"font-family","elements.h1.color.gradient":"gradient","elements.h2.color":"color","elements.h2.color.background":"color","elements.h2.typography.fontFamily":"font-family","elements.h2.color.gradient":"gradient","elements.h3.color":"color","elements.h3.color.background":"color","elements.h3.typography.fontFamily":"font-family","elements.h3.color.gradient":"gradient","elements.h4.color":"color","elements.h4.color.background":"color","elements.h4.typography.fontFamily":"font-family","elements.h4.color.gradient":"gradient","elements.h5.color":"color","elements.h5.color.background":"color","elements.h5.typography.fontFamily":"font-family","elements.h5.color.gradient":"gradient","elements.h6.color":"color","elements.h6.color.background":"color","elements.h6.typography.fontFamily":"font-family","elements.h6.color.gradient":"gradient","color.gradient":"gradient",blockGap:"spacing","typography.fontSize":"font-size","typography.fontFamily":"font-family"},de={"border.color":"borderColor","color.background":"backgroundColor","color.text":"textColor","color.gradient":"gradient","typography.fontSize":"fontSize","typography.fontFamily":"fontFamily"},he=["border","color","spacing","typography"],pe=(e,t)=>{let n=e;return t.forEach((e=>{n=n?.[e]})),n},fe=["borderColor","borderWidth","borderStyle"],me=["top","right","bottom","left"];function ge(e,t,n){if(!t?.[e]||n?.[e]?.style)return[];const{color:s,style:i,width:r}=t[e];return!(s||r)||i?[]:[{path:["border",e,"style"],value:"solid"}]}function ve(e,t,n){const s=function(e,t){const{supportedPanels:n}=(0,l.useSelect)((n=>({supportedPanels:te(n(o.store)).getSupportedStyles(e,t)})),[e,t]);return n}(e),i=n?.styles?.blocks?.[e];return(0,d.useMemo)((()=>{const e=s.flatMap((e=>{if(!ce[e])return[];const{value:n}=ce[e],s=n.join("."),i=t[de[s]],r=i?`var:preset|${ue[s]}|${i}`:pe(t.style,n);if("linkColor"===e){const e=r?[{path:n,value:r}]:[],s=["elements","link",":hover","color","text"],i=pe(t.style,s);return i&&e.push({path:s,value:i}),e}if(fe.includes(e)&&r){const e=[{path:n,value:r}];return me.forEach((t=>{const s=[...n];s.splice(-1,0,t),e.push({path:s,value:r})})),e}return r?[{path:n,value:r}]:[]}));return function(e,t,n){if(!e&&!t)return[];const s=[...ge("top",e,n),...ge("right",e,n),...ge("bottom",e,n),...ge("left",e,n)],{color:i,style:r,width:o}=e||{};return(t||i||o)&&!r&&me.forEach((e=>{n?.[e]?.style||s.push({path:["border",e,"style"],value:"solid"})})),s}(t.style?.border,t.borderColor,i?.border).forEach((t=>e.push(t))),e}),[s,t,i])}function xe({name:e,attributes:t,setAttributes:n}){const{user:s,setUserConfig:i}=(0,d.useContext)(le),r=ve(e,t,s),{__unstableMarkNextChangeAsNotPersistent:a}=(0,l.useDispatch)(x.store),{createSuccessNotice:c}=(0,l.useDispatch)(w.store),u=(0,d.useCallback)((()=>{if(0!==r.length&&r.length>0){const{style:l}=t,u=structuredClone(l),d=structuredClone(s);for(const{path:t,value:n}of r)re(u,t,void 0),re(d,["styles","blocks",e,...t],n);const h={borderColor:void 0,backgroundColor:void 0,textColor:void 0,gradient:void 0,fontSize:void 0,fontFamily:void 0,style:ae(u)};a(),n(h),i(d,{undoIgnore:!0}),c((0,b.sprintf)((0,b.__)("%s styles applied."),(0,o.getBlockType)(e).title),{type:"snackbar",actions:[{label:(0,b.__)("Undo"),onClick(){a(),n(t),i(s,{undoIgnore:!0})}}]})}}),[a,t,r,c,e,n,i,s]);return(0,oe.jsxs)(y.BaseControl,{__nextHasNoMarginBottom:!0,className:"edit-site-push-changes-to-global-styles-control",help:(0,b.sprintf)((0,b.__)("Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks."),(0,o.getBlockType)(e).title),children:[(0,oe.jsx)(y.BaseControl.VisualLabel,{children:(0,b.__)("Styles")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"secondary",accessibleWhenDisabled:!0,disabled:0===r.length,onClick:u,children:(0,b.__)("Apply globally")})]})}function ye(e){const t=(0,x.useBlockEditingMode)(),n=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.is_block_theme),[]),s=he.some((t=>(0,o.hasBlockSupport)(e.name,t)));return"default"===t&&s&&n?(0,oe.jsx)(x.InspectorAdvancedControls,{children:(0,oe.jsx)(xe,{...e})}):null}const be=(0,v.createHigherOrderComponent)((e=>t=>(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(e,{...t},"edit"),t.isSelected&&(0,oe.jsx)(ye,{...t})]})));(0,g.addFilter)("editor.BlockEdit","core/edit-site/push-changes-to-global-styles",be);const we=(0,l.combineReducers)({settings:function(e={},t){return"UPDATE_SETTINGS"===t.type?{...e,...t.settings}:e},editedPost:function(e={},t){switch(t.type){case"SET_EDITED_POST":return{postType:t.postType,id:t.id,context:t.context};case"SET_EDITED_POST_CONTEXT":return{...e,context:t.context}}return e},saveViewPanel:function(e=!1,t){return"SET_IS_SAVE_VIEW_OPENED"===t.type?t.isOpen:e},editorCanvasContainerView:function(e=void 0,t){return"SET_EDITOR_CANVAS_CONTAINER_VIEW"===t.type?t.view:e},routes:function(e=[],t){switch(t.type){case"REGISTER_ROUTE":return[...e,t.route];case"UNREGISTER_ROUTE":return e.filter((e=>e.name!==t.name))}return e}}),_e=window.wp.patterns,je="wp_navigation",Se="wp_template",Ce="wp_template_part",ke="custom",Ee="uncategorized",Pe="all-parts",{PATTERN_TYPES:Ie,PATTERN_DEFAULT_CATEGORY:Te,PATTERN_USER_CATEGORY:Oe,EXCLUDED_PATTERN_SOURCES:Ae,PATTERN_SYNC_TYPES:Ne}=te(_e.privateApis),Me=[Ce,je,Ie.user],Ve={[Se]:(0,b.__)("Template"),[Ce]:(0,b.__)("Template part"),[Ie.user]:(0,b.__)("Pattern"),[je]:(0,b.__)("Navigation")},Fe="grid",Re="table",Be="list",De="isAny",Le="isNone",{interfaceStore:ze}=te(h.privateApis);function Ge(e){return function({registry:t}){u()("dispatch( 'core/edit-site' ).toggleFeature( featureName )",{since:"6.0",alternative:"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"}),t.dispatch(f.store).toggle("core/edit-site",e)}}const He=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",{since:"6.5",version:"6.7",hint:"registry.dispatch( editorStore ).setDeviceType"}),t.dispatch(h.store).setDeviceType(e)};function Ue(){return u()("dispatch( 'core/edit-site' ).setTemplate",{since:"6.5",version:"6.8",hint:"The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}const We=e=>async({dispatch:t,registry:n})=>{u()("dispatch( 'core/edit-site' ).addTemplate",{since:"6.5",version:"6.8",hint:"use saveEntityRecord directly"});const s=await n.dispatch(_.store).saveEntityRecord("postType",Se,e);e.content&&n.dispatch(_.store).editEntityRecord("postType",Se,s.id,{blocks:(0,o.parse)(e.content)},{undoIgnore:!0}),t({type:"SET_EDITED_POST",postType:Se,id:s.id})},qe=e=>({registry:t})=>te(t.dispatch(h.store)).removeTemplates([e]);function Ze(e){return u()("dispatch( 'core/edit-site' ).setTemplatePart",{since:"6.8"}),{type:"SET_EDITED_POST",postType:Ce,id:e}}function Ke(e){return u()("dispatch( 'core/edit-site' ).setNavigationMenu",{since:"6.8"}),{type:"SET_EDITED_POST",postType:je,id:e}}function Ye(e,t,n){return{type:"SET_EDITED_POST",postType:e,id:t,context:n}}function Xe(){return u()("dispatch( 'core/edit-site' ).setHomeTemplateId",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function Je(e){return u()("dispatch( 'core/edit-site' ).setEditedPostContext",{since:"6.8"}),{type:"SET_EDITED_POST_CONTEXT",context:e}}function Qe(){return u()("dispatch( 'core/edit-site' ).setPage",{since:"6.5",version:"6.8",hint:"The setPage is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}function $e(){return u()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function et(){return u()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function tt(){return u()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}const nt=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).setIsInserterOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsInserterOpened"}),t.dispatch(h.store).setIsInserterOpened(e)},st=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).setIsListViewOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsListViewOpened"}),t.dispatch(h.store).setIsListViewOpened(e)};function it(e){return{type:"UPDATE_SETTINGS",settings:e}}function rt(e){return{type:"SET_IS_SAVE_VIEW_OPENED",isOpen:e}}const ot=(e,t)=>({registry:n})=>te(n.dispatch(h.store)).revertTemplate(e,t),at=e=>({registry:t})=>{t.dispatch(ze).enableComplementaryArea("core",e)},lt=()=>({registry:e})=>{e.dispatch(ze).disableComplementaryArea("core")},ct=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).switchEditorMode",{since:"6.6",alternative:"dispatch( 'core/editor').switchEditorMode"}),t.dispatch(h.store).switchEditorMode(e)},ut=e=>({dispatch:t,registry:n})=>{u()("dispatch( 'core/edit-site' ).setHasPageContentFocus",{since:"6.5"}),e&&n.dispatch(x.store).clearSelectedBlock(),t({type:"SET_HAS_PAGE_CONTENT_FOCUS",hasPageContentFocus:e})},dt=()=>({registry:e})=>{u()("dispatch( 'core/edit-site' ).toggleDistractionFree",{since:"6.6",alternative:"dispatch( 'core/editor').toggleDistractionFree"}),e.dispatch(h.store).toggleDistractionFree()},ht=e=>({dispatch:t})=>{t({type:"SET_EDITOR_CANVAS_CONTAINER_VIEW",view:e})};function pt(e){return{type:"REGISTER_ROUTE",route:e}}function ft(e){return{type:"UNREGISTER_ROUTE",name:e}}const mt=[];const gt=(0,l.createRegistrySelector)((e=>(t,n)=>(u()("select( 'core/edit-site' ).isFeatureActive",{since:"6.0",alternative:"select( 'core/preferences' ).get"}),!!e(f.store).get("core/edit-site",n)))),vt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).__experimentalGetPreviewDeviceType",{since:"6.5",version:"6.7",alternative:"select( 'core/editor' ).getDeviceType"}),e(h.store).getDeviceType()))),xt=(0,l.createRegistrySelector)((e=>()=>(u()("wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()",{since:"6.7",alternative:"wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )"}),e(_.store).canUser("create","media")))),yt=(0,l.createRegistrySelector)((e=>()=>{u()("select( 'core/edit-site' ).getReusableBlocks()",{since:"6.5",version:"6.8",alternative:"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )"});return"web"===d.Platform.OS?e(_.store).getEntityRecords("postType","wp_block",{per_page:-1}):[]}));function bt(e){return e.settings}function wt(){u()("select( 'core/edit-site' ).getHomeTemplateId",{since:"6.2",version:"6.4"})}function _t(e){return u()("select( 'core/edit-site' ).getEditedPostType",{since:"6.8",alternative:"select( 'core/editor' ).getCurrentPostType"}),e.editedPost.postType}function jt(e){return u()("select( 'core/edit-site' ).getEditedPostId",{since:"6.8",alternative:"select( 'core/editor' ).getCurrentPostId"}),e.editedPost.id}function St(e){return u()("select( 'core/edit-site' ).getEditedPostContext",{since:"6.8"}),e.editedPost.context}function Ct(e){return u()("select( 'core/edit-site' ).getPage",{since:"6.8"}),{context:e.editedPost.context}}const kt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).isInserterOpened",{since:"6.5",alternative:"select( 'core/editor' ).isInserterOpened"}),e(h.store).isInserterOpened()))),Et=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).__experimentalGetInsertionPoint",{since:"6.5",version:"6.7"}),te(e(h.store)).getInserter()))),Pt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).isListViewOpened",{since:"6.5",alternative:"select( 'core/editor' ).isListViewOpened"}),e(h.store).isListViewOpened())));function It(e){return e.saveViewPanel}function Tt(e){const t=e(_.store).getEntityRecords("postType",Ce,{per_page:-1}),{getBlocksByName:n,getBlocksByClientId:s}=e(x.store);return[s(n("core/template-part")),t]}const Ot=(0,l.createRegistrySelector)((e=>(0,l.createSelector)((()=>(u()("select( 'core/edit-site' ).getCurrentTemplateTemplateParts()",{since:"6.7",version:"6.9",alternative:"select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )"}),function(e=mt,t){const n=t?t.reduce(((e,t)=>({...e,[t.id]:t})),{}):{},s=[],i=[...e];for(;i.length;){const{innerBlocks:e,...t}=i.shift();if(i.unshift(...e),(0,o.isTemplatePart)(t)){const{attributes:{theme:e,slug:i}}=t,r=n[`${e}//${i}`];r&&s.push({templatePart:r,block:t})}}return s}(...Tt(e)))),(()=>Tt(e))))),At=(0,l.createRegistrySelector)((e=>()=>e(f.store).get("core","editorMode")));function Nt(){u()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",{since:"6.2",version:"6.4"})}function Mt(){u()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu",{since:"6.2",version:"6.4"})}function Vt(){u()("dispatch( 'core/edit-site' ).isNavigationOpened",{since:"6.2",version:"6.4"})}function Ft(e){return u()("select( 'core/edit-site' ).isPage",{since:"6.8",alternative:"select( 'core/editor' ).getCurrentPostType"}),!!e.editedPost.context?.postId}function Rt(){return u()("select( 'core/edit-site' ).hasPageContentFocus",{since:"6.5"}),!1}function Bt(e){return e.editorCanvasContainerView}function Dt(e){return e.routes}const Lt={reducer:we,actions:e,selectors:n},zt=(0,l.createReduxStore)("core/edit-site",Lt);(0,l.register)(zt),te(zt).registerPrivateSelectors(s),te(zt).registerPrivateActions(t);const Gt=window.wp.router;function Ht(e){var t,n,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ht(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}const Ut=function(){for(var e,t,n=0,s="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ht(e))&&(s&&(s+=" "),s+=t);return s},Wt=window.wp.commands,qt=window.wp.coreCommands,Zt=window.wp.plugins,Kt=window.wp.htmlEntities,Yt=window.wp.primitives,Xt=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})}),Jt=window.wp.keycodes,Qt=window.wp.url,$t=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"})});const en=function({className:e}){const{isRequestingSite:t,siteIconUrl:n}=(0,l.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),n=t("root","__unstableBase",void 0);return{isRequestingSite:!n,siteIconUrl:n?.site_icon_url}}),[]);if(t&&!n)return(0,oe.jsx)("div",{className:"edit-site-site-icon__image"});const s=n?(0,oe.jsx)("img",{className:"edit-site-site-icon__image",alt:(0,b.__)("Site Icon"),src:n}):(0,oe.jsx)(y.Icon,{className:"edit-site-site-icon__icon",icon:$t,size:48});return(0,oe.jsx)("div",{className:Ut(e,"edit-site-site-icon"),children:s})},tn=window.wp.dom,nn=(0,d.createContext)((()=>{}));function sn(){let e={direction:null,focusSelector:null};return{get:()=>e,navigate(t,n=null){e={direction:t,focusSelector:"forward"===t&&n?n:e.focusSelector}}}}function rn({children:e,shouldAnimate:t}){const n=(0,d.useContext)(nn),s=(0,d.useRef)(),[i,r]=(0,d.useState)(null);(0,d.useLayoutEffect)((()=>{const{direction:e,focusSelector:t}=n.get();!function(e,t,n){let s;if("back"===t&&n&&(s=e.querySelector(n)),null!==t&&!s){const[t]=tn.focus.tabbable.find(e);s=null!=t?t:e}s?.focus()}(s.current,e,t),r(e)}),[n]);const o=Ut("edit-site-sidebar__screen-wrapper",t?{"slide-from-left":"back"===i,"slide-from-right":"forward"===i}:{});return(0,oe.jsx)("div",{ref:s,className:o,children:e})}function on({children:e}){const[t]=(0,d.useState)(sn);return(0,oe.jsx)(nn.Provider,{value:t,children:e})}function an({routeKey:e,shouldAnimate:t,children:n}){return(0,oe.jsx)("div",{className:"edit-site-sidebar__content",children:(0,oe.jsx)(rn,{shouldAnimate:t,children:n},e)})}const{useLocation:ln,useHistory:cn}=te(Gt.privateApis),un=(0,d.memo)((0,d.forwardRef)((({isTransparent:e},t)=>{const{dashboardLink:n,homeUrl:s,siteTitle:i}=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt)),{getEntityRecord:n}=e(_.store),s=n("root","site");return{dashboardLink:t().__experimentalDashboardLink,homeUrl:n("root","__unstableBase")?.home,siteTitle:!s?.title&&s?.url?(0,Qt.filterURLForDisplay)(s?.url):s?.title}}),[]),{open:r}=(0,l.useDispatch)(Wt.store);return(0,oe.jsx)("div",{className:"edit-site-site-hub",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,oe.jsx)("div",{className:Ut("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,ref:t,href:n,label:(0,b.__)("Go to the Dashboard"),className:"edit-site-layout__view-mode-toggle",style:{transform:"scale(0.5333) translateX(-4px)",borderRadius:4},children:(0,oe.jsx)(en,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,oe.jsxs)(y.__experimentalHStack,{children:[(0,oe.jsx)("div",{className:"edit-site-site-hub__title",children:(0,oe.jsxs)(y.Button,{__next40pxDefaultSize:!0,variant:"link",href:s,target:"_blank",children:[(0,Kt.decodeEntities)(i),(0,oe.jsx)(y.VisuallyHidden,{as:"span",children:(0,b.__)("(opens in a new tab)")})]})}),(0,oe.jsx)(y.__experimentalHStack,{spacing:0,expanded:!1,className:"edit-site-site-hub__actions",children:(0,oe.jsx)(y.Button,{size:"compact",className:"edit-site-site-hub_toggle-command-center",icon:Xt,onClick:()=>r(),label:(0,b.__)("Open command palette"),shortcut:Jt.displayShortcut.primary("k")})})]})]})})}))),dn=un,hn=(0,d.memo)((0,d.forwardRef)((({isTransparent:e},t)=>{const{path:n}=ln(),s=cn(),{navigate:i}=(0,d.useContext)(nn),{dashboardLink:r,homeUrl:o,siteTitle:a,isBlockTheme:c,isClassicThemeWithStyleBookSupport:u}=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt)),{getEntityRecord:n,getCurrentTheme:s}=e(_.store),i=n("root","site"),r=s(),o=t(),a=r.theme_supports["editor-styles"],l=o.supportsLayout;return{dashboardLink:o.__experimentalDashboardLink,homeUrl:n("root","__unstableBase")?.home,siteTitle:!i?.title&&i?.url?(0,Qt.filterURLForDisplay)(i?.url):i?.title,isBlockTheme:r?.is_block_theme,isClassicThemeWithStyleBookSupport:!r?.is_block_theme&&(a||l)}}),[]),{open:h}=(0,l.useDispatch)(Wt.store);let p;"/"!==n&&(c||u?p="/":"/pattern"!==n&&(p="/pattern"));const f={href:p?void 0:r,label:p?(0,b.__)("Go to Site Editor"):(0,b.__)("Go to the Dashboard"),onClick:p?()=>{s.navigate(p),i("back")}:void 0};return(0,oe.jsx)("div",{className:"edit-site-site-hub",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,oe.jsx)("div",{className:Ut("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,ref:t,className:"edit-site-layout__view-mode-toggle",style:{transform:"scale(0.5)",borderRadius:4},...f,children:(0,oe.jsx)(en,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,oe.jsxs)(y.__experimentalHStack,{children:[(0,oe.jsx)("div",{className:"edit-site-site-hub__title",children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"link",href:o,target:"_blank",label:(0,b.__)("View site (opens in a new tab)"),children:(0,Kt.decodeEntities)(a)})}),(0,oe.jsx)(y.__experimentalHStack,{spacing:0,expanded:!1,className:"edit-site-site-hub__actions",children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,className:"edit-site-site-hub_toggle-command-center",icon:Xt,onClick:()=>h(),label:(0,b.__)("Open command palette"),shortcut:Jt.displayShortcut.primary("k")})})]})]})})}))),{useLocation:pn,useHistory:fn}=te(Gt.privateApis),mn={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0},gn=320,vn=9/19.5,xn={width:"100%",height:"100%"};function yn(e,t){const n=1-Math.max(0,Math.min(1,(e-gn)/980)),s=((e,t,n)=>e+(t-e)*n)(t,vn,n);return e/s}const bn=function e({isFullWidth:t,isOversized:n,setIsOversized:s,isReady:i,children:r,defaultSize:o,innerContentStyle:a}){const c=fn(),{path:u,query:h}=pn(),{canvas:p="view"}=h,f=(0,v.useReducedMotion)(),[m,g]=(0,d.useState)(xn),[x,w]=(0,d.useState)(),[j,S]=(0,d.useState)(!1),[C,k]=(0,d.useState)(!1),[E,P]=(0,d.useState)(1),I={type:"tween",duration:j?0:.5},T=(0,d.useRef)(null),O=(0,v.useInstanceId)(e,"edit-site-resizable-frame-handle-help"),A=o.width/o.height,N=(0,l.useSelect)((e=>{const{getCurrentTheme:t}=e(_.store);return t()?.is_block_theme}),[]),M={default:{flexGrow:0,height:m.height},fullWidth:{flexGrow:1,height:m.height}},V={hidden:{opacity:0,...(0,b.isRTL)()?{right:0}:{left:0}},visible:{opacity:1,...(0,b.isRTL)()?{right:-14}:{left:-14}},active:{opacity:1,...(0,b.isRTL)()?{right:-14}:{left:-14},scaleY:1.3}},F=j?"active":C?"visible":"hidden";return(0,oe.jsx)(y.ResizableBox,{as:y.__unstableMotion.div,ref:T,initial:!1,variants:M,animate:t?"fullWidth":"default",onAnimationComplete:e=>{"fullWidth"===e&&g({width:"100%",height:"100%"})},whileHover:"view"===p&&N?{scale:1.005,transition:{duration:f?0:.5,ease:"easeOut"}}:{},transition:I,size:m,enable:{top:!1,bottom:!1,...(0,b.isRTL)()?{right:i,left:!1}:{left:i,right:!1},topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},resizeRatio:E,handleClasses:void 0,handleStyles:{left:mn,right:mn},minWidth:gn,maxWidth:t?"100%":"150%",maxHeight:"100%",onFocus:()=>k(!0),onBlur:()=>k(!1),onMouseOver:()=>k(!0),onMouseOut:()=>k(!1),handleComponent:{[(0,b.isRTL)()?"right":"left"]:"view"===p&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Tooltip,{text:(0,b.__)("Drag to resize"),children:(0,oe.jsx)(y.__unstableMotion.button,{role:"separator","aria-orientation":"vertical",className:Ut("edit-site-resizable-frame__handle",{"is-resizing":j}),variants:V,animate:F,"aria-label":(0,b.__)("Drag to resize"),"aria-describedby":O,"aria-valuenow":T.current?.resizable?.offsetWidth||void 0,"aria-valuemin":gn,"aria-valuemax":o.width,onKeyDown:e=>{if(!["ArrowLeft","ArrowRight"].includes(e.key))return;e.preventDefault();const t=20*(e.shiftKey?5:1)*("ArrowLeft"===e.key?1:-1)*((0,b.isRTL)()?-1:1),n=Math.min(Math.max(gn,T.current.resizable.offsetWidth+t),o.width);g({width:n,height:yn(n,A)})},initial:"hidden",exit:"hidden",whileFocus:"active",whileHover:"active"},"handle")}),(0,oe.jsx)("div",{hidden:!0,id:O,children:(0,b.__)("Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.")})]})},onResizeStart:(e,t,n)=>{w(n.offsetWidth),S(!0)},onResize:(e,t,i,r)=>{const a=r.width/E,l=Math.abs(a),c=r.width<0?l:(o.width-x)/2,u=Math.min(l,c),d=0===l?0:u/l;P(1-d+2*d);const h=x+r.width;s(h>o.width),g({height:n?"100%":yn(h,A)})},onResizeStop:(e,t,i)=>{if(S(!1),!n)return;s(!1);i.ownerDocument.documentElement.offsetWidth-i.offsetWidth>200||!N?g(xn):c.navigate((0,Qt.addQueryArgs)(u,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"})},className:Ut("edit-site-resizable-frame__inner",{"is-resizing":j}),showHandle:!1,children:(0,oe.jsx)("div",{className:"edit-site-resizable-frame__inner-content",style:a,children:r})})},wn=window.wp.keyboardShortcuts,_n="core/edit-site/save";function jn(){const{__experimentalGetDirtyEntityRecords:e,isSavingEntityRecord:t}=(0,l.useSelect)(_.store),{hasNonPostEntityChanges:n,isPostSavingLocked:s}=(0,l.useSelect)(h.store),{savePost:i}=(0,l.useDispatch)(h.store),{setIsSaveViewOpened:r}=(0,l.useDispatch)(zt),{registerShortcut:o,unregisterShortcut:a}=(0,l.useDispatch)(wn.store);return(0,d.useEffect)((()=>(o({name:_n,category:"global",description:(0,b.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),()=>{a(_n)})),[o,a]),(0,wn.useShortcut)("core/edit-site/save",(o=>{o.preventDefault();const a=e(),l=!!a.length,c=a.some((e=>t(e.kind,e.name,e.key)));l&&!c&&(n()?r(!0):s()||i())})),null}const Sn=1e4;function Cn(){const[e,t]=(0,d.useState)(!1),n=(0,l.useSelect)((t=>{const n=t(_.store).hasResolvingSelectors();return!e&&!n}),[e]);return(0,d.useEffect)((()=>{let n;return e||(n=setTimeout((()=>{t(!0)}),Sn)),()=>{clearTimeout(n)}}),[e]),(0,d.useEffect)((()=>{if(n){const e=setTimeout((()=>{t(!0)}),100);return()=>{clearTimeout(e)}}}),[n]),!e}var kn=Gn(),En=e=>Bn(e,kn),Pn=Gn();En.write=e=>Bn(e,Pn);var In=Gn();En.onStart=e=>Bn(e,In);var Tn=Gn();En.onFrame=e=>Bn(e,Tn);var On=Gn();En.onFinish=e=>Bn(e,On);var An=[];En.setTimeout=(e,t)=>{let n=En.now()+t,s=()=>{let e=An.findIndex((e=>e.cancel==s));~e&&An.splice(e,1),Fn-=~e?1:0},i={time:n,handler:e,cancel:s};return An.splice(Nn(n),0,i),Fn+=1,Dn(),i};var Nn=e=>~(~An.findIndex((t=>t.time>e))||~An.length);En.cancel=e=>{In.delete(e),Tn.delete(e),On.delete(e),kn.delete(e),Pn.delete(e)},En.sync=e=>{Rn=!0,En.batchedUpdates(e),Rn=!1},En.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function s(...e){t=e,En.onStart(n)}return s.handler=e,s.cancel=()=>{In.delete(n),t=null},s};var Mn=typeof window<"u"?window.requestAnimationFrame:()=>{};En.use=e=>Mn=e,En.now=typeof performance<"u"?()=>performance.now():Date.now,En.batchedUpdates=e=>e(),En.catch=console.error,En.frameLoop="always",En.advance=()=>{"demand"!==En.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):zn()};var Vn=-1,Fn=0,Rn=!1;function Bn(e,t){Rn?(t.delete(e),e(0)):(t.add(e),Dn())}function Dn(){Vn<0&&(Vn=0,"demand"!==En.frameLoop&&Mn(Ln))}function Ln(){~Vn&&(Mn(Ln),En.batchedUpdates(zn))}function zn(){let e=Vn;Vn=En.now();let t=Nn(Vn);t&&(Hn(An.splice(0,t),(e=>e.handler())),Fn-=t),Fn?(In.flush(),kn.flush(e?Math.min(64,Vn-e):16.667),Tn.flush(),Pn.flush(),On.flush()):Vn=-1}function Gn(){let e=new Set,t=e;return{add(n){Fn+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(Fn-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,Fn-=t.size,Hn(t,(t=>t(n)&&e.add(t))),Fn+=e.size,t=e)}}}function Hn(e,t){e.forEach((e=>{try{t(e)}catch(e){En.catch(e)}}))}var Un=i(1609),Wn=i.t(Un,2),qn=Object.defineProperty,Zn={};function Kn(){}((e,t)=>{for(var n in t)qn(e,n,{get:t[n],enumerable:!0})})(Zn,{assign:()=>ls,colors:()=>rs,createStringInterpolator:()=>ts,skipAnimation:()=>os,to:()=>ns,willAdvance:()=>as});var Yn={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function Xn(e,t){if(Yn.arr(e)){if(!Yn.arr(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}var Jn=(e,t)=>e.forEach(t);function Qn(e,t,n){if(Yn.arr(e))for(let s=0;s<e.length;s++)t.call(n,e[s],`${s}`);else for(let s in e)e.hasOwnProperty(s)&&t.call(n,e[s],s)}var $n=e=>Yn.und(e)?[]:Yn.arr(e)?e:[e];function es(e,t){if(e.size){let n=Array.from(e);e.clear(),Jn(n,t)}}var ts,ns,ss=(e,...t)=>es(e,(e=>e(...t))),is=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),rs=null,os=!1,as=Kn,ls=e=>{e.to&&(ns=e.to),e.now&&(En.now=e.now),void 0!==e.colors&&(rs=e.colors),null!=e.skipAnimation&&(os=e.skipAnimation),e.createStringInterpolator&&(ts=e.createStringInterpolator),e.requestAnimationFrame&&En.use(e.requestAnimationFrame),e.batchedUpdates&&(En.batchedUpdates=e.batchedUpdates),e.willAdvance&&(as=e.willAdvance),e.frameLoop&&(En.frameLoop=e.frameLoop)},cs=new Set,us=[],ds=[],hs=0,ps={get idle(){return!cs.size&&!us.length},start(e){hs>e.priority?(cs.add(e),En.onStart(fs)):(ms(e),En(vs))},advance:vs,sort(e){if(hs)En.onFrame((()=>ps.sort(e)));else{let t=us.indexOf(e);~t&&(us.splice(t,1),gs(e))}},clear(){us=[],cs.clear()}};function fs(){cs.forEach(ms),cs.clear(),En(vs)}function ms(e){us.includes(e)||gs(e)}function gs(e){us.splice(function(e,t){let n=e.findIndex(t);return n<0?e.length:n}(us,(t=>t.priority>e.priority)),0,e)}function vs(e){let t=ds;for(let n=0;n<us.length;n++){let s=us[n];hs=s.priority,s.idle||(as(s),s.advance(e),s.idle||t.push(s))}return hs=0,(ds=us).length=0,(us=t).length>0}var xs="[-+]?\\d*\\.?\\d+",ys=xs+"%";function bs(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var ws=new RegExp("rgb"+bs(xs,xs,xs)),_s=new RegExp("rgba"+bs(xs,xs,xs,xs)),js=new RegExp("hsl"+bs(xs,ys,ys)),Ss=new RegExp("hsla"+bs(xs,ys,ys,xs)),Cs=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ks=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Es=/^#([0-9a-fA-F]{6})$/,Ps=/^#([0-9a-fA-F]{8})$/;function Is(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Ts(e,t,n){let s=n<.5?n*(1+t):n+t-n*t,i=2*n-s,r=Is(i,s,e+1/3),o=Is(i,s,e),a=Is(i,s,e-1/3);return Math.round(255*r)<<24|Math.round(255*o)<<16|Math.round(255*a)<<8}function Os(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function As(e){return(parseFloat(e)%360+360)%360/360}function Ns(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function Ms(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function Vs(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=Es.exec(e))?parseInt(t[1]+"ff",16)>>>0:rs&&void 0!==rs[e]?rs[e]:(t=ws.exec(e))?(Os(t[1])<<24|Os(t[2])<<16|Os(t[3])<<8|255)>>>0:(t=_s.exec(e))?(Os(t[1])<<24|Os(t[2])<<16|Os(t[3])<<8|Ns(t[4]))>>>0:(t=Cs.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=Ps.exec(e))?parseInt(t[1],16)>>>0:(t=ks.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=js.exec(e))?(255|Ts(As(t[1]),Ms(t[2]),Ms(t[3])))>>>0:(t=Ss.exec(e))?(Ts(As(t[1]),Ms(t[2]),Ms(t[3]))|Ns(t[4]))>>>0:null}(e);return null===t?e:(t=t||0,`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`)}var Fs=(e,t,n)=>{if(Yn.fun(e))return e;if(Yn.arr(e))return Fs({range:e,output:t,extrapolate:n});if(Yn.str(e.output[0]))return ts(e);let s=e,i=s.output,r=s.range||[0,1],o=s.extrapolateLeft||s.extrapolate||"extend",a=s.extrapolateRight||s.extrapolate||"extend",l=s.easing||(e=>e);return e=>{let t=function(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}(e,r);return function(e,t,n,s,i,r,o,a,l){let c=l?l(e):e;if(c<t){if("identity"===o)return c;"clamp"===o&&(c=t)}if(c>n){if("identity"===a)return c;"clamp"===a&&(c=n)}return s===i?s:t===n?e<=t?s:i:(t===-1/0?c=-c:n===1/0?c-=t:c=(c-t)/(n-t),c=r(c),s===-1/0?c=-c:i===1/0?c+=s:c=c*(i-s)+s,c)}(e,r[t],r[t+1],i[t],i[t+1],l,o,a,s.map)}};var Rs=1.70158,Bs=1.525*Rs,Ds=Rs+1,Ls=2*Math.PI/3,zs=2*Math.PI/4.5,Gs=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Hs={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>0===e?0:Math.pow(2,10*e-10),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>Ds*e*e*e-Rs*e*e,easeOutBack:e=>1+Ds*Math.pow(e-1,3)+Rs*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*(2*(Bs+1)*e-Bs)/2:(Math.pow(2*e-2,2)*((Bs+1)*(2*e-2)+Bs)+2)/2,easeInElastic:e=>0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*Ls),easeOutElastic:e=>0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*Ls)+1,easeInOutElastic:e=>0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*zs)/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*zs)/2+1,easeInBounce:e=>1-Gs(1-e),easeOutBounce:Gs,easeInOutBounce:e=>e<.5?(1-Gs(1-2*e))/2:(1+Gs(2*e-1))/2,steps:(e,t="end")=>n=>{let s=(n="end"===t?Math.min(n,.999):Math.max(n,.001))*e;return((e,t,n)=>Math.min(Math.max(n,e),t))(0,1,("end"===t?Math.floor(s):Math.ceil(s))/e)}},Us=Symbol.for("FluidValue.get"),Ws=Symbol.for("FluidValue.observers"),qs=e=>Boolean(e&&e[Us]),Zs=e=>e&&e[Us]?e[Us]():e,Ks=e=>e[Ws]||null;function Ys(e,t){let n=e[Ws];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}var Xs=class{[Us];[Ws];constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");Js(this,e)}},Js=(e,t)=>ti(e,Us,t);function Qs(e,t){if(e[Us]){let n=e[Ws];n||ti(e,Ws,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function $s(e,t){let n=e[Ws];if(n&&n.has(t)){let s=n.size-1;s?n.delete(t):e[Ws]=null,e.observerRemoved&&e.observerRemoved(s,t)}}var ei,ti=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),ni=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,si=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,ii=new RegExp(`(${ni.source})(%|[a-z]+)`,"i"),ri=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,oi=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,ai=e=>{let[t,n]=li(e);if(!t||is())return e;let s=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(s)return s.trim();if(n&&n.startsWith("--")){return window.getComputedStyle(document.documentElement).getPropertyValue(n)||e}return n&&oi.test(n)?ai(n):n||e},li=e=>{let t=oi.exec(e);if(!t)return[,];let[,n,s]=t;return[n,s]},ci=(e,t,n,s,i)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(s)}, ${i})`,ui=e=>{ei||(ei=rs?new RegExp(`(${Object.keys(rs).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map((e=>Zs(e).replace(oi,ai).replace(si,Vs).replace(ei,Vs))),n=t.map((e=>e.match(ni).map(Number))),s=n[0].map(((e,t)=>n.map((e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})))).map((t=>Fs({...e,output:t})));return e=>{let n=!ii.test(t[0])&&t.find((e=>ii.test(e)))?.replace(ni,""),i=0;return t[0].replace(ni,(()=>`${s[i++](e)}${n||""}`)).replace(ri,ci)}},di="react-spring: ",hi=e=>{let t=e,n=!1;if("function"!=typeof t)throw new TypeError(`${di}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},pi=hi(console.warn);hi(console.warn);function fi(e){return Yn.str(e)&&("#"==e[0]||/\d/.test(e)||!is()&&oi.test(e)||e in(rs||{}))}new WeakMap;new Set,new WeakMap,new WeakMap,new WeakMap;var mi=is()?Un.useEffect:Un.useLayoutEffect;function gi(){let e=(0,Un.useState)()[1],t=(()=>{let e=(0,Un.useRef)(!1);return mi((()=>(e.current=!0,()=>{e.current=!1})),[]),e})();return()=>{t.current&&e(Math.random())}}var vi=[];var xi=Symbol.for("Animated:node"),yi=e=>e&&e[xi],bi=(e,t)=>((e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}))(e,xi,t),wi=e=>e&&e[xi]&&e[xi].getPayload(),_i=class{payload;constructor(){bi(this,this)}getPayload(){return this.payload||[]}},ji=class extends _i{constructor(e){super(),this._value=e,Yn.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(e){return new ji(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Yn.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,Yn.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},Si=class extends ji{_string=null;_toString;constructor(e){super(0),this._toString=Fs({output:[e,e]})}static create(e){return new Si(e)}getValue(){return this._string??(this._string=this._toString(this._value))}setValue(e){if(Yn.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=Fs({output:[this.getValue(),e]})),this._value=0,super.reset()}},Ci={dependencies:null},ki=class extends _i{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return Qn(this.source,((n,s)=>{(e=>!!e&&e[xi]===e)(n)?t[s]=n.getValue(e):qs(n)?t[s]=Zs(n):e||(t[s]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&Jn(this.payload,(e=>e.reset()))}_makePayload(e){if(e){let t=new Set;return Qn(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Ci.dependencies&&qs(e)&&Ci.dependencies.add(e);let t=wi(e);t&&Jn(t,(e=>this.add(e)))}},Ei=class extends ki{constructor(e){super(e)}static create(e){return new Ei(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){let t=this.getPayload();return e.length==t.length?t.map(((t,n)=>t.setValue(e[n]))).some(Boolean):(super.setValue(e.map(Pi)),!0)}};function Pi(e){return(fi(e)?Si:ji).create(e)}function Ii(e){let t=yi(e);return t?t.constructor:Yn.arr(e)?Ei:fi(e)?Si:ji}var Ti=(e,t)=>{let n=!Yn.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,Un.forwardRef)(((s,i)=>{let r=(0,Un.useRef)(null),o=n&&(0,Un.useCallback)((e=>{r.current=function(e,t){return e&&(Yn.fun(e)?e(t):e.current=t),t}(i,e)}),[i]),[a,l]=function(e,t){let n=new Set;return Ci.dependencies=n,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new ki(e),Ci.dependencies=null,[e,n]}(s,t),c=gi(),u=()=>{let e=r.current;n&&!e||!1===(!!e&&t.applyAnimatedValues(e,a.getValue(!0)))&&c()},d=new Oi(u,l),h=(0,Un.useRef)();mi((()=>(h.current=d,Jn(l,(e=>Qs(e,d))),()=>{h.current&&(Jn(h.current.deps,(e=>$s(e,h.current))),En.cancel(h.current.update))}))),(0,Un.useEffect)(u,[]),(e=>{(0,Un.useEffect)(e,vi)})((()=>()=>{let e=h.current;Jn(e.deps,(t=>$s(t,e)))}));let p=t.getComponentProps(a.getValue());return Un.createElement(e,{...p,ref:o})}))},Oi=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&En.write(this.update)}};var Ai=Symbol.for("AnimatedComponent"),Ni=e=>Yn.str(e)?e:e&&Yn.str(e.displayName)?e.displayName:Yn.fun(e)&&e.name||null;function Mi(e,...t){return Yn.fun(e)?e(...t):e}var Vi=(e,t)=>!0===e||!!(t&&e&&(Yn.fun(e)?e(t):$n(e).includes(t))),Fi=(e,t)=>Yn.obj(e)?t&&e[t]:e,Ri=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,Bi=e=>e,Di=(e,t=Bi)=>{let n=Li;e.default&&!0!==e.default&&(e=e.default,n=Object.keys(e));let s={};for(let i of n){let n=t(e[i],i);Yn.und(n)||(s[i]=n)}return s},Li=["config","onProps","onStart","onChange","onPause","onResume","onRest"],zi={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function Gi(e){let t=function(e){let t={},n=0;if(Qn(e,((e,s)=>{zi[s]||(t[s]=e,n++)})),n)return t}(e);if(t){let n={to:t};return Qn(e,((e,s)=>s in t||(n[s]=e))),n}return{...e}}function Hi(e){return e=Zs(e),Yn.arr(e)?e.map(Hi):fi(e)?Zn.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Ui(e){return Yn.fun(e)||Yn.arr(e)&&Yn.obj(e[0])}var Wi={tension:170,friction:26,mass:1,damping:1,easing:Hs.linear,clamp:!1},qi=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,Wi)}};function Zi(e,t){if(Yn.und(t.decay)){let n=!Yn.und(t.tension)||!Yn.und(t.friction);(n||!Yn.und(t.frequency)||!Yn.und(t.damping)||!Yn.und(t.mass))&&(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}var Ki=[],Yi=class{changed=!1;values=Ki;toValues=null;fromValues=Ki;to;from;config=new qi;immediate=!1};function Xi(e,{key:t,props:n,defaultProps:s,state:i,actions:r}){return new Promise(((o,a)=>{let l,c,u=Vi(n.cancel??s?.cancel,t);if(u)p();else{Yn.und(n.pause)||(i.paused=Vi(n.pause,t));let e=s?.pause;!0!==e&&(e=i.paused||Vi(e,t)),l=Mi(n.delay||0,t),e?(i.resumeQueue.add(h),r.pause()):(r.resume(),h())}function d(){i.resumeQueue.add(h),i.timeouts.delete(c),c.cancel(),l=c.time-En.now()}function h(){l>0&&!Zn.skipAnimation?(i.delayed=!0,c=En.setTimeout(p,l),i.pauseQueue.add(d),i.timeouts.add(c)):p()}function p(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(d),i.timeouts.delete(c),e<=(i.cancelId||0)&&(u=!0);try{r.start({...n,callId:e,cancel:u},o)}catch(e){a(e)}}}))}var Ji=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?er(e.get()):t.every((e=>e.noop))?Qi(e.get()):$i(e.get(),t.every((e=>e.finished))),Qi=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),$i=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),er=e=>({value:e,cancelled:!0,finished:!1});function tr(e,t,n,s){let{callId:i,parentId:r,onRest:o}=t,{asyncTo:a,promise:l}=n;return r||e!==a||t.reset?n.promise=(async()=>{n.asyncId=i,n.asyncTo=e;let c,u,d,h=Di(t,((e,t)=>"onRest"===t?void 0:e)),p=new Promise(((e,t)=>(c=e,u=t))),f=e=>{let t=i<=(n.cancelId||0)&&er(s)||i!==n.asyncId&&$i(s,!1);if(t)throw e.result=t,u(e),e},m=(e,t)=>{let r=new sr,o=new ir;return(async()=>{if(Zn.skipAnimation)throw nr(n),o.result=$i(s,!1),u(o),o;f(r);let a=Yn.obj(e)?{...e}:{...t,to:e};a.parentId=i,Qn(h,((e,t)=>{Yn.und(a[t])&&(a[t]=e)}));let l=await s.start(a);return f(r),n.paused&&await new Promise((e=>{n.resumeQueue.add(e)})),l})()};if(Zn.skipAnimation)return nr(n),$i(s,!1);try{let t;t=Yn.arr(e)?(async e=>{for(let t of e)await m(t)})(e):Promise.resolve(e(m,s.stop.bind(s))),await Promise.all([t.then(c),p]),d=$i(s.get(),!0,!1)}catch(e){if(e instanceof sr)d=e.result;else{if(!(e instanceof ir))throw e;d=e.result}}finally{i==n.asyncId&&(n.asyncId=r,n.asyncTo=r?a:void 0,n.promise=r?l:void 0)}return Yn.fun(o)&&En.batchedUpdates((()=>{o(d,s,s.item)})),d})():l}function nr(e,t){es(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var sr=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},ir=class extends Error{result;constructor(){super("SkipAnimationSignal")}},rr=e=>e instanceof ar,or=1,ar=class extends Xs{id=or++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=yi(this);return e&&e.getValue()}to(...e){return Zn.to(this,e)}interpolate(...e){return pi(`${di}The "interpolate" function is deprecated in v9 (use "to" instead)`),Zn.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){Ys(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||ps.sort(this),Ys(this,{type:"priority",parent:this,priority:e})}},lr=Symbol.for("SpringPhase"),cr=e=>(1&e[lr])>0,ur=e=>(2&e[lr])>0,dr=e=>(4&e[lr])>0,hr=(e,t)=>t?e[lr]|=3:e[lr]&=-3,pr=(e,t)=>t?e[lr]|=4:e[lr]&=-5,fr=class extends ar{key;animation=new Yi;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,t){if(super(),!Yn.und(e)||!Yn.und(t)){let n=Yn.obj(e)?{...e}:{...t,from:e};Yn.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(ur(this)||this._state.asyncTo)||dr(this)}get goal(){return Zs(this.animation.to)}get velocity(){let e=yi(this);return e instanceof ji?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return cr(this)}get isAnimating(){return ur(this)}get isPaused(){return dr(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1,s=this.animation,{config:i,toValues:r}=s,o=wi(s.to);!o&&qs(s.to)&&(r=$n(Zs(s.to))),s.values.forEach(((a,l)=>{if(a.done)return;let c=a.constructor==Si?1:o?o[l].lastPosition:r[l],u=s.immediate,d=c;if(!u){if(d=a.lastPosition,i.tension<=0)return void(a.done=!0);let t,n=a.elapsedTime+=e,r=s.fromValues[l],o=null!=a.v0?a.v0:a.v0=Yn.arr(i.velocity)?i.velocity[l]:i.velocity,h=i.precision||(r==c?.005:Math.min(1,.001*Math.abs(c-r)));if(Yn.und(i.duration))if(i.decay){let e=!0===i.decay?.998:i.decay,s=Math.exp(-(1-e)*n);d=r+o/(1-e)*(1-s),u=Math.abs(a.lastPosition-d)<=h,t=o*s}else{t=null==a.lastVelocity?o:a.lastVelocity;let n,s=i.restVelocity||h/10,l=i.clamp?0:i.bounce,p=!Yn.und(l),f=r==c?a.v0>0:r<c,m=!1,g=1,v=Math.ceil(e/g);for(let e=0;e<v&&(n=Math.abs(t)>s,n||(u=Math.abs(c-d)<=h,!u));++e){p&&(m=d==c||d>c==f,m&&(t=-t*l,d=c)),t+=(1e-6*-i.tension*(d-c)+.001*-i.friction*t)/i.mass*g,d+=t*g}}else{let s=1;i.duration>0&&(this._memoizedDuration!==i.duration&&(this._memoizedDuration=i.duration,a.durationProgress>0&&(a.elapsedTime=i.duration*a.durationProgress,n=a.elapsedTime+=e)),s=(i.progress||0)+n/this._memoizedDuration,s=s>1?1:s<0?0:s,a.durationProgress=s),d=r+i.easing(s)*(c-r),t=(d-a.lastPosition)/e,u=1==s}a.lastVelocity=t,Number.isNaN(d)&&(console.warn("Got NaN while animating:",this),u=!0)}o&&!o[l].done&&(u=!1),u?a.done=!0:t=!1,a.setValue(d,i.round)&&(n=!0)}));let a=yi(this),l=a.getValue();if(t){let e=Zs(s.to);l===e&&!n||i.decay?n&&i.decay&&this._onChange(l):(a.setValue(e),this._onChange(e)),this._stop()}else n&&this._onChange(l)}set(e){return En.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(ur(this)){let{to:e,config:t}=this.animation;En.batchedUpdates((()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()}))}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return Yn.und(e)?(n=this.queue||[],this.queue=[]):n=[Yn.obj(e)?e:{...t,to:e}],Promise.all(n.map((e=>this._update(e)))).then((e=>Ji(this,e)))}stop(e){let{to:t}=this.animation;return this._focus(this.get()),nr(this._state,e&&this._lastCallId),En.batchedUpdates((()=>this._stop(t,e))),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||"",{to:n,from:s}=e;n=Yn.obj(n)?n[t]:n,(null==n||Ui(n))&&(n=void 0),s=Yn.obj(s)?s[t]:s,null==s&&(s=void 0);let i={to:n,from:s};return cr(this)||(e.reverse&&([n,s]=[s,n]),s=Zs(s),Yn.und(s)?yi(this)||this._set(n):this._set(s)),i}_update({...e},t){let{key:n,defaultProps:s}=this;e.default&&Object.assign(s,Di(e,((e,t)=>/^on/.test(t)?Fi(e,n):e))),br(this,e,"onProps"),wr(this,"onProps",e,this);let i=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let r=this._state;return Xi(++this._lastCallId,{key:n,props:e,defaultProps:s,state:r,actions:{pause:()=>{dr(this)||(pr(this,!0),ss(r.pauseQueue),wr(this,"onPause",$i(this,mr(this,this.animation.to)),this))},resume:()=>{dr(this)&&(pr(this,!1),ur(this)&&this._resume(),ss(r.resumeQueue),wr(this,"onResume",$i(this,mr(this,this.animation.to)),this))},start:this._merge.bind(this,i)}}).then((n=>{if(e.loop&&n.finished&&(!t||!n.noop)){let t=gr(e);if(t)return this._update(t,!0)}return n}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(er(this));let s=!Yn.und(e.to),i=!Yn.und(e.from);if(s||i){if(!(t.callId>this._lastToId))return n(er(this));this._lastToId=t.callId}let{key:r,defaultProps:o,animation:a}=this,{to:l,from:c}=a,{to:u=l,from:d=c}=e;i&&!s&&(!t.default||Yn.und(u))&&(u=d),t.reverse&&([u,d]=[d,u]);let h=!Xn(d,c);h&&(a.from=d),d=Zs(d);let p=!Xn(u,l);p&&this._focus(u);let f=Ui(t.to),{config:m}=a,{decay:g,velocity:v}=m;(s||i)&&(m.velocity=0),t.config&&!f&&function(e,t,n){n&&(Zi(n={...n},t),t={...n,...t}),Zi(e,t),Object.assign(e,t);for(let t in Wi)null==e[t]&&(e[t]=Wi[t]);let{mass:s,frequency:i,damping:r}=e;Yn.und(i)||(i<.01&&(i=.01),r<0&&(r=0),e.tension=Math.pow(2*Math.PI/i,2)*s,e.friction=4*Math.PI*r*s/i)}(m,Mi(t.config,r),t.config!==o.config?Mi(o.config,r):void 0);let x=yi(this);if(!x||Yn.und(u))return n($i(this,!0));let y=Yn.und(t.reset)?i&&!t.default:!Yn.und(d)&&Vi(t.reset,r),b=y?d:this.get(),w=Hi(u),_=Yn.num(w)||Yn.arr(w)||fi(w),j=!f&&(!_||Vi(o.immediate||t.immediate,r));if(p){let e=Ii(u);if(e!==x.constructor){if(!j)throw Error(`Cannot animate between ${x.constructor.name} and ${e.name}, as the "to" prop suggests`);x=this._set(w)}}let S=x.constructor,C=qs(u),k=!1;if(!C){let e=y||!cr(this)&&h;(p||e)&&(k=Xn(Hi(b),w),C=!k),(!Xn(a.immediate,j)&&!j||!Xn(m.decay,g)||!Xn(m.velocity,v))&&(C=!0)}if(k&&ur(this)&&(a.changed&&!y?C=!0:C||this._stop(l)),!f&&((C||qs(l))&&(a.values=x.getPayload(),a.toValues=qs(u)?null:S==Si?[1]:$n(w)),a.immediate!=j&&(a.immediate=j,!j&&!y&&this._set(l)),C)){let{onRest:e}=a;Jn(yr,(e=>br(this,t,e)));let s=$i(this,mr(this,l));ss(this._pendingCalls,s),this._pendingCalls.add(n),a.changed&&En.batchedUpdates((()=>{a.changed=!y,e?.(s,this),y?Mi(o.onRest,s):a.onStart?.(s,this)}))}y&&this._set(b),f?n(tr(t.to,t,this._state,this)):C?this._start():ur(this)&&!p?this._pendingCalls.add(n):n(Qi(b))}_focus(e){let t=this.animation;e!==t.to&&(Ks(this)&&this._detach(),t.to=e,Ks(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;qs(t)&&(Qs(t,this),rr(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;qs(e)&&$s(e,this)}_set(e,t=!0){let n=Zs(e);if(!Yn.und(n)){let e=yi(this);if(!e||!Xn(n,e.getValue())){let s=Ii(n);e&&e.constructor==s?e.setValue(n):bi(this,s.create(n)),e&&En.batchedUpdates((()=>{this._onChange(n,t)}))}}return yi(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,wr(this,"onStart",$i(this,mr(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Mi(this.animation.onChange,e,this)),Mi(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){let e=this.animation;yi(this).reset(Zs(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),ur(this)||(hr(this,!0),dr(this)||this._resume())}_resume(){Zn.skipAnimation?this.finish():ps.start(this)}_stop(e,t){if(ur(this)){hr(this,!1);let n=this.animation;Jn(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Ys(this,{type:"idle",parent:this});let s=t?er(this.get()):$i(this.get(),mr(this,e??n.to));ss(this._pendingCalls,s),n.changed&&(n.changed=!1,wr(this,"onRest",s,this))}}};function mr(e,t){let n=Hi(t);return Xn(Hi(e.get()),n)}function gr(e,t=e.loop,n=e.to){let s=Mi(t);if(s){let i=!0!==s&&Gi(s),r=(i||e).reverse,o=!i||i.reset;return vr({...e,loop:t,default:!1,pause:void 0,to:!r||Ui(n)?n:void 0,from:o?e.from:void 0,reset:o,...i})}}function vr(e){let{to:t,from:n}=e=Gi(e),s=new Set;return Yn.obj(t)&&xr(t,s),Yn.obj(n)&&xr(n,s),e.keys=s.size?Array.from(s):null,e}function xr(e,t){Qn(e,((e,n)=>null!=e&&t.add(n)))}var yr=["onStart","onRest","onChange","onPause","onResume"];function br(e,t,n){e.animation[n]=t[n]!==Ri(t,n)?Fi(t[n],e.key):void 0}function wr(e,t,...n){e.animation[t]?.(...n),e.defaultProps[t]?.(...n)}var _r=["onStart","onChange","onRest"],jr=1,Sr=class{id=jr++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,t){this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle&&!e.isDelayed&&!e.isPaused))}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each(((t,n)=>e[n]=t.get())),e}set(e){for(let t in e){let n=e[t];Yn.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(vr(e)),this}start(e){let{queue:t}=this;return e?t=$n(e).map(vr):this.queue=[],this._flush?this._flush(this,t):(Ir(this,t),Cr(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){let n=this.springs;Jn($n(t),(t=>n[t].stop(!!e)))}else nr(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(Yn.und(e))this.start({pause:!0});else{let t=this.springs;Jn($n(e),(e=>t[e].pause()))}return this}resume(e){if(Yn.und(e))this.start({pause:!1});else{let t=this.springs;Jn($n(e),(e=>t[e].resume()))}return this}each(e){Qn(this.springs,e)}_onFrame(){let{onStart:e,onChange:t,onRest:n}=this._events,s=this._active.size>0,i=this._changed.size>0;(s&&!this._started||i&&!this._started)&&(this._started=!0,es(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));let r=!s&&this._started,o=i||r&&n.size?this.get():null;i&&t.size&&es(t,(([e,t])=>{t.value=o,e(t,this,this._item)})),r&&(this._started=!1,es(n,(([e,t])=>{t.value=o,e(t,this,this._item)})))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}En.onFrame(this._onFrame)}};function Cr(e,t){return Promise.all(t.map((t=>kr(e,t)))).then((t=>Ji(e,t)))}async function kr(e,t,n){let{keys:s,to:i,from:r,loop:o,onRest:a,onResolve:l}=t,c=Yn.obj(t.default)&&t.default;o&&(t.loop=!1),!1===i&&(t.to=null),!1===r&&(t.from=null);let u=Yn.arr(i)||Yn.fun(i)?i:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):Jn(_r,(n=>{let s=t[n];if(Yn.fun(s)){let i=e._events[n];t[n]=({finished:e,cancelled:t})=>{let n=i.get(s);n?(e||(n.finished=!1),t&&(n.cancelled=!0)):i.set(s,{value:null,finished:e||!1,cancelled:t||!1})},c&&(c[n]=t[n])}}));let d=e._state;t.pause===!d.paused?(d.paused=t.pause,ss(t.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(t.pause=!0);let h=(s||Object.keys(e.springs)).map((n=>e.springs[n].start(t))),p=!0===t.cancel||!0===Ri(t,"cancel");(u||p&&d.asyncId)&&h.push(Xi(++e._lastAsyncId,{props:t,state:d,actions:{pause:Kn,resume:Kn,start(t,n){p?(nr(d,e._lastAsyncId),n(er(e))):(t.onRest=a,n(tr(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));let f=Ji(e,await Promise.all(h));if(o&&f.finished&&(!n||!f.noop)){let n=gr(t,o,i);if(n)return Ir(e,[n]),kr(e,n,!0)}return l&&En.batchedUpdates((()=>l(f,e,e.item))),f}function Er(e,t){let n=new fr;return n.key=e,t&&Qs(n,t),n}function Pr(e,t,n){t.keys&&Jn(t.keys,(s=>{(e[s]||(e[s]=n(s)))._prepareNode(t)}))}function Ir(e,t){Jn(t,(t=>{Pr(e.springs,t,(t=>Er(t,e)))}))}var Tr=({children:e,...t})=>{let n=(0,Un.useContext)(Or),s=t.pause||!!n.pause,i=t.immediate||!!n.immediate;t=function(e,t){let[n]=(0,Un.useState)((()=>({inputs:t,result:e()}))),s=(0,Un.useRef)(),i=s.current,r=i;return r?Boolean(t&&r.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(t,r.inputs))||(r={inputs:t,result:e()}):r=n,(0,Un.useEffect)((()=>{s.current=r,i==n&&(n.inputs=n.result=void 0)}),[r]),r.result}((()=>({pause:s,immediate:i})),[s,i]);let{Provider:r}=Or;return Un.createElement(r,{value:t},e)},Or=function(e,t){return Object.assign(e,Un.createContext(t)),e.Provider._context=e,e.Consumer._context=e,e}(Tr,{});Tr.Provider=Or.Provider,Tr.Consumer=Or.Consumer;var Ar=class extends ar{constructor(e,t){super(),this.source=e,this.calc=Fs(...t);let n=this._get(),s=Ii(n);bi(this,s.create(n))}key;idle=!0;calc;_active=new Set;advance(e){let t=this._get();Xn(t,this.get())||(yi(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Mr(this._active)&&Vr(this)}_get(){let e=Yn.arr(this.source)?this.source.map(Zs):$n(Zs(this.source));return this.calc(...e)}_start(){this.idle&&!Mr(this._active)&&(this.idle=!1,Jn(wi(this),(e=>{e.done=!1})),Zn.skipAnimation?(En.batchedUpdates((()=>this.advance())),Vr(this)):ps.start(this))}_attach(){let e=1;Jn($n(this.source),(t=>{qs(t)&&Qs(t,this),rr(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){Jn($n(this.source),(e=>{qs(e)&&$s(e,this)})),this._active.clear(),Vr(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=$n(this.source).reduce(((e,t)=>Math.max(e,(rr(t)?t.priority:0)+1)),0))}};function Nr(e){return!1!==e.idle}function Mr(e){return!e.size||Array.from(e).every(Nr)}function Vr(e){e.idle||(e.idle=!0,Jn(wi(e),(e=>{e.done=!0})),Ys(e,{type:"idle",parent:e}))}Zn.assign({createStringInterpolator:ui,to:(e,t)=>new Ar(e,t)});ps.advance;const Fr=window.ReactDOM;var Rr=/^--/;function Br(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||Rr.test(e)||Lr.hasOwnProperty(e)&&Lr[e]?(""+t).trim():t+"px"}var Dr={};var Lr={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},zr=["Webkit","Ms","Moz","O"];Lr=Object.keys(Lr).reduce(((e,t)=>(zr.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),Lr);var Gr=/^(matrix|translate|scale|rotate|skew)/,Hr=/^(translate)/,Ur=/^(rotate|skew)/,Wr=(e,t)=>Yn.num(e)&&0!==e?e+t:e,qr=(e,t)=>Yn.arr(e)?e.every((e=>qr(e,t))):Yn.num(e)?e===t:parseFloat(e)===t,Zr=class extends ki{constructor({x:e,y:t,z:n,...s}){let i=[],r=[];(e||t||n)&&(i.push([e||0,t||0,n||0]),r.push((e=>[`translate3d(${e.map((e=>Wr(e,"px"))).join(",")})`,qr(e,0)]))),Qn(s,((e,t)=>{if("transform"===t)i.push([e||""]),r.push((e=>[e,""===e]));else if(Gr.test(t)){if(delete s[t],Yn.und(e))return;let n=Hr.test(t)?"px":Ur.test(t)?"deg":"";i.push($n(e)),r.push("rotate3d"===t?([e,t,s,i])=>[`rotate3d(${e},${t},${s},${Wr(i,n)})`,qr(i,0)]:e=>[`${t}(${e.map((e=>Wr(e,n))).join(",")})`,qr(e,t.startsWith("scale")?1:0)])}})),i.length&&(s.transform=new Kr(i,r)),super(s)}},Kr=class extends Xs{constructor(e,t){super(),this.inputs=e,this.transforms=t}_value=null;get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return Jn(this.inputs,((n,s)=>{let i=Zs(n[0]),[r,o]=this.transforms[s](Yn.arr(i)?i:n.map(Zs));e+=" "+r,t=t&&o})),t?"none":e}observerAdded(e){1==e&&Jn(this.inputs,(e=>Jn(e,(e=>qs(e)&&Qs(e,this)))))}observerRemoved(e){0==e&&Jn(this.inputs,(e=>Jn(e,(e=>qs(e)&&$s(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),Ys(this,e)}};Zn.assign({batchedUpdates:Fr.unstable_batchedUpdates,createStringInterpolator:ui,colors:{transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199}});var Yr=((e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:n=e=>new ki(e),getComponentProps:s=e=>e}={})=>{let i={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:s},r=e=>{let t=Ni(e)||"Anonymous";return(e=Yn.str(e)?r[e]||(r[e]=Ti(e,i)):e[Ai]||(e[Ai]=Ti(e,i))).displayName=`Animated(${t})`,e};return Qn(e,((t,n)=>{Yn.arr(e)&&(n=Ni(t)),r[n]=r(t)})),{animated:r}})(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],{applyAnimatedValues:function(e,t){if(!e.nodeType||!e.setAttribute)return!1;let n="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,{style:s,children:i,scrollTop:r,scrollLeft:o,viewBox:a,...l}=t,c=Object.values(l),u=Object.keys(l).map((t=>n||e.hasAttribute(t)?t:Dr[t]||(Dr[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==i&&(e.textContent=i);for(let t in s)if(s.hasOwnProperty(t)){let n=Br(t,s[t]);Rr.test(t)?e.style.setProperty(t,n):e.style[t]=n}u.forEach(((t,n)=>{e.setAttribute(t,c[n])})),void 0!==r&&(e.scrollTop=r),void 0!==o&&(e.scrollLeft=o),void 0!==a&&e.setAttribute("viewBox",a)},createAnimatedStyle:e=>new Zr(e),getComponentProps:({scrollTop:e,scrollLeft:t,...n})=>n});Yr.animated;const Xr=function({triggerAnimationOnChange:e}){const t=(0,d.useRef)(),{previous:n,prevRect:s}=(0,d.useMemo)((()=>{return{previous:t.current&&(e=t.current,{top:e.offsetTop,left:e.offsetLeft}),prevRect:t.current&&t.current.getBoundingClientRect()};var e}),[e]);return(0,d.useLayoutEffect)((()=>{if(!n||!t.current)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const e=new Sr({x:0,y:0,width:s.width,height:s.height,config:{duration:400,easing:Hs.easeInOutQuint},onChange({value:e}){if(!t.current)return;let{x:n,y:s,width:i,height:r}=e;n=Math.round(n),s=Math.round(s),i=Math.round(i),r=Math.round(r);const o=0===n&&0===s;t.current.style.transformOrigin="center center",t.current.style.transform=o?null:`translate3d(${n}px,${s}px,0)`,t.current.style.width=o?null:`${i}px`,t.current.style.height=o?null:`${r}px`}});t.current.style.transform=void 0;const i=t.current.getBoundingClientRect(),r=Math.round(s.left-i.left),o=Math.round(s.top-i.top),a=i.width,l=i.height;return e.start({x:0,y:0,width:a,height:l,from:{x:r,y:o,width:s.width,height:s.height}}),()=>{e.stop(),e.set({x:0,y:0,width:s.width,height:s.height})}}),[n,s]),t},Jr=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})});function Qr(){return!!(0,Qt.getQueryArg)(window.location.href,"wp_theme_preview")}function $r(){return Qr()?(0,Qt.getQueryArg)(window.location.href,"wp_theme_preview"):null}const{useLocation:eo}=te(Gt.privateApis);function to({className:e="edit-site-save-button__button",variant:t="primary",showTooltip:n=!0,showReviewMessage:s,icon:i,size:r,__next40pxDefaultSize:o=!1}){const{params:a}=eo(),{setIsSaveViewOpened:c}=(0,l.useDispatch)(zt),{saveDirtyEntities:u}=te((0,l.useDispatch)(h.store)),{dirtyEntityRecords:d}=(0,h.useEntitiesSavedStatesIsDirty)(),{isSaving:p,isSaveViewOpen:f,previewingThemeName:m}=(0,l.useSelect)((e=>{const{isSavingEntityRecord:t,isResolving:n}=e(_.store),{isSaveViewOpened:s}=e(zt),i=n("activateTheme"),r=$r();return{isSaving:d.some((e=>t(e.kind,e.name,e.key)))||i,isSaveViewOpen:s(),previewingThemeName:r?e(_.store).getTheme(r)?.name?.rendered:void 0}}),[d]),g=!!d.length;let v;1===d.length&&(a.postId?v=`${d[0].key}`===a.postId&&d[0].name===a.postType:a.path?.includes("wp_global_styles")&&(v="globalStyles"===d[0].name));const x=p||!g&&!Qr(),w=Qr()?p?(0,b.sprintf)((0,b.__)("Activating %s"),m):x?(0,b.__)("Saved"):g?(0,b.sprintf)((0,b.__)("Activate %s & Save"),m):(0,b.sprintf)((0,b.__)("Activate %s"),m):p?(0,b.__)("Saving"):x?(0,b.__)("Saved"):!v&&s?(0,b.sprintf)((0,b._n)("Review %d change…","Review %d changes…",d.length),d.length):(0,b.__)("Save"),j=v?()=>u({dirtyEntityRecords:d}):()=>c(!0);return(0,oe.jsx)(y.Button,{variant:t,className:e,"aria-disabled":x,"aria-expanded":f,isBusy:p,onClick:x?void 0:j,label:w,shortcut:x?void 0:Jt.displayShortcut.primary("s"),showTooltip:n,icon:i,__next40pxDefaultSize:o,size:r,children:w})}function no(){const{isDisabled:e,isSaving:t}=(0,l.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n}=e(_.store),s=t(),i=s.some((e=>n(e.kind,e.name,e.key)));return{isSaving:i,isDisabled:i||!s.length&&!Qr()}}),[]);return(0,oe.jsx)(y.__experimentalHStack,{className:"edit-site-save-hub",alignment:"right",spacing:4,children:(0,oe.jsx)(to,{className:"edit-site-save-hub__button",variant:e?null:"primary",showTooltip:!1,icon:e&&!t?Jr:null,showReviewMessage:!0,__next40pxDefaultSize:!0})})}const{useHistory:so,useLocation:io}=te(Gt.privateApis);const ro=window.wp.apiFetch;var oo=i.n(ro);const{EntitiesSavedStatesExtensible:ao,NavigableRegion:lo}=te(h.privateApis),{useLocation:co}=te(Gt.privateApis),uo=({onClose:e,renderDialog:t,variant:n})=>{var s,i;const r=(0,h.useEntitiesSavedStatesIsDirty)();let o;o=r.isDirty?(0,b.__)("Activate & Save"):(0,b.__)("Activate");const a=function(){const[e,t]=(0,d.useState)();return(0,d.useEffect)((()=>{const e=(0,Qt.addQueryArgs)("/wp/v2/themes?status=active",{context:"edit",wp_theme_preview:""});oo()({path:e}).then((e=>t(e[0]))).catch((()=>{}))}),[]),e}(),c=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()),[]),u=(0,oe.jsx)("p",{children:(0,b.sprintf)((0,b.__)("Saving your changes will change your active theme from %1$s to %2$s."),null!==(s=a?.name?.rendered)&&void 0!==s?s:"...",null!==(i=c?.name?.rendered)&&void 0!==i?i:"...")}),p=function(){const e=so(),{path:t}=io(),{startResolution:n,finishResolution:s}=(0,l.useDispatch)(_.store);return async()=>{if(Qr()){const i="themes.php?action=activate&stylesheet="+$r()+"&_wpnonce="+window.WP_BLOCK_THEME_ACTIVATE_NONCE;n("activateTheme"),await window.fetch(i),s("activateTheme"),e.navigate((0,Qt.addQueryArgs)(t,{wp_theme_preview:""}))}}}();return(0,oe.jsx)(ao,{...r,additionalPrompt:u,close:e,onSave:async e=>(await p(),e),saveEnabled:!0,saveLabel:o,renderDialog:t,variant:n})},ho=({onClose:e,renderDialog:t,variant:n})=>Qr()?(0,oe.jsx)(uo,{onClose:e,renderDialog:t,variant:n}):(0,oe.jsx)(h.EntitiesSavedStates,{close:e,renderDialog:t,variant:n});function po(){const{query:e}=co(),{canvas:t="view"}=e,{isSaveViewOpen:n,isDirty:s,isSaving:i}=(0,l.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n,isResolving:s}=e(_.store),i=t(),r=s("activateTheme"),{isSaveViewOpened:o}=te(e(zt));return{isSaveViewOpen:o(),isDirty:i.length>0,isSaving:i.some((e=>n(e.kind,e.name,e.key)))||r}}),[]),{setIsSaveViewOpened:r}=(0,l.useDispatch)(zt),o=()=>r(!1);if((0,d.useEffect)((()=>{r(!1)}),[t,r]),"view"===t)return n?(0,oe.jsx)(y.Modal,{className:"edit-site-save-panel__modal",onRequestClose:o,title:(0,b.__)("Review changes"),size:"small",children:(0,oe.jsx)(ho,{onClose:o,variant:"inline"})}):null;const a=Qr()||s,c=i||!a;return(0,oe.jsxs)(lo,{className:Ut("edit-site-layout__actions",{"is-entity-save-view-open":n}),ariaLabel:(0,b.__)("Save panel"),children:[(0,oe.jsx)("div",{className:Ut("edit-site-editor__toggle-save-panel",{"screen-reader-text":n}),children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"secondary",className:"edit-site-editor__toggle-save-panel-button",onClick:()=>r(!0),"aria-haspopup":"dialog",disabled:c,accessibleWhenDisabled:!0,children:(0,b.__)("Open save panel")})}),n&&(0,oe.jsx)(ho,{onClose:o,renderDialog:!0})]})}const{useCommands:fo}=te(qt.privateApis),{useGlobalStyle:mo}=te(x.privateApis),{NavigableRegion:go,GlobalStylesProvider:vo}=te(h.privateApis),{useLocation:xo}=te(Gt.privateApis),yo=.3;function bo(){const{query:e,name:t,areas:n,widths:s}=xo(),{canvas:i="view"}=e;fo();const r=(0,v.useViewportMatch)("medium","<"),o=(0,d.useRef)(),a=(0,y.__unstableUseNavigateRegions)(),c=(0,v.useReducedMotion)(),[u,p]=(0,v.useResizeObserver)(),m=Cn(),[g,x]=(0,d.useState)(!1),w=Xr({triggerAnimationOnChange:t+"-"+i}),{showIconLabels:_}=(0,l.useSelect)((e=>({showIconLabels:e(f.store).get("core","showIconLabels")}))),[j]=mo("color.background"),[S]=mo("color.gradient"),C=(0,v.usePrevious)(i);return(0,d.useEffect)((()=>{"edit"===C&&o.current?.focus()}),[i]),(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(h.UnsavedChangesWarning,{}),(0,oe.jsx)(Wt.CommandMenu,{}),"view"===i&&(0,oe.jsx)(jn,{}),(0,oe.jsx)("div",{...a,ref:a.ref,className:Ut("edit-site-layout",a.className,{"is-full-canvas":"edit"===i,"show-icon-labels":_}),children:(0,oe.jsxs)("div",{className:"edit-site-layout__content",children:[(!r||!n.mobile)&&(0,oe.jsx)(go,{ariaLabel:(0,b.__)("Navigation"),className:"edit-site-layout__sidebar-region",children:(0,oe.jsx)(y.__unstableAnimatePresence,{children:"view"===i&&(0,oe.jsxs)(y.__unstableMotion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{type:"tween",duration:c||r?0:yo,ease:"easeOut"},className:"edit-site-layout__sidebar",children:[(0,oe.jsx)(dn,{ref:o,isTransparent:g}),(0,oe.jsx)(on,{children:(0,oe.jsx)(an,{shouldAnimate:"styles"!==t,routeKey:t,children:(0,oe.jsx)(h.ErrorBoundary,{children:n.sidebar})})}),(0,oe.jsx)(no,{}),(0,oe.jsx)(po,{})]})})}),(0,oe.jsx)(h.EditorSnackbars,{}),r&&n.mobile&&(0,oe.jsx)("div",{className:"edit-site-layout__mobile",children:(0,oe.jsx)(on,{children:"edit"!==i?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(hn,{ref:o,isTransparent:g}),(0,oe.jsx)(an,{routeKey:t,children:(0,oe.jsx)(h.ErrorBoundary,{children:n.mobile})}),(0,oe.jsx)(no,{}),(0,oe.jsx)(po,{})]}):(0,oe.jsx)(h.ErrorBoundary,{children:n.mobile})})}),!r&&n.content&&"edit"!==i&&(0,oe.jsx)("div",{className:"edit-site-layout__area",style:{maxWidth:s?.content},children:(0,oe.jsx)(h.ErrorBoundary,{children:n.content})}),!r&&n.edit&&"edit"!==i&&(0,oe.jsx)("div",{className:"edit-site-layout__area",style:{maxWidth:s?.edit},children:(0,oe.jsx)(h.ErrorBoundary,{children:n.edit})}),!r&&n.preview&&(0,oe.jsxs)("div",{className:"edit-site-layout__canvas-container",children:[u,!!p.width&&(0,oe.jsx)("div",{className:Ut("edit-site-layout__canvas",{"is-right-aligned":g}),ref:w,children:(0,oe.jsx)(h.ErrorBoundary,{children:(0,oe.jsx)(bn,{isReady:!m,isFullWidth:"edit"===i,defaultSize:{width:p.width-24,height:p.height},isOversized:g,setIsOversized:x,innerContentStyle:{background:null!=S?S:j},children:n.preview})})})]})]})})]})}function wo(e){const{createErrorNotice:t}=(0,l.useDispatch)(w.store);return(0,oe.jsx)(y.SlotFillProvider,{children:(0,oe.jsxs)(vo,{children:[(0,oe.jsx)(Zt.PluginArea,{onError:function(e){t((0,b.sprintf)((0,b.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,oe.jsx)(bo,{...e})]})})}const _o=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"})}),jo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"})}),So=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z"})}),Co=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z"})}),ko=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"})}),Eo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"})}),Po=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})}),{useGlobalStylesReset:Io}=te(x.privateApis),{useHistory:To,useLocation:Oo}=te(Gt.privateApis),Ao=()=>function(){const{openGeneralSidebar:e}=te((0,l.useDispatch)(zt)),{params:t}=Oo(),{canvas:n="view"}=t,s=To(),i=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>i?[{name:"core/edit-site/open-styles",label:(0,b.__)("Open styles"),callback:({close:t})=>{t(),"edit"!==n&&s.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles")},icon:_o}]:[]),[s,e,n,i])}},No=()=>function(){const{openGeneralSidebar:e}=te((0,l.useDispatch)(zt)),{params:t}=Oo(),{canvas:n="view"}=t,{set:s}=(0,l.useDispatch)(f.store),i=To(),r=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/toggle-styles-welcome-guide",label:(0,b.__)("Learn about styles"),callback:({close:t})=>{t(),"edit"!==n&&i.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles"),s("core/edit-site","welcomeGuideStyles",!0),setTimeout((()=>{s("core/edit-site","welcomeGuideStyles",!0)}),500)},icon:jo}]:[]),[i,e,n,r,s])}},Mo=()=>function(){const[e,t]=Io();return{isLoading:!1,commands:(0,d.useMemo)((()=>e?[{name:"core/edit-site/reset-global-styles",label:(0,b.__)("Reset styles"),icon:(0,b.isRTL)()?So:Co,callback:({close:e})=>{e(),t()}}]:[]),[e,t])}},Vo=()=>function(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t}=te((0,l.useDispatch)(zt)),{params:n}=Oo(),{canvas:s="view"}=n,i=To(),{canEditCSS:r}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(_.store),s=n(),i=s?t("root","globalStyles",s):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/open-styles-css",label:(0,b.__)("Customize CSS"),icon:ko,callback:({close:n})=>{n(),"edit"!==s&&i.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles"),t("global-styles-css")}}]:[]),[i,e,t,r,s])}},Fo=()=>function(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t}=te((0,l.useDispatch)(zt)),{params:n}=Oo(),{canvas:s="view"}=n,i=To(),r=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(_.store),s=n(),i=s?t("root","globalStyles",s):void 0;return!!i?._links?.["version-history"]?.[0]?.count}),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/open-global-styles-revisions",label:(0,b.__)("Style revisions"),icon:Eo,callback:({close:n})=>{n(),"edit"!==s&&i.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles"),t("global-styles-revisions")}}]:[]),[r,i,e,t,s])}};const Ro=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})}),{EditorContentSlotFill:Bo,ResizableEditor:Do}=te(h.privateApis);function Lo(e){switch(e){case"style-book":return(0,b.__)("Style Book");case"global-styles-revisions":case"global-styles-revisions:style-book":return(0,b.__)("Style Revisions");default:return""}}function zo(){const e=(0,y.__experimentalUseSlotFills)(Bo.name);return!!e?.length}const Go=function({children:e,closeButtonLabel:t,onClose:n,enableResizing:s=!1}){const{editorCanvasContainerView:i,showListViewByDefault:r}=(0,l.useSelect)((e=>({editorCanvasContainerView:te(e(zt)).getEditorCanvasContainerView(),showListViewByDefault:e(f.store).get("core","showListViewByDefault")})),[]),[o,a]=(0,d.useState)(!1),{setEditorCanvasContainerView:c}=te((0,l.useDispatch)(zt)),{setIsListViewOpened:u}=(0,l.useDispatch)(h.store),p=(0,v.useFocusOnMount)("firstElement"),m=(0,v.useFocusReturn)();function g(){u(r),c(void 0),a(!0),"function"==typeof n&&n()}const x=Array.isArray(e)?d.Children.map(e,((e,t)=>0===t?(0,d.cloneElement)(e,{ref:m}):e)):(0,d.cloneElement)(e,{ref:m});if(o)return null;const w=Lo(i),_=n||t;return(0,oe.jsx)(Bo.Fill,{children:(0,oe.jsx)("div",{className:"edit-site-editor-canvas-container",children:(0,oe.jsx)(Do,{enableResizing:s,children:(0,oe.jsxs)("section",{className:"edit-site-editor-canvas-container__section",ref:_?p:null,onKeyDown:function(e){e.keyCode!==Jt.ESCAPE||e.defaultPrevented||(e.preventDefault(),g())},"aria-label":w,children:[_&&(0,oe.jsx)(y.Button,{size:"compact",className:"edit-site-editor-canvas-container__close-button",icon:Ro,label:t||(0,b.__)("Close"),onClick:g}),x]})})})})},{useCommandContext:Ho}=te(Wt.privateApis),{useLocation:Uo}=te(Gt.privateApis);const Wo=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"})}),qo=(0,oe.jsxs)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,oe.jsx)(Yt.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,oe.jsx)(Yt.Path,{d:"M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"})]}),Zo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})}),Ko=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})}),Yo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})}),Xo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})});function Jo(e){return(0,oe.jsx)(y.Button,{size:"compact",...e,className:Ut("edit-site-sidebar-button",e.className)})}const{useHistory:Qo,useLocation:$o}=te(Gt.privateApis);function ea({isRoot:e,title:t,actions:n,content:s,footer:i,description:r,backPath:o}){const{dashboardLink:a,dashboardLinkText:c,previewingThemeName:u}=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt)),n=$r();return{dashboardLink:t().__experimentalDashboardLink,dashboardLinkText:t().__experimentalDashboardLinkText,previewingThemeName:n?e(_.store).getTheme(n)?.name?.rendered:void 0}}),[]),h=$o(),p=Qo(),{navigate:f}=(0,d.useContext)(nn),m=null!=o?o:h.state?.backPath,g=(0,b.isRTL)()?Yo:Xo;return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.__experimentalVStack,{className:Ut("edit-site-sidebar-navigation-screen__main",{"has-footer":!!i}),spacing:0,justify:"flex-start",children:[(0,oe.jsxs)(y.__experimentalHStack,{spacing:3,alignment:"flex-start",className:"edit-site-sidebar-navigation-screen__title-icon",children:[!e&&(0,oe.jsx)(Jo,{onClick:()=>{p.navigate(m),f("back")},icon:g,label:(0,b.__)("Back"),showTooltip:!1}),e&&(0,oe.jsx)(Jo,{icon:g,label:c||(0,b.__)("Go to the Dashboard"),href:a}),(0,oe.jsx)(y.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen__title",color:"#e0e0e0",level:1,size:20,children:Qr()?(0,b.sprintf)((0,b.__)("Previewing %1$s: %2$s"),u,t):t}),n&&(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen__actions",children:n})]}),(0,oe.jsxs)("div",{className:"edit-site-sidebar-navigation-screen__content",children:[r&&(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen__description",children:r}),s]})]}),i&&(0,oe.jsx)("footer",{className:"edit-site-sidebar-navigation-screen__footer",children:i})]})}const ta=(0,d.forwardRef)((function({icon:e,size:t=24,...n},s){return(0,d.cloneElement)(e,{width:t,height:t,...n,ref:s})})),na=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})}),sa=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})}),{useHistory:ia,useLink:ra}=te(Gt.privateApis);function oa({className:e,icon:t,withChevron:n=!1,suffix:s,uid:i,to:r,onClick:o,children:a,...l}){const c=ia(),{navigate:u}=(0,d.useContext)(nn);const h=ra(r);return(0,oe.jsx)(y.__experimentalItem,{className:Ut("edit-site-sidebar-navigation-item",{"with-suffix":!n&&s},e),id:i,onClick:function(e){o?(o(e),u("forward")):r&&(e.preventDefault(),c.navigate(r),u("forward",`[id="${i}"]`))},href:r?h.href:void 0,...l,children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",children:[t&&(0,oe.jsx)(ta,{style:{fill:"currentcolor"},icon:t,size:24}),(0,oe.jsx)(y.FlexBlock,{children:a}),n&&(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?na:sa,className:"edit-site-sidebar-navigation-item__drilldown-indicator",size:24}),!n&&s]})})}const aa={per_page:-1,_fields:"id,name,avatar_urls",context:"view",capabilities:["edit_theme_options"]},la={per_page:100,page:1},ca=[],{GlobalStylesContext:ua}=te(x.privateApis);function da({query:e}={}){const{user:t}=(0,d.useContext)(ua),n={...la,...e},{authors:s,currentUser:i,isDirty:r,revisions:o,isLoadingGlobalStylesRevisions:a,revisionsCount:c}=(0,l.useSelect)((e=>{var t;const{__experimentalGetDirtyEntityRecords:s,getCurrentUser:i,getUsers:r,getRevisions:o,__experimentalGetCurrentGlobalStylesId:a,getEntityRecord:l,isResolving:c}=e(_.store),u=s(),d=i(),h=u.length>0,p=a(),f=p?l("root","globalStyles",p):void 0,m=null!==(t=f?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0,g=o("root","globalStyles",p,n)||ca;return{authors:r(aa)||ca,currentUser:d,isDirty:h,revisions:g,isLoadingGlobalStylesRevisions:c("getRevisions",["root","globalStyles",p,n]),revisionsCount:m}}),[e]);return(0,d.useMemo)((()=>{if(!s.length||a)return{revisions:ca,hasUnsavedChanges:r,isLoading:!0,revisionsCount:c};const e=o.map((e=>({...e,author:s.find((t=>t.id===e.author))})));if(o.length){if("unsaved"!==e[0].id&&1===n.page&&(e[0].isLatest=!0),r&&t&&Object.keys(t).length>0&&i&&1===n.page){const n={id:"unsaved",styles:t?.styles,settings:t?.settings,_links:t?._links,author:{name:i?.name,avatar_urls:i?.avatar_urls},modified:new Date};e.unshift(n)}n.page===Math.ceil(c/n.per_page)&&e.push({id:"parent",styles:{},settings:{}})}return{revisions:e,hasUnsavedChanges:r,isLoading:!1,revisionsCount:c}}),[r,o,i,s,t,a])}function ha({record:e,revisionsCount:t,...n}){var s;const i={},r=null!==(s=e?._links?.["predecessor-version"]?.[0]?.id)&&void 0!==s?s:null;return t=t||e?._links?.["version-history"]?.[0]?.count||0,r&&t>1&&(i.href=(0,Qt.addQueryArgs)("revision.php",{revision:e?._links["predecessor-version"][0].id}),i.as="a"),(0,oe.jsx)(y.__experimentalItemGroup,{size:"large",className:"edit-site-sidebar-navigation-screen-details-footer",children:(0,oe.jsx)(oa,{icon:Eo,...i,...n,children:(0,b.sprintf)((0,b._n)("%d Revision","%d Revisions",t),t)})})}const{useLocation:pa,useHistory:fa}=te(Gt.privateApis);function ma(e){const{name:t}=pa();return(0,oe.jsx)(oa,{...e,"aria-current":"styles"===t})}function ga(){const e=fa(),{path:t}=pa(),{revisions:n,isLoading:s,revisionsCount:i}=da(),{openGeneralSidebar:r}=(0,l.useDispatch)(zt),{setEditorCanvasContainerView:o}=te((0,l.useDispatch)(zt)),{set:a}=(0,l.useDispatch)(f.store),c=(0,d.useCallback)((async()=>(e.navigate((0,Qt.addQueryArgs)(t,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"}),Promise.all([a("core","distractionFree",!1),r("edit-site/global-styles")]))),[t,e,r,a]),u=(0,d.useCallback)((async()=>{await c(),o("global-styles-revisions")}),[c,o]),h=!!i&&!s;return(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsx)(ea,{title:(0,b.__)("Design"),isRoot:!0,description:(0,b.__)("Customize the appearance of your website using the block editor."),content:(0,oe.jsx)(va,{activeItem:"styles-navigation-item"}),footer:h&&(0,oe.jsx)(ha,{record:n?.[0],revisionsCount:i,onClick:u})})})}function va({isBlockBasedTheme:e=!0}){return(0,oe.jsxs)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-main",children:[e&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(oa,{uid:"navigation-navigation-item",to:"/navigation",withChevron:!0,icon:Wo,children:(0,b.__)("Navigation")}),(0,oe.jsx)(ma,{to:"/styles",uid:"global-styles-navigation-item",icon:_o,children:(0,b.__)("Styles")}),(0,oe.jsx)(oa,{uid:"page-navigation-item",to:"/page",withChevron:!0,icon:qo,children:(0,b.__)("Pages")}),(0,oe.jsx)(oa,{uid:"template-navigation-item",to:"/template",withChevron:!0,icon:Zo,children:(0,b.__)("Templates")})]}),!e&&(0,oe.jsx)(oa,{uid:"stylebook-navigation-item",to:"/stylebook",withChevron:!0,icon:_o,children:(0,b.__)("Styles")}),(0,oe.jsx)(oa,{uid:"patterns-navigation-item",to:"/pattern",withChevron:!0,icon:Ko,children:(0,b.__)("Patterns")})]})}function xa({customDescription:e}){const t=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.is_block_theme),[]),{setEditorCanvasContainerView:n}=te((0,l.useDispatch)(zt));let s;return(0,d.useEffect)((()=>{n(void 0)}),[n]),s=e||(t?(0,b.__)("Customize the appearance of your website using the block editor."):(0,b.__)("Explore block styles and patterns to refine your site.")),(0,oe.jsx)(ea,{isRoot:!0,title:(0,b.__)("Design"),description:s,content:(0,oe.jsx)(va,{isBlockBasedTheme:t})})}function ya(){return(0,oe.jsx)(y.__experimentalSpacer,{padding:3,children:(0,oe.jsx)(y.Notice,{status:"warning",isDismissible:!1,children:(0,b.__)("The theme you are currently using does not support this screen.")})})}const ba=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z"})});function wa({nonAnimatedSrc:e,animatedSrc:t}){return(0,oe.jsxs)("picture",{className:"edit-site-welcome-guide__image",children:[(0,oe.jsx)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,oe.jsx)("img",{src:t,width:"312",height:"240",alt:""})]})}function _a(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,isBlockBasedTheme:n}=(0,l.useSelect)((e=>({isActive:!!e(f.store).get("core/edit-site","welcomeGuide"),isBlockBasedTheme:e(_.store).getCurrentTheme()?.is_block_theme})),[]);return t&&n?(0,oe.jsx)(y.Guide,{className:"edit-site-welcome-guide guide-editor",contentLabel:(0,b.__)("Welcome to the site editor"),finishButtonText:(0,b.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuide"),pages:[{image:(0,oe.jsx)(wa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/edit-your-site.svg?1",animatedSrc:"https://s.w.org/images/block-editor/edit-your-site.gif?1"}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Edit your site")}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("Design everything on your site — from the header right down to the footer — using blocks.")}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,d.createInterpolateElement)((0,b.__)("Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors."),{StylesIconImage:(0,oe.jsx)("img",{alt:(0,b.__)("styles"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"})})})]})}]}):null}const{interfaceStore:ja}=te(h.privateApis);function Sa(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,isStylesOpen:n}=(0,l.useSelect)((e=>{const t=e(ja).getActiveComplementaryArea("core");return{isActive:!!e(f.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:"edit-site/global-styles"===t}}),[]);if(!t||!n)return null;const s=(0,b.__)("Welcome to Styles");return(0,oe.jsx)(y.Guide,{className:"edit-site-welcome-guide guide-styles",contentLabel:s,finishButtonText:(0,b.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,oe.jsx)(wa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.svg?1",animatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.gif?1"}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.")})]})},{image:(0,oe.jsx)(wa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/set-the-design.svg?1",animatedSrc:"https://s.w.org/images/block-editor/set-the-design.gif?1"}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Set the design")}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!")})]})},{image:(0,oe.jsx)(wa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.svg?1",animatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.gif?1"}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Personalize blocks")}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.")})]})},{image:(0,oe.jsx)(wa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Learn more")}),(0,oe.jsxs)("p",{className:"edit-site-welcome-guide__text",children:[(0,b.__)("New to block themes and styling your site?")," ",(0,oe.jsx)(y.ExternalLink,{href:(0,b.__)("https://wordpress.org/documentation/article/styles-overview/"),children:(0,b.__)("Here’s a detailed guide to learn how to make the most of it.")})]})]})}]})}function Ca(){const{toggle:e}=(0,l.useDispatch)(f.store);if(!(0,l.useSelect)((e=>{const t=!!e(f.store).get("core/edit-site","welcomeGuidePage"),n=!!e(f.store).get("core/edit-site","welcomeGuide");return t&&!n}),[]))return null;const t=(0,b.__)("Editing a page");return(0,oe.jsx)(y.Guide,{className:"edit-site-welcome-guide guide-page",contentLabel:t,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuidePage"),pages:[{image:(0,oe.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,oe.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-page.mp4",type:"video/mp4"})}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:t}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.")})]})}]})}function ka(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,hasPreviousEntity:n}=(0,l.useSelect)((e=>{const{getEditorSettings:t}=e(h.store),{get:n}=e(f.store);return{isActive:n("core/edit-site","welcomeGuideTemplate"),hasPreviousEntity:!!t().onNavigateToPreviousEntityRecord}}),[]);if(!(t&&n))return null;const s=(0,b.__)("Editing a template");return(0,oe.jsx)(y.Guide,{className:"edit-site-welcome-guide guide-template",contentLabel:s,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuideTemplate"),pages:[{image:(0,oe.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,oe.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-template.mp4",type:"video/mp4"})}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.")})]})}]})}function Ea({postType:e}){return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(_a,{}),(0,oe.jsx)(Sa,{}),"page"===e&&(0,oe.jsx)(Ca,{}),"wp_template"===e&&(0,oe.jsx)(ka,{})]})}const{useGlobalStylesOutput:Pa}=te(x.privateApis);function Ia({disableRootPadding:e}){return function(e){const[t,n]=Pa(e),{getSettings:s}=(0,l.useSelect)(zt),{updateSettings:i}=(0,l.useDispatch)(zt);(0,d.useEffect)((()=>{var e;if(!t||!n)return;const r=s(),o=Object.values(null!==(e=r.styles)&&void 0!==e?e:[]).filter((e=>!e.isGlobalStyles));i({...r,styles:[...o,...t],__experimentalFeatures:n})}),[t,n,i,s])}(e),null}const{Theme:Ta}=te(y.privateApis),{useGlobalStyle:Oa}=te(x.privateApis);function Aa({id:e}){var t;const[n]=Oa("color.text"),[s]=Oa("color.background"),{highlightedColors:i}=ie(),r=null!==(t=i[0]?.color)&&void 0!==t?t:n,{elapsed:o,total:a}=(0,l.useSelect)((e=>{var t,n;const s=e(_.store).countSelectorsByStatus(),i=null!==(t=s.resolving)&&void 0!==t?t:0,r=null!==(n=s.finished)&&void 0!==n?n:0;return{elapsed:r,total:r+i}}),[]);return(0,oe.jsx)("div",{className:"edit-site-canvas-loader",children:(0,oe.jsx)(Ta,{accent:r,background:s,children:(0,oe.jsx)(y.ProgressBar,{id:e,max:a,value:o})})})}const{useHistory:Na}=te(Gt.privateApis);const{useLocation:Ma,useHistory:Va}=te(Gt.privateApis);function Fa(){const{query:e}=Ma(),{canvas:t="view"}=e,n=function(){const e=Na();return(0,d.useCallback)((t=>{e.navigate(`/${t.postType}/${t.postId}?canvas=edit&focusMode=true`)}),[e])}(),{settings:s}=(0,l.useSelect)((e=>{const{getSettings:t}=e(zt);return{settings:t()}}),[]),i=function(){const e=Ma(),t=(0,v.usePrevious)(e),n=Va();return(0,d.useMemo)((()=>{const s=e.query.focusMode||e?.params?.postId&&Me.includes(e?.params?.postType),i="edit"===t?.query.canvas;return s&&i?()=>n.back():void 0}),[e,n])}();return(0,d.useMemo)((()=>({...s,richEditingEnabled:!0,supportsTemplateMode:!0,focusMode:"view"!==t,onNavigateToEntityRecord:n,onNavigateToPreviousEntityRecord:i,isPreviewMode:"view"===t})),[s,t,n,i])}const{Fill:Ra,Slot:Ba}=(0,y.createSlotFill)("PluginTemplateSettingPanel"),Da=({children:e})=>{u()("wp.editSite.PluginTemplateSettingPanel",{since:"6.6",version:"6.8",alternative:"wp.editor.PluginDocumentSettingPanel"});return(0,l.useSelect)((e=>"wp_template"===e(h.store).getCurrentPostType()),[])?(0,oe.jsx)(Ra,{children:e}):null};Da.Slot=Ba;const La=Da,za=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"})}),Ga=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});function Ha({className:e,...t}){return(0,oe.jsx)(y.Icon,{className:Ut(e,"edit-site-global-styles-icon-with-current-color"),...t})}function Ua({icon:e,children:t,...n}){return(0,oe.jsxs)(y.__experimentalItem,{...n,children:[e&&(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",children:[(0,oe.jsx)(Ha,{icon:e,size:24}),(0,oe.jsx)(y.FlexItem,{children:t})]}),!e&&t]})}function Wa(e){return(0,oe.jsx)(y.Navigator.Button,{as:Ua,...e})}const qa=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z"})}),Za=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"})}),Ka=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z"})}),Ya=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z"})}),{useHasDimensionsPanel:Xa,useHasTypographyPanel:Ja,useHasColorPanel:Qa,useGlobalSetting:$a,useSettingsForBlockElement:el,useHasBackgroundPanel:tl}=te(x.privateApis);const nl=function(){const[e]=$a(""),t=el(e),n=tl(e),s=Ja(t),i=Qa(t),r=Xa(t);return(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsxs)(y.__experimentalItemGroup,{children:[s&&(0,oe.jsx)(Wa,{icon:qa,path:"/typography",children:(0,b.__)("Typography")}),i&&(0,oe.jsx)(Wa,{icon:Za,path:"/colors",children:(0,b.__)("Colors")}),n&&(0,oe.jsx)(Wa,{icon:Ka,path:"/background","aria-label":(0,b.__)("Background styles"),children:(0,b.__)("Background")}),(0,oe.jsx)(Wa,{icon:Ya,path:"/shadows",children:(0,b.__)("Shadows")}),r&&(0,oe.jsx)(Wa,{icon:Zo,path:"/layout",children:(0,b.__)("Layout")})]})})};function sl(e){const t=/^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/,n=e.trim(),s=e=>(e=e.trim()).match(t)?`"${e=e.replace(/^["']|["']$/g,"")}"`:e;return n.includes(",")?n.split(",").map(s).filter((e=>""!==e)).join(", "):s(n)}function il(e){if(!e)return"";let t=e.trim();return t.includes(",")&&(t=t.split(",").find((e=>""!==e.trim())).trim()),t=t.replace(/^["']|["']$/g,""),window.navigator.userAgent.toLowerCase().includes("firefox")&&(t=`"${t}"`),t}function rl(e){const t={fontFamily:sl(e.fontFamily)};if(!Array.isArray(e.fontFace))return t.fontWeight="400",t.fontStyle="normal",t;if(e.fontFace){const i=e.fontFace.filter((e=>e?.fontStyle&&"normal"===e.fontStyle.toLowerCase()));if(i.length>0){t.fontStyle="normal";const e=function(e){const t=[];return e.forEach((e=>{const n=String(e.fontWeight).split(" ");if(2===n.length){const e=parseInt(n[0]),s=parseInt(n[1]);for(let n=e;n<=s;n+=100)t.push(n)}else 1===n.length&&t.push(parseInt(n[0]))})),t}(i),r=(n=400,0===(s=e).length?null:(s.sort(((e,t)=>Math.abs(n-e)-Math.abs(n-t))),s[0]));t.fontWeight=String(r)||"400"}else t.fontStyle=e.fontFace.length&&e.fontFace[0].fontStyle||"normal",t.fontWeight=e.fontFace.length&&String(e.fontFace[0].fontWeight)||"400"}var n,s;return t}function ol(e){return e?`is-style-${e}`:""}function al(e,t){const n=new RegExp(`^${t}([\\d]+)$`);return e.reduce(((e,t)=>{if("string"==typeof t?.slug){const s=t?.slug.match(n);if(s){const t=parseInt(s[1],10);if(t>e)return t}}return e}),0)+1}function ll(e,t){if(!Array.isArray(e)||!t)return null;const n=t.replace("var(","").replace(")",""),s=n?.split("--").slice(-1)[0];return e.find((e=>e.slug===s))}const{useGlobalStyle:cl,GlobalStylesContext:ul}=te(x.privateApis),{mergeBaseAndUserConfigs:dl}=te(h.privateApis);function hl({fontSize:e,variation:t}){const{base:n}=(0,d.useContext)(ul);let s=n;t&&(s=dl(n,t));const[i]=cl("color.text"),[r,o]=function(e){const t=e?.settings?.typography?.fontFamilies?.theme,n=e?.settings?.typography?.fontFamilies?.custom;let s=[];t&&n?s=[...t,...n]:t?s=t:n&&(s=n);const i=e?.styles?.typography?.fontFamily,r=ll(s,i),o=e?.styles?.elements?.heading?.typography?.fontFamily;let a;return a=o?ll(s,e?.styles?.elements?.heading?.typography?.fontFamily):r,[r,a]}(s),a=r?rl(r):{},l=o?rl(o):{};return i&&(a.color=i,l.color=i),e&&(a.fontSize=e,l.fontSize=e),(0,oe.jsxs)(y.__unstableMotion.div,{animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:.3,type:"tween"},style:{textAlign:"center",lineHeight:1},children:[(0,oe.jsx)("span",{style:l,children:(0,b._x)("A","Uppercase letter A")}),(0,oe.jsx)("span",{style:a,children:(0,b._x)("a","Lowercase letter A")})]})}function pl({normalizedColorSwatchSize:e,ratio:t}){const{highlightedColors:n}=ie(),s=e*t;return n.map((({slug:e,color:t},n)=>(0,oe.jsx)(y.__unstableMotion.div,{style:{height:s,width:s,background:t,borderRadius:s/2},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:1===n?.2:.1}},`${e}-${n}`)))}const{useGlobalStyle:fl}=te(x.privateApis),ml={leading:!0,trailing:!0};function gl({children:e,label:t,isFocused:n,withHoverView:s}){const[i="white"]=fl("color.background"),[r]=fl("color.gradient"),o=(0,v.useReducedMotion)(),[a,l]=(0,d.useState)(!1),[c,{width:u}]=(0,v.useResizeObserver)(),[h,p]=(0,d.useState)(u),[f,m]=(0,d.useState)(),g=(0,v.useThrottle)(p,250,ml);(0,d.useLayoutEffect)((()=>{u&&g(u)}),[u,g]),(0,d.useLayoutEffect)((()=>{const e=h?h/248:1,t=e-(f||0);!(Math.abs(t)>.1)&&f||m(e)}),[h,f]);const x=f||(u?u/248:1),b=!!u;return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("div",{style:{position:"relative"},children:c}),b&&(0,oe.jsx)("div",{className:"edit-site-global-styles-preview__wrapper",style:{height:152*x},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),tabIndex:-1,children:(0,oe.jsx)(y.__unstableMotion.div,{style:{height:152*x,width:"100%",background:null!=r?r:i,cursor:s?"pointer":void 0},initial:"start",animate:(a||n)&&!o&&t?"hover":"start",children:[].concat(e).map(((e,t)=>e({ratio:x,key:t})))})})]})}const{useGlobalStyle:vl}=te(x.privateApis),xl={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},yl={hover:{opacity:1},start:{opacity:.5}},bl={hover:{scale:1,opacity:1},start:{scale:0,opacity:0}},wl=({label:e,isFocused:t,withHoverView:n,variation:s})=>{const[i]=vl("typography.fontWeight"),[r="serif"]=vl("typography.fontFamily"),[o=r]=vl("elements.h1.typography.fontFamily"),[a=i]=vl("elements.h1.typography.fontWeight"),[l="black"]=vl("color.text"),[c=l]=vl("elements.h1.color.text"),{paletteColors:u}=ie();return(0,oe.jsxs)(gl,{label:e,isFocused:t,withHoverView:n,children:[({ratio:e,key:t})=>(0,oe.jsx)(y.__unstableMotion.div,{variants:xl,style:{height:"100%",overflow:"hidden"},children:(0,oe.jsxs)(y.__experimentalHStack,{spacing:10*e,justify:"center",style:{height:"100%",overflow:"hidden"},children:[(0,oe.jsx)(hl,{fontSize:65*e,variation:s}),(0,oe.jsx)(y.__experimentalVStack,{spacing:4*e,children:(0,oe.jsx)(pl,{normalizedColorSwatchSize:32,ratio:e})})]})},t),({key:e})=>(0,oe.jsx)(y.__unstableMotion.div,{variants:n&&yl,style:{height:"100%",width:"100%",position:"absolute",top:0,overflow:"hidden",filter:"blur(60px)",opacity:.1},children:(0,oe.jsx)(y.__experimentalHStack,{spacing:0,justify:"flex-start",style:{height:"100%",overflow:"hidden"},children:u.slice(0,4).map((({color:e},t)=>(0,oe.jsx)("div",{style:{height:"100%",background:e,flexGrow:1}},t)))})},e),({ratio:t,key:n})=>(0,oe.jsx)(y.__unstableMotion.div,{variants:bl,style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",top:0},children:(0,oe.jsx)(y.__experimentalVStack,{spacing:3*t,justify:"center",style:{height:"100%",overflow:"hidden",padding:10*t,boxSizing:"border-box"},children:e&&(0,oe.jsx)("div",{style:{fontSize:40*t,fontFamily:o,color:c,fontWeight:a,lineHeight:"1em",textAlign:"center"},children:e})})},n)]})},{useGlobalStyle:_l}=te(x.privateApis);const jl=function(){const[e]=_l("css"),{hasVariations:t,canEditCSS:n}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n,__experimentalGetCurrentThemeGlobalStylesVariations:s}=e(_.store),i=n(),r=i?t("root","globalStyles",i):void 0;return{hasVariations:!!s()?.length,canEditCSS:!!r?._links?.["wp:action-edit-css"]}}),[]);return(0,oe.jsxs)(y.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-root",isRounded:!1,children:[(0,oe.jsx)(y.CardBody,{children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(y.Card,{className:"edit-site-global-styles-screen-root__active-style-tile",children:(0,oe.jsx)(y.CardMedia,{className:"edit-site-global-styles-screen-root__active-style-tile-preview",children:(0,oe.jsx)(wl,{})})}),t&&(0,oe.jsx)(y.__experimentalItemGroup,{children:(0,oe.jsx)(Wa,{path:"/variations",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Browse styles")}),(0,oe.jsx)(Ha,{icon:(0,b.isRTL)()?Xo:Yo})]})})}),(0,oe.jsx)(nl,{})]})}),(0,oe.jsx)(y.CardDivider,{}),(0,oe.jsxs)(y.CardBody,{children:[(0,oe.jsx)(y.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4,children:(0,b.__)("Customize the appearance of specific blocks for the whole site.")}),(0,oe.jsx)(y.__experimentalItemGroup,{children:(0,oe.jsx)(Wa,{path:"/blocks",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Blocks")}),(0,oe.jsx)(Ha,{icon:(0,b.isRTL)()?Xo:Yo})]})})})]}),n&&!!e&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.CardDivider,{}),(0,oe.jsxs)(y.CardBody,{children:[(0,oe.jsx)(y.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4,children:(0,b.__)("Add your own CSS to customize the appearance and layout of your site.")}),(0,oe.jsx)(y.__experimentalItemGroup,{children:(0,oe.jsx)(Wa,{path:"/css",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Additional CSS")}),(0,oe.jsx)(Ha,{icon:(0,b.isRTL)()?Xo:Yo})]})})})]})]})]})},Sl=window.wp.a11y,{useGlobalStyle:Cl}=te(x.privateApis);function kl(e){const t=(0,l.useSelect)((t=>{const{getBlockStyles:n}=t(o.store);return n(e)}),[e]),[n]=Cl("variations",e);return function(e,t){return e?.filter((e=>"block"===e.source||t.includes(e.name)))}(t,Object.keys(null!=n?n:{}))}function El({name:e}){const t=kl(e);return(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map(((t,n)=>t?.isDefault?null:(0,oe.jsx)(Wa,{path:"/blocks/"+encodeURIComponent(e)+"/variations/"+encodeURIComponent(t.name),children:t.label},n)))})}const Pl=function({title:e,description:t,onBack:n}){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,children:[(0,oe.jsx)(y.__experimentalView,{children:(0,oe.jsx)(y.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3,children:(0,oe.jsxs)(y.__experimentalHStack,{spacing:2,children:[(0,oe.jsx)(y.Navigator.BackButton,{icon:(0,b.isRTL)()?Yo:Xo,size:"small",label:(0,b.__)("Back"),onClick:n}),(0,oe.jsx)(y.__experimentalSpacer,{children:(0,oe.jsx)(y.__experimentalHeading,{className:"edit-site-global-styles-header",level:2,size:13,children:e})})]})})}),t&&(0,oe.jsx)("p",{className:"edit-site-global-styles-header__description",children:t})]})},{useHasDimensionsPanel:Il,useHasTypographyPanel:Tl,useHasBorderPanel:Ol,useGlobalSetting:Al,useSettingsForBlockElement:Nl,useHasColorPanel:Ml}=te(x.privateApis);function Vl(e){const[t]=Al("",e),n=Nl(t,e),s=Tl(n),i=Ml(n),r=Ol(n),o=Il(n),a=r||o,l=!!kl(e)?.length;return s||i||a||l}function Fl({block:e}){return Vl(e.name)?(0,oe.jsx)(Wa,{path:"/blocks/"+encodeURIComponent(e.name),children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",children:[(0,oe.jsx)(x.BlockIcon,{icon:e.icon}),(0,oe.jsx)(y.FlexItem,{children:e.title})]})}):null}const Rl=(0,d.memo)((function({filterValue:e}){const t=function(){const e=(0,l.useSelect)((e=>e(o.store).getBlockTypes()),[]),{core:t,noncore:n}=e.reduce(((e,t)=>{const{core:n,noncore:s}=e;return(t.name.startsWith("core/")?n:s).push(t),e}),{core:[],noncore:[]});return[...t,...n]}(),n=(0,v.useDebounce)(Sl.speak,500),{isMatchingSearchTerm:s}=(0,l.useSelect)(o.store),i=e?t.filter((t=>s(t,e))):t,r=(0,d.useRef)();return(0,d.useEffect)((()=>{if(!e)return;const t=r.current.childElementCount,s=(0,b.sprintf)((0,b._n)("%d result found.","%d results found.",t),t);n(s,t)}),[e,n]),(0,oe.jsx)("div",{ref:r,className:"edit-site-block-types-item-list",role:"list",children:0===i.length?(0,oe.jsx)(y.__experimentalText,{align:"center",as:"p",children:(0,b.__)("No blocks found.")}):i.map((e=>(0,oe.jsx)(Fl,{block:e},"menu-itemblock-"+e.name)))})}));const Bl=function(){const[e,t]=(0,d.useState)(""),n=(0,d.useDeferredValue)(e);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Blocks"),description:(0,b.__)("Customize the appearance of specific blocks and for the whole site.")}),(0,oe.jsx)(y.SearchControl,{__nextHasNoMarginBottom:!0,className:"edit-site-block-types-search",onChange:t,value:e,label:(0,b.__)("Search"),placeholder:(0,b.__)("Search")}),(0,oe.jsx)(Rl,{filterValue:n})]})},Dl=({name:e,variation:t=""})=>{var n;const s=(0,o.getBlockType)(e)?.example,i=(0,d.useMemo)((()=>{if(!s)return null;const n={...s,attributes:{...s.attributes,style:void 0,className:t?ol(t):s.attributes?.className}};return(0,o.getBlockFromExample)(e,n)}),[e,s,t]),r=null!==(n=s?.viewportWidth)&&void 0!==n?n:500,a=144,l=235/r,c=0!==l&&l<1?a/l:a;return s?(0,oe.jsx)(y.__experimentalSpacer,{marginX:4,marginBottom:4,children:(0,oe.jsx)("div",{className:"edit-site-global-styles__block-preview-panel",style:{maxHeight:a,boxSizing:"initial"},children:(0,oe.jsx)(x.BlockPreview,{blocks:i,viewportWidth:r,minHeight:a,additionalStyles:[{css:`\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tpadding: 24px;\n\t\t\t\t\t\t\t\t\tmin-height:${Math.round(c)}px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;\n\t\t\t\t\t\t\t\t\talign-items:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t.is-root-container { width: 100%; }\n\t\t\t\t\t\t\t`}]})})}):null};const Ll=function({children:e,level:t}){return(0,oe.jsx)(y.__experimentalHeading,{className:"edit-site-global-styles-subtitle",level:null!=t?t:2,children:e})},zl={backgroundSize:"cover",backgroundPosition:"50% 50%"};function Gl(e){if(!e)return e;const t=e.color||e.width;return!e.style&&t?{...e,style:"solid"}:!e.style||t?e:void 0}const{useHasDimensionsPanel:Hl,useHasTypographyPanel:Ul,useHasBorderPanel:Wl,useGlobalSetting:ql,useSettingsForBlockElement:Zl,useHasColorPanel:Kl,useHasFiltersPanel:Yl,useHasImageSettingsPanel:Xl,useGlobalStyle:Jl,useHasBackgroundPanel:Ql,BackgroundPanel:$l,BorderPanel:ec,ColorPanel:tc,TypographyPanel:nc,DimensionsPanel:sc,FiltersPanel:ic,ImageSettingsPanel:rc,AdvancedPanel:oc}=te(x.privateApis);const ac=function({name:e,variation:t}){let n=[];t&&(n=["variations",t].concat(n));const s=n.join("."),[i]=Jl(s,e,"user",{shouldDecodeEncode:!1}),[r,a]=Jl(s,e,"all",{shouldDecodeEncode:!1}),[c]=ql("",e,"user"),[u,h]=ql("",e),p=Zl(u,e),f=(0,o.getBlockType)(e);let m=!1;p?.spacing?.blockGap&&f?.supports?.spacing?.blockGap&&(!0===f?.supports?.spacing?.__experimentalSkipSerialization||f?.supports?.spacing?.__experimentalSkipSerialization?.some?.((e=>"blockGap"===e)))&&(m=!0);let g=!1;p?.dimensions?.aspectRatio&&"core/group"===e&&(g=!0);const v=(0,d.useMemo)((()=>{const e=structuredClone(p);return m&&(e.spacing.blockGap=!1),g&&(e.dimensions.aspectRatio=!1),e}),[p,m,g]),x=kl(e),w=Ql(v),j=Ul(v),S=Kl(v),C=Wl(v),k=Hl(v),E=Yl(v),P=Xl(e,c,v),I=!!x?.length&&!t,{canEditCSS:T}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(_.store),s=n(),i=s?t("root","globalStyles",s):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),O=t?x.find((e=>e.name===t)):null,A=(0,d.useMemo)((()=>({...r,layout:v.layout})),[r,v.layout]),N=(0,d.useMemo)((()=>({...i,layout:c.layout})),[i,c.layout]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:t?O?.label:f.title}),(0,oe.jsx)(Dl,{name:e,variation:t}),I&&(0,oe.jsx)("div",{className:"edit-site-global-styles-screen-variations",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[(0,oe.jsx)(Ll,{children:(0,b.__)("Style Variations")}),(0,oe.jsx)(El,{name:e})]})}),S&&(0,oe.jsx)(tc,{inheritedValue:r,value:i,onChange:a,settings:v}),w&&(0,oe.jsx)($l,{inheritedValue:r,value:i,onChange:a,settings:v,defaultValues:zl}),j&&(0,oe.jsx)(nc,{inheritedValue:r,value:i,onChange:a,settings:v}),k&&(0,oe.jsx)(sc,{inheritedValue:A,value:N,onChange:e=>{const t={...e};delete t.layout,a(t),e.layout!==c.layout&&h({...c,layout:e.layout})},settings:v,includeLayoutControls:!0}),C&&(0,oe.jsx)(ec,{inheritedValue:r,value:i,onChange:e=>{if(!e?.border)return void a(e);const{radius:t,...n}=e.border,s=function(e){return e?(0,y.__experimentalHasSplitBorders)(e)?{top:Gl(e.top),right:Gl(e.right),bottom:Gl(e.bottom),left:Gl(e.left)}:Gl(e):e}(n),i=(0,y.__experimentalHasSplitBorders)(s)?{color:null,style:null,width:null,...s}:{top:s,right:s,bottom:s,left:s};a({...e,border:{...i,radius:t}})},settings:v}),E&&(0,oe.jsx)(ic,{inheritedValue:A,value:N,onChange:a,settings:v,includeLayoutControls:!0}),P&&(0,oe.jsx)(rc,{onChange:e=>{h(void 0===e?{...u,lightbox:void 0}:{...u,lightbox:{...u.lightbox,...e}})},value:c,inheritedValue:v}),T&&(0,oe.jsxs)(y.PanelBody,{title:(0,b.__)("Advanced"),initialOpen:!1,children:[(0,oe.jsx)("p",{children:(0,b.sprintf)((0,b.__)("Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value."),f?.title)}),(0,oe.jsx)(oc,{value:i,onChange:a,inheritedValue:r})]})]})},{useGlobalStyle:lc}=te(x.privateApis);function cc({parentMenu:e,element:t,label:n}){var s;const i="text"!==t&&t?`elements.${t}.`:"",r="link"===t?{textDecoration:"underline"}:{},[o]=lc(i+"typography.fontFamily"),[a]=lc(i+"typography.fontStyle"),[l]=lc(i+"typography.fontWeight"),[c]=lc(i+"color.background"),[u]=lc("color.background"),[d]=lc(i+"color.gradient"),[h]=lc(i+"color.text");return(0,oe.jsx)(Wa,{path:e+"/typography/"+t,children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",children:[(0,oe.jsx)(y.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:null!=o?o:"serif",background:null!==(s=null!=d?d:c)&&void 0!==s?s:u,color:h,fontStyle:a,fontWeight:l,...r},"aria-hidden":"true",children:(0,b.__)("Aa")}),(0,oe.jsx)(y.FlexItem,{children:n})]})})}const uc=function(){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Elements")}),(0,oe.jsxs)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[(0,oe.jsx)(cc,{parentMenu:"",element:"text",label:(0,b.__)("Text")}),(0,oe.jsx)(cc,{parentMenu:"",element:"link",label:(0,b.__)("Links")}),(0,oe.jsx)(cc,{parentMenu:"",element:"heading",label:(0,b.__)("Headings")}),(0,oe.jsx)(cc,{parentMenu:"",element:"caption",label:(0,b.__)("Captions")}),(0,oe.jsx)(cc,{parentMenu:"",element:"button",label:(0,b.__)("Buttons")})]})]})},dc=({variation:e,isFocused:t,withHoverView:n})=>(0,oe.jsx)(gl,{label:e.title,isFocused:t,withHoverView:n,children:({ratio:t,key:n})=>(0,oe.jsx)(y.__experimentalHStack,{spacing:10*t,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,oe.jsx)(hl,{variation:e,fontSize:85*t})},n)}),hc=[],{GlobalStylesContext:pc,areGlobalStyleConfigsEqual:fc}=te(x.privateApis),{mergeBaseAndUserConfigs:mc}=te(h.privateApis);function gc(e,t){if(!t?.length)return e;if("object"!=typeof e||!e||!Object.keys(e).length)return e;for(const n in e)t.includes(n)?delete e[n]:"object"==typeof e[n]&&gc(e[n],t);return e}function vc({title:e,settings:t,styles:n}){return e===(0,b.__)("Default")||Object.keys(t).length>0||Object.keys(n).length>0}function xc(e=[]){const{variationsFromTheme:t}=(0,l.useSelect)((e=>({variationsFromTheme:e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()||hc})),[]),{user:n}=(0,d.useContext)(pc),s=e.toString();return(0,d.useMemo)((()=>{const s=gc(structuredClone(n),e);s.title=(0,b.__)("Default");const i=t.filter((t=>bc(t,e))).map((e=>mc(s,e))),r=[s,...i];return r?.length?r.filter(vc):[]}),[s,n,t])}const yc=(e,t)=>{if(!e||!t?.length)return{};const n={};return Object.keys(e).forEach((s=>{if(t.includes(s))n[s]=e[s];else if("object"==typeof e[s]){const i=yc(e[s],t);Object.keys(i).length&&(n[s]=i)}})),n};function bc(e,t){const n=yc(structuredClone(e),t);return fc(n,e)}const{mergeBaseAndUserConfigs:wc}=te(h.privateApis),{GlobalStylesContext:_c,areGlobalStyleConfigsEqual:jc}=te(x.privateApis);function Sc({variation:e,children:t,isPill:n,properties:s,showTooltip:i}){const[r,o]=(0,d.useState)(!1),{base:a,user:l,setUserConfig:c}=(0,d.useContext)(_c),u=(0,d.useMemo)((()=>{let t=wc(a,e);return s&&(t=yc(t,s)),{user:e,base:a,merged:t,setUserConfig:()=>{}}}),[e,a,s]),h=()=>c(e),p=(0,d.useMemo)((()=>jc(l,e)),[l,e]);let f=e?.title;e?.description&&(f=(0,b.sprintf)((0,b._x)("%1$s (%2$s)","variation label"),e?.title,e?.description));const m=(0,oe.jsx)("div",{className:Ut("edit-site-global-styles-variations_item",{"is-active":p}),role:"button",onClick:h,onKeyDown:e=>{e.keyCode===Jt.ENTER&&(e.preventDefault(),h())},tabIndex:"0","aria-label":f,"aria-current":p,onFocus:()=>o(!0),onBlur:()=>o(!1),children:(0,oe.jsx)("div",{className:Ut("edit-site-global-styles-variations_item-preview",{"is-pill":n}),children:t(r)})});return(0,oe.jsx)(_c.Provider,{value:u,children:i?(0,oe.jsx)(y.Tooltip,{text:e?.title,children:m}):m})}function Cc({title:e,gap:t=2}){const n=["typography"],s=xc(n);return s?.length<=1?null:(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[e&&(0,oe.jsx)(Ll,{level:3,children:e}),(0,oe.jsx)(y.__experimentalGrid,{columns:3,gap:t,className:"edit-site-global-styles-style-variations-container",children:s.map(((e,t)=>(0,oe.jsx)(Sc,{variation:e,properties:n,showTooltip:!0,children:()=>(0,oe.jsx)(dc,{variation:e})},t)))})]})}const kc=function(){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:2,children:[(0,oe.jsx)(y.__experimentalHStack,{justify:"space-between",children:(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Font Sizes")})}),(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,oe.jsx)(Wa,{path:"/typography/font-sizes",children:(0,oe.jsxs)(y.__experimentalHStack,{direction:"row",children:[(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Font size presets")}),(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?Xo:Yo})]})})})]})},Ec=(0,oe.jsxs)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,oe.jsx)(Yt.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,oe.jsx)(Yt.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})]}),Pc="/wp/v2/font-families",Ic="/wp/v2/font-collections";async function Tc(e){const t={path:Pc,method:"POST",body:e},n=await oo()(t);return{id:n.id,...n.font_family_settings,fontFace:[]}}async function Oc(e,t){const n={path:`${Pc}/${e}/font-faces`,method:"POST",body:t},s=await oo()(n);return{id:s.id,...s.font_face_settings}}async function Ac(e){const t={path:`${Pc}?slug=${e}&_embed=true`,method:"GET"},n=await oo()(t);if(!n||0===n.length)return null;const s=n[0];return{id:s.id,...s.font_family_settings,fontFace:s?._embedded?.font_faces.map((e=>e.font_face_settings))||[]}}async function Nc(e){const t={path:`${Pc}/${e}?force=true`,method:"DELETE"};return await oo()(t)}const Mc=["otf","ttf","woff","woff2"],Vc={100:(0,b._x)("Thin","font weight"),200:(0,b._x)("Extra-light","font weight"),300:(0,b._x)("Light","font weight"),400:(0,b._x)("Normal","font weight"),500:(0,b._x)("Medium","font weight"),600:(0,b._x)("Semi-bold","font weight"),700:(0,b._x)("Bold","font weight"),800:(0,b._x)("Extra-bold","font weight"),900:(0,b._x)("Black","font weight")},Fc={normal:(0,b._x)("Normal","font style"),italic:(0,b._x)("Italic","font style")},{File:Rc}=window,{kebabCase:Bc}=te(y.privateApis);function Dc(e,t={}){return e.name||!e.fontFamily&&!e.slug||(e.name=e.fontFamily||e.slug),{...e,...t}}function Lc(e){return`${Vc[e.fontWeight]||e.fontWeight} ${"normal"===e.fontStyle?"":Fc[e.fontStyle]||e.fontStyle}`}function zc(e=[],t=[]){const n=new Map;for(const t of e)n.set(`${t.fontWeight}${t.fontStyle}`,t);for(const e of t)n.set(`${e.fontWeight}${e.fontStyle}`,e);return Array.from(n.values())}function Gc(e=[],t=[]){const n=new Map;for(const t of e)n.set(t.slug,{...t});for(const e of t)if(n.has(e.slug)){const{fontFace:t,...s}=e,i=zc(n.get(e.slug).fontFace,t);n.set(e.slug,{...s,fontFace:i})}else n.set(e.slug,{...e});return Array.from(n.values())}async function Hc(e,t,n="all"){let s;if("string"==typeof t)s=`url(${t})`;else{if(!(t instanceof Rc))return;s=await t.arrayBuffer()}const i=new window.FontFace(il(e.fontFamily),s,{style:e.fontStyle,weight:e.fontWeight}),r=await i.load();if("document"!==n&&"all"!==n||document.fonts.add(r),"iframe"===n||"all"===n){document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts.add(r)}}function Uc(e,t="all"){const n=t=>{t.forEach((n=>{n.family===il(e?.fontFamily)&&n.weight===e?.fontWeight&&n.style===e?.fontStyle&&t.delete(n)}))};if("document"!==t&&"all"!==t||n(document.fonts),"iframe"===t||"all"===t){n(document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts)}}function Wc(e){if(!e)return;let t;var n;return t=Array.isArray(e)?e[0]:e,t.startsWith("file:.")?void 0:(("string"!=typeof(n=t)||n===decodeURIComponent(n))&&(t=encodeURI(t)),t)}function qc(e){const t=new FormData,{fontFace:n,category:s,...i}=e,r={...i,slug:Bc(e.slug)};return t.append("font_family_settings",JSON.stringify(r)),t}function Zc(e){if(e?.fontFace){const t=e.fontFace.map(((e,t)=>{const n={...e},s=new FormData;if(n.file){const e=Array.isArray(n.file)?n.file:[n.file],i=[];e.forEach(((e,n)=>{const r=`file-${t}-${n}`;s.append(r,e,e.name),i.push(r)})),n.src=1===i.length?i[0]:i,delete n.file,s.append("font_face_settings",JSON.stringify(n))}else s.append("font_face_settings",JSON.stringify(n));return s}));return t}}async function Kc(e,t){const n=[];for(const s of t)try{const t=await Oc(e,s);n.push({status:"fulfilled",value:t})}catch(e){n.push({status:"rejected",reason:e})}const s={errors:[],successes:[]};return n.forEach(((e,n)=>{if("fulfilled"===e.status){const i=e.value;i.id?s.successes.push(i):s.errors.push({data:t[n],message:`Error: ${i.message}`})}else s.errors.push({data:t[n],message:e.reason.message})})),s}function Yc(e,t){return-1!==t.findIndex((t=>t.fontWeight===e.fontWeight&&t.fontStyle===e.fontStyle))}function Xc(e,t,n){const s=t=>t.slug===e.slug,i=n.find(s);return t?(i=>{const r=e=>e.fontWeight===t.fontWeight&&e.fontStyle===t.fontStyle;if(!i)return[...n,{...e,fontFace:[t]}];let o=i.fontFace||[];return o=o.find(r)?o.filter((e=>!r(e))):[...o,t],0===o.length?n.filter((e=>!s(e))):n.map((e=>s(e)?{...e,fontFace:o}:e))})(i):(t=>t?n.filter((e=>!s(e))):[...n,e])(i)}const{useGlobalSetting:Jc}=te(x.privateApis),Qc=(0,d.createContext)({});const $c=function({children:e}){const{saveEntityRecord:t}=(0,l.useDispatch)(_.store),{globalStylesId:n}=(0,l.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(_.store);return{globalStylesId:t()}})),s=(0,_.useEntityRecord)("root","globalStyles",n),[i,r]=(0,d.useState)(!1),[o,a]=(0,d.useState)(0),c=()=>{a(Date.now())},{records:u=[],isResolving:h}=(0,_.useEntityRecords)("postType","wp_font_family",{refreshKey:o,_embed:!0}),p=(u||[]).map((e=>({id:e.id,...e.font_family_settings,fontFace:e?._embedded?.font_faces.map((e=>e.font_face_settings))||[]})))||[],[f,m]=Jc("typography.fontFamilies"),g=async e=>{const n=s.record;re(n,["settings","typography","fontFamilies"],e),await t("root","globalStyles",n)},[v,x]=(0,d.useState)(!1),[y,w]=(0,d.useState)(null),j=f?.theme?f.theme.map((e=>Dc(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],S=f?.custom?f.custom.map((e=>Dc(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],C=p?p.map((e=>Dc(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[];(0,d.useEffect)((()=>{v||w(null)}),[v]);const[k]=(0,d.useState)(new Set),E=e=>e.reduce(((e,t)=>{const n=t?.fontFace&&t.fontFace?.length>0?t?.fontFace.map((e=>`${e.fontStyle+e.fontWeight}`)):["normal400"];return e[t.slug]=n,e}),{}),P=e=>E("theme"===e?j:S),I=(e,t,n,s)=>t||n?!!P(s)[e]?.includes(t+n):!!P(s)[e],T=e=>{var t;const n=(null!==(t=f?.[e.source])&&void 0!==t?t:[]).filter((t=>t.slug!==e.slug)),s={...f,[e.source]:n};return m(s),e.fontFace&&e.fontFace.forEach((e=>{Uc(e,"all")})),s},O=e=>{const t=A(e),n={...f,custom:Gc(f?.custom,t)};return m(n),N(t),n},A=e=>e.map((({id:e,fontFace:t,...n})=>({...n,...t&&t.length>0?{fontFace:t.map((({id:e,...t})=>t))}:{}}))),N=e=>{e.forEach((e=>{e.fontFace&&e.fontFace.forEach((e=>{Hc(e,Wc(e.src),"all")}))}))},[M,V]=(0,d.useState)([]),F=async()=>{const e=await async function(){const e={path:`${Ic}?_fields=slug,name,description`,method:"GET"};return await oo()(e)}();V(e)};return(0,d.useEffect)((()=>{F()}),[]),(0,oe.jsx)(Qc.Provider,{value:{libraryFontSelected:y,handleSetLibraryFontSelected:e=>{if(!e)return void w(null);const t=("theme"===e.source?j:C).find((t=>t.slug===e.slug));w({...t||e,source:e.source})},fontFamilies:f,baseCustomFonts:C,isFontActivated:I,getFontFacesActivated:(e,t)=>P(t)[e]||[],loadFontFaceAsset:async e=>{if(!e.src)return;const t=Wc(e.src);t&&!k.has(t)&&(Hc(e,t,"document"),k.add(t))},installFonts:async function(e){r(!0);try{const t=[];let n=[];for(const s of e){let e=!1,i=await Ac(s.slug);i||(e=!0,i=await Tc(qc(s)));const r=i.fontFace&&s.fontFace?i.fontFace.filter((e=>Yc(e,s.fontFace))):[];i.fontFace&&s.fontFace&&(s.fontFace=s.fontFace.filter((e=>!Yc(e,i.fontFace))));let o=[],a=[];if(s?.fontFace?.length>0){const e=await Kc(i.id,Zc(s));o=e?.successes,a=e?.errors}(o?.length>0||r?.length>0)&&(i.fontFace=[...o],t.push(i)),i&&!s?.fontFace?.length&&t.push(i),e&&s?.fontFace?.length>0&&0===o?.length&&await Nc(i.id),n=n.concat(a)}if(n=n.reduce(((e,t)=>e.includes(t.message)?e:[...e,t.message]),[]),t.length>0){const e=O(t);await g(e),c()}if(n.length>0){const e=new Error((0,b.__)("There was an error installing fonts."));throw e.installationErrors=n,e}}finally{r(!1)}},uninstallFontFamily:async function(e){try{const t=await Nc(e.id);if(t.deleted){const t=T(e);await g(t)}return c(),t}catch(e){throw console.error("There was an error uninstalling the font family:",e),e}},toggleActivateFont:(e,t)=>{var n;const s=Xc(e,t,null!==(n=f?.[e.source])&&void 0!==n?n:[]);m({...f,[e.source]:s});I(e.slug,t?.fontStyle,t?.fontWeight,e.source)?Uc(t,"all"):Hc(t,Wc(t?.src),"all")},getAvailableFontsOutline:E,modalTabOpen:v,setModalTabOpen:x,refreshLibrary:c,saveFontFamilies:g,isResolvingLibrary:h,isInstalling:i,collections:M,getFontCollection:async e=>{try{if(!!M.find((t=>t.slug===e))?.font_families)return;const t=await async function(e){const t={path:`${Ic}/${e}`,method:"GET"};return await oo()(t)}(e),n=M.map((n=>n.slug===e?{...n,...t}:n));V(n)}catch(e){throw console.error(e),e}}},children:e})};const eu=function({font:e,text:t}){const n=(0,d.useRef)(null),s=function(e){return e.fontStyle||e.fontWeight?e:e.fontFace&&e.fontFace.length?e.fontFace.find((e=>"normal"===e.fontStyle&&"400"===e.fontWeight))||e.fontFace[0]:{fontStyle:"normal",fontWeight:"400",fontFamily:e.fontFamily,fake:!0}}(e),i=rl(e);t=t||e.name;const r=e.preview,[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(!1),{loadFontFaceAsset:u}=(0,d.useContext)(Qc),h=null!=r?r:function(e){return e.preview?e.preview:e.src?Array.isArray(e.src)?e.src[0]:e.src:void 0}(s),p=h&&h.match(/\.(png|jpg|jpeg|gif|svg)$/i);var f;const m={fontSize:"18px",lineHeight:1,opacity:l?"1":"0",...i,...{fontFamily:sl((f=s).fontFamily),fontStyle:f.fontStyle||"normal",fontWeight:f.fontWeight||"400"}};return(0,d.useEffect)((()=>{const e=new window.IntersectionObserver((([e])=>{a(e.isIntersecting)}),{});return e.observe(n.current),()=>e.disconnect()}),[n]),(0,d.useEffect)((()=>{(async()=>{o&&(!p&&s.src&&await u(s),c(!0))})()}),[s,o,u,p]),(0,oe.jsx)("div",{ref:n,children:p?(0,oe.jsx)("img",{src:h,loading:"lazy",alt:t,className:"font-library-modal__font-variant_demo-image"}):(0,oe.jsx)(y.__experimentalText,{style:m,className:"font-library-modal__font-variant_demo-text",children:t})})};const tu=function({font:e,onClick:t,variantsText:n,navigatorPath:s}){const i=e.fontFace?.length||1,r={cursor:t?"pointer":"default"},o=(0,y.useNavigator)();return(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,onClick:()=>{t(),s&&o.goTo(s)},style:r,className:"font-library-modal__font-card",children:(0,oe.jsxs)(y.Flex,{justify:"space-between",wrap:!1,children:[(0,oe.jsx)(eu,{font:e}),(0,oe.jsxs)(y.Flex,{justify:"flex-end",children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.__experimentalText,{className:"font-library-modal__font-card__count",children:n||(0,b.sprintf)((0,b._n)("%d variant","%d variants",i),i)})}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Icon,{icon:(0,b.isRTL)()?Xo:Yo})})]})]})})};const nu=function({face:e,font:t}){const{isFontActivated:n,toggleActivateFont:s}=(0,d.useContext)(Qc),i=t?.fontFace?.length>0?n(t.slug,e.fontStyle,e.fontWeight,t.source):n(t.slug,null,null,t.source),r=()=>{t?.fontFace?.length>0?s(t,e):s(t)},o=t.name+" "+Lc(e),a=(0,d.useId)();return(0,oe.jsx)("div",{className:"font-library-modal__font-card",children:(0,oe.jsxs)(y.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,oe.jsx)(y.CheckboxControl,{checked:i,onChange:r,__nextHasNoMarginBottom:!0,id:a}),(0,oe.jsx)("label",{htmlFor:a,children:(0,oe.jsx)(eu,{font:e,text:o,onClick:r})})]})})};function su(e){switch(e){case"normal":return 400;case"bold":return 700;case"bolder":return 500;case"lighter":return 300;default:return parseInt(e,10)}}function iu(e){return e.sort(((e,t)=>"normal"===e.fontStyle&&"normal"!==t.fontStyle?-1:"normal"===t.fontStyle&&"normal"!==e.fontStyle?1:e.fontStyle===t.fontStyle?su(e.fontWeight)-su(t.fontWeight):e.fontStyle.localeCompare(t.fontStyle)))}const{useGlobalSetting:ru}=te(x.privateApis);function ou({font:e,isOpen:t,setIsOpen:n,setNotice:s,uninstallFontFamily:i,handleSetLibraryFontSelected:r}){const o=(0,y.useNavigator)();return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:(0,b.__)("Delete"),onCancel:()=>{n(!1)},onConfirm:async()=>{s(null),n(!1);try{await i(e),o.goBack(),r(null),s({type:"success",message:(0,b.__)("Font family uninstalled successfully.")})}catch(e){s({type:"error",message:(0,b.__)("There was an error uninstalling the font family.")+e.message})}},size:"medium",children:e&&(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s" font and all its variants and assets?'),e.name)})}const au=function(){var e;const{baseCustomFonts:t,libraryFontSelected:n,handleSetLibraryFontSelected:s,refreshLibrary:i,uninstallFontFamily:r,isResolvingLibrary:o,isInstalling:a,saveFontFamilies:c,getFontFacesActivated:u}=(0,d.useContext)(Qc),[h,p]=ru("typography.fontFamilies"),[f,m]=(0,d.useState)(!1),[g,v]=(0,d.useState)(!1),[x]=ru("typography.fontFamilies",void 0,"base"),w=(0,l.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(_.store);return t()})),j=(0,_.useEntityRecord)("root","globalStyles",w),S=!!j?.edits?.settings?.typography?.fontFamilies,C=h?.theme?h.theme.map((e=>Dc(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],k=new Set(C.map((e=>e.slug))),E=x?.theme?C.concat(x.theme.filter((e=>!k.has(e.slug))).map((e=>Dc(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name)))):[],P="custom"===n?.source&&n?.id,I=(0,l.useSelect)((e=>{const{canUser:t}=e(_.store);return P&&t("delete",{kind:"postType",name:"wp_font_family",id:P})}),[P]),T=!!n&&"theme"!==n?.source&&I,O=e=>{const t=e?.fontFace?.length>0?e.fontFace.length:1,n=u(e.slug,e.source).length;return(0,b.sprintf)((0,b.__)("%1$s/%2$s variants active"),n,t)};(0,d.useEffect)((()=>{s(n),i()}),[]);const A=n?u(n.slug,n.source).length:0,N=null!==(e=n?.fontFace?.length)&&void 0!==e?e:n?.fontFamily?1:0,M=A>0&&A!==N,V=A===N,F=E.length>0||t.length>0;return(0,oe.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[o&&(0,oe.jsx)("div",{className:"font-library-modal__loading",children:(0,oe.jsx)(y.ProgressBar,{})}),!o&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.Navigator,{initialPath:n?"/fontFamily":"/",children:[(0,oe.jsx)(y.Navigator.Screen,{path:"/",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"8",children:[g&&(0,oe.jsx)(y.Notice,{status:g.type,onRemove:()=>v(null),children:g.message}),!F&&(0,oe.jsx)(y.__experimentalText,{as:"p",children:(0,b.__)("No fonts installed.")}),E.length>0&&(0,oe.jsxs)(y.__experimentalVStack,{children:[(0,oe.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,b._x)("Theme","font source")}),(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:E.map((e=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(tu,{font:e,navigatorPath:"/fontFamily",variantsText:O(e),onClick:()=>{v(null),s(e)}})},e.slug)))})]}),t.length>0&&(0,oe.jsxs)(y.__experimentalVStack,{children:[(0,oe.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,b._x)("Custom","font source")}),(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:t.map((e=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(tu,{font:e,navigatorPath:"/fontFamily",variantsText:O(e),onClick:()=>{v(null),s(e)}})},e.slug)))})]})]})}),(0,oe.jsxs)(y.Navigator.Screen,{path:"/fontFamily",children:[(0,oe.jsx)(ou,{font:n,isOpen:f,setIsOpen:m,setNotice:v,uninstallFontFamily:r,handleSetLibraryFontSelected:s}),(0,oe.jsxs)(y.Flex,{justify:"flex-start",children:[(0,oe.jsx)(y.Navigator.BackButton,{icon:(0,b.isRTL)()?Yo:Xo,size:"small",onClick:()=>{s(null),v(null)},label:(0,b.__)("Back")}),(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:n?.name})]}),g&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalSpacer,{margin:1}),(0,oe.jsx)(y.Notice,{status:g.type,onRemove:()=>v(null),children:g.message}),(0,oe.jsx)(y.__experimentalSpacer,{margin:1})]}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsx)(y.__experimentalText,{children:(0,b.__)("Choose font variants. Keep in mind that too many variants could make your site slower.")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,children:[(0,oe.jsx)(y.CheckboxControl,{className:"font-library-modal__select-all",label:(0,b.__)("Select all"),checked:V,onChange:()=>{var e;const t=null!==(e=h?.[n.source]?.filter((e=>e.slug!==n.slug)))&&void 0!==e?e:[],s=V?t:[...t,n];p({...h,[n.source]:s}),n.fontFace&&n.fontFace.forEach((e=>{V?Uc(e,"all"):Hc(e,Wc(e?.src),"all")}))},indeterminate:M,__nextHasNoMarginBottom:!0}),(0,oe.jsx)(y.__experimentalSpacer,{margin:8}),(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:(e=>e?e.fontFace&&e.fontFace.length?iu(e.fontFace):[{fontFamily:e.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[])(n).map(((e,t)=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(nu,{font:n,face:e},`face${t}`)},`face${t}`)))})]})]})]}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-end",className:"font-library-modal__footer",children:[a&&(0,oe.jsx)(y.ProgressBar,{}),T&&(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,isDestructive:!0,variant:"tertiary",onClick:()=>{m(!0)},children:(0,b.__)("Delete")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{v(null);try{await c(h),v({type:"success",message:(0,b.__)("Font family updated successfully.")})}catch(e){v({type:"error",message:(0,b.sprintf)((0,b.__)("There was an error updating the font family. %s"),e.message)})}},disabled:!S,accessibleWhenDisabled:!0,children:(0,b.__)("Update")})]})]})]})},lu=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"})}),cu=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"})});function uu(e,t,n){return t?!!n[e]?.[`${t.fontStyle}-${t.fontWeight}`]:!!n[e]}const du=function(){return(0,oe.jsx)("div",{className:"font-library__google-fonts-confirm",children:(0,oe.jsx)(y.Card,{children:(0,oe.jsxs)(y.CardBody,{children:[(0,oe.jsx)(y.__experimentalHeading,{level:2,children:(0,b.__)("Connect to Google Fonts")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:6}),(0,oe.jsx)(y.__experimentalText,{as:"p",children:(0,b.__)("To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts.")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:3}),(0,oe.jsx)(y.__experimentalText,{as:"p",children:(0,b.__)("You can alternatively upload files directly on the Upload tab.")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:6}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:()=>{window.localStorage.setItem("wp-font-library-google-fonts-permission","true"),window.dispatchEvent(new Event("storage"))},children:(0,b.__)("Allow access to Google Fonts")})]})})})};const hu=function({face:e,font:t,handleToggleVariant:n,selected:s}){const i=()=>{t?.fontFace?n(t,e):n(t)},r=t.name+" "+Lc(e),o=(0,d.useId)();return(0,oe.jsx)("div",{className:"font-library-modal__font-card",children:(0,oe.jsxs)(y.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,oe.jsx)(y.CheckboxControl,{checked:s,onChange:i,__nextHasNoMarginBottom:!0,id:o}),(0,oe.jsx)("label",{htmlFor:o,children:(0,oe.jsx)(eu,{font:e,text:r,onClick:i})})]})})},pu={slug:"all",name:(0,b._x)("All","font categories")},fu="wp-font-library-google-fonts-permission";const mu=function({slug:e}){var t;const n="google-fonts"===e,s=()=>"true"===window.localStorage.getItem(fu),[i,r]=(0,d.useState)(null),[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)([]),[u,h]=(0,d.useState)(1),[p,f]=(0,d.useState)({}),[m,g]=(0,d.useState)(n&&!s()),{collections:x,getFontCollection:w,installFonts:_,isInstalling:j}=(0,d.useContext)(Qc),S=x.find((t=>t.slug===e));(0,d.useEffect)((()=>{const e=()=>{g(n&&!s())};return e(),window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[e,n]);const C=()=>{window.localStorage.setItem(fu,"false"),window.dispatchEvent(new Event("storage"))};(0,d.useEffect)((()=>{(async()=>{try{await w(e),B()}catch(e){o||a({type:"error",message:e?.message})}})()}),[e,w,a,o]),(0,d.useEffect)((()=>{r(null)}),[e]),(0,d.useEffect)((()=>{c([])}),[i]);const k=(0,d.useMemo)((()=>{var e;return null!==(e=S?.font_families)&&void 0!==e?e:[]}),[S]),E=null!==(t=S?.categories)&&void 0!==t?t:[],P=[pu,...E],I=(0,d.useMemo)((()=>function(e,t){const{category:n,search:s}=t;let i=e||[];return n&&"all"!==n&&(i=i.filter((e=>-1!==e.categories.indexOf(n)))),s&&(i=i.filter((e=>e.font_family_settings.name.toLowerCase().includes(s.toLowerCase())))),i}(k,p)),[k,p]),T=!S?.font_families&&!o,O=Math.max(window.innerHeight,500),A=Math.floor((O-417)/61),N=Math.ceil(I.length/A),M=(u-1)*A,V=u*A,F=I.slice(M,V),R=(0,v.debounce)((e=>{f({...p,search:e}),h(1)}),300),B=()=>{f({}),h(1)},D=(e,t)=>{const n=Xc(e,t,l);c(n)},L=function(e){return e.reduce(((e,t)=>({...e,[t.slug]:(t?.fontFace||[]).reduce(((e,t)=>({...e,[`${t.fontStyle}-${t.fontWeight}`]:!0})),{})})),{})}(l),z=l.length>0?l[0]?.fontFace?.length:0,G=z>0&&z!==i?.fontFace?.length,H=z===i?.fontFace?.length;if(m)return(0,oe.jsx)(du,{});const U=()=>"google-fonts"!==e||m||i?null:(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("Actions"),popoverProps:{position:"bottom left"},controls:[{title:(0,b.__)("Revoke access to Google Fonts"),onClick:C}]});return(0,oe.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[T&&(0,oe.jsx)("div",{className:"font-library-modal__loading",children:(0,oe.jsx)(y.ProgressBar,{})}),!T&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.Navigator,{initialPath:"/",className:"font-library-modal__tabpanel-layout",children:[(0,oe.jsxs)(y.Navigator.Screen,{path:"/",children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsxs)(y.__experimentalVStack,{children:[(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,children:S.name}),(0,oe.jsx)(y.__experimentalText,{children:S.description})]}),(0,oe.jsx)(U,{})]}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsxs)(y.Flex,{children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.SearchControl,{className:"font-library-modal__search",value:p.search,placeholder:(0,b.__)("Font name…"),label:(0,b.__)("Search"),onChange:R,__nextHasNoMarginBottom:!0,hideLabelFromVision:!1})}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,b.__)("Category"),value:p.category,onChange:e=>{f({...p,category:e}),h(1)},children:P&&P.map((e=>(0,oe.jsx)("option",{value:e.slug,children:e.name},e.slug)))})})]}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),!!S?.font_families?.length&&!I.length&&(0,oe.jsx)(y.__experimentalText,{children:(0,b.__)("No fonts found. Try with a different search term")}),(0,oe.jsx)("div",{className:"font-library-modal__fonts-grid__main",children:(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:F.map((e=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(tu,{font:e.font_family_settings,navigatorPath:"/fontFamily",onClick:()=>{r(e.font_family_settings)}})},e.font_family_settings.slug)))})})]}),(0,oe.jsxs)(y.Navigator.Screen,{path:"/fontFamily",children:[(0,oe.jsxs)(y.Flex,{justify:"flex-start",children:[(0,oe.jsx)(y.Navigator.BackButton,{icon:(0,b.isRTL)()?Yo:Xo,size:"small",onClick:()=>{r(null),a(null)},label:(0,b.__)("Back")}),(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:i?.name})]}),o&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalSpacer,{margin:1}),(0,oe.jsx)(y.Notice,{status:o.type,onRemove:()=>a(null),children:o.message}),(0,oe.jsx)(y.__experimentalSpacer,{margin:1})]}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsx)(y.__experimentalText,{children:(0,b.__)("Select font variants to install.")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsx)(y.CheckboxControl,{className:"font-library-modal__select-all",label:(0,b.__)("Select all"),checked:H,onChange:()=>{c(H?[]:[i])},indeterminate:G,__nextHasNoMarginBottom:!0}),(0,oe.jsx)(y.__experimentalVStack,{spacing:0,children:(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:(W=i,W?W.fontFace&&W.fontFace.length?iu(W.fontFace):[{fontFamily:W.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[]).map(((e,t)=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(hu,{font:i,face:e,handleToggleVariant:D,selected:uu(i.slug,i.fontFace?e:null,L)})},`face${t}`)))})}),(0,oe.jsx)(y.__experimentalSpacer,{margin:16})]})]}),i&&(0,oe.jsx)(y.Flex,{justify:"flex-end",className:"font-library-modal__footer",children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{a(null);const e=l[0];try{e?.fontFace&&await Promise.all(e.fontFace.map((async e=>{e.src&&(e.file=await async function(e){e=Array.isArray(e)?e:[e];const t=await Promise.all(e.map((async e=>fetch(new Request(e)).then((t=>{if(!t.ok)throw new Error(`Error downloading font face asset from ${e}. Server responded with status: ${t.status}`);return t.blob()})).then((t=>{const n=e.split("/").pop();return new Rc([t],n,{type:t.type})})))));return 1===t.length?t[0]:t}(e.src))})))}catch(e){return void a({type:"error",message:(0,b.__)("Error installing the fonts, could not be downloaded.")})}try{await _([e]),a({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){a({type:"error",message:e.message})}c([])},isBusy:j,disabled:0===l.length||j,accessibleWhenDisabled:!0,children:(0,b.__)("Install")})}),!i&&(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,className:"font-library-modal__footer",justify:"end",spacing:6,children:[(0,oe.jsx)(y.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"font-library-modal__page-selection",children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b._x)("<div>Page</div>%1$s<div>of %2$s</div>","paging"),"<CurrentPage />",N),{div:(0,oe.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,oe.jsx)(y.SelectControl,{"aria-label":(0,b.__)("Current page"),value:u,options:[...Array(N)].map(((e,t)=>({label:t+1,value:t+1}))),onChange:e=>h(parseInt(e)),size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,oe.jsx)(y.Button,{onClick:()=>h(u-1),disabled:1===u,accessibleWhenDisabled:!0,label:(0,b.__)("Previous page"),icon:(0,b.isRTL)()?lu:cu,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,oe.jsx)(y.Button,{onClick:()=>h(u+1),disabled:u===N,accessibleWhenDisabled:!0,label:(0,b.__)("Next page"),icon:(0,b.isRTL)()?cu:lu,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})]})]});var W};var gu=i(8572),vu=i.n(gu),xu=i(4660),yu=i.n(xu);globalThis.fetch;class bu{constructor(e,t={},n){this.type=e,this.detail=t,this.msg=n,Object.defineProperty(this,"__mayPropagate",{enumerable:!1,writable:!0}),this.__mayPropagate=!0}preventDefault(){}stopPropagation(){this.__mayPropagate=!1}valueOf(){return this}toString(){return this.msg?`[${this.type} event]: ${this.msg}`:`[${this.type} event]`}}class wu{constructor(){this.listeners={}}addEventListener(e,t,n){let s=this.listeners[e]||[];n?s.unshift(t):s.push(t),this.listeners[e]=s}removeEventListener(e,t){let n=this.listeners[e]||[],s=n.findIndex((e=>e===t));s>-1&&(n.splice(s,1),this.listeners[e]=n)}dispatch(e){let t=this.listeners[e.type];if(t)for(let n=0,s=t.length;n<s&&e.__mayPropagate;n++)t[n](e)}}const _u=new Date("1904-01-01T00:00:00+0000").getTime();class ju{constructor(e,t,n){this.name=(n||e.tag||"").trim(),this.length=e.length,this.start=e.offset,this.offset=0,this.data=t,["getInt8","getUint8","getInt16","getUint16","getInt32","getUint32","getBigInt64","getBigUint64"].forEach((e=>{let t=e.replace(/get(Big)?/,"").toLowerCase(),n=parseInt(e.replace(/[^\d]/g,""))/8;Object.defineProperty(this,t,{get:()=>this.getValue(e,n)})}))}get currentPosition(){return this.start+this.offset}set currentPosition(e){this.start=e,this.offset=0}skip(e=0,t=8){this.offset+=e*t/8}getValue(e,t){let n=this.start+this.offset;this.offset+=t;try{return this.data[e](n)}catch(n){throw console.error("parser",e,t,this),console.error("parser",this.start,this.offset),n}}flags(e){if(8===e||16===e||32===e||64===e)return this[`uint${e}`].toString(2).padStart(e,0).split("").map((e=>"1"===e));console.error("Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long"),console.trace()}get tag(){const e=this.uint32;return t=[e>>24&255,e>>16&255,e>>8&255,255&e],Array.from(t).map((e=>String.fromCharCode(e))).join("");var t}get fixed(){return this.int16+Math.round(1e3*this.uint16/65356)/1e3}get legacyFixed(){let e=this.uint16,t=this.uint16.toString(16).padStart(4,0);return parseFloat(`${e}.${t}`)}get uint24(){return(this.uint8<<16)+(this.uint8<<8)+this.uint8}get uint128(){let e=0;for(let t=0;t<5;t++){let t=this.uint8;if(e=128*e+(127&t),t<128)break}return e}get longdatetime(){return new Date(_u+1e3*parseInt(this.int64.toString()))}get fword(){return this.int16}get ufword(){return this.uint16}get Offset16(){return this.uint16}get Offset32(){return this.uint32}get F2DOT14(){const e=p.uint16;return[0,1,-2,-1][e>>14]+(16383&e)/16384}verifyLength(){this.offset!=this.length&&console.error(`unexpected parsed table size (${this.offset}) for "${this.name}" (expected ${this.length})`)}readBytes(e=0,t=0,n=8,s=!1){if(0===(e=e||this.length))return[];t&&(this.currentPosition=t);const i=`${s?"":"u"}int${n}`,r=[];for(;e--;)r.push(this[i]);return r}}class Su{constructor(e){const t={enumerable:!1,get:()=>e};Object.defineProperty(this,"parser",t);const n=e.currentPosition,s={enumerable:!1,get:()=>n};Object.defineProperty(this,"start",s)}load(e){Object.keys(e).forEach((t=>{let n=Object.getOwnPropertyDescriptor(e,t);n.get?this[t]=n.get.bind(this):void 0!==n.value&&(this[t]=n.value)})),this.parser.length&&this.parser.verifyLength()}}class Cu extends Su{constructor(e,t,n){const{parser:s,start:i}=super(new ju(e,t,n)),r={enumerable:!1,get:()=>s};Object.defineProperty(this,"p",r);const o={enumerable:!1,get:()=>i};Object.defineProperty(this,"tableStart",o)}}function ku(e,t,n){let s;Object.defineProperty(e,t,{get:()=>s||(s=n(),s),enumerable:!0})}class Eu extends Cu{constructor(e,t,n){const{p:s}=super({offset:0,length:12},t,"sfnt");this.version=s.uint32,this.numTables=s.uint16,this.searchRange=s.uint16,this.entrySelector=s.uint16,this.rangeShift=s.uint16,s.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Pu(s))),this.tables={},this.directory.forEach((e=>{ku(this.tables,e.tag.trim(),(()=>n(this.tables,{tag:e.tag,offset:e.offset,length:e.length},t)))}))}}class Pu{constructor(e){this.tag=e.tag,this.checksum=e.uint32,this.offset=e.uint32,this.length=e.uint32}}const Iu=yu().inflate||void 0;let Tu;class Ou extends Cu{constructor(e,t,n){const{p:s}=super({offset:0,length:44},t,"woff");this.signature=s.tag,this.flavor=s.uint32,this.length=s.uint32,this.numTables=s.uint16,s.uint16,this.totalSfntSize=s.uint32,this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.metaOffset=s.uint32,this.metaLength=s.uint32,this.metaOrigLength=s.uint32,this.privOffset=s.uint32,this.privLength=s.uint32,s.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Au(s))),Nu(this,t,n)}}class Au{constructor(e){this.tag=e.tag,this.offset=e.uint32,this.compLength=e.uint32,this.origLength=e.uint32,this.origChecksum=e.uint32}}function Nu(e,t,n){e.tables={},e.directory.forEach((s=>{ku(e.tables,s.tag.trim(),(()=>{let i=0,r=t;if(s.compLength!==s.origLength){const e=t.buffer.slice(s.offset,s.offset+s.compLength);let n;if(Iu)n=Iu(new Uint8Array(e));else{if(!Tu){const e="no brotli decoder available to decode WOFF2 font";throw font.onerror&&font.onerror(e),new Error(e)}n=Tu(new Uint8Array(e))}r=new DataView(n.buffer)}else i=s.offset;return n(e.tables,{tag:s.tag,offset:i,length:s.origLength},r)}))}))}const Mu=vu();let Vu;class Fu extends Cu{constructor(e,t,n){const{p:s}=super({offset:0,length:48},t,"woff2");this.signature=s.tag,this.flavor=s.uint32,this.length=s.uint32,this.numTables=s.uint16,s.uint16,this.totalSfntSize=s.uint32,this.totalCompressedSize=s.uint32,this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.metaOffset=s.uint32,this.metaLength=s.uint32,this.metaOrigLength=s.uint32,this.privOffset=s.uint32,this.privLength=s.uint32,s.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Ru(s)));let i,r=s.currentPosition;this.directory[0].offset=0,this.directory.forEach(((e,t)=>{let n=this.directory[t+1];n&&(n.offset=e.offset+(void 0!==e.transformLength?e.transformLength:e.origLength))}));let o=t.buffer.slice(r);if(Mu)i=Mu(new Uint8Array(o));else{if(!Vu){const t="no brotli decoder available to decode WOFF2 font";throw e.onerror&&e.onerror(t),new Error(t)}i=new Uint8Array(Vu(o))}!function(e,t,n){e.tables={},e.directory.forEach((s=>{ku(e.tables,s.tag.trim(),(()=>{const i=s.offset,r=i+(s.transformLength?s.transformLength:s.origLength),o=new DataView(t.slice(i,r).buffer);try{return n(e.tables,{tag:s.tag,offset:0,length:s.origLength},o)}catch(e){console.error(e)}}))}))}(this,i,n)}}class Ru{constructor(e){this.flags=e.uint8;const t=this.tagNumber=63&this.flags;this.tag=63===t?e.tag:["cmap","head","hhea","hmtx","maxp","name","OS/2","post","cvt ","fpgm","glyf","loca","prep","CFF ","VORG","EBDT","EBLC","gasp","hdmx","kern","LTSH","PCLT","VDMX","vhea","vmtx","BASE","GDEF","GPOS","GSUB","EBSC","JSTF","MATH","CBDT","CBLC","COLR","CPAL","SVG ","sbix","acnt","avar","bdat","bloc","bsln","cvar","fdsc","feat","fmtx","fvar","gvar","hsty","just","lcar","mort","morx","opbd","prop","trak","Zapf","Silf","Glat","Gloc","Feat","Sill"][63&t];let n=0!==(this.transformVersion=(192&this.flags)>>6);"glyf"!==this.tag&&"loca"!==this.tag||(n=3!==this.transformVersion),this.origLength=e.uint128,n&&(this.transformLength=e.uint128)}}const Bu={};let Du=!1;function Lu(e,t,n){let s=t.tag.replace(/[^\w\d]/g,""),i=Bu[s];return i?new i(t,n,e):(console.warn(`lib-font has no definition for ${s}. The table was skipped.`),{})}function zu(){let e=0;function t(n,s){if(!Du)return e>10?s(new Error("loading took too long")):(e++,setTimeout((()=>t(n)),250));n(Lu)}return new Promise(((e,n)=>t(e)))}async function Gu(e,t,n={}){if(!globalThis.document)return;let s=function(e,t){let n=e.lastIndexOf("."),s=(e.substring(n+1)||"").toLowerCase(),i={ttf:"truetype",otf:"opentype",woff:"woff",woff2:"woff2"}[s];if(i)return i;let r={eot:"The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.",svg:"The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.",fon:"The .fon format is not supported: this is an ancient Windows bitmap font format.",ttc:"Based on the current CSS specification, font collections are not (yet?) supported."}[s];if(r||(r=`${e} is not a known webfont format.`),t)throw new Error(r);console.warn(`Could not load font: ${r}`)}(t,n.errorOnStyle);if(!s)return;let i=document.createElement("style");i.className="injected-by-Font-js";let r=[];return n.styleRules&&(r=Object.entries(n.styleRules).map((([e,t])=>`${e}: ${t};`))),i.textContent=`\n@font-face {\n font-family: "${e}";\n ${r.join("\n\t")}\n src: url("${t}") format("${s}");\n}`,globalThis.document.head.appendChild(i),i}Promise.all([Promise.resolve().then((function(){return dd})),Promise.resolve().then((function(){return hd})),Promise.resolve().then((function(){return pd})),Promise.resolve().then((function(){return md})),Promise.resolve().then((function(){return gd})),Promise.resolve().then((function(){return yd})),Promise.resolve().then((function(){return bd})),Promise.resolve().then((function(){return _d})),Promise.resolve().then((function(){return Nd})),Promise.resolve().then((function(){return Wd})),Promise.resolve().then((function(){return Gh})),Promise.resolve().then((function(){return Hh})),Promise.resolve().then((function(){return qh})),Promise.resolve().then((function(){return Yh})),Promise.resolve().then((function(){return Xh})),Promise.resolve().then((function(){return Jh})),Promise.resolve().then((function(){return $h})),Promise.resolve().then((function(){return ep})),Promise.resolve().then((function(){return tp})),Promise.resolve().then((function(){return np})),Promise.resolve().then((function(){return sp})),Promise.resolve().then((function(){return ip})),Promise.resolve().then((function(){return op})),Promise.resolve().then((function(){return dp})),Promise.resolve().then((function(){return pp})),Promise.resolve().then((function(){return fp})),Promise.resolve().then((function(){return mp})),Promise.resolve().then((function(){return gp})),Promise.resolve().then((function(){return vp})),Promise.resolve().then((function(){return bp})),Promise.resolve().then((function(){return Cp})),Promise.resolve().then((function(){return Pp})),Promise.resolve().then((function(){return Tp})),Promise.resolve().then((function(){return Np})),Promise.resolve().then((function(){return Mp})),Promise.resolve().then((function(){return Vp})),Promise.resolve().then((function(){return Rp})),Promise.resolve().then((function(){return Bp})),Promise.resolve().then((function(){return Gp})),Promise.resolve().then((function(){return Hp})),Promise.resolve().then((function(){return Wp}))]).then((e=>{e.forEach((e=>{let t=Object.keys(e)[0];Bu[t]=e[t]})),Du=!0}));const Hu=[0,1,0,0],Uu=[79,84,84,79],Wu=[119,79,70,70],qu=[119,79,70,50];function Zu(e,t){if(e.length===t.length){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return;return!0}}class Ku extends wu{constructor(e,t={}){super(),this.name=e,this.options=t,this.metrics=!1}get src(){return this.__src}set src(e){this.__src=e,(async()=>{globalThis.document&&!this.options.skipStyleSheet&&await Gu(this.name,e,this.options),this.loadFont(e)})()}async loadFont(e,t){fetch(e).then((e=>function(e){if(!e.ok)throw new Error(`HTTP ${e.status} - ${e.statusText}`);return e}(e)&&e.arrayBuffer())).then((n=>this.fromDataBuffer(n,t||e))).catch((n=>{const s=new bu("error",n,`Failed to load font at ${t||e}`);this.dispatch(s),this.onerror&&this.onerror(s)}))}async fromDataBuffer(e,t){this.fontData=new DataView(e);let n=function(e){const t=[e.getUint8(0),e.getUint8(1),e.getUint8(2),e.getUint8(3)];return Zu(t,Hu)||Zu(t,Uu)?"SFNT":Zu(t,Wu)?"WOFF":Zu(t,qu)?"WOFF2":void 0}(this.fontData);if(!n)throw new Error(`${t} is either an unsupported font format, or not a font at all.`);await this.parseBasicData(n);const s=new bu("load",{font:this});this.dispatch(s),this.onload&&this.onload(s)}async parseBasicData(e){return zu().then((t=>("SFNT"===e&&(this.opentype=new Eu(this,this.fontData,t)),"WOFF"===e&&(this.opentype=new Ou(this,this.fontData,t)),"WOFF2"===e&&(this.opentype=new Fu(this,this.fontData,t)),this.opentype)))}getGlyphId(e){return this.opentype.tables.cmap.getGlyphId(e)}reverse(e){return this.opentype.tables.cmap.reverse(e)}supports(e){return 0!==this.getGlyphId(e)}supportsVariation(e){return!1!==this.opentype.tables.cmap.supportsVariation(e)}measureText(e,t=16){if(this.__unloaded)throw new Error("Cannot measure text: font was unloaded. Please reload before calling measureText()");let n=document.createElement("div");n.textContent=e,n.style.fontFamily=this.name,n.style.fontSize=`${t}px`,n.style.color="transparent",n.style.background="transparent",n.style.top="0",n.style.left="0",n.style.position="absolute",document.body.appendChild(n);let s=n.getBoundingClientRect();document.body.removeChild(n);const i=this.opentype.tables["OS/2"];return s.fontSize=t,s.ascender=i.sTypoAscender,s.descender=i.sTypoDescender,s}unload(){if(this.styleElement.parentNode){this.styleElement.parentNode.removeElement(this.styleElement);const e=new bu("unload",{font:this});this.dispatch(e),this.onunload&&this.onunload(e)}this._unloaded=!0}load(){if(this.__unloaded){delete this.__unloaded,document.head.appendChild(this.styleElement);const e=new bu("load",{font:this});this.dispatch(e),this.onload&&this.onload(e)}}}globalThis.Font=Ku;class Yu extends Su{constructor(e,t,n){super(e),this.plaformID=t,this.encodingID=n}}class Xu extends Yu{constructor(e,t,n){super(e,t,n),this.format=0,this.length=e.uint16,this.language=e.uint16,this.glyphIdArray=[...new Array(256)].map((t=>e.uint8))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.")),0<=e&&e<=255}reverse(e){return console.warn("reverse not implemented for cmap subtable format 0"),{}}getSupportedCharCodes(){return[{start:1,end:256}]}}class Ju extends Yu{constructor(e,t,n){super(e,t,n),this.format=2,this.length=e.uint16,this.language=e.uint16,this.subHeaderKeys=[...new Array(256)].map((t=>e.uint16));const s=Math.max(...this.subHeaderKeys),i=e.currentPosition;ku(this,"subHeaders",(()=>(e.currentPosition=i,[...new Array(s)].map((t=>new Qu(e))))));const r=i+8*s;ku(this,"glyphIndexArray",(()=>(e.currentPosition=r,[...new Array(s)].map((t=>e.uint16)))))}supports(e){e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented."));const t=e&&255,n=e&&65280,s=this.subHeaders[n],i=this.subHeaders[s],r=i.firstCode,o=r+i.entryCount;return r<=t&&t<=o}reverse(e){return console.warn("reverse not implemented for cmap subtable format 2"),{}}getSupportedCharCodes(e=!1){return e?this.subHeaders.map((e=>({firstCode:e.firstCode,lastCode:e.lastCode}))):this.subHeaders.map((e=>({start:e.firstCode,end:e.lastCode})))}}class Qu{constructor(e){this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.first+this.entryCount,this.idDelta=e.int16,this.idRangeOffset=e.uint16}}class $u extends Yu{constructor(e,t,n){super(e,t,n),this.format=4,this.length=e.uint16,this.language=e.uint16,this.segCountX2=e.uint16,this.segCount=this.segCountX2/2,this.searchRange=e.uint16,this.entrySelector=e.uint16,this.rangeShift=e.uint16;const s=e.currentPosition;ku(this,"endCode",(()=>e.readBytes(this.segCount,s,16)));const i=s+2+this.segCountX2;ku(this,"startCode",(()=>e.readBytes(this.segCount,i,16)));const r=i+this.segCountX2;ku(this,"idDelta",(()=>e.readBytes(this.segCount,r,16,!0)));const o=r+this.segCountX2;ku(this,"idRangeOffset",(()=>e.readBytes(this.segCount,o,16)));const a=o+this.segCountX2,l=this.length-(a-this.tableStart);ku(this,"glyphIdArray",(()=>e.readBytes(l,a,16))),ku(this,"segments",(()=>this.buildSegments(o,a,e)))}buildSegments(e,t,n){return[...new Array(this.segCount)].map(((t,s)=>{let i=this.startCode[s],r=this.endCode[s],o=this.idDelta[s],a=this.idRangeOffset[s],l=e+2*s,c=[];if(0===a)for(let e=i+o,t=r+o;e<=t;e++)c.push(e);else for(let e=0,t=r-i;e<=t;e++)n.currentPosition=l+a+2*e,c.push(n.uint16);return{startCode:i,endCode:r,idDelta:o,idRangeOffset:a,glyphIDs:c}}))}reverse(e){let t=this.segments.find((t=>t.glyphIDs.includes(e)));if(!t)return{};const n=t.startCode+t.glyphIDs.indexOf(e);return{code:n,unicode:String.fromCodePoint(n)}}getGlyphId(e){if(e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343)return 0;if(!(65534&~e&&65535&~e))return 0;let t=this.segments.find((t=>t.startCode<=e&&e<=t.endCode));return t?t.glyphIDs[e-t.startCode]:0}supports(e){return 0!==this.getGlyphId(e)}getSupportedCharCodes(e=!1){return e?this.segments:this.segments.map((e=>({start:e.startCode,end:e.endCode})))}}class ed extends Yu{constructor(e,t,n){super(e,t,n),this.format=6,this.length=e.uint16,this.language=e.uint16,this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.firstCode+this.entryCount-1;ku(this,"glyphIdArray",(()=>[...new Array(this.entryCount)].map((t=>e.uint16))))}supports(e){if(e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.")),e<this.firstCode)return{};if(e>this.firstCode+this.entryCount)return{};const t=e-this.firstCode;return{code:t,unicode:String.fromCodePoint(t)}}reverse(e){let t=this.glyphIdArray.indexOf(e);if(t>-1)return this.firstCode+t}getSupportedCharCodes(e=!1){return e?[{firstCode:this.firstCode,lastCode:this.lastCode}]:[{start:this.firstCode,end:this.lastCode}]}}class td extends Yu{constructor(e,t,n){super(e,t,n),this.format=8,e.uint16,this.length=e.uint32,this.language=e.uint32,this.is32=[...new Array(8192)].map((t=>e.uint8)),this.numGroups=e.uint32;ku(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new nd(e)))))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.")),-1!==this.groups.findIndex((t=>t.startcharCode<=e&&e<=t.endcharCode))}reverse(e){return console.warn("reverse not implemented for cmap subtable format 8"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startcharCode,end:e.endcharCode})))}}class nd{constructor(e){this.startcharCode=e.uint32,this.endcharCode=e.uint32,this.startGlyphID=e.uint32}}class sd extends Yu{constructor(e,t,n){super(e,t,n),this.format=10,e.uint16,this.length=e.uint32,this.language=e.uint32,this.startCharCode=e.uint32,this.numChars=e.uint32,this.endCharCode=this.startCharCode+this.numChars;ku(this,"glyphs",(()=>[...new Array(this.numChars)].map((t=>e.uint16))))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.")),!(e<this.startCharCode)&&(!(e>this.startCharCode+this.numChars)&&e-this.startCharCode)}reverse(e){return console.warn("reverse not implemented for cmap subtable format 10"),{}}getSupportedCharCodes(e=!1){return e?[{startCharCode:this.startCharCode,endCharCode:this.endCharCode}]:[{start:this.startCharCode,end:this.endCharCode}]}}class id extends Yu{constructor(e,t,n){super(e,t,n),this.format=12,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;ku(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new rd(e)))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343?0:65534&~e&&65535&~e?-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode)):0}reverse(e){for(let t of this.groups){let n=t.startGlyphID;if(n>e)continue;if(n===e)return t.startCharCode;if(n+(t.endCharCode-t.startCharCode)<e)continue;const s=t.startCharCode+(e-n);return{code:s,unicode:String.fromCodePoint(s)}}return{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startCharCode,end:e.endCharCode})))}}class rd{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.startGlyphID=e.uint32}}class od extends Yu{constructor(e,t,n){super(e,t,n),this.format=13,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;ku(this,"groups",[...new Array(this.numGroups)].map((t=>new ad(e))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode))}reverse(e){return console.warn("reverse not implemented for cmap subtable format 13"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startCharCode,end:e.endCharCode})))}}class ad{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.glyphID=e.uint32}}class ld extends Yu{constructor(e,t,n){super(e,t,n),this.subTableStart=e.currentPosition,this.format=14,this.length=e.uint32,this.numVarSelectorRecords=e.uint32,ku(this,"varSelectors",(()=>[...new Array(this.numVarSelectorRecords)].map((t=>new cd(e)))))}supports(){return console.warn("supports not implemented for cmap subtable format 14"),0}getSupportedCharCodes(){return console.warn("getSupportedCharCodes not implemented for cmap subtable format 14"),[]}reverse(e){return console.warn("reverse not implemented for cmap subtable format 14"),{}}supportsVariation(e){let t=this.varSelector.find((t=>t.varSelector===e));return t||!1}getSupportedVariations(){return this.varSelectors.map((e=>e.varSelector))}}class cd{constructor(e){this.varSelector=e.uint24,this.defaultUVSOffset=e.Offset32,this.nonDefaultUVSOffset=e.Offset32}}class ud{constructor(e,t){const n=this.platformID=e.uint16,s=this.encodingID=e.uint16,i=this.offset=e.Offset32;ku(this,"table",(()=>(e.currentPosition=t+i,function(e,t,n){const s=e.uint16;return 0===s?new Xu(e,t,n):2===s?new Ju(e,t,n):4===s?new $u(e,t,n):6===s?new ed(e,t,n):8===s?new td(e,t,n):10===s?new sd(e,t,n):12===s?new id(e,t,n):13===s?new od(e,t,n):14===s?new ld(e,t,n):{}}(e,n,s))))}}var dd=Object.freeze({__proto__:null,cmap:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numTables=n.uint16,this.encodingRecords=[...new Array(this.numTables)].map((e=>new ud(n,this.tableStart)))}getSubTable(e){return this.encodingRecords[e].table}getSupportedEncodings(){return this.encodingRecords.map((e=>({platformID:e.platformID,encodingId:e.encodingID})))}getSupportedCharCodes(e,t){const n=this.encodingRecords.findIndex((n=>n.platformID===e&&n.encodingID===t));if(-1===n)return!1;return this.getSubTable(n).getSupportedCharCodes()}reverse(e){for(let t=0;t<this.numTables;t++){let n=this.getSubTable(t).reverse(e);if(n)return n}}getGlyphId(e){let t=0;return this.encodingRecords.some(((n,s)=>{let i=this.getSubTable(s);return!!i.getGlyphId&&(t=i.getGlyphId(e),0!==t)})),t}supports(e){return this.encodingRecords.some(((t,n)=>{const s=this.getSubTable(n);return s.supports&&!1!==s.supports(e)}))}supportsVariation(e){return this.encodingRecords.some(((t,n)=>{const s=this.getSubTable(n);return s.supportsVariation&&!1!==s.supportsVariation(e)}))}}});var hd=Object.freeze({__proto__:null,head:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.load({majorVersion:n.uint16,minorVersion:n.uint16,fontRevision:n.fixed,checkSumAdjustment:n.uint32,magicNumber:n.uint32,flags:n.flags(16),unitsPerEm:n.uint16,created:n.longdatetime,modified:n.longdatetime,xMin:n.int16,yMin:n.int16,xMax:n.int16,yMax:n.int16,macStyle:n.flags(16),lowestRecPPEM:n.uint16,fontDirectionHint:n.uint16,indexToLocFormat:n.uint16,glyphDataFormat:n.uint16})}}});var pd=Object.freeze({__proto__:null,hhea:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.ascender=n.fword,this.descender=n.fword,this.lineGap=n.fword,this.advanceWidthMax=n.ufword,this.minLeftSideBearing=n.fword,this.minRightSideBearing=n.fword,this.xMaxExtent=n.fword,this.caretSlopeRise=n.int16,this.caretSlopeRun=n.int16,this.caretOffset=n.int16,n.int16,n.int16,n.int16,n.int16,this.metricDataFormat=n.int16,this.numberOfHMetrics=n.uint16,n.verifyLength()}}});class fd{constructor(e,t){this.advanceWidth=e,this.lsb=t}}var md=Object.freeze({__proto__:null,hmtx:class extends Cu{constructor(e,t,n){const{p:s}=super(e,t),i=n.hhea.numberOfHMetrics,r=n.maxp.numGlyphs,o=s.currentPosition;if(ku(this,"hMetrics",(()=>(s.currentPosition=o,[...new Array(i)].map((e=>new fd(s.uint16,s.int16)))))),i<r){const e=o+4*i;ku(this,"leftSideBearings",(()=>(s.currentPosition=e,[...new Array(r-i)].map((e=>s.int16)))))}}}});var gd=Object.freeze({__proto__:null,maxp:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.legacyFixed,this.numGlyphs=n.uint16,1===this.version&&(this.maxPoints=n.uint16,this.maxContours=n.uint16,this.maxCompositePoints=n.uint16,this.maxCompositeContours=n.uint16,this.maxZones=n.uint16,this.maxTwilightPoints=n.uint16,this.maxStorage=n.uint16,this.maxFunctionDefs=n.uint16,this.maxInstructionDefs=n.uint16,this.maxStackElements=n.uint16,this.maxSizeOfInstructions=n.uint16,this.maxComponentElements=n.uint16,this.maxComponentDepth=n.uint16),n.verifyLength()}}});class vd{constructor(e,t){this.length=e,this.offset=t}}class xd{constructor(e,t){this.platformID=e.uint16,this.encodingID=e.uint16,this.languageID=e.uint16,this.nameID=e.uint16,this.length=e.uint16,this.offset=e.Offset16,ku(this,"string",(()=>(e.currentPosition=t.stringStart+this.offset,function(e,t){const{platformID:n,length:s}=t;if(0===s)return"";if(0===n||3===n){const t=[];for(let n=0,i=s/2;n<i;n++)t[n]=String.fromCharCode(e.uint16);return t.join("")}const i=e.readBytes(s),r=[];return i.forEach((function(e,t){r[t]=String.fromCharCode(e)})),r.join("")}(e,this))))}}var yd=Object.freeze({__proto__:null,name:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.format=n.uint16,this.count=n.uint16,this.stringOffset=n.Offset16,this.nameRecords=[...new Array(this.count)].map((e=>new xd(n,this))),1===this.format&&(this.langTagCount=n.uint16,this.langTagRecords=[...new Array(this.langTagCount)].map((e=>new vd(n.uint16,n.Offset16)))),this.stringStart=this.tableStart+this.stringOffset}get(e){let t=this.nameRecords.find((t=>t.nameID===e));if(t)return t.string}}});var bd=Object.freeze({__proto__:null,OS2:class extends Cu{constructor(e,t){const{p:n}=super(e,t);return this.version=n.uint16,this.xAvgCharWidth=n.int16,this.usWeightClass=n.uint16,this.usWidthClass=n.uint16,this.fsType=n.uint16,this.ySubscriptXSize=n.int16,this.ySubscriptYSize=n.int16,this.ySubscriptXOffset=n.int16,this.ySubscriptYOffset=n.int16,this.ySuperscriptXSize=n.int16,this.ySuperscriptYSize=n.int16,this.ySuperscriptXOffset=n.int16,this.ySuperscriptYOffset=n.int16,this.yStrikeoutSize=n.int16,this.yStrikeoutPosition=n.int16,this.sFamilyClass=n.int16,this.panose=[...new Array(10)].map((e=>n.uint8)),this.ulUnicodeRange1=n.flags(32),this.ulUnicodeRange2=n.flags(32),this.ulUnicodeRange3=n.flags(32),this.ulUnicodeRange4=n.flags(32),this.achVendID=n.tag,this.fsSelection=n.uint16,this.usFirstCharIndex=n.uint16,this.usLastCharIndex=n.uint16,this.sTypoAscender=n.int16,this.sTypoDescender=n.int16,this.sTypoLineGap=n.int16,this.usWinAscent=n.uint16,this.usWinDescent=n.uint16,0===this.version?n.verifyLength():(this.ulCodePageRange1=n.flags(32),this.ulCodePageRange2=n.flags(32),1===this.version?n.verifyLength():(this.sxHeight=n.int16,this.sCapHeight=n.int16,this.usDefaultChar=n.uint16,this.usBreakChar=n.uint16,this.usMaxContext=n.uint16,this.version<=4?n.verifyLength():(this.usLowerOpticalPointSize=n.uint16,this.usUpperOpticalPointSize=n.uint16,5===this.version?n.verifyLength():void 0)))}}});const wd=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];var _d=Object.freeze({__proto__:null,post:class extends Cu{constructor(e,t){const{p:n}=super(e,t);if(this.version=n.legacyFixed,this.italicAngle=n.fixed,this.underlinePosition=n.fword,this.underlineThickness=n.fword,this.isFixedPitch=n.uint32,this.minMemType42=n.uint32,this.maxMemType42=n.uint32,this.minMemType1=n.uint32,this.maxMemType1=n.uint32,1===this.version||3===this.version)return n.verifyLength();if(this.numGlyphs=n.uint16,2===this.version){this.glyphNameIndex=[...new Array(this.numGlyphs)].map((e=>n.uint16)),this.namesOffset=n.currentPosition,this.glyphNameOffsets=[1];for(let e=0;e<this.numGlyphs;e++){if(this.glyphNameIndex[e]<wd.length){this.glyphNameOffsets.push(this.glyphNameOffsets[e]);continue}let t=n.int8;n.skip(t),this.glyphNameOffsets.push(this.glyphNameOffsets[e]+t+1)}}2.5===this.version&&(this.offset=[...new Array(this.numGlyphs)].map((e=>n.int8)))}getGlyphName(e){if(2!==this.version)return console.warn(`post table version ${this.version} does not support glyph name lookups`),"";let t=this.glyphNameIndex[e];if(t<258)return wd[t];let n=this.glyphNameOffsets[e],s=this.glyphNameOffsets[e+1]-n-1;if(0===s)return".notdef.";this.parser.currentPosition=this.namesOffset+n;return this.parser.readBytes(s,this.namesOffset+n,8,!0).map((e=>String.fromCharCode(e))).join("")}}});class jd extends Cu{constructor(e,t){const{p:n}=super(e,t,"AxisTable");this.baseTagListOffset=n.Offset16,this.baseScriptListOffset=n.Offset16,ku(this,"baseTagList",(()=>new Sd({offset:e.offset+this.baseTagListOffset},t))),ku(this,"baseScriptList",(()=>new Cd({offset:e.offset+this.baseScriptListOffset},t)))}}class Sd extends Cu{constructor(e,t){const{p:n}=super(e,t,"BaseTagListTable");this.baseTagCount=n.uint16,this.baselineTags=[...new Array(this.baseTagCount)].map((e=>n.tag))}}class Cd extends Cu{constructor(e,t){const{p:n}=super(e,t,"BaseScriptListTable");this.baseScriptCount=n.uint16;const s=n.currentPosition;ku(this,"baseScriptRecords",(()=>(n.currentPosition=s,[...new Array(this.baseScriptCount)].map((e=>new kd(this.start,n))))))}}class kd{constructor(e,t){this.baseScriptTag=t.tag,this.baseScriptOffset=t.Offset16,ku(this,"baseScriptTable",(()=>(t.currentPosition=e+this.baseScriptOffset,new Ed(t))))}}class Ed{constructor(e){this.start=e.currentPosition,this.baseValuesOffset=e.Offset16,this.defaultMinMaxOffset=e.Offset16,this.baseLangSysCount=e.uint16,this.baseLangSysRecords=[...new Array(this.baseLangSysCount)].map((t=>new Pd(this.start,e))),ku(this,"baseValues",(()=>(e.currentPosition=this.start+this.baseValuesOffset,new Id(e)))),ku(this,"defaultMinMax",(()=>(e.currentPosition=this.start+this.defaultMinMaxOffset,new Td(e))))}}class Pd{constructor(e,t){this.baseLangSysTag=t.tag,this.minMaxOffset=t.Offset16,ku(this,"minMax",(()=>(t.currentPosition=e+this.minMaxOffset,new Td(t))))}}class Id{constructor(e){this.parser=e,this.start=e.currentPosition,this.defaultBaselineIndex=e.uint16,this.baseCoordCount=e.uint16,this.baseCoords=[...new Array(this.baseCoordCount)].map((t=>e.Offset16))}getTable(e){return this.parser.currentPosition=this.start+this.baseCoords[e],new Ad(this.parser)}}class Td{constructor(e){this.minCoord=e.Offset16,this.maxCoord=e.Offset16,this.featMinMaxCount=e.uint16;const t=e.currentPosition;ku(this,"featMinMaxRecords",(()=>(e.currentPosition=t,[...new Array(this.featMinMaxCount)].map((t=>new Od(e))))))}}class Od{constructor(e){this.featureTableTag=e.tag,this.minCoord=e.Offset16,this.maxCoord=e.Offset16}}class Ad{constructor(e){this.baseCoordFormat=e.uint16,this.coordinate=e.int16,2===this.baseCoordFormat&&(this.referenceGlyph=e.uint16,this.baseCoordPoint=e.uint16),3===this.baseCoordFormat&&(this.deviceTable=e.Offset16)}}var Nd=Object.freeze({__proto__:null,BASE:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.horizAxisOffset=n.Offset16,this.vertAxisOffset=n.Offset16,ku(this,"horizAxis",(()=>new jd({offset:e.offset+this.horizAxisOffset},t))),ku(this,"vertAxis",(()=>new jd({offset:e.offset+this.vertAxisOffset},t))),1===this.majorVersion&&1===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,ku(this,"itemVarStore",(()=>new jd({offset:e.offset+this.itemVarStoreOffset},t))))}}});class Md{constructor(e){this.classFormat=e.uint16,1===this.classFormat&&(this.startGlyphID=e.uint16,this.glyphCount=e.uint16,this.classValueArray=[...new Array(this.glyphCount)].map((t=>e.uint16))),2===this.classFormat&&(this.classRangeCount=e.uint16,this.classRangeRecords=[...new Array(this.classRangeCount)].map((t=>new Vd(e))))}}class Vd{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.class=e.uint16}}class Fd extends Su{constructor(e){super(e),this.coverageFormat=e.uint16,1===this.coverageFormat&&(this.glyphCount=e.uint16,this.glyphArray=[...new Array(this.glyphCount)].map((t=>e.uint16))),2===this.coverageFormat&&(this.rangeCount=e.uint16,this.rangeRecords=[...new Array(this.rangeCount)].map((t=>new Rd(e))))}}class Rd{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.startCoverageIndex=e.uint16}}class Bd{constructor(e,t){this.table=e,this.parser=t,this.start=t.currentPosition,this.format=t.uint16,this.variationRegionListOffset=t.Offset32,this.itemVariationDataCount=t.uint16,this.itemVariationDataOffsets=[...new Array(this.itemVariationDataCount)].map((e=>t.Offset32))}}class Dd extends Su{constructor(e){super(e),this.coverageOffset=e.Offset16,this.glyphCount=e.uint16,this.attachPointOffsets=[...new Array(this.glyphCount)].map((t=>e.Offset16))}getPoint(e){return this.parser.currentPosition=this.start+this.attachPointOffsets[e],new Ld(this.parser)}}class Ld{constructor(e){this.pointCount=e.uint16,this.pointIndices=[...new Array(this.pointCount)].map((t=>e.uint16))}}class zd extends Su{constructor(e){super(e),this.coverageOffset=e.Offset16,ku(this,"coverage",(()=>(e.currentPosition=this.start+this.coverageOffset,new Fd(e)))),this.ligGlyphCount=e.uint16,this.ligGlyphOffsets=[...new Array(this.ligGlyphCount)].map((t=>e.Offset16))}getLigGlyph(e){return this.parser.currentPosition=this.start+this.ligGlyphOffsets[e],new Gd(this.parser)}}class Gd extends Su{constructor(e){super(e),this.caretCount=e.uint16,this.caretValueOffsets=[...new Array(this.caretCount)].map((t=>e.Offset16))}getCaretValue(e){return this.parser.currentPosition=this.start+this.caretValueOffsets[e],new Hd(this.parser)}}class Hd{constructor(e){this.caretValueFormat=e.uint16,1===this.caretValueFormat&&(this.coordinate=e.int16),2===this.caretValueFormat&&(this.caretValuePointIndex=e.uint16),3===this.caretValueFormat&&(this.coordinate=e.int16,this.deviceOffset=e.Offset16)}}class Ud extends Su{constructor(e){super(e),this.markGlyphSetTableFormat=e.uint16,this.markGlyphSetCount=e.uint16,this.coverageOffsets=[...new Array(this.markGlyphSetCount)].map((t=>e.Offset32))}getMarkGlyphSet(e){return this.parser.currentPosition=this.start+this.coverageOffsets[e],new Fd(this.parser)}}var Wd=Object.freeze({__proto__:null,GDEF:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.glyphClassDefOffset=n.Offset16,ku(this,"glyphClassDefs",(()=>{if(0!==this.glyphClassDefOffset)return n.currentPosition=this.tableStart+this.glyphClassDefOffset,new Md(n)})),this.attachListOffset=n.Offset16,ku(this,"attachList",(()=>{if(0!==this.attachListOffset)return n.currentPosition=this.tableStart+this.attachListOffset,new Dd(n)})),this.ligCaretListOffset=n.Offset16,ku(this,"ligCaretList",(()=>{if(0!==this.ligCaretListOffset)return n.currentPosition=this.tableStart+this.ligCaretListOffset,new zd(n)})),this.markAttachClassDefOffset=n.Offset16,ku(this,"markAttachClassDef",(()=>{if(0!==this.markAttachClassDefOffset)return n.currentPosition=this.tableStart+this.markAttachClassDefOffset,new Md(n)})),this.minorVersion>=2&&(this.markGlyphSetsDefOffset=n.Offset16,ku(this,"markGlyphSetsDef",(()=>{if(0!==this.markGlyphSetsDefOffset)return n.currentPosition=this.tableStart+this.markGlyphSetsDefOffset,new Ud(n)}))),3===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,ku(this,"itemVarStore",(()=>{if(0!==this.itemVarStoreOffset)return n.currentPosition=this.tableStart+this.itemVarStoreOffset,new Bd(n)})))}}});class qd extends Su{static EMPTY={scriptCount:0,scriptRecords:[]};constructor(e){super(e),this.scriptCount=e.uint16,this.scriptRecords=[...new Array(this.scriptCount)].map((t=>new Zd(e)))}}class Zd{constructor(e){this.scriptTag=e.tag,this.scriptOffset=e.Offset16}}class Kd extends Su{constructor(e){super(e),this.defaultLangSys=e.Offset16,this.langSysCount=e.uint16,this.langSysRecords=[...new Array(this.langSysCount)].map((t=>new Yd(e)))}}class Yd{constructor(e){this.langSysTag=e.tag,this.langSysOffset=e.Offset16}}class Xd{constructor(e){this.lookupOrder=e.Offset16,this.requiredFeatureIndex=e.uint16,this.featureIndexCount=e.uint16,this.featureIndices=[...new Array(this.featureIndexCount)].map((t=>e.uint16))}}class Jd extends Su{static EMPTY={featureCount:0,featureRecords:[]};constructor(e){super(e),this.featureCount=e.uint16,this.featureRecords=[...new Array(this.featureCount)].map((t=>new Qd(e)))}}class Qd{constructor(e){this.featureTag=e.tag,this.featureOffset=e.Offset16}}class $d extends Su{constructor(e){super(e),this.featureParams=e.Offset16,this.lookupIndexCount=e.uint16,this.lookupListIndices=[...new Array(this.lookupIndexCount)].map((t=>e.uint16))}getFeatureParams(){if(this.featureParams>0){const e=this.parser;e.currentPosition=this.start+this.featureParams;const t=this.featureTag;if("size"===t)return new th(e);if(t.startsWith("cc"))return new eh(e);if(t.startsWith("ss"))return new nh(e)}}}class eh{constructor(e){this.format=e.uint16,this.featUiLabelNameId=e.uint16,this.featUiTooltipTextNameId=e.uint16,this.sampleTextNameId=e.uint16,this.numNamedParameters=e.uint16,this.firstParamUiLabelNameId=e.uint16,this.charCount=e.uint16,this.character=[...new Array(this.charCount)].map((t=>e.uint24))}}class th{constructor(e){this.designSize=e.uint16,this.subfamilyIdentifier=e.uint16,this.subfamilyNameID=e.uint16,this.smallEnd=e.uint16,this.largeEnd=e.uint16}}class nh{constructor(e){this.version=e.uint16,this.UINameID=e.uint16}}function sh(e){e.parser.currentPosition-=2,delete e.coverageOffset,delete e.getCoverageTable}class ih extends Su{constructor(e){super(e),this.substFormat=e.uint16,this.coverageOffset=e.Offset16}getCoverageTable(){let e=this.parser;return e.currentPosition=this.start+this.coverageOffset,new Fd(e)}}class rh{constructor(e){this.glyphSequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class oh extends ih{constructor(e){super(e),this.deltaGlyphID=e.int16}}class ah extends ih{constructor(e){super(e),this.sequenceCount=e.uint16,this.sequenceOffsets=[...new Array(this.sequenceCount)].map((t=>e.Offset16))}getSequence(e){let t=this.parser;return t.currentPosition=this.start+this.sequenceOffsets[e],new lh(t)}}class lh{constructor(e){this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class ch extends ih{constructor(e){super(e),this.alternateSetCount=e.uint16,this.alternateSetOffsets=[...new Array(this.alternateSetCount)].map((t=>e.Offset16))}getAlternateSet(e){let t=this.parser;return t.currentPosition=this.start+this.alternateSetOffsets[e],new uh(t)}}class uh{constructor(e){this.glyphCount=e.uint16,this.alternateGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class dh extends ih{constructor(e){super(e),this.ligatureSetCount=e.uint16,this.ligatureSetOffsets=[...new Array(this.ligatureSetCount)].map((t=>e.Offset16))}getLigatureSet(e){let t=this.parser;return t.currentPosition=this.start+this.ligatureSetOffsets[e],new hh(t)}}class hh extends Su{constructor(e){super(e),this.ligatureCount=e.uint16,this.ligatureOffsets=[...new Array(this.ligatureCount)].map((t=>e.Offset16))}getLigature(e){let t=this.parser;return t.currentPosition=this.start+this.ligatureOffsets[e],new ph(t)}}class ph{constructor(e){this.ligatureGlyph=e.uint16,this.componentCount=e.uint16,this.componentGlyphIDs=[...new Array(this.componentCount-1)].map((t=>e.uint16))}}class fh extends ih{constructor(e){super(e),1===this.substFormat&&(this.subRuleSetCount=e.uint16,this.subRuleSetOffsets=[...new Array(this.subRuleSetCount)].map((t=>e.Offset16))),2===this.substFormat&&(this.classDefOffset=e.Offset16,this.subClassSetCount=e.uint16,this.subClassSetOffsets=[...new Array(this.subClassSetCount)].map((t=>e.Offset16))),3===this.substFormat&&(sh(this),this.glyphCount=e.uint16,this.substitutionCount=e.uint16,this.coverageOffsets=[...new Array(this.glyphCount)].map((t=>e.Offset16)),this.substLookupRecords=[...new Array(this.substitutionCount)].map((t=>new rh(e))))}getSubRuleSet(e){if(1!==this.substFormat)throw new Error(`lookup type 5.${this.substFormat} has no subrule sets.`);let t=this.parser;return t.currentPosition=this.start+this.subRuleSetOffsets[e],new mh(t)}getSubClassSet(e){if(2!==this.substFormat)throw new Error(`lookup type 5.${this.substFormat} has no subclass sets.`);let t=this.parser;return t.currentPosition=this.start+this.subClassSetOffsets[e],new vh(t)}getCoverageTable(e){if(3!==this.substFormat&&!e)return super.getCoverageTable();if(!e)throw new Error(`lookup type 5.${this.substFormat} requires an coverage table index.`);let t=this.parser;return t.currentPosition=this.start+this.coverageOffsets[e],new Fd(t)}}class mh extends Su{constructor(e){super(e),this.subRuleCount=e.uint16,this.subRuleOffsets=[...new Array(this.subRuleCount)].map((t=>e.Offset16))}getSubRule(e){let t=this.parser;return t.currentPosition=this.start+this.subRuleOffsets[e],new gh(t)}}class gh{constructor(e){this.glyphCount=e.uint16,this.substitutionCount=e.uint16,this.inputSequence=[...new Array(this.glyphCount-1)].map((t=>e.uint16)),this.substLookupRecords=[...new Array(this.substitutionCount)].map((t=>new rh(e)))}}class vh extends Su{constructor(e){super(e),this.subClassRuleCount=e.uint16,this.subClassRuleOffsets=[...new Array(this.subClassRuleCount)].map((t=>e.Offset16))}getSubClass(e){let t=this.parser;return t.currentPosition=this.start+this.subClassRuleOffsets[e],new xh(t)}}class xh extends gh{constructor(e){super(e)}}class yh extends ih{constructor(e){super(e),1===this.substFormat&&(this.chainSubRuleSetCount=e.uint16,this.chainSubRuleSetOffsets=[...new Array(this.chainSubRuleSetCount)].map((t=>e.Offset16))),2===this.substFormat&&(this.backtrackClassDefOffset=e.Offset16,this.inputClassDefOffset=e.Offset16,this.lookaheadClassDefOffset=e.Offset16,this.chainSubClassSetCount=e.uint16,this.chainSubClassSetOffsets=[...new Array(this.chainSubClassSetCount)].map((t=>e.Offset16))),3===this.substFormat&&(sh(this),this.backtrackGlyphCount=e.uint16,this.backtrackCoverageOffsets=[...new Array(this.backtrackGlyphCount)].map((t=>e.Offset16)),this.inputGlyphCount=e.uint16,this.inputCoverageOffsets=[...new Array(this.inputGlyphCount)].map((t=>e.Offset16)),this.lookaheadGlyphCount=e.uint16,this.lookaheadCoverageOffsets=[...new Array(this.lookaheadGlyphCount)].map((t=>e.Offset16)),this.seqLookupCount=e.uint16,this.seqLookupRecords=[...new Array(this.substitutionCount)].map((t=>new Sh(e))))}getChainSubRuleSet(e){if(1!==this.substFormat)throw new Error(`lookup type 6.${this.substFormat} has no chainsubrule sets.`);let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleSetOffsets[e],new bh(t)}getChainSubClassSet(e){if(2!==this.substFormat)throw new Error(`lookup type 6.${this.substFormat} has no chainsubclass sets.`);let t=this.parser;return t.currentPosition=this.start+this.chainSubClassSetOffsets[e],new _h(t)}getCoverageFromOffset(e){if(3!==this.substFormat)throw new Error(`lookup type 6.${this.substFormat} does not use contextual coverage offsets.`);let t=this.parser;return t.currentPosition=this.start+e,new Fd(t)}}class bh extends Su{constructor(e){super(e),this.chainSubRuleCount=e.uint16,this.chainSubRuleOffsets=[...new Array(this.chainSubRuleCount)].map((t=>e.Offset16))}getSubRule(e){let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleOffsets[e],new wh(t)}}class wh{constructor(e){this.backtrackGlyphCount=e.uint16,this.backtrackSequence=[...new Array(this.backtrackGlyphCount)].map((t=>e.uint16)),this.inputGlyphCount=e.uint16,this.inputSequence=[...new Array(this.inputGlyphCount-1)].map((t=>e.uint16)),this.lookaheadGlyphCount=e.uint16,this.lookAheadSequence=[...new Array(this.lookAheadGlyphCount)].map((t=>e.uint16)),this.substitutionCount=e.uint16,this.substLookupRecords=[...new Array(this.SubstCount)].map((t=>new rh(e)))}}class _h extends Su{constructor(e){super(e),this.chainSubClassRuleCount=e.uint16,this.chainSubClassRuleOffsets=[...new Array(this.chainSubClassRuleCount)].map((t=>e.Offset16))}getSubClass(e){let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleOffsets[e],new jh(t)}}class jh{constructor(e){this.backtrackGlyphCount=e.uint16,this.backtrackSequence=[...new Array(this.backtrackGlyphCount)].map((t=>e.uint16)),this.inputGlyphCount=e.uint16,this.inputSequence=[...new Array(this.inputGlyphCount-1)].map((t=>e.uint16)),this.lookaheadGlyphCount=e.uint16,this.lookAheadSequence=[...new Array(this.lookAheadGlyphCount)].map((t=>e.uint16)),this.substitutionCount=e.uint16,this.substLookupRecords=[...new Array(this.substitutionCount)].map((t=>new Sh(e)))}}class Sh extends Su{constructor(e){super(e),this.sequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class Ch extends Su{constructor(e){super(e),this.substFormat=e.uint16,this.extensionLookupType=e.uint16,this.extensionOffset=e.Offset32}}class kh extends ih{constructor(e){super(e),this.backtrackGlyphCount=e.uint16,this.backtrackCoverageOffsets=[...new Array(this.backtrackGlyphCount)].map((t=>e.Offset16)),this.lookaheadGlyphCount=e.uint16,this.lookaheadCoverageOffsets=[new Array(this.lookaheadGlyphCount)].map((t=>e.Offset16)),this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}var Eh={buildSubtable:function(e,t){const n=new[void 0,oh,ah,ch,dh,fh,yh,Ch,kh][e](t);return n.type=e,n}};class Ph extends Su{constructor(e){super(e)}}class Ih extends Ph{constructor(e){super(e),console.log("lookup type 1")}}class Th extends Ph{constructor(e){super(e),console.log("lookup type 2")}}class Oh extends Ph{constructor(e){super(e),console.log("lookup type 3")}}class Ah extends Ph{constructor(e){super(e),console.log("lookup type 4")}}class Nh extends Ph{constructor(e){super(e),console.log("lookup type 5")}}class Mh extends Ph{constructor(e){super(e),console.log("lookup type 6")}}class Vh extends Ph{constructor(e){super(e),console.log("lookup type 7")}}class Fh extends Ph{constructor(e){super(e),console.log("lookup type 8")}}class Rh extends Ph{constructor(e){super(e),console.log("lookup type 9")}}var Bh={buildSubtable:function(e,t){const n=new[void 0,Ih,Th,Oh,Ah,Nh,Mh,Vh,Fh,Rh][e](t);return n.type=e,n}};class Dh extends Su{static EMPTY={lookupCount:0,lookups:[]};constructor(e){super(e),this.lookupCount=e.uint16,this.lookups=[...new Array(this.lookupCount)].map((t=>e.Offset16))}}class Lh extends Su{constructor(e,t){super(e),this.ctType=t,this.lookupType=e.uint16,this.lookupFlag=e.uint16,this.subTableCount=e.uint16,this.subtableOffsets=[...new Array(this.subTableCount)].map((t=>e.Offset16)),this.markFilteringSet=e.uint16}get rightToLeft(){return!0&this.lookupFlag}get ignoreBaseGlyphs(){return!0&this.lookupFlag}get ignoreLigatures(){return!0&this.lookupFlag}get ignoreMarks(){return!0&this.lookupFlag}get useMarkFilteringSet(){return!0&this.lookupFlag}get markAttachmentType(){return!0&this.lookupFlag}getSubTable(e){const t="GSUB"===this.ctType?Eh:Bh;return this.parser.currentPosition=this.start+this.subtableOffsets[e],t.buildSubtable(this.lookupType,this.parser)}}class zh extends Cu{constructor(e,t,n){const{p:s,tableStart:i}=super(e,t,n);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.scriptListOffset=s.Offset16,this.featureListOffset=s.Offset16,this.lookupListOffset=s.Offset16,1===this.majorVersion&&1===this.minorVersion&&(this.featureVariationsOffset=s.Offset32);const r=!(this.scriptListOffset||this.featureListOffset||this.lookupListOffset);ku(this,"scriptList",(()=>r?qd.EMPTY:(s.currentPosition=i+this.scriptListOffset,new qd(s)))),ku(this,"featureList",(()=>r?Jd.EMPTY:(s.currentPosition=i+this.featureListOffset,new Jd(s)))),ku(this,"lookupList",(()=>r?Dh.EMPTY:(s.currentPosition=i+this.lookupListOffset,new Dh(s)))),this.featureVariationsOffset&&ku(this,"featureVariations",(()=>r?FeatureVariations.EMPTY:(s.currentPosition=i+this.featureVariationsOffset,new FeatureVariations(s))))}getSupportedScripts(){return this.scriptList.scriptRecords.map((e=>e.scriptTag))}getScriptTable(e){let t=this.scriptList.scriptRecords.find((t=>t.scriptTag===e));this.parser.currentPosition=this.scriptList.start+t.scriptOffset;let n=new Kd(this.parser);return n.scriptTag=e,n}ensureScriptTable(e){return"string"==typeof e?this.getScriptTable(e):e}getSupportedLangSys(e){const t=0!==(e=this.ensureScriptTable(e)).defaultLangSys,n=e.langSysRecords.map((e=>e.langSysTag));return t&&n.unshift("dflt"),n}getDefaultLangSysTable(e){let t=(e=this.ensureScriptTable(e)).defaultLangSys;if(0!==t){this.parser.currentPosition=e.start+t;let n=new Xd(this.parser);return n.langSysTag="",n.defaultForScript=e.scriptTag,n}}getLangSysTable(e,t="dflt"){if("dflt"===t)return this.getDefaultLangSysTable(e);let n=(e=this.ensureScriptTable(e)).langSysRecords.find((e=>e.langSysTag===t));this.parser.currentPosition=e.start+n.langSysOffset;let s=new Xd(this.parser);return s.langSysTag=t,s}getFeatures(e){return e.featureIndices.map((e=>this.getFeature(e)))}getFeature(e){let t;if(t=parseInt(e)==e?this.featureList.featureRecords[e]:this.featureList.featureRecords.find((t=>t.featureTag===e)),!t)return;this.parser.currentPosition=this.featureList.start+t.featureOffset;let n=new $d(this.parser);return n.featureTag=t.featureTag,n}getLookups(e){return e.lookupListIndices.map((e=>this.getLookup(e)))}getLookup(e,t){let n=this.lookupList.lookups[e];return this.parser.currentPosition=this.lookupList.start+n,new Lh(this.parser,t)}}var Gh=Object.freeze({__proto__:null,GSUB:class extends zh{constructor(e,t){super(e,t,"GSUB")}getLookup(e){return super.getLookup(e,"GSUB")}}});var Hh=Object.freeze({__proto__:null,GPOS:class extends zh{constructor(e,t){super(e,t,"GPOS")}getLookup(e){return super.getLookup(e,"GPOS")}}});class Uh extends Su{constructor(e){super(e),this.numEntries=e.uint16,this.documentRecords=[...new Array(this.numEntries)].map((t=>new Wh(e)))}getDocument(e){let t=this.documentRecords[e];if(!t)return"";let n=this.start+t.svgDocOffset;return this.parser.currentPosition=n,this.parser.readBytes(t.svgDocLength)}getDocumentForGlyph(e){let t=this.documentRecords.findIndex((t=>t.startGlyphID<=e&&e<=t.endGlyphID));return-1===t?"":this.getDocument(t)}}class Wh{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.svgDocOffset=e.Offset32,this.svgDocLength=e.uint32}}var qh=Object.freeze({__proto__:null,SVG:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.offsetToSVGDocumentList=n.Offset32,n.currentPosition=this.tableStart+this.offsetToSVGDocumentList,this.documentList=new Uh(n)}}});class Zh{constructor(e){this.tag=e.tag,this.minValue=e.fixed,this.defaultValue=e.fixed,this.maxValue=e.fixed,this.flags=e.flags(16),this.axisNameID=e.uint16}}class Kh{constructor(e,t,n){let s=e.currentPosition;this.subfamilyNameID=e.uint16,e.uint16,this.coordinates=[...new Array(t)].map((t=>e.fixed)),e.currentPosition-s<n&&(this.postScriptNameID=e.uint16)}}var Yh=Object.freeze({__proto__:null,fvar:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.axesArrayOffset=n.Offset16,n.uint16,this.axisCount=n.uint16,this.axisSize=n.uint16,this.instanceCount=n.uint16,this.instanceSize=n.uint16;const s=this.tableStart+this.axesArrayOffset;ku(this,"axes",(()=>(n.currentPosition=s,[...new Array(this.axisCount)].map((e=>new Zh(n))))));const i=s+this.axisCount*this.axisSize;ku(this,"instances",(()=>{let e=[];for(let t=0;t<this.instanceCount;t++)n.currentPosition=i+t*this.instanceSize,e.push(new Kh(n,this.axisCount,this.instanceSize));return e}))}getSupportedAxes(){return this.axes.map((e=>e.tag))}getAxis(e){return this.axes.find((t=>t.tag===e))}}});var Xh=Object.freeze({__proto__:null,cvt:class extends Cu{constructor(e,t){const{p:n}=super(e,t),s=e.length/2;ku(this,"items",(()=>[...new Array(s)].map((e=>n.fword))))}}});var Jh=Object.freeze({__proto__:null,fpgm:class extends Cu{constructor(e,t){const{p:n}=super(e,t);ku(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});class Qh{constructor(e){this.rangeMaxPPEM=e.uint16,this.rangeGaspBehavior=e.uint16}}var $h=Object.freeze({__proto__:null,gasp:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numRanges=n.uint16;ku(this,"gaspRanges",(()=>[...new Array(this.numRanges)].map((e=>new Qh(n)))))}}});var ep=Object.freeze({__proto__:null,glyf:class extends Cu{constructor(e,t){super(e,t)}getGlyphData(e,t){return this.parser.currentPosition=this.tableStart+e,this.parser.readBytes(t)}}});var tp=Object.freeze({__proto__:null,loca:class extends Cu{constructor(e,t,n){const{p:s}=super(e,t),i=n.maxp.numGlyphs+1;0===n.head.indexToLocFormat?(this.x2=!0,ku(this,"offsets",(()=>[...new Array(i)].map((e=>s.Offset16))))):ku(this,"offsets",(()=>[...new Array(i)].map((e=>s.Offset32))))}getGlyphDataOffsetAndLength(e){let t=this.offsets[e]*this.x2?2:1;return{offset:t,length:(this.offsets[e+1]*this.x2?2:1)-t}}}});var np=Object.freeze({__proto__:null,prep:class extends Cu{constructor(e,t){const{p:n}=super(e,t);ku(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});var sp=Object.freeze({__proto__:null,CFF:class extends Cu{constructor(e,t){const{p:n}=super(e,t);ku(this,"data",(()=>n.readBytes()))}}});var ip=Object.freeze({__proto__:null,CFF2:class extends Cu{constructor(e,t){const{p:n}=super(e,t);ku(this,"data",(()=>n.readBytes()))}}});class rp{constructor(e){this.glyphIndex=e.uint16,this.vertOriginY=e.int16}}var op=Object.freeze({__proto__:null,VORG:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.defaultVertOriginY=n.int16,this.numVertOriginYMetrics=n.uint16,ku(this,"vertORiginYMetrics",(()=>[...new Array(this.numVertOriginYMetrics)].map((e=>new rp(n)))))}}});class ap{constructor(e){this.indexSubTableArrayOffset=e.Offset32,this.indexTablesSize=e.uint32,this.numberofIndexSubTables=e.uint32,this.colorRef=e.uint32,this.hori=new cp(e),this.vert=new cp(e),this.startGlyphIndex=e.uint16,this.endGlyphIndex=e.uint16,this.ppemX=e.uint8,this.ppemY=e.uint8,this.bitDepth=e.uint8,this.flags=e.int8}}class lp{constructor(e){this.hori=new cp(e),this.vert=new cp(e),this.ppemX=e.uint8,this.ppemY=e.uint8,this.substitutePpemX=e.uint8,this.substitutePpemY=e.uint8}}class cp{constructor(e){this.ascender=e.int8,this.descender=e.int8,this.widthMax=e.uint8,this.caretSlopeNumerator=e.int8,this.caretSlopeDenominator=e.int8,this.caretOffset=e.int8,this.minOriginSB=e.int8,this.minAdvanceSB=e.int8,this.maxBeforeBL=e.int8,this.minAfterBL=e.int8,this.pad1=e.int8,this.pad2=e.int8}}class up extends Cu{constructor(e,t,n){const{p:s}=super(e,t,n);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.numSizes=s.uint32,ku(this,"bitMapSizes",(()=>[...new Array(this.numSizes)].map((e=>new ap(s)))))}}var dp=Object.freeze({__proto__:null,EBLC:up});class hp extends Cu{constructor(e,t,n){const{p:s}=super(e,t,n);this.majorVersion=s.uint16,this.minorVersion=s.uint16}}var pp=Object.freeze({__proto__:null,EBDT:hp});var fp=Object.freeze({__proto__:null,EBSC:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.numSizes=n.uint32,ku(this,"bitmapScales",(()=>[...new Array(this.numSizes)].map((e=>new lp(n)))))}}});var mp=Object.freeze({__proto__:null,CBLC:class extends up{constructor(e,t){super(e,t,"CBLC")}}});var gp=Object.freeze({__proto__:null,CBDT:class extends hp{constructor(e,t){super(e,t,"CBDT")}}});var vp=Object.freeze({__proto__:null,sbix:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.flags=n.flags(16),this.numStrikes=n.uint32,ku(this,"strikeOffsets",(()=>[...new Array(this.numStrikes)].map((e=>n.Offset32))))}}});class xp{constructor(e){this.gID=e.uint16,this.firstLayerIndex=e.uint16,this.numLayers=e.uint16}}class yp{constructor(e){this.gID=e.uint16,this.paletteIndex=e.uint16}}var bp=Object.freeze({__proto__:null,COLR:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numBaseGlyphRecords=n.uint16,this.baseGlyphRecordsOffset=n.Offset32,this.layerRecordsOffset=n.Offset32,this.numLayerRecords=n.uint16}getBaseGlyphRecord(e){let t=this.tableStart+this.baseGlyphRecordsOffset;this.parser.currentPosition=t;let n=new xp(this.parser),s=n.gID,i=this.tableStart+this.layerRecordsOffset-6;this.parser.currentPosition=i;let r=new xp(this.parser),o=r.gID;if(s===e)return n;if(o===e)return r;for(;t!==i;){let n=t+(i-t)/12;this.parser.currentPosition=n;let s=new xp(this.parser),r=s.gID;if(r===e)return s;r>e?i=n:r<e&&(t=n)}return!1}getLayers(e){let t=this.getBaseGlyphRecord(e);return this.parser.currentPosition=this.tableStart+this.layerRecordsOffset+4*t.firstLayerIndex,[...new Array(t.numLayers)].map((e=>new yp(p)))}}});class wp{constructor(e){this.blue=e.uint8,this.green=e.uint8,this.red=e.uint8,this.alpha=e.uint8}}class _p{constructor(e,t){this.paletteTypes=[...new Array(t)].map((t=>e.uint32))}}class jp{constructor(e,t){this.paletteLabels=[...new Array(t)].map((t=>e.uint16))}}class Sp{constructor(e,t){this.paletteEntryLabels=[...new Array(t)].map((t=>e.uint16))}}var Cp=Object.freeze({__proto__:null,CPAL:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numPaletteEntries=n.uint16;const s=this.numPalettes=n.uint16;this.numColorRecords=n.uint16,this.offsetFirstColorRecord=n.Offset32,this.colorRecordIndices=[...new Array(this.numPalettes)].map((e=>n.uint16)),ku(this,"colorRecords",(()=>(n.currentPosition=this.tableStart+this.offsetFirstColorRecord,[...new Array(this.numColorRecords)].map((e=>new wp(n)))))),1===this.version&&(this.offsetPaletteTypeArray=n.Offset32,this.offsetPaletteLabelArray=n.Offset32,this.offsetPaletteEntryLabelArray=n.Offset32,ku(this,"paletteTypeArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteTypeArray,new _p(n,s)))),ku(this,"paletteLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteLabelArray,new jp(n,s)))),ku(this,"paletteEntryLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteEntryLabelArray,new Sp(n,s)))))}}});class kp{constructor(e){this.format=e.uint32,this.length=e.uint32,this.offset=e.Offset32}}class Ep{constructor(e){e.uint16,e.uint16,this.signatureLength=e.uint32,this.signature=e.readBytes(this.signatureLength)}}var Pp=Object.freeze({__proto__:null,DSIG:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint32,this.numSignatures=n.uint16,this.flags=n.uint16,this.signatureRecords=[...new Array(this.numSignatures)].map((e=>new kp(n)))}getData(e){const t=this.signatureRecords[e];return this.parser.currentPosition=this.tableStart+t.offset,new Ep(this.parser)}}});class Ip{constructor(e,t){this.pixelSize=e.uint8,this.maxWidth=e.uint8,this.widths=e.readBytes(t)}}var Tp=Object.freeze({__proto__:null,hdmx:class extends Cu{constructor(e,t,n){const{p:s}=super(e,t),i=n.hmtx.numGlyphs;this.version=s.uint16,this.numRecords=s.int16,this.sizeDeviceRecord=s.int32,this.records=[...new Array(numRecords)].map((e=>new Ip(s,i)))}}});class Op{constructor(e){this.version=e.uint16,this.length=e.uint16,this.coverage=e.flags(8),this.format=e.uint8,0===this.format&&(this.nPairs=e.uint16,this.searchRange=e.uint16,this.entrySelector=e.uint16,this.rangeShift=e.uint16,ku(this,"pairs",(()=>[...new Array(this.nPairs)].map((t=>new Ap(e)))))),2===this.format&&console.warn("Kern subtable format 2 is not supported: this parser currently only parses universal table data.")}get horizontal(){return this.coverage[0]}get minimum(){return this.coverage[1]}get crossstream(){return this.coverage[2]}get override(){return this.coverage[3]}}class Ap{constructor(e){this.left=e.uint16,this.right=e.uint16,this.value=e.fword}}var Np=Object.freeze({__proto__:null,kern:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.nTables=n.uint16,ku(this,"tables",(()=>{let e=this.tableStart+4;const t=[];for(let s=0;s<this.nTables;s++){n.currentPosition=e;let s=new Op(n);t.push(s),e+=s}return t}))}}});var Mp=Object.freeze({__proto__:null,LTSH:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numGlyphs=n.uint16,this.yPels=n.readBytes(this.numGlyphs)}}});var Vp=Object.freeze({__proto__:null,MERG:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.mergeClassCount=n.uint16,this.mergeDataOffset=n.Offset16,this.classDefCount=n.uint16,this.offsetToClassDefOffsets=n.Offset16,ku(this,"mergeEntryMatrix",(()=>[...new Array(this.mergeClassCount)].map((e=>n.readBytes(this.mergeClassCount))))),console.warn("Full MERG parsing is currently not supported."),console.warn("If you need this table parsed, please file an issue, or better yet, a PR.")}}});class Fp{constructor(e,t){this.tableStart=e,this.parser=t,this.tag=t.tag,this.dataOffset=t.Offset32,this.dataLength=t.uint32}getData(){return this.parser.currentField=this.tableStart+this.dataOffset,this.parser.readBytes(this.dataLength)}}var Rp=Object.freeze({__proto__:null,meta:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint32,this.flags=n.uint32,n.uint32,this.dataMapsCount=n.uint32,this.dataMaps=[...new Array(this.dataMapsCount)].map((e=>new Fp(this.tableStart,n)))}}});var Bp=Object.freeze({__proto__:null,PCLT:class extends Cu{constructor(e,t){super(e,t),console.warn("This font uses a PCLT table, which is currently not supported by this parser."),console.warn("If you need this table parsed, please file an issue, or better yet, a PR.")}}});class Dp{constructor(e){this.bCharSet=e.uint8,this.xRatio=e.uint8,this.yStartRatio=e.uint8,this.yEndRatio=e.uint8}}class Lp{constructor(e){this.recs=e.uint16,this.startsz=e.uint8,this.endsz=e.uint8,this.records=[...new Array(this.recs)].map((t=>new zp(e)))}}class zp{constructor(e){this.yPelHeight=e.uint16,this.yMax=e.int16,this.yMin=e.int16}}var Gp=Object.freeze({__proto__:null,VDMX:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numRecs=n.uint16,this.numRatios=n.uint16,this.ratRanges=[...new Array(this.numRatios)].map((e=>new Dp(n))),this.offsets=[...new Array(this.numRatios)].map((e=>n.Offset16)),this.VDMXGroups=[...new Array(this.numRecs)].map((e=>new Lp(n)))}}});var Hp=Object.freeze({__proto__:null,vhea:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.fixed,this.ascent=this.vertTypoAscender=n.int16,this.descent=this.vertTypoDescender=n.int16,this.lineGap=this.vertTypoLineGap=n.int16,this.advanceHeightMax=n.int16,this.minTopSideBearing=n.int16,this.minBottomSideBearing=n.int16,this.yMaxExtent=n.int16,this.caretSlopeRise=n.int16,this.caretSlopeRun=n.int16,this.caretOffset=n.int16,this.reserved=n.int16,this.reserved=n.int16,this.reserved=n.int16,this.reserved=n.int16,this.metricDataFormat=n.int16,this.numOfLongVerMetrics=n.uint16,n.verifyLength()}}});class Up{constructor(e,t){this.advanceHeight=e,this.topSideBearing=t}}var Wp=Object.freeze({__proto__:null,vmtx:class extends Cu{constructor(e,t,n){super(e,t);const s=n.vhea.numOfLongVerMetrics,i=n.maxp.numGlyphs,r=p.currentPosition;if(lazy(this,"vMetrics",(()=>(p.currentPosition=r,[...new Array(s)].map((e=>new Up(p.uint16,p.int16)))))),s<i){const e=r+4*s;lazy(this,"topSideBearings",(()=>(p.currentPosition=e,[...new Array(i-s)].map((e=>p.int16)))))}}}});const{kebabCase:qp}=te(y.privateApis);const Zp=function(){const{installFonts:e}=(0,d.useContext)(Qc),[t,n]=(0,d.useState)(!1),[s,i]=(0,d.useState)(!1),r=async e=>{i(null),n(!0);const t=new Set,s=[...e];let r=!1;const l=s.map((async e=>{const n=await async function(e){const t=new Ku("Uploaded Font");try{const n=await a(e);return await t.fromDataBuffer(n,"font"),!0}catch(e){return!1}}(e);if(!n)return r=!0,null;if(t.has(e.name))return null;const s=e.name.split(".").pop().toLowerCase();return Mc.includes(s)?(t.add(e.name),e):null})),c=(await Promise.all(l)).filter((e=>null!==e));if(c.length>0)o(c);else{const e=r?(0,b.__)("Sorry, you are not allowed to upload this file type."):(0,b.__)("No fonts found to install.");i({type:"error",message:e}),n(!1)}},o=async e=>{const t=await Promise.all(e.map((async e=>{const t=await l(e);return await Hc(t,t.file,"all"),t})));c(t)};async function a(e){return new Promise(((t,n)=>{const s=new window.FileReader;s.readAsArrayBuffer(e),s.onload=()=>t(s.result),s.onerror=n}))}const l=async e=>{const t=await a(e),n=new Ku("Uploaded Font");n.fromDataBuffer(t,e.name);const s=(await new Promise((e=>n.onload=e))).detail.font,{name:i}=s.opentype.tables,r=i.get(16)||i.get(1),o=i.get(2).toLowerCase().includes("italic"),l=s.opentype.tables["OS/2"].usWeightClass||"normal",c=!!s.opentype.tables.fvar&&s.opentype.tables.fvar.axes.find((({tag:e})=>"wght"===e));return{file:e,fontFamily:r,fontStyle:o?"italic":"normal",fontWeight:(c?`${c.minValue} ${c.maxValue}`:null)||l}},c=async t=>{const s=function(e){const t=e.reduce(((e,t)=>(e[t.fontFamily]||(e[t.fontFamily]={name:t.fontFamily,fontFamily:t.fontFamily,slug:qp(t.fontFamily.toLowerCase()),fontFace:[]}),e[t.fontFamily].fontFace.push(t),e)),{});return Object.values(t)}(t);try{await e(s),i({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){i({type:"error",message:e.message,errors:e?.installationErrors})}n(!1)};return(0,oe.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[(0,oe.jsx)(y.DropZone,{onFilesDrop:e=>{r(e)}}),(0,oe.jsxs)(y.__experimentalVStack,{className:"font-library-modal__local-fonts",children:[s&&(0,oe.jsxs)(y.Notice,{status:s.type,__unstableHTML:!0,onRemove:()=>i(null),children:[s.message,s.errors&&(0,oe.jsx)("ul",{children:s.errors.map(((e,t)=>(0,oe.jsx)("li",{children:e},t)))})]}),t&&(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)("div",{className:"font-library-modal__upload-area",children:(0,oe.jsx)(y.ProgressBar,{})})}),!t&&(0,oe.jsx)(y.FormFileUpload,{accept:Mc.map((e=>`.${e}`)).join(","),multiple:!0,onChange:e=>{r(e.target.files)},render:({openFileDialog:e})=>(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,className:"font-library-modal__upload-area",onClick:e,children:(0,b.__)("Upload font")})}),(0,oe.jsx)(y.__experimentalSpacer,{margin:2}),(0,oe.jsx)(y.__experimentalText,{className:"font-library-modal__upload-area__text",children:(0,b.__)("Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.")})]})]})},{Tabs:Kp}=te(y.privateApis),Yp={id:"installed-fonts",title:(0,b._x)("Library","Font library")},Xp={id:"upload-fonts",title:(0,b._x)("Upload","noun")};const Jp=function({onRequestClose:e,defaultTabId:t="installed-fonts"}){const{collections:n}=(0,d.useContext)(Qc),s=(0,l.useSelect)((e=>e(_.store).canUser("create",{kind:"postType",name:"wp_font_family"})),[]),i=[Yp];return s&&(i.push(Xp),i.push(...(e=>e.map((({slug:t,name:n})=>({id:t,title:1===e.length&&"google-fonts"===t?(0,b.__)("Install Fonts"):n}))))(n||[]))),(0,oe.jsx)(y.Modal,{title:(0,b.__)("Fonts"),onRequestClose:e,isFullScreen:!0,className:"font-library-modal",children:(0,oe.jsxs)(Kp,{defaultTabId:t,children:[(0,oe.jsx)("div",{className:"font-library-modal__tablist-container",children:(0,oe.jsx)(Kp.TabList,{children:i.map((({id:e,title:t})=>(0,oe.jsx)(Kp.Tab,{tabId:e,children:t},e)))})}),i.map((({id:e})=>{let t;switch(e){case"upload-fonts":t=(0,oe.jsx)(Zp,{});break;case"installed-fonts":t=(0,oe.jsx)(au,{});break;default:t=(0,oe.jsx)(mu,{slug:e})}return(0,oe.jsx)(Kp.TabPanel,{tabId:e,focusable:!1,children:t},e)}))]})})};const Qp=function({font:e}){const{handleSetLibraryFontSelected:t,setModalTabOpen:n}=(0,d.useContext)(Qc),s=e?.fontFace?.length||1,i=rl(e);return(0,oe.jsx)(y.__experimentalItem,{onClick:()=>{t(e),n("installed-fonts")},children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.FlexItem,{style:i,children:e.name}),(0,oe.jsx)(y.FlexItem,{className:"edit-site-global-styles-screen-typography__font-variants-count",children:(0,b.sprintf)((0,b._n)("%d variant","%d variants",s),s)})]})})},{useGlobalSetting:$p}=te(x.privateApis);function ef(e,t){return e?e.map((e=>Dc(e,{source:t}))):[]}function tf(){const{baseCustomFonts:e,modalTabOpen:t,setModalTabOpen:n}=(0,d.useContext)(Qc),[s]=$p("typography.fontFamilies"),[i]=$p("typography.fontFamilies",void 0,"base"),r=[...ef(s?.theme,"theme"),...ef(s?.custom,"custom")].sort(((e,t)=>e.name.localeCompare(t.name))),o=0<r.length,a=o||i?.theme?.length>0||e?.length>0;return(0,oe.jsxs)(oe.Fragment,{children:[!!t&&(0,oe.jsx)(Jp,{onRequestClose:()=>n(null),defaultTabId:t}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:2,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Fonts")}),(0,oe.jsx)(y.Button,{onClick:()=>n("installed-fonts"),label:(0,b.__)("Manage fonts"),icon:Ec,size:"small"})]}),r.length>0&&(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsx)(y.__experimentalItemGroup,{size:"large",isBordered:!0,isSeparated:!0,children:r.map((e=>(0,oe.jsx)(Qp,{font:e},e.slug)))})}),!o&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalText,{as:"p",children:a?(0,b.__)("No fonts activated."):(0,b.__)("No fonts installed.")}),(0,oe.jsx)(y.Button,{className:"edit-site-global-styles-font-families__manage-fonts",variant:"secondary",__next40pxDefaultSize:!0,onClick:()=>{n(a?"installed-fonts":"upload-fonts")},children:a?(0,b.__)("Manage fonts"):(0,b.__)("Add fonts")})]})]})]})}const nf=({...e})=>(0,oe.jsx)($c,{children:(0,oe.jsx)(tf,{...e})});const sf=function(){const e=(0,l.useSelect)((e=>e(h.store).getEditorSettings().fontLibraryEnabled),[]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Typography"),description:(0,b.__)("Available fonts, typographic styles, and the application of those styles.")}),(0,oe.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:7,children:[(0,oe.jsx)(Cc,{title:(0,b.__)("Typesets")}),e&&(0,oe.jsx)(nf,{}),(0,oe.jsx)(uc,{}),(0,oe.jsx)(kc,{})]})})]})},{useGlobalStyle:rf,useGlobalSetting:of,useSettingsForBlockElement:af,TypographyPanel:lf}=te(x.privateApis);function cf({element:e,headingLevel:t}){let n=[];"heading"===e?n=n.concat(["elements",t]):e&&"text"!==e&&(n=n.concat(["elements",e]));const s=n.join("."),[i]=rf(s,void 0,"user",{shouldDecodeEncode:!1}),[r,o]=rf(s,void 0,"all",{shouldDecodeEncode:!1}),[a]=of(""),l=af(a,void 0,"heading"===e?t:e);return(0,oe.jsx)(lf,{inheritedValue:r,value:i,onChange:o,settings:l})}const{useGlobalStyle:uf}=te(x.privateApis);function df({name:e,element:t,headingLevel:n}){var s;let i="";"heading"===t?i=`elements.${n}.`:t&&"text"!==t&&(i=`elements.${t}.`);const[r]=uf(i+"typography.fontFamily",e),[o]=uf(i+"color.gradient",e),[a]=uf(i+"color.background",e),[l]=uf("color.background"),[c]=uf(i+"color.text",e),[u]=uf(i+"typography.fontSize",e),[d]=uf(i+"typography.fontStyle",e),[h]=uf(i+"typography.fontWeight",e),[p]=uf(i+"typography.letterSpacing",e),f="link"===t?{textDecoration:"underline"}:{};return(0,oe.jsx)("div",{className:"edit-site-typography-preview",style:{fontFamily:null!=r?r:"serif",background:null!==(s=null!=o?o:a)&&void 0!==s?s:l,color:c,fontSize:u,fontStyle:d,fontWeight:h,letterSpacing:p,...f},children:"Aa"})}const hf={text:{description:(0,b.__)("Manage the fonts used on the site."),title:(0,b.__)("Text")},link:{description:(0,b.__)("Manage the fonts and typography used on the links."),title:(0,b.__)("Links")},heading:{description:(0,b.__)("Manage the fonts and typography used on headings."),title:(0,b.__)("Headings")},caption:{description:(0,b.__)("Manage the fonts and typography used on captions."),title:(0,b.__)("Captions")},button:{description:(0,b.__)("Manage the fonts and typography used on buttons."),title:(0,b.__)("Buttons")}};const pf=function({element:e}){const[t,n]=(0,d.useState)("heading");return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:hf[e].title,description:hf[e].description}),(0,oe.jsx)(y.__experimentalSpacer,{marginX:4,children:(0,oe.jsx)(df,{element:e,headingLevel:t})}),"heading"===e&&(0,oe.jsx)(y.__experimentalSpacer,{marginX:4,marginBottom:"1em",children:(0,oe.jsxs)(y.__experimentalToggleGroupControl,{label:(0,b.__)("Select heading level"),hideLabelFromVision:!0,value:t,onChange:n,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,children:[(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"heading",showTooltip:!0,"aria-label":(0,b.__)("All headings"),label:(0,b._x)("All","heading levels")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h1",showTooltip:!0,"aria-label":(0,b.__)("Heading 1"),label:(0,b.__)("H1")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h2",showTooltip:!0,"aria-label":(0,b.__)("Heading 2"),label:(0,b.__)("H2")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h3",showTooltip:!0,"aria-label":(0,b.__)("Heading 3"),label:(0,b.__)("H3")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h4",showTooltip:!0,"aria-label":(0,b.__)("Heading 4"),label:(0,b.__)("H4")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h5",showTooltip:!0,"aria-label":(0,b.__)("Heading 5"),label:(0,b.__)("H5")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h6",showTooltip:!0,"aria-label":(0,b.__)("Heading 6"),label:(0,b.__)("H6")})]})}),(0,oe.jsx)(cf,{element:e,headingLevel:t})]})},{useGlobalStyle:ff}=te(x.privateApis);const mf=function({fontSize:e}){var t;const[n]=ff("typography"),s=e?.fluid?.min&&e?.fluid?.max?{minimumFontSize:e.fluid.min,maximumFontSize:e.fluid.max}:{fontSize:e.size},i=(0,x.getComputedFluidTypographyValue)(s);return(0,oe.jsx)("div",{className:"edit-site-typography-preview",style:{fontSize:i,fontFamily:null!==(t=n?.fontFamily)&&void 0!==t?t:"serif"},children:(0,b.__)("Aa")})};const gf=function({fontSize:e,isOpen:t,toggleOpen:n,handleRemoveFontSize:s}){return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:(0,b.__)("Delete"),onCancel:()=>{n()},onConfirm:async()=>{n(),s(e)},size:"medium",children:e&&(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s" font size preset?'),e.name)})};const vf=function({fontSize:e,toggleOpen:t,handleRename:n}){const[s,i]=(0,d.useState)(e.name);return(0,oe.jsx)(y.Modal,{onRequestClose:t,focusOnMount:"firstContentElement",title:(0,b.__)("Rename"),size:"small",children:(0,oe.jsx)("form",{onSubmit:e=>{e.preventDefault(),s.trim()&&n(s),t(),t()},children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"3",children:[(0,oe.jsx)(y.__experimentalInputControl,{__next40pxDefaultSize:!0,autoComplete:"off",value:s,onChange:i,label:(0,b.__)("Name"),placeholder:(0,b.__)("Font size preset name")}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"right",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,b.__)("Save")})]})]})})})},xf=["px","em","rem","vw","vh"];const yf=function({__nextHasNoMarginBottom:e,...t}){const{baseControlProps:n}=(0,y.useBaseControlProps)(t),{value:s,onChange:i,fallbackValue:r,disabled:o,label:a}=t,l=(0,y.__experimentalUseCustomUnits)({availableUnits:xf}),[c,u="px"]=(0,y.__experimentalParseQuantityAndUnitFromRawValue)(s,l),d=!!u&&["em","rem","vw","vh"].includes(u);return(0,oe.jsx)(y.BaseControl,{...n,__nextHasNoMarginBottom:!0,children:(0,oe.jsxs)(y.Flex,{children:[(0,oe.jsx)(y.FlexItem,{isBlock:!0,children:(0,oe.jsx)(y.__experimentalUnitControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:a,hideLabelFromVision:!0,value:s,onChange:e=>{i(e)},units:l,min:0,disabled:o})}),(0,oe.jsx)(y.FlexItem,{isBlock:!0,children:(0,oe.jsx)(y.__experimentalSpacer,{marginX:2,marginBottom:0,children:(0,oe.jsx)(y.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:a,hideLabelFromVision:!0,value:c,initialPosition:r,withInputField:!1,onChange:e=>{i?.(e+u)},min:0,max:d?10:100,step:d?.1:1,disabled:o})})})]})})},{Menu:bf}=te(y.privateApis),{useGlobalSetting:wf}=te(x.privateApis);const _f=function(){var e;const[t,n]=(0,d.useState)(!1),[s,i]=(0,d.useState)(!1),{params:{origin:r,slug:o},goBack:a}=(0,y.useNavigator)(),[l,c]=wf("typography.fontSizes"),[u]=wf("typography.fluid"),h=null!==(e=l[r])&&void 0!==e?e:[],p=h.find((e=>e.slug===o));if((0,d.useEffect)((()=>{o&&!p&&a()}),[o,p,a]),!r||!o||!p)return null;const f=void 0!==p?.fluid?!!p.fluid:!!u,m="object"==typeof p?.fluid,g=(e,t)=>{const n=h.map((n=>n.slug===o?{...n,[e]:t}:n));c({...l,[r]:n})},v=()=>{n(!t)},x=()=>{i(!s)};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(gf,{fontSize:p,isOpen:t,toggleOpen:v,handleRemoveFontSize:()=>{const e=h.filter((e=>e.slug!==o));c({...l,[r]:e})}}),s&&(0,oe.jsx)(vf,{fontSize:p,toggleOpen:x,handleRename:e=>{g("name",e)}}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",align:"flex-start",children:[(0,oe.jsx)(Pl,{title:p.name,description:(0,b.sprintf)((0,b.__)("Manage the font size %s."),p.name)}),"custom"===r&&(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.__experimentalSpacer,{marginTop:3,marginBottom:0,paddingX:4,children:(0,oe.jsxs)(bf,{children:[(0,oe.jsx)(bf.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Font size options")})}),(0,oe.jsxs)(bf.Popover,{children:[(0,oe.jsx)(bf.Item,{onClick:x,children:(0,oe.jsx)(bf.ItemLabel,{children:(0,b.__)("Rename")})}),(0,oe.jsx)(bf.Item,{onClick:v,children:(0,oe.jsx)(bf.ItemLabel,{children:(0,b.__)("Delete")})})]})]})})})]}),(0,oe.jsx)(y.__experimentalView,{children:(0,oe.jsx)(y.__experimentalSpacer,{paddingX:4,marginBottom:0,paddingBottom:6,children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(mf,{fontSize:p})}),(0,oe.jsx)(yf,{label:(0,b.__)("Size"),value:m?"":p.size,onChange:e=>{g("size",e)},disabled:m}),(0,oe.jsx)(y.ToggleControl,{label:(0,b.__)("Fluid typography"),help:(0,b.__)("Scale the font size dynamically to fit the screen or viewport."),checked:f,onChange:e=>{g("fluid",e)},__nextHasNoMarginBottom:!0}),f&&(0,oe.jsx)(y.ToggleControl,{label:(0,b.__)("Custom fluid values"),help:(0,b.__)("Set custom min and max values for the fluid font size."),checked:m,onChange:e=>{g("fluid",!e||{min:p.size,max:p.size})},__nextHasNoMarginBottom:!0}),m&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(yf,{label:(0,b.__)("Minimum"),value:p.fluid?.min,onChange:e=>{g("fluid",{...p.fluid,min:e})}}),(0,oe.jsx)(yf,{label:(0,b.__)("Maximum"),value:p.fluid?.max,onChange:e=>{g("fluid",{...p.fluid,max:e})}})]})]})})})]})]})},jf=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})});const Sf=function({text:e,confirmButtonText:t,isOpen:n,toggleOpen:s,onConfirm:i}){return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:n,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:t,onCancel:()=>{s()},onConfirm:async()=>{s(),i()},size:"medium",children:e})},{Menu:Cf}=te(y.privateApis),{useGlobalSetting:kf}=te(x.privateApis);function Ef({label:e,origin:t,sizes:n,handleAddFontSize:s,handleResetFontSizes:i}){const[r,o]=(0,d.useState)(!1),a=()=>o(!r),l="custom"===t?(0,b.__)("Are you sure you want to remove all custom font size presets?"):(0,b.__)("Are you sure you want to reset all font size presets to their default values?");return(0,oe.jsxs)(oe.Fragment,{children:[r&&(0,oe.jsx)(Sf,{text:l,confirmButtonText:"custom"===t?(0,b.__)("Remove"):(0,b.__)("Reset"),isOpen:r,toggleOpen:a,onConfirm:i}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",align:"center",children:[(0,oe.jsx)(Ll,{level:3,children:e}),(0,oe.jsxs)(y.FlexItem,{children:["custom"===t&&(0,oe.jsx)(y.Button,{label:(0,b.__)("Add font size"),icon:jf,size:"small",onClick:s}),!!i&&(0,oe.jsxs)(Cf,{children:[(0,oe.jsx)(Cf.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Font size presets options")})}),(0,oe.jsx)(Cf.Popover,{children:(0,oe.jsx)(Cf.Item,{onClick:a,children:(0,oe.jsx)(Cf.ItemLabel,{children:"custom"===t?(0,b.__)("Remove font size presets"):(0,b.__)("Reset font size presets")})})})]})]})]}),!!n.length&&(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:n.map((e=>(0,oe.jsx)(Wa,{path:`/typography/font-sizes/${t}/${e.slug}`,children:(0,oe.jsxs)(y.__experimentalHStack,{children:[(0,oe.jsx)(y.FlexItem,{className:"edit-site-font-size__item",children:e.name}),(0,oe.jsx)(y.FlexItem,{display:"flex",children:(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?Xo:Yo})})]})},e.slug)))})]})]})}const Pf=function(){const[e,t]=kf("typography.fontSizes.theme"),[n]=kf("typography.fontSizes.theme",null,"base"),[s,i]=kf("typography.fontSizes.default"),[r]=kf("typography.fontSizes.default",null,"base"),[o=[],a]=kf("typography.fontSizes.custom"),[l]=kf("typography.defaultFontSizes"),c=()=>{const e=al(o,"custom-"),t={name:(0,b.sprintf)((0,b.__)("New Font Size %d"),e),size:"16px",slug:`custom-${e}`};a([...o,t])},u=(e,t)=>e.map((e=>e.size)).join("")===t.map((e=>e.size)).join("");return(0,oe.jsxs)(y.__experimentalVStack,{spacing:2,children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Font size presets"),description:(0,b.__)("Create and edit the presets used for font sizes across the site.")}),(0,oe.jsx)(y.__experimentalView,{children:(0,oe.jsx)(y.__experimentalSpacer,{paddingX:4,children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:8,children:[!!e?.length&&(0,oe.jsx)(Ef,{label:(0,b.__)("Theme"),origin:"theme",sizes:e,baseSizes:n,handleAddFontSize:c,handleResetFontSizes:u(e,n)?null:()=>t(n)}),l&&!!s?.length&&(0,oe.jsx)(Ef,{label:(0,b.__)("Default"),origin:"default",sizes:s,baseSizes:r,handleAddFontSize:c,handleResetFontSizes:u(s,r)?null:()=>i(r)}),(0,oe.jsx)(Ef,{label:(0,b.__)("Custom"),origin:"custom",sizes:o,handleAddFontSize:c,handleResetFontSizes:o.length>0?()=>a([]):null})]})})})]})},If=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/SVG",children:(0,oe.jsx)(Yt.Path,{d:"M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z"})});const Tf=function({className:e,...t}){return(0,oe.jsx)(y.Flex,{className:Ut("edit-site-global-styles__color-indicator-wrapper",e),...t})},{useGlobalSetting:Of}=te(x.privateApis),Af=[];const Nf=function({name:e}){const[t]=Of("color.palette.custom"),[n]=Of("color.palette.theme"),[s]=Of("color.palette.default"),[i]=Of("color.defaultPalette",e),[r]=function(e){const[t,n]=ne("color.palette.theme",e);return window.__experimentalEnableColorRandomizer?[function(){const e=Math.floor(225*Math.random()),s=t.map((t=>{const{color:n}=t,s=Y(n).rotate(e).toHex();return{...t,color:s}}));n(s)}]:[]}(),o=(0,d.useMemo)((()=>[...t||Af,...n||Af,...s&&i?s:Af]),[t,n,s,i]),a=e?"/blocks/"+encodeURIComponent(e)+"/colors/palette":"/colors/palette";return(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Palette")}),(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,oe.jsx)(Wa,{path:a,children:(0,oe.jsxs)(y.__experimentalHStack,{direction:"row",children:[o.length>0?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalZStack,{isLayered:!1,offset:-8,children:o.slice(0,5).map((({color:e},t)=>(0,oe.jsx)(Tf,{children:(0,oe.jsx)(y.ColorIndicator,{colorValue:e})},`${e}-${t}`)))}),(0,oe.jsx)(y.FlexItem,{isBlock:!0,children:(0,b.__)("Edit palette")})]}):(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Add colors")}),(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?Xo:Yo})]})})}),window.__experimentalEnableColorRandomizer&&n?.length>0&&(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"secondary",icon:If,onClick:r,children:(0,b.__)("Randomize colors")})]})},{useGlobalStyle:Mf,useGlobalSetting:Vf,useSettingsForBlockElement:Ff,ColorPanel:Rf}=te(x.privateApis);const Bf=function(){const[e]=Mf("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=Mf("",void 0,"all",{shouldDecodeEncode:!1}),[s]=Vf(""),i=Ff(s);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Colors"),description:(0,b.__)("Palette colors and the application of those colors on site elements.")}),(0,oe.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:7,children:[(0,oe.jsx)(Nf,{}),(0,oe.jsx)(Rf,{inheritedValue:t,value:e,onChange:n,settings:i})]})})]})};function Df(){const{paletteColors:e}=ie();return e.slice(0,4).map((({slug:e,color:t},n)=>(0,oe.jsx)("div",{style:{flexGrow:1,height:"100%",background:t}},`${e}-${n}`)))}const Lf={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},zf=({label:e,isFocused:t,withHoverView:n})=>(0,oe.jsx)(gl,{label:e,isFocused:t,withHoverView:n,children:({key:e})=>(0,oe.jsx)(y.__unstableMotion.div,{variants:Lf,style:{height:"100%",overflow:"hidden"},children:(0,oe.jsx)(y.__experimentalHStack,{spacing:0,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,oe.jsx)(Df,{})})},e)});function Gf({title:e,gap:t=2}){const n=["color"],s=xc(n);return s?.length<=1?null:(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[e&&(0,oe.jsx)(Ll,{level:3,children:e}),(0,oe.jsx)(y.__experimentalGrid,{spacing:t,children:s.map(((e,t)=>(0,oe.jsx)(Sc,{variation:e,isPill:!0,properties:n,showTooltip:!0,children:()=>(0,oe.jsx)(zf,{})},t)))})]})}const{useGlobalSetting:Hf}=te(x.privateApis),Uf={placement:"bottom-start",offset:8};function Wf({name:e}){const[t,n]=Hf("color.palette.theme",e),[s]=Hf("color.palette.theme",e,"base"),[i,r]=Hf("color.palette.default",e),[o]=Hf("color.palette.default",e,"base"),[a,l]=Hf("color.palette.custom",e),[c]=Hf("color.defaultPalette",e),u=(0,v.useViewportMatch)("small","<")?Uf:void 0;return(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-global-styles-color-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,oe.jsx)(y.__experimentalPaletteEdit,{canReset:t!==s,canOnlyChangeValues:!0,colors:t,onChange:n,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:u}),!!i&&!!i.length&&!!c&&(0,oe.jsx)(y.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,colors:i,onChange:r,paletteLabel:(0,b.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:u}),(0,oe.jsx)(y.__experimentalPaletteEdit,{colors:a,onChange:l,paletteLabel:(0,b.__)("Custom"),paletteLabelHeadingLevel:3,slugPrefix:"custom-",popoverProps:u}),(0,oe.jsx)(Gf,{title:(0,b.__)("Palettes")})]})}const{useGlobalSetting:qf}=te(x.privateApis),Zf={placement:"bottom-start",offset:8},Kf=()=>{};function Yf({name:e}){const[t,n]=qf("color.gradients.theme",e),[s]=qf("color.gradients.theme",e,"base"),[i,r]=qf("color.gradients.default",e),[o]=qf("color.gradients.default",e,"base"),[a,l]=qf("color.gradients.custom",e),[c]=qf("color.defaultGradients",e),[u]=qf("color.duotone.custom")||[],[d]=qf("color.duotone.default")||[],[h]=qf("color.duotone.theme")||[],[p]=qf("color.defaultDuotone"),f=[...u||[],...h||[],...d&&p?d:[]],m=(0,v.useViewportMatch)("small","<")?Zf:void 0;return(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-global-styles-gradient-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,oe.jsx)(y.__experimentalPaletteEdit,{canReset:t!==s,canOnlyChangeValues:!0,gradients:t,onChange:n,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:m}),!!i&&!!i.length&&!!c&&(0,oe.jsx)(y.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,gradients:i,onChange:r,paletteLabel:(0,b.__)("Default"),paletteLabelLevel:3,popoverProps:m}),(0,oe.jsx)(y.__experimentalPaletteEdit,{gradients:a,onChange:l,paletteLabel:(0,b.__)("Custom"),paletteLabelLevel:3,slugPrefix:"custom-",popoverProps:m}),!!f&&!!f.length&&(0,oe.jsxs)("div",{children:[(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Duotone")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:3}),(0,oe.jsx)(y.DuotonePicker,{duotonePalette:f,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:Kf})]})]})}const{Tabs:Xf}=te(y.privateApis);const Jf=function({name:e}){return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Edit palette"),description:(0,b.__)("The combination of colors used across the site and in color pickers.")}),(0,oe.jsxs)(Xf,{children:[(0,oe.jsxs)(Xf.TabList,{children:[(0,oe.jsx)(Xf.Tab,{tabId:"color",children:(0,b.__)("Color")}),(0,oe.jsx)(Xf.Tab,{tabId:"gradient",children:(0,b.__)("Gradient")})]}),(0,oe.jsx)(Xf.TabPanel,{tabId:"color",focusable:!1,children:(0,oe.jsx)(Wf,{name:e})}),(0,oe.jsx)(Xf.TabPanel,{tabId:"gradient",focusable:!1,children:(0,oe.jsx)(Yf,{name:e})})]})]})},Qf={backgroundSize:"auto"},{useGlobalStyle:$f,useGlobalSetting:em,BackgroundPanel:tm}=te(x.privateApis);function nm(){const[e]=$f("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=$f("",void 0,"all",{shouldDecodeEncode:!1}),[s]=em("");return(0,oe.jsx)(tm,{inheritedValue:t,value:e,onChange:n,settings:s,defaultValues:Qf})}const{useHasBackgroundPanel:sm,useGlobalSetting:im}=te(x.privateApis);const rm=function(){const[e]=im(""),t=sm(e);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Background"),description:(0,oe.jsx)(y.__experimentalText,{children:(0,b.__)("Set styles for the site’s background.")})}),t&&(0,oe.jsx)(nm,{})]})};const om=function({text:e,confirmButtonText:t,isOpen:n,toggleOpen:s,onConfirm:i}){return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:n,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:t,onCancel:()=>{s()},onConfirm:async()=>{s(),i()},size:"medium",children:e})},{useGlobalSetting:am}=te(x.privateApis),{Menu:lm}=te(y.privateApis),cm="6px 6px 9px rgba(0, 0, 0, 0.2)";function um(){const[e]=am("shadow.presets.default"),[t]=am("shadow.defaultPresets"),[n]=am("shadow.presets.theme"),[s,i]=am("shadow.presets.custom"),[r,o]=(0,d.useState)(!1),a=()=>o(!r);return(0,oe.jsxs)(oe.Fragment,{children:[r&&(0,oe.jsx)(om,{text:(0,b.__)("Are you sure you want to remove all custom shadows?"),confirmButtonText:(0,b.__)("Remove"),isOpen:r,toggleOpen:a,onConfirm:()=>{i([])}}),(0,oe.jsx)(Pl,{title:(0,b.__)("Shadows"),description:(0,b.__)("Manage and create shadow styles for use across the site.")}),(0,oe.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-global-styles__shadows-panel",spacing:7,children:[t&&(0,oe.jsx)(dm,{label:(0,b.__)("Default"),shadows:e||[],category:"default"}),n&&n.length>0&&(0,oe.jsx)(dm,{label:(0,b.__)("Theme"),shadows:n||[],category:"theme"}),(0,oe.jsx)(dm,{label:(0,b.__)("Custom"),shadows:s||[],category:"custom",canCreate:!0,onCreate:e=>{i([...s||[],e])},onReset:a})]})})]})}function dm({label:e,shadows:t,category:n,canCreate:s,onCreate:i,onReset:r}){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:2,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.Flex,{align:"center",className:"edit-site-global-styles__shadows-panel__title",children:(0,oe.jsx)(Ll,{level:3,children:e})}),s&&(0,oe.jsx)(y.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:(0,oe.jsx)(y.Button,{size:"small",icon:jf,label:(0,b.__)("Add shadow"),onClick:()=>{(()=>{const e=al(t,"shadow-");i({name:(0,b.sprintf)((0,b.__)("Shadow %s"),e),shadow:cm,slug:`shadow-${e}`})})()}})}),!!t?.length&&"custom"===n&&(0,oe.jsxs)(lm,{children:[(0,oe.jsx)(lm.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Shadow options")})}),(0,oe.jsx)(lm.Popover,{children:(0,oe.jsx)(lm.Item,{onClick:r,children:(0,oe.jsx)(lm.ItemLabel,{children:(0,b.__)("Remove all custom shadows")})})})]})]}),t.length>0&&(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map((e=>(0,oe.jsx)(hm,{shadow:e,category:n},e.slug)))})]})}function hm({shadow:e,category:t}){return(0,oe.jsx)(Wa,{path:`/shadows/edit/${t}/${e.slug}`,children:(0,oe.jsxs)(y.__experimentalHStack,{children:[(0,oe.jsx)(y.FlexItem,{children:e.name}),(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?Xo:Yo})]})})}const pm=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M7 11.5h10V13H7z"})});const{useGlobalSetting:fm}=te(x.privateApis),{Menu:mm}=te(y.privateApis),gm=[{label:(0,b.__)("Rename"),action:"rename"},{label:(0,b.__)("Delete"),action:"delete"}],vm=[{label:(0,b.__)("Reset"),action:"reset"}];function xm(){const{goBack:e,params:{category:t,slug:n}}=(0,y.useNavigator)(),[s,i]=fm(`shadow.presets.${t}`);(0,d.useEffect)((()=>{const t=s?.some((e=>e.slug===n));n&&!t&&e()}),[s,n,e]);const[r]=fm(`shadow.presets.${t}`,void 0,"base"),[o,a]=(0,d.useState)((()=>(s||[]).find((e=>e.slug===n)))),l=(0,d.useMemo)((()=>(r||[]).find((e=>e.slug===n))),[r,n]),[c,u]=(0,d.useState)(!1),[h,p]=(0,d.useState)(!1),[f,m]=(0,d.useState)(o.name);if(!t||!n)return null;return o?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(Pl,{title:o.name}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.__experimentalSpacer,{marginTop:2,marginBottom:0,paddingX:4,children:(0,oe.jsxs)(mm,{children:[(0,oe.jsx)(mm.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Menu")})}),(0,oe.jsx)(mm.Popover,{children:("custom"===t?gm:vm).map((e=>(0,oe.jsx)(mm.Item,{onClick:()=>(e=>{if("reset"===e){const e=s.map((e=>e.slug===n?l:e));a(l),i(e)}else"delete"===e?u(!0):"rename"===e&&p(!0)})(e.action),disabled:"reset"===e.action&&o.shadow===l.shadow,children:(0,oe.jsx)(mm.ItemLabel,{children:e.label})},e.action)))})]})})})]}),(0,oe.jsxs)("div",{className:"edit-site-global-styles-screen",children:[(0,oe.jsx)(ym,{shadow:o.shadow}),(0,oe.jsx)(bm,{shadow:o.shadow,onChange:e=>{a({...o,shadow:e});const t=s.map((t=>t.slug===n?{...o,shadow:e}:t));i(t)}})]}),c&&(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{i(s.filter((e=>e.slug!==n))),u(!1)},onCancel:()=>{u(!1)},confirmButtonText:(0,b.__)("Delete"),size:"medium",children:(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s" shadow preset?'),o.name)}),h&&(0,oe.jsx)(y.Modal,{title:(0,b.__)("Rename"),onRequestClose:()=>p(!1),size:"small",children:(0,oe.jsxs)("form",{onSubmit:e=>{e.preventDefault(),(e=>{if(!e)return;const t=s.map((t=>t.slug===n?{...o,name:e}:t));a({...o,name:e}),i(t)})(f),p(!1)},children:[(0,oe.jsx)(y.__experimentalInputControl,{__next40pxDefaultSize:!0,autoComplete:"off",label:(0,b.__)("Name"),placeholder:(0,b.__)("Shadow name"),value:f,onChange:e=>m(e)}),(0,oe.jsx)(y.__experimentalSpacer,{marginBottom:6}),(0,oe.jsxs)(y.Flex,{className:"block-editor-shadow-edit-modal__actions",justify:"flex-end",expanded:!1,children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>p(!1),children:(0,b.__)("Cancel")})}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,b.__)("Save")})})]})]})})]}):(0,oe.jsx)(Pl,{title:""})}function ym({shadow:e}){const t={boxShadow:e};return(0,oe.jsx)(y.__experimentalSpacer,{marginBottom:4,marginTop:-2,children:(0,oe.jsx)(y.__experimentalHStack,{align:"center",justify:"center",className:"edit-site-global-styles__shadow-preview-panel",children:(0,oe.jsx)("div",{className:"edit-site-global-styles__shadow-preview-block",style:t})})})}function bm({shadow:e,onChange:t}){const n=(0,d.useRef)(),s=(0,d.useMemo)((()=>function(e){return(e.match(/(?:[^,(]|\([^)]*\))+/g)||[]).map((e=>e.trim()))}(e)),[e]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalVStack,{spacing:2,children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.Flex,{align:"center",className:"edit-site-global-styles__shadows-panel__title",children:(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Shadows")})}),(0,oe.jsx)(y.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:(0,oe.jsx)(y.Button,{size:"small",icon:jf,label:(0,b.__)("Add shadow"),onClick:()=>{t([...s,cm].join(", "))},ref:n})})]})}),(0,oe.jsx)(y.__experimentalSpacer,{}),(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:s.map(((e,i)=>(0,oe.jsx)(wm,{shadow:e,onChange:e=>((e,n)=>{const i=[...s];i[e]=n,t(i.join(", "))})(i,e),canRemove:s.length>1,onRemove:()=>(e=>{t(s.filter(((t,n)=>n!==e)).join(", ")),n.current.focus()})(i)},i)))})]})}function wm({shadow:e,onChange:t,canRemove:n,onRemove:s}){const i=(0,d.useMemo)((()=>function(e){const t={x:"0",y:"0",blur:"0",spread:"0",color:"#000",inset:!1};if(!e)return t;if(e.includes("none"))return t;const n=/((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g,s=e.match(n)||[];if(1!==s.length)return t;const i=s[0].split(" ").map((e=>e.trim())).filter((e=>e));if(i.length<2)return t;const r=e.match(/inset/gi)||[];if(r.length>1)return t;const o=1===r.length;let a=e.replace(n,"").trim();o&&(a=a.replace("inset","").replace("INSET","").trim());let l=(a.match(/^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi)||[]).map((e=>e?.trim())).filter((e=>e));if(l.length>1)return t;if(0===l.length&&(l=a.trim().split(" ").filter((e=>e)),l.length>1))return t;const[c,u,d,h]=i;return{x:c,y:u,blur:d||t.blur,spread:h||t.spread,inset:o,color:a||t.color}}(e)),[e]),r=e=>{t(function(e){const t=`${e.x||"0px"} ${e.y||"0px"} ${e.blur||"0px"} ${e.spread||"0px"}`;return`${e.inset?"inset":""} ${t} ${e.color||""}`.trim()}(e))};return(0,oe.jsx)(y.Dropdown,{popoverProps:{placement:"left-start",offset:36,shift:!0},className:"edit-site-global-styles__shadow-editor__dropdown",renderToggle:({onToggle:e,isOpen:t})=>{const r={onClick:e,className:Ut("edit-site-global-styles__shadow-editor__dropdown-toggle",{"is-open":t}),"aria-expanded":t},o={onClick:()=>{t&&e(),s()},className:Ut("edit-site-global-styles__shadow-editor__remove-button",{"is-open":t}),label:(0,b.__)("Remove shadow")};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,icon:Ya,...r,children:i.inset?(0,b.__)("Inner shadow"):(0,b.__)("Drop shadow")}),n&&(0,oe.jsx)(y.Button,{size:"small",icon:pm,...o})]})},renderContent:()=>(0,oe.jsx)(y.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"edit-site-global-styles__shadow-editor__dropdown-content",children:(0,oe.jsx)(_m,{shadowObj:i,onChange:r})})})}function _m({shadowObj:e,onChange:t}){const n=(n,s)=>{const i={...e,[n]:s};t(i)};return(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,className:"edit-site-global-styles__shadow-editor-panel",children:[(0,oe.jsx)(y.ColorPalette,{clearable:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,value:e.color,onChange:e=>n("color",e)}),(0,oe.jsxs)(y.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,value:e.inset?"inset":"outset",isBlock:!0,onChange:e=>n("inset","inset"===e),hideLabelFromVision:!0,__next40pxDefaultSize:!0,children:[(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"outset",label:(0,b.__)("Outset")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"inset",label:(0,b.__)("Inset")})]}),(0,oe.jsxs)(y.__experimentalGrid,{columns:2,gap:4,children:[(0,oe.jsx)(jm,{label:(0,b.__)("X Position"),value:e.x,onChange:e=>n("x",e)}),(0,oe.jsx)(jm,{label:(0,b.__)("Y Position"),value:e.y,onChange:e=>n("y",e)}),(0,oe.jsx)(jm,{label:(0,b.__)("Blur"),value:e.blur,onChange:e=>n("blur",e)}),(0,oe.jsx)(jm,{label:(0,b.__)("Spread"),value:e.spread,onChange:e=>n("spread",e)})]})]})}function jm({label:e,value:t,onChange:n}){return(0,oe.jsx)(y.__experimentalUnitControl,{label:e,__next40pxDefaultSize:!0,value:t,onChange:e=>{const t=void 0!==e&&!isNaN(parseFloat(e));n(t?e:"0px")}})}function Sm(){return(0,oe.jsx)(um,{})}function Cm(){return(0,oe.jsx)(xm,{})}const{useGlobalStyle:km,useGlobalSetting:Em,useSettingsForBlockElement:Pm,DimensionsPanel:Im}=te(x.privateApis),Tm={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,childLayout:!1};function Om(){const[e]=km("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=km("",void 0,"all",{shouldDecodeEncode:!1}),[s]=Em("",void 0,"user"),[i,r]=Em(""),o=Pm(i),a=(0,d.useMemo)((()=>({...t,layout:o.layout})),[t,o.layout]),l=(0,d.useMemo)((()=>({...e,layout:s.layout})),[e,s.layout]);return(0,oe.jsx)(Im,{inheritedValue:a,value:l,onChange:e=>{const t={...e};if(delete t.layout,n(t),e.layout!==s.layout){const t={...s,layout:e.layout};t.layout?.definitions&&delete t.layout.definitions,r(t)}},settings:o,includeLayoutControls:!0,defaultControls:Tm})}const{useHasDimensionsPanel:Am,useGlobalSetting:Nm,useSettingsForBlockElement:Mm}=te(x.privateApis);const Vm=function(){const[e]=Nm(""),t=Mm(e),n=Am(t);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Layout")}),n&&(0,oe.jsx)(Om,{})]})},{GlobalStylesContext:Fm}=te(x.privateApis);function Rm({gap:e=2}){const{user:t}=(0,d.useContext)(Fm),n=t?.styles,s=(0,l.useSelect)((e=>e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()),[]),i=s?.filter((e=>!bc(e,["color"])&&!bc(e,["typography","spacing"]))),r=(0,d.useMemo)((()=>[...[{title:(0,b.__)("Default"),settings:{},styles:{}},...null!=i?i:[]].map((e=>{var t;const s={...e?.styles?.blocks}||{};n?.blocks&&Object.keys(n.blocks).forEach((e=>{if(n.blocks[e].css){const t=s[e]||{},i={css:`${s[e]?.css||""} ${n.blocks[e].css.trim()||""}`};s[e]={...t,...i}}}));const i=n?.css||e.styles?.css?{css:`${e.styles?.css||""} ${n?.css||""}`}:{},r=Object.keys(s).length>0?{blocks:s}:{},o={...e.styles,...i,...r};return{...e,settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:o}}))]),[i,n?.blocks,n?.css]);return!i||i?.length<1?null:(0,oe.jsx)(y.__experimentalGrid,{columns:2,className:"edit-site-global-styles-style-variations-container",gap:e,children:r.map(((e,t)=>(0,oe.jsx)(Sc,{variation:e,children:t=>(0,oe.jsx)(wl,{label:e?.title,withHoverView:!0,isFocused:t,variation:e})},t)))})}function Bm(){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:10,className:"edit-site-global-styles-variation-container",children:[(0,oe.jsx)(Rm,{gap:3}),(0,oe.jsx)(Gf,{title:(0,b.__)("Palettes"),gap:3}),(0,oe.jsx)(Cc,{title:(0,b.__)("Typography"),gap:3})]})}const{useZoomOut:Dm}=te(x.privateApis);const Lm=function(){const e=(0,l.useSelect)((e=>e(x.store).getSettings().isPreviewMode),[]),{setDeviceType:t}=(0,l.useDispatch)(h.store);return Dm(!e),(0,d.useEffect)((()=>{t("desktop")}),[t]),(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Browse styles"),description:(0,b.__)("Choose a variation to change the look of the site.")}),(0,oe.jsx)(y.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-style-variations",children:(0,oe.jsx)(y.CardBody,{children:(0,oe.jsx)(Bm,{})})})]})},zm=window.wp.mediaUtils,Gm=[{slug:"theme-colors",title:(0,b.__)("Theme Colors"),origin:"theme",type:"colors"},{slug:"theme-gradients",title:(0,b.__)("Theme Gradients"),origin:"theme",type:"gradients"},{slug:"custom-colors",title:(0,b.__)("Custom Colors"),origin:"custom",type:"colors"},{slug:"custom-gradients",title:(0,b.__)("Custom Gradients"),origin:"custom",type:"gradients"},{slug:"duotones",title:(0,b.__)("Duotones"),origin:"theme",type:"duotones"},{slug:"default-colors",title:(0,b.__)("Default Colors"),origin:"default",type:"colors"},{slug:"default-gradients",title:(0,b.__)("Default Gradients"),origin:"default",type:"gradients"}],Hm=[{slug:"site-identity",title:(0,b.__)("Site Identity"),blocks:["core/site-logo","core/site-title","core/site-tagline"]},{slug:"design",title:(0,b.__)("Design"),blocks:["core/navigation","core/avatar","core/post-time-to-read"],exclude:["core/home-link","core/navigation-link"]},{slug:"posts",title:(0,b.__)("Posts"),blocks:["core/post-title","core/post-excerpt","core/post-author","core/post-author-name","core/post-author-biography","core/post-date","core/post-terms","core/term-description","core/query-title","core/query-no-results","core/query-pagination","core/query-numbers"]},{slug:"comments",title:(0,b.__)("Comments"),blocks:["core/comments-title","core/comments-pagination","core/comments-pagination-numbers","core/comments","core/comments-author-name","core/comment-content","core/comment-date","core/comment-edit-link","core/comment-reply-link","core/comment-template","core/post-comments-count","core/post-comments-link"]}],Um=[{slug:"overview",title:(0,b.__)("Overview"),blocks:[]},{slug:"text",title:(0,b.__)("Text"),blocks:["core/post-content","core/home-link","core/navigation-link"]},{slug:"colors",title:(0,b.__)("Colors"),blocks:[]},{slug:"theme",title:(0,b.__)("Theme"),subcategories:Hm},{slug:"media",title:(0,b.__)("Media"),blocks:["core/post-featured-image"]},{slug:"widgets",title:(0,b.__)("Widgets"),blocks:[]},{slug:"embed",title:(0,b.__)("Embeds"),include:[]}],Wm=[...Hm,{slug:"media",title:(0,b.__)("Media"),blocks:["core/post-featured-image"]},{slug:"widgets",title:(0,b.__)("Widgets"),blocks:[]},{slug:"embed",title:(0,b.__)("Embeds"),include:[]}],qm=[{slug:"overview",title:(0,b.__)("Overview"),blocks:[]},{slug:"text",title:(0,b.__)("Text"),blocks:["core/post-content","core/home-link","core/navigation-link"]},{slug:"colors",title:(0,b.__)("Colors"),blocks:[]},{slug:"blocks",title:(0,b.__)("All Blocks"),blocks:[],subcategories:Wm}];function Zm(e,t){var n;if(!e?.slug||!t?.length)return;const s=null!==(n=e?.subcategories)&&void 0!==n?n:[];if(s.length)return s.reduce(((e,n)=>{const s=Zm(n,t);return s&&(e.subcategories||(e.subcategories=[]),e.subcategories=[...e.subcategories,s]),e}),{title:e.title,slug:e.slug});const i=e?.blocks||[],r=e?.exclude||[],o=t.filter((t=>!r.includes(t.name)&&(t.category===e.slug||i.includes(t.name))));return o.length?{title:e.title,slug:e.slug,examples:o}:void 0}function Km(){const e=[...Hm,...Um].map((({slug:e})=>e)),t=(0,o.getCategories)().filter((({slug:t})=>!e.includes(t)));return[...Um,...t]}const Ym=({colors:e,type:t,templateColumns:n="1fr 1fr",itemHeight:s="52px"})=>e?(0,oe.jsx)(y.__experimentalGrid,{templateColumns:n,rowGap:8,columnGap:16,children:e.map((e=>{const n="gradients"===t?(0,x.__experimentalGetGradientClass)(e.slug):(0,x.getColorClassName)("background-color",e.slug),i=Ut("edit-site-style-book__color-example",n);return(0,oe.jsx)(Yt.View,{className:i,style:{height:s}},e.slug)}))}):null,Xm=({duotones:e})=>e?(0,oe.jsx)(y.__experimentalGrid,{columns:2,rowGap:16,columnGap:16,children:e.map((e=>(0,oe.jsxs)(y.__experimentalGrid,{className:"edit-site-style-book__duotone-example",columns:2,rowGap:8,columnGap:8,children:[(0,oe.jsx)(Yt.View,{children:(0,oe.jsx)("img",{alt:`Duotone example: ${e.slug}`,src:"https://s.w.org/images/core/5.3/MtBlanc1.jpg",style:{filter:`url(#wp-duotone-${e.slug})`}})}),e.colors.map((e=>(0,oe.jsx)(Yt.View,{className:"edit-site-style-book__color-example",style:{backgroundColor:e}},e)))]},e.slug)))}):null;function Jm(e){const t=(0,o.getBlockTypes)().filter((e=>{const{name:t,example:n,supports:s}=e;return"core/heading"!==t&&!!n&&!1!==s?.inserter})).map((e=>({name:e.name,title:e.title,category:e.category,blocks:(0,o.getBlockFromExample)(e.name,{...e.example,attributes:{...e.example.attributes,style:void 0}})})));if(!!!(0,o.getBlockType)("core/heading"))return t;const n={name:"core/heading",title:(0,b.__)("Headings"),category:"text",blocks:[1,2,3,4,5,6].map((e=>(0,o.createBlock)("core/heading",{content:(0,b.sprintf)((0,b.__)("Heading %d"),e),level:e})))},s=function(e){if(!e)return[];const t=[];return Gm.forEach((n=>{const s=e[n.type],i=Array.isArray(s)?s.find((e=>e.slug===n.origin)):void 0;if(i?.[n.type]){const e={name:n.slug,title:n.title,category:"colors"};"duotones"===n.type?(e.content=(0,oe.jsx)(Xm,{duotones:i[n.type]}),t.push(e)):(e.content=(0,oe.jsx)(Ym,{colors:i[n.type],type:n.type}),t.push(e))}})),t}(e),i=function(e){const t=[],n=Array.isArray(e?.colors)?e.colors.find((e=>"theme"===e.slug)):void 0;if(n){const e={name:"theme-colors",title:(0,b.__)("Colors"),category:"overview",content:(0,oe.jsx)(Ym,{colors:n.colors,type:"colors",templateColumns:"repeat(auto-fill, minmax( 200px, 1fr ))",itemHeight:"32px"})};t.push(e)}const s=[];if((0,o.getBlockType)("core/heading")){const e=(0,o.createBlock)("core/heading",{content:(0,b.__)("AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™"),level:1});s.push(e)}if((0,o.getBlockType)("core/paragraph")){const e=(0,o.createBlock)("core/paragraph",{content:(0,b.__)("A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.")}),t=(0,o.createBlock)("core/paragraph",{content:(0,b.__)("Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.")});if((0,o.getBlockType)("core/group")){const n=(0,o.createBlock)("core/group",{layout:{type:"grid",columnCount:2,minimumColumnWidth:"12rem"},style:{spacing:{blockGap:"1.5rem"}}},[e,t]);s.push(n)}else s.push(e)}return s.length&&t.push({name:"typography",title:(0,b.__)("Typography"),category:"overview",blocks:s}),["core/image","core/separator","core/buttons","core/pullquote","core/search"].forEach((e=>{const n=(0,o.getBlockType)(e);if(n&&n.example){const s={name:e,title:n.title,category:"overview",blocks:(0,o.getBlockFromExample)(e,{...n.example,attributes:{...n.example.attributes,style:void 0}})};t.push(s)}})),t}(e);return[n,...s,...t,...i]}function Qm({title:e,subTitle:t,actions:n}){return(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-page-header",as:"header",spacing:0,children:[(0,oe.jsxs)(y.__experimentalHStack,{className:"edit-site-page-header__page-title",children:[(0,oe.jsx)(y.__experimentalHeading,{as:"h2",level:3,weight:500,className:"edit-site-page-header__title",truncate:!0,children:e}),(0,oe.jsx)(y.FlexItem,{className:"edit-site-page-header__actions",children:n})]}),t&&(0,oe.jsx)(y.__experimentalText,{variant:"muted",as:"p",className:"edit-site-page-header__sub-title",children:t})]})}const{NavigableRegion:$m}=te(h.privateApis);function eg({title:e,subTitle:t,actions:n,children:s,className:i,hideTitleFromUI:r=!1}){const o=Ut("edit-site-page",i);return(0,oe.jsx)($m,{className:o,ariaLabel:e,children:(0,oe.jsxs)("div",{className:"edit-site-page-content",children:[!r&&e&&(0,oe.jsx)(Qm,{title:e,subTitle:t,actions:n}),s]})})}const{useLocation:tg,useHistory:ng}=te(Gt.privateApis),sg=({isStyleBookOpened:e,setIsStyleBookOpened:t,path:n})=>{const s=ng();return(0,oe.jsx)(y.Button,{isPressed:e,icon:za,label:(0,b.__)("Style Book"),onClick:()=>{t(!e);const i=e?(0,Qt.removeQueryArgs)(n,"preview"):(0,Qt.addQueryArgs)(n,{preview:"stylebook"});s.navigate(i)},size:"compact"})},ig=()=>{const{path:e,query:t}=tg(),n=ng();return(0,d.useMemo)((()=>{var s;return[null!==(s=t.section)&&void 0!==s?s:"/",t=>{n.navigate((0,Qt.addQueryArgs)(e,{section:t}))}]}),[e,t.section,n])};function rg(){const{path:e}=tg(),[t,n]=(0,d.useState)(e.includes("preview=stylebook")),s=(0,v.useViewportMatch)("medium","<"),[i,r]=ig();return(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsx)(eg,{actions:s?null:(0,oe.jsx)(sg,{isStyleBookOpened:t,setIsStyleBookOpened:n,path:e}),className:"edit-site-styles",title:(0,b.__)("Styles"),children:(0,oe.jsx)($g,{path:i,onPathChange:r})})})}const{ExperimentalBlockEditorProvider:og,useGlobalStyle:ag,GlobalStylesContext:lg,useGlobalStylesOutputWithConfig:cg}=te(x.privateApis),{mergeBaseAndUserConfigs:ug}=te(h.privateApis),{Tabs:dg}=te(y.privateApis);function hg(e){return!e||0===Object.keys(e).length}const pg=(e,t)=>{if(!e||!t||!t?.contentDocument)return;const n="top"===e?t.contentDocument.body:t.contentDocument.getElementById(e);n&&n.scrollIntoView({behavior:"smooth"})},fg=e=>e&&"string"==typeof e&&("/"===e||e.startsWith("/typography")||e.startsWith("/colors")||e.startsWith("/blocks"))?{top:!0}:null;function mg(){const{colors:e,gradients:t}=(0,x.__experimentalUseMultipleOriginColorsAndGradients)(),[n,s,i,r]=(0,x.useSettings)("color.defaultDuotone","color.duotone.custom","color.duotone.theme","color.duotone.default");return(0,d.useMemo)((()=>{const o={colors:e,gradients:t,duotones:[]};return i&&i.length&&o.duotones.push({name:(0,b._x)("Theme","Indicates these duotone filters come from the theme."),slug:"theme",duotones:i}),n&&r&&r.length&&o.duotones.push({name:(0,b._x)("Default","Indicates these duotone filters come from WordPress."),slug:"default",duotones:r}),s&&s.length&&o.duotones.push({name:(0,b._x)("Custom","Indicates these doutone filters are created by the user."),slug:"custom",duotones:s}),o}),[e,t,s,i,r,n])}function gg(e){const t=[],n=Zm({slug:"overview"},e);t.push(...n.examples);const s=e.filter((e=>"overview"!==e.category&&!n.examples.find((t=>t.name===e.name))));return t.push(...s),t}const vg=({userConfig:e={},isStatic:t=!1})=>{const n=(0,l.useSelect)((e=>e(zt).getSettings()),[]),s=(0,l.useSelect)((e=>e(_.store).canUser("create",{kind:"root",name:"media"})),[]);(0,d.useEffect)((()=>{(0,l.dispatch)(x.store).updateSettings({...n,mediaUpload:s?zm.uploadMedia:void 0})}),[n,s]);const[i,r]=ig(),o=Jm(mg()),a=gg(o);let c=null;if(i.includes("/colors"))c="colors";else if(i.includes("/typography"))c="text";else if(i.includes("/blocks")){c="blocks";const e=decodeURIComponent(i).split("/blocks/")[1];e&&o.find((t=>t.name===e))&&(c=e)}else t||(c="overview");const u=qm.find((e=>e.slug===c)),h=u?Zm(u,o):{examples:[o.find((e=>e.name===c))]},p=c?h:{examples:a},{base:f}=(0,d.useContext)(lg),m=fg(i),g=(0,d.useMemo)((()=>hg(e)||hg(f)?{}:ug(f,e)),[f,e]),[v]=cg(g),y=(0,d.useMemo)((()=>({...n,styles:hg(v)||hg(e)?n.styles:v,isPreviewMode:!0})),[v,n,e]);return(0,oe.jsx)("div",{className:"edit-site-style-book",children:(0,oe.jsxs)(x.BlockEditorProvider,{settings:y,children:[(0,oe.jsx)(Ia,{disableRootPadding:!0}),(0,oe.jsx)(xg,{examples:p,settings:y,goTo:m,isSelected:t?null:e=>i===`/blocks/${encodeURIComponent(e)}`||i.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t?null:e=>{Gm.find((t=>t.slug===e))?r("/colors/palette"):r("typography"!==e?`/blocks/${encodeURIComponent(e)}`:"/typography")}})]})})},xg=({examples:e,isSelected:t,onClick:n,onSelect:s,settings:i,title:r,goTo:o})=>{const[a,l]=(0,d.useState)(!1),[c,u]=(0,d.useState)(!1),h=(0,d.useRef)(null),p={role:"button",onFocus:()=>l(!0),onBlur:()=>l(!1),onKeyDown:e=>{if(e.defaultPrevented)return;const{keyCode:t}=e;!n||t!==Jt.ENTER&&t!==Jt.SPACE||(e.preventDefault(),n(e))},onClick:e=>{e.defaultPrevented||n&&(e.preventDefault(),n(e))},readonly:!0};return(0,d.useLayoutEffect)((()=>{c&&h?.current&&o?.top&&pg("top",h?.current)}),[h?.current,o,pg,c]),(0,oe.jsxs)(x.__unstableIframe,{onLoad:()=>u(!0),ref:h,className:Ut("edit-site-style-book__iframe",{"is-focused":a&&!!n,"is-button":!!n}),name:"style-book-canvas",tabIndex:0,...n?p:{},children:[(0,oe.jsx)(x.__unstableEditorStyles,{styles:i.styles}),(0,oe.jsxs)("style",{children:['\n\tbody {\n\t\tposition: relative;\n\t\tpadding: 32px !important;\n\t}\n\n\t\n\t.is-root-container {\n\t\tdisplay: flow-root;\n\t}\n\n\n\t.edit-site-style-book__examples {\n\t\tmax-width: 1200px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t max-width: 900px;\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t\tmargin: 0 auto 40px auto;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example.is-disabled-example {\n\t\tpointer-events: none;\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__duotone-example > div:first-child {\n\t\tdisplay: flex;\n\t\taspect-ratio: 16 / 9;\n\t\tgrid-row: span 1;\n\t\tgrid-column: span 2;\n\t}\n\t.edit-site-style-book__duotone-example img {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tobject-fit: cover;\n\t}\n\t.edit-site-style-book__duotone-example > div:not(:first-child) {\n\t\theight: 20px;\n\t\tborder: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t}\n\n\t.edit-site-style-book__color-example {\n\t\tborder: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t}\n\n\t.edit-site-style-book__subcategory-title,\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\tfont-size: 13px;\n\t\tfont-weight: normal;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\tpadding-top: 8px;\n\t\tborder-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t\tcolor: color-mix( in srgb, currentColor 60%, transparent );\n\t}\n\n\t.edit-site-style-book__subcategory-title {\n\t\tfont-size: 16px;\n\t\tmargin-bottom: 40px;\n \tpadding-bottom: 8px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\t:where(.is-root-container > .wp-block:first-child) {\n\t\tmargin-top: 0;\n\t}\n\t:where(.is-root-container > .wp-block:last-child) {\n\t\tmargin-bottom: 0;\n\t}\n',!!n&&"body { cursor: pointer; } body * { pointer-events: none; }"]}),(0,oe.jsx)(yg,{className:"edit-site-style-book__examples",filteredExamples:e,label:r?(0,b.sprintf)((0,b.__)("Examples of blocks in the %s category"),r):(0,b.__)("Examples of blocks"),isSelected:t,onSelect:s},r)]})},yg=(0,d.memo)((({className:e,filteredExamples:t,label:n,isSelected:s,onSelect:i})=>(0,oe.jsxs)(y.Composite,{orientation:"vertical",className:e,"aria-label":n,role:"grid",children:[!!t?.examples?.length&&t.examples.map((e=>(0,oe.jsx)(_g,{id:`example-${e.name}`,title:e.title,content:e.content,blocks:e.blocks,isSelected:s?.(e.name),onClick:i?()=>i(e.name):null},e.name))),!!t?.subcategories?.length&&t.subcategories.map((e=>(0,oe.jsxs)(y.Composite.Group,{className:"edit-site-style-book__subcategory",children:[(0,oe.jsx)(y.Composite.GroupLabel,{children:(0,oe.jsx)("h2",{className:"edit-site-style-book__subcategory-title",children:e.title})}),(0,oe.jsx)(bg,{examples:e.examples,isSelected:s,onSelect:i})]},`subcategory-${e.slug}`)))]}))),bg=({examples:e,isSelected:t,onSelect:n})=>!!e?.length&&e.map((e=>(0,oe.jsx)(_g,{id:`example-${e.name}`,title:e.title,content:e.content,blocks:e.blocks,isSelected:t?.(e.name),onClick:n?()=>n(e.name):null},e.name))),wg=["example-duotones"],_g=({id:e,title:t,blocks:n,isSelected:s,onClick:i,content:r})=>{const o=(0,l.useSelect)((e=>e(x.store).getSettings()),[]),a=(0,d.useMemo)((()=>({...o,focusMode:!1,isPreviewMode:!0})),[o]),c=(0,d.useMemo)((()=>Array.isArray(n)?n:[n]),[n]),u=wg.includes(e)||!i?{disabled:!0,accessibleWhenDisabled:!!i}:{};return(0,oe.jsx)("div",{role:"row",children:(0,oe.jsx)("div",{role:"gridcell",children:(0,oe.jsxs)(y.Composite.Item,{className:Ut("edit-site-style-book__example",{"is-selected":s,"is-disabled-example":!!u?.disabled}),id:e,"aria-label":i?(0,b.sprintf)((0,b.__)("Open %s styles in Styles panel"),t):void 0,render:(0,oe.jsx)("div",{}),role:i?"button":null,onClick:i,...u,children:[(0,oe.jsx)("span",{className:"edit-site-style-book__example-title",children:t}),(0,oe.jsx)("div",{className:"edit-site-style-book__example-preview","aria-hidden":!0,children:(0,oe.jsx)(y.Disabled,{className:"edit-site-style-book__example-preview__content",children:r||(0,oe.jsxs)(og,{value:c,settings:a,children:[(0,oe.jsx)(x.__unstableEditorStyles,{}),(0,oe.jsx)(x.BlockList,{renderAppender:!1})]})})})]})})})},jg=function({enableResizing:e=!0,isSelected:t,onClick:n,onSelect:s,showCloseButton:i=!0,onClose:r,showTabs:o=!0,userConfig:a={},path:c=""}){const[u]=ag("color.text"),[h]=ag("color.background"),p=mg(),f=(0,d.useMemo)((()=>Jm(p)),[p]),m=(0,d.useMemo)((()=>Km().filter((e=>f.some((t=>t.category===e.slug))))),[f]),g=gg(f),{base:v}=(0,d.useContext)(lg),y=fg(c),w=(0,d.useMemo)((()=>hg(a)||hg(v)?{}:ug(v,a)),[v,a]),_=(0,l.useSelect)((e=>e(x.store).getSettings()),[]),[j]=cg(w),S=(0,d.useMemo)((()=>({..._,styles:hg(j)||hg(a)?_.styles:j,isPreviewMode:!0})),[j,_,a]);return(0,oe.jsx)(Go,{onClose:r,enableResizing:e,closeButtonLabel:i?(0,b.__)("Close"):null,children:(0,oe.jsx)("div",{className:Ut("edit-site-style-book",{"is-button":!!n}),style:{color:u,background:h},children:o?(0,oe.jsxs)(dg,{children:[(0,oe.jsx)("div",{className:"edit-site-style-book__tablist-container",children:(0,oe.jsx)(dg.TabList,{children:m.map((e=>(0,oe.jsx)(dg.Tab,{tabId:e.slug,children:e.title},e.slug)))})}),m.map((e=>{const n=e.slug?Km().find((t=>t.slug===e.slug)):null,i=n?Zm(n,f):{examples:f};return(0,oe.jsx)(dg.TabPanel,{tabId:e.slug,focusable:!1,className:"edit-site-style-book__tabpanel",children:(0,oe.jsx)(xg,{category:e.slug,examples:i,isSelected:t,onSelect:s,settings:S,title:e.title,goTo:y})},e.slug)}))]}):(0,oe.jsx)(xg,{examples:{examples:g},isSelected:t,onClick:n,onSelect:s,settings:S,goTo:y})})})},{useGlobalStyle:Sg,AdvancedPanel:Cg}=te(x.privateApis);const kg=function(){const e=(0,b.__)("Add your own CSS to customize the appearance and layout of your site."),[t]=Sg("",void 0,"user",{shouldDecodeEncode:!1}),[n,s]=Sg("",void 0,"all",{shouldDecodeEncode:!1}),{setEditorCanvasContainerView:i}=te((0,l.useDispatch)(zt));return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("CSS"),description:(0,oe.jsxs)(oe.Fragment,{children:[e,(0,oe.jsx)("br",{}),(0,oe.jsx)(y.ExternalLink,{href:(0,b.__)("https://developer.wordpress.org/advanced-administration/wordpress/css/"),className:"edit-site-global-styles-screen-css-help-link",children:(0,b.__)("Learn more about CSS")})]}),onBack:()=>{i(void 0)}}),(0,oe.jsx)("div",{className:"edit-site-global-styles-screen-css",children:(0,oe.jsx)(Cg,{value:t,onChange:s,inheritedValue:n})})]})},{ExperimentalBlockEditorProvider:Eg,GlobalStylesContext:Pg,useGlobalStylesOutputWithConfig:Ig,__unstableBlockStyleVariationOverridesWithConfig:Tg}=te(x.privateApis),{mergeBaseAndUserConfigs:Og}=te(h.privateApis);function Ag(e){return!e||0===Object.keys(e).length}const Ng=function({userConfig:e,blocks:t}){const{base:n}=(0,d.useContext)(Pg),s=(0,d.useMemo)((()=>Ag(e)||Ag(n)?{}:Og(n,e)),[n,e]),i=(0,d.useMemo)((()=>Array.isArray(t)?t:[t]),[t]),r=(0,l.useSelect)((e=>e(x.store).getSettings()),[]),o=(0,d.useMemo)((()=>({...r,isPreviewMode:!0})),[r]),[a]=Ig(s),c=Ag(a)||Ag(e)?o.styles:a;return(0,oe.jsx)(Go,{title:(0,b.__)("Revisions"),closeButtonLabel:(0,b.__)("Close revisions"),enableResizing:!0,children:(0,oe.jsxs)(x.__unstableIframe,{className:"edit-site-revisions__iframe",name:"revisions",tabIndex:0,children:[(0,oe.jsx)("style",{children:".is-root-container { display: flow-root; }"}),(0,oe.jsx)(y.Disabled,{className:"edit-site-revisions__example-preview__content",children:(0,oe.jsxs)(Eg,{value:i,settings:o,children:[(0,oe.jsx)(x.BlockList,{renderAppender:!1}),(0,oe.jsx)(x.__unstableEditorStyles,{styles:c}),(0,oe.jsx)(Tg,{config:s})]})})]})})},Mg=window.wp.date,{getGlobalStylesChanges:Vg}=te(x.privateApis);function Fg({revision:e,previousRevision:t}){const n=Vg(e,t,{maxResults:7});return n.length?(0,oe.jsx)("ul",{"data-testid":"global-styles-revision-changes",className:"edit-site-global-styles-screen-revisions__changes",children:n.map((e=>(0,oe.jsx)("li",{children:e},e)))}):null}const Rg=function({userRevisions:e,selectedRevisionId:t,onChange:n,canApplyRevision:s,onApplyRevision:i}){const{currentThemeName:r,currentUser:o}=(0,l.useSelect)((e=>{const{getCurrentTheme:t,getCurrentUser:n}=e(_.store),s=t();return{currentThemeName:s?.name?.rendered||s?.stylesheet,currentUser:n()}}),[]),a=(0,Mg.getDate)().getTime(),{datetimeAbbreviated:c}=(0,Mg.getSettings)().formats;return(0,oe.jsx)(y.Composite,{orientation:"vertical",className:"edit-site-global-styles-screen-revisions__revisions-list","aria-label":(0,b.__)("Global styles revisions list"),role:"listbox",children:e.map(((l,u)=>{const{id:d,author:h,modified:p}=l,f="unsaved"===d,m=f?o:h,g=m?.name||(0,b.__)("User"),v=m?.avatar_urls?.[48],x=t?t===d:0===u,w=!s&&x,_="parent"===d,j=(0,Mg.getDate)(p),S=p&&a-j.getTime()>864e5?(0,Mg.dateI18n)(c,j):(0,Mg.humanTimeDiff)(p),C=function(e,t,n,s){return"parent"===e?(0,b.__)("Reset the styles to the theme defaults"):"unsaved"===e?(0,b.sprintf)((0,b.__)("Unsaved changes by %s"),t):s?(0,b.sprintf)((0,b.__)("Changes saved by %1$s on %2$s. This revision matches current editor styles."),t,n):(0,b.sprintf)((0,b.__)("Changes saved by %1$s on %2$s"),t,n)}(d,g,(0,Mg.dateI18n)(c,j),w);return(0,oe.jsxs)(y.Composite.Item,{className:"edit-site-global-styles-screen-revisions__revision-item","aria-current":x,role:"option",onKeyDown:e=>{const{keyCode:t}=e;t!==Jt.ENTER&&t!==Jt.SPACE||n(l)},onClick:e=>{e.preventDefault(),n(l)},"aria-selected":x,"aria-label":C,render:(0,oe.jsx)("div",{}),children:[(0,oe.jsx)("span",{className:"edit-site-global-styles-screen-revisions__revision-item-wrapper",children:_?(0,oe.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[(0,b.__)("Default styles"),(0,oe.jsx)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:r})]}):(0,oe.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[f?(0,oe.jsx)("span",{className:"edit-site-global-styles-screen-revisions__date",children:(0,b.__)("(Unsaved)")}):(0,oe.jsx)("time",{className:"edit-site-global-styles-screen-revisions__date",dateTime:p,children:S}),(0,oe.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:[(0,oe.jsx)("img",{alt:g,src:v}),g]}),x&&(0,oe.jsx)(Fg,{revision:l,previousRevision:u<e.length?e[u+1]:{}})]})}),x&&(w?(0,oe.jsx)("p",{className:"edit-site-global-styles-screen-revisions__applied-text",children:(0,b.__)("These styles are already applied to your site.")}):(0,oe.jsx)(y.Button,{size:"compact",variant:"primary",className:"edit-site-global-styles-screen-revisions__apply-button",onClick:i,"aria-label":(0,b.__)("Apply the selected revision to your site."),children:_?(0,b.__)("Reset to defaults"):(0,b.__)("Apply")}))]},d)}))})};function Bg({currentPage:e,numPages:t,changePage:n,totalItems:s,className:i,disabled:r=!1,buttonVariant:o="tertiary",label:a=(0,b.__)("Pagination")}){return(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,as:"nav","aria-label":a,spacing:3,justify:"flex-start",className:Ut("edit-site-pagination",i),children:[(0,oe.jsx)(y.__experimentalText,{variant:"muted",className:"edit-site-pagination__total",children:(0,b.sprintf)((0,b._n)("%s item","%s items",s),s)}),(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,oe.jsx)(y.Button,{variant:o,onClick:()=>n(1),accessibleWhenDisabled:!0,disabled:r||1===e,label:(0,b.__)("First page"),icon:(0,b.isRTL)()?lu:cu,size:"compact"}),(0,oe.jsx)(y.Button,{variant:o,onClick:()=>n(e-1),accessibleWhenDisabled:!0,disabled:r||1===e,label:(0,b.__)("Previous page"),icon:(0,b.isRTL)()?Yo:Xo,size:"compact"})]}),(0,oe.jsx)(y.__experimentalText,{variant:"muted",children:(0,b.sprintf)((0,b._x)("%1$s of %2$s","paging"),e,t)}),(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,oe.jsx)(y.Button,{variant:o,onClick:()=>n(e+1),accessibleWhenDisabled:!0,disabled:r||e===t,label:(0,b.__)("Next page"),icon:(0,b.isRTL)()?Xo:Yo,size:"compact"}),(0,oe.jsx)(y.Button,{variant:o,onClick:()=>n(t),accessibleWhenDisabled:!0,disabled:r||e===t,label:(0,b.__)("Last page"),icon:(0,b.isRTL)()?cu:lu,size:"compact"})]})]})}const{GlobalStylesContext:Dg,areGlobalStyleConfigsEqual:Lg}=te(x.privateApis);const zg=function(){const{user:e,setUserConfig:t}=(0,d.useContext)(Dg),{blocks:n,editorCanvasContainerView:s}=(0,l.useSelect)((e=>({editorCanvasContainerView:te(e(zt)).getEditorCanvasContainerView(),blocks:e(x.store).getBlocks()})),[]),[i,r]=(0,d.useState)(1),[o,a]=(0,d.useState)([]),{revisions:c,isLoading:u,hasUnsavedChanges:h,revisionsCount:p}=da({query:{per_page:10,page:i}}),f=Math.ceil(p/10),[m,g]=(0,d.useState)(e),[v,w]=(0,d.useState)(!1),{setEditorCanvasContainerView:_}=te((0,l.useDispatch)(zt)),j=Lg(m,e),S=()=>{_("global-styles-revisions:style-book"===s?"style-book":void 0)},C=e=>{t((()=>e)),w(!1),S()};(0,d.useEffect)((()=>{!u&&c.length&&a(c)}),[c,u]);const k=c[0],E=m?.id,P=!!k?.id&&!j&&!E;(0,d.useEffect)((()=>{P&&g(k)}),[P,k]);const I=!!E&&"unsaved"!==E&&!j,T=!!o.length;return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:p&&(0,b.sprintf)((0,b.__)("Revisions (%s)"),p),description:(0,b.__)('Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you\'re ready, use the Save button to save your changes.'),onBack:S}),!T&&(0,oe.jsx)(y.Spinner,{className:"edit-site-global-styles-screen-revisions__loading"}),T&&("global-styles-revisions:style-book"===s?(0,oe.jsx)(jg,{userConfig:m,isSelected:()=>{},onClose:()=>{_("global-styles-revisions")}}):(0,oe.jsx)(Ng,{blocks:n,userConfig:m,closeButtonLabel:(0,b.__)("Close revisions")})),(0,oe.jsx)(Rg,{onChange:g,selectedRevisionId:E,userRevisions:o,canApplyRevision:I,onApplyRevision:()=>h?w(!0):C(m)}),f>1&&(0,oe.jsx)("div",{className:"edit-site-global-styles-screen-revisions__footer",children:(0,oe.jsx)(Bg,{className:"edit-site-global-styles-screen-revisions__pagination",currentPage:i,numPages:f,changePage:r,totalItems:p,disabled:u,label:(0,b.__)("Global Styles pagination")})}),v&&(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:v,confirmButtonText:(0,b.__)("Apply"),onConfirm:()=>C(m),onCancel:()=>w(!1),size:"medium",children:(0,b.__)("Are you sure you want to apply this revision? Any unsaved changes will be lost.")})]})},{useGlobalStylesReset:Gg}=te(x.privateApis),{Slot:Hg,Fill:Ug}=(0,y.createSlotFill)("GlobalStylesMenu");function Wg(){const[e,t]=Gg(),{toggle:n}=(0,l.useDispatch)(f.store),{canEditCSS:s}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(_.store),s=n(),i=s?t("root","globalStyles",s):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),{setEditorCanvasContainerView:i}=te((0,l.useDispatch)(zt)),r=()=>{i("global-styles-css")};return(0,oe.jsx)(Ug,{children:(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("More"),toggleProps:{size:"compact"},children:({onClose:i})=>(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.MenuGroup,{children:[s&&(0,oe.jsx)(y.MenuItem,{onClick:r,children:(0,b.__)("Additional CSS")}),(0,oe.jsx)(y.MenuItem,{onClick:()=>{n("core/edit-site","welcomeGuideStyles"),i()},children:(0,b.__)("Welcome Guide")})]}),(0,oe.jsx)(y.MenuGroup,{children:(0,oe.jsx)(y.MenuItem,{onClick:()=>{t(),i()},disabled:!e,children:(0,b.__)("Reset styles")})})]})})})}function qg({className:e,...t}){return(0,oe.jsx)(y.Navigator.Screen,{className:["edit-site-global-styles-sidebar__navigator-screen",e].filter(Boolean).join(" "),...t})}function Zg({parentMenu:e,blockStyles:t,blockName:n}){return t.map(((t,s)=>(0,oe.jsx)(qg,{path:e+"/variations/"+t.name,children:(0,oe.jsx)(ac,{name:n,variation:t.name})},s)))}function Kg({name:e,parentMenu:t=""}){const n=(0,l.useSelect)((t=>{const{getBlockStyles:n}=t(o.store);return n(e)}),[e]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(qg,{path:t+"/colors/palette",children:(0,oe.jsx)(Jf,{name:e})}),!!n?.length&&(0,oe.jsx)(Zg,{parentMenu:t,blockStyles:n,blockName:e})]})}function Yg(){const e=(0,y.useNavigator)(),{path:t}=e.location;return(0,oe.jsx)(jg,{isSelected:e=>t===`/blocks/${encodeURIComponent(e)}`||t.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t=>{Gm.find((e=>e.slug===t))?e.goTo("/colors/palette"):"typography"!==t?e.goTo("/blocks/"+encodeURIComponent(t)):e.goTo("/typography")}})}function Xg(){const e=(0,y.useNavigator)(),{selectedBlockName:t,selectedBlockClientId:n}=(0,l.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n}=e(x.store),s=t();return{selectedBlockName:n(s),selectedBlockClientId:s}}),[]),s=Vl(t);(0,d.useEffect)((()=>{if(!n||!s)return;const i=e.location.path;if("/blocks"!==i&&!i.startsWith("/blocks/"))return;const r="/blocks/"+encodeURIComponent(t);r!==i&&e.goTo(r,{skipFocus:!0})}),[n,t,s])}function Jg(){const{goTo:e,location:t}=(0,y.useNavigator)(),n=(0,l.useSelect)((e=>te(e(zt)).getEditorCanvasContainerView()),[]),s=t?.path,i="/revisions"===s;(0,d.useEffect)((()=>{switch(n){case"global-styles-revisions":case"global-styles-revisions:style-book":i||e("/revisions");break;case"global-styles-css":e("/css");break;default:i&&e("/",{isBack:!0})}}),[n,i,e])}function Qg({path:e,onPathChange:t,children:n}){return function(e,t){const n=(0,y.useNavigator)(),{path:s}=n.location,i=(0,v.usePrevious)(e),r=(0,v.usePrevious)(s);(0,d.useEffect)((()=>{e!==s&&(e!==i?n.goTo(e):s!==r&&t(s))}),[t,e,r,i,s,n])}(e,t),n}const $g=function({path:e,onPathChange:t}){const n=(0,o.getBlockTypes)(),s=(0,l.useSelect)((e=>te(e(zt)).getEditorCanvasContainerView()),[]);return(0,oe.jsxs)(y.Navigator,{className:"edit-site-global-styles-sidebar__navigator-provider",initialPath:"/",children:[e&&t&&(0,oe.jsx)(Qg,{path:e,onPathChange:t}),(0,oe.jsx)(qg,{path:"/",children:(0,oe.jsx)(jl,{})}),(0,oe.jsx)(qg,{path:"/variations",children:(0,oe.jsx)(Lm,{})}),(0,oe.jsx)(qg,{path:"/blocks",children:(0,oe.jsx)(Bl,{})}),(0,oe.jsx)(qg,{path:"/typography",children:(0,oe.jsx)(sf,{})}),(0,oe.jsx)(qg,{path:"/typography/font-sizes",children:(0,oe.jsx)(Pf,{})}),(0,oe.jsx)(qg,{path:"/typography/font-sizes/:origin/:slug",children:(0,oe.jsx)(_f,{})}),(0,oe.jsx)(qg,{path:"/typography/text",children:(0,oe.jsx)(pf,{element:"text"})}),(0,oe.jsx)(qg,{path:"/typography/link",children:(0,oe.jsx)(pf,{element:"link"})}),(0,oe.jsx)(qg,{path:"/typography/heading",children:(0,oe.jsx)(pf,{element:"heading"})}),(0,oe.jsx)(qg,{path:"/typography/caption",children:(0,oe.jsx)(pf,{element:"caption"})}),(0,oe.jsx)(qg,{path:"/typography/button",children:(0,oe.jsx)(pf,{element:"button"})}),(0,oe.jsx)(qg,{path:"/colors",children:(0,oe.jsx)(Bf,{})}),(0,oe.jsx)(qg,{path:"/shadows",children:(0,oe.jsx)(Sm,{})}),(0,oe.jsx)(qg,{path:"/shadows/edit/:category/:slug",children:(0,oe.jsx)(Cm,{})}),(0,oe.jsx)(qg,{path:"/layout",children:(0,oe.jsx)(Vm,{})}),(0,oe.jsx)(qg,{path:"/css",children:(0,oe.jsx)(kg,{})}),(0,oe.jsx)(qg,{path:"/revisions",children:(0,oe.jsx)(zg,{})}),(0,oe.jsx)(qg,{path:"/background",children:(0,oe.jsx)(rm,{})}),n.map((e=>(0,oe.jsx)(qg,{path:"/blocks/"+encodeURIComponent(e.name),children:(0,oe.jsx)(ac,{name:e.name})},"menu-block-"+e.name))),(0,oe.jsx)(Kg,{}),n.map((e=>(0,oe.jsx)(Kg,{name:e.name,parentMenu:"/blocks/"+encodeURIComponent(e.name)},"screens-block-"+e.name))),"style-book"===s&&(0,oe.jsx)(Yg,{}),(0,oe.jsx)(Wg,{}),(0,oe.jsx)(Xg,{}),(0,oe.jsx)(Jg,{})]})},{ComplementaryArea:ev,ComplementaryAreaMoreMenuItem:tv}=te(h.privateApis);function nv({className:e,identifier:t,title:n,icon:s,children:i,closeLabel:r,header:o,headerClassName:a,panelClassName:l,isActiveByDefault:c}){return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(ev,{className:e,scope:"core",identifier:t,title:n,icon:s,closeLabel:r,header:o,headerClassName:a,panelClassName:l,isActiveByDefault:c,children:i}),(0,oe.jsx)(tv,{scope:"core",identifier:t,icon:s,children:n})]})}const{interfaceStore:sv}=te(h.privateApis),{useLocation:iv}=te(Gt.privateApis);function rv(){const{query:e}=iv(),{canvas:t="view",name:n}=e,{shouldClearCanvasContainerView:s,isStyleBookOpened:i,showListViewByDefault:r,hasRevisions:o,isRevisionsOpened:a,isRevisionsStyleBookOpened:c}=(0,l.useSelect)((e=>{const{getActiveComplementaryArea:n}=e(sv),{getEditorCanvasContainerView:s}=te(e(zt)),i=s(),r="visual"===e(h.store).getEditorMode(),o="edit"===t,a=e(f.store).get("core","showListViewByDefault"),{getEntityRecord:l,__experimentalGetCurrentGlobalStylesId:c}=e(_.store),u=c(),d=u?l("root","globalStyles",u):void 0;return{isStyleBookOpened:"style-book"===i,shouldClearCanvasContainerView:"edit-site/global-styles"!==n("core")||!r||!o,showListViewByDefault:a,hasRevisions:!!d?._links?.["version-history"]?.[0]?.count,isRevisionsStyleBookOpened:"global-styles-revisions:style-book"===i,isRevisionsOpened:"global-styles-revisions"===i}}),[t]),{setEditorCanvasContainerView:u}=te((0,l.useDispatch)(zt)),p=(0,v.useViewportMatch)("medium","<");(0,d.useEffect)((()=>{s&&u(void 0)}),[s,u]);const{setIsListViewOpened:m}=(0,l.useDispatch)(h.store),{getActiveComplementaryArea:g}=(0,l.useSelect)(sv),{enableComplementaryArea:x}=(0,l.useDispatch)(sv),w=(0,d.useRef)(null);return(0,d.useEffect)((()=>{"styles"===n&&"edit"===t?(w.current=g("core"),x("core","edit-site/global-styles")):w.current&&x("core",w.current)}),[n,x,t,g]),(0,oe.jsx)(nv,{className:"edit-site-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,b.__)("Styles"),icon:_o,closeLabel:(0,b.__)("Close Styles"),panelClassName:"edit-site-global-styles-sidebar__panel",header:(0,oe.jsxs)(y.Flex,{className:"edit-site-global-styles-sidebar__header",gap:1,children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)("h2",{className:"edit-site-global-styles-sidebar__header-title",children:(0,b.__)("Styles")})}),(0,oe.jsxs)(y.Flex,{justify:"flex-end",gap:1,className:"edit-site-global-styles-sidebar__header-actions",children:[!p&&(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Button,{icon:za,label:(0,b.__)("Style Book"),isPressed:i||c,accessibleWhenDisabled:!0,disabled:s,onClick:()=>{a?u("global-styles-revisions:style-book"):c?u("global-styles-revisions"):(m(i&&r),u(i?void 0:"style-book"))},size:"compact"})}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Button,{label:(0,b.__)("Revisions"),icon:Eo,onClick:()=>{m(!1),u(c?"style-book":a?void 0:i?"global-styles-revisions:style-book":"global-styles-revisions")},accessibleWhenDisabled:!0,disabled:!o,isPressed:a||c,size:"compact"})}),(0,oe.jsx)(Hg,{})]})]}),children:(0,oe.jsx)($g,{})})}const ov=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})}),av=window.wp.blob;function lv(){const{createErrorNotice:e}=(0,l.useDispatch)(w.store);return(0,oe.jsx)(y.MenuItem,{role:"menuitem",icon:ov,onClick:async function(){try{const e=await oo()({path:"/wp-block-editor/v1/export",parse:!1,headers:{Accept:"application/zip"}}),t=await e.blob(),n=e.headers.get("content-disposition").match(/=(.+)\.zip/),s=n[1]?n[1]:"edit-site-export";(0,av.downloadBlob)(s+".zip",t,"application/zip")}catch(t){let n={};try{n=await t.json()}catch(e){}const s=n.message&&"unknown_error"!==n.code?n.message:(0,b.__)("An error occurred while creating the site export.");e(s,{type:"snackbar"})}},info:(0,b.__)("Download your theme with updated templates and styles."),children:(0,b._x)("Export","site exporter menu item")})}function cv(){const{toggle:e}=(0,l.useDispatch)(f.store);return(0,oe.jsx)(y.MenuItem,{onClick:()=>e("core/edit-site","welcomeGuide"),children:(0,b.__)("Welcome Guide")})}const{ToolsMoreMenuGroup:uv,PreferencesModal:dv}=te(h.privateApis);function hv(){const e=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(uv,{children:[e&&(0,oe.jsx)(lv,{}),(0,oe.jsx)(cv,{})]}),(0,oe.jsx)(dv,{})]})}const{useLocation:pv,useHistory:fv}=te(Gt.privateApis);const{useLocation:mv}=te(Gt.privateApis);const{getTemplateInfo:gv}=te(h.privateApis);const vv=function(e,t){const{title:n,isLoaded:s}=(0,l.useSelect)((n=>{var s;const{getEditedEntityRecord:i,getCurrentTheme:r,hasFinishedResolution:o}=n(_.store);if(!t)return{isLoaded:!1};const a=i("postType",e,t),{default_template_types:l=[]}=null!==(s=r())&&void 0!==s?s:{},c=gv({template:a,templateTypes:l}),u=o("getEditedEntityRecord",["postType",e,t]);return{title:c.title,isLoaded:u}}),[e,t]);let i;var r;s&&(i=(0,b.sprintf)((0,b._x)("%1$s ‹ %2$s","breadcrumb trail"),(0,Kt.decodeEntities)(n),null!==(r=Ve[e])&&void 0!==r?r:Ve[Se])),function(e){const t=mv(),n=(0,l.useSelect)((e=>e(_.store).getEntityRecord("root","site")?.title),[]),s=(0,d.useRef)(!0);(0,d.useEffect)((()=>{s.current=!1}),[t]),(0,d.useEffect)((()=>{if(!s.current&&e&&n){const t=(0,b.sprintf)((0,b.__)("%1$s ‹ %2$s ‹ Editor — WordPress"),(0,Kt.decodeEntities)(e),(0,Kt.decodeEntities)(n));document.title=t,(0,Sl.speak)(e,"assertive")}}),[e,n,t])}(s&&i)};const{useLocation:xv}=te(Gt.privateApis),yv=[Se,Ce,je,Ie.user],bv=["page","post"];function wv(){const e=(0,l.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),n=t("root","__unstableBase");return n?.home}),[]);return(0,oe.jsx)("iframe",{src:(0,Qt.addQueryArgs)(e,{wp_site_preview:1}),title:(0,b.__)("Site Preview"),style:{display:"block",width:"100%",height:"100%",backgroundColor:"#fff"},onLoad:e=>{const t=e.target.contentDocument;tn.focus.focusable.find(t).forEach((e=>{e.style.pointerEvents="none",e.tabIndex=-1,e.setAttribute("aria-hidden","true")}))}})}const{Editor:_v,BackButton:jv}=te(h.privateApis),{useHistory:Sv,useLocation:Cv}=te(Gt.privateApis),{BlockKeyboardShortcuts:kv}=te(a.privateApis),Ev={edit:{opacity:0,scale:.2},hover:{opacity:1,scale:1,clipPath:"inset( 22% round 2px )"}},Pv={edit:{clipPath:"inset(0% round 0px)"},hover:{clipPath:"inset( 22% round 2px )"},tap:{clipPath:"inset(0% round 0px)"}};function Iv(e){switch(e){case"navigation":return"/navigation";case"wp_block":return"/pattern?postType=wp_block";case"wp_template_part":return"/pattern?postType=wp_template_part";case"wp_template":return"/template";case"page":return"/page";case"post":return"/"}throw"Unknown post type"}function Tv({isHomeRoute:e=!1,isPostsList:t=!1}){const n=(0,v.useReducedMotion)(),s=Cv(),{canvas:i="view"}=s.query,r=Cn();!function(e){const{clearSelectedBlock:t}=(0,l.useDispatch)(x.store),{setDeviceType:n,closePublishSidebar:s,setIsListViewOpened:i,setIsInserterOpened:r}=(0,l.useDispatch)(h.store),{get:o}=(0,l.useSelect)(f.store),a=(0,l.useRegistry)();(0,d.useLayoutEffect)((()=>{const l=window.matchMedia("(min-width: 782px)").matches;a.batch((()=>{t(),n("Desktop"),s(),r(!1),l&&"edit"===e&&o("core","showListViewByDefault")&&!o("core","distractionFree")?i(!0):i(!1)}))}),[e,a,t,n,s,r,i,o])}(i);const o=function(){const{name:e,params:t={},query:n}=xv(),{postId:s=n?.postId}=t;let i;"navigation-item"===e?i=je:"pattern-item"===e?i=Ie.user:"template-part-item"===e?i=Ce:"template-item"===e||"templates"===e?i=Se:"page-item"===e||"pages"===e?i="page":"post-item"!==e&&"posts"!==e||(i="post");const r=(0,l.useSelect)((e=>{const{getHomePage:t}=te(e(_.store));return t()}),[]),o=(0,l.useSelect)((e=>{if(yv.includes(i)&&s)return;if(s&&s.includes(","))return;const{getTemplateId:t}=te(e(_.store));return i&&s&&bv.includes(i)?t(i,s):"page"===r?.postType?t("page",r?.postId):"wp_template"===r?.postType?r?.postId:void 0}),[r,s,i]),a=(0,d.useMemo)((()=>yv.includes(i)&&s?{}:i&&s&&bv.includes(i)?{postType:i,postId:s}:"page"===r?.postType?{postType:"page",postId:r?.postId}:{}),[r,i,s]);return yv.includes(i)&&s?{isReady:!0,postType:i,postId:s,context:a}:r?{isReady:void 0!==o,postType:Se,postId:o,context:a}:{isReady:!1}}();!function({postType:e,postId:t,context:n,isReady:s}){const{setEditedEntity:i}=(0,l.useDispatch)(zt);(0,d.useEffect)((()=>{s&&i(e,t,n)}),[s,e,t,n,i])}(o);const{postType:a,postId:c,context:u}=o,{isBlockBasedTheme:p,editorCanvasView:m,currentPostIsTrashed:g,hasSiteIcon:j}=(0,l.useSelect)((e=>{const{getEditorCanvasContainerView:t}=te(e(zt)),{getCurrentTheme:n,getEntityRecord:s}=e(_.store),i=s("root","__unstableBase",void 0);return{isBlockBasedTheme:n()?.is_block_theme,editorCanvasView:t(),currentPostIsTrashed:"trash"===e(h.store).getCurrentPostAttribute("status"),hasSiteIcon:!!i?.site_icon_url}}),[]),S=!!u?.postId;vv(S?u.postType:a,S?u.postId:c);const C=Qr(),k=!zo(),E=function(){const{query:e,path:t}=pv(),n=fv(),{canvas:s="view"}=e,i=(0,l.useSelect)((e=>"trash"===e(h.store).getCurrentPostAttribute("status")),[]),[r,o]=(0,d.useState)(!1);(0,d.useEffect)((()=>{"edit"===s&&o(!1)}),[s]);const a={"aria-label":(0,b.__)("Edit"),"aria-disabled":i,title:null,role:"button",tabIndex:0,onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:e=>{const{keyCode:s}=e;s!==Jt.ENTER&&s!==Jt.SPACE||i||(e.preventDefault(),n.navigate((0,Qt.addQueryArgs)(t,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"}))},onClick:()=>n.navigate((0,Qt.addQueryArgs)(t,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"}),onClickCapture:e=>{i&&(e.preventDefault(),e.stopPropagation())},readonly:!0};return{className:Ut("edit-site-visual-editor__editor-canvas",{"is-focused":r&&"view"===s}),..."view"===s?a:{}}}(),P="edit"===i,I=(0,v.useInstanceId)(Aa,"edit-site-editor__loading-progress"),T=Fa(),O=(0,d.useMemo)((()=>[...T.styles,{css:"view"===i?`body{min-height: 100vh; ${g?"":"cursor: pointer;"}}`:void 0}]),[T.styles,i,g]),{resetZoomLevel:A}=te((0,l.useDispatch)(x.store)),{createSuccessNotice:N}=(0,l.useDispatch)(w.store),M=Sv(),V=(0,d.useCallback)(((e,t)=>{switch(e){case"move-to-trash":case"delete-post":M.navigate(Iv(S?u.postType:a));break;case"duplicate-post":{const e=t[0],n="string"==typeof e.title?e.title:e.title?.rendered;N((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,Kt.decodeEntities)(n)),{type:"snackbar",id:"duplicate-post-action",actions:[{label:(0,b.__)("Edit"),onClick:()=>{M.navigate(`/${e.type}/${e.id}?canvas=edit`)}}]})}}}),[a,u?.postType,S,M,N]),F=Lo(m),R=!r,B={duration:n?0:.2};return!p&&e?(0,oe.jsx)(wv,{}):(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Ia,{disableRootPadding:a!==Se}),(0,oe.jsx)(h.EditorKeyboardShortcutsRegister,{}),P&&(0,oe.jsx)(kv,{}),R?null:(0,oe.jsx)(Aa,{id:I}),P&&(0,oe.jsx)(Ea,{postType:S?u.postType:a}),R&&(0,oe.jsxs)(_v,{postType:S?u.postType:a,postId:S?u.postId:c,templateId:S?c:void 0,settings:T,className:"edit-site-editor__editor-interface",styles:O,customSaveButton:C&&(0,oe.jsx)(to,{size:"compact"}),customSavePanel:C&&(0,oe.jsx)(po,{}),forceDisableBlockTools:!k,title:F,iframeProps:E,onActionPerformed:V,extraSidebarPanels:!S&&(0,oe.jsx)(La.Slot,{}),children:[P&&(0,oe.jsx)(jv,{children:({length:e})=>e<=1&&(0,oe.jsxs)(y.__unstableMotion.div,{className:"edit-site-editor__view-mode-toggle",transition:B,animate:"edit",initial:"edit",whileHover:"hover",whileTap:"tap",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,label:(0,b.__)("Open Navigation"),showTooltip:!0,tooltipPosition:"middle right",onClick:()=>{A(),t&&s.query?.focusMode?M.navigate("/",{transition:"canvas-mode-view-transition"}):M.navigate(function(e,t){const{path:n,name:s}=e;return["pattern-item","template-part-item","page-item","template-item","post-item"].includes(s)?Iv(t):(0,Qt.addQueryArgs)(n,{canvas:void 0})}(s,S?u.postType:a),{transition:"canvas-mode-view-transition"})},children:(0,oe.jsx)(y.__unstableMotion.div,{variants:Pv,children:(0,oe.jsx)(en,{className:"edit-site-editor__view-mode-toggle-icon"})})}),(0,oe.jsx)(y.__unstableMotion.div,{className:Ut("edit-site-editor__back-icon",{"has-site-icon":j}),variants:Ev,children:(0,oe.jsx)(ta,{icon:ba})})]})}),(0,oe.jsx)(hv,{}),p&&(0,oe.jsx)(rv,{})]})]})}function Ov(e){const t=e.currentTheme?.is_block_theme,n=e.currentTheme?.theme_supports["editor-styles"],s=e.editorSettings?.supportsLayout;return!t&&(n||s)}const Av={name:"home",path:"/",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t||Ov(e)?(0,oe.jsx)(xa,{}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t||Ov(e)?(0,oe.jsx)(Tv,{isHomeRoute:!0}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t||Ov(e)?(0,oe.jsx)(xa,{}):(0,oe.jsx)(ya,{})}}},{useLocation:Nv}=te(Gt.privateApis);function Mv(){const{query:e={}}=Nv(),{canvas:t}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(rg,{})}const Vv={name:"styles",path:"/styles",areas:{content:(0,oe.jsx)(rg,{}),sidebar:(0,oe.jsx)(ga,{backPath:"/"}),preview:({query:e})=>"stylebook"===e.preview?(0,oe.jsx)(vg,{}):(0,oe.jsx)(Tv,{}),mobile:(0,oe.jsx)(Mv,{})},widths:{content:380}},Fv={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"};function Rv({menuTitle:e,onClose:t,onSave:n}){const[s,i]=(0,d.useState)(e),r=s!==e&&(o=s,o?.trim()?.length>0);var o;return(0,oe.jsx)(y.Modal,{title:(0,b.__)("Rename"),onRequestClose:t,focusOnMount:"firstContentElement",size:"small",children:(0,oe.jsx)("form",{className:"sidebar-navigation__rename-modal-form",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"3",children:[(0,oe.jsx)(y.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:s,placeholder:(0,b.__)("Navigation title"),onChange:i,label:(0,b.__)("Name")}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"right",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,accessibleWhenDisabled:!0,disabled:!r,variant:"primary",type:"submit",onClick:e=>{e.preventDefault(),r&&(n({title:s}),t())},children:(0,b.__)("Save")})]})]})})})}function Bv({onClose:e,onConfirm:t}){return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{t(),e()},onCancel:e,confirmButtonText:(0,b.__)("Delete"),size:"medium",children:(0,b.__)("Are you sure you want to delete this Navigation Menu?")})}const{useHistory:Dv}=te(Gt.privateApis),Lv={position:"bottom right"};function zv(e){const{onDelete:t,onSave:n,onDuplicate:s,menuTitle:i,menuId:r}=e,[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(!1),u=Dv(),h=()=>{a(!1),c(!1)};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.DropdownMenu,{className:"sidebar-navigation__more-menu",label:(0,b.__)("Actions"),icon:Ga,popoverProps:Lv,children:({onClose:e})=>(0,oe.jsx)("div",{children:(0,oe.jsxs)(y.MenuGroup,{children:[(0,oe.jsx)(y.MenuItem,{onClick:()=>{a(!0),e()},children:(0,b.__)("Rename")}),(0,oe.jsx)(y.MenuItem,{onClick:()=>{u.navigate(`/wp_navigation/${r}?canvas=edit`)},children:(0,b.__)("Edit")}),(0,oe.jsx)(y.MenuItem,{onClick:()=>{s(),e()},children:(0,b.__)("Duplicate")}),(0,oe.jsx)(y.MenuItem,{isDestructive:!0,onClick:()=>{c(!0),e()},children:(0,b.__)("Delete")})]})})}),l&&(0,oe.jsx)(Bv,{onClose:h,onConfirm:t}),o&&(0,oe.jsx)(Rv,{onClose:h,menuTitle:i,onSave:n})]})}const Gv=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),Hv=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),Uv={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"},{useHistory:Wv,useLocation:qv}=te(Gt.privateApis);function Zv(e){const t=Wv(),{path:n}=qv(),{block:s}=e,{clientId:i}=s,{moveBlocksDown:r,moveBlocksUp:o,removeBlocks:a}=(0,l.useDispatch)(x.store),c=(0,b.sprintf)((0,b.__)("Remove %s"),(0,x.BlockTitle)({clientId:i,maximumLength:25})),u=(0,b.sprintf)((0,b.__)("Go to %s"),(0,x.BlockTitle)({clientId:i,maximumLength:25})),h=(0,l.useSelect)((e=>{const{getBlockRootClientId:t}=e(x.store);return t(i)}),[i]),p=(0,d.useCallback)((e=>{const{attributes:s,name:i}=e;"post-type"===s.kind&&s.id&&s.type&&t&&t.navigate(`/${s.type}/${s.id}?canvas=edit`,{state:{backPath:n}}),"core/page-list-item"===i&&s.id&&t&&t.navigate(`/page/${s.id}?canvas=edit`,{state:{backPath:n}})}),[n,t]);return(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:Uv,noIcons:!0,...e,children:({onClose:e})=>(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.MenuGroup,{children:[(0,oe.jsx)(y.MenuItem,{icon:Gv,onClick:()=>{o([i],h),e()},children:(0,b.__)("Move up")}),(0,oe.jsx)(y.MenuItem,{icon:Hv,onClick:()=>{r([i],h),e()},children:(0,b.__)("Move down")}),"page"===s.attributes?.type&&s.attributes?.id&&(0,oe.jsx)(y.MenuItem,{onClick:()=>{p(s),e()},children:u})]}),(0,oe.jsx)(y.MenuGroup,{children:(0,oe.jsx)(y.MenuItem,{onClick:()=>{a([i],!1),e()},children:c})})]})})}const{PrivateListView:Kv}=te(x.privateApis),Yv=["postType","page",{per_page:100,_fields:["id","link","menu_order","parent","title","type"],orderby:"menu_order",order:"asc"}];function Xv({rootClientId:e}){const{listViewRootClientId:t,isLoading:n}=(0,l.useSelect)((t=>{const{areInnerBlocksControlled:n,getBlockName:s,getBlockCount:i,getBlockOrder:r}=t(x.store),{isResolving:o}=t(_.store),a=r(e),l=1===a.length&&"core/page-list"===s(a[0])&&i(a[0])>0,c=o("getEntityRecords",Yv);return{listViewRootClientId:l?a[0]:e,isLoading:!n(e)||c}}),[e]),{replaceBlock:s,__unstableMarkNextChangeAsNotPersistent:i}=(0,l.useDispatch)(x.store),r=(0,d.useCallback)((e=>{"core/navigation-link"!==e.name||e.attributes.url||(i(),s(e.clientId,(0,o.createBlock)("core/navigation-link",e.attributes)))}),[i,s]);return(0,oe.jsxs)(oe.Fragment,{children:[!n&&(0,oe.jsx)(Kv,{rootClientId:t,onSelect:r,blockSettingsMenu:Zv,showAppender:!1}),(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor",children:(0,oe.jsx)(x.BlockList,{})})]})}const Jv=()=>{};function Qv({navigationMenuId:e}){const{storedSettings:t}=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt));return{storedSettings:t()}}),[]),n=(0,d.useMemo)((()=>e?[(0,o.createBlock)("core/navigation",{ref:e})]:[]),[e]);return e&&n?.length?(0,oe.jsx)(x.BlockEditorProvider,{settings:t,value:n,onChange:Jv,onInput:Jv,children:(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__content",children:(0,oe.jsx)(Xv,{rootClientId:n[0].clientId})})}):null}function $v(e,t,n){return e?.rendered?"publish"===n?(0,Kt.decodeEntities)(e?.rendered):(0,b.sprintf)((0,b._x)("%1$s (%2$s)","menu label"),(0,Kt.decodeEntities)(e?.rendered),n):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}function ex({navigationMenu:e,backPath:t,handleDelete:n,handleDuplicate:s,handleSave:i}){const r=e?.title?.rendered;return(0,oe.jsx)(dx,{actions:(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsx)(zv,{menuId:e?.id,menuTitle:(0,Kt.decodeEntities)(r),onDelete:n,onSave:i,onDuplicate:s})}),backPath:t,title:$v(e?.title,e?.id,e?.status),description:(0,b.__)("Navigation Menus are a curated collection of blocks that allow visitors to get around your site."),children:(0,oe.jsx)(Qv,{navigationMenuId:e?.id})})}const{useLocation:tx}=te(Gt.privateApis),nx="wp_navigation";function sx({backPath:e}){const{params:{postId:t}}=tx(),{record:n,isResolving:s}=(0,_.useEntityRecord)("postType",nx,t),{isSaving:i,isDeleting:r}=(0,l.useSelect)((e=>{const{isSavingEntityRecord:n,isDeletingEntityRecord:s}=e(_.store);return{isSaving:n("postType",nx,t),isDeleting:s("postType",nx,t)}}),[t]),o=s||i||r,a=n?.title?.rendered||n?.slug,{handleSave:c,handleDelete:u,handleDuplicate:d}=lx(),h=()=>u(n),p=e=>c(n,e),f=()=>d(n);return o?(0,oe.jsx)(dx,{description:(0,b.__)("Navigation Menus are a curated collection of blocks that allow visitors to get around your site."),backPath:e,children:(0,oe.jsx)(y.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):o||n?n?.content?.raw?(0,oe.jsx)(ex,{navigationMenu:n,backPath:e,handleDelete:h,handleSave:p,handleDuplicate:f}):(0,oe.jsx)(dx,{actions:(0,oe.jsx)(zv,{menuId:n?.id,menuTitle:(0,Kt.decodeEntities)(a),onDelete:h,onSave:p,onDuplicate:f}),backPath:e,title:$v(n?.title,n?.id,n?.status),description:(0,b.__)("This Navigation Menu is empty.")}):(0,oe.jsx)(dx,{description:(0,b.__)("Navigation Menu missing."),backPath:e})}const{useHistory:ix}=te(Gt.privateApis);function rx(){const{deleteEntityRecord:e}=(0,l.useDispatch)(_.store),{createSuccessNotice:t,createErrorNotice:n}=(0,l.useDispatch)(w.store),s=ix();return async i=>{const r=i?.id;try{await e("postType",nx,r,{force:!0},{throwOnError:!0}),t((0,b.__)("Navigation Menu successfully deleted."),{type:"snackbar"}),s.navigate("/navigation")}catch(e){n((0,b.sprintf)((0,b.__)("Unable to delete Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function ox(){const{getEditedEntityRecord:e}=(0,l.useSelect)((e=>{const{getEditedEntityRecord:t}=e(_.store);return{getEditedEntityRecord:t}}),[]),{editEntityRecord:t,__experimentalSaveSpecifiedEntityEdits:n}=(0,l.useDispatch)(_.store),{createSuccessNotice:s,createErrorNotice:i}=(0,l.useDispatch)(w.store);return async(r,o)=>{if(!o)return;const a=r?.id,l=e("postType",je,a);t("postType",nx,a,o);const c=Object.keys(o);try{await n("postType",nx,a,c,{throwOnError:!0}),s((0,b.__)("Renamed Navigation Menu"),{type:"snackbar"})}catch(e){t("postType",nx,a,l),i((0,b.sprintf)((0,b.__)("Unable to rename Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function ax(){const e=ix(),{saveEntityRecord:t}=(0,l.useDispatch)(_.store),{createSuccessNotice:n,createErrorNotice:s}=(0,l.useDispatch)(w.store);return async i=>{const r=i?.title?.rendered||i?.slug;try{const s=await t("postType",nx,{title:(0,b.sprintf)((0,b._x)("%s (Copy)","navigation menu"),r),content:i?.content?.raw,status:"publish"},{throwOnError:!0});s&&(n((0,b.__)("Duplicated Navigation Menu"),{type:"snackbar"}),e.navigate(`/wp_navigation/${s.id}`))}catch(e){s((0,b.sprintf)((0,b.__)("Unable to duplicate Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function lx(){return{handleDelete:rx(),handleSave:ox(),handleDuplicate:ax()}}function cx(e,t,n){return e?"publish"===n?(0,Kt.decodeEntities)(e):(0,b.sprintf)((0,b._x)("%1$s (%2$s)","menu label"),(0,Kt.decodeEntities)(e),n):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}function ux({backPath:e}){const{records:t,isResolving:n,hasResolved:s}=(0,_.useEntityRecords)("postType",je,Fv),i=n&&!s,{getNavigationFallbackId:r}=te((0,l.useSelect)(_.store)),o=(0,l.useSelect)((e=>e(_.store).isResolving("getNavigationFallbackId")),[]),a=t?.[0];a||n||!s||o||r();const{handleSave:c,handleDelete:u,handleDuplicate:d}=lx(),h=!!t?.length;return i?(0,oe.jsx)(dx,{backPath:e,children:(0,oe.jsx)(y.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):i||h?1===t?.length?(0,oe.jsx)(ex,{navigationMenu:a,backPath:e,handleDelete:()=>u(a),handleDuplicate:()=>d(a),handleSave:e=>c(a,e)}):(0,oe.jsx)(dx,{backPath:e,children:(0,oe.jsx)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-navigation-menus",children:t?.map((({id:e,title:t,status:n},s)=>(0,oe.jsx)(hx,{postId:e,withChevron:!0,icon:Wo,children:cx(t?.rendered,s+1,n)},e)))})}):(0,oe.jsx)(dx,{description:(0,b.__)("No Navigation Menus found."),backPath:e})}function dx({children:e,actions:t,title:n,description:s,backPath:i}){return(0,oe.jsx)(ea,{title:n||(0,b.__)("Navigation"),actions:t,description:s||(0,b.__)("Manage your Navigation Menus."),backPath:i,content:e})}const hx=({postId:e,...t})=>(0,oe.jsx)(oa,{to:`/wp_navigation/${e}`,...t}),{useLocation:px}=te(Gt.privateApis);function fx(){const{query:e={}}=px(),{canvas:t="view"}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ux,{backPath:"/"})}const mx={name:"navigation",path:"/navigation",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(ux,{backPath:"/"}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(fx,{}):(0,oe.jsx)(ya,{})}}},{useLocation:gx}=te(Gt.privateApis);function vx(){const{query:e={}}=gx(),{canvas:t="view"}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(sx,{backPath:"/navigation"})}const xx={name:"navigation-item",path:"/wp_navigation/:postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(sx,{backPath:"/navigation"}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(vx,{}):(0,oe.jsx)(ya,{})}}},yx=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"})});function bx({count:e,icon:t,id:n,isActive:s,label:i,type:r}){if(!e)return;const o=[`postType=${r}`];return n&&o.push(`categoryId=${n}`),(0,oe.jsx)(oa,{icon:t,suffix:(0,oe.jsx)("span",{children:e}),"aria-current":s?"true":void 0,to:`/pattern?${o.join("&")}`,children:i})}const wx=(e,t,n)=>t===n.findIndex((t=>e.name===t.name));const{extractWords:_x,getNormalizedSearchTerms:jx,normalizeString:Sx}=te(x.privateApis),Cx=e=>e.type===Ie.user?e.slug:e.type===Ce?"":e.name||"",kx=e=>"string"==typeof e.title?e.title:e.title&&e.title.rendered?e.title.rendered:e.title&&e.title.raw?e.title.raw:"",Ex=e=>e.type===Ie.user?e.excerpt.raw:e.description||"",Px=e=>e.keywords||[],Ix=()=>!1,Tx=(e=[],t="",n={})=>{const s=jx(t),i=n.categoryId!==Te&&!s.length,r={...n,onlyFilterByCategory:i},o=i?0:1,a=e.map((e=>[e,Ox(e,t,r)])).filter((([,e])=>e>o));return 0===s.length||a.sort((([,e],[,t])=>t-e)),a.map((([e])=>e))};function Ox(e,t,n){const{categoryId:s,getName:i=Cx,getTitle:r=kx,getDescription:o=Ex,getKeywords:a=Px,hasCategory:l=Ix,onlyFilterByCategory:c}=n;let u=s===Te||s===Pe||s===Oe&&e.type===Ie.user||l(e,s)?1:0;if(!u||c)return u;const d=i(e),h=r(e),p=o(e),f=a(e),m=Sx(t),g=Sx(h);if(m===g)u+=30;else if(g.startsWith(m))u+=20;else{const e=[d,h,p,...f].join(" ");0===((e,t)=>e.filter((e=>!jx(t).some((t=>t.includes(e))))))(_x(m),e).length&&(u+=10)}return u}const Ax=[],Nx=(0,l.createSelector)(((e,t,n="")=>{var s;const{getEntityRecords:i,getCurrentTheme:r,isResolving:o}=e(_.store),a={per_page:-1},l=null!==(s=i("postType",Ce,a))&&void 0!==s?s:Ax,c=(r()?.default_template_part_areas||[]).map((e=>e.area)),u=o("getEntityRecords",["postType",Ce,a]),d=Tx(l,n,{categoryId:t,hasCategory:(e,t)=>t!==Ee?e.area===t:e.area===t||!c.includes(e.area)});return{patterns:d,isResolving:u}}),(e=>[e(_.store).getEntityRecords("postType",Ce,{per_page:-1}),e(_.store).isResolving("getEntityRecords",["postType",Ce,{per_page:-1}]),e(_.store).getCurrentTheme()?.default_template_part_areas])),Mx=(0,l.createSelector)((e=>{var t;const{getSettings:n}=te(e(zt)),{isResolving:s}=e(_.store),i=n();return{patterns:[...(null!==(t=i.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:i.__experimentalBlockPatterns)||[],...e(_.store).getBlockPatterns()||[]].filter((e=>!Ae.includes(e.source))).filter(wx).filter((e=>!1!==e.inserter)).map((e=>({...e,keywords:e.keywords||[],type:Ie.theme,blocks:(0,o.parse)(e.content,{__unstableSkipMigrationLogs:!0})}))),isResolving:s("getBlockPatterns")}}),(e=>[e(_.store).getBlockPatterns(),e(_.store).isResolving("getBlockPatterns"),te(e(zt)).getSettings()])),Vx=(0,l.createSelector)(((e,t,n,s="")=>{const{patterns:i,isResolving:r}=Mx(e),{patterns:o,isResolving:a,categories:l}=Fx(e);let c=[...i||[],...o||[]];return n&&(c=c.filter((e=>e.type===Ie.user?(e.wp_pattern_sync_status||Ne.full)===n:n===Ne.unsynced))),c=Tx(c,s,t?{categoryId:t,hasCategory:(e,t)=>e.type===Ie.user?e.wp_pattern_category?.some((e=>l.find((t=>t.id===e))?.slug===t)):e.categories?.includes(t)}:{hasCategory:e=>e.type===Ie.user?l?.length&&(!e.wp_pattern_category?.length||!e.wp_pattern_category?.some((e=>l.find((t=>t.id===e))))):!e.hasOwnProperty("categories")}),{patterns:c,isResolving:r||a}}),(e=>[Mx(e),Fx(e)])),Fx=(0,l.createSelector)(((e,t,n="")=>{const{getEntityRecords:s,isResolving:i,getUserPatternCategories:r}=e(_.store),o={per_page:-1},a=s("postType",Ie.user,o),l=r(),c=new Map;l.forEach((e=>c.set(e.id,e)));let u=null!=a?a:Ax;const d=i("getEntityRecords",["postType",Ie.user,o]);return t&&(u=u.filter((e=>e.wp_pattern_sync_status||Ne.full===t))),u=Tx(u,n,{hasCategory:()=>!0}),{patterns:u,isResolving:d,categories:l}}),(e=>[e(_.store).getEntityRecords("postType",Ie.user,{per_page:-1}),e(_.store).isResolving("getEntityRecords",["postType",Ie.user,{per_page:-1}]),e(_.store).getUserPatternCategories()]));const Rx=(e,t,{search:n="",syncStatus:s}={})=>(0,l.useSelect)((i=>{if(e===Ce)return Nx(i,t,n);if(e===Ie.user&&t){return Vx(i,"uncategorized"===t?"":t,s,n)}return e===Ie.user?Fx(i,s,n):{patterns:Ax,isResolving:!1}}),[t,e,n,s]);function Bx(){const e=function(){const e=(0,l.useSelect)((e=>{var t;const{getSettings:n}=te(e(zt)),s=n();return null!==(t=s.__experimentalAdditionalBlockPatternCategories)&&void 0!==t?t:s.__experimentalBlockPatternCategories}));return[...e||[],...(0,l.useSelect)((e=>e(_.store).getBlockPatternCategories()))||[]]}();e.push({name:Ee,label:(0,b.__)("Uncategorized")});const t=function(){const e=(0,l.useSelect)((e=>{var t;const{getSettings:n}=te(e(zt));return null!==(t=n().__experimentalAdditionalBlockPatterns)&&void 0!==t?t:n().__experimentalBlockPatterns})),t=(0,l.useSelect)((e=>e(_.store).getBlockPatterns()));return(0,d.useMemo)((()=>[...e||[],...t||[]].filter((e=>!Ae.includes(e.source))).filter(wx).filter((e=>!1!==e.inserter))),[e,t])}(),{patterns:n,categories:s}=Rx(Ie.user),i=(0,d.useMemo)((()=>{const i={},r=[];e.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),s.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),t.forEach((e=>{e.categories?.forEach((e=>{i[e]&&(i[e].count+=1)})),e.categories?.length||(i.uncategorized.count+=1)})),n.forEach((e=>{e.wp_pattern_category?.forEach((e=>{const t=s.find((t=>t.id===e))?.name;i[t]&&(i[t].count+=1)})),e.wp_pattern_category?.length&&e.wp_pattern_category?.some((e=>s.find((t=>t.id===e))))||(i.uncategorized.count+=1)})),[...e,...s].forEach((e=>{i[e.name].count&&!r.find((t=>t.name===e.name))&&r.push(i[e.name])}));const o=r.sort(((e,t)=>e.label.localeCompare(t.label)));return o.unshift({name:Oe,label:(0,b.__)("My patterns"),count:n.length}),o.unshift({name:Te,label:(0,b.__)("All patterns"),description:(0,b.__)("A list of all patterns from all sources."),count:t.length+n.length}),o}),[e,t,s,n]);return{patternCategories:i,hasPatterns:!!i.length}}const Dx=e=>{const t=e||[],n=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.default_template_part_areas||[]),[]),s={header:{},footer:{},sidebar:{},uncategorized:{}};n.forEach((e=>s[e.area]={...e,templateParts:[]}));return t.reduce(((e,t)=>{const n=e[t.area]?t.area:Ee;return e[n]?.templateParts?.push(t),e}),s)};const{useLocation:Lx}=te(Gt.privateApis);function zx({templatePartAreas:e,patternCategories:t,currentCategory:n,currentType:s}){const[i,...r]=t;return(0,oe.jsxs)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:[(0,oe.jsx)(bx,{count:Object.values(e).map((({templateParts:e})=>e?.length||0)).reduce(((e,t)=>e+t),0),icon:(0,h.getTemplatePartIcon)(),label:(0,b.__)("All template parts"),id:Pe,type:Ce,isActive:n===Pe&&s===Ce},"all"),Object.entries(e).map((([e,{label:t,templateParts:i}])=>(0,oe.jsx)(bx,{count:i?.length,icon:(0,h.getTemplatePartIcon)(e),label:t,id:e,type:Ce,isActive:n===e&&s===Ce},e))),(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen-patterns__divider"}),i&&(0,oe.jsx)(bx,{count:i.count,label:i.label,icon:yx,id:i.name,type:Ie.user,isActive:n===`${i.name}`&&s===Ie.user},i.name),r.map((e=>(0,oe.jsx)(bx,{count:e.count,label:e.label,icon:yx,id:e.name,type:Ie.user,isActive:n===`${e.name}`&&s===Ie.user},e.name)))]})}function Gx({backPath:e}){const{query:{postType:t="wp_block",categoryId:n}}=Lx(),s=n||(t===Ie.user?Te:Pe),{templatePartAreas:i,hasTemplateParts:r,isLoading:o}=function(){const{records:e,isResolving:t}=(0,_.useEntityRecords)("postType",Ce,{per_page:-1});return{hasTemplateParts:!!e&&!!e.length,isLoading:t,templatePartAreas:Dx(e)}}(),{patternCategories:a,hasPatterns:l}=Bx();return(0,oe.jsx)(ea,{title:(0,b.__)("Patterns"),description:(0,b.__)("Manage what patterns are available when editing the site."),isRoot:!e,backPath:e,content:(0,oe.jsxs)(oe.Fragment,{children:[o&&(0,b.__)("Loading items…"),!o&&(0,oe.jsxs)(oe.Fragment,{children:[!r&&!l&&(0,oe.jsx)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:(0,oe.jsx)(y.__experimentalItem,{children:(0,b.__)("No items found")})}),(0,oe.jsx)(zx,{templatePartAreas:i,patternCategories:a,currentCategory:s,currentType:t})]})]})})}var Hx=i(9681),Ux=i.n(Hx);const Wx=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})}),qx=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})}),Zx="is",Kx="isNot",Yx="isAny",Xx="isNone",Jx="isAll",Qx="isNotAll",$x=[Zx,Kx,Yx,Xx,Jx,Qx],ey={[Zx]:{key:"is-filter",label:(0,b.__)("Is")},[Kx]:{key:"is-not-filter",label:(0,b.__)("Is not")},[Yx]:{key:"is-any-filter",label:(0,b.__)("Is any")},[Xx]:{key:"is-none-filter",label:(0,b.__)("Is none")},[Jx]:{key:"is-all-filter",label:(0,b.__)("Is all")},[Qx]:{key:"is-not-all-filter",label:(0,b.__)("Is not all")}},ty=["asc","desc"],ny={asc:"↑",desc:"↓"},sy={asc:"ascending",desc:"descending"},iy={asc:(0,b.__)("Sort ascending"),desc:(0,b.__)("Sort descending")},ry={asc:Wx,desc:qx},oy="table",ay="grid";const ly={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:function(e,t){if(""===e)return!1;if(!Number.isInteger(Number(e)))return!1;if(t?.elements){const n=t?.elements.map((e=>e.value));if(!n.includes(Number(e)))return!1}return!0},Edit:"integer"};const cy={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:function(e,t){if(t?.elements){const n=t?.elements?.map((e=>e.value));if(!n.includes(e))return!1}return!0},Edit:"text"};const uy={sort:function(e,t,n){const s=new Date(e).getTime(),i=new Date(t).getTime();return"asc"===n?s-i:i-s},isValid:function(e,t){if(t?.elements){const n=t?.elements.map((e=>e.value));if(!n.includes(e))return!1}return!0},Edit:"datetime"};const dy={datetime:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){const{id:i,label:r}=t,o=t.getValue({item:e}),a=(0,d.useCallback)((e=>n({[i]:e})),[i,n]);return(0,oe.jsxs)("fieldset",{className:"dataviews-controls__datetime",children:[!s&&(0,oe.jsx)(y.BaseControl.VisualLabel,{as:"legend",children:r}),s&&(0,oe.jsx)(y.VisuallyHidden,{as:"legend",children:r}),(0,oe.jsx)(y.TimePicker,{currentTime:o,onChange:a,hideLabelFromVision:!0})]})},integer:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){var i;const{id:r,label:o,description:a}=t,l=null!==(i=t.getValue({item:e}))&&void 0!==i?i:"",c=(0,d.useCallback)((e=>n({[r]:Number(e)})),[r,n]);return(0,oe.jsx)(y.__experimentalNumberControl,{label:o,help:a,value:l,onChange:c,__next40pxDefaultSize:!0,hideLabelFromVision:s})},radio:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){const{id:i,label:r}=t,o=t.getValue({item:e}),a=(0,d.useCallback)((e=>n({[i]:e})),[i,n]);return t.elements?(0,oe.jsx)(y.RadioControl,{label:r,onChange:a,options:t.elements,selected:o,hideLabelFromVision:s}):null},select:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){var i,r;const{id:o,label:a}=t,l=null!==(i=t.getValue({item:e}))&&void 0!==i?i:"",c=(0,d.useCallback)((e=>n({[o]:e})),[o,n]),u=[{label:(0,b.__)("Select item"),value:""},...null!==(r=t?.elements)&&void 0!==r?r:[]];return(0,oe.jsx)(y.SelectControl,{label:a,value:l,options:u,onChange:c,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:s})},text:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){const{id:i,label:r,placeholder:o}=t,a=t.getValue({item:e}),l=(0,d.useCallback)((e=>n({[i]:e})),[i,n]);return(0,oe.jsx)(y.TextControl,{label:r,placeholder:o,value:null!=a?a:"",onChange:l,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:s})}};function hy(e){if(Object.keys(dy).includes(e))return dy[e];throw"Control "+e+" not found"}function py(e){return e.map((e=>{var t,n,s,i;const r="integer"===(o=e.type)?ly:"text"===o?cy:"datetime"===o?uy:{sort:(e,t,n)=>"number"==typeof e&&"number"==typeof t?"asc"===n?e-t:t-e:"asc"===n?e.localeCompare(t):t.localeCompare(e),isValid:(e,t)=>{if(t?.elements){const n=t?.elements?.map((e=>e.value));if(!n.includes(e))return!1}return!0},Edit:()=>null};var o;const a=e.getValue||(l=e.id,({item:e})=>{const t=l.split(".");let n=e;for(const e of t)n=n.hasOwnProperty(e)?n[e]:void 0;return n});var l;const c=null!==(t=e.sort)&&void 0!==t?t:function(e,t,n){return r.sort(a({item:e}),a({item:t}),n)},u=null!==(n=e.isValid)&&void 0!==n?n:function(e,t){return r.isValid(a({item:e}),t)},d=function(e,t){return"function"==typeof e.Edit?e.Edit:"string"==typeof e.Edit?hy(e.Edit):e.elements?hy("select"):"string"==typeof t.Edit?hy(t.Edit):t.Edit}(e,r),h=e.render||(e.elements?({item:t})=>{const n=a({item:t});return e?.elements?.find((e=>e.value===n))?.label||a({item:t})}:a);return{...e,label:e.label||e.id,header:e.header||e.label||e.id,getValue:a,render:h,sort:c,isValid:u,Edit:d,enableHiding:null===(s=e.enableHiding)||void 0===s||s,enableSorting:null===(i=e.enableSorting)||void 0===i||i}}))}function fy(e=""){return Ux()(e.trim().toLowerCase())}const my=[];function gy(e,t,n){if(!e)return{data:my,paginationInfo:{totalItems:0,totalPages:0}};const s=py(n);let i=[...e];if(t.search){const e=fy(t.search);i=i.filter((t=>s.filter((e=>e.enableGlobalSearch)).map((e=>fy(e.getValue({item:t})))).some((t=>t.includes(e)))))}if(t.filters&&t.filters?.length>0&&t.filters.forEach((e=>{const t=s.find((t=>t.id===e.field));t&&(e.operator===Yx&&e?.value?.length>0?i=i.filter((n=>{const s=t.getValue({item:n});return Array.isArray(s)?e.value.some((e=>s.includes(e))):"string"==typeof s&&e.value.includes(s)})):e.operator===Xx&&e?.value?.length>0?i=i.filter((n=>{const s=t.getValue({item:n});return Array.isArray(s)?!e.value.some((e=>s.includes(e))):"string"==typeof s&&!e.value.includes(s)})):e.operator===Jx&&e?.value?.length>0?i=i.filter((n=>e.value.every((e=>t.getValue({item:n})?.includes(e))))):e.operator===Qx&&e?.value?.length>0?i=i.filter((n=>e.value.every((e=>!t.getValue({item:n})?.includes(e))))):e.operator===Zx?i=i.filter((n=>e.value===t.getValue({item:n}))):e.operator===Kx&&(i=i.filter((n=>e.value!==t.getValue({item:n})))))})),t.sort){const e=t.sort.field,n=s.find((t=>t.id===e));n&&i.sort(((e,s)=>{var i;return n.sort(e,s,null!==(i=t.sort?.direction)&&void 0!==i?i:"desc")}))}let r=i.length,o=1;if(void 0!==t.page&&void 0!==t.perPage){const e=(t.page-1)*t.perPage;r=i?.length||0,o=Math.ceil(r/t.perPage),i=i?.slice(e,e+t.perPage)}return{data:i,paginationInfo:{totalItems:r,totalPages:o}}}const vy=(0,d.createContext)({view:{type:oy},onChangeView:()=>{},fields:[],data:[],paginationInfo:{totalItems:0,totalPages:0},selection:[],onChangeSelection:()=>{},setOpenedFilter:()=>{},openedFilter:null,getItemId:e=>e.id,isItemClickable:()=>!0,containerWidth:0}),xy=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})});var yy=Object.defineProperty,by=Object.defineProperties,wy=Object.getOwnPropertyDescriptors,_y=Object.getOwnPropertySymbols,jy=Object.prototype.hasOwnProperty,Sy=Object.prototype.propertyIsEnumerable,Cy=(e,t,n)=>t in e?yy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ky=(e,t)=>{for(var n in t||(t={}))jy.call(t,n)&&Cy(e,n,t[n]);if(_y)for(var n of _y(t))Sy.call(t,n)&&Cy(e,n,t[n]);return e},Ey=(e,t)=>by(e,wy(t)),Py=(e,t)=>{var n={};for(var s in e)jy.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&_y)for(var s of _y(e))t.indexOf(s)<0&&Sy.call(e,s)&&(n[s]=e[s]);return n},Iy=Object.defineProperty,Ty=Object.defineProperties,Oy=Object.getOwnPropertyDescriptors,Ay=Object.getOwnPropertySymbols,Ny=Object.prototype.hasOwnProperty,My=Object.prototype.propertyIsEnumerable,Vy=(e,t,n)=>t in e?Iy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fy=(e,t)=>{for(var n in t||(t={}))Ny.call(t,n)&&Vy(e,n,t[n]);if(Ay)for(var n of Ay(t))My.call(t,n)&&Vy(e,n,t[n]);return e},Ry=(e,t)=>Ty(e,Oy(t)),By=(e,t)=>{var n={};for(var s in e)Ny.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&Ay)for(var s of Ay(e))t.indexOf(s)<0&&My.call(e,s)&&(n[s]=e[s]);return n};function Dy(...e){}function Ly(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function zy(...e){return(...t)=>{for(const n of e)"function"==typeof n&&n(...t)}}function Gy(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Hy(e){return e}function Uy(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function Wy(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function qy(e){const t={};for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}function Zy(...e){for(const t of e)if(void 0!==t)return t}function Ky(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function Yy(e){if(!function(e){return!!e&&!!(0,Un.isValidElement)(e)&&("ref"in e.props||"ref"in e)}(e))return null;return ky({},e.props).ref||e.ref}var Xy,Jy="undefined"!=typeof window&&!!(null==(Xy=window.document)?void 0:Xy.createElement);function Qy(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function $y(e,t=!1){const{activeElement:n}=Qy(e);if(!(null==n?void 0:n.nodeName))return null;if("IFRAME"===n.tagName&&n.contentDocument)return $y(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Qy(n).getElementById(e);if(t)return t}}return n}function eb(e,t){return e===t||e.contains(t)}function tb(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==nb.indexOf(e.type)}var nb=["button","color","file","image","reset","submit"];function sb(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName;return t||n||!1}catch(e){return!1}}function ib(e){return e.isContentEditable||sb(e)}function rb(e){let t=0,n=0;if(sb(e))t=e.selectionStart||0,n=e.selectionEnd||0;else if(e.isContentEditable){const s=Qy(e).getSelection();if((null==s?void 0:s.rangeCount)&&s.anchorNode&&eb(e,s.anchorNode)&&s.focusNode&&eb(e,s.focusNode)){const i=s.getRangeAt(0),r=i.cloneRange();r.selectNodeContents(e),r.setEnd(i.startContainer,i.startOffset),t=r.toString().length,r.setEnd(i.endContainer,i.endOffset),n=r.toString().length}}return{start:t,end:n}}function ob(e,t){const n=null==e?void 0:e.getAttribute("role");return n&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(n)?n:t}function ab(e){if(!e)return null;const t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){const{overflowY:n}=getComputedStyle(e);if(t(n))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){const{overflowX:n}=getComputedStyle(e);if(t(n))return e}return ab(e.parentElement)||document.scrollingElement||document.body}function lb(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function cb(e,t){const n=e.map(((e,t)=>[t,e]));let s=!1;return n.sort((([e,n],[i,r])=>{const o=t(n),a=t(r);return o===a?0:o&&a?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(o,a)?(e>i&&(s=!0),-1):(e<i&&(s=!0),1):0})),s?n.map((([e,t])=>t)):e}function ub(){return Jy&&!!navigator.maxTouchPoints}function db(){return!!Jy&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function hb(){return Jy&&db()&&/apple/i.test(navigator.vendor)}function pb(e){return Boolean(e.currentTarget&&!eb(e.currentTarget,e.target))}function fb(e){return e.target===e.currentTarget}function mb(e,t){const n=new FocusEvent("blur",t),s=e.dispatchEvent(n),i=Ry(Fy({},t),{bubbles:!0});return e.dispatchEvent(new FocusEvent("focusout",i)),s}function gb(e,t){const n=new MouseEvent("click",t);return e.dispatchEvent(n)}function vb(e,t){const n=t||e.currentTarget,s=e.relatedTarget;return!s||!eb(n,s)}function xb(e,t,n,s){const i=(e=>{if(s){const t=setTimeout(e,s);return()=>clearTimeout(t)}const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})((()=>{e.removeEventListener(t,r,!0),n()})),r=()=>{i(),n()};return e.addEventListener(t,r,{once:!0,capture:!0}),i}function yb(e,t,n,s=window){const i=[];try{s.document.addEventListener(e,t,n);for(const r of Array.from(s.frames))i.push(yb(e,t,n,r))}catch(e){}return()=>{try{s.document.removeEventListener(e,t,n)}catch(e){}for(const e of i)e()}}var bb=ky({},Wn),wb=bb.useId,_b=(bb.useDeferredValue,bb.useInsertionEffect),jb=Jy?Un.useLayoutEffect:Un.useEffect;function Sb(e){const t=(0,Un.useRef)((()=>{throw new Error("Cannot call an event handler while rendering.")}));return _b?_b((()=>{t.current=e})):t.current=e,(0,Un.useCallback)(((...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)}),[])}function Cb(...e){return(0,Un.useMemo)((()=>{if(e.some(Boolean))return t=>{for(const n of e)Ky(n,t)}}),e)}function kb(e){if(wb){const t=wb();return e||t}const[t,n]=(0,Un.useState)(e);return jb((()=>{if(e||t)return;const s=Math.random().toString(36).slice(2,8);n(`id-${s}`)}),[e,t]),e||t}function Eb(e,t,n){const s=function(e){const[t]=(0,Un.useState)(e);return t}(n),[i,r]=(0,Un.useState)(s);return(0,Un.useEffect)((()=>{const n=e&&"current"in e?e.current:e;if(!n)return;const i=()=>{const e=n.getAttribute(t);r(null==e?s:e)},o=new MutationObserver(i);return o.observe(n,{attributeFilter:[t]}),i(),()=>o.disconnect()}),[e,t,s]),i}function Pb(e,t){const n=(0,Un.useRef)(!1);(0,Un.useEffect)((()=>{if(n.current)return e();n.current=!0}),t),(0,Un.useEffect)((()=>()=>{n.current=!1}),[])}function Ib(e){return Sb("function"==typeof e?e:()=>e)}function Tb(e,t,n=[]){const s=(0,Un.useCallback)((n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n))),[...n,e.wrapElement]);return Ey(ky({},e),{wrapElement:s})}var Ob=!1,Ab=0,Nb=0;function Mb(e){(function(e){const t=e.movementX||e.screenX-Ab,n=e.movementY||e.screenY-Nb;return Ab=e.screenX,Nb=e.screenY,t||n||!1})(e)&&(Ob=!0)}function Vb(){Ob=!1}function Fb(e){const t=Un.forwardRef(((t,n)=>e(Ey(ky({},t),{ref:n}))));return t.displayName=e.displayName||e.name,t}function Rb(e,t){return Un.memo(e,t)}function Bb(e,t){const n=t,{wrapElement:s,render:i}=n,r=Py(n,["wrapElement","render"]),o=Cb(t.ref,Yy(i));let a;if(Un.isValidElement(i)){const e=Ey(ky({},i.props),{ref:o});a=Un.cloneElement(i,function(e,t){const n=ky({},e);for(const s in t){if(!Ly(t,s))continue;if("className"===s){const s="className";n[s]=e[s]?`${e[s]} ${t[s]}`:t[s];continue}if("style"===s){const s="style";n[s]=e[s]?ky(ky({},e[s]),t[s]):t[s];continue}const i=t[s];if("function"==typeof i&&s.startsWith("on")){const t=e[s];if("function"==typeof t){n[s]=(...e)=>{i(...e),t(...e)};continue}}n[s]=i}return n}(r,e))}else a=i?i(r):(0,oe.jsx)(e,ky({},r));return s?s(a):a}function Db(e){const t=(t={})=>e(t);return t.displayName=e.name,t}function Lb(e=[],t=[]){const n=Un.createContext(void 0),s=Un.createContext(void 0),i=()=>Un.useContext(n),r=t=>e.reduceRight(((e,n)=>(0,oe.jsx)(n,Ey(ky({},t),{children:e}))),(0,oe.jsx)(n.Provider,ky({},t)));return{context:n,scopedContext:s,useContext:i,useScopedContext:(e=!1)=>{const t=Un.useContext(s),n=i();return e?t:t||n},useProviderContext:()=>{const e=Un.useContext(s),t=i();if(!e||e!==t)return t},ContextProvider:r,ScopedContextProvider:e=>(0,oe.jsx)(r,Ey(ky({},e),{children:t.reduceRight(((t,n)=>(0,oe.jsx)(n,Ey(ky({},e),{children:t}))),(0,oe.jsx)(s.Provider,ky({},e)))}))}}var zb=Lb(),Gb=zb.useContext,Hb=(zb.useScopedContext,zb.useProviderContext,Lb([zb.ContextProvider],[zb.ScopedContextProvider])),Ub=Hb.useContext,Wb=(Hb.useScopedContext,Hb.useProviderContext),qb=Hb.ContextProvider,Zb=Hb.ScopedContextProvider,Kb=(0,Un.createContext)(void 0),Yb=(0,Un.createContext)(void 0),Xb=((0,Un.createContext)(null),(0,Un.createContext)(null),Lb([qb],[Zb])),Jb=Xb.useContext;Xb.useScopedContext,Xb.useProviderContext,Xb.ContextProvider,Xb.ScopedContextProvider;function Qb(e,t){const n=e.__unstableInternals;return Uy(n,"Invalid store"),n[t]}function $b(e,...t){let n=e,s=n,i=Symbol(),r=Dy;const o=new Set,a=new Set,l=new Set,c=new Set,u=new Set,d=new WeakMap,h=new WeakMap,p=(e,t,n=c)=>(n.add(t),h.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),h.delete(t),n.delete(t)}),f=(e,r,o=!1)=>{var l;if(!Ly(n,e))return;const p=function(e,t){if(function(e){return"function"==typeof e}(e))return e(function(e){return"function"==typeof e}(t)?t():t);return e}(r,n[e]);if(p===n[e])return;if(!o)for(const n of t)null==(l=null==n?void 0:n.setState)||l.call(n,e,p);const f=n;n=Ry(Fy({},n),{[e]:p});const m=Symbol();i=m,a.add(e);const g=(t,s,i)=>{var r;const o=h.get(t);o&&!o.some((t=>i?i.has(t):t===e))||(null==(r=d.get(t))||r(),d.set(t,t(n,s)))};for(const e of c)g(e,f);queueMicrotask((()=>{if(i!==m)return;const e=n;for(const e of u)g(e,s,a);s=e,a.clear()}))},m={getState:()=>n,setState:f,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{const e=o.size,s=Symbol();o.add(s);const i=()=>{o.delete(s),o.size||r()};if(e)return i;const a=(c=n,Object.keys(c)).map((e=>zy(...t.map((t=>{var n;const s=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);if(s&&Ly(s,e))return sw(t,[e],(t=>{f(e,t[e],!0)}))})))));var c;const u=[];for(const e of l)u.push(e());const d=t.map(tw);return r=zy(...a,...u,...d),i},subscribe:(e,t)=>p(e,t),sync:(e,t)=>(d.set(t,t(n,n)),p(e,t)),batch:(e,t)=>(d.set(t,t(n,s)),p(e,t,u)),pick:e=>$b(function(e,t){const n={};for(const s of t)Ly(e,s)&&(n[s]=e[s]);return n}(n,e),m),omit:e=>$b(function(e,t){const n=Fy({},e);for(const e of t)Ly(n,e)&&delete n[e];return n}(n,e),m)}};return m}function ew(e,...t){if(e)return Qb(e,"setup")(...t)}function tw(e,...t){if(e)return Qb(e,"init")(...t)}function nw(e,...t){if(e)return Qb(e,"subscribe")(...t)}function sw(e,...t){if(e)return Qb(e,"sync")(...t)}function iw(e,...t){if(e)return Qb(e,"batch")(...t)}function rw(e,...t){if(e)return Qb(e,"omit")(...t)}function ow(...e){const t=e.reduce(((e,t)=>{var n;const s=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);return s?Object.assign(e,s):e}),{}),n=$b(t,...e);return Object.assign({},...e,n)}var aw=i(422),{useSyncExternalStore:lw}=aw;function cw(e,t=Hy){const n=Un.useCallback((t=>e?nw(e,null,t):()=>{}),[e]),s=()=>{const n="string"==typeof t?t:null,s="function"==typeof t?t:null,i=null==e?void 0:e.getState();return s?s(i):i&&n&&Ly(i,n)?i[n]:void 0};return lw(n,s,s)}function uw(e,t){const n=Un.useRef({}),s=Un.useCallback((t=>e?nw(e,null,t):()=>{}),[e]),i=()=>{const s=null==e?void 0:e.getState();let i=!1;const r=n.current;for(const e in t){const n=t[e];if("function"==typeof n){const t=n(s);t!==r[e]&&(r[e]=t,i=!0)}if("string"==typeof n){if(!s)continue;if(!Ly(s,n))continue;const t=s[n];t!==r[e]&&(r[e]=t,i=!0)}}return i&&(n.current=ky({},r)),n.current};return lw(s,i,i)}function dw(e,t,n,s){const i=Ly(t,n)?t[n]:void 0,r=s?t[s]:void 0,o=function(e){const t=(0,Un.useRef)(e);return jb((()=>{t.current=e})),t}({value:i,setValue:r});jb((()=>sw(e,[n],((e,t)=>{const{value:s,setValue:i}=o.current;i&&e[n]!==t[n]&&e[n]!==s&&i(e[n])}))),[e,n]),jb((()=>{if(void 0!==i)return e.setState(n,i),iw(e,[n],(()=>{void 0!==i&&e.setState(n,i)}))}))}function hw(e,t,n){return Pb(t,[n.store]),dw(e,n,"items","setItems"),e}function pw(e){const t=kb(e.id);return ky({id:t},e)}function fw(e,t,n){return dw(e=hw(e,t,n),n,"activeId","setActiveId"),dw(e,n,"includesBaseElement"),dw(e,n,"virtualFocus"),dw(e,n,"orientation"),dw(e,n,"rtl"),dw(e,n,"focusLoop"),dw(e,n,"focusWrap"),dw(e,n,"focusShift"),e}function mw(e,t,n){return Pb(t,[n.store,n.disclosure]),dw(e,n,"open","setOpen"),dw(e,n,"mounted","setMounted"),dw(e,n,"animated"),Object.assign(e,{disclosure:n.disclosure})}function gw(e,t,n){return mw(e,t,n)}function vw(e,t,n){return Pb(t,[n.popover]),dw(e,n,"placement"),gw(e,t,n)}function xw(e={}){var t;e.store;const n=null==(t=e.store)?void 0:t.getState(),s=Zy(e.items,null==n?void 0:n.items,e.defaultItems,[]),i=new Map(s.map((e=>[e.id,e]))),r={items:s,renderedItems:Zy(null==n?void 0:n.renderedItems,[])},o=function(e){return null==e?void 0:e.__unstablePrivateStore}(e.store),a=$b({items:s,renderedItems:r.renderedItems},o),l=$b(r,e.store),c=e=>{const t=cb(e,(e=>e.element));a.setState("renderedItems",t),l.setState("renderedItems",t)};ew(l,(()=>tw(a))),ew(a,(()=>iw(a,["items"],(e=>{l.setState("items",e.items)})))),ew(a,(()=>iw(a,["renderedItems"],(e=>{let t=!0,n=requestAnimationFrame((()=>{const{renderedItems:t}=l.getState();e.renderedItems!==t&&c(e.renderedItems)}));if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(n);const s=function(e){var t;const n=e.find((e=>!!e.element)),s=[...e].reverse().find((e=>!!e.element));let i=null==(t=null==n?void 0:n.element)?void 0:t.parentElement;for(;i&&(null==s?void 0:s.element);){if(s&&i.contains(s.element))return i;i=i.parentElement}return Qy(i).body}(e.renderedItems),i=new IntersectionObserver((()=>{t?t=!1:(cancelAnimationFrame(n),n=requestAnimationFrame((()=>c(e.renderedItems))))}),{root:s});for(const t of e.renderedItems)t.element&&i.observe(t.element);return()=>{cancelAnimationFrame(n),i.disconnect()}}))));const u=(e,t,n=!1)=>{let s;t((t=>{const n=t.findIndex((({id:t})=>t===e.id)),r=t.slice();if(-1!==n){s=t[n];const o=Fy(Fy({},s),e);r[n]=o,i.set(e.id,o)}else r.push(e),i.set(e.id,e);return r}));return()=>{t((t=>{if(!s)return n&&i.delete(e.id),t.filter((({id:t})=>t!==e.id));const r=t.findIndex((({id:t})=>t===e.id));if(-1===r)return t;const o=t.slice();return o[r]=s,i.set(e.id,s),o}))}},d=e=>u(e,(e=>a.setState("items",e)),!0);return Ry(Fy({},l),{registerItem:d,renderItem:e=>zy(d(e),u(e,(e=>a.setState("renderedItems",e)))),item:e=>{if(!e)return null;let t=i.get(e);if(!t){const{items:n}=a.getState();t=n.find((t=>t.id===e)),t&&i.set(e,t)}return t||null},__unstablePrivateStore:a})}function yw(e){const t=[];for(const n of e)t.push(...n);return t}function bw(e){return e.slice().reverse()}var ww={id:null};function _w(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}function jw(e,t){return e.filter((e=>e.rowId===t))}function Sw(e){const t=[];for(const n of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId}));e?e.push(n):t.push([n])}return t}function Cw(e){let t=0;for(const{length:n}of e)n>t&&(t=n);return t}function kw(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),s=xw(e),i=Zy(e.activeId,null==n?void 0:n.activeId,e.defaultActiveId),r=$b(Ry(Fy({},s.getState()),{id:Zy(e.id,null==n?void 0:n.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:i,baseElement:Zy(null==n?void 0:n.baseElement,null),includesBaseElement:Zy(e.includesBaseElement,null==n?void 0:n.includesBaseElement,null===i),moves:Zy(null==n?void 0:n.moves,0),orientation:Zy(e.orientation,null==n?void 0:n.orientation,"both"),rtl:Zy(e.rtl,null==n?void 0:n.rtl,!1),virtualFocus:Zy(e.virtualFocus,null==n?void 0:n.virtualFocus,!1),focusLoop:Zy(e.focusLoop,null==n?void 0:n.focusLoop,!1),focusWrap:Zy(e.focusWrap,null==n?void 0:n.focusWrap,!1),focusShift:Zy(e.focusShift,null==n?void 0:n.focusShift,!1)}),s,e.store);ew(r,(()=>sw(r,["renderedItems","activeId"],(e=>{r.setState("activeId",(t=>{var n;return void 0!==t?t:null==(n=_w(e.renderedItems))?void 0:n.id}))}))));const o=(e="next",t={})=>{var n,s;const i=r.getState(),{skip:o=0,activeId:a=i.activeId,focusShift:l=i.focusShift,focusLoop:c=i.focusLoop,focusWrap:u=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:h=i.renderedItems,rtl:p=i.rtl}=t,f="up"===e||"down"===e,m="next"===e||"down"===e,g=m?p&&!f:!p||f,v=l&&!o;let x=f?yw(function(e,t,n){const s=Cw(e);for(const i of e)for(let e=0;e<s;e+=1){const s=i[e];if(!s||n&&s.disabled){const s=0===e&&n?_w(i):i[e-1];i[e]=s&&t!==s.id&&n?s:{id:"__EMPTY_ITEM__",disabled:!0,rowId:null==s?void 0:s.rowId}}}return e}(Sw(h),a,v)):h;if(x=g?bw(x):x,x=f?function(e){const t=Sw(e),n=Cw(t),s=[];for(let e=0;e<n;e+=1)for(const n of t){const t=n[e];t&&s.push(Ry(Fy({},t),{rowId:t.rowId?`${e}`:void 0}))}return s}(x):x,null==a)return null==(n=_w(x))?void 0:n.id;const y=x.find((e=>e.id===a));if(!y)return null==(s=_w(x))?void 0:s.id;const b=x.some((e=>e.rowId)),w=x.indexOf(y),_=x.slice(w+1),j=jw(_,y.rowId);if(o){const e=function(e,t){return e.filter((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(j,a),t=e.slice(o)[0]||e[e.length-1];return null==t?void 0:t.id}const S=c&&(f?"horizontal"!==c:"vertical"!==c),C=b&&u&&(f?"horizontal"!==u:"vertical"!==u),k=m?(!b||f)&&S&&d:!!f&&d;if(S){const e=function(e,t,n=!1){const s=e.findIndex((e=>e.id===t));return[...e.slice(s+1),...n?[ww]:[],...e.slice(0,s)]}(C&&!k?x:jw(x,y.rowId),a,k),t=_w(e,a);return null==t?void 0:t.id}if(C){const e=_w(k?j:_,a);return k?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const E=_w(j,a);return!E&&k?null:null==E?void 0:E.id};return Ry(Fy(Fy({},s),r),{setBaseElement:e=>r.setState("baseElement",e),setActiveId:e=>r.setState("activeId",e),move:e=>{void 0!==e&&(r.setState("activeId",e),r.setState("moves",(e=>e+1)))},first:()=>{var e;return null==(e=_w(r.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=_w(bw(r.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("up",e))})}function Ew(e={}){return function(e={}){const t=ow(e.store,rw(e.disclosure,["contentElement","disclosureElement"])),n=null==t?void 0:t.getState(),s=Zy(e.open,null==n?void 0:n.open,e.defaultOpen,!1),i=Zy(e.animated,null==n?void 0:n.animated,!1),r=$b({open:s,animated:i,animating:!!i&&s,mounted:s,contentElement:Zy(null==n?void 0:n.contentElement,null),disclosureElement:Zy(null==n?void 0:n.disclosureElement,null)},t);return ew(r,(()=>sw(r,["animated","animating"],(e=>{e.animated||r.setState("animating",!1)})))),ew(r,(()=>nw(r,["open"],(()=>{r.getState().animated&&r.setState("animating",!0)})))),ew(r,(()=>sw(r,["open","animating"],(e=>{r.setState("mounted",e.open||e.animating)})))),Ry(Fy({},r),{disclosure:e.disclosure,setOpen:e=>r.setState("open",e),show:()=>r.setState("open",!0),hide:()=>r.setState("open",!1),toggle:()=>r.setState("open",(e=>!e)),stopAnimation:()=>r.setState("animating",!1),setContentElement:e=>r.setState("contentElement",e),setDisclosureElement:e=>r.setState("disclosureElement",e)})}(e)}var Pw=hb()&&ub();function Iw(e={}){var t=e,{tag:n}=t,s=By(t,["tag"]);const i=ow(s.store,function(e,...t){if(e)return Qb(e,"pick")(...t)}(n,["value","rtl"])),r=null==n?void 0:n.getState(),o=null==i?void 0:i.getState(),a=Zy(s.activeId,null==o?void 0:o.activeId,s.defaultActiveId,null),l=kw(Ry(Fy({},s),{activeId:a,includesBaseElement:Zy(s.includesBaseElement,null==o?void 0:o.includesBaseElement,!0),orientation:Zy(s.orientation,null==o?void 0:o.orientation,"vertical"),focusLoop:Zy(s.focusLoop,null==o?void 0:o.focusLoop,!0),focusWrap:Zy(s.focusWrap,null==o?void 0:o.focusWrap,!0),virtualFocus:Zy(s.virtualFocus,null==o?void 0:o.virtualFocus,!0)})),c=function(e={}){var t=e,{popover:n}=t,s=By(t,["popover"]);const i=ow(s.store,rw(n,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),r=null==i?void 0:i.getState(),o=Ew(Ry(Fy({},s),{store:i})),a=Zy(s.placement,null==r?void 0:r.placement,"bottom"),l=$b(Ry(Fy({},o.getState()),{placement:a,currentPlacement:a,anchorElement:Zy(null==r?void 0:r.anchorElement,null),popoverElement:Zy(null==r?void 0:r.popoverElement,null),arrowElement:Zy(null==r?void 0:r.arrowElement,null),rendered:Symbol("rendered")}),o,i);return Ry(Fy(Fy({},o),l),{setAnchorElement:e=>l.setState("anchorElement",e),setPopoverElement:e=>l.setState("popoverElement",e),setArrowElement:e=>l.setState("arrowElement",e),render:()=>l.setState("rendered",Symbol("rendered"))})}(Ry(Fy({},s),{placement:Zy(s.placement,null==o?void 0:o.placement,"bottom-start")})),u=Zy(s.value,null==o?void 0:o.value,s.defaultValue,""),d=Zy(s.selectedValue,null==o?void 0:o.selectedValue,null==r?void 0:r.values,s.defaultSelectedValue,""),h=Array.isArray(d),p=Ry(Fy(Fy({},l.getState()),c.getState()),{value:u,selectedValue:d,resetValueOnSelect:Zy(s.resetValueOnSelect,null==o?void 0:o.resetValueOnSelect,h),resetValueOnHide:Zy(s.resetValueOnHide,null==o?void 0:o.resetValueOnHide,h&&!n),activeValue:null==o?void 0:o.activeValue}),f=$b(p,l,c,i);return Pw&&ew(f,(()=>sw(f,["virtualFocus"],(()=>{f.setState("virtualFocus",!1)})))),ew(f,(()=>{if(n)return zy(sw(f,["selectedValue"],(e=>{Array.isArray(e.selectedValue)&&n.setValues(e.selectedValue)})),sw(n,["values"],(e=>{f.setState("selectedValue",e.values)})))})),ew(f,(()=>sw(f,["resetValueOnHide","mounted"],(e=>{e.resetValueOnHide&&(e.mounted||f.setState("value",u))})))),ew(f,(()=>sw(f,["open"],(e=>{e.open||(f.setState("activeId",a),f.setState("moves",0))})))),ew(f,(()=>sw(f,["moves","activeId"],((e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})))),ew(f,(()=>iw(f,["moves","renderedItems"],((e,t)=>{if(e.moves===t.moves)return;const{activeId:n}=f.getState(),s=l.item(n);f.setState("activeValue",null==s?void 0:s.value)})))),Ry(Fy(Fy(Fy({},c),l),f),{tag:n,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",p.value),setSelectedValue:e=>f.setState("selectedValue",e)})}function Tw(e={}){e=function(e){const t=Jb();return pw(e=Ey(ky({},e),{tag:void 0!==e.tag?e.tag:t}))}(e);const[t,n]=function(e,t){const[n,s]=Un.useState((()=>e(t)));jb((()=>tw(n)),[n]);const i=Un.useCallback((e=>cw(n,e)),[n]);return[Un.useMemo((()=>Ey(ky({},n),{useState:i})),[n,i]),Sb((()=>{s((n=>e(ky(ky({},t),n.getState()))))}))]}(Iw,e);return function(e,t,n){return Pb(t,[n.tag]),dw(e,n,"value","setValue"),dw(e,n,"selectedValue","setSelectedValue"),dw(e,n,"resetValueOnHide"),dw(e,n,"resetValueOnSelect"),Object.assign(fw(vw(e,t,n),t,n),{tag:n.tag})}(t,n,e)}var Ow=Lb(),Aw=(Ow.useContext,Ow.useScopedContext,Ow.useProviderContext),Nw=Lb([Ow.ContextProvider],[Ow.ScopedContextProvider]),Mw=(Nw.useContext,Nw.useScopedContext,Nw.useProviderContext,Nw.ContextProvider),Vw=Nw.ScopedContextProvider,Fw=((0,Un.createContext)(void 0),(0,Un.createContext)(void 0),Lb([Mw],[Vw])),Rw=(Fw.useContext,Fw.useScopedContext,Fw.useProviderContext),Bw=Fw.ContextProvider,Dw=Fw.ScopedContextProvider,Lw=(0,Un.createContext)(void 0),zw=Lb([Bw,qb],[Dw,Zb]),Gw=zw.useContext,Hw=zw.useScopedContext,Uw=zw.useProviderContext,Ww=zw.ContextProvider,qw=zw.ScopedContextProvider,Zw=(0,Un.createContext)(void 0),Kw=(0,Un.createContext)(!1);function Yw(e={}){const t=Tw(e);return(0,oe.jsx)(Ww,{value:t,children:e.children})}var Xw=Db((function(e){var t=e,{store:n}=t,s=Py(t,["store"]);const i=Uw();Uy(n=n||i,!1);const r=n.useState((e=>{var t;return null==(t=e.baseElement)?void 0:t.id}));return qy(s=ky({htmlFor:r},s))})),Jw=Rb(Fb((function(e){return Bb("label",Xw(e))}))),Qw=Db((function(e){var t=e,{store:n}=t,s=Py(t,["store"]);const i=Rw();return n=n||i,s=Ey(ky({},s),{ref:Cb(null==n?void 0:n.setAnchorElement,s.ref)})}));Fb((function(e){return Bb("div",Qw(e))}));function $w(e,t){return t&&e.item(t)||null}var e_=Symbol("FOCUS_SILENTLY");function t_(e,t,n){if(!t)return!1;if(t===n)return!1;const s=e.item(t.id);return!!s&&(!n||s.element!==n)}var n_=(0,Un.createContext)(!0),s_="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function i_(e){return!!e.matches(s_)&&(!!function(e){if("function"==typeof e.checkVisibility)return e.checkVisibility();const t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)&&!e.closest("[inert]"))}function r_(e){const t=$y(e);if(!t)return!1;if(t===e)return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function o_(e){const t=$y(e);if(!t)return!1;if(eb(e,t))return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&("id"in e&&(n===e.id||!!e.querySelector(`#${CSS.escape(n)}`)))}var a_=hb(),l_=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],c_=Symbol("safariFocusAncestor");function u_(e,t){e&&(e[c_]=t)}function d_(e){return!("input"!==e.tagName.toLowerCase()||!e.type)&&("radio"===e.type||"checkbox"===e.type)}function h_(e,t,n,s,i){return e?t?n&&!s?-1:void 0:n?i:i||0:i}function p_(e,t){return Sb((n=>{null==e||e(n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())}))}var f_=!0;function m_(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(f_=!1))}function g_(e){e.metaKey||e.ctrlKey||e.altKey||(f_=!0)}var v_=Db((function(e){var t=e,{focusable:n=!0,accessibleWhenDisabled:s,autoFocus:i,onFocusVisible:r}=t,o=Py(t,["focusable","accessibleWhenDisabled","autoFocus","onFocusVisible"]);const a=(0,Un.useRef)(null);(0,Un.useEffect)((()=>{n&&(yb("mousedown",m_,!0),yb("keydown",g_,!0))}),[n]),a_&&(0,Un.useEffect)((()=>{if(!n)return;const e=a.current;if(!e)return;if(!d_(e))return;const t=function(e){return"labels"in e?e.labels:null}(e);if(!t)return;const s=()=>queueMicrotask((()=>e.focus()));for(const e of t)e.addEventListener("mouseup",s);return()=>{for(const e of t)e.removeEventListener("mouseup",s)}}),[n]);const l=n&&Wy(o),c=!!l&&!s,[u,d]=(0,Un.useState)(!1);(0,Un.useEffect)((()=>{n&&c&&u&&d(!1)}),[n,c,u]),(0,Un.useEffect)((()=>{if(!n)return;if(!u)return;const e=a.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return;const t=new IntersectionObserver((()=>{i_(e)||d(!1)}));return t.observe(e),()=>t.disconnect()}),[n,u]);const h=p_(o.onKeyPressCapture,l),p=p_(o.onMouseDownCapture,l),f=p_(o.onClickCapture,l),m=o.onMouseDown,g=Sb((e=>{if(null==m||m(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget;if(!a_)return;if(pb(e))return;if(!tb(t)&&!d_(t))return;let s=!1;const i=()=>{s=!0};t.addEventListener("focusin",i,{capture:!0,once:!0});const r=function(e){for(;e&&!i_(e);)e=e.closest(s_);return e||null}(t.parentElement);u_(r,!0),xb(t,"mouseup",(()=>{t.removeEventListener("focusin",i,!0),u_(r,!1),s||function(e){!o_(e)&&i_(e)&&e.focus()}(t)}))})),v=(e,t)=>{if(t&&(e.currentTarget=t),!n)return;const s=e.currentTarget;s&&r_(s)&&(null==r||r(e),e.defaultPrevented||(s.dataset.focusVisible="true",d(!0)))},x=o.onKeyDownCapture,y=Sb((e=>{if(null==x||x(e),e.defaultPrevented)return;if(!n)return;if(u)return;if(e.metaKey)return;if(e.altKey)return;if(e.ctrlKey)return;if(!fb(e))return;const t=e.currentTarget;xb(t,"focusout",(()=>v(e,t)))})),b=o.onFocusCapture,w=Sb((e=>{if(null==b||b(e),e.defaultPrevented)return;if(!n)return;if(!fb(e))return void d(!1);const t=e.currentTarget,s=()=>v(e,t);f_||function(e){const{tagName:t,readOnly:n,type:s}=e;return"TEXTAREA"===t&&!n||("SELECT"===t&&!n||("INPUT"!==t||n?!!e.isContentEditable||!("combobox"!==e.getAttribute("role")||!e.dataset.name):l_.includes(s)))}(e.target)?xb(e.target,"focusout",s):d(!1)})),_=o.onBlur,j=Sb((e=>{null==_||_(e),n&&vb(e)&&d(!1)})),S=(0,Un.useContext)(n_),C=Sb((e=>{n&&i&&e&&S&&queueMicrotask((()=>{r_(e)||i_(e)&&e.focus()}))})),k=function(e,t){const n=e=>{if("string"==typeof e)return e},[s,i]=(0,Un.useState)((()=>n(t)));return jb((()=>{const s=e&&"current"in e?e.current:e;i((null==s?void 0:s.tagName.toLowerCase())||n(t))}),[e,t]),s}(a),E=n&&function(e){return!e||"button"===e||"summary"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(k),P=n&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(k),I=o.style,T=(0,Un.useMemo)((()=>c?ky({pointerEvents:"none"},I):I),[c,I]);return qy(o=Ey(ky({"data-focus-visible":n&&u||void 0,"data-autofocus":i||void 0,"aria-disabled":l||void 0},o),{ref:Cb(a,C,o.ref),style:T,tabIndex:h_(n,c,E,P,o.tabIndex),disabled:!(!P||!c)||void 0,contentEditable:l?void 0:o.contentEditable,onKeyPressCapture:h,onClickCapture:f,onMouseDownCapture:p,onMouseDown:g,onKeyDownCapture:y,onFocusCapture:w,onBlur:j}))}));Fb((function(e){return Bb("div",v_(e))}));function x_(e,t,n){return Sb((s=>{var i;if(null==t||t(s),s.defaultPrevented)return;if(s.isPropagationStopped())return;if(!fb(s))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(s))return;if(function(e){const t=e.target;return!(t&&!sb(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(s))return;const r=e.getState(),o=null==(i=$w(e,r.activeId))?void 0:i.element;if(!o)return;const a=s,{view:l}=a,c=Py(a,["view"]);o!==(null==n?void 0:n.current)&&o.focus(),function(e,t,n){const s=new KeyboardEvent(t,n);return e.dispatchEvent(s)}(o,s.type,c)||s.preventDefault(),s.currentTarget.contains(o)&&s.stopPropagation()}))}var y_=Db((function(e){var t=e,{store:n,composite:s=!0,focusOnMove:i=s,moveOnKeyPress:r=!0}=t,o=Py(t,["store","composite","focusOnMove","moveOnKeyPress"]);const a=Wb();Uy(n=n||a,!1);const l=(0,Un.useRef)(null),c=(0,Un.useRef)(null),u=function(e){const[t,n]=(0,Un.useState)(!1),s=(0,Un.useCallback)((()=>n(!0)),[]),i=e.useState((t=>$w(e,t.activeId)));return(0,Un.useEffect)((()=>{const e=null==i?void 0:i.element;t&&e&&(n(!1),e.focus({preventScroll:!0}))}),[i,t]),s}(n),d=n.useState("moves"),[,h]=function(e){const[t,n]=(0,Un.useState)(null);return jb((()=>{if(null==t)return;if(!e)return;let n=null;return e((e=>(n=e,t))),()=>{e(n)}}),[t,e]),[t,n]}(s?n.setBaseElement:null);(0,Un.useEffect)((()=>{var e;if(!n)return;if(!d)return;if(!s)return;if(!i)return;const{activeId:t}=n.getState(),r=null==(e=$w(n,t))?void 0:e.element;var o,a;r&&("scrollIntoView"in(o=r)?(o.focus({preventScroll:!0}),o.scrollIntoView(Fy({block:"nearest",inline:"nearest"},a))):o.focus())}),[n,d,s,i]),jb((()=>{if(!n)return;if(!d)return;if(!s)return;const{baseElement:e,activeId:t}=n.getState();if(!(null===t))return;if(!e)return;const i=c.current;c.current=null,i&&mb(i,{relatedTarget:e}),r_(e)||e.focus()}),[n,d,s]);const p=n.useState("activeId"),f=n.useState("virtualFocus");jb((()=>{var e;if(!n)return;if(!s)return;if(!f)return;const t=c.current;if(c.current=null,!t)return;const i=(null==(e=$w(n,p))?void 0:e.element)||$y(t);i!==t&&mb(t,{relatedTarget:i})}),[n,p,f,s]);const m=x_(n,o.onKeyDownCapture,c),g=x_(n,o.onKeyUpCapture,c),v=o.onFocusCapture,x=Sb((e=>{if(null==v||v(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:t}=n.getState();if(!t)return;const s=e.relatedTarget,i=function(e){const t=e[e_];return delete e[e_],t}(e.currentTarget);fb(e)&&i&&(e.stopPropagation(),c.current=s)})),y=o.onFocus,b=Sb((e=>{if(null==y||y(e),e.defaultPrevented)return;if(!s)return;if(!n)return;const{relatedTarget:t}=e,{virtualFocus:i}=n.getState();i?fb(e)&&!t_(n,t)&&queueMicrotask(u):fb(e)&&n.setActiveId(null)})),w=o.onBlurCapture,_=Sb((e=>{var t;if(null==w||w(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:s,activeId:i}=n.getState();if(!s)return;const r=null==(t=$w(n,i))?void 0:t.element,o=e.relatedTarget,a=t_(n,o),l=c.current;if(c.current=null,fb(e)&&a)o===r?l&&l!==o&&mb(l,e):r?mb(r,e):l&&mb(l,e),e.stopPropagation();else{!t_(n,e.target)&&r&&mb(r,e)}})),j=o.onKeyDown,S=Ib(r),C=Sb((e=>{var t;if(null==j||j(e),e.defaultPrevented)return;if(!n)return;if(!fb(e))return;const{orientation:s,renderedItems:i,activeId:r}=n.getState(),o=$w(n,r);if(null==(t=null==o?void 0:o.element)?void 0:t.isConnected)return;const a="horizontal"!==s,l="vertical"!==s,c=i.some((e=>!!e.rowId));if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&sb(e.currentTarget))return;const u={ArrowUp:(c||a)&&(()=>{if(c){const e=function(e){return function(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(yw(bw(function(e){const t=[];for(const n of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId}));e?e.push(n):t.push([n])}return t}(e))))}(i);return null==e?void 0:e.id}return null==n?void 0:n.last()}),ArrowRight:(c||l)&&n.first,ArrowDown:(c||a)&&n.first,ArrowLeft:(c||l)&&n.last,Home:n.first,End:n.last,PageUp:n.first,PageDown:n.last},d=u[e.key];if(d){const t=d();if(void 0!==t){if(!S(e))return;e.preventDefault(),n.move(t)}}}));o=Tb(o,(e=>(0,oe.jsx)(qb,{value:n,children:e})),[n]);const k=n.useState((e=>{var t;if(n&&s&&e.virtualFocus)return null==(t=$w(n,e.activeId))?void 0:t.id}));o=Ey(ky({"aria-activedescendant":k},o),{ref:Cb(l,h,o.ref),onKeyDownCapture:m,onKeyUpCapture:g,onFocusCapture:x,onFocus:b,onBlurCapture:_,onKeyDown:C});const E=n.useState((e=>s&&(e.virtualFocus||null===e.activeId)));return o=v_(ky({focusable:E},o))}));Fb((function(e){return Bb("div",y_(e))}));function b_(e,t,n){if(!n)return!1;const s=e.find((e=>!e.disabled&&e.value));return(null==s?void 0:s.value)===t}function w_(e,t){return!!t&&(null!=e&&(e=Gy(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase())))}var __=Db((function(e){var t=e,{store:n,focusable:s=!0,autoSelect:i=!1,getAutoSelectId:r,setValueOnChange:o,showMinLength:a=0,showOnChange:l,showOnMouseDown:c,showOnClick:u=c,showOnKeyDown:d,showOnKeyPress:h=d,blurActiveItemOnClick:p,setValueOnClick:f=!0,moveOnKeyPress:m=!0,autoComplete:g="list"}=t,v=Py(t,["store","focusable","autoSelect","getAutoSelectId","setValueOnChange","showMinLength","showOnChange","showOnMouseDown","showOnClick","showOnKeyDown","showOnKeyPress","blurActiveItemOnClick","setValueOnClick","moveOnKeyPress","autoComplete"]);const x=Uw();Uy(n=n||x,!1);const y=(0,Un.useRef)(null),[b,w]=(0,Un.useReducer)((()=>[]),[]),_=(0,Un.useRef)(!1),j=(0,Un.useRef)(!1),S=n.useState((e=>e.virtualFocus&&i)),C="inline"===g||"both"===g,[k,E]=(0,Un.useState)(C);!function(e,t){const n=(0,Un.useRef)(!1);jb((()=>{if(n.current)return e();n.current=!0}),t),jb((()=>()=>{n.current=!1}),[])}((()=>{C&&E(!0)}),[C]);const P=n.useState("value"),I=(0,Un.useRef)();(0,Un.useEffect)((()=>sw(n,["selectedValue","activeId"],((e,t)=>{I.current=t.selectedValue}))),[]);const T=n.useState((e=>{var t;if(C&&k){if(e.activeValue&&Array.isArray(e.selectedValue)){if(e.selectedValue.includes(e.activeValue))return;if(null==(t=I.current)?void 0:t.includes(e.activeValue))return}return e.activeValue}})),O=n.useState("renderedItems"),A=n.useState("open"),N=n.useState("contentElement"),M=(0,Un.useMemo)((()=>{if(!C)return P;if(!k)return P;if(b_(O,T,S)){if(w_(P,T)){const e=(null==T?void 0:T.slice(P.length))||"";return P+e}return P}return T||P}),[C,k,O,T,S,P]);(0,Un.useEffect)((()=>{const e=y.current;if(!e)return;const t=()=>E(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}}),[]),(0,Un.useEffect)((()=>{if(!C)return;if(!k)return;if(!T)return;if(!b_(O,T,S))return;if(!w_(P,T))return;let e=Dy;return queueMicrotask((()=>{const t=y.current;if(!t)return;const{start:n,end:s}=rb(t),i=P.length,r=T.length;lb(t,i,r),e=()=>{if(!r_(t))return;const{start:e,end:o}=rb(t);e===i&&o===r&&lb(t,n,s)}})),()=>e()}),[b,C,k,T,O,S,P]);const V=(0,Un.useRef)(null),F=Sb(r),R=(0,Un.useRef)(null);(0,Un.useEffect)((()=>{if(!A)return;if(!N)return;const e=ab(N);if(!e)return;V.current=e;const t=()=>{_.current=!1},s=()=>{if(!n)return;if(!_.current)return;const{activeId:e}=n.getState();null!==e&&e!==R.current&&(_.current=!1)},i={passive:!0,capture:!0};return e.addEventListener("wheel",t,i),e.addEventListener("touchmove",t,i),e.addEventListener("scroll",s,i),()=>{e.removeEventListener("wheel",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("scroll",s,!0)}}),[A,N,n]),jb((()=>{P&&(j.current||(_.current=!0))}),[P]),jb((()=>{"always"!==S&&A||(_.current=A)}),[S,A]);const B=n.useState("resetValueOnSelect");Pb((()=>{var e,t;const s=_.current;if(!n)return;if(!A)return;if(!s&&!B)return;const{baseElement:i,contentElement:r,activeId:o}=n.getState();if(!i||r_(i)){if(null==r?void 0:r.hasAttribute("data-placing")){const e=new MutationObserver(w);return e.observe(r,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(S&&s){const t=F(O),s=void 0!==t?t:null!=(e=function(e){const t=e.find((e=>{var t;return!e.disabled&&"tab"!==(null==(t=e.element)?void 0:t.getAttribute("role"))}));return null==t?void 0:t.id}(O))?e:n.first();R.current=s,n.move(null!=s?s:null)}else{const e=null==(t=n.item(o||n.first()))?void 0:t.element;e&&"scrollIntoView"in e&&e.scrollIntoView({block:"nearest",inline:"nearest"})}}}),[n,A,b,P,S,B,F,O]),(0,Un.useEffect)((()=>{if(!C)return;const e=y.current;if(!e)return;const t=[e,N].filter((e=>!!e)),s=e=>{t.every((t=>vb(e,t)))&&(null==n||n.setValue(M))};for(const e of t)e.addEventListener("focusout",s);return()=>{for(const e of t)e.removeEventListener("focusout",s)}}),[C,N,n,M]);const D=e=>e.currentTarget.value.length>=a,L=v.onChange,z=Ib(null!=l?l:D),G=Ib(null!=o?o:!n.tag),H=Sb((e=>{if(null==L||L(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget,{value:s,selectionStart:i,selectionEnd:r}=t,o=e.nativeEvent;if(_.current=!0,function(e){return"input"===e.type}(o)&&(o.isComposing&&(_.current=!1,j.current=!0),C)){const e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=i===s.length;E(e&&t)}if(G(e)){const e=s===n.getState().value;n.setValue(s),queueMicrotask((()=>{lb(t,i,r)})),C&&S&&e&&w()}z(e)&&n.show(),S&&_.current||n.setActiveId(null)})),U=v.onCompositionEnd,W=Sb((e=>{_.current=!0,j.current=!1,null==U||U(e),e.defaultPrevented||S&&w()})),q=v.onMouseDown,Z=Ib(null!=p?p:()=>!!(null==n?void 0:n.getState().includesBaseElement)),K=Ib(f),Y=Ib(null!=u?u:D),X=Sb((e=>{null==q||q(e),e.defaultPrevented||e.button||e.ctrlKey||n&&(Z(e)&&n.setActiveId(null),K(e)&&n.setValue(M),Y(e)&&xb(e.currentTarget,"mouseup",n.show))})),J=v.onKeyDown,Q=Ib(null!=h?h:D),$=Sb((e=>{if(null==J||J(e),e.repeat||(_.current=!1),e.defaultPrevented)return;if(e.ctrlKey)return;if(e.altKey)return;if(e.shiftKey)return;if(e.metaKey)return;if(!n)return;const{open:t}=n.getState();t||"ArrowUp"!==e.key&&"ArrowDown"!==e.key||Q(e)&&(e.preventDefault(),n.show())})),ee=v.onBlur,te=Sb((e=>{_.current=!1,null==ee||ee(e),e.defaultPrevented})),ne=kb(v.id),se=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(g)?g:void 0,ie=n.useState((e=>null===e.activeId));return v=Ey(ky({id:ne,role:"combobox","aria-autocomplete":se,"aria-haspopup":ob(N,"listbox"),"aria-expanded":A,"aria-controls":null==N?void 0:N.id,"data-active-item":ie||void 0,value:M},v),{ref:Cb(y,v.ref),onChange:H,onCompositionEnd:W,onMouseDown:X,onKeyDown:$,onBlur:te}),v=y_(Ey(ky({store:n,focusable:s},v),{moveOnKeyPress:e=>!function(e,...t){const n="function"==typeof e?e(...t):e;return null!=n&&!n}(m,e)&&(C&&E(!0),!0)})),v=Qw(ky({store:n},v)),ky({autoComplete:"off"},v)})),j_=Fb((function(e){return Bb("input",__(e))}));function S_(e,t){const n=setTimeout(t,e);return()=>clearTimeout(n)}function C_(...e){return e.join(", ").split(", ").reduce(((e,t)=>{const n=t.endsWith("ms")?1:1e3,s=Number.parseFloat(t||"0s")*n;return s>e?s:e}),0)}function k_(e,t,n){return!(n||!1===t||e&&!t)}var E_=Db((function(e){var t=e,{store:n,alwaysVisible:s}=t,i=Py(t,["store","alwaysVisible"]);const r=Aw();Uy(n=n||r,!1);const o=(0,Un.useRef)(null),a=kb(i.id),[l,c]=(0,Un.useState)(null),u=n.useState("open"),d=n.useState("mounted"),h=n.useState("animated"),p=n.useState("contentElement"),f=cw(n.disclosure,"contentElement");jb((()=>{o.current&&(null==n||n.setContentElement(o.current))}),[n]),jb((()=>{let e;return null==n||n.setState("animated",(t=>(e=t,!0))),()=>{void 0!==e&&(null==n||n.setState("animated",e))}}),[n]),jb((()=>{if(h){if(null==p?void 0:p.isConnected)return function(e){let t=requestAnimationFrame((()=>{t=requestAnimationFrame(e)}));return()=>cancelAnimationFrame(t)}((()=>{c(u?"enter":d?"leave":null)}));c(null)}}),[h,p,u,d]),jb((()=>{if(!n)return;if(!h)return;if(!l)return;if(!p)return;const e=()=>null==n?void 0:n.setState("animating",!1),t=()=>(0,Fr.flushSync)(e);if("leave"===l&&u)return;if("enter"===l&&!u)return;if("number"==typeof h){return S_(h,t)}const{transitionDuration:s,animationDuration:i,transitionDelay:r,animationDelay:o}=getComputedStyle(p),{transitionDuration:a="0",animationDuration:c="0",transitionDelay:d="0",animationDelay:m="0"}=f?getComputedStyle(f):{},g=C_(r,o,d,m)+C_(s,i,a,c);if(!g)return"enter"===l&&n.setState("animated",!1),void e();return S_(Math.max(g-1e3/60,0),t)}),[n,h,p,f,u,l]),i=Tb(i,(e=>(0,oe.jsx)(Vw,{value:n,children:e})),[n]);const m=k_(d,i.hidden,s),g=i.style,v=(0,Un.useMemo)((()=>m?Ey(ky({},g),{display:"none"}):g),[m,g]);return qy(i=Ey(ky({id:a,"data-open":u||void 0,"data-enter":"enter"===l||void 0,"data-leave":"leave"===l||void 0,hidden:m},i),{ref:Cb(a?n.setContentElement:null,o,i.ref),style:v}))})),P_=Fb((function(e){return Bb("div",E_(e))})),I_=(Fb((function(e){var t=e,{unmountOnHide:n}=t,s=Py(t,["unmountOnHide"]);const i=Aw();return!1===cw(s.store||i,(e=>!n||(null==e?void 0:e.mounted)))?null:(0,oe.jsx)(P_,ky({},s))})),Db((function(e){var t=e,{store:n,alwaysVisible:s}=t,i=Py(t,["store","alwaysVisible"]);const r=Hw(!0),o=Gw(),a=!!(n=n||o)&&n===r;Uy(n,!1);const l=(0,Un.useRef)(null),c=kb(i.id),u=n.useState("mounted"),d=k_(u,i.hidden,s),h=d?Ey(ky({},i.style),{display:"none"}):i.style,p=n.useState((e=>Array.isArray(e.selectedValue))),f=Eb(l,"role",i.role),m=("listbox"===f||"tree"===f||"grid"===f)&&p||void 0,[g,v]=(0,Un.useState)(!1),x=n.useState("contentElement");jb((()=>{if(!u)return;const e=l.current;if(!e)return;if(x!==e)return;const t=()=>{v(!!e.querySelector("[role='listbox']"))},n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>n.disconnect()}),[u,x]),g||(i=ky({role:"listbox","aria-multiselectable":m},i)),i=Tb(i,(e=>(0,oe.jsx)(qw,{value:n,children:(0,oe.jsx)(Lw.Provider,{value:f,children:e})})),[n,f]);const y=!c||r&&a?null:n.setContentElement;return qy(i=Ey(ky({id:c,hidden:d},i),{ref:Cb(y,l,i.ref),style:h}))}))),T_=Fb((function(e){return Bb("div",I_(e))}));function O_(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var A_=Symbol("composite-hover");var N_=Db((function(e){var t=e,{store:n,focusOnHover:s=!0,blurOnHoverEnd:i=!!s}=t,r=Py(t,["store","focusOnHover","blurOnHoverEnd"]);const o=Ub();Uy(n=n||o,!1);const a=((0,Un.useEffect)((()=>{yb("mousemove",Mb,!0),yb("mousedown",Vb,!0),yb("mouseup",Vb,!0),yb("keydown",Vb,!0),yb("scroll",Vb,!0)}),[]),Sb((()=>Ob))),l=r.onMouseMove,c=Ib(s),u=Sb((e=>{if(null==l||l(e),!e.defaultPrevented&&a()&&c(e)){if(!o_(e.currentTarget)){const e=null==n?void 0:n.getState().baseElement;e&&!r_(e)&&e.focus()}null==n||n.setActiveId(e.currentTarget.id)}})),d=r.onMouseLeave,h=Ib(i),p=Sb((e=>{var t;null==d||d(e),e.defaultPrevented||a()&&(function(e){const t=O_(e);return!!t&&eb(e.currentTarget,t)}(e)||function(e){let t=O_(e);if(!t)return!1;do{if(Ly(t,A_)&&t[A_])return!0;t=t.parentElement}while(t);return!1}(e)||c(e)&&h(e)&&(null==n||n.setActiveId(null),null==(t=null==n?void 0:n.getState().baseElement)||t.focus()))})),f=(0,Un.useCallback)((e=>{e&&(e[A_]=!0)}),[]);return qy(r=Ey(ky({},r),{ref:Cb(f,r.ref),onMouseMove:u,onMouseLeave:p}))})),M_=(Rb(Fb((function(e){return Bb("div",N_(e))}))),Db((function(e){var t=e,{store:n,shouldRegisterItem:s=!0,getItem:i=Hy,element:r}=t,o=Py(t,["store","shouldRegisterItem","getItem","element"]);const a=Gb();n=n||a;const l=kb(o.id),c=(0,Un.useRef)(r);return(0,Un.useEffect)((()=>{const e=c.current;if(!l)return;if(!e)return;if(!s)return;const t=i({id:l,element:e});return null==n?void 0:n.renderItem(t)}),[l,s,i,n]),qy(o=Ey(ky({},o),{ref:Cb(c,o.ref)}))})));Fb((function(e){return Bb("div",M_(e))}));function V_(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?tb(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(tb(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}var F_=Symbol("command"),R_=Db((function(e){var t=e,{clickOnEnter:n=!0,clickOnSpace:s=!0}=t,i=Py(t,["clickOnEnter","clickOnSpace"]);const r=(0,Un.useRef)(null),[o,a]=(0,Un.useState)(!1);(0,Un.useEffect)((()=>{r.current&&a(tb(r.current))}),[]);const[l,c]=(0,Un.useState)(!1),u=(0,Un.useRef)(!1),d=Wy(i),[h,p]=function(e,t,n){const s=e.onLoadedMetadataCapture,i=(0,Un.useMemo)((()=>Object.assign((()=>{}),Ey(ky({},s),{[t]:n}))),[s,t,n]);return[null==s?void 0:s[t],{onLoadedMetadataCapture:i}]}(i,F_,!0),f=i.onKeyDown,m=Sb((e=>{null==f||f(e);const t=e.currentTarget;if(e.defaultPrevented)return;if(h)return;if(d)return;if(!fb(e))return;if(sb(t))return;if(t.isContentEditable)return;const i=n&&"Enter"===e.key,r=s&&" "===e.key,o="Enter"===e.key&&!n,a=" "===e.key&&!s;if(o||a)e.preventDefault();else if(i||r){const n=V_(e);if(i){if(!n){e.preventDefault();const n=e,{view:s}=n,i=Py(n,["view"]),r=()=>gb(t,i);Jy&&/firefox\//i.test(navigator.userAgent)?xb(t,"keyup",r):queueMicrotask(r)}}else r&&(u.current=!0,n||(e.preventDefault(),c(!0)))}})),g=i.onKeyUp,v=Sb((e=>{if(null==g||g(e),e.defaultPrevented)return;if(h)return;if(d)return;if(e.metaKey)return;const t=s&&" "===e.key;if(u.current&&t&&(u.current=!1,!V_(e))){e.preventDefault(),c(!1);const t=e.currentTarget,n=e,{view:s}=n,i=Py(n,["view"]);queueMicrotask((()=>gb(t,i)))}}));return i=Ey(ky(ky({"data-active":l||void 0,type:o?"button":void 0},p),i),{ref:Cb(r,i.ref),onKeyDown:m,onKeyUp:v}),i=v_(i)}));Fb((function(e){return Bb("button",R_(e))}));function B_(e,t=!1){const{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function D_(e,t,n,s=!1){var i;if(!t)return;if(!n)return;const{renderedItems:r}=t.getState(),o=ab(e);if(!o)return;const a=function(e,t=!1){const n=e.clientHeight,{top:s}=e.getBoundingClientRect(),i=1.5*Math.max(.875*n,n-40),r=t?n-i+s:i+s;return"HTML"===e.tagName?r+e.scrollTop:r}(o,s);let l,c;for(let e=0;e<r.length;e+=1){const r=l;if(l=n(e),!l)break;if(l===r)continue;const o=null==(i=$w(t,l))?void 0:i.element;if(!o)continue;const u=B_(o,s)-a,d=Math.abs(u);if(s&&u<=0||!s&&u>=0){void 0!==c&&c<d&&(l=r);break}c=d}return l}var L_=Db((function(e){var t=e,{store:n,rowId:s,preventScrollOnKeyDown:i=!1,moveOnKeyPress:r=!0,tabbable:o=!1,getItem:a,"aria-setsize":l,"aria-posinset":c}=t,u=Py(t,["store","rowId","preventScrollOnKeyDown","moveOnKeyPress","tabbable","getItem","aria-setsize","aria-posinset"]);const d=Ub();n=n||d;const h=kb(u.id),p=(0,Un.useRef)(null),f=(0,Un.useContext)(Yb),m=Wy(u)&&!u.accessibleWhenDisabled,{rowId:g,baseElement:v,isActiveItem:x,ariaSetSize:y,ariaPosInSet:b,isTabbable:w}=uw(n,{rowId:e=>s||(e&&(null==f?void 0:f.baseElement)&&f.baseElement===e.baseElement?f.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===h,ariaSetSize:e=>null!=l?l:e&&(null==f?void 0:f.ariaSetSize)&&f.baseElement===e.baseElement?f.ariaSetSize:void 0,ariaPosInSet(e){if(null!=c)return c;if(!e)return;if(!(null==f?void 0:f.ariaPosInSet))return;if(f.baseElement!==e.baseElement)return;const t=e.renderedItems.filter((e=>e.rowId===g));return f.ariaPosInSet+t.findIndex((e=>e.id===h))},isTabbable(e){if(!(null==e?void 0:e.renderedItems.length))return!0;if(e.virtualFocus)return!1;if(o)return!0;if(null===e.activeId)return!1;const t=null==n?void 0:n.item(e.activeId);return!!(null==t?void 0:t.disabled)||(!(null==t?void 0:t.element)||e.activeId===h)}}),_=(0,Un.useCallback)((e=>{var t;const n=Ey(ky({},e),{id:h||e.id,rowId:g,disabled:!!m,children:null==(t=e.element)?void 0:t.textContent});return a?a(n):n}),[h,g,m,a]),j=u.onFocus,S=(0,Un.useRef)(!1),C=Sb((e=>{if(null==j||j(e),e.defaultPrevented)return;if(pb(e))return;if(!h)return;if(!n)return;if(function(e,t){return!fb(e)&&t_(t,e.target)}(e,n))return;const{virtualFocus:t,baseElement:s}=n.getState();if(n.setActiveId(h),ib(e.currentTarget)&&function(e,t=!1){if(sb(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){const n=Qy(e).getSelection();null==n||n.selectAllChildren(e),t&&(null==n||n.collapseToEnd())}}(e.currentTarget),!t)return;if(!fb(e))return;if(ib(i=e.currentTarget)||"INPUT"===i.tagName&&!tb(i))return;var i;if(!(null==s?void 0:s.isConnected))return;hb()&&e.currentTarget.hasAttribute("data-autofocus")&&e.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),S.current=!0;e.relatedTarget===s||t_(n,e.relatedTarget)?function(e){e[e_]=!0,e.focus({preventScroll:!0})}(s):s.focus()})),k=u.onBlurCapture,E=Sb((e=>{if(null==k||k(e),e.defaultPrevented)return;const t=null==n?void 0:n.getState();(null==t?void 0:t.virtualFocus)&&S.current&&(S.current=!1,e.preventDefault(),e.stopPropagation())})),P=u.onKeyDown,I=Ib(i),T=Ib(r),O=Sb((e=>{if(null==P||P(e),e.defaultPrevented)return;if(!fb(e))return;if(!n)return;const{currentTarget:t}=e,s=n.getState(),i=n.item(h),r=!!(null==i?void 0:i.rowId),o="horizontal"!==s.orientation,a="vertical"!==s.orientation,l=()=>!!r||(!!a||(!s.baseElement||!sb(s.baseElement))),c={ArrowUp:(r||o)&&n.up,ArrowRight:(r||a)&&n.next,ArrowDown:(r||o)&&n.down,ArrowLeft:(r||a)&&n.previous,Home:()=>{if(l())return!r||e.ctrlKey?null==n?void 0:n.first():null==n?void 0:n.previous(-1)},End:()=>{if(l())return!r||e.ctrlKey?null==n?void 0:n.last():null==n?void 0:n.next(-1)},PageUp:()=>D_(t,n,null==n?void 0:n.up,!0),PageDown:()=>D_(t,n,null==n?void 0:n.down)}[e.key];if(c){if(ib(t)){const n=rb(t),s=a&&"ArrowLeft"===e.key,i=a&&"ArrowRight"===e.key,r=o&&"ArrowUp"===e.key,l=o&&"ArrowDown"===e.key;if(i||l){const{length:e}=function(e){if(sb(e))return e.value;if(e.isContentEditable){const t=Qy(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(t);if(n.end!==e)return}else if((s||r)&&0!==n.start)return}const s=c();if(I(e)||void 0!==s){if(!T(e))return;e.preventDefault(),n.move(s)}}})),A=(0,Un.useMemo)((()=>({id:h,baseElement:v})),[h,v]);return u=Tb(u,(e=>(0,oe.jsx)(Kb.Provider,{value:A,children:e})),[A]),u=Ey(ky({id:h,"data-active-item":x||void 0},u),{ref:Cb(p,u.ref),tabIndex:w?u.tabIndex:-1,onFocus:C,onBlurCapture:E,onKeyDown:O}),u=R_(u),u=M_(Ey(ky({store:n},u),{getItem:_,shouldRegisterItem:!!h&&u.shouldRegisterItem})),qy(Ey(ky({},u),{"aria-setsize":y,"aria-posinset":b}))}));Rb(Fb((function(e){return Bb("button",L_(e))})));function z_(e){var t;return null!=(t={menu:"menuitem",listbox:"option",tree:"treeitem"}[e])?t:"option"}var G_=Db((function(e){var t,n=e,{store:s,value:i,hideOnClick:r,setValueOnClick:o,selectValueOnClick:a=!0,resetValueOnSelect:l,focusOnHover:c=!1,moveOnKeyPress:u=!0,getItem:d}=n,h=Py(n,["store","value","hideOnClick","setValueOnClick","selectValueOnClick","resetValueOnSelect","focusOnHover","moveOnKeyPress","getItem"]);const p=Hw();Uy(s=s||p,!1);const{resetValueOnSelectState:f,multiSelectable:m,selected:g}=uw(s,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)}(e.selectedValue,i)}),v=(0,Un.useCallback)((e=>{const t=Ey(ky({},e),{value:i});return d?d(t):t}),[i,d]);o=null!=o?o:!m,r=null!=r?r:null!=i&&!m;const x=h.onClick,y=Ib(o),b=Ib(a),w=Ib(null!=(t=null!=l?l:f)?t:m),_=Ib(r),j=Sb((e=>{null==x||x(e),e.defaultPrevented||function(e){const t=e.currentTarget;if(!t)return!1;const n=t.tagName.toLowerCase();return!!e.altKey&&("a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type)}(e)||function(e){const t=e.currentTarget;if(!t)return!1;const n=db();if(n&&!e.metaKey)return!1;if(!n&&!e.ctrlKey)return!1;const s=t.tagName.toLowerCase();return"a"===s||"button"===s&&"submit"===t.type||"input"===s&&"submit"===t.type}(e)||(null!=i&&(b(e)&&(w(e)&&(null==s||s.resetValue()),null==s||s.setSelectedValue((e=>Array.isArray(e)?e.includes(i)?e.filter((e=>e!==i)):[...e,i]:i))),y(e)&&(null==s||s.setValue(i))),_(e)&&(null==s||s.hide()))})),S=h.onKeyDown,C=Sb((e=>{if(null==S||S(e),e.defaultPrevented)return;const t=null==s?void 0:s.getState().baseElement;if(!t)return;if(r_(t))return;(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask((()=>t.focus())),sb(t)&&(null==s||s.setValue(t.value)))}));m&&null!=g&&(h=ky({"aria-selected":g},h)),h=Tb(h,(e=>(0,oe.jsx)(Zw.Provider,{value:i,children:(0,oe.jsx)(Kw.Provider,{value:null!=g&&g,children:e})})),[i,g]);const k=(0,Un.useContext)(Lw);h=Ey(ky({role:z_(k),children:i},h),{onClick:j,onKeyDown:C});const E=Ib(u);return h=L_(Ey(ky({store:s},h),{getItem:v,moveOnKeyPress:e=>{if(!E(e))return!1;const t=new Event("combobox-item-move"),n=null==s?void 0:s.getState().baseElement;return null==n||n.dispatchEvent(t),!0}})),h=N_(ky({store:s,focusOnHover:c},h))})),H_=Rb(Fb((function(e){return Bb("div",G_(e))})));function U_(e){return Gy(e).toLowerCase()}function W_(e,t){if(!e)return e;if(!t)return e;const n=(s=t,Array.isArray(s)?s:void 0!==s?[s]:[]).filter(Boolean).map(U_);var s;const i=[],r=(e,t=!1)=>(0,oe.jsx)("span",{"data-autocomplete-value":t?"":void 0,"data-user-value":t?void 0:"",children:e},i.length),o=function(e){return e.sort((([e],[t])=>e-t))}(function(e){return e.filter((([e,t],n,s)=>!s.some((([s,i],r)=>r!==n&&s<=e&&s+i>=e+t))))}(function(e,t){const n=[];for(const s of t){let t=0;const i=s.length;for(;-1!==e.indexOf(s,t);){const r=e.indexOf(s,t);-1!==r&&n.push([r,i]),t=r+1}}return n}(U_(e),new Set(n))));if(!o.length)return i.push(r(e,!0)),i;const[a]=o[0],l=[e.slice(0,a),...o.flatMap((([t,n],s)=>{var i;const r=e.slice(t,t+n),a=null==(i=o[s+1])?void 0:i[0];return[r,e.slice(t+n,a)]}))];return l.forEach(((e,t)=>{e&&i.push(r(e,t%2==0))})),i}var q_=Db((function(e){var t=e,{store:n,value:s,userValue:i}=t,r=Py(t,["store","value","userValue"]);const o=Hw();n=n||o;const a=(0,Un.useContext)(Zw),l=null!=s?s:a,c=cw(n,(e=>null!=i?i:null==e?void 0:e.value)),u=(0,Un.useMemo)((()=>{if(l)return c?W_(l,c):l}),[l,c]);return qy(r=ky({children:u},r))})),Z_=Fb((function(e){return Bb("span",q_(e))}));const K_=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Circle,{cx:12,cy:12,r:3})});function Y_(e=""){return Ux()(e.trim().toLowerCase())}const X_=[],J_=(e,t)=>e.singleSelection?t?.value:Array.isArray(t?.value)?t.value:!Array.isArray(t?.value)&&t?.value?[t.value]:X_,Q_=(e,t,n)=>e.singleSelection?n:Array.isArray(t?.value)?t.value.includes(n)?t.value.filter((e=>e!==n)):[...t.value,n]:[n];function $_(e,t){return`${e}-${t}`}function ej({view:e,filter:t,onChangeView:n}){const s=(0,v.useInstanceId)(ej,"dataviews-filter-list-box"),[i,r]=(0,d.useState)(1===t.operators?.length?void 0:null),o=e.filters?.find((e=>e.field===t.field)),a=J_(t,o);return(0,oe.jsx)(y.Composite,{virtualFocus:!0,focusLoop:!0,activeId:i,setActiveId:r,role:"listbox",className:"dataviews-filters__search-widget-listbox","aria-label":(0,b.sprintf)((0,b.__)("List of: %1$s"),t.name),onFocusVisible:()=>{!i&&t.elements.length&&r($_(s,t.elements[0].value))},render:(0,oe.jsx)(y.Composite.Typeahead,{}),children:t.elements.map((i=>(0,oe.jsxs)(y.Composite.Hover,{render:(0,oe.jsx)(y.Composite.Item,{id:$_(s,i.value),render:(0,oe.jsx)("div",{"aria-label":i.label,role:"option",className:"dataviews-filters__search-widget-listitem"}),onClick:()=>{var s,r;const a=o?[...(null!==(s=e.filters)&&void 0!==s?s:[]).map((e=>e.field===t.field?{...e,operator:o.operator||t.operators[0],value:Q_(t,o,i.value)}:e))]:[...null!==(r=e.filters)&&void 0!==r?r:[],{field:t.field,operator:t.operators[0],value:Q_(t,o,i.value)}];n({...e,page:1,filters:a})}}),children:[(0,oe.jsxs)("span",{className:"dataviews-filters__search-widget-listitem-check",children:[t.singleSelection&&a===i.value&&(0,oe.jsx)(y.Icon,{icon:K_}),!t.singleSelection&&a.includes(i.value)&&(0,oe.jsx)(y.Icon,{icon:Jr})]}),(0,oe.jsx)("span",{children:i.label})]},i.value)))})}function tj({view:e,filter:t,onChangeView:n}){const[s,i]=(0,d.useState)(""),r=(0,d.useDeferredValue)(s),o=e.filters?.find((e=>e.field===t.field)),a=J_(t,o),l=(0,d.useMemo)((()=>{const e=Y_(r);return t.elements.filter((t=>Y_(t.label).includes(e)))}),[t.elements,r]);return(0,oe.jsxs)(Yw,{selectedValue:a,setSelectedValue:s=>{var i,r;const a=o?[...(null!==(i=e.filters)&&void 0!==i?i:[]).map((e=>e.field===t.field?{...e,operator:o.operator||t.operators[0],value:s}:e))]:[...null!==(r=e.filters)&&void 0!==r?r:[],{field:t.field,operator:t.operators[0],value:s}];n({...e,page:1,filters:a})},setValue:i,children:[(0,oe.jsxs)("div",{className:"dataviews-filters__search-widget-filter-combobox__wrapper",children:[(0,oe.jsx)(Jw,{render:(0,oe.jsx)(y.VisuallyHidden,{children:(0,b.__)("Search items")}),children:(0,b.__)("Search items")}),(0,oe.jsx)(j_,{autoSelect:"always",placeholder:(0,b.__)("Search"),className:"dataviews-filters__search-widget-filter-combobox__input"}),(0,oe.jsx)("div",{className:"dataviews-filters__search-widget-filter-combobox__icon",children:(0,oe.jsx)(y.Icon,{icon:Xt})})]}),(0,oe.jsxs)(T_,{className:"dataviews-filters__search-widget-filter-combobox-list",alwaysVisible:!0,children:[l.map((e=>(0,oe.jsxs)(H_,{resetValueOnSelect:!1,value:e.value,className:"dataviews-filters__search-widget-listitem",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0,children:[(0,oe.jsxs)("span",{className:"dataviews-filters__search-widget-listitem-check",children:[t.singleSelection&&a===e.value&&(0,oe.jsx)(y.Icon,{icon:K_}),!t.singleSelection&&a.includes(e.value)&&(0,oe.jsx)(y.Icon,{icon:Jr})]}),(0,oe.jsxs)("span",{children:[(0,oe.jsx)(Z_,{className:"dataviews-filters__search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,oe.jsx)("span",{className:"dataviews-filters__search-widget-listitem-description",children:e.description})]})]},e.value))),!l.length&&(0,oe.jsx)("p",{children:(0,b.__)("No results found")})]})]})}function nj(e){const t=e.filter.elements.length>10?tj:ej;return(0,oe.jsx)(t,{...e})}const sj="Enter",ij=" ",rj=({activeElements:e,filterInView:t,filter:n})=>{if(void 0===e||0===e.length)return n.name;const s={Name:(0,oe.jsx)("span",{className:"dataviews-filters__summary-filter-text-name"}),Value:(0,oe.jsx)("span",{className:"dataviews-filters__summary-filter-text-value"})};return t?.operator===Yx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("<Name>%1$s is any: </Name><Value>%2$s</Value>"),n.name,e.map((e=>e.label)).join(", ")),s):t?.operator===Xx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("<Name>%1$s is none: </Name><Value>%2$s</Value>"),n.name,e.map((e=>e.label)).join(", ")),s):t?.operator===Jx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("<Name>%1$s is all: </Name><Value>%2$s</Value>"),n.name,e.map((e=>e.label)).join(", ")),s):t?.operator===Qx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("<Name>%1$s is not all: </Name><Value>%2$s</Value>"),n.name,e.map((e=>e.label)).join(", ")),s):t?.operator===Zx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),n.name,e[0].label),s):t?.operator===Kx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),n.name,e[0].label),s):(0,b.sprintf)((0,b.__)("Unknown status for %1$s"),n.name)};function oj({filter:e,view:t,onChangeView:n}){const s=e.operators?.map((e=>({value:e,label:ey[e]?.label}))),i=t.filters?.find((t=>t.field===e.field)),r=i?.operator||e.operators[0];return s.length>1&&(0,oe.jsxs)(y.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filters__summary-operators-container",children:[(0,oe.jsx)(y.FlexItem,{className:"dataviews-filters__summary-operators-filter-name",children:e.name}),(0,oe.jsx)(y.SelectControl,{label:(0,b.__)("Conditions"),value:r,options:s,onChange:s=>{var r,o;const a=s,l=i?[...(null!==(r=t.filters)&&void 0!==r?r:[]).map((t=>t.field===e.field?{...t,operator:a}:t))]:[...null!==(o=t.filters)&&void 0!==o?o:[],{field:e.field,operator:a,value:void 0}];n({...t,page:1,filters:l})},size:"small",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0})]})}function aj({addFilterRef:e,openedFilter:t,...n}){const s=(0,d.useRef)(null),{filter:i,view:r,onChangeView:o}=n,a=r.filters?.find((e=>e.field===i.field)),l=i.elements.filter((e=>i.singleSelection?e.value===a?.value:a?.value?.includes(e.value))),c=i.isPrimary,u=void 0!==a?.value,h=!c||u;return(0,oe.jsx)(y.Dropdown,{defaultOpen:t===i.field,contentClassName:"dataviews-filters__summary-popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{s.current?.focus()},renderToggle:({isOpen:t,onToggle:n})=>(0,oe.jsxs)("div",{className:"dataviews-filters__summary-chip-container",children:[(0,oe.jsx)(y.Tooltip,{text:(0,b.sprintf)((0,b.__)("Filter by: %1$s"),i.name.toLowerCase()),placement:"top",children:(0,oe.jsx)("div",{className:Ut("dataviews-filters__summary-chip",{"has-reset":h,"has-values":u}),role:"button",tabIndex:0,onClick:n,onKeyDown:e=>{[sj,ij].includes(e.key)&&(n(),e.preventDefault())},"aria-pressed":t,"aria-expanded":t,ref:s,children:(0,oe.jsx)(rj,{activeElements:l,filterInView:a,filter:i})})}),h&&(0,oe.jsx)(y.Tooltip,{text:c?(0,b.__)("Reset"):(0,b.__)("Remove"),placement:"top",children:(0,oe.jsx)("button",{className:Ut("dataviews-filters__summary-chip-remove",{"has-values":u}),onClick:()=>{o({...r,page:1,filters:r.filters?.filter((e=>e.field!==i.field))}),c?s.current?.focus():e.current?.focus()},children:(0,oe.jsx)(y.Icon,{icon:Ro})})})]}),renderContent:()=>(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,justify:"flex-start",children:[(0,oe.jsx)(oj,{...n}),(0,oe.jsx)(nj,{...n})]})})}const{lock:lj,unlock:cj}=(0,$.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/dataviews"),{Menu:uj}=cj(y.privateApis);function dj({filters:e,view:t,onChangeView:n,setOpenedFilter:s,triggerProps:i}){const r=e.filter((e=>!e.isVisible));return(0,oe.jsxs)(uj,{children:[(0,oe.jsx)(uj.TriggerButton,{...i}),(0,oe.jsx)(uj.Popover,{children:r.map((e=>(0,oe.jsx)(uj.Item,{onClick:()=>{s(e.field),n({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})},children:(0,oe.jsx)(uj.ItemLabel,{children:e.name})},e.field)))})]})}const hj=(0,d.forwardRef)((function({filters:e,view:t,onChangeView:n,setOpenedFilter:s},i){if(!e.length||e.every((({isPrimary:e})=>e)))return null;const r=e.filter((e=>!e.isVisible));return(0,oe.jsx)(dj,{triggerProps:{render:(0,oe.jsx)(y.Button,{accessibleWhenDisabled:!0,size:"compact",className:"dataviews-filters-button",variant:"tertiary",disabled:!r.length,ref:i}),children:(0,b.__)("Add filter")},filters:e,view:t,onChangeView:n,setOpenedFilter:s})}));function pj({filters:e,view:t,onChangeView:n}){const s=!t.search&&!t.filters?.some((t=>{return void 0!==t.value||(n=t.field,!e.some((e=>e.field===n&&e.isPrimary)));var n}));return(0,oe.jsx)(y.Button,{disabled:s,accessibleWhenDisabled:!0,size:"compact",variant:"tertiary",className:"dataviews-filters__reset-button",onClick:()=>{n({...t,page:1,search:"",filters:[]})},children:(0,b.__)("Reset")})}function fj(e){let t=e.filterBy?.operators;return t&&Array.isArray(t)||(t=[Yx,Xx]),t=t.filter((e=>$x.includes(e))),(t.includes(Zx)||t.includes(Kx))&&(t=t.filter((e=>[Zx,Kx].includes(e)))),t}function mj(e,t){return(0,d.useMemo)((()=>{const n=[];return e.forEach((e=>{if(!e.elements?.length)return;const s=fj(e);if(0===s.length)return;const i=!!e.filterBy?.isPrimary;n.push({field:e.id,name:e.label,elements:e.elements,singleSelection:s.some((e=>[Zx,Kx].includes(e))),operators:s,isVisible:i||!!t.filters?.some((t=>t.field===e.id&&$x.includes(t.operator))),isPrimary:i})})),n.sort(((e,t)=>e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name))),n}),[e,t])}function gj({filters:e,view:t,onChangeView:n,setOpenedFilter:s,isShowingFilter:i,setIsShowingFilter:r}){const o=(0,d.useRef)(null),a=(0,d.useCallback)((e=>{n(e),r(!0)}),[n,r]),l=!!e.filter((e=>e.isVisible)).length;if(0===e.length)return null;const c={label:(0,b.__)("Add filter"),"aria-expanded":!1,isPressed:!1},u={label:(0,b._x)("Filter","verb"),"aria-expanded":i,isPressed:i,onClick:()=>{i||s(null),r(!i)}},h=(0,oe.jsx)(y.Button,{ref:o,className:"dataviews-filters__visibility-toggle",size:"compact",icon:xy,...l?u:c});return(0,oe.jsx)("div",{className:"dataviews-filters__container-visibility-toggle",children:l?(0,oe.jsx)(vj,{buttonRef:o,filtersCount:t.filters?.length,children:h}):(0,oe.jsx)(dj,{filters:e,view:t,onChangeView:a,setOpenedFilter:s,triggerProps:{render:h}})})}function vj({buttonRef:e,filtersCount:t,children:n}){return(0,d.useEffect)((()=>()=>{e.current?.focus()}),[e]),(0,oe.jsxs)(oe.Fragment,{children:[n,!!t&&(0,oe.jsx)("span",{className:"dataviews-filters-toggle__count",children:t})]})}const xj=(0,d.memo)((function(){const{fields:e,view:t,onChangeView:n,openedFilter:s,setOpenedFilter:i}=(0,d.useContext)(vy),r=(0,d.useRef)(null),o=mj(e,t),a=(0,oe.jsx)(hj,{filters:o,view:t,onChangeView:n,ref:r,setOpenedFilter:i},"add-filter"),l=o.filter((e=>e.isVisible));if(0===l.length)return null;const c=[...l.map((e=>(0,oe.jsx)(aj,{filter:e,view:t,onChangeView:n,addFilterRef:r,openedFilter:s},e.field))),a];return c.push((0,oe.jsx)(pj,{filters:o,view:t,onChangeView:n},"reset-filters")),(0,oe.jsx)(y.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},className:"dataviews-filters__container",wrap:!0,children:c})})),yj=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"})}),bj=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})}),wj=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})}),_j=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})});function jj({selection:e,onChangeSelection:t,item:n,getItemId:s,titleField:i,disabled:r}){const o=s(n),a=!r&&e.includes(o),l=i?.getValue?.({item:n})||(0,b.__)("(no title)");return(0,oe.jsx)(y.CheckboxControl,{className:"dataviews-selection-checkbox",__nextHasNoMarginBottom:!0,"aria-label":l,"aria-disabled":r,checked:a,onChange:()=>{r||t(e.includes(o)?e.filter((e=>o!==e)):[...e,o])}})}const{Menu:Sj,kebabCase:Cj}=cj(y.privateApis);function kj({action:e,onClick:t,items:n}){const s="string"==typeof e.label?e.label:e.label(n);return(0,oe.jsx)(y.Button,{label:s,icon:e.icon,disabled:!!e.disabled,accessibleWhenDisabled:!0,isDestructive:e.isDestructive,size:"compact",onClick:t})}function Ej({action:e,onClick:t,items:n}){const s="string"==typeof e.label?e.label:e.label(n);return(0,oe.jsx)(Sj.Item,{disabled:e.disabled,onClick:t,children:(0,oe.jsx)(Sj.ItemLabel,{children:s})})}function Pj({action:e,items:t,closeModal:n}){const s="string"==typeof e.label?e.label:e.label(t);return(0,oe.jsx)(y.Modal,{title:e.modalHeader||s,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:n,focusOnMount:"firstContentElement",size:"medium",overlayClassName:`dataviews-action-modal dataviews-action-modal__${Cj(e.id)}`,children:(0,oe.jsx)(e.RenderModal,{items:t,closeModal:n})})}function Ij({actions:e,item:t,registry:n,setActiveModalAction:s}){return(0,oe.jsx)(Sj.Group,{children:e.map((e=>(0,oe.jsx)(Ej,{action:e,onClick:()=>{"RenderModal"in e?s(e):e.callback([t],{registry:n})},items:[t]},e.id)))})}function Tj({item:e,actions:t,isCompact:n}){const s=(0,l.useRegistry)(),{primaryActions:i,eligibleActions:r}=(0,d.useMemo)((()=>{const n=t.filter((t=>!t.isEligible||t.isEligible(e)));return{primaryActions:n.filter((e=>e.isPrimary&&!!e.icon)),eligibleActions:n}}),[t,e]);return n?(0,oe.jsx)(Oj,{item:e,actions:r,isSmall:!0,registry:s}):i.length===r.length?(0,oe.jsx)(Aj,{item:e,actions:i,registry:s}):(0,oe.jsxs)(y.__experimentalHStack,{spacing:1,justify:"flex-end",className:"dataviews-item-actions",style:{flexShrink:"0",width:"auto"},children:[(0,oe.jsx)(Aj,{item:e,actions:i,registry:s}),(0,oe.jsx)(Oj,{item:e,actions:r,registry:s})]})}function Oj({item:e,actions:t,isSmall:n,registry:s}){const[i,r]=(0,d.useState)(null);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(Sj,{placement:"bottom-end",children:[(0,oe.jsx)(Sj.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:n?"small":"compact",icon:Ga,label:(0,b.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,className:"dataviews-all-actions-button"})}),(0,oe.jsx)(Sj.Popover,{children:(0,oe.jsx)(Ij,{actions:t,item:e,registry:s,setActiveModalAction:r})})]}),!!i&&(0,oe.jsx)(Pj,{action:i,items:[e],closeModal:()=>r(null)})]})}function Aj({item:e,actions:t,registry:n}){const[s,i]=(0,d.useState)(null);return Array.isArray(t)&&0!==t.length?(0,oe.jsxs)(oe.Fragment,{children:[t.map((t=>(0,oe.jsx)(kj,{action:t,onClick:()=>{"RenderModal"in t?i(t):t.callback([e],{registry:n})},items:[e]},t.id))),!!s&&(0,oe.jsx)(Pj,{action:s,items:[e],closeModal:()=>i(null)})]}):null}function Nj({action:e,items:t,ActionTriggerComponent:n}){const[s,i]=(0,d.useState)(!1),r={action:e,onClick:()=>{i(!0)},items:t};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(n,{...r}),s&&(0,oe.jsx)(Pj,{action:e,items:t,closeModal:()=>i(!1)})]})}function Mj(e,t){return(0,d.useMemo)((()=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))),[e,t])}function Vj(e,t){return(0,d.useMemo)((()=>t.some((t=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))))),[e,t])}function Fj({selection:e,onChangeSelection:t,data:n,actions:s,getItemId:i}){const r=(0,d.useMemo)((()=>n.filter((e=>s.some((t=>t.supportsBulk&&(!t.isEligible||t.isEligible(e))))))),[n,s]),o=n.filter((t=>e.includes(i(t))&&r.includes(t))),a=o.length===r.length;return(0,oe.jsx)(y.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:a,indeterminate:!a&&!!o.length,onChange:()=>{t(a?[]:r.map((e=>i(e))))},"aria-label":a?(0,b.__)("Deselect all"):(0,b.__)("Select all")})}function Rj({action:e,onClick:t,isBusy:n,items:s}){const i="string"==typeof e.label?e.label:e.label(s);return(0,oe.jsx)(y.Button,{disabled:n,accessibleWhenDisabled:!0,label:i,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t,isBusy:n,tooltipPosition:"top"})}const Bj=[];function Dj({action:e,selectedItems:t,actionInProgress:n,setActionInProgress:s}){const i=(0,l.useRegistry)(),r=(0,d.useMemo)((()=>t.filter((t=>!e.isEligible||e.isEligible(t)))),[e,t]);return"RenderModal"in e?(0,oe.jsx)(Nj,{action:e,items:r,ActionTriggerComponent:Rj},e.id):(0,oe.jsx)(Rj,{action:e,onClick:async()=>{s(e.id),await e.callback(t,{registry:i}),s(null)},items:r,isBusy:n===e.id},e.id)}function Lj(e,t,n,s,i,r,o,a,l){const c=r.length>0?(0,b.sprintf)((0,b._n)("%d Item selected","%d Items selected",r.length),r.length):(0,b.sprintf)((0,b._n)("%d Item","%d Items",e.length),e.length);return(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,className:"dataviews-bulk-actions-footer__container",spacing:3,children:[(0,oe.jsx)(Fj,{selection:s,onChangeSelection:l,data:e,actions:t,getItemId:n}),(0,oe.jsx)("span",{className:"dataviews-bulk-actions-footer__item-count",children:c}),(0,oe.jsxs)(y.__experimentalHStack,{className:"dataviews-bulk-actions-footer__action-buttons",expanded:!1,spacing:1,children:[i.map((e=>(0,oe.jsx)(Dj,{action:e,selectedItems:r,actionInProgress:o,setActionInProgress:a},e.id))),r.length>0&&(0,oe.jsx)(y.Button,{icon:Ro,showTooltip:!0,tooltipPosition:"top",size:"compact",label:(0,b.__)("Cancel"),disabled:!!o,accessibleWhenDisabled:!1,onClick:()=>{l(Bj)}})]})]})}function zj({selection:e,actions:t,onChangeSelection:n,data:s,getItemId:i}){const[r,o]=(0,d.useState)(null),a=(0,d.useRef)(null),l=(0,d.useMemo)((()=>t.filter((e=>e.supportsBulk))),[t]),c=(0,d.useMemo)((()=>s.filter((e=>l.some((t=>!t.isEligible||t.isEligible(e)))))),[s,l]),u=(0,d.useMemo)((()=>s.filter((t=>e.includes(i(t))&&c.includes(t)))),[e,s,i,c]),h=(0,d.useMemo)((()=>t.filter((e=>e.supportsBulk&&e.icon&&u.some((t=>!e.isEligible||e.isEligible(t)))))),[t,u]);return r?(a.current||(a.current=Lj(s,t,i,e,h,u,r,o,n)),a.current):(a.current&&(a.current=null),Lj(s,t,i,e,h,u,r,o,n))}function Gj(){const{data:e,selection:t,actions:n=Bj,onChangeSelection:s,getItemId:i}=(0,d.useContext)(vy);return(0,oe.jsx)(zj,{selection:t,onChangeSelection:s,data:e,actions:n,getItemId:i})}const Hj=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})}),Uj=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})}),Wj=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z"})}),{Menu:qj}=cj(y.privateApis);function Zj({children:e}){return d.Children.toArray(e).filter(Boolean).map(((e,t)=>(0,oe.jsxs)(d.Fragment,{children:[t>0&&(0,oe.jsx)(qj.Separator,{}),e]},t)))}const Kj=(0,d.forwardRef)((function({fieldId:e,view:t,fields:n,onChangeView:s,onHide:i,setOpenedFilter:r,canMove:o=!0},a){var l;const c=null!==(l=t.fields)&&void 0!==l?l:[],u=c?.indexOf(e),d=t.sort?.field===e;let h=!1,p=!1,f=!1,m=[];const g=n.find((t=>t.id===e));if(!g)return null;h=!1!==g.enableHiding,p=!1!==g.enableSorting;const v=g.header;return m=fj(g),f=!(t.filters?.some((t=>e===t.field))||!g.elements?.length||!m.length||g.filterBy?.isPrimary),(0,oe.jsxs)(qj,{children:[(0,oe.jsxs)(qj.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:a,variant:"tertiary"}),children:[v,t.sort&&d&&(0,oe.jsx)("span",{"aria-hidden":"true",children:ny[t.sort.direction]})]}),(0,oe.jsx)(qj.Popover,{style:{minWidth:"240px"},children:(0,oe.jsxs)(Zj,{children:[p&&(0,oe.jsx)(qj.Group,{children:ty.map((n=>{const i=t.sort&&d&&t.sort.direction===n,r=`${e}-${n}`;return(0,oe.jsx)(qj.RadioItem,{name:"view-table-sorting",value:r,checked:i,onChange:()=>{s({...t,sort:{field:e,direction:n},showLevels:!1})},children:(0,oe.jsx)(qj.ItemLabel,{children:iy[n]})},r)}))}),f&&(0,oe.jsx)(qj.Group,{children:(0,oe.jsx)(qj.Item,{prefix:(0,oe.jsx)(y.Icon,{icon:xy}),onClick:()=>{r(e),s({...t,page:1,filters:[...t.filters||[],{field:e,value:void 0,operator:m[0]}]})},children:(0,oe.jsx)(qj.ItemLabel,{children:(0,b.__)("Add filter")})})}),(o||h)&&g&&(0,oe.jsxs)(qj.Group,{children:[o&&(0,oe.jsx)(qj.Item,{prefix:(0,oe.jsx)(y.Icon,{icon:Hj}),disabled:u<1,onClick:()=>{var n;s({...t,fields:[...null!==(n=c.slice(0,u-1))&&void 0!==n?n:[],e,c[u-1],...c.slice(u+1)]})},children:(0,oe.jsx)(qj.ItemLabel,{children:(0,b.__)("Move left")})}),o&&(0,oe.jsx)(qj.Item,{prefix:(0,oe.jsx)(y.Icon,{icon:Uj}),disabled:u>=c.length-1,onClick:()=>{var n;s({...t,fields:[...null!==(n=c.slice(0,u))&&void 0!==n?n:[],c[u+1],e,...c.slice(u+2)]})},children:(0,oe.jsx)(qj.ItemLabel,{children:(0,b.__)("Move right")})}),h&&g&&(0,oe.jsx)(qj.Item,{prefix:(0,oe.jsx)(y.Icon,{icon:Wj}),onClick:()=>{i(g),s({...t,fields:c.filter((t=>t!==e))})},children:(0,oe.jsx)(qj.ItemLabel,{children:(0,b.__)("Hide column")})})]})]})})]})})),Yj=Kj;function Xj({item:e,isItemClickable:t,onClickItem:n,className:s}){return t(e)&&n?{className:s?`${s} ${s}--clickable`:void 0,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),n(e)},onKeyDown:t=>{"Enter"!==t.key&&""!==t.key&&" "!==t.key||(t.stopPropagation(),n(e))}}:{className:s}}const Jj=function({item:e,level:t,titleField:n,mediaField:s,descriptionField:i,onClickItem:r,isItemClickable:o}){const a=Xj({item:e,isItemClickable:o,onClickItem:r,className:"dataviews-view-table__cell-content-wrapper dataviews-title-field"});return(0,oe.jsxs)(y.__experimentalHStack,{spacing:3,justify:"flex-start",children:[s&&(0,oe.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",children:(0,oe.jsx)(s.render,{item:e})}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,children:[n&&(0,oe.jsxs)("div",{...a,children:[void 0!==t&&(0,oe.jsxs)("span",{className:"dataviews-view-table__level",children:["—".repeat(t)," "]}),(0,oe.jsx)(n.render,{item:e})]}),i&&(0,oe.jsx)(i.render,{item:e})]})]})};function Qj({item:e,fields:t,column:n}){const s=t.find((e=>e.id===n));return s?(0,oe.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,oe.jsx)(s.render,{item:e})}):null}function $j({hasBulkActions:e,item:t,level:n,actions:s,fields:i,id:r,view:o,titleField:a,mediaField:l,descriptionField:c,selection:u,getItemId:h,isItemClickable:p,onClickItem:f,onChangeSelection:m}){var g;const v=Mj(s,t),x=v&&u.includes(r),[y,b]=(0,d.useState)(!1),{showTitle:w=!0,showMedia:_=!0,showDescription:j=!0}=o,S=(0,d.useRef)(!1),C=null!==(g=o.fields)&&void 0!==g?g:[],k=a&&w||l&&_||c&&j;return(0,oe.jsxs)("tr",{className:Ut("dataviews-view-table__row",{"is-selected":v&&x,"is-hovered":y,"has-bulk-actions":v}),onMouseEnter:()=>{b(!0)},onMouseLeave:()=>{b(!1)},onTouchStart:()=>{S.current=!0},onClick:()=>{v&&(S.current||"Range"===document.getSelection()?.type||m(u.includes(r)?u.filter((e=>r!==e)):[r]))},children:[e&&(0,oe.jsx)("td",{className:"dataviews-view-table__checkbox-column",children:(0,oe.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,oe.jsx)(jj,{item:t,selection:u,onChangeSelection:m,getItemId:h,titleField:a,disabled:!v})})}),k&&(0,oe.jsx)("td",{children:(0,oe.jsx)(Jj,{item:t,level:n,titleField:w?a:void 0,mediaField:_?l:void 0,descriptionField:j?c:void 0,isItemClickable:p,onClickItem:f})}),C.map((e=>{var n;const{width:s,maxWidth:r,minWidth:a}=null!==(n=o.layout?.styles?.[e])&&void 0!==n?n:{};return(0,oe.jsx)("td",{style:{width:s,maxWidth:r,minWidth:a},children:(0,oe.jsx)(Qj,{fields:i,item:t,column:e})},e)})),!!s?.length&&(0,oe.jsx)("td",{className:"dataviews-view-table__actions-column",onClick:e=>e.stopPropagation(),children:(0,oe.jsx)(Tj,{item:t,actions:s})})]})}const eS=function({actions:e,data:t,fields:n,getItemId:s,getItemLevel:i,isLoading:r=!1,onChangeView:o,onChangeSelection:a,selection:l,setOpenedFilter:c,onClickItem:u,isItemClickable:h,view:p}){var f;const m=(0,d.useRef)(new Map),g=(0,d.useRef)(),[v,x]=(0,d.useState)(),w=Vj(e,t);(0,d.useEffect)((()=>{g.current&&(g.current.focus(),g.current=void 0)}));const _=(0,d.useId)();if(v)return g.current=v,void x(void 0);const j=e=>{const t=m.current.get(e.id),n=t?m.current.get(t.fallback):void 0;x(n?.node)},S=!!t?.length,C=n.find((e=>e.id===p.titleField)),k=n.find((e=>e.id===p.mediaField)),E=n.find((e=>e.id===p.descriptionField)),{showTitle:P=!0,showMedia:I=!0,showDescription:T=!0}=p,O=C&&P||k&&I||E&&T,A=null!==(f=p.fields)&&void 0!==f?f:[],N=(e,t)=>n=>{n?m.current.set(e,{node:n,fallback:A[t>0?t-1:1]}):m.current.delete(e)};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)("table",{className:Ut("dataviews-view-table",{[`has-${p.layout?.density}-density`]:p.layout?.density&&["compact","comfortable"].includes(p.layout.density)}),"aria-busy":r,"aria-describedby":_,children:[(0,oe.jsx)("thead",{children:(0,oe.jsxs)("tr",{className:"dataviews-view-table__row",children:[w&&(0,oe.jsx)("th",{className:"dataviews-view-table__checkbox-column",scope:"col",children:(0,oe.jsx)(Fj,{selection:l,onChangeSelection:a,data:t,actions:e,getItemId:s})}),O&&(0,oe.jsx)("th",{scope:"col",children:C&&(0,oe.jsx)(Yj,{ref:N(C.id,0),fieldId:C.id,view:p,fields:n,onChangeView:o,onHide:j,setOpenedFilter:c,canMove:!1})}),A.map(((e,t)=>{var s;const{width:i,maxWidth:r,minWidth:a}=null!==(s=p.layout?.styles?.[e])&&void 0!==s?s:{};return(0,oe.jsx)("th",{style:{width:i,maxWidth:r,minWidth:a},"aria-sort":p.sort?.direction&&p.sort?.field===e?sy[p.sort.direction]:void 0,scope:"col",children:(0,oe.jsx)(Yj,{ref:N(e,t),fieldId:e,view:p,fields:n,onChangeView:o,onHide:j,setOpenedFilter:c})},e)})),!!e?.length&&(0,oe.jsx)("th",{className:"dataviews-view-table__actions-column",children:(0,oe.jsx)("span",{className:"dataviews-view-table-header",children:(0,b.__)("Actions")})})]})}),(0,oe.jsx)("tbody",{children:S&&t.map(((t,r)=>(0,oe.jsx)($j,{item:t,level:p.showLevels&&"function"==typeof i?i(t):void 0,hasBulkActions:w,actions:e,fields:n,id:s(t)||r.toString(),view:p,titleField:C,mediaField:k,descriptionField:E,selection:l,getItemId:s,onChangeSelection:a,onClickItem:u,isItemClickable:h},s(t))))})]}),(0,oe.jsx)("div",{className:Ut({"dataviews-loading":r,"dataviews-no-results":!S&&!r}),id:_,children:!S&&(0,oe.jsx)("p",{children:r?(0,oe.jsx)(y.Spinner,{}):(0,b.__)("No results")})})]})},tS={xhuge:{min:3,max:6,default:5},huge:{min:2,max:4,default:4},xlarge:{min:2,max:3,default:3},large:{min:1,max:2,default:2},mobile:{min:1,max:2,default:2}},nS={xhuge:1520,huge:1140,xlarge:780,large:480,mobile:0};function sS(){const e=(0,d.useContext)(vy).containerWidth;for(const[t,n]of Object.entries(nS))if(e>=n)return t;return"mobile"}const{Badge:iS}=cj(y.privateApis);function rS({view:e,selection:t,onChangeSelection:n,onClickItem:s,isItemClickable:i,getItemId:r,item:o,actions:a,mediaField:l,titleField:c,descriptionField:u,regularFields:d,badgeFields:h,hasBulkActions:p}){const{showTitle:f=!0,showMedia:m=!0,showDescription:g=!0}=e,x=Mj(a,o),w=r(o),_=(0,v.useInstanceId)(rS),j=t.includes(w),S=l?.render?(0,oe.jsx)(l.render,{item:o}):null,C=f&&c?.render?(0,oe.jsx)(c.render,{item:o}):null,k=Xj({item:o,isItemClickable:i,onClickItem:s,className:"dataviews-view-grid__media"}),E=Xj({item:o,isItemClickable:i,onClickItem:s,className:"dataviews-view-grid__title-field dataviews-title-field"});let P,I;return i(o)&&s&&(C?(P={"aria-labelledby":`dataviews-view-grid__title-field-${_}`},I={id:`dataviews-view-grid__title-field-${_}`}):P={"aria-label":(0,b.__)("Navigate to item")}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,className:Ut("dataviews-view-grid__card",{"is-selected":x&&j}),onClickCapture:e=>{if(e.ctrlKey||e.metaKey){if(e.stopPropagation(),e.preventDefault(),!x)return;n(t.includes(w)?t.filter((e=>w!==e)):[...t,w])}},children:[m&&S&&(0,oe.jsx)("div",{...k,...P,children:S}),p&&m&&S&&(0,oe.jsx)(jj,{item:o,selection:t,onChangeSelection:n,getItemId:r,titleField:c,disabled:!x}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions",children:[(0,oe.jsx)("div",{...E,...I,children:C}),!!a?.length&&(0,oe.jsx)(Tj,{item:o,actions:a,isCompact:!0})]}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:1,children:[g&&u?.render&&(0,oe.jsx)(u.render,{item:o}),!!h?.length&&(0,oe.jsx)(y.__experimentalHStack,{className:"dataviews-view-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:h.map((e=>(0,oe.jsx)(iS,{className:"dataviews-view-grid__field-value",children:(0,oe.jsx)(e.render,{item:o})},e.id)))}),!!d?.length&&(0,oe.jsx)(y.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:1,children:d.map((e=>(0,oe.jsx)(y.Flex,{className:"dataviews-view-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.FlexItem,{className:"dataviews-view-grid__field-name",children:e.header}),(0,oe.jsx)(y.FlexItem,{className:"dataviews-view-grid__field-value",style:{maxHeight:"none"},children:(0,oe.jsx)(e.render,{item:o})})]})},e.id)))})]})]},w)}const{Menu:oS}=cj(y.privateApis);function aS(e){return`${e}-item-wrapper`}function lS(e){return`${e}-dropdown`}function cS({idPrefix:e,primaryAction:t,item:n}){const s=(0,l.useRegistry)(),[i,r]=(0,d.useState)(!1),o=function(e,t){return`${e}-primary-action-${t}`}(e,t.id),a="string"==typeof t.label?t.label:t.label([n]);return"RenderModal"in t?(0,oe.jsx)("div",{role:"gridcell",children:(0,oe.jsx)(y.Composite.Item,{id:o,render:(0,oe.jsx)(y.Button,{label:a,disabled:!!t.disabled,accessibleWhenDisabled:!0,icon:t.icon,isDestructive:t.isDestructive,size:"small",onClick:()=>r(!0)}),children:i&&(0,oe.jsx)(Pj,{action:t,items:[n],closeModal:()=>r(!1)})})},t.id):(0,oe.jsx)("div",{role:"gridcell",children:(0,oe.jsx)(y.Composite.Item,{id:o,render:(0,oe.jsx)(y.Button,{label:a,disabled:!!t.disabled,accessibleWhenDisabled:!0,icon:t.icon,isDestructive:t.isDestructive,size:"small",onClick:()=>{t.callback([n],{registry:s})}})})},t.id)}function uS({view:e,actions:t,idPrefix:n,isSelected:s,item:i,titleField:r,mediaField:o,descriptionField:a,onSelect:c,otherFields:u,onDropdownTriggerKeyDown:h}){const{showTitle:p=!0,showMedia:f=!0,showDescription:m=!0}=e,g=(0,d.useRef)(null),v=`${n}-label`,x=`${n}-description`,w=(0,l.useRegistry)(),[_,j]=(0,d.useState)(!1),[S,C]=(0,d.useState)(null),k=({type:e})=>{j("mouseenter"===e)};(0,d.useEffect)((()=>{s&&g.current?.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})}),[s]);const{primaryAction:E,eligibleActions:P}=(0,d.useMemo)((()=>{const e=t.filter((e=>!e.isEligible||e.isEligible(i)));return{primaryAction:e.filter((e=>e.isPrimary&&!!e.icon))[0],eligibleActions:e}}),[t,i]),I=E&&1===t.length,T=f&&o?.render?(0,oe.jsx)("div",{className:"dataviews-view-list__media-wrapper",children:(0,oe.jsx)(o.render,{item:i})}):null,O=p&&r?.render?(0,oe.jsx)(r.render,{item:i}):null,A=P?.length>0&&(0,oe.jsxs)(y.__experimentalHStack,{spacing:3,className:"dataviews-view-list__item-actions",children:[E&&(0,oe.jsx)(cS,{idPrefix:n,primaryAction:E,item:i}),!I&&(0,oe.jsxs)("div",{role:"gridcell",children:[(0,oe.jsxs)(oS,{placement:"bottom-end",children:[(0,oe.jsx)(oS.TriggerButton,{render:(0,oe.jsx)(y.Composite.Item,{id:lS(n),render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,onKeyDown:h})})}),(0,oe.jsx)(oS.Popover,{children:(0,oe.jsx)(Ij,{actions:P,item:i,registry:w,setActiveModalAction:C})})]}),!!S&&(0,oe.jsx)(Pj,{action:S,items:[i],closeModal:()=>C(null)})]})]});return(0,oe.jsx)(y.Composite.Row,{ref:g,render:(0,oe.jsx)("div",{}),role:"row",className:Ut({"is-selected":s,"is-hovered":_}),onMouseEnter:k,onMouseLeave:k,children:(0,oe.jsxs)(y.__experimentalHStack,{className:"dataviews-view-list__item-wrapper",spacing:0,children:[(0,oe.jsx)("div",{role:"gridcell",children:(0,oe.jsx)(y.Composite.Item,{id:aS(n),"aria-pressed":s,"aria-labelledby":v,"aria-describedby":x,className:"dataviews-view-list__item",onClick:()=>c(i)})}),(0,oe.jsxs)(y.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start",children:[T,(0,oe.jsxs)(y.__experimentalVStack,{spacing:1,className:"dataviews-view-list__field-wrapper",children:[(0,oe.jsxs)(y.__experimentalHStack,{spacing:0,children:[(0,oe.jsx)("div",{className:"dataviews-title-field",id:v,children:O}),A]}),m&&a?.render&&(0,oe.jsx)("div",{className:"dataviews-view-list__field",children:(0,oe.jsx)(a.render,{item:i})}),(0,oe.jsx)("div",{className:"dataviews-view-list__fields",id:x,children:u.map((e=>(0,oe.jsxs)("div",{className:"dataviews-view-list__field",children:[(0,oe.jsx)(y.VisuallyHidden,{as:"span",className:"dataviews-view-list__field-label",children:e.label}),(0,oe.jsx)("span",{className:"dataviews-view-list__field-value",children:(0,oe.jsx)(e.render,{item:i})})]},e.id)))})]})]})]})})}function dS(e){return!!e}const hS=[{type:oy,label:(0,b.__)("Table"),component:eS,icon:yj,viewConfigOptions:function(){const e=(0,d.useContext)(vy),t=e.view;return(0,oe.jsxs)(y.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,size:"__unstable-large",label:(0,b.__)("Density"),value:t.layout?.density||"balanced",onChange:n=>{e.onChangeView({...t,layout:{...t.layout,density:n}})},isBlock:!0,children:[(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"comfortable",label:(0,b._x)("Comfortable","Density option for DataView layout")},"comfortable"),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"balanced",label:(0,b._x)("Balanced","Density option for DataView layout")},"balanced"),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"compact",label:(0,b._x)("Compact","Density option for DataView layout")},"compact")]})}},{type:ay,label:(0,b.__)("Grid"),component:function({actions:e,data:t,fields:n,getItemId:s,isLoading:i,onChangeSelection:r,onClickItem:o,isItemClickable:a,selection:l,view:c}){var u;const h=n.find((e=>e.id===c?.titleField)),p=n.find((e=>e.id===c?.mediaField)),f=n.find((e=>e.id===c?.descriptionField)),m=null!==(u=c.fields)&&void 0!==u?u:[],{regularFields:g,badgeFields:v}=m.reduce(((e,t)=>{const s=n.find((e=>e.id===t));if(!s)return e;return e[c.layout?.badgeFields?.includes(t)?"badgeFields":"regularFields"].push(s),e}),{regularFields:[],badgeFields:[]}),x=!!t?.length,w=function(){const e=(0,d.useContext)(vy).view,t=sS();return(0,d.useMemo)((()=>{const n=e.layout?.previewSize;let s;if(!n)return;const i=tS[t];return n<i.min&&(s=i.min),n>i.max&&(s=i.max),s}),[t,e])}(),_=Vj(e,t),j=w||c.layout?.previewSize,S=j?{gridTemplateColumns:`repeat(${j}, minmax(0, 1fr))`}:{};return(0,oe.jsxs)(oe.Fragment,{children:[x&&(0,oe.jsx)(y.__experimentalGrid,{gap:8,columns:2,alignment:"top",className:"dataviews-view-grid",style:S,"aria-busy":i,children:t.map((t=>(0,oe.jsx)(rS,{view:c,selection:l,onChangeSelection:r,onClickItem:o,isItemClickable:a,getItemId:s,item:t,actions:e,mediaField:p,titleField:h,descriptionField:f,regularFields:g,badgeFields:v,hasBulkActions:_},s(t))))}),!x&&(0,oe.jsx)("div",{className:Ut({"dataviews-loading":i,"dataviews-no-results":!i}),children:(0,oe.jsx)("p",{children:i?(0,oe.jsx)(y.Spinner,{}):(0,b.__)("No results")})})]})},icon:bj,viewConfigOptions:function(){const e=sS(),t=(0,d.useContext)(vy),n=t.view,s=tS[e],i=n.layout?.previewSize||s.default,r=(0,d.useMemo)((()=>Array.from({length:s.max-s.min+1},((e,t)=>({value:s.min+t})))),[s]);return"mobile"===e?null:(0,oe.jsx)(y.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,showTooltip:!1,label:(0,b.__)("Preview size"),value:s.max+s.min-i,marks:r,min:s.min,max:s.max,withInputField:!1,onChange:(e=0)=>{t.onChangeView({...n,layout:{...n.layout,previewSize:s.max+s.min-e}})},step:1})}},{type:"list",label:(0,b.__)("List"),component:function e(t){var n;const{actions:s,data:i,fields:r,getItemId:o,isLoading:a,onChangeSelection:l,selection:c,view:u}=t,h=(0,v.useInstanceId)(e,"view-list"),p=i?.findLast((e=>c.includes(o(e)))),f=r.find((e=>e.id===u.titleField)),m=r.find((e=>e.id===u.mediaField)),g=r.find((e=>e.id===u.descriptionField)),x=(null!==(n=u?.fields)&&void 0!==n?n:[]).map((e=>r.find((t=>e===t.id)))).filter(dS),w=e=>l([o(e)]),_=(0,d.useCallback)((e=>`${h}-${o(e)}`),[h,o]),j=(0,d.useCallback)(((e,t)=>t.startsWith(_(e))),[_]),[S,C]=(0,d.useState)(void 0);(0,d.useEffect)((()=>{p&&C(aS(_(p)))}),[p,_]);const k=i.findIndex((e=>j(e,null!=S?S:""))),E=(0,v.usePrevious)(k),P=-1!==k,I=(0,d.useCallback)(((e,t)=>{const n=Math.min(i.length-1,Math.max(0,e));if(!i[n])return;const s=t(_(i[n]));C(s),document.getElementById(s)?.focus()}),[i,_]);(0,d.useEffect)((()=>{!P&&(void 0!==E&&-1!==E)&&I(E,aS)}),[P,I,E]);const T=(0,d.useCallback)((e=>{"ArrowDown"===e.key&&(e.preventDefault(),I(k+1,lS)),"ArrowUp"===e.key&&(e.preventDefault(),I(k-1,lS))}),[I,k]),O=i?.length;return O?(0,oe.jsx)(y.Composite,{id:h,render:(0,oe.jsx)("div",{}),className:"dataviews-view-list",role:"grid",activeId:S,setActiveId:C,children:i.map((e=>{const t=_(e);return(0,oe.jsx)(uS,{view:u,idPrefix:t,actions:s,item:e,isSelected:e===p,onSelect:w,mediaField:m,titleField:f,descriptionField:g,otherFields:x,onDropdownTriggerKeyDown:T},t)}))}):(0,oe.jsx)("div",{className:Ut({"dataviews-loading":a,"dataviews-no-results":!O&&!a}),children:!O&&(0,oe.jsx)("p",{children:a?(0,oe.jsx)(y.Spinner,{}):(0,b.__)("No results")})})},icon:(0,b.isRTL)()?wj:_j}];function pS(){const{actions:e=[],data:t,fields:n,getItemId:s,getItemLevel:i,isLoading:r,view:o,onChangeView:a,selection:l,onChangeSelection:c,setOpenedFilter:u,onClickItem:h,isItemClickable:p}=(0,d.useContext)(vy),f=hS.find((e=>e.type===o.type))?.component;return(0,oe.jsx)(f,{actions:e,data:t,fields:n,getItemId:s,getItemLevel:i,isLoading:r,onChangeView:a,onChangeSelection:c,selection:l,setOpenedFilter:u,onClickItem:h,isItemClickable:p,view:o})}const fS=(0,d.memo)((function(){var e;const{view:t,onChangeView:n,paginationInfo:{totalItems:s=0,totalPages:i}}=(0,d.useContext)(vy);if(!s||!i)return null;const r=null!==(e=t.page)&&void 0!==e?e:1,o=Array.from(Array(i)).map(((e,t)=>{const n=t+1;return{value:n.toString(),label:n.toString(),"aria-label":r===n?(0,b.sprintf)((0,b.__)("Page %1$s of %2$s"),r,i):n.toString()}}));return!!s&&1!==i&&(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,className:"dataviews-pagination",justify:"end",spacing:6,children:[(0,oe.jsx)(y.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"dataviews-pagination__page-select",children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b._x)("<div>Page</div>%1$s<div>of %2$s</div>","paging"),"<CurrentPage />",i),{div:(0,oe.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,oe.jsx)(y.SelectControl,{"aria-label":(0,b.__)("Current page"),value:r.toString(),options:o,onChange:e=>{n({...t,page:+e})},size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,oe.jsx)(y.Button,{onClick:()=>n({...t,page:r-1}),disabled:1===r,accessibleWhenDisabled:!0,label:(0,b.__)("Previous page"),icon:(0,b.isRTL)()?lu:cu,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,oe.jsx)(y.Button,{onClick:()=>n({...t,page:r+1}),disabled:r>=i,accessibleWhenDisabled:!0,label:(0,b.__)("Next page"),icon:(0,b.isRTL)()?cu:lu,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})})),mS=[];function gS(){const{view:e,paginationInfo:{totalItems:t=0,totalPages:n},data:s,actions:i=mS}=(0,d.useContext)(vy),r=Vj(i,s)&&[oy,ay].includes(e.type);return!t||!n||n<=1&&!r?null:!!t&&(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,justify:"end",className:"dataviews-footer",children:[r&&(0,oe.jsx)(Gj,{}),(0,oe.jsx)(fS,{})]})}const vS=(0,d.memo)((function({label:e}){const{view:t,onChangeView:n}=(0,d.useContext)(vy),[s,i,r]=(0,v.useDebouncedInput)(t.search);(0,d.useEffect)((()=>{var e;i(null!==(e=t.search)&&void 0!==e?e:"")}),[t.search,i]);const o=(0,d.useRef)(n),a=(0,d.useRef)(t);(0,d.useEffect)((()=>{o.current=n,a.current=t}),[n,t]),(0,d.useEffect)((()=>{r!==a.current?.search&&o.current({...a.current,page:1,search:r})}),[r]);const l=e||(0,b.__)("Search");return(0,oe.jsx)(y.SearchControl,{className:"dataviews-search",__nextHasNoMarginBottom:!0,onChange:i,value:s,label:l,placeholder:l,size:"compact"})})),xS=vS,yS=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z"})}),bS=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"})}),{Menu:wS}=(window.wp.warning,cj(y.privateApis)),_S={className:"dataviews-config__popover",placement:"bottom-end",offset:9};function jS({defaultLayouts:e={list:{},grid:{},table:{}}}){const{view:t,onChangeView:n}=(0,d.useContext)(vy),s=Object.keys(e);if(s.length<=1)return null;const i=hS.find((e=>t.type===e.type));return(0,oe.jsxs)(wS,{children:[(0,oe.jsx)(wS.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"compact",icon:i?.icon,label:(0,b.__)("Layout")})}),(0,oe.jsx)(wS.Popover,{children:s.map((s=>{const i=hS.find((e=>e.type===s));return i?(0,oe.jsx)(wS.RadioItem,{value:s,name:"view-actions-available-view",checked:s===t.type,hideOnClick:!0,onChange:s=>{switch(s.target.value){case"list":case"grid":case"table":const i={...t};return"layout"in i&&delete i.layout,n({...i,type:s.target.value,...e[s.target.value]})}},children:(0,oe.jsx)(wS.ItemLabel,{children:i.label})},s):null}))})]})}function SS(){const{view:e,fields:t,onChangeView:n}=(0,d.useContext)(vy),s=(0,d.useMemo)((()=>t.filter((e=>!1!==e.enableSorting)).map((e=>({label:e.label,value:e.id})))),[t]);return(0,oe.jsx)(y.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,b.__)("Sort by"),value:e.sort?.field,options:s,onChange:t=>{n({...e,sort:{direction:e?.sort?.direction||"desc",field:t},showLevels:!1})}})}function CS(){const{view:e,fields:t,onChangeView:n}=(0,d.useContext)(vy);if(0===t.filter((e=>!1!==e.enableSorting)).length)return null;let s=e.sort?.direction;return!s&&e.sort?.field&&(s="desc"),(0,oe.jsx)(y.__experimentalToggleGroupControl,{className:"dataviews-view-config__sort-direction",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,b.__)("Order"),value:s,onChange:s=>{"asc"!==s&&"desc"!==s||n({...e,sort:{direction:s,field:e.sort?.field||t.find((e=>!1!==e.enableSorting))?.id||""},showLevels:!1})},children:ty.map((e=>(0,oe.jsx)(y.__experimentalToggleGroupControlOptionIcon,{value:e,icon:ry[e],label:iy[e]},e)))})}const kS=[10,20,50,100];function ES(){const{view:e,onChangeView:t}=(0,d.useContext)(vy);return(0,oe.jsx)(y.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,b.__)("Items per page"),value:e.perPage||10,disabled:!e?.sort?.field,onChange:n=>{const s="number"==typeof n||void 0===n?n:parseInt(n,10);t({...e,perPage:s,page:1})},children:kS.map((e=>(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:e,label:e.toString()},e)))})}function PS({previewOptions:e,onChangePreviewOption:t,onMenuOpenChange:n,activeOption:s}){return(0,oe.jsxs)(wS,{onOpenChange:n,children:[(0,oe.jsx)(wS.TriggerButton,{render:(0,oe.jsx)(y.Button,{className:"dataviews-field-control__field-preview-options-button",size:"compact",icon:Ga,label:(0,b.__)("Preview")})}),(0,oe.jsx)(wS.Popover,{children:e?.map((({id:e,label:n})=>(0,oe.jsx)(wS.RadioItem,{value:e,checked:e===s,onChange:()=>{t?.(e),(e=>{setTimeout((()=>{const t=document.querySelector(`.dataviews-field-control__field-${e} .dataviews-field-control__field-preview-options-button`);t instanceof HTMLElement&&t.focus()}),50)})(e)},children:(0,oe.jsx)(wS.ItemLabel,{children:n})},e)))})]})}function IS({field:e,label:t,description:n,isVisible:s,isFirst:i,isLast:r,canMove:o=!0,onToggleVisibility:a,onMoveUp:l,onMoveDown:c,previewOptions:u,onChangePreviewOption:h}){const[p,f]=(0,d.useState)(!1);return(0,oe.jsx)(y.__experimentalItem,{children:(0,oe.jsxs)(y.__experimentalHStack,{expanded:!0,className:Ut("dataviews-field-control__field",`dataviews-field-control__field-${e.id}`,{"is-interacting":p}),justify:"flex-start",children:[(0,oe.jsx)("span",{className:"dataviews-field-control__icon",children:!o&&!e.enableHiding&&(0,oe.jsx)(y.Icon,{icon:yS})}),(0,oe.jsxs)("span",{className:"dataviews-field-control__label-sub-label-container",children:[(0,oe.jsx)("span",{className:"dataviews-field-control__label",children:t||e.label}),n&&(0,oe.jsx)("span",{className:"dataviews-field-control__sub-label",children:n})]}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-end",expanded:!1,className:"dataviews-field-control__actions",children:[s&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Button,{disabled:i||!o,accessibleWhenDisabled:!0,size:"compact",onClick:l,icon:Gv,label:i||!o?(0,b.__)("This field can't be moved up"):(0,b.sprintf)((0,b.__)("Move %s up"),e.label)}),(0,oe.jsx)(y.Button,{disabled:r||!o,accessibleWhenDisabled:!0,size:"compact",onClick:c,icon:Hv,label:r||!o?(0,b.__)("This field can't be moved down"):(0,b.sprintf)((0,b.__)("Move %s down"),e.label)})]}),a&&(0,oe.jsx)(y.Button,{className:"dataviews-field-control__field-visibility-button",disabled:!e.enableHiding,accessibleWhenDisabled:!0,size:"compact",onClick:()=>{a(),setTimeout((()=>{const t=document.querySelector(`.dataviews-field-control__field-${e.id} .dataviews-field-control__field-visibility-button`);t instanceof HTMLElement&&t.focus()}),50)},icon:s?Wj:za,label:s?(0,b.sprintf)((0,b._x)("Hide %s","field"),e.label):(0,b.sprintf)((0,b._x)("Show %s","field"),e.label)}),u&&(0,oe.jsx)(PS,{previewOptions:u,onChangePreviewOption:h,onMenuOpenChange:f,activeOption:e.id})]})]})})}function TS({index:e,field:t,view:n,onChangeView:s}){var i;const r=null!==(i=n.fields)&&void 0!==i?i:[],o=void 0!==e&&r.includes(t.id);return(0,oe.jsx)(IS,{field:t,isVisible:o,isFirst:void 0!==e&&e<1,isLast:void 0!==e&&e===r.length-1,onToggleVisibility:()=>{s({...n,fields:o?r.filter((e=>e!==t.id)):[...r,t.id]})},onMoveUp:void 0!==e?()=>{var i;s({...n,fields:[...null!==(i=r.slice(0,e-1))&&void 0!==i?i:[],t.id,r[e-1],...r.slice(e+1)]})}:void 0,onMoveDown:void 0!==e?()=>{var i;s({...n,fields:[...null!==(i=r.slice(0,e))&&void 0!==i?i:[],r[e+1],t.id,...r.slice(e+2)]})}:void 0})}function OS(e){return!!e}function AS(){var e;const{view:t,fields:n,onChangeView:s}=(0,d.useContext)(vy),i=[t?.titleField,t?.mediaField,t?.descriptionField].filter(Boolean),r=null!==(e=t.fields)&&void 0!==e?e:[],o=n.filter((e=>!r.includes(e.id)&&!i.includes(e.id)&&"media"!==e.type)),a=r.map((e=>n.find((t=>t.id===e)))).filter(OS);if(!a?.length&&!o?.length)return null;const l=n.find((e=>e.id===t.titleField)),c=n.find((e=>e.id===t.mediaField)),u=n.find((e=>e.id===t.descriptionField)),h=n.filter((e=>"media"===e.type));let p;if(h.length>1){var f;const e=OS(c)&&(null===(f=t.showMedia)||void 0===f||f);p=OS(c)&&(0,oe.jsx)(IS,{field:c,label:(0,b.__)("Preview"),description:c.label,isVisible:e,onToggleVisibility:()=>{s({...t,showMedia:!e})},canMove:!1,previewOptions:h.map((e=>({label:e.label,id:e.id}))),onChangePreviewOption:e=>s({...t,mediaField:e})},c.id)}const m=[{field:l,isVisibleFlag:"showTitle"},{field:c,isVisibleFlag:"showMedia",ui:p},{field:u,isVisibleFlag:"showDescription"}].filter((({field:e})=>OS(e))),g=m.filter((({field:e,isVisibleFlag:n})=>{var s;return OS(e)&&(null===(s=t[n])||void 0===s||s)})),v=m.filter((({field:e,isVisibleFlag:n})=>{var s;return OS(e)&&!(null===(s=t[n])||void 0===s||s)}));return(0,oe.jsxs)(y.__experimentalVStack,{className:"dataviews-field-control",spacing:6,children:[(0,oe.jsx)(y.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(g.length>0||!!a?.length)&&(0,oe.jsxs)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[g.map((({field:e,isVisibleFlag:n,ui:i})=>null!=i?i:(0,oe.jsx)(IS,{field:e,isVisible:!0,onToggleVisibility:()=>{s({...t,[n]:!1})},canMove:!1},e.id))),a.map(((e,n)=>(0,oe.jsx)(TS,{field:e,view:t,onChangeView:s,index:n},e.id)))]})}),(!!o?.length||!!v.length)&&(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(y.BaseControl.VisualLabel,{style:{margin:0},children:(0,b.__)("Hidden")}),(0,oe.jsx)(y.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(0,oe.jsxs)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[v.length>0&&v.map((({field:e,isVisibleFlag:n,ui:i})=>null!=i?i:(0,oe.jsx)(IS,{field:e,isVisible:!1,onToggleVisibility:()=>{s({...t,[n]:!0})},canMove:!1},e.id))),o.map((e=>(0,oe.jsx)(TS,{field:e,view:t,onChangeView:s},e.id)))]})})]})]})}function NS({title:e,description:t,children:n}){return(0,oe.jsxs)(y.__experimentalGrid,{columns:12,className:"dataviews-settings-section",gap:4,children:[(0,oe.jsxs)("div",{className:"dataviews-settings-section__sidebar",children:[(0,oe.jsx)(y.__experimentalHeading,{level:2,className:"dataviews-settings-section__title",children:e}),t&&(0,oe.jsx)(y.__experimentalText,{variant:"muted",className:"dataviews-settings-section__description",children:t})]}),(0,oe.jsx)(y.__experimentalGrid,{columns:8,gap:4,className:"dataviews-settings-section__content",children:n})]})}function MS(){const{view:e}=(0,d.useContext)(vy),t=(0,v.useInstanceId)(VS,"dataviews-view-config-dropdown"),n=hS.find((t=>t.type===e.type));return(0,oe.jsx)(y.Dropdown,{expandOnMobile:!0,popoverProps:{..._S,id:t},renderToggle:({onToggle:e,isOpen:n})=>(0,oe.jsx)(y.Button,{size:"compact",icon:bS,label:(0,b._x)("View options","View is used as a noun"),onClick:e,"aria-expanded":n?"true":"false","aria-controls":t}),renderContent:()=>(0,oe.jsx)(y.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"dataviews-config__popover-content-wrapper",children:(0,oe.jsxs)(y.__experimentalVStack,{className:"dataviews-view-config",spacing:6,children:[(0,oe.jsxs)(NS,{title:(0,b.__)("Appearance"),children:[(0,oe.jsxs)(y.__experimentalHStack,{expanded:!0,className:"is-divided-in-two",children:[(0,oe.jsx)(SS,{}),(0,oe.jsx)(CS,{})]}),!!n?.viewConfigOptions&&(0,oe.jsx)(n.viewConfigOptions,{}),(0,oe.jsx)(ES,{})]}),(0,oe.jsx)(NS,{title:(0,b.__)("Properties"),children:(0,oe.jsx)(AS,{})})]})})})}function VS({defaultLayouts:e={list:{},grid:{},table:{}}}){return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(jS,{defaultLayouts:e}),(0,oe.jsx)(MS,{})]})}const FS=(0,d.memo)(VS),RS=e=>e.id,BS=()=>!0,DS=[];function LS({view:e,onChangeView:t,fields:n,search:s=!0,searchLabel:i,actions:r=DS,data:o,getItemId:a=RS,getItemLevel:l,isLoading:c=!1,paginationInfo:u,defaultLayouts:h,selection:p,onChangeSelection:f,onClickItem:m,isItemClickable:g=BS,header:x}){const[b,w]=(0,d.useState)(0),_=(0,v.useResizeObserver)((e=>{w(e[0].borderBoxSize[0].inlineSize)}),{box:"border-box"}),[j,S]=(0,d.useState)([]),C=void 0===p||void 0===f,k=C?j:p,[E,P]=(0,d.useState)(null);const I=(0,d.useMemo)((()=>py(n)),[n]),T=(0,d.useMemo)((()=>k.filter((e=>o.some((t=>a(t)===e))))),[k,o,a]),O=mj(I,e),[A,N]=(0,d.useState)((()=>(O||[]).some((e=>e.isPrimary))));return(0,oe.jsx)(vy.Provider,{value:{view:e,onChangeView:t,fields:I,actions:r,data:o,isLoading:c,paginationInfo:u,selection:T,onChangeSelection:function(e){const t="function"==typeof e?e(k):e;C&&S(t),f&&f(t)},openedFilter:E,setOpenedFilter:P,getItemId:a,getItemLevel:l,isItemClickable:g,onClickItem:m,containerWidth:b},children:(0,oe.jsxs)("div",{className:"dataviews-wrapper",ref:_,children:[(0,oe.jsxs)(y.__experimentalHStack,{alignment:"top",justify:"space-between",className:"dataviews__view-actions",spacing:1,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"start",expanded:!1,className:"dataviews__search",children:[s&&(0,oe.jsx)(xS,{label:i}),(0,oe.jsx)(gj,{filters:O,view:e,onChangeView:t,setOpenedFilter:P,setIsShowingFilter:N,isShowingFilter:A})]}),(0,oe.jsxs)(y.__experimentalHStack,{spacing:1,expanded:!1,style:{flexShrink:0},children:[(0,oe.jsx)(FS,{defaultLayouts:h}),x]})]}),A&&(0,oe.jsx)(xj,{}),(0,oe.jsx)(pS,{}),(0,oe.jsx)(gS,{})]})})}function zS(){var e;const t=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt));return t()}),[]),n=null!==(e=t.__experimentalAdditionalBlockPatterns)&&void 0!==e?e:t.__experimentalBlockPatterns,s=(0,l.useSelect)((e=>e(_.store).getBlockPatterns()),[]),i=(0,d.useMemo)((()=>[...n||[],...s||[]].filter(wx)),[n,s]);return(0,d.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:e,...n}=t;return{...n,__experimentalBlockPatterns:i,isPreviewMode:!0}}),[t,i])}const GS=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})}),HS=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})}),{useHistory:US,useLocation:WS}=te(Gt.privateApis),{CreatePatternModal:qS,useAddPatternCategory:ZS}=te(_e.privateApis),{CreateTemplatePartModal:KS}=te(h.privateApis);function YS(){const e=US(),t=WS(),[n,s]=(0,d.useState)(!1),[i,r]=(0,d.useState)(!1),{createPatternFromFile:o}=te((0,l.useDispatch)(_e.store)),{createSuccessNotice:a,createErrorNotice:c}=(0,l.useDispatch)(w.store),u=(0,d.useRef)(),{isBlockBasedTheme:h,addNewPatternLabel:p,addNewTemplatePartLabel:f,canCreatePattern:m,canCreateTemplatePart:g}=(0,l.useSelect)((e=>{const{getCurrentTheme:t,getPostType:n,canUser:s}=e(_.store);return{isBlockBasedTheme:t()?.is_block_theme,addNewPatternLabel:n(Ie.user)?.labels?.add_new_item,addNewTemplatePartLabel:n(Ce)?.labels?.add_new_item,canCreatePattern:s("create",{kind:"postType",name:Ie.user}),canCreateTemplatePart:s("create",{kind:"postType",name:Ce})}}),[]);function v(){s(!1),r(!1)}const x=[];m&&x.push({icon:Ko,onClick:()=>s(!0),title:p}),h&&g&&x.push({icon:GS,onClick:()=>r(!0),title:f}),m&&x.push({icon:HS,onClick:()=>{u.current.click()},title:(0,b.__)("Import pattern from JSON")});const{categoryMap:j,findOrCreateTerm:S}=ZS();return 0===x.length?null:(0,oe.jsxs)(oe.Fragment,{children:[p&&(0,oe.jsx)(y.DropdownMenu,{controls:x,icon:null,toggleProps:{variant:"primary",showTooltip:!1,__next40pxDefaultSize:!0},text:p,label:p}),n&&(0,oe.jsx)(qS,{onClose:()=>s(!1),onSuccess:function({pattern:t}){s(!1),e.navigate(`/${Ie.user}/${t.id}?canvas=edit`)},onError:v}),i&&(0,oe.jsx)(KS,{closeModal:()=>r(!1),blocks:[],onCreate:function(t){r(!1),e.navigate(`/${Ce}/${t.id}?canvas=edit`)},onError:v}),(0,oe.jsx)("input",{type:"file",accept:".json",hidden:!0,ref:u,onChange:async n=>{const s=n.target.files?.[0];if(s)try{let n;if(t.query.postType!==Ce){const e=Array.from(j.values()).find((e=>e.name===t.query.categoryId));e&&(n=e.id||await S(e.label))}const i=await o(s,n?[n]:void 0);n||"my-patterns"===t.query.categoryId||e.navigate(`/pattern?categoryId=${Te}`),a((0,b.sprintf)((0,b.__)('Imported "%s" from JSON.'),i.title.raw),{type:"snackbar",id:"import-pattern-success"})}catch(e){c(e.message,{type:"snackbar",id:"import-pattern-error"})}finally{n.target.value=""}}})]})}const{RenamePatternCategoryModal:XS}=te(_e.privateApis);function JS({category:e,onClose:t}){const[n,s]=(0,d.useState)(!1);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.MenuItem,{onClick:()=>s(!0),children:(0,b.__)("Rename")}),n&&(0,oe.jsx)(QS,{category:e,onClose:()=>{s(!1),t()}})]})}function QS({category:e,onClose:t}){const n={id:e.id,slug:e.slug,name:e.label},s=Bx();return(0,oe.jsx)(XS,{category:n,existingCategories:s,onClose:t,overlayClassName:"edit-site-list__rename-modal",focusOnMount:"firstContentElement",size:"small"})}const{useHistory:$S}=te(Gt.privateApis);function eC({category:e,onClose:t}){const[n,s]=(0,d.useState)(!1),i=$S(),{createSuccessNotice:r,createErrorNotice:o}=(0,l.useDispatch)(w.store),{deleteEntityRecord:a,invalidateResolution:c}=(0,l.useDispatch)(_.store);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.MenuItem,{isDestructive:!0,onClick:()=>s(!0),children:(0,b.__)("Delete")}),(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:n,onConfirm:async()=>{try{await a("taxonomy","wp_pattern_category",e.id,{force:!0},{throwOnError:!0}),c("getUserPatternCategories"),c("getEntityRecords",["postType",Ie.user,{per_page:-1}]),r((0,b.sprintf)((0,b._x)('"%s" deleted.',"pattern category"),e.label),{type:"snackbar",id:"pattern-category-delete"}),t?.(),i.navigate(`/pattern?categoryId=${Te}`)}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while deleting the pattern category.");o(t,{type:"snackbar",id:"pattern-category-delete"})}},onCancel:()=>s(!1),confirmButtonText:(0,b.__)("Delete"),className:"edit-site-patterns__delete-modal",title:(0,b.sprintf)((0,b._x)('Delete "%s"?',"pattern category"),(0,Kt.decodeEntities)(e.label)),size:"medium",__experimentalHideHeader:!1,children:(0,b.sprintf)((0,b.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'),(0,Kt.decodeEntities)(e.label))})]})}function tC({categoryId:e,type:t,titleId:n,descriptionId:s}){const{patternCategories:i}=Bx(),r=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.default_template_part_areas||[]),[]);let o,a,c;if(t===Ce){const t=r.find((t=>t.area===e));o=t?.label||(0,b.__)("All Template Parts"),a=t?.description||(0,b.__)("Includes every template part defined for any area.")}else t===Ie.user&&e&&(c=i.find((t=>t.name===e)),o=c?.label,a=c?.description);return o?(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-patterns__section-header",spacing:1,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",className:"edit-site-patterns__title",children:[(0,oe.jsx)(y.__experimentalHeading,{as:"h2",level:3,id:n,weight:500,truncate:!0,children:o}),(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,children:[(0,oe.jsx)(YS,{}),!!c?.id&&(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("Actions"),toggleProps:{className:"edit-site-patterns__button",description:(0,b.sprintf)((0,b.__)("Action menu for %s pattern category"),o),size:"compact"},children:({onClose:e})=>(0,oe.jsxs)(y.MenuGroup,{children:[(0,oe.jsx)(JS,{category:c,onClose:e}),(0,oe.jsx)(eC,{category:c,onClose:e})]})})]})]}),a?(0,oe.jsx)(y.__experimentalText,{variant:"muted",as:"p",id:s,className:"edit-site-patterns__sub-title",children:a}):null]}):null}const nC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})}),{useHistory:sC}=te(Gt.privateApis),iC=()=>{const e=sC();return(0,d.useMemo)((()=>({id:"edit-post",label:(0,b.__)("Edit"),isPrimary:!0,icon:nC,isEligible:e=>"trash"!==e.status&&e.type!==Ie.theme,callback(t){const n=t[0];e.navigate(`/${n.type}/${n.id}?canvas=edit`)}})),[e])},rC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"})}),oC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"})}),aC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",d:"M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",clipRule:"evenodd"})});function lC(e,t){return(0,l.useSelect)((n=>{const{getEntityRecord:s,getMedia:i,getUser:r,getEditedEntityRecord:o}=n(_.store),a=o("postType",e,t),l=a?.original_source,c=a?.author_text;switch(l){case"theme":return{type:l,icon:Zo,text:c,isCustomized:a.source===ke};case"plugin":return{type:l,icon:rC,text:c,isCustomized:a.source===ke};case"site":{const e=s("root","__unstableBase");return{type:l,icon:oC,imageUrl:e?.site_logo?i(e.site_logo)?.source_url:void 0,text:c,isCustomized:!1}}default:{const e=r(a.author);return{type:"user",icon:aC,imageUrl:e?.avatar_urls?.[48],text:c,isCustomized:!1}}}}),[e,t])}const{useGlobalStyle:cC}=te(x.privateApis);const uC={label:(0,b.__)("Preview"),id:"preview",render:function({item:e}){const t=(0,d.useId)(),n=e.description||e?.excerpt?.raw,s=e.type===Ce,[i]=cC("color.background"),r=(0,d.useMemo)((()=>{var t;return null!==(t=e.blocks)&&void 0!==t?t:(0,o.parse)(e.content.raw,{__unstableSkipMigrationLogs:!0})}),[e?.content?.raw,e.blocks]),a=!r?.length;return(0,oe.jsxs)("div",{className:"page-patterns-preview-field",style:{backgroundColor:i},"aria-describedby":n?t:void 0,children:[a&&s&&(0,b.__)("Empty template part"),a&&!s&&(0,b.__)("Empty pattern"),!a&&(0,oe.jsx)(x.BlockPreview.Async,{children:(0,oe.jsx)(x.BlockPreview,{blocks:r,viewportWidth:e.viewportWidth})}),!!n&&(0,oe.jsx)("div",{hidden:!0,id:t,children:n})]})},enableSorting:!1},dC=[{value:Ne.full,label:(0,b._x)("Synced","pattern (singular)"),description:(0,b.__)("Patterns that are kept in sync across the site.")},{value:Ne.unsynced,label:(0,b._x)("Not synced","pattern (singular)"),description:(0,b.__)("Patterns that can be changed freely without affecting the site.")}],hC={label:(0,b.__)("Sync status"),id:"sync-status",render:({item:e})=>{const t="wp_pattern_sync_status"in e?e.wp_pattern_sync_status||Ne.full:Ne.unsynced;return(0,oe.jsx)("span",{className:`edit-site-patterns__field-sync-status-${t}`,children:dC.find((({value:e})=>e===t)).label})},elements:dC,filterBy:{operators:["is"],isPrimary:!0},enableSorting:!1};const pC={label:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:function({item:e}){const[t,n]=(0,d.useState)(!1),{text:s,icon:i,imageUrl:r}=lC(e.type,e.id);return(0,oe.jsxs)(y.__experimentalHStack,{alignment:"left",spacing:0,children:[r&&(0,oe.jsx)("div",{className:Ut("page-templates-author-field__avatar",{"is-loaded":t}),children:(0,oe.jsx)("img",{onLoad:()=>n(!0),alt:"",src:r})}),!r&&(0,oe.jsx)("div",{className:"page-templates-author-field__icon",children:(0,oe.jsx)(ta,{icon:i})}),(0,oe.jsx)("span",{className:"page-templates-author-field__name",children:s})]})},filterBy:{isPrimary:!0}},{ExperimentalBlockEditorProvider:fC}=te(x.privateApis),{usePostActions:mC,patternTitleField:gC}=te(h.privateApis),{useLocation:vC,useHistory:xC}=te(Gt.privateApis),yC=[],bC={[Re]:{layout:{styles:{author:{width:"1%"}}}},[Fe]:{layout:{badgeFields:["sync-status"]}}},wC={type:Fe,search:"",page:1,perPage:20,titleField:"title",mediaField:"preview",fields:["sync-status"],filters:[],...bC[Fe]};function _C(){const{query:{postType:e="wp_block",categoryId:t}}=vC(),n=xC(),s=t||Te,[i,r]=(0,d.useState)(wC),o=(0,v.usePrevious)(s),a=(0,v.usePrevious)(e),c=i.filters?.find((({field:e})=>"sync-status"===e))?.value,{patterns:u,isResolving:h}=Rx(e,s,{search:i.search,syncStatus:c}),{records:p}=(0,_.useEntityRecords)("postType",Ce,{per_page:-1}),f=(0,d.useMemo)((()=>{if(!p)return yC;const e=new Set;return p.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[p]),m=(0,d.useMemo)((()=>{const t=[uC,gC];return e===Ie.user?t.push(hC):e===Ce&&t.push({...pC,elements:f}),t}),[e,f]);(0,d.useEffect)((()=>{o===s&&a===e||r((e=>({...e,page:1})))}),[s,o,a,e]);const{data:g,paginationInfo:x}=(0,d.useMemo)((()=>{const t={...i};return delete t.search,e!==Ce&&(t.filters=[]),gy(u,t,m)}),[u,i,m,e]),y=function(e){const t=(0,d.useMemo)((()=>{var t;return null!==(t=e?.filter((e=>e.type!==Ie.theme)).map((e=>[e.type,e.id])))&&void 0!==t?t:[]}),[e]),n=(0,l.useSelect)((e=>{const{getEntityRecordPermissions:n}=te(e(_.store));return t.reduce(((e,[t,s])=>(e[s]=n("postType",t,s),e)),{})}),[t]);return(0,d.useMemo)((()=>{var t;return null!==(t=e?.map((e=>{var t;return{...e,permissions:null!==(t=n?.[e.id])&&void 0!==t?t:{}}})))&&void 0!==t?t:[]}),[e,n])}(g),w=mC({postType:Ce,context:"list"}),j=mC({postType:Ie.user,context:"list"}),S=iC(),C=(0,d.useMemo)((()=>e===Ce?[S,...w].filter(Boolean):[S,...j].filter(Boolean)),[S,e,w,j]),k=(0,d.useId)(),E=zS();return(0,oe.jsx)(fC,{settings:E,children:(0,oe.jsxs)(eg,{title:(0,b.__)("Patterns content"),className:"edit-site-page-patterns-dataviews",hideTitleFromUI:!0,children:[(0,oe.jsx)(tC,{categoryId:s,type:e,titleId:`${k}-title`,descriptionId:`${k}-description`}),(0,oe.jsx)(LS,{paginationInfo:x,fields:m,actions:C,data:y||yC,getItemId:e=>{var t;return null!==(t=e.name)&&void 0!==t?t:e.id},isLoading:h,isItemClickable:e=>e.type!==Ie.theme,onClickItem:e=>{n.navigate(`/${e.type}/${[Ie.user,Ce].includes(e.type)?e.id:e.name}?canvas=edit`)},view:i,onChangeView:r,defaultLayouts:bC},s+e)]})})}const jC={name:"patterns",path:"/pattern",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme,n=t||Ov(e)?"/":void 0;return(0,oe.jsx)(Gx,{backPath:n})},content:(0,oe.jsx)(_C,{}),mobile({siteData:e,query:t}){const{categoryId:n}=t,s=e.currentTheme?.is_block_theme,i=s||Ov(e)?"/":void 0;return n?(0,oe.jsx)(_C,{}):(0,oe.jsx)(Gx,{backPath:i})}}},SC={name:"pattern-item",path:"/wp_block/:postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme,n=t||Ov(e)?"/":void 0;return(0,oe.jsx)(Gx,{backPath:n})},mobile:(0,oe.jsx)(Tv,{}),preview:(0,oe.jsx)(Tv,{})}},CC={name:"template-part-item",path:"/wp_template_part/*postId",areas:{sidebar:(0,oe.jsx)(Gx,{backPath:"/"}),mobile:(0,oe.jsx)(Tv,{}),preview:(0,oe.jsx)(Tv,{})}},{useLocation:kC}=te(Gt.privateApis),EC=[];function PC({template:e,isActive:t}){const{text:n,icon:s}=lC(e.type,e.id);return(0,oe.jsx)(oa,{to:(0,Qt.addQueryArgs)("/template",{activeView:n}),icon:s,"aria-current":t,children:n})}function IC(){const{query:{activeView:e="all"}}=kC(),{records:t}=(0,_.useEntityRecords)("postType",Se,{per_page:-1}),n=(0,d.useMemo)((()=>{var e;const n=t?.reduce(((e,t)=>{const n=t.author_text;return n&&!e[n]&&(e[n]=t),e}),{});return null!==(e=n&&Object.values(n))&&void 0!==e?e:EC}),[t]);return(0,oe.jsxs)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-templates-browse",children:[(0,oe.jsx)(oa,{to:"/template",icon:Zo,"aria-current":"all"===e,children:(0,b.__)("All templates")}),n.map((t=>(0,oe.jsx)(PC,{template:t,isActive:e===t.author_text},t.author_text)))]})}function TC({backPath:e}){return(0,oe.jsx)(ea,{title:(0,b.__)("Templates"),description:(0,b.__)("Create new templates, or reset any customizations made to the templates supplied by your theme."),backPath:e,content:(0,oe.jsx)(IC,{})})}const OC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})}),AC=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"})}),NC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"})}),MC=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z"})}),VC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z"})}),FC=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})}),RC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",d:"M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z",clipRule:"evenodd"})}),BC=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"})}),DC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),LC=(0,oe.jsxs)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,oe.jsx)(Yt.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"})]}),zC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"})}),GC={},HC=(e,t)=>{let n=e;return t.split(".").forEach((e=>{n=n?.[e]})),n},UC=()=>(0,l.useSelect)((e=>e(_.store).getEntityRecords("postType",Se,{per_page:-1})),[]),WC=()=>(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.default_template_types||[]),[]),qC=()=>{const e=(0,l.useSelect)((e=>e(_.store).getPostTypes({per_page:-1})),[]);return(0,d.useMemo)((()=>{const t=["attachment"];return e?.filter((({viewable:e,slug:n})=>e&&!t.includes(n)))}),[e])};function ZC(){const e=qC(),t=(0,d.useMemo)((()=>e?.filter((e=>e.has_archive))),[e]),n=UC(),s=(0,d.useMemo)((()=>e?.reduce(((e,{labels:t})=>{const n=t.singular_name.toLowerCase();return e[n]=(e[n]||0)+1,e}),{})),[e]),i=(0,d.useCallback)((({labels:e,slug:t})=>{const n=e.singular_name.toLowerCase();return s[n]>1&&n!==t}),[s]);return(0,d.useMemo)((()=>t?.filter((e=>!(n||[]).some((t=>t.slug==="archive-"+e.slug)))).map((e=>{let t;return t=i(e)?(0,b.sprintf)((0,b.__)("Archive: %1$s (%2$s)"),e.labels.singular_name,e.slug):(0,b.sprintf)((0,b.__)("Archive: %s"),e.labels.singular_name),{slug:"archive-"+e.slug,description:(0,b.sprintf)((0,b.__)("Displays an archive with the latest posts of type: %s."),e.labels.singular_name),title:t,icon:"string"==typeof e.icon&&e.icon.startsWith("dashicons-")?e.icon.slice(10):MC,templatePrefix:"archive"}}))||[]),[t,n,i])}const KC=e=>{const t=(()=>{const e=(0,l.useSelect)((e=>e(_.store).getTaxonomies({per_page:-1})),[]);return(0,d.useMemo)((()=>e?.filter((({visibility:e})=>e?.publicly_queryable))),[e])})(),n=UC(),s=WC(),i=(0,d.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return["category","post_tag"].includes(t)||(n=`taxonomy-${n}`),"post_tag"===t&&(n="tag"),e[t]=n,e}),{})),[t]),r=t?.reduce(((e,{labels:t})=>{const n=(t.template_name||t.singular_name).toLowerCase();return e[n]=(e[n]||0)+1,e}),{}),o=QC("taxonomy",i),a=(n||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,n)=>{const{slug:l,labels:c}=n,u=i[l],d=s?.find((({slug:e})=>e===u)),h=a?.includes(u),p=((e,t)=>{if(["category","post_tag"].includes(t))return!1;const n=(e.template_name||e.singular_name).toLowerCase();return r[n]>1&&n!==t})(c,l);let f=c.template_name||c.singular_name;p&&(f=c.template_name?(0,b.sprintf)((0,b._x)("%1$s (%2$s)","taxonomy template menu label"),c.template_name,l):(0,b.sprintf)((0,b._x)("%1$s (%2$s)","taxonomy menu label"),c.singular_name,l));const m=d?{...d,templatePrefix:i[l]}:{slug:u,title:f,description:(0,b.sprintf)((0,b.__)("Displays taxonomy: %s."),c.singular_name),icon:RC,templatePrefix:i[l]},g=o?.[l]?.hasEntities;return g&&(m.onClick=t=>{e({type:"taxonomy",slug:l,config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"count",exclude:o[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${i[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:i[l]}}},labels:c,hasGeneralTemplate:h,template:t})}),h&&!g||t.push(m),t}),[]);return(0,d.useMemo)((()=>c.reduce(((e,t)=>{const{slug:n}=t;let s="taxonomiesMenuItems";return["category","tag"].includes(n)&&(s="defaultTaxonomiesMenuItems"),e[s].push(t),e}),{defaultTaxonomiesMenuItems:[],taxonomiesMenuItems:[]})),[c])},YC={user:"author"},XC={user:{who:"authors"}};const JC=(e,t,n={})=>{const s=(e=>{const t=UC();return(0,d.useMemo)((()=>Object.entries(e||{}).reduce(((e,[n,s])=>{const i=(t||[]).reduce(((e,t)=>{const n=`${s}-`;return t.slug.startsWith(n)&&e.push(t.slug.substring(n.length)),e}),[]);return i.length&&(e[n]=i),e}),{})),[e,t])})(t);return(0,l.useSelect)((t=>Object.entries(s||{}).reduce(((s,[i,r])=>{const o=t(_.store).getEntityRecords(e,i,{_fields:"id",context:"view",slug:r,...n[i]});return o?.length&&(s[i]=o),s}),{})),[s])},QC=(e,t,n=GC)=>{const s=JC(e,t,n),i=(0,l.useSelect)((i=>Object.keys(t||{}).reduce(((t,r)=>{const o=s?.[r]?.map((({id:e})=>e))||[];return t[r]=!!i(_.store).getEntityRecords(e,r,{per_page:1,_fields:"id",context:"view",exclude:o,...n[r]})?.length,t}),{})),[t,s,e,n]);return(0,d.useMemo)((()=>Object.keys(t||{}).reduce(((e,t)=>{const n=s?.[t]?.map((({id:e})=>e))||[];return e[t]={hasEntities:i[t],existingEntitiesIds:n},e}),{})),[t,s,i])},$C=[];function ek({suggestion:e,search:t,onSelect:n,entityForSuggestions:s}){const i="edit-site-custom-template-modal__suggestions_list__list-item";return(0,oe.jsxs)(y.Composite.Item,{render:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,role:"option",className:i,onClick:()=>n(s.config.getSpecificTemplate(e))}),children:[(0,oe.jsx)(y.__experimentalText,{size:"body",lineHeight:1.53846153846,weight:500,className:`${i}__title`,children:(0,oe.jsx)(y.TextHighlight,{text:(0,Kt.decodeEntities)(e.name),highlight:t})}),e.link&&(0,oe.jsx)(y.__experimentalText,{size:"body",lineHeight:1.53846153846,className:`${i}__info`,children:e.link})]})}function tk(e,t){const{config:n}=e,s=(0,d.useMemo)((()=>({order:"asc",context:"view",search:t,per_page:t?20:10,...n.queryArgs(t)})),[t,n]),{records:i,hasResolved:r}=(0,_.useEntityRecords)(e.type,e.slug,s),[o,a]=(0,d.useState)($C);return(0,d.useEffect)((()=>{if(!r)return;let e=$C;var t,s;i?.length&&(e=i,n.recordNamePath&&(t=e,s=n.recordNamePath,e=(t||[]).map((e=>({...e,name:(0,Kt.decodeEntities)(HC(e,s))}))))),a(e)}),[i,r]),o}function nk({entityForSuggestions:e,onSelect:t}){const[n,s,i]=(0,v.useDebouncedInput)(),r=tk(e,i),{labels:o}=e,[a,l]=(0,d.useState)(!1);return!a&&r?.length>9&&l(!0),(0,oe.jsxs)(oe.Fragment,{children:[a&&(0,oe.jsx)(y.SearchControl,{__nextHasNoMarginBottom:!0,onChange:s,value:n,label:o.search_items,placeholder:o.search_items}),!!r?.length&&(0,oe.jsx)(y.Composite,{orientation:"vertical",role:"listbox",className:"edit-site-custom-template-modal__suggestions_list","aria-label":(0,b.__)("Suggestions list"),children:r.map((n=>(0,oe.jsx)(ek,{suggestion:n,search:i,onSelect:t,entityForSuggestions:e},n.slug)))}),i&&!r?.length&&(0,oe.jsx)(y.__experimentalText,{as:"p",className:"edit-site-custom-template-modal__no-results",children:o.not_found})]})}const sk=function({onSelect:e,entityForSuggestions:t}){const[n,s]=(0,d.useState)(t.hasGeneralTemplate);return(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,className:"edit-site-custom-template-modal__contents-wrapper",alignment:"left",children:[!n&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalText,{as:"p",children:(0,b.__)("Select whether to create a single template for all items or a specific one.")}),(0,oe.jsxs)(y.Flex,{className:"edit-site-custom-template-modal__contents",gap:"4",align:"initial",children:[(0,oe.jsxs)(y.FlexItem,{isBlock:!0,as:y.Button,onClick:()=>{const{slug:n,title:s,description:i,templatePrefix:r}=t.template;e({slug:n,title:s,description:i,templatePrefix:r})},children:[(0,oe.jsx)(y.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.all_items}),(0,oe.jsx)(y.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,b.__)("For all items")})]}),(0,oe.jsxs)(y.FlexItem,{isBlock:!0,as:y.Button,onClick:()=>{s(!0)},children:[(0,oe.jsx)(y.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.singular_name}),(0,oe.jsx)(y.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,b.__)("For a specific item")})]})]})]}),n&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalText,{as:"p",children:(0,b.__)("This template will be used only for the specific item chosen.")}),(0,oe.jsx)(nk,{entityForSuggestions:t,onSelect:e})]})]})};var ik=function(){return ik=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ik.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function rk(e){return e.toLowerCase()}var ok=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],ak=/[^A-Z0-9]+/gi;function lk(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function ck(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,s=void 0===n?ok:n,i=t.stripRegexp,r=void 0===i?ak:i,o=t.transform,a=void 0===o?rk:o,l=t.delimiter,c=void 0===l?" ":l,u=lk(lk(e,s,"$1\0$2"),r,"\0"),d=0,h=u.length;"\0"===u.charAt(d);)d++;for(;"\0"===u.charAt(h-1);)h--;return u.slice(d,h).split("\0").map(a).join(c)}(e,ik({delimiter:"."},t))}const uk=function({onClose:e,createTemplate:t}){const[n,s]=(0,d.useState)(""),i=(0,b.__)("Custom Template"),[r,o]=(0,d.useState)(!1);return(0,oe.jsx)("form",{onSubmit:async function(e){if(e.preventDefault(),!r){o(!0);try{await t({slug:"wp-custom-template-"+(s=n||i,void 0===a&&(a={}),ck(s,ik({delimiter:"-"},a))),title:n||i},!1)}finally{o(!1)}var s,a}},children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:6,children:[(0,oe.jsx)(y.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:n,onChange:s,placeholder:i,disabled:r,help:(0,b.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')}),(0,oe.jsxs)(y.__experimentalHStack,{className:"edit-site-custom-generic-template__modal-actions",justify:"right",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{e()},children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:r,"aria-disabled":r,children:(0,b.__)("Create")})]})]})})},{useHistory:dk}=te(Gt.privateApis),hk=["front-page","home","single","page","index","archive","author","category","date","tag","search","404"],pk={"front-page":OC,home:AC,single:NC,page:qo,archive:MC,search:Xt,404:VC,index:FC,category:bj,author:aC,taxonomy:RC,date:BC,tag:DC,attachment:LC};function fk({title:e,direction:t,className:n,description:s,icon:i,onClick:r,children:o}){return(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,className:n,onClick:r,label:s,showTooltip:!!s,children:(0,oe.jsxs)(y.Flex,{as:"span",spacing:2,align:"center",justify:"center",style:{width:"100%"},direction:t,children:[(0,oe.jsx)("div",{className:"edit-site-add-new-template__template-icon",children:(0,oe.jsx)(y.Icon,{icon:i})}),(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-add-new-template__template-name",alignment:"center",spacing:0,children:[(0,oe.jsx)(y.__experimentalText,{align:"center",weight:500,lineHeight:1.53846153846,children:e}),o]})]})})}const mk=1,gk=2,vk=3;function xk({onClose:e}){const[t,n]=(0,d.useState)(mk),[s,i]=(0,d.useState)({}),[r,o]=(0,d.useState)(!1),a=function(e,t){const n=UC(),s=WC(),i=(n||[]).map((({slug:e})=>e)),r=(s||[]).filter((e=>hk.includes(e.slug)&&!i.includes(e.slug))),o=n=>{t?.(),e(n)},a=[...r],{defaultTaxonomiesMenuItems:l,taxonomiesMenuItems:c}=KC(o),{defaultPostTypesMenuItems:u,postTypesMenuItems:h}=(e=>{const t=qC(),n=UC(),s=WC(),i=(0,d.useMemo)((()=>t?.reduce(((e,{labels:t})=>{const n=(t.template_name||t.singular_name).toLowerCase();return e[n]=(e[n]||0)+1,e}),{})),[t]),r=(0,d.useCallback)((({labels:e,slug:t})=>{const n=(e.template_name||e.singular_name).toLowerCase();return i[n]>1&&n!==t}),[i]),o=(0,d.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return"page"!==t&&(n=`single-${n}`),e[t]=n,e}),{})),[t]),a=QC("postType",o),l=(n||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,n)=>{const{slug:i,labels:c,icon:u}=n,d=o[i],h=s?.find((({slug:e})=>e===d)),p=l?.includes(d),f=r(n);let m=c.template_name||(0,b.sprintf)((0,b.__)("Single item: %s"),c.singular_name);f&&(m=c.template_name?(0,b.sprintf)((0,b._x)("%1$s (%2$s)","post type menu label"),c.template_name,i):(0,b.sprintf)((0,b._x)("Single item: %1$s (%2$s)","post type menu label"),c.singular_name,i));const g=h?{...h,templatePrefix:o[i]}:{slug:d,title:m,description:(0,b.sprintf)((0,b.__)("Displays a single item: %s."),c.singular_name),icon:"string"==typeof u&&u.startsWith("dashicons-")?u.slice(10):zC,templatePrefix:o[i]},v=a?.[i]?.hasEntities;return v&&(g.onClick=t=>{e({type:"postType",slug:i,config:{recordNamePath:"title.rendered",queryArgs:({search:e})=>({_fields:"id,title,slug,link",orderBy:e?"relevance":"modified",exclude:a[i].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${o[i]}-${e.slug}`;return{title:t,slug:t,templatePrefix:o[i]}}},labels:c,hasGeneralTemplate:p,template:t})}),p&&!v||t.push(g),t}),[]),u=(0,d.useMemo)((()=>c.reduce(((e,t)=>{const{slug:n}=t;let s="postTypesMenuItems";return"page"===n&&(s="defaultPostTypesMenuItems"),e[s].push(t),e}),{defaultPostTypesMenuItems:[],postTypesMenuItems:[]})),[c]);return u})(o),p=function(e){const t=UC(),n=WC(),s=QC("root",YC,XC);let i=n?.find((({slug:e})=>"author"===e));i||(i={description:(0,b.__)("Displays latest posts written by a single author."),slug:"author",title:"Author"});const r=!!t?.find((({slug:e})=>"author"===e));if(s.user?.hasEntities&&(i={...i,templatePrefix:"author"},i.onClick=t=>{e({type:"root",slug:"user",config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"registered_date",exclude:s.user.existingEntitiesIds,who:"authors"}),getSpecificTemplate:e=>{const t=`author-${e.slug}`;return{title:t,slug:t,templatePrefix:"author"}}},labels:{singular_name:(0,b.__)("Author"),search_items:(0,b.__)("Search Authors"),not_found:(0,b.__)("No authors found."),all_items:(0,b.__)("All Authors")},hasGeneralTemplate:r,template:t})}),!r||s.user?.hasEntities)return i}(o);[...l,...u,p].forEach((e=>{if(!e)return;const t=a.findIndex((t=>t.slug===e.slug));t>-1?a[t]=e:a.push(e)})),a?.sort(((e,t)=>hk.indexOf(e.slug)-hk.indexOf(t.slug)));const f=[...a,...ZC(),...h,...c];return f}(i,(()=>n(gk))),c=dk(),{saveEntityRecord:u}=(0,l.useDispatch)(_.store),{createErrorNotice:h,createSuccessNotice:p}=(0,l.useDispatch)(w.store),f=(0,v.useViewportMatch)("medium","<"),m=(0,l.useSelect)((e=>e(_.store).getEntityRecord("root","__unstableBase")?.home),[]),g={"front-page":m,date:(0,b.sprintf)((0,b.__)("E.g. %s"),m+"/"+(new Date).getFullYear())};async function x(e,t=!0){if(!r){o(!0);try{const{title:n,description:s,slug:i}=e,r=await u("postType",Se,{description:s,slug:i.toString(),status:"publish",title:n,is_wp_suggestion:t},{throwOnError:!0});c.navigate(`/${Se}/${r.id}?canvas=edit`),p((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,Kt.decodeEntities)(r.title?.rendered||n)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the template.");h(t,{type:"snackbar"})}finally{o(!1)}}}const j=()=>{e(),n(mk)};let S=(0,b.__)("Add template");return t===gk?S=(0,b.sprintf)((0,b.__)("Add template: %s"),s.labels.singular_name):t===vk&&(S=(0,b.__)("Create custom template")),(0,oe.jsxs)(y.Modal,{title:S,className:Ut("edit-site-add-new-template__modal",{"edit-site-add-new-template__modal_template_list":t===mk,"edit-site-custom-template-modal":t===gk}),onRequestClose:j,overlayClassName:t===vk?"edit-site-custom-generic-template__modal":void 0,children:[t===mk&&(0,oe.jsxs)(y.__experimentalGrid,{columns:f?2:3,gap:4,align:"flex-start",justify:"center",className:"edit-site-add-new-template__template-list__contents",children:[(0,oe.jsx)(y.Flex,{className:"edit-site-add-new-template__template-list__prompt",children:(0,b.__)("Select what the new template should apply to:")}),a.map((e=>{const{title:t,slug:n,onClick:s}=e;return(0,oe.jsx)(fk,{title:t,direction:"column",className:"edit-site-add-new-template__template-button",description:g[n],icon:pk[n]||Zo,onClick:()=>s?s(e):x(e)},n)})),(0,oe.jsx)(fk,{title:(0,b.__)("Custom template"),direction:"row",className:"edit-site-add-new-template__custom-template-button",icon:nC,onClick:()=>n(vk),children:(0,oe.jsx)(y.__experimentalText,{lineHeight:1.53846153846,children:(0,b.__)("A custom template can be manually applied to any post or page.")})})]}),t===gk&&(0,oe.jsx)(sk,{onSelect:x,entityForSuggestions:s}),t===vk&&(0,oe.jsx)(uk,{onClose:j,createTemplate:x})]})}const yk=(0,d.memo)((function(){const[e,t]=(0,d.useState)(!1),{postType:n}=(0,l.useSelect)((e=>{const{getPostType:t}=e(_.store);return{postType:t(Se)}}),[]);return n?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Button,{variant:"primary",onClick:()=>t(!0),label:n.labels.add_new_item,__next40pxDefaultSize:!0,children:n.labels.add_new_item}),e&&(0,oe.jsx)(xk,{onClose:()=>t(!1)})]}):null})),{useGlobalStyle:bk}=te(x.privateApis);const wk={label:(0,b.__)("Preview"),id:"preview",render:function({item:e}){const t=zS(),[n="white"]=bk("color.background"),s=(0,d.useMemo)((()=>(0,o.parse)(e.content.raw)),[e.content.raw]),i=!s?.length;return(0,oe.jsx)(h.EditorProvider,{post:e,settings:t,children:(0,oe.jsxs)("div",{className:"page-templates-preview-field",style:{backgroundColor:n},children:[i&&(0,b.__)("Empty template"),!i&&(0,oe.jsx)(x.BlockPreview.Async,{children:(0,oe.jsx)(x.BlockPreview,{blocks:s})})]})})},enableSorting:!1},_k={label:(0,b.__)("Description"),id:"description",render:({item:e})=>e.description&&(0,oe.jsx)("span",{className:"page-templates-description",children:(0,Kt.decodeEntities)(e.description)}),enableSorting:!1,enableGlobalSearch:!0};const jk={label:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:function({item:e}){const[t,n]=(0,d.useState)(!1),{text:s,icon:i,imageUrl:r}=lC(e.type,e.id);return(0,oe.jsxs)(y.__experimentalHStack,{alignment:"left",spacing:0,children:[r&&(0,oe.jsx)("div",{className:Ut("page-templates-author-field__avatar",{"is-loaded":t}),children:(0,oe.jsx)("img",{onLoad:()=>n(!0),alt:"",src:r})}),!r&&(0,oe.jsx)("div",{className:"page-templates-author-field__icon",children:(0,oe.jsx)(y.Icon,{icon:i})}),(0,oe.jsx)("span",{className:"page-templates-author-field__name",children:s})]})}},{usePostActions:Sk,templateTitleField:Ck}=te(h.privateApis),{useHistory:kk,useLocation:Ek}=te(Gt.privateApis),{useEntityRecordsWithPermissions:Pk}=te(_.privateApis),Ik=[],Tk={[Re]:{showMedia:!1,layout:{styles:{author:{width:"1%"}}}},[Fe]:{showMedia:!0},[Be]:{showMedia:!1}},Ok={type:Fe,search:"",page:1,perPage:20,sort:{field:"title",direction:"asc"},titleField:"title",descriptionField:"description",mediaField:"preview",fields:["author"],filters:[],...Tk[Fe]};function Ak(){const{path:e,query:t}=Ek(),{activeView:n="all",layout:s,postId:i}=t,[r,o]=(0,d.useState)([i]),a=(0,d.useMemo)((()=>{const e=null!=s?s:Ok.type;return{...Ok,type:e,filters:"all"!==n?[{field:"author",operator:"isAny",value:[n]}]:[],...Tk[e]}}),[s,n]),[l,c]=(0,d.useState)(a);(0,d.useEffect)((()=>{c((e=>({...e,type:null!=s?s:Ok.type})))}),[c,s]),(0,d.useEffect)((()=>{c((e=>({...e,filters:"all"!==n?[{field:"author",operator:De,value:[n]}]:[]})))}),[c,n]);const{records:u,isResolving:h}=Pk("postType",Se,{per_page:-1}),p=kk(),f=(0,d.useCallback)((t=>{o(t),l?.type===Be&&p.navigate((0,Qt.addQueryArgs)(e,{postId:1===t.length?t[0]:void 0}))}),[p,e,l?.type]),m=(0,d.useMemo)((()=>{if(!u)return Ik;const e=new Set;return u.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[u]),g=(0,d.useMemo)((()=>[wk,Ck,_k,{...jk,elements:m}]),[m]),{data:x,paginationInfo:y}=(0,d.useMemo)((()=>gy(u,l,g)),[u,l,g]),w=Sk({postType:Se,context:"list"}),_=iC(),j=(0,d.useMemo)((()=>[_,...w]),[w,_]),S=(0,v.useEvent)((t=>{c(t),t.type!==s&&p.navigate((0,Qt.addQueryArgs)(e,{layout:t.type}))}));return(0,oe.jsx)(eg,{className:"edit-site-page-templates",title:(0,b.__)("Templates"),actions:(0,oe.jsx)(yk,{}),children:(0,oe.jsx)(LS,{paginationInfo:y,fields:g,actions:j,data:x,isLoading:h,view:l,onChangeView:S,onChangeSelection:f,isItemClickable:()=>!0,onClickItem:({id:e})=>{p.navigate(`/wp_template/${e}?canvas=edit`)},selection:r,defaultLayouts:Tk},n)})}const Nk={name:"templates",path:"/template",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(TC,{backPath:"/"}):(0,oe.jsx)(ya,{})},content({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Ak,{}):void 0},preview({query:e,siteData:t}){const n=t.currentTheme?.is_block_theme;if(!n)return;return"list"===e.layout?(0,oe.jsx)(Tv,{}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Ak,{}):(0,oe.jsx)(ya,{})}},widths:{content:({query:e})=>"list"===e.layout?380:void 0}},Mk={name:"template-item",path:"/wp_template/*postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(TC,{backPath:"/"}):(0,oe.jsx)(ya,{})},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})}}},Vk=(0,oe.jsxs)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,oe.jsx)(Yt.Path,{d:"M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"}),(0,oe.jsx)(Yt.Path,{d:"M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"}),(0,oe.jsx)(Yt.Path,{d:"M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"})]}),Fk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z"})}),Rk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z"})}),Bk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z"})}),Dk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z"})}),Lk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"})}),zk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),Gk={[Re]:{},[Fe]:{},[Be]:{}},Hk={type:Be,search:"",filters:[],page:1,perPage:20,sort:{field:"title",direction:"asc"},showLevels:!0,titleField:"title",mediaField:"featured_media",fields:["author","status"],...Gk[Be]};function Uk({postType:e}){const t=(0,l.useSelect)((t=>{const{getPostType:n}=t(_.store);return n(e)?.labels}),[e]);return(0,d.useMemo)((()=>[{title:t?.all_items||(0,b.__)("All items"),slug:"all",icon:Vk,view:Hk},{title:(0,b.__)("Published"),slug:"published",icon:Fk,view:Hk,filters:[{field:"status",operator:De,value:"publish"}]},{title:(0,b.__)("Scheduled"),slug:"future",icon:Rk,view:Hk,filters:[{field:"status",operator:De,value:"future"}]},{title:(0,b.__)("Drafts"),slug:"drafts",icon:Bk,view:Hk,filters:[{field:"status",operator:De,value:"draft"}]},{title:(0,b.__)("Pending"),slug:"pending",icon:Dk,view:Hk,filters:[{field:"status",operator:De,value:"pending"}]},{title:(0,b.__)("Private"),slug:"private",icon:Lk,view:Hk,filters:[{field:"status",operator:De,value:"private"}]},{title:(0,b.__)("Trash"),slug:"trash",icon:zk,view:{...Hk,type:Re,layout:Gk[Re].layout},filters:[{field:"status",operator:De,value:"trash"}]}]),[t])}const{useLocation:Wk}=te(Gt.privateApis);function qk({title:e,slug:t,customViewId:n,type:s,icon:i,isActive:r,isCustom:o,suffix:a}){const{path:l}=Wk(),c=i||hS.find((e=>e.type===s)).icon;let u=o?n:t;"all"===u&&(u=void 0);const d={layout:s,activeView:u,isCustom:o?"true":void 0};return(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",className:Ut("edit-site-sidebar-dataviews-dataview-item",{"is-selected":r}),children:[(0,oe.jsx)(oa,{icon:c,to:(0,Qt.addQueryArgs)(l,d),"aria-current":r?"true":void 0,children:e}),a]})}const{useLocation:Zk,useHistory:Kk}=te(Gt.privateApis);function Yk({type:e,setIsAdding:t}){const n=Kk(),{path:s}=Zk(),{saveEntityRecord:i}=(0,l.useDispatch)(_.store),[r,o]=(0,d.useState)(""),[a,c]=(0,d.useState)(!1),u=Uk({postType:e});return(0,oe.jsx)("form",{onSubmit:async o=>{o.preventDefault(),c(!0);const{getEntityRecords:a}=(0,l.resolveSelect)(_.store);let d;const h=await a("taxonomy","wp_dataviews_type",{slug:e});if(h&&h.length>0)d=h[0].id;else{const t=await i("taxonomy","wp_dataviews_type",{name:e});t&&t.id&&(d=t.id)}const p=await i("postType","wp_dataviews",{title:r,status:"publish",wp_dataviews_type:d,content:JSON.stringify(u[0].view)});n.navigate((0,Qt.addQueryArgs)(s,{activeView:p.id,isCustom:"true"})),c(!1),t(!1)},children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"5",children:[(0,oe.jsx)(y.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:r,onChange:o,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"right",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t(!1)},children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit","aria-disabled":!r||a,isBusy:a,children:(0,b.__)("Create")})]})]})})}function Xk({type:e}){const[t,n]=(0,d.useState)(!1);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(oa,{icon:jf,onClick:()=>{n(!0)},className:"dataviews__siderbar-content-add-new-item",children:(0,b.__)("New view")}),t&&(0,oe.jsx)(y.Modal,{title:(0,b.__)("Add new view"),onRequestClose:()=>{n(!1)},children:(0,oe.jsx)(Yk,{type:e,setIsAdding:n})})]})}const{useHistory:Jk,useLocation:Qk}=te(Gt.privateApis),$k=[];function eE({dataviewId:e,currentTitle:t,setIsRenaming:n}){const{editEntityRecord:s}=(0,l.useDispatch)(_.store),[i,r]=(0,d.useState)(t);return(0,oe.jsx)("form",{onSubmit:async t=>{t.preventDefault(),await s("postType","wp_dataviews",e,{title:i}),n(!1)},children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"5",children:[(0,oe.jsx)(y.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:i,onChange:r,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"right",children:[(0,oe.jsx)(y.Button,{variant:"tertiary",__next40pxDefaultSize:!0,onClick:()=>{n(!1)},children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{variant:"primary",type:"submit","aria-disabled":!i,__next40pxDefaultSize:!0,children:(0,b.__)("Save")})]})]})})}function tE({dataviewId:e,isActive:t}){const n=Jk(),s=Qk(),{dataview:i}=(0,l.useSelect)((t=>{const{getEditedEntityRecord:n}=t(_.store);return{dataview:n("postType","wp_dataviews",e)}}),[e]),{deleteEntityRecord:r}=(0,l.useDispatch)(_.store),o=(0,d.useMemo)((()=>JSON.parse(i.content).type),[i.content]),[a,c]=(0,d.useState)(!1);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(qk,{title:i.title,type:o,isActive:t,isCustom:!0,customViewId:e,suffix:(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("Actions"),className:"edit-site-sidebar-dataviews-dataview-item__dropdown-menu",toggleProps:{style:{color:"inherit"},size:"small"},children:({onClose:e})=>(0,oe.jsxs)(y.MenuGroup,{children:[(0,oe.jsx)(y.MenuItem,{onClick:()=>{c(!0),e()},children:(0,b.__)("Rename")}),(0,oe.jsx)(y.MenuItem,{onClick:async()=>{await r("postType","wp_dataviews",i.id,{force:!0}),t&&n.replace({postType:s.query.postType}),e()},isDestructive:!0,children:(0,b.__)("Delete")})]})})}),a&&(0,oe.jsx)(y.Modal,{title:(0,b.__)("Rename"),onRequestClose:()=>{c(!1)},focusOnMount:"firstContentElement",size:"small",children:(0,oe.jsx)(eE,{dataviewId:e,setIsRenaming:c,currentTitle:i.title})})]})}function nE({type:e,activeView:t,isCustom:n}){const s=function(e){return(0,l.useSelect)((t=>{const{getEntityRecords:n}=t(_.store),s=n("taxonomy","wp_dataviews_type",{slug:e});if(!s||0===s.length)return $k;return n("postType","wp_dataviews",{wp_dataviews_type:s[0].id,orderby:"date",order:"asc"})||$k}))}(e);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen-dataviews__group-header",children:(0,oe.jsx)(y.__experimentalHeading,{level:2,children:(0,b.__)("Custom Views")})}),(0,oe.jsxs)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-dataviews__custom-items",children:[s.map((e=>(0,oe.jsx)(tE,{dataviewId:e.id,isActive:n&&Number(t)===e.id},e.id))),(0,oe.jsx)(Xk,{type:e})]})]})}const{useLocation:sE}=te(Gt.privateApis);function iE({postType:e}){const{query:{activeView:t="all",isCustom:n="false"}}=sE(),s=Uk({postType:e});if(!e)return null;const i="true"===n;return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalItemGroup,{className:"edit-site-sidebar-dataviews",children:s.map((e=>(0,oe.jsx)(qk,{slug:e.slug,title:e.title,icon:e.icon,type:e.view.type,isActive:!i&&e.slug===t,isCustom:!1},e.slug)))}),window?.__experimentalCustomViews&&(0,oe.jsx)(nE,{activeView:t,type:e,isCustom:!0})]})}const rE=(0,oe.jsx)(Yt.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"})});function oE({postType:e,onSave:t,onClose:n}){const s=(0,l.useSelect)((t=>t(_.store).getPostType(e)?.labels),[e]),[i,r]=(0,d.useState)(!1),[a,c]=(0,d.useState)(""),{saveEntityRecord:u}=(0,l.useDispatch)(_.store),{createErrorNotice:h,createSuccessNotice:p}=(0,l.useDispatch)(w.store),{resolveSelect:f}=(0,l.useRegistry)();return(0,oe.jsx)(y.Modal,{title:(0,b.sprintf)((0,b.__)("Draft new: %s"),s?.singular_name),onRequestClose:n,focusOnMount:"firstContentElement",size:"small",children:(0,oe.jsx)("form",{onSubmit:async function(n){if(n.preventDefault(),!i){r(!0);try{const n=await f(_.store).getPostType(e),s=await u("postType",e,{status:"draft",title:a,slug:null!=a?a:void 0,content:n.template&&n.template.length?(0,o.serialize)((0,o.synchronizeBlocksWithTemplate)([],n.template)):void 0},{throwOnError:!0});t(s),p((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,Kt.decodeEntities)(s.title?.rendered||a)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the item.");h(t,{type:"snackbar"})}finally{r(!1)}}},children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(y.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,b.__)("Title"),onChange:c,placeholder:(0,b.__)("No title"),value:a}),(0,oe.jsxs)(y.__experimentalHStack,{spacing:2,justify:"end",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:n,children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:i,"aria-disabled":i,children:(0,b.__)("Create draft")})]})]})})})}const{usePostActions:aE,usePostFields:lE}=te(h.privateApis),{useLocation:cE,useHistory:uE}=te(Gt.privateApis),{useEntityRecordsWithPermissions:dE}=te(_.privateApis),hE=[],pE=(e,t)=>e.find((({slug:e})=>e===t))?.view,fE=e=>{if(!e?.content)return;const t=JSON.parse(e.content);return t?{...t,...Gk[t.type]}:void 0};function mE(e){return e.id.toString()}function gE(e){return e.level}function vE({postType:e}){var t,n,s;const[i,r]=function(e){const{path:t,query:{activeView:n="all",isCustom:s="false",layout:i}}=cE(),r=uE(),o=Uk({postType:e}),{editEntityRecord:a}=(0,l.useDispatch)(_.store),c=(0,l.useSelect)((e=>{if("true"!==s)return;const{getEditedEntityRecord:t}=e(_.store);return t("postType","wp_dataviews",Number(n))}),[n,s]),[u,h]=(0,d.useState)((()=>{let e;var t,r;e="true"===s?null!==(t=fE(c))&&void 0!==t?t:{type:null!=i?i:Be}:null!==(r=pE(o,n))&&void 0!==r?r:{type:null!=i?i:Be};const a=null!=i?i:e.type;return{...e,type:a,...Gk[a]}})),p=(0,v.useEvent)((e=>{h(e),"true"===s&&c?.id&&a("postType","wp_dataviews",c?.id,{content:JSON.stringify(e)});const n=null!=i?i:Be;e.type!==n&&r.navigate((0,Qt.addQueryArgs)(t,{layout:e.type}))})),f=(0,v.useEvent)((()=>{h((e=>{const t=null!=i?i:Be;return t===e.type?e:{...e,type:t,...Gk[t]}}))}));(0,d.useEffect)((()=>{f()}),[f,i]);const m=(0,v.useEvent)((()=>{let e;if(e="true"===s?fE(c):pE(o,n),e){const t=null!=i?i:e.type;h({...e,type:t,...Gk[t]})}}));return(0,d.useEffect)((()=>{m()}),[m,n,s,o,c]),[u,p]}(e),o=Uk({postType:e}),a=uE(),c=cE(),{postId:u,quickEdit:h=!1,isCustom:p,activeView:f="all"}=c.query,[m,g]=(0,d.useState)(null!==(t=u?.split(","))&&void 0!==t?t:[]),x=(0,d.useCallback)((e=>{var t;g(e),"false"===(null!==(t=c.query.isCustom)&&void 0!==t?t:"false")&&a.navigate((0,Qt.addQueryArgs)(c.path,{postId:e.join(",")}))}),[c.path,c.query.isCustom,a]),w=(e,t)=>{var n;const s=e.find((({slug:e})=>e===t));return null!==(n=s?.filters)&&void 0!==n?n:[]},{isLoading:j,fields:S}=lE({postType:e}),C=(0,d.useMemo)((()=>{const e=w(o,f).map((({field:e})=>e));return S.map((t=>({...t,elements:e.includes(t.id)?[]:t.elements})))}),[S,o,f]),k=(0,d.useMemo)((()=>{const e={};i.filters?.forEach((t=>{"status"===t.field&&t.operator===De&&(e.status=t.value),"author"===t.field&&t.operator===De?e.author=t.value:"author"===t.field&&t.operator===Le&&(e.author_exclude=t.value)}));return w(o,f).forEach((t=>{"status"===t.field&&t.operator===De&&(e.status=t.value),"author"===t.field&&t.operator===De?e.author=t.value:"author"===t.field&&t.operator===Le&&(e.author_exclude=t.value)})),e.status&&""!==e.status||(e.status="draft,future,pending,private,publish"),{per_page:i.perPage,page:i.page,_embed:"author",order:i.sort?.direction,orderby:i.sort?.field,orderby_hierarchy:!!i.showLevels,search:i.search,...e}}),[i,f,o]),{records:E,isResolving:P,totalItems:I,totalPages:T}=dE("postType",e,k),O=(0,d.useMemo)((()=>j||"author"!==i?.sort?.field?E:gy(E,{sort:{...i.sort}},C).data),[E,C,j,i?.sort]),A=null!==(n=O?.map((e=>mE(e))))&&void 0!==n?n:[],N=(null!==(s=(0,v.usePrevious)(A))&&void 0!==s?s:[]).filter((e=>!A.includes(e))).includes(u);(0,d.useEffect)((()=>{N&&a.navigate((0,Qt.addQueryArgs)(c.path,{postId:void 0}))}),[a,N,c.path]);const M=(0,d.useMemo)((()=>({totalItems:I,totalPages:T})),[I,T]),{labels:V,canCreateRecord:F}=(0,l.useSelect)((t=>{const{getPostType:n,canUser:s}=t(_.store);return{labels:n(e)?.labels,canCreateRecord:s("create",{kind:"postType",name:e})}}),[e]),R=aE({postType:e,context:"list"}),B=iC(),D=(0,d.useMemo)((()=>[B,...R]),[R,B]),[L,z]=(0,d.useState)(!1),G=()=>z(!1);return(0,oe.jsx)(eg,{title:V?.name,actions:V?.add_new_item&&F&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Button,{variant:"primary",onClick:()=>z(!0),__next40pxDefaultSize:!0,children:V.add_new_item}),L&&(0,oe.jsx)(oE,{postType:e,onSave:({type:e,id:t})=>{a.navigate(`/${e}/${t}?canvas=edit`),G()},onClose:G})]}),children:(0,oe.jsx)(LS,{paginationInfo:M,fields:C,actions:D,data:O||hE,isLoading:P||j,view:i,onChangeView:r,selection:m,onChangeSelection:x,isItemClickable:e=>"trash"!==e.status,onClickItem:({id:t})=>{a.navigate(`/${e}/${t}?canvas=edit`)},getItemId:mE,getItemLevel:gE,defaultLayouts:Gk,header:window.__experimentalQuickEditDataViews&&i.type!==Be&&"page"===e&&(0,oe.jsx)(y.Button,{size:"compact",isPressed:h,icon:rE,label:(0,b.__)("Details"),onClick:()=>{a.navigate((0,Qt.addQueryArgs)(c.path,{quickEdit:!h||void 0}))}})},f+p)})}const xE=(0,d.createContext)({fields:[]});function yE({fields:e,children:t}){return(0,oe.jsx)(xE.Provider,{value:{fields:e},children:t})}const bE=xE;function wE(e){return void 0!==e.children}function _E({title:e}){return(0,oe.jsx)(y.__experimentalVStack,{className:"dataforms-layouts-regular__header",spacing:4,children:(0,oe.jsxs)(y.__experimentalHStack,{alignment:"center",children:[(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,children:e}),(0,oe.jsx)(y.__experimentalSpacer,{})]})})}function jE({title:e,onClose:t}){return(0,oe.jsx)(y.__experimentalVStack,{className:"dataforms-layouts-panel__dropdown-header",spacing:4,children:(0,oe.jsxs)(y.__experimentalHStack,{alignment:"center",children:[e&&(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,children:e}),(0,oe.jsx)(y.__experimentalSpacer,{}),t&&(0,oe.jsx)(y.Button,{label:(0,b.__)("Close"),icon:Ro,onClick:t,size:"small"})]})})}function SE({fieldDefinition:e,popoverAnchor:t,labelPosition:n="side",data:s,onChange:i,field:r}){const o=wE(r)?r.label:e?.label,a=(0,d.useMemo)((()=>wE(r)?{type:"regular",fields:r.children.map((e=>"string"==typeof e?{id:e}:e))}:{type:"regular",fields:[{id:r.id}]}),[r]),l=(0,d.useMemo)((()=>({anchor:t,placement:"left-start",offset:36,shift:!0})),[t]);return(0,oe.jsx)(y.Dropdown,{contentClassName:"dataforms-layouts-panel__field-dropdown",popoverProps:l,focusOnMount:!0,toggleProps:{size:"compact",variant:"tertiary",tooltipPosition:"middle left"},renderToggle:({isOpen:t,onToggle:i})=>(0,oe.jsx)(y.Button,{className:"dataforms-layouts-panel__field-control",size:"compact",variant:["none","top"].includes(n)?"link":"tertiary","aria-expanded":t,"aria-label":(0,b.sprintf)((0,b._x)("Edit %s","field"),o),onClick:i,children:(0,oe.jsx)(e.render,{item:s})}),renderContent:({onClose:e})=>(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(jE,{title:o,onClose:e}),(0,oe.jsx)(kE,{data:s,form:a,onChange:i,children:(e,t)=>{var n;return(0,oe.jsx)(e,{data:s,field:t,onChange:i,hideLabelFromVision:(null!==(n=a?.fields)&&void 0!==n?n:[]).length<2},t.id)}})]})})}const CE=[{type:"regular",component:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){var i;const{fields:r}=(0,d.useContext)(bE),o=(0,d.useMemo)((()=>wE(t)?{fields:t.children.map((e=>"string"==typeof e?{id:e}:e)),type:"regular"}:{type:"regular",fields:[]}),[t]);if(wE(t))return(0,oe.jsxs)(oe.Fragment,{children:[!s&&t.label&&(0,oe.jsx)(_E,{title:t.label}),(0,oe.jsx)(kE,{data:e,form:o,onChange:n})]});const a=null!==(i=t.labelPosition)&&void 0!==i?i:"top",l=r.find((e=>e.id===t.id));return l?"side"===a?(0,oe.jsxs)(y.__experimentalHStack,{className:"dataforms-layouts-regular__field",children:[(0,oe.jsx)("div",{className:"dataforms-layouts-regular__field-label",children:l.label}),(0,oe.jsx)("div",{className:"dataforms-layouts-regular__field-control",children:(0,oe.jsx)(l.Edit,{data:e,field:l,onChange:n,hideLabelFromVision:!0},l.id)})]}):(0,oe.jsx)("div",{className:"dataforms-layouts-regular__field",children:(0,oe.jsx)(l.Edit,{data:e,field:l,onChange:n,hideLabelFromVision:"none"===a||s})}):null}},{type:"panel",component:function({data:e,field:t,onChange:n}){var s;const{fields:i}=(0,d.useContext)(bE),r=i.find((e=>{if(wE(t)){const n=t.children.filter((e=>"string"==typeof e||!wE(e))),s="string"==typeof n[0]?n[0]:n[0].id;return e.id===s}return e.id===t.id})),o=null!==(s=t.labelPosition)&&void 0!==s?s:"side",[a,l]=(0,d.useState)(null);if(!r)return null;const c=wE(t)?t.label:r?.label;return"top"===o?(0,oe.jsxs)(y.__experimentalVStack,{className:"dataforms-layouts-panel__field",spacing:0,children:[(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field-label",style:{paddingBottom:0},children:c}),(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field-control",children:(0,oe.jsx)(SE,{field:t,popoverAnchor:a,fieldDefinition:r,data:e,onChange:n,labelPosition:o})})]}):"none"===o?(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field",children:(0,oe.jsx)(SE,{field:t,popoverAnchor:a,fieldDefinition:r,data:e,onChange:n,labelPosition:o})}):(0,oe.jsxs)(y.__experimentalHStack,{ref:l,className:"dataforms-layouts-panel__field",children:[(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field-label",children:c}),(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field-control",children:(0,oe.jsx)(SE,{field:t,popoverAnchor:a,fieldDefinition:r,data:e,onChange:n,labelPosition:o})})]})}}];function kE({data:e,form:t,onChange:n,children:s}){const{fields:i}=(0,d.useContext)(bE);const r=(0,d.useMemo)((()=>function(e){var t,n,s;let i="regular";["regular","panel"].includes(null!==(t=e.type)&&void 0!==t?t:"")&&(i=e.type);const r=null!==(n=e.labelPosition)&&void 0!==n?n:"regular"===i?"top":"side";return(null!==(s=e.fields)&&void 0!==s?s:[]).map((e=>{var t,n;if("string"==typeof e)return{id:e,layout:i,labelPosition:r};const s=null!==(t=e.layout)&&void 0!==t?t:i,o=null!==(n=e.labelPosition)&&void 0!==n?n:"regular"===s?"top":"side";return{...e,layout:s,labelPosition:o}}))}(t)),[t]);return(0,oe.jsx)(y.__experimentalVStack,{spacing:2,children:r.map((t=>{const r=(o=t.layout,CE.find((e=>e.type===o)))?.component;var o;if(!r)return null;const a=wE(t)?void 0:function(e){const t="string"==typeof e?e:e.id;return i.find((e=>e.id===t))}(t);return a&&a.isVisible&&!a.isVisible(e)?null:s?s(r,t):(0,oe.jsx)(r,{data:e,field:t,onChange:n},t.id)}))})}function EE({data:e,form:t,fields:n,onChange:s}){const i=(0,d.useMemo)((()=>py(n)),[n]);return t.fields?(0,oe.jsx)(yE,{fields:i,children:(0,oe.jsx)(kE,{data:e,form:t,onChange:s})}):null}const{usePostFields:PE,PostCardPanel:IE}=te(h.privateApis),TE=["title","status","date","author","comment_status"];function OE({postType:e,postId:t}){const n=(0,d.useMemo)((()=>t.split(",")),[t]),{record:s,hasFinishedResolution:i}=(0,l.useSelect)((t=>{const s=["postType",e,n[0]],{getEditedEntityRecord:i,hasFinishedResolution:r}=t(_.store);return{record:1===n.length?i(...s):null,hasFinishedResolution:r("getEditedEntityRecord",s)}}),[e,n]),[r,o]=(0,d.useState)({}),{editEntityRecord:a}=(0,l.useDispatch)(_.store),{fields:c}=PE({postType:e}),u=(0,d.useMemo)((()=>c?.map((e=>"status"===e.id?{...e,elements:e.elements.filter((e=>"trash"!==e.value))}:e))),[c]),h=(0,d.useMemo)((()=>({type:"panel",fields:[{id:"featured_media",layout:"regular"},{id:"status",label:(0,b.__)("Status & Visibility"),children:["status","password"]},"author","date","slug","parent","comment_status",{label:(0,b.__)("Template"),labelPosition:"side",id:"template",layout:"regular"}].filter((e=>1===n.length||TE.includes(e)))})),[n]);(0,d.useEffect)((()=>{o({})}),[n]);const{ExperimentalBlockEditorProvider:p}=te(x.privateApis),f=zS(),m=(0,d.useMemo)((()=>u.map((e=>"template"===e.id?{...e,Edit:t=>(0,oe.jsx)(p,{settings:f,children:(0,oe.jsx)(e.Edit,{...t})})}:e))),[u,f]);return(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(IE,{postType:e,postId:n}),i&&(0,oe.jsx)(EE,{data:1===n.length?s:r,fields:m,form:h,onChange:t=>{for(const i of n)t.status&&"future"!==t.status&&"future"===s?.status&&new Date(s.date)>new Date&&(t.date=null),t.status&&"private"===t.status&&s.password&&(t.password=""),a("postType",e,i,t),n.length>1&&o((e=>({...e,...t})))}})]})}function AE({postType:e,postId:t}){return(0,oe.jsxs)(eg,{className:Ut("edit-site-post-edit",{"is-empty":!t}),label:(0,b.__)("Post Edit"),children:[t&&(0,oe.jsx)(OE,{postType:e,postId:t}),!t&&(0,oe.jsx)("p",{children:(0,b.__)("Select a page to edit")})]})}const{useLocation:NE}=te(Gt.privateApis);function ME(){const{query:e={}}=NE(),{canvas:t="view"}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(vE,{postType:"page"})}const VE={name:"pages",path:"/page",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(ea,{title:(0,b.__)("Pages"),backPath:"/",content:(0,oe.jsx)(iE,{postType:"page"})}):(0,oe.jsx)(ya,{})},content({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(vE,{postType:"page"}):void 0},preview({query:e,siteData:t}){const n=t.currentTheme?.is_block_theme;if(!n)return;return("list"===e.layout||!e.layout)&&"true"!==e.isCustom?(0,oe.jsx)(Tv,{}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(ME,{}):(0,oe.jsx)(ya,{})},edit({query:e}){var t;return"list"!==(null!==(t=e.layout)&&void 0!==t?t:"list")&&!!e.quickEdit?(0,oe.jsx)(AE,{postType:"page",postId:e.postId}):void 0}},widths:{content:({query:e})=>("list"===e.layout||!e.layout)&&"true"!==e.isCustom?380:void 0,edit({query:e}){var t;return"list"!==(null!==(t=e.layout)&&void 0!==t?t:"list")&&!!e.quickEdit?380:void 0}}};function FE(){return(0,oe.jsx)(y.Notice,{status:"error",isDismissible:!1,children:(0,b.__)("The requested page could not be found. Please check the URL.")})}const RE=[{name:"page-item",path:"/page/:postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(ea,{title:(0,b.__)("Pages"),backPath:"/",content:(0,oe.jsx)(iE,{postType:"page"})}):(0,oe.jsx)(ya,{})},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})}}},VE,Mk,Nk,CC,SC,jC,xx,mx,Vv,Av,{name:"stylebook",path:"/stylebook",areas:{sidebar:({siteData:e})=>Ov(e)?(0,oe.jsx)(ea,{title:(0,b.__)("Styles"),backPath:"/",description:(0,b.__)("Preview your website's visual identity: colors, typography, and blocks.")}):(0,oe.jsx)(ya,{}),preview:({siteData:e})=>Ov(e)?(0,oe.jsx)(vg,{isStatic:!0}):void 0,mobile:({siteData:e})=>Ov(e)?(0,oe.jsx)(vg,{isStatic:!0}):void 0}},{name:"notfound",path:"*",areas:{sidebar:(0,oe.jsx)(xa,{}),mobile:(0,oe.jsx)(xa,{customDescription:(0,oe.jsx)(FE,{})}),content:(0,oe.jsx)(y.__experimentalSpacer,{padding:2,children:(0,oe.jsx)(FE,{})})}}];const{RouterProvider:BE}=te(Gt.privateApis);function DE(){return function(){const e=(0,l.useSelect)((e=>e(_.store).getEntityRecord("root","__unstableBase")?.home),[]);(0,Wt.useCommand)({name:"core/edit-site/view-site",label:(0,b.__)("View site"),callback:({close:t})=>{t(),window.open(e,"_blank")},icon:Po}),(0,Wt.useCommandLoader)({name:"core/edit-site/open-styles",hook:Ao()}),(0,Wt.useCommandLoader)({name:"core/edit-site/toggle-styles-welcome-guide",hook:No()}),(0,Wt.useCommandLoader)({name:"core/edit-site/reset-global-styles",hook:Mo()}),(0,Wt.useCommandLoader)({name:"core/edit-site/open-styles-css",hook:Vo()}),(0,Wt.useCommandLoader)({name:"core/edit-site/open-styles-revisions",hook:Fo()})}(),function(){const{query:e={}}=Uo(),{canvas:t="view"}=e;let n="site-editor";"edit"===t&&(n="entity-edit"),(0,l.useSelect)((e=>e(x.store).getBlockSelectionStart()),[])&&(n="block-selection-edit"),zo()&&(n=""),Ho(n)}(),(0,oe.jsx)(wo,{})}function LE(){!function(){const e=(0,l.useRegistry)(),{registerRoute:t}=te((0,l.useDispatch)(zt));(0,d.useEffect)((()=>{e.batch((()=>{RE.forEach(t)}))}),[e,t])}();const{routes:e,currentTheme:t,editorSettings:n}=(0,l.useSelect)((e=>({routes:te(e(zt)).getRoutes(),currentTheme:e(_.store).getCurrentTheme(),editorSettings:e(zt).getSettings()})),[]),s=(0,d.useCallback)((({path:e,query:t})=>Qr()?{path:e,query:{...t,wp_theme_preview:"wp_theme_preview"in t?t.wp_theme_preview:$r()}}:{path:e,query:t}),[]),i=(0,d.useMemo)((()=>({siteData:{currentTheme:t,editorSettings:n}})),[t,n]);return(0,oe.jsx)(BE,{routes:e,pathArg:"p",beforeNavigate:s,matchResolverArgs:i,children:(0,oe.jsx)(DE,{})})}const zE=(0,Qt.getPath)(window.location.href)?.includes("site-editor.php"),GE=e=>{u()(`wp.editPost.${e}`,{since:"6.6",alternative:`wp.editor.${e}`})};function HE(e){return zE?(GE("PluginMoreMenuItem"),(0,oe.jsx)(h.PluginMoreMenuItem,{...e})):null}function UE(e){return zE?(GE("PluginSidebar"),(0,oe.jsx)(h.PluginSidebar,{...e})):null}function WE(e){return zE?(GE("PluginSidebarMoreMenuItem"),(0,oe.jsx)(h.PluginSidebarMoreMenuItem,{...e})):null}const{useLocation:qE}=te(Gt.privateApis);function ZE(){const{query:e={}}=qE(),{canvas:t="view"}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(vE,{postType:"post"})}const KE={name:"posts",path:"/",areas:{sidebar:(0,oe.jsx)(ea,{title:(0,b.__)("Posts"),isRoot:!0,content:(0,oe.jsx)(iE,{postType:"post"})}),content:(0,oe.jsx)(vE,{postType:"post"}),preview:({query:e})=>("list"===e.layout||!e.layout)&&"true"!==e.isCustom?(0,oe.jsx)(Tv,{isPostsList:!0}):void 0,mobile:(0,oe.jsx)(ZE,{}),edit({query:e}){var t;return"list"===(null!==(t=e.layout)&&void 0!==t?t:"list")&&!!e.quickEdit?(0,oe.jsx)(AE,{postType:"post",postId:e.postId}):void 0}},widths:{content:({query:e})=>("list"===e.layout||!e.layout)&&"true"!==e.isCustom?380:void 0,edit({query:e}){var t;return"list"===(null!==(t=e.layout)&&void 0!==t?t:"list")&&!!e.quickEdit?380:void 0}}};(0,b.__)("Posts");const{RouterProvider:YE}=te(Gt.privateApis);function XE(e,t){}const{registerCoreBlockBindingsSources:JE}=te(h.privateApis);function QE(e,t){const n=document.getElementById(e),s=(0,d.createRoot)(n);(0,l.dispatch)(o.store).reapplyBlockTypeFilters();const i=(0,a.__experimentalGetCoreBlocks)().filter((({name:e})=>"core/freeform"!==e));return(0,a.registerCoreBlocks)(i),JE(),(0,l.dispatch)(o.store).setFreeformFallbackBlockName("core/html"),(0,m.registerLegacyWidgetBlock)({inserter:!1}),(0,m.registerWidgetGroupBlock)({inserter:!1}),(0,l.dispatch)(f.store).setDefaults("core/edit-site",{welcomeGuide:!0,welcomeGuideStyles:!0,welcomeGuidePage:!0,welcomeGuideTemplate:!0}),(0,l.dispatch)(f.store).setDefaults("core",{allowRightClickOverrides:!0,distractionFree:!1,editorMode:"visual",editorTool:"edit",fixedToolbar:!1,focusMode:!1,inactivePanels:[],keepCaretInsideBlock:!1,openPanels:["post-status"],showBlockBreadcrumbs:!0,showListViewByDefault:!1,enableChoosePatternModal:!0}),window.__experimentalMediaProcessing&&(0,l.dispatch)(f.store).setDefaults("core/media",{requireApproval:!0,optimizeOnUpload:!0}),(0,l.dispatch)(zt).updateSettings(t),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),s.render((0,oe.jsx)(d.StrictMode,{children:(0,oe.jsx)(LE,{})})),s}function $E(){u()("wp.editSite.reinitializeEditor",{since:"6.2",version:"6.3"})}})(),(window.wp=window.wp||{}).editSite=r})(); dist/annotations.min.js 0000644 00000012621 15125140777 0011177 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{store:()=>C});var n={};t.r(n),t.d(n,{__experimentalGetAllAnnotationsForBlock:()=>x,__experimentalGetAnnotations:()=>N,__experimentalGetAnnotationsForBlock:()=>y,__experimentalGetAnnotationsForRichText:()=>T});var r={};t.r(r),t.d(r,{__experimentalAddAnnotation:()=>R,__experimentalRemoveAnnotation:()=>U,__experimentalRemoveAnnotationsBySource:()=>k,__experimentalUpdateAnnotationRange:()=>S});const o=window.wp.richText,a=window.wp.i18n,i="core/annotations",c="core/annotation",l="annotation-text-";const s={name:c,title:(0,a.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(t,{richTextIdentifier:e,blockClientId:n})=>({annotations:t(i).__experimentalGetAnnotationsForRichText(n,e)}),__experimentalCreatePrepareEditableTree:({annotations:t})=>(e,n)=>{if(0===t.length)return e;let r={formats:e,text:n};return r=function(t,e=[]){return e.forEach((e=>{let{start:n,end:r}=e;n>t.text.length&&(n=t.text.length),r>t.text.length&&(r=t.text.length);const a=l+e.source,i=l+e.id;t=(0,o.applyFormat)(t,{type:c,attributes:{className:a,id:i}},n,r)})),t}(r,t),r.formats},__experimentalGetPropsForEditableTreeChangeHandler:t=>({removeAnnotation:t(i).__experimentalRemoveAnnotation,updateAnnotationRange:t(i).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:t=>e=>{const n=function(t){const e={};return t.forEach(((t,n)=>{(t=(t=t||[]).filter((t=>t.type===c))).forEach((t=>{let{id:r}=t.attributes;r=r.replace(l,""),e.hasOwnProperty(r)||(e[r]={start:n}),e[r].end=n+1}))})),e}(e),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=t;!function(t,e,{removeAnnotation:n,updateAnnotationRange:r}){t.forEach((t=>{const o=e[t.id];if(!o)return void n(t.id);const{start:a,end:i}=t;a===o.start&&i===o.end||r(t.id,o.start,o.end)}))}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:d,...u}=s;(0,o.registerFormatType)(d,u);const p=window.wp.hooks,m=window.wp.data;function f(t,e){const n=t.filter(e);return t.length===n.length?t:n}(0,p.addFilter)("editor.BlockListBlock","core/annotations",(t=>(0,m.withSelect)(((t,{clientId:e,className:n})=>({className:t(i).__experimentalGetAnnotationsForBlock(e).map((t=>"is-annotated-by-"+t.source)).concat(n).filter(Boolean).join(" ")})))(t)));const _=(t,e)=>Object.entries(t).reduce(((t,[n,r])=>({...t,[n]:e(r)})),{});const A=function(t={},e){var n;switch(e.type){case"ANNOTATION_ADD":const r=e.blockClientId,o={id:e.id,blockClientId:r,richTextIdentifier:e.richTextIdentifier,source:e.source,selector:e.selector,range:e.range};if("range"===o.selector&&!function(t){return"number"==typeof t.start&&"number"==typeof t.end&&t.start<=t.end}(o.range))return t;const a=null!==(n=t?.[r])&&void 0!==n?n:[];return{...t,[r]:[...a,o]};case"ANNOTATION_REMOVE":return _(t,(t=>f(t,(t=>t.id!==e.annotationId))));case"ANNOTATION_UPDATE_RANGE":return _(t,(t=>{let n=!1;const r=t.map((t=>t.id===e.annotationId?(n=!0,{...t,range:{start:e.start,end:e.end}}):t));return n?r:t}));case"ANNOTATION_REMOVE_SOURCE":return _(t,(t=>f(t,(t=>t.source!==e.source))))}return t},g=[],y=(0,m.createSelector)(((t,e)=>{var n;return(null!==(n=t?.[e])&&void 0!==n?n:[]).filter((t=>"block"===t.selector))}),((t,e)=>{var n;return[null!==(n=t?.[e])&&void 0!==n?n:g]}));function x(t,e){var n;return null!==(n=t?.[e])&&void 0!==n?n:g}const T=(0,m.createSelector)(((t,e,n)=>{var r;return(null!==(r=t?.[e])&&void 0!==r?r:[]).filter((t=>"range"===t.selector&&n===t.richTextIdentifier)).map((t=>{const{range:e,...n}=t;return{...e,...n}}))}),((t,e)=>{var n;return[null!==(n=t?.[e])&&void 0!==n?n:g]}));function N(t){return Object.values(t).flat()}const h={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let O;const b=new Uint8Array(16);function I(){if(!O&&(O="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!O))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O(b)}const v=[];for(let t=0;t<256;++t)v.push((t+256).toString(16).slice(1));function w(t,e=0){return v[t[e+0]]+v[t[e+1]]+v[t[e+2]]+v[t[e+3]]+"-"+v[t[e+4]]+v[t[e+5]]+"-"+v[t[e+6]]+v[t[e+7]]+"-"+v[t[e+8]]+v[t[e+9]]+"-"+v[t[e+10]]+v[t[e+11]]+v[t[e+12]]+v[t[e+13]]+v[t[e+14]]+v[t[e+15]]}const E=function(t,e,n){if(h.randomUUID&&!e&&!t)return h.randomUUID();const r=(t=t||{}).random||(t.rng||I)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=r[t];return e}return w(r)};function R({blockClientId:t,richTextIdentifier:e=null,range:n=null,selector:r="range",source:o="default",id:a=E()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:t,richTextIdentifier:e,source:o,selector:r};return"range"===r&&(i.range=n),i}function U(t){return{type:"ANNOTATION_REMOVE",annotationId:t}}function S(t,e,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:t,start:e,end:n}}function k(t){return{type:"ANNOTATION_REMOVE_SOURCE",source:t}}const C=(0,m.createReduxStore)(i,{reducer:A,selectors:n,actions:r});(0,m.register)(C),(window.wp=window.wp||{}).annotations=e})(); dist/server-side-render.min.js 0000644 00000010420 15125140777 0012342 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={7734:e=>{e.exports=function e(r,t){if(r===t)return!0;if(r&&t&&"object"==typeof r&&"object"==typeof t){if(r.constructor!==t.constructor)return!1;var n,o,s;if(Array.isArray(r)){if((n=r.length)!=t.length)return!1;for(o=n;0!=o--;)if(!e(r[o],t[o]))return!1;return!0}if(r instanceof Map&&t instanceof Map){if(r.size!==t.size)return!1;for(o of r.entries())if(!t.has(o[0]))return!1;for(o of r.entries())if(!e(o[1],t.get(o[0])))return!1;return!0}if(r instanceof Set&&t instanceof Set){if(r.size!==t.size)return!1;for(o of r.entries())if(!t.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(r)&&ArrayBuffer.isView(t)){if((n=r.length)!=t.length)return!1;for(o=n;0!=o--;)if(r[o]!==t[o])return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if((n=(s=Object.keys(r)).length)!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,s[o]))return!1;for(o=n;0!=o--;){var i=s[o];if(!e(r[i],t[i]))return!1}return!0}return r!=r&&t!=t}}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var s=r[n]={exports:{}};return e[n](s,s.exports,t),s.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var n={};t.d(n,{default:()=>j});const o=window.wp.element,s=window.wp.data;var i=t(7734),u=t.n(i);const c=window.wp.compose,l=window.wp.i18n,a=window.wp.apiFetch;var f=t.n(a);const d=window.wp.url,p=window.wp.components,w=window.wp.blocks,h=window.ReactJSXRuntime,y={};function g({className:e}){return(0,h.jsx)(p.Placeholder,{className:e,children:(0,l.__)("Block rendered as empty.")})}function m({response:e,className:r}){const t=(0,l.sprintf)((0,l.__)("Error loading block: %s"),e.errorMsg);return(0,h.jsx)(p.Placeholder,{className:r,children:t})}function v({children:e,showLoader:r}){return(0,h.jsxs)("div",{style:{position:"relative"},children:[r&&(0,h.jsx)("div",{style:{position:"absolute",top:"50%",left:"50%",marginTop:"-9px",marginLeft:"-9px"},children:(0,h.jsx)(p.Spinner,{})}),(0,h.jsx)("div",{style:{opacity:r?"0.3":1},children:e})]})}function b(e){const{attributes:r,block:t,className:n,httpMethod:s="GET",urlQueryArgs:i,skipBlockSupportAttributes:l=!1,EmptyResponsePlaceholder:a=g,ErrorResponsePlaceholder:p=m,LoadingResponsePlaceholder:b=v}=e,x=(0,o.useRef)(!1),[j,S]=(0,o.useState)(!1),O=(0,o.useRef)(),[P,k]=(0,o.useState)(null),R=(0,c.usePrevious)(e),[A,M]=(0,o.useState)(!1);function T(){var e,n;if(!x.current)return;M(!0);const o=setTimeout((()=>{S(!0)}),1e3);let u=r&&(0,w.__experimentalSanitizeBlockAttributes)(t,r);l&&(u=function(e){const{backgroundColor:r,borderColor:t,fontFamily:n,fontSize:o,gradient:s,textColor:i,className:u,...c}=e,{border:l,color:a,elements:f,spacing:d,typography:p,...w}=e?.style||y;return{...c,style:w}}(u));const c="POST"===s,a=c?null:null!==(e=u)&&void 0!==e?e:null,p=function(e,r=null,t={}){return(0,d.addQueryArgs)(`/wp/v2/block-renderer/${e}`,{context:"edit",...null!==r?{attributes:r}:{},...t})}(t,a,i),h=c?{attributes:null!==(n=u)&&void 0!==n?n:null}:null,g=O.current=f()({path:p,data:h,method:c?"POST":"GET"}).then((e=>{x.current&&g===O.current&&e&&k(e.rendered)})).catch((e=>{x.current&&g===O.current&&k({error:!0,errorMsg:e.message})})).finally((()=>{x.current&&g===O.current&&(M(!1),S(!1),clearTimeout(o))}));return g}const _=(0,c.useDebounce)(T,500);(0,o.useEffect)((()=>(x.current=!0,()=>{x.current=!1})),[]),(0,o.useEffect)((()=>{void 0===R?T():u()(R,e)||_()}));const E=!!P,N=""===P,z=P?.error;return A?(0,h.jsx)(b,{...e,showLoader:j,children:E&&(0,h.jsx)(o.RawHTML,{className:n,children:P})}):N||!E?(0,h.jsx)(a,{...e}):z?(0,h.jsx)(p,{response:P,...e}):(0,h.jsx)(o.RawHTML,{className:n,children:P})}const x={},j=(0,s.withSelect)((e=>{const r=e("core/editor");if(r){const e=r.getCurrentPostId();if(e&&"number"==typeof e)return{currentPostId:e}}return x}))((({urlQueryArgs:e=x,currentPostId:r,...t})=>{const n=(0,o.useMemo)((()=>r?{post_id:r,...e}:e),[r,e]);return(0,h.jsx)(b,{urlQueryArgs:n,...t})}));(window.wp=window.wp||{}).serverSideRender=n.default})(); dist/is-shallow-equal.js 0000644 00000010277 15125140777 0011254 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": () => (/* binding */ isShallowEqual), isShallowEqualArrays: () => (/* reexport */ isShallowEqualArrays), isShallowEqualObjects: () => (/* reexport */ isShallowEqualObjects) }); ;// ./node_modules/@wordpress/is-shallow-equal/build-module/objects.js /** * Returns true if the two objects are shallow equal, or false otherwise. * * @param {import('.').ComparableObject} a First object to compare. * @param {import('.').ComparableObject} b Second object to compare. * * @return {boolean} Whether the two objects are shallow equal. */ function isShallowEqualObjects(a, b) { if (a === b) { return true; } const aKeys = Object.keys(a); const bKeys = Object.keys(b); if (aKeys.length !== bKeys.length) { return false; } let i = 0; while (i < aKeys.length) { const key = aKeys[i]; const aValue = a[key]; if ( // In iterating only the keys of the first object after verifying // equal lengths, account for the case that an explicit `undefined` // value in the first is implicitly undefined in the second. // // Example: isShallowEqualObjects( { a: undefined }, { b: 5 } ) aValue === undefined && !b.hasOwnProperty(key) || aValue !== b[key]) { return false; } i++; } return true; } ;// ./node_modules/@wordpress/is-shallow-equal/build-module/arrays.js /** * Returns true if the two arrays are shallow equal, or false otherwise. * * @param {any[]} a First array to compare. * @param {any[]} b Second array to compare. * * @return {boolean} Whether the two arrays are shallow equal. */ function isShallowEqualArrays(a, b) { if (a === b) { return true; } if (a.length !== b.length) { return false; } for (let i = 0, len = a.length; i < len; i++) { if (a[i] !== b[i]) { return false; } } return true; } ;// ./node_modules/@wordpress/is-shallow-equal/build-module/index.js /** * Internal dependencies */ /** * @typedef {Record<string, any>} ComparableObject */ /** * Returns true if the two arrays or objects are shallow equal, or false * otherwise. Also handles primitive values, just in case. * * @param {unknown} a First object or array to compare. * @param {unknown} b Second object or array to compare. * * @return {boolean} Whether the two values are shallow equal. */ function isShallowEqual(a, b) { if (a && b) { if (a.constructor === Object && b.constructor === Object) { return isShallowEqualObjects(a, b); } else if (Array.isArray(a) && Array.isArray(b)) { return isShallowEqualArrays(a, b); } } return a === b; } (window.wp = window.wp || {}).isShallowEqual = __webpack_exports__; /******/ })() ; dist/blocks.min.js 0000644 00000522772 15125140777 0010134 0 ustar 00 /*! This file is auto-generated */ (()=>{var e={1030:function(e,t,r){var n;/*! showdown v 1.9.1 - 02-11-2019 */ (function(){function o(e){"use strict";var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as <br> (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex: <div>foo</div>",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n].defaultValue);return r}var a={},i={},s={},c=o(!0),l="vanilla",u={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:o(!0),allOn:function(){"use strict";var e=o(!0),t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=!0);return t}()};function d(e,t){"use strict";var r=t?"Error in "+t+" extension->":"Error in unnamed extension",n={valid:!0,error:""};a.helper.isArray(e)||(e=[e]);for(var o=0;o<e.length;++o){var i=r+" sub-extension "+o+": ",s=e[o];if("object"!=typeof s)return n.valid=!1,n.error=i+"must be an object, but "+typeof s+" given",n;if(!a.helper.isString(s.type))return n.valid=!1,n.error=i+'property "type" must be a string, but '+typeof s.type+" given",n;var c=s.type=s.type.toLowerCase();if("language"===c&&(c=s.type="lang"),"html"===c&&(c=s.type="output"),"lang"!==c&&"output"!==c&&"listener"!==c)return n.valid=!1,n.error=i+"type "+c+' is not recognized. Valid values: "lang/language", "output/html" or "listener"',n;if("listener"===c){if(a.helper.isUndefined(s.listeners))return n.valid=!1,n.error=i+'. Extensions of type "listener" must have a property called "listeners"',n}else if(a.helper.isUndefined(s.filter)&&a.helper.isUndefined(s.regex))return n.valid=!1,n.error=i+c+' extensions must define either a "regex" property or a "filter" method',n;if(s.listeners){if("object"!=typeof s.listeners)return n.valid=!1,n.error=i+'"listeners" property must be an object but '+typeof s.listeners+" given",n;for(var l in s.listeners)if(s.listeners.hasOwnProperty(l)&&"function"!=typeof s.listeners[l])return n.valid=!1,n.error=i+'"listeners" property must be an hash of [event name]: [callback]. listeners.'+l+" must be a function but "+typeof s.listeners[l]+" given",n}if(s.filter){if("function"!=typeof s.filter)return n.valid=!1,n.error=i+'"filter" must be a function, but '+typeof s.filter+" given",n}else if(s.regex){if(a.helper.isString(s.regex)&&(s.regex=new RegExp(s.regex,"g")),!(s.regex instanceof RegExp))return n.valid=!1,n.error=i+'"regex" property must either be a string or a RegExp object, but '+typeof s.regex+" given",n;if(a.helper.isUndefined(s.replace))return n.valid=!1,n.error=i+'"regex" extensions must implement a replace string or function',n}}return n}function p(e,t){"use strict";return"¨E"+t.charCodeAt(0)+"E"}a.helper={},a.extensions={},a.setOption=function(e,t){"use strict";return c[e]=t,this},a.getOption=function(e){"use strict";return c[e]},a.getOptions=function(){"use strict";return c},a.resetOptions=function(){"use strict";c=o(!0)},a.setFlavor=function(e){"use strict";if(!u.hasOwnProperty(e))throw Error(e+" flavor was not found");a.resetOptions();var t=u[e];for(var r in l=e,t)t.hasOwnProperty(r)&&(c[r]=t[r])},a.getFlavor=function(){"use strict";return l},a.getFlavorOptions=function(e){"use strict";if(u.hasOwnProperty(e))return u[e]},a.getDefaultOptions=function(e){"use strict";return o(e)},a.subParser=function(e,t){"use strict";if(a.helper.isString(e)){if(void 0===t){if(i.hasOwnProperty(e))return i[e];throw Error("SubParser named "+e+" not registered!")}i[e]=t}},a.extension=function(e,t){"use strict";if(!a.helper.isString(e))throw Error("Extension 'name' must be a string");if(e=a.helper.stdExtName(e),a.helper.isUndefined(t)){if(!s.hasOwnProperty(e))throw Error("Extension named "+e+" is not registered!");return s[e]}"function"==typeof t&&(t=t()),a.helper.isArray(t)||(t=[t]);var r=d(t,e);if(!r.valid)throw Error(r.error);s[e]=t},a.getAllExtensions=function(){"use strict";return s},a.removeExtension=function(e){"use strict";delete s[e]},a.resetExtensions=function(){"use strict";s={}},a.validateExtension=function(e){"use strict";var t=d(e,null);return!!t.valid||(console.warn(t.error),!1)},a.hasOwnProperty("helper")||(a.helper={}),a.helper.isString=function(e){"use strict";return"string"==typeof e||e instanceof String},a.helper.isFunction=function(e){"use strict";return e&&"[object Function]"==={}.toString.call(e)},a.helper.isArray=function(e){"use strict";return Array.isArray(e)},a.helper.isUndefined=function(e){"use strict";return void 0===e},a.helper.forEach=function(e,t){"use strict";if(a.helper.isUndefined(e))throw new Error("obj param is required");if(a.helper.isUndefined(t))throw new Error("callback param is required");if(!a.helper.isFunction(t))throw new Error("callback param must be a function/closure");if("function"==typeof e.forEach)e.forEach(t);else if(a.helper.isArray(e))for(var r=0;r<e.length;r++)t(e[r],r,e);else{if("object"!=typeof e)throw new Error("obj does not seem to be an array or an iterable object");for(var n in e)e.hasOwnProperty(n)&&t(e[n],n,e)}},a.helper.stdExtName=function(e){"use strict";return e.replace(/[_?*+\/\\.^-]/g,"").replace(/\s/g,"").toLowerCase()},a.helper.escapeCharactersCallback=p,a.helper.escapeCharacters=function(e,t,r){"use strict";var n="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";r&&(n="\\\\"+n);var o=new RegExp(n,"g");return e=e.replace(o,p)},a.helper.unescapeHTMLEntities=function(e){"use strict";return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")};var f=function(e,t,r,n){"use strict";var o,a,i,s,c,l=n||"",u=l.indexOf("g")>-1,d=new RegExp(t+"|"+r,"g"+l.replace(/g/g,"")),p=new RegExp(t,l.replace(/g/g,"")),f=[];do{for(o=0;i=d.exec(e);)if(p.test(i[0]))o++||(s=(a=d.lastIndex)-i[0].length);else if(o&&! --o){c=i.index+i[0].length;var h={left:{start:s,end:a},match:{start:a,end:i.index},right:{start:i.index,end:c},wholeMatch:{start:s,end:c}};if(f.push(h),!u)return f}}while(o&&(d.lastIndex=a));return f};a.helper.matchRecursiveRegExp=function(e,t,r,n){"use strict";for(var o=f(e,t,r,n),a=[],i=0;i<o.length;++i)a.push([e.slice(o[i].wholeMatch.start,o[i].wholeMatch.end),e.slice(o[i].match.start,o[i].match.end),e.slice(o[i].left.start,o[i].left.end),e.slice(o[i].right.start,o[i].right.end)]);return a},a.helper.replaceRecursiveRegExp=function(e,t,r,n,o){"use strict";if(!a.helper.isFunction(t)){var i=t;t=function(){return i}}var s=f(e,r,n,o),c=e,l=s.length;if(l>0){var u=[];0!==s[0].wholeMatch.start&&u.push(e.slice(0,s[0].wholeMatch.start));for(var d=0;d<l;++d)u.push(t(e.slice(s[d].wholeMatch.start,s[d].wholeMatch.end),e.slice(s[d].match.start,s[d].match.end),e.slice(s[d].left.start,s[d].left.end),e.slice(s[d].right.start,s[d].right.end))),d<l-1&&u.push(e.slice(s[d].wholeMatch.end,s[d+1].wholeMatch.start));s[l-1].wholeMatch.end<e.length&&u.push(e.slice(s[l-1].wholeMatch.end)),c=u.join("")}return c},a.helper.regexIndexOf=function(e,t,r){"use strict";if(!a.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";if(t instanceof RegExp==!1)throw"InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";var n=e.substring(r||0).search(t);return n>=0?n+(r||0):n},a.helper.splitAtIndex=function(e,t){"use strict";if(!a.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},a.helper.encodeEmailAddress=function(e){"use strict";var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e=e.replace(/./g,(function(e){if("@"===e)e=t[Math.floor(2*Math.random())](e);else{var r=Math.random();e=r>.9?t[2](e):r>.45?t[1](e):t[0](e)}return e}))},a.helper.padEnd=function(e,t,r){"use strict";return t|=0,r=String(r||" "),e.length>t?String(e):((t-=e.length)>r.length&&(r+=r.repeat(t/r.length)),String(e)+r.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){"use strict";alert(e)},log:function(e){"use strict";alert(e)},error:function(e){"use strict";throw e}}),a.helper.regexes={asteriskDashAndColon:/([*_:~])/g},a.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:'<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',showdown:"<span style=\"font-family: 'Anonymous Pro', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;\">S</span>"},a.Converter=function(e){"use strict";var t={},r=[],n=[],o={},i=l,p={parsed:{},raw:"",format:""};function f(e,t){if(t=t||null,a.helper.isString(e)){if(t=e=a.helper.stdExtName(e),a.extensions[e])return console.warn("DEPRECATION WARNING: "+e+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),void function(e,t){"function"==typeof e&&(e=e(new a.Converter));a.helper.isArray(e)||(e=[e]);var o=d(e,t);if(!o.valid)throw Error(o.error);for(var i=0;i<e.length;++i)switch(e[i].type){case"lang":r.push(e[i]);break;case"output":n.push(e[i]);break;default:throw Error("Extension loader error: Type unrecognized!!!")}}(a.extensions[e],e);if(a.helper.isUndefined(s[e]))throw Error('Extension "'+e+'" could not be loaded. It was either not found or is not a valid extension.');e=s[e]}"function"==typeof e&&(e=e()),a.helper.isArray(e)||(e=[e]);var o=d(e,t);if(!o.valid)throw Error(o.error);for(var i=0;i<e.length;++i){switch(e[i].type){case"lang":r.push(e[i]);break;case"output":n.push(e[i])}if(e[i].hasOwnProperty("listeners"))for(var c in e[i].listeners)e[i].listeners.hasOwnProperty(c)&&h(c,e[i].listeners[c])}}function h(e,t){if(!a.helper.isString(e))throw Error("Invalid argument in converter.listen() method: name must be a string, but "+typeof e+" given");if("function"!=typeof t)throw Error("Invalid argument in converter.listen() method: callback must be a function, but "+typeof t+" given");o.hasOwnProperty(e)||(o[e]=[]),o[e].push(t)}!function(){for(var r in e=e||{},c)c.hasOwnProperty(r)&&(t[r]=c[r]);if("object"!=typeof e)throw Error("Converter expects the passed parameter to be an object, but "+typeof e+" was passed instead.");for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.extensions&&a.helper.forEach(t.extensions,f)}(),this._dispatch=function(e,t,r,n){if(o.hasOwnProperty(e))for(var a=0;a<o[e].length;++a){var i=o[e][a](e,t,this,r,n);i&&void 0!==i&&(t=i)}return t},this.listen=function(e,t){return h(e,t),this},this.makeHtml=function(e){if(!e)return e;var o={gHtmlBlocks:[],gHtmlMdBlocks:[],gHtmlSpans:[],gUrls:{},gTitles:{},gDimensions:{},gListLevel:0,hashLinkCounts:{},langExtensions:r,outputModifiers:n,converter:this,ghCodeBlocks:[],metadata:{parsed:{},raw:"",format:""}};return e=(e=(e=(e=(e=e.replace(/¨/g,"¨T")).replace(/\$/g,"¨D")).replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/\u00A0/g," "),t.smartIndentationFix&&(e=function(e){var t=e.match(/^\s*/)[0].length,r=new RegExp("^\\s{0,"+t+"}","gm");return e.replace(r,"")}(e)),e="\n\n"+e+"\n\n",e=(e=a.subParser("detab")(e,t,o)).replace(/^[ \t]+$/gm,""),a.helper.forEach(r,(function(r){e=a.subParser("runExtension")(r,e,t,o)})),e=a.subParser("metadata")(e,t,o),e=a.subParser("hashPreCodeTags")(e,t,o),e=a.subParser("githubCodeBlocks")(e,t,o),e=a.subParser("hashHTMLBlocks")(e,t,o),e=a.subParser("hashCodeTags")(e,t,o),e=a.subParser("stripLinkDefinitions")(e,t,o),e=a.subParser("blockGamut")(e,t,o),e=a.subParser("unhashHTMLSpans")(e,t,o),e=(e=(e=a.subParser("unescapeSpecialChars")(e,t,o)).replace(/¨D/g,"$$")).replace(/¨T/g,"¨"),e=a.subParser("completeHTMLDocument")(e,t,o),a.helper.forEach(n,(function(r){e=a.subParser("runExtension")(r,e,t,o)})),p=o.metadata,e},this.makeMarkdown=this.makeMd=function(e,t){if(e=(e=(e=e.replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/>[ \t]+</,">¨NBSP;<"),!t){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");t=window.document}var r=t.createElement("div");r.innerHTML=e;var n={preList:function(e){for(var t=e.querySelectorAll("pre"),r=[],n=0;n<t.length;++n)if(1===t[n].childElementCount&&"code"===t[n].firstChild.tagName.toLowerCase()){var o=t[n].firstChild.innerHTML.trim(),i=t[n].firstChild.getAttribute("data-language")||"";if(""===i)for(var s=t[n].firstChild.className.split(" "),c=0;c<s.length;++c){var l=s[c].match(/^language-(.+)$/);if(null!==l){i=l[1];break}}o=a.helper.unescapeHTMLEntities(o),r.push(o),t[n].outerHTML='<precode language="'+i+'" precodenum="'+n.toString()+'"></precode>'}else r.push(t[n].innerHTML),t[n].innerHTML="",t[n].setAttribute("prenum",n.toString());return r}(r)};!function e(t){for(var r=0;r<t.childNodes.length;++r){var n=t.childNodes[r];3===n.nodeType?/\S/.test(n.nodeValue)?(n.nodeValue=n.nodeValue.split("\n").join(" "),n.nodeValue=n.nodeValue.replace(/(\s)+/g,"$1")):(t.removeChild(n),--r):1===n.nodeType&&e(n)}}(r);for(var o=r.childNodes,i="",s=0;s<o.length;s++)i+=a.subParser("makeMarkdown.node")(o[s],n);return i},this.setOption=function(e,r){t[e]=r},this.getOption=function(e){return t[e]},this.getOptions=function(){return t},this.addExtension=function(e,t){f(e,t=t||null)},this.useExtension=function(e){f(e)},this.setFlavor=function(e){if(!u.hasOwnProperty(e))throw Error(e+" flavor was not found");var r=u[e];for(var n in i=e,r)r.hasOwnProperty(n)&&(t[n]=r[n])},this.getFlavor=function(){return i},this.removeExtension=function(e){a.helper.isArray(e)||(e=[e]);for(var t=0;t<e.length;++t){for(var o=e[t],i=0;i<r.length;++i)r[i]===o&&r[i].splice(i,1);for(;0<n.length;++i)n[0]===o&&n[0].splice(i,1)}},this.getAllExtensions=function(){return{language:r,output:n}},this.getMetadata=function(e){return e?p.raw:p.parsed},this.getMetadataFormat=function(){return p.format},this._setMetadataPair=function(e,t){p.parsed[e]=t},this._setMetadataFormat=function(e){p.format=e},this._setMetadataRaw=function(e){p.raw=e}},a.subParser("anchors",(function(e,t,r){"use strict";var n=function(e,n,o,i,s,c,l){if(a.helper.isUndefined(l)&&(l=""),o=o.toLowerCase(),e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)i="";else if(!i){if(o||(o=n.toLowerCase().replace(/ ?\n/g," ")),i="#"+o,a.helper.isUndefined(r.gUrls[o]))return e;i=r.gUrls[o],a.helper.isUndefined(r.gTitles[o])||(l=r.gTitles[o])}var u='<a href="'+(i=i.replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback))+'"';return""!==l&&null!==l&&(u+=' title="'+(l=(l=l.replace(/"/g,""")).replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback))+'"'),t.openLinksInNewWindow&&!/^#/.test(i)&&(u+=' rel="noopener noreferrer" target="¨E95Eblank"'),u+=">"+n+"</a>"};return e=(e=(e=(e=(e=r.converter._dispatch("anchors.before",e,t,r)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[([^\[\]]+)]()()()()()/g,n),t.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,(function(e,r,n,o,i){if("\\"===n)return r+o;if(!a.helper.isString(t.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var s=t.ghMentionsLink.replace(/\{u}/g,i),c="";return t.openLinksInNewWindow&&(c=' rel="noopener noreferrer" target="¨E95Eblank"'),r+'<a href="'+s+'"'+c+">"+o+"</a>"}))),e=r.converter._dispatch("anchors.after",e,t,r)}));var h=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,g=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,m=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,b=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,_=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,y=function(e){"use strict";return function(t,r,n,o,i,s,c){var l=n=n.replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback),u="",d="",p=r||"",f=c||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&s&&(u=s),e.openLinksInNewWindow&&(d=' rel="noopener noreferrer" target="¨E95Eblank"'),p+'<a href="'+n+'"'+d+">"+l+"</a>"+u+f}},k=function(e,t){"use strict";return function(r,n,o){var i="mailto:";return n=n||"",o=a.subParser("unescapeSpecialChars")(o,e,t),e.encodeEmails?(i=a.helper.encodeEmailAddress(i+o),o=a.helper.encodeEmailAddress(o)):i+=o,n+'<a href="'+i+'">'+o+"</a>"}};a.subParser("autoLinks",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("autoLinks.before",e,t,r)).replace(m,y(t))).replace(_,k(t,r)),e=r.converter._dispatch("autoLinks.after",e,t,r)})),a.subParser("simplifiedAutoLinks",(function(e,t,r){"use strict";return t.simplifiedAutoLink?(e=r.converter._dispatch("simplifiedAutoLinks.before",e,t,r),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(g,y(t)):e.replace(h,y(t))).replace(b,k(t,r)),e=r.converter._dispatch("simplifiedAutoLinks.after",e,t,r)):e})),a.subParser("blockGamut",(function(e,t,r){"use strict";return e=r.converter._dispatch("blockGamut.before",e,t,r),e=a.subParser("blockQuotes")(e,t,r),e=a.subParser("headers")(e,t,r),e=a.subParser("horizontalRule")(e,t,r),e=a.subParser("lists")(e,t,r),e=a.subParser("codeBlocks")(e,t,r),e=a.subParser("tables")(e,t,r),e=a.subParser("hashHTMLBlocks")(e,t,r),e=a.subParser("paragraphs")(e,t,r),e=r.converter._dispatch("blockGamut.after",e,t,r)})),a.subParser("blockQuotes",(function(e,t,r){"use strict";e=r.converter._dispatch("blockQuotes.before",e,t,r),e+="\n\n";var n=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(n=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(n,(function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=a.subParser("githubCodeBlocks")(e,t,r),e=(e=(e=a.subParser("blockGamut")(e,t,r)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,(function(e,t){var r=t;return r=(r=r.replace(/^ /gm,"¨0")).replace(/¨0/g,"")})),a.subParser("hashBlock")("<blockquote>\n"+e+"\n</blockquote>",t,r)})),e=r.converter._dispatch("blockQuotes.after",e,t,r)})),a.subParser("codeBlocks",(function(e,t,r){"use strict";e=r.converter._dispatch("codeBlocks.before",e,t,r);return e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,(function(e,n,o){var i=n,s=o,c="\n";return i=a.subParser("outdent")(i,t,r),i=a.subParser("encodeCode")(i,t,r),i=(i=(i=a.subParser("detab")(i,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(c=""),i="<pre><code>"+i+c+"</code></pre>",a.subParser("hashBlock")(i,t,r)+s}))).replace(/¨0/,""),e=r.converter._dispatch("codeBlocks.after",e,t,r)})),a.subParser("codeSpans",(function(e,t,r){"use strict";return void 0===(e=r.converter._dispatch("codeSpans.before",e,t,r))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,(function(e,n,o,i){var s=i;return s=(s=s.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),s=n+"<code>"+(s=a.subParser("encodeCode")(s,t,r))+"</code>",s=a.subParser("hashHTMLSpans")(s,t,r)})),e=r.converter._dispatch("codeSpans.after",e,t,r)})),a.subParser("completeHTMLDocument",(function(e,t,r){"use strict";if(!t.completeHTMLDocument)return e;e=r.converter._dispatch("completeHTMLDocument.before",e,t,r);var n="html",o="<!DOCTYPE HTML>\n",a="",i='<meta charset="utf-8">\n',s="",c="";for(var l in void 0!==r.metadata.parsed.doctype&&(o="<!DOCTYPE "+r.metadata.parsed.doctype+">\n","html"!==(n=r.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==n||(i='<meta charset="utf-8">')),r.metadata.parsed)if(r.metadata.parsed.hasOwnProperty(l))switch(l.toLowerCase()){case"doctype":break;case"title":a="<title>"+r.metadata.parsed.title+"</title>\n";break;case"charset":i="html"===n||"html5"===n?'<meta charset="'+r.metadata.parsed.charset+'">\n':'<meta name="charset" content="'+r.metadata.parsed.charset+'">\n';break;case"language":case"lang":s=' lang="'+r.metadata.parsed[l]+'"',c+='<meta name="'+l+'" content="'+r.metadata.parsed[l]+'">\n';break;default:c+='<meta name="'+l+'" content="'+r.metadata.parsed[l]+'">\n'}return e=o+"<html"+s+">\n<head>\n"+a+i+c+"</head>\n<body>\n"+e.trim()+"\n</body>\n</html>",e=r.converter._dispatch("completeHTMLDocument.after",e,t,r)})),a.subParser("detab",(function(e,t,r){"use strict";return e=(e=(e=(e=(e=(e=r.converter._dispatch("detab.before",e,t,r)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,(function(e,t){for(var r=t,n=4-r.length%4,o=0;o<n;o++)r+=" ";return r}))).replace(/¨A/g," ")).replace(/¨B/g,""),e=r.converter._dispatch("detab.after",e,t,r)})),a.subParser("ellipsis",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("ellipsis.before",e,t,r)).replace(/\.\.\./g,"…"),e=r.converter._dispatch("ellipsis.after",e,t,r)})),a.subParser("emoji",(function(e,t,r){"use strict";if(!t.emoji)return e;return e=(e=r.converter._dispatch("emoji.before",e,t,r)).replace(/:([\S]+?):/g,(function(e,t){return a.helper.emojis.hasOwnProperty(t)?a.helper.emojis[t]:e})),e=r.converter._dispatch("emoji.after",e,t,r)})),a.subParser("encodeAmpsAndAngles",(function(e,t,r){"use strict";return e=(e=(e=(e=(e=r.converter._dispatch("encodeAmpsAndAngles.before",e,t,r)).replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&")).replace(/<(?![a-z\/?$!])/gi,"<")).replace(/</g,"<")).replace(/>/g,">"),e=r.converter._dispatch("encodeAmpsAndAngles.after",e,t,r)})),a.subParser("encodeBackslashEscapes",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("encodeBackslashEscapes.before",e,t,r)).replace(/\\(\\)/g,a.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,a.helper.escapeCharactersCallback),e=r.converter._dispatch("encodeBackslashEscapes.after",e,t,r)})),a.subParser("encodeCode",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("encodeCode.before",e,t,r)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/([*_{}\[\]\\=~-])/g,a.helper.escapeCharactersCallback),e=r.converter._dispatch("encodeCode.after",e,t,r)})),a.subParser("escapeSpecialCharsWithinTagAttributes",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,r)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,(function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,a.helper.escapeCharactersCallback)}))).replace(/<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,(function(e){return e.replace(/([\\`*_~=|])/g,a.helper.escapeCharactersCallback)})),e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,r)})),a.subParser("githubCodeBlocks",(function(e,t,r){"use strict";return t.ghCodeBlocks?(e=r.converter._dispatch("githubCodeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,(function(e,n,o,i){var s=t.omitExtraWLInCodeBlocks?"":"\n";return i=a.subParser("encodeCode")(i,t,r),i="<pre><code"+(o?' class="'+o+" language-"+o+'"':"")+">"+(i=(i=(i=a.subParser("detab")(i,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""))+s+"</code></pre>",i=a.subParser("hashBlock")(i,t,r),"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:i})-1)+"G\n\n"}))).replace(/¨0/,""),r.converter._dispatch("githubCodeBlocks.after",e,t,r)):e})),a.subParser("hashBlock",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("hashBlock.before",e,t,r)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n",e=r.converter._dispatch("hashBlock.after",e,t,r)})),a.subParser("hashCodeTags",(function(e,t,r){"use strict";e=r.converter._dispatch("hashCodeTags.before",e,t,r);return e=a.helper.replaceRecursiveRegExp(e,(function(e,n,o,i){var s=o+a.subParser("encodeCode")(n,t,r)+i;return"¨C"+(r.gHtmlSpans.push(s)-1)+"C"}),"<code\\b[^>]*>","</code>","gim"),e=r.converter._dispatch("hashCodeTags.after",e,t,r)})),a.subParser("hashElement",(function(e,t,r){"use strict";return function(e,t){var n=t;return n=(n=(n=n.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),n="\n\n¨K"+(r.gHtmlBlocks.push(n)-1)+"K\n\n"}})),a.subParser("hashHTMLBlocks",(function(e,t,r){"use strict";e=r.converter._dispatch("hashHTMLBlocks.before",e,t,r);var n=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],o=function(e,t,n,o){var a=e;return-1!==n.search(/\bmarkdown\b/)&&(a=n+r.converter.makeHtml(t)+o),"\n\n¨K"+(r.gHtmlBlocks.push(a)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,(function(e,t){return"<"+t+">"})));for(var i=0;i<n.length;++i)for(var s,c=new RegExp("^ {0,3}(<"+n[i]+"\\b[^>]*>)","im"),l="<"+n[i]+"\\b[^>]*>",u="</"+n[i]+">";-1!==(s=a.helper.regexIndexOf(e,c));){var d=a.helper.splitAtIndex(e,s),p=a.helper.replaceRecursiveRegExp(d[1],o,l,u,"im");if(p===d[1])break;e=d[0].concat(p)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,a.subParser("hashElement")(e,t,r)),e=(e=a.helper.replaceRecursiveRegExp(e,(function(e){return"\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n"}),"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,a.subParser("hashElement")(e,t,r)),e=r.converter._dispatch("hashHTMLBlocks.after",e,t,r)})),a.subParser("hashHTMLSpans",(function(e,t,r){"use strict";function n(e){return"¨C"+(r.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=r.converter._dispatch("hashHTMLSpans.before",e,t,r)).replace(/<[^>]+?\/>/gi,(function(e){return n(e)}))).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,(function(e){return n(e)}))).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,(function(e){return n(e)}))).replace(/<[^>]+?>/gi,(function(e){return n(e)})),e=r.converter._dispatch("hashHTMLSpans.after",e,t,r)})),a.subParser("unhashHTMLSpans",(function(e,t,r){"use strict";e=r.converter._dispatch("unhashHTMLSpans.before",e,t,r);for(var n=0;n<r.gHtmlSpans.length;++n){for(var o=r.gHtmlSpans[n],a=0;/¨C(\d+)C/.test(o);){var i=RegExp.$1;if(o=o.replace("¨C"+i+"C",r.gHtmlSpans[i]),10===a){console.error("maximum nesting of 10 spans reached!!!");break}++a}e=e.replace("¨C"+n+"C",o)}return e=r.converter._dispatch("unhashHTMLSpans.after",e,t,r)})),a.subParser("hashPreCodeTags",(function(e,t,r){"use strict";e=r.converter._dispatch("hashPreCodeTags.before",e,t,r);return e=a.helper.replaceRecursiveRegExp(e,(function(e,n,o,i){var s=o+a.subParser("encodeCode")(n,t,r)+i;return"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:s})-1)+"G\n\n"}),"^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>","^ {0,3}</code>\\s*</pre>","gim"),e=r.converter._dispatch("hashPreCodeTags.after",e,t,r)})),a.subParser("headers",(function(e,t,r){"use strict";e=r.converter._dispatch("headers.before",e,t,r);var n=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),o=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,i=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,(function(e,o){var i=a.subParser("spanGamut")(o,t,r),s=t.noHeaderId?"":' id="'+c(o)+'"',l="<h"+n+s+">"+i+"</h"+n+">";return a.subParser("hashBlock")(l,t,r)}))).replace(i,(function(e,o){var i=a.subParser("spanGamut")(o,t,r),s=t.noHeaderId?"":' id="'+c(o)+'"',l=n+1,u="<h"+l+s+">"+i+"</h"+l+">";return a.subParser("hashBlock")(u,t,r)}));var s=t.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;function c(e){var n,o;if(t.customizedHeaderId){var i=e.match(/\{([^{]+?)}\s*$/);i&&i[1]&&(e=i[1])}return n=e,o=a.helper.isString(t.prefixHeaderId)?t.prefixHeaderId:!0===t.prefixHeaderId?"section-":"",t.rawPrefixHeaderId||(n=o+n),n=t.ghCompatibleHeaderId?n.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():t.rawHeaderId?n.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():n.replace(/[^\w]/g,"").toLowerCase(),t.rawPrefixHeaderId&&(n=o+n),r.hashLinkCounts[n]?n=n+"-"+r.hashLinkCounts[n]++:r.hashLinkCounts[n]=1,n}return e=e.replace(s,(function(e,o,i){var s=i;t.customizedHeaderId&&(s=i.replace(/\s?\{([^{]+?)}\s*$/,""));var l=a.subParser("spanGamut")(s,t,r),u=t.noHeaderId?"":' id="'+c(i)+'"',d=n-1+o.length,p="<h"+d+u+">"+l+"</h"+d+">";return a.subParser("hashBlock")(p,t,r)})),e=r.converter._dispatch("headers.after",e,t,r)})),a.subParser("horizontalRule",(function(e,t,r){"use strict";e=r.converter._dispatch("horizontalRule.before",e,t,r);var n=a.subParser("hashBlock")("<hr />",t,r);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,n),e=r.converter._dispatch("horizontalRule.after",e,t,r)})),a.subParser("images",(function(e,t,r){"use strict";function n(e,t,n,o,i,s,c,l){var u=r.gUrls,d=r.gTitles,p=r.gDimensions;if(n=n.toLowerCase(),l||(l=""),e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)o="";else if(""===o||null===o){if(""!==n&&null!==n||(n=t.toLowerCase().replace(/ ?\n/g," ")),o="#"+n,a.helper.isUndefined(u[n]))return e;o=u[n],a.helper.isUndefined(d[n])||(l=d[n]),a.helper.isUndefined(p[n])||(i=p[n].width,s=p[n].height)}t=t.replace(/"/g,""").replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback);var f='<img src="'+(o=o.replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback))+'" alt="'+t+'"';return l&&a.helper.isString(l)&&(f+=' title="'+(l=l.replace(/"/g,""").replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback))+'"'),i&&s&&(f+=' width="'+(i="*"===i?"auto":i)+'"',f+=' height="'+(s="*"===s?"auto":s)+'"'),f+=" />"}return e=(e=(e=(e=(e=(e=r.converter._dispatch("images.before",e,t,r)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,(function(e,t,r,o,a,i,s,c){return n(e,t,r,o=o.replace(/\s/g,""),a,i,s,c)}))).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,n)).replace(/!\[([^\[\]]+)]()()()()()/g,n),e=r.converter._dispatch("images.after",e,t,r)})),a.subParser("italicsAndBold",(function(e,t,r){"use strict";function n(e,t,r){return t+e+r}return e=r.converter._dispatch("italicsAndBold.before",e,t,r),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,(function(e,t){return n(t,"<strong><em>","</em></strong>")}))).replace(/\b__(\S[\s\S]*?)__\b/g,(function(e,t){return n(t,"<strong>","</strong>")}))).replace(/\b_(\S[\s\S]*?)_\b/g,(function(e,t){return n(t,"<em>","</em>")})):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong><em>","</em></strong>"):e}))).replace(/__(\S[\s\S]*?)__/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong>","</strong>"):e}))).replace(/_([^\s_][\s\S]*?)_/g,(function(e,t){return/\S$/.test(t)?n(t,"<em>","</em>"):e})),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,(function(e,t,r){return n(r,t+"<strong><em>","</em></strong>")}))).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,(function(e,t,r){return n(r,t+"<strong>","</strong>")}))).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,(function(e,t,r){return n(r,t+"<em>","</em>")})):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong><em>","</em></strong>"):e}))).replace(/\*\*(\S[\s\S]*?)\*\*/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong>","</strong>"):e}))).replace(/\*([^\s*][\s\S]*?)\*/g,(function(e,t){return/\S$/.test(t)?n(t,"<em>","</em>"):e})),e=r.converter._dispatch("italicsAndBold.after",e,t,r)})),a.subParser("lists",(function(e,t,r){"use strict";function n(e,n){r.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var o=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,i=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return t.disableForced4SpacesIndentedSublists&&(o=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(o,(function(e,n,o,s,c,l,u){u=u&&""!==u.trim();var d=a.subParser("outdent")(c,t,r),p="";return l&&t.tasklists&&(p=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,(function(){var e='<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';return u&&(e+=" checked"),e+=">"}))),d=d.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,(function(e){return"¨A"+e})),n||d.search(/\n{2,}/)>-1?(d=a.subParser("githubCodeBlocks")(d,t,r),d=a.subParser("blockGamut")(d,t,r)):(d=(d=a.subParser("lists")(d,t,r)).replace(/\n$/,""),d=(d=a.subParser("hashHTMLBlocks")(d,t,r)).replace(/\n\n+/g,"\n\n"),d=i?a.subParser("paragraphs")(d,t,r):a.subParser("spanGamut")(d,t,r)),d="<li"+p+">"+(d=d.replace("¨A",""))+"</li>\n"}))).replace(/¨0/g,""),r.gListLevel--,n&&(e=e.replace(/\s+$/,"")),e}function o(e,t){if("ol"===t){var r=e.match(/^ *(\d+)\./);if(r&&"1"!==r[1])return' start="'+r[1]+'"'}return""}function i(e,r,a){var i=t.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,s=t.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,c="ul"===r?i:s,l="";if(-1!==e.search(c))!function t(u){var d=u.search(c),p=o(e,r);-1!==d?(l+="\n\n<"+r+p+">\n"+n(u.slice(0,d),!!a)+"</"+r+">\n",c="ul"===(r="ul"===r?"ol":"ul")?i:s,t(u.slice(d))):l+="\n\n<"+r+p+">\n"+n(u,!!a)+"</"+r+">\n"}(e);else{var u=o(e,r);l="\n\n<"+r+u+">\n"+n(e,!!a)+"</"+r+">\n"}return l}return e=r.converter._dispatch("lists.before",e,t,r),e+="¨0",e=(e=r.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,(function(e,t,r){return i(t,r.search(/[*+-]/g)>-1?"ul":"ol",!0)})):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,(function(e,t,r,n){return i(r,n.search(/[*+-]/g)>-1?"ul":"ol",!1)}))).replace(/¨0/,""),e=r.converter._dispatch("lists.after",e,t,r)})),a.subParser("metadata",(function(e,t,r){"use strict";if(!t.metadata)return e;function n(e){r.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,(function(e,t,n){return r.metadata.parsed[t]=n,""}))}return e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,(function(e,t,r){return n(r),"¨M"}))).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,(function(e,t,o){return t&&(r.metadata.format=t),n(o),"¨M"}))).replace(/¨M/g,""),e=r.converter._dispatch("metadata.after",e,t,r)})),a.subParser("outdent",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("outdent.before",e,t,r)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),e=r.converter._dispatch("outdent.after",e,t,r)})),a.subParser("paragraphs",(function(e,t,r){"use strict";for(var n=(e=(e=(e=r.converter._dispatch("paragraphs.before",e,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),o=[],i=n.length,s=0;s<i;s++){var c=n[s];c.search(/¨(K|G)(\d+)\1/g)>=0?o.push(c):c.search(/\S/)>=0&&(c=(c=a.subParser("spanGamut")(c,t,r)).replace(/^([ \t]*)/g,"<p>"),c+="</p>",o.push(c))}for(i=o.length,s=0;s<i;s++){for(var l="",u=o[s],d=!1;/¨(K|G)(\d+)\1/.test(u);){var p=RegExp.$1,f=RegExp.$2;l=(l="K"===p?r.gHtmlBlocks[f]:d?a.subParser("encodeCode")(r.ghCodeBlocks[f].text,t,r):r.ghCodeBlocks[f].codeblock).replace(/\$/g,"$$$$"),u=u.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/,l),/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(u)&&(d=!0)}o[s]=u}return e=(e=(e=o.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),r.converter._dispatch("paragraphs.after",e,t,r)})),a.subParser("runExtension",(function(e,t,r,n){"use strict";if(e.filter)t=e.filter(t,n.converter,r);else if(e.regex){var o=e.regex;o instanceof RegExp||(o=new RegExp(o,"g")),t=t.replace(o,e.replace)}return t})),a.subParser("spanGamut",(function(e,t,r){"use strict";return e=r.converter._dispatch("spanGamut.before",e,t,r),e=a.subParser("codeSpans")(e,t,r),e=a.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,r),e=a.subParser("encodeBackslashEscapes")(e,t,r),e=a.subParser("images")(e,t,r),e=a.subParser("anchors")(e,t,r),e=a.subParser("autoLinks")(e,t,r),e=a.subParser("simplifiedAutoLinks")(e,t,r),e=a.subParser("emoji")(e,t,r),e=a.subParser("underline")(e,t,r),e=a.subParser("italicsAndBold")(e,t,r),e=a.subParser("strikethrough")(e,t,r),e=a.subParser("ellipsis")(e,t,r),e=a.subParser("hashHTMLSpans")(e,t,r),e=a.subParser("encodeAmpsAndAngles")(e,t,r),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"<br />\n")):e=e.replace(/ +\n/g,"<br />\n"),e=r.converter._dispatch("spanGamut.after",e,t,r)})),a.subParser("strikethrough",(function(e,t,r){"use strict";return t.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,t,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,(function(e,n){return function(e){return t.simplifiedAutoLink&&(e=a.subParser("simplifiedAutoLinks")(e,t,r)),"<del>"+e+"</del>"}(n)})),e=r.converter._dispatch("strikethrough.after",e,t,r)),e})),a.subParser("stripLinkDefinitions",(function(e,t,r){"use strict";var n=function(e,n,o,i,s,c,l){return n=n.toLowerCase(),o.match(/^data:.+?\/.+?;base64,/)?r.gUrls[n]=o.replace(/\s/g,""):r.gUrls[n]=a.subParser("encodeAmpsAndAngles")(o,t,r),c?c+l:(l&&(r.gTitles[n]=l.replace(/"|'/g,""")),t.parseImgDimensions&&i&&s&&(r.gDimensions[n]={width:i,height:s}),"")};return e=(e=(e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,n)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,n)).replace(/¨0/,"")})),a.subParser("tables",(function(e,t,r){"use strict";if(!t.tables)return e;function n(e,n){return"<td"+n+">"+a.subParser("spanGamut")(e,t,r)+"</td>\n"}function o(e){var o,i=e.split("\n");for(o=0;o<i.length;++o)/^ {0,3}\|/.test(i[o])&&(i[o]=i[o].replace(/^ {0,3}\|/,"")),/\|[ \t]*$/.test(i[o])&&(i[o]=i[o].replace(/\|[ \t]*$/,"")),i[o]=a.subParser("codeSpans")(i[o],t,r);var s,c,l,u,d=i[0].split("|").map((function(e){return e.trim()})),p=i[1].split("|").map((function(e){return e.trim()})),f=[],h=[],g=[],m=[];for(i.shift(),i.shift(),o=0;o<i.length;++o)""!==i[o].trim()&&f.push(i[o].split("|").map((function(e){return e.trim()})));if(d.length<p.length)return e;for(o=0;o<p.length;++o)g.push((s=p[o],/^:[ \t]*--*$/.test(s)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(s)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(s)?' style="text-align:center;"':""));for(o=0;o<d.length;++o)a.helper.isUndefined(g[o])&&(g[o]=""),h.push((c=d[o],l=g[o],u=void 0,u="",c=c.trim(),(t.tablesHeaderId||t.tableHeaderId)&&(u=' id="'+c.replace(/ /g,"_").toLowerCase()+'"'),"<th"+u+l+">"+(c=a.subParser("spanGamut")(c,t,r))+"</th>\n"));for(o=0;o<f.length;++o){for(var b=[],_=0;_<h.length;++_)a.helper.isUndefined(f[o][_]),b.push(n(f[o][_],g[_]));m.push(b)}return function(e,t){for(var r="<table>\n<thead>\n<tr>\n",n=e.length,o=0;o<n;++o)r+=e[o];for(r+="</tr>\n</thead>\n<tbody>\n",o=0;o<t.length;++o){r+="<tr>\n";for(var a=0;a<n;++a)r+=t[o][a];r+="</tr>\n"}return r+"</tbody>\n</table>\n"}(h,m)}return e=(e=(e=(e=r.converter._dispatch("tables.before",e,t,r)).replace(/\\(\|)/g,a.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,o)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,o),e=r.converter._dispatch("tables.after",e,t,r)})),a.subParser("underline",(function(e,t,r){"use strict";return t.underline?(e=r.converter._dispatch("underline.before",e,t,r),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,(function(e,t){return"<u>"+t+"</u>"}))).replace(/\b__(\S[\s\S]*?)__\b/g,(function(e,t){return"<u>"+t+"</u>"})):(e=e.replace(/___(\S[\s\S]*?)___/g,(function(e,t){return/\S$/.test(t)?"<u>"+t+"</u>":e}))).replace(/__(\S[\s\S]*?)__/g,(function(e,t){return/\S$/.test(t)?"<u>"+t+"</u>":e}))).replace(/(_)/g,a.helper.escapeCharactersCallback),e=r.converter._dispatch("underline.after",e,t,r)):e})),a.subParser("unescapeSpecialChars",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("unescapeSpecialChars.before",e,t,r)).replace(/¨E(\d+)E/g,(function(e,t){var r=parseInt(t);return String.fromCharCode(r)})),e=r.converter._dispatch("unescapeSpecialChars.after",e,t,r)})),a.subParser("makeMarkdown.blockquote",(function(e,t){"use strict";var r="";if(e.hasChildNodes())for(var n=e.childNodes,o=n.length,i=0;i<o;++i){var s=a.subParser("makeMarkdown.node")(n[i],t);""!==s&&(r+=s)}return r="> "+(r=r.trim()).split("\n").join("\n> ")})),a.subParser("makeMarkdown.codeBlock",(function(e,t){"use strict";var r=e.getAttribute("language"),n=e.getAttribute("precodenum");return"```"+r+"\n"+t.preList[n]+"\n```"})),a.subParser("makeMarkdown.codeSpan",(function(e){"use strict";return"`"+e.innerHTML+"`"})),a.subParser("makeMarkdown.emphasis",(function(e,t){"use strict";var r="";if(e.hasChildNodes()){r+="*";for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);r+="*"}return r})),a.subParser("makeMarkdown.header",(function(e,t,r){"use strict";var n=new Array(r+1).join("#"),o="";if(e.hasChildNodes()){o=n+" ";for(var i=e.childNodes,s=i.length,c=0;c<s;++c)o+=a.subParser("makeMarkdown.node")(i[c],t)}return o})),a.subParser("makeMarkdown.hr",(function(){"use strict";return"---"})),a.subParser("makeMarkdown.image",(function(e){"use strict";var t="";return e.hasAttribute("src")&&(t+="+">",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t})),a.subParser("makeMarkdown.links",(function(e,t){"use strict";var r="";if(e.hasChildNodes()&&e.hasAttribute("href")){var n=e.childNodes,o=n.length;r="[";for(var i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);r+="](",r+="<"+e.getAttribute("href")+">",e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r})),a.subParser("makeMarkdown.list",(function(e,t,r){"use strict";var n="";if(!e.hasChildNodes())return"";for(var o=e.childNodes,i=o.length,s=e.getAttribute("start")||1,c=0;c<i;++c)if(void 0!==o[c].tagName&&"li"===o[c].tagName.toLowerCase()){n+=("ol"===r?s.toString()+". ":"- ")+a.subParser("makeMarkdown.listItem")(o[c],t),++s}return(n+="\n\x3c!-- --\x3e\n").trim()})),a.subParser("makeMarkdown.listItem",(function(e,t){"use strict";for(var r="",n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);return/\n$/.test(r)?r=r.split("\n").join("\n ").replace(/^ {4}$/gm,"").replace(/\n\n+/g,"\n\n"):r+="\n",r})),a.subParser("makeMarkdown.node",(function(e,t,r){"use strict";r=r||!1;var n="";if(3===e.nodeType)return a.subParser("makeMarkdown.txt")(e,t);if(8===e.nodeType)return"\x3c!--"+e.data+"--\x3e\n\n";if(1!==e.nodeType)return"";switch(e.tagName.toLowerCase()){case"h1":r||(n=a.subParser("makeMarkdown.header")(e,t,1)+"\n\n");break;case"h2":r||(n=a.subParser("makeMarkdown.header")(e,t,2)+"\n\n");break;case"h3":r||(n=a.subParser("makeMarkdown.header")(e,t,3)+"\n\n");break;case"h4":r||(n=a.subParser("makeMarkdown.header")(e,t,4)+"\n\n");break;case"h5":r||(n=a.subParser("makeMarkdown.header")(e,t,5)+"\n\n");break;case"h6":r||(n=a.subParser("makeMarkdown.header")(e,t,6)+"\n\n");break;case"p":r||(n=a.subParser("makeMarkdown.paragraph")(e,t)+"\n\n");break;case"blockquote":r||(n=a.subParser("makeMarkdown.blockquote")(e,t)+"\n\n");break;case"hr":r||(n=a.subParser("makeMarkdown.hr")(e,t)+"\n\n");break;case"ol":r||(n=a.subParser("makeMarkdown.list")(e,t,"ol")+"\n\n");break;case"ul":r||(n=a.subParser("makeMarkdown.list")(e,t,"ul")+"\n\n");break;case"precode":r||(n=a.subParser("makeMarkdown.codeBlock")(e,t)+"\n\n");break;case"pre":r||(n=a.subParser("makeMarkdown.pre")(e,t)+"\n\n");break;case"table":r||(n=a.subParser("makeMarkdown.table")(e,t)+"\n\n");break;case"code":n=a.subParser("makeMarkdown.codeSpan")(e,t);break;case"em":case"i":n=a.subParser("makeMarkdown.emphasis")(e,t);break;case"strong":case"b":n=a.subParser("makeMarkdown.strong")(e,t);break;case"del":n=a.subParser("makeMarkdown.strikethrough")(e,t);break;case"a":n=a.subParser("makeMarkdown.links")(e,t);break;case"img":n=a.subParser("makeMarkdown.image")(e,t);break;default:n=e.outerHTML+"\n\n"}return n})),a.subParser("makeMarkdown.paragraph",(function(e,t){"use strict";var r="";if(e.hasChildNodes())for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);return r=r.trim()})),a.subParser("makeMarkdown.pre",(function(e,t){"use strict";var r=e.getAttribute("prenum");return"<pre>"+t.preList[r]+"</pre>"})),a.subParser("makeMarkdown.strikethrough",(function(e,t){"use strict";var r="";if(e.hasChildNodes()){r+="~~";for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);r+="~~"}return r})),a.subParser("makeMarkdown.strong",(function(e,t){"use strict";var r="";if(e.hasChildNodes()){r+="**";for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);r+="**"}return r})),a.subParser("makeMarkdown.table",(function(e,t){"use strict";var r,n,o="",i=[[],[]],s=e.querySelectorAll("thead>tr>th"),c=e.querySelectorAll("tbody>tr");for(r=0;r<s.length;++r){var l=a.subParser("makeMarkdown.tableCell")(s[r],t),u="---";if(s[r].hasAttribute("style"))switch(s[r].getAttribute("style").toLowerCase().replace(/\s/g,"")){case"text-align:left;":u=":---";break;case"text-align:right;":u="---:";break;case"text-align:center;":u=":---:"}i[0][r]=l.trim(),i[1][r]=u}for(r=0;r<c.length;++r){var d=i.push([])-1,p=c[r].getElementsByTagName("td");for(n=0;n<s.length;++n){var f=" ";void 0!==p[n]&&(f=a.subParser("makeMarkdown.tableCell")(p[n],t)),i[d].push(f)}}var h=3;for(r=0;r<i.length;++r)for(n=0;n<i[r].length;++n){var g=i[r][n].length;g>h&&(h=g)}for(r=0;r<i.length;++r){for(n=0;n<i[r].length;++n)1===r?":"===i[r][n].slice(-1)?i[r][n]=a.helper.padEnd(i[r][n].slice(-1),h-1,"-")+":":i[r][n]=a.helper.padEnd(i[r][n],h,"-"):i[r][n]=a.helper.padEnd(i[r][n],h);o+="| "+i[r].join(" | ")+" |\n"}return o.trim()})),a.subParser("makeMarkdown.tableCell",(function(e,t){"use strict";var r="";if(!e.hasChildNodes())return"";for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t,!0);return r.trim()})),a.subParser("makeMarkdown.txt",(function(e){"use strict";var t=e.nodeValue;return t=(t=t.replace(/ +/g," ")).replace(/¨NBSP;/g," "),t=(t=(t=(t=(t=(t=(t=(t=(t=a.helper.unescapeHTMLEntities(t)).replace(/([*_~|`])/g,"\\$1")).replace(/^(\s*)>/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}));void 0===(n=function(){"use strict";return a}.call(t,r,t,e))||(e.exports=n)}).call(this)},5373:(e,t)=>{"use strict";var r,n=Symbol.for("react.element"),o=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.server_context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"); /** * @license React * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function b(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case a:case s:case i:case p:case f:return e;default:switch(e=e&&e.$$typeof){case u:case l:case d:case g:case h:case c:return e;default:return t}}case o:return t}}}r=Symbol.for("react.module.reference"),t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===s||e===i||e===p||e===f||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===c||e.$$typeof===l||e.$$typeof===d||e.$$typeof===r||void 0!==e.getModuleId)}},7734:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,a;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(o of t.entries())if(!r.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],r.get(o[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(o of t.entries())if(!r.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(t[o]!==r[o])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,a[o]))return!1;for(o=n;0!=o--;){var i=a[o];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r}},8529:(e,t,r)=>{"use strict";e.exports=r(5373)},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},r=Object.keys(t).join("|"),n=new RegExp(r,"g"),o=new RegExp(r,"");function a(e){return t[e]}var i=function(e){return e.replace(n,a)};e.exports=i,e.exports.has=function(e){return!!e.match(o)},e.exports.remove=i}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.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})};var n={};(()=>{"use strict";r.r(n),r.d(n,{__EXPERIMENTAL_ELEMENTS:()=>ee,__EXPERIMENTAL_PATHS_WITH_OVERRIDE:()=>te,__EXPERIMENTAL_STYLE_PROPERTY:()=>J,__experimentalCloneSanitizedBlock:()=>xr,__experimentalGetAccessibleBlockLabel:()=>Ge,__experimentalGetBlockAttributesNamesByRole:()=>Ze,__experimentalGetBlockLabel:()=>qe,__experimentalSanitizeBlockAttributes:()=>Ye,__unstableGetBlockProps:()=>Wr,__unstableGetInnerBlocksProps:()=>Yr,__unstableSerializeAndClean:()=>tn,children:()=>Jn,cloneBlock:()=>Er,createBlock:()=>Tr,createBlocksFromInnerBlocksTemplate:()=>Cr,doBlocksMatchTemplate:()=>ia,findTransform:()=>Lr,getBlockAttributes:()=>ao,getBlockAttributesNamesByRole:()=>Qe,getBlockBindingsSource:()=>ze,getBlockBindingsSources:()=>Ie,getBlockContent:()=>Xr,getBlockDefaultClassName:()=>Fr,getBlockFromExample:()=>zr,getBlockMenuDefaultClassName:()=>qr,getBlockSupport:()=>Te,getBlockTransforms:()=>Mr,getBlockType:()=>we,getBlockTypes:()=>ve,getBlockVariations:()=>Oe,getCategories:()=>na,getChildBlockNames:()=>Se,getDefaultBlockName:()=>ke,getFreeformContentHandlerName:()=>he,getGroupingBlockName:()=>ge,getPhrasingContentSchema:()=>Lo,getPossibleBlockTransformations:()=>Or,getSaveContent:()=>Zr,getSaveElement:()=>Qr,getUnregisteredTypeHandlerName:()=>be,hasBlockSupport:()=>Ce,hasChildBlocks:()=>Be,hasChildBlocksWithInserterSupport:()=>Ae,isReusableBlock:()=>xe,isTemplatePart:()=>Ee,isUnmodifiedBlock:()=>He,isUnmodifiedDefaultBlock:()=>Ve,isValidBlockContent:()=>Hn,isValidIcon:()=>$e,node:()=>Yn,normalizeIconObject:()=>Ue,parse:()=>ho,parseWithAttributeSchema:()=>oo,pasteHandler:()=>ra,privateApis:()=>pa,rawHandler:()=>Mo,registerBlockBindingsSource:()=>je,registerBlockCollection:()=>de,registerBlockStyle:()=>Ne,registerBlockType:()=>le,registerBlockVariation:()=>Le,serialize:()=>rn,serializeRawBlock:()=>$r,setCategories:()=>oa,setDefaultBlockName:()=>_e,setFreeformContentHandlerName:()=>fe,setGroupingBlockName:()=>ye,setUnregisteredTypeHandlerName:()=>me,store:()=>gr,switchToBlockType:()=>Dr,synchronizeBlocksWithTemplate:()=>da,unregisterBlockBindingsSource:()=>De,unregisterBlockStyle:()=>Pe,unregisterBlockType:()=>pe,unregisterBlockVariation:()=>Me,unstable__bootstrapServerSideBlockDefinitions:()=>se,updateCategory:()=>aa,validateBlock:()=>Rn,withBlockContentContext:()=>fa});var e={};r.r(e),r.d(e,{getAllBlockBindingsSources:()=>yt,getBlockBindingsSource:()=>kt,getBootstrappedBlockType:()=>bt,getSupportedStyles:()=>mt,getUnprocessedBlockTypes:()=>_t,hasContentRoleAttribute:()=>wt});var t={};r.r(t),r.d(t,{__experimentalHasContentRoleAttribute:()=>$t,getActiveBlockVariation:()=>St,getBlockStyles:()=>xt,getBlockSupport:()=>Dt,getBlockType:()=>Ct,getBlockTypes:()=>Tt,getBlockVariations:()=>Et,getCategories:()=>At,getChildBlockNames:()=>jt,getCollections:()=>Nt,getDefaultBlockName:()=>Pt,getDefaultBlockVariation:()=>Bt,getFreeformFallbackBlockName:()=>Ot,getGroupingBlockName:()=>Mt,getUnregisteredFallbackBlockName:()=>Lt,hasBlockSupport:()=>zt,hasChildBlocks:()=>Ht,hasChildBlocksWithInserterSupport:()=>Vt,isMatchingSearchTerm:()=>Rt});var o={};r.r(o),r.d(o,{__experimentalReapplyBlockFilters:()=>Zt,addBlockCollection:()=>lr,addBlockStyles:()=>Jt,addBlockTypes:()=>Yt,addBlockVariations:()=>tr,reapplyBlockTypeFilters:()=>Qt,removeBlockCollection:()=>ur,removeBlockStyles:()=>er,removeBlockTypes:()=>Xt,removeBlockVariations:()=>rr,setCategories:()=>sr,setDefaultBlockName:()=>nr,setFreeformFallbackBlockName:()=>or,setGroupingBlockName:()=>ir,setUnregisteredFallbackBlockName:()=>ar,updateCategory:()=>cr});var a={};r.r(a),r.d(a,{addBlockBindingsSource:()=>fr,addBootstrappedBlockType:()=>dr,addUnprocessedBlockType:()=>pr,removeBlockBindingsSource:()=>hr});const i=window.wp.data;var s=function(){return s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function c(e){return e.toLowerCase()}var l=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],u=/[^A-Z0-9]+/gi;function d(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce((function(e,t){return e.replace(t,r)}),e)}function p(e,t){var r=e.charAt(0),n=e.substr(1).toLowerCase();return t>0&&r>="0"&&r<="9"?"_"+r+n:""+r.toUpperCase()+n}function f(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var r=t.splitRegexp,n=void 0===r?l:r,o=t.stripRegexp,a=void 0===o?u:o,i=t.transform,s=void 0===i?c:i,p=t.delimiter,f=void 0===p?" ":p,h=d(d(e,n,"$1\0$2"),a,"\0"),g=0,m=h.length;"\0"===h.charAt(g);)g++;for(;"\0"===h.charAt(m-1);)m--;return h.slice(g,m).split("\0").map(s).join(f)}(e,s({delimiter:"",transform:p},t))}function h(e,t){return 0===t?e.toLowerCase():p(e,t)}const g=window.wp.i18n;var m={grad:.9,turn:360,rad:360/(2*Math.PI)},b=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},_=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r+0},y=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e>t?e:t},k=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},w=function(e){return{r:y(e.r,0,255),g:y(e.g,0,255),b:y(e.b,0,255),a:y(e.a)}},v=function(e){return{r:_(e.r),g:_(e.g),b:_(e.b),a:_(e.a,3)}},T=/^#([0-9a-f]{3,8})$/i,C=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},x=function(e){var t=e.r,r=e.g,n=e.b,o=e.a,a=Math.max(t,r,n),i=a-Math.min(t,r,n),s=i?a===t?(r-n)/i:a===r?2+(n-t)/i:4+(t-r)/i:0;return{h:60*(s<0?s+6:s),s:a?i/a*100:0,v:a/255*100,a:o}},E=function(e){var t=e.h,r=e.s,n=e.v,o=e.a;t=t/360*6,r/=100,n/=100;var a=Math.floor(t),i=n*(1-r),s=n*(1-(t-a)*r),c=n*(1-(1-t+a)*r),l=a%6;return{r:255*[n,s,i,i,c,n][l],g:255*[c,n,n,s,i,i][l],b:255*[i,i,c,n,n,s][l],a:o}},S=function(e){return{h:k(e.h),s:y(e.s,0,100),l:y(e.l,0,100),a:y(e.a)}},B=function(e){return{h:_(e.h),s:_(e.s),l:_(e.l),a:_(e.a,3)}},A=function(e){return E((r=(t=e).s,{h:t.h,s:(r*=((n=t.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:t.a}));var t,r,n},N=function(e){return{h:(t=x(e)).h,s:(o=(200-(r=t.s))*(n=t.v)/100)>0&&o<200?r*n/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,r,n,o},P=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,O=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,L=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,M=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,j={string:[[function(e){var t=T.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?_(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?_(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=L.exec(e)||M.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:w({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=P.exec(e)||O.exec(e);if(!t)return null;var r,n,o=S({h:(r=t[1],n=t[2],void 0===n&&(n="deg"),Number(r)*(m[n]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return A(o)},"hsl"]],object:[[function(e){var t=e.r,r=e.g,n=e.b,o=e.a,a=void 0===o?1:o;return b(t)&&b(r)&&b(n)?w({r:Number(t),g:Number(r),b:Number(n),a:Number(a)}):null},"rgb"],[function(e){var t=e.h,r=e.s,n=e.l,o=e.a,a=void 0===o?1:o;if(!b(t)||!b(r)||!b(n))return null;var i=S({h:Number(t),s:Number(r),l:Number(n),a:Number(a)});return A(i)},"hsl"],[function(e){var t=e.h,r=e.s,n=e.v,o=e.a,a=void 0===o?1:o;if(!b(t)||!b(r)||!b(n))return null;var i=function(e){return{h:k(e.h),s:y(e.s,0,100),v:y(e.v,0,100),a:y(e.a)}}({h:Number(t),s:Number(r),v:Number(n),a:Number(a)});return E(i)},"hsv"]]},D=function(e,t){for(var r=0;r<t.length;r++){var n=t[r][0](e);if(n)return[n,t[r][1]]}return[null,void 0]},z=function(e){return"string"==typeof e?D(e.trim(),j.string):"object"==typeof e&&null!==e?D(e,j.object):[null,void 0]},I=function(e,t){var r=N(e);return{h:r.h,s:y(r.s+100*t,0,100),l:r.l,a:r.a}},R=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},H=function(e,t){var r=N(e);return{h:r.h,s:r.s,l:y(r.l+100*t,0,100),a:r.a}},V=function(){function e(e){this.parsed=z(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return _(R(this.rgba),2)},e.prototype.isDark=function(){return R(this.rgba)<.5},e.prototype.isLight=function(){return R(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=v(this.rgba)).r,r=e.g,n=e.b,a=(o=e.a)<1?C(_(255*o)):"","#"+C(t)+C(r)+C(n)+a;var e,t,r,n,o,a},e.prototype.toRgb=function(){return v(this.rgba)},e.prototype.toRgbString=function(){return t=(e=v(this.rgba)).r,r=e.g,n=e.b,(o=e.a)<1?"rgba("+t+", "+r+", "+n+", "+o+")":"rgb("+t+", "+r+", "+n+")";var e,t,r,n,o},e.prototype.toHsl=function(){return B(N(this.rgba))},e.prototype.toHslString=function(){return t=(e=B(N(this.rgba))).h,r=e.s,n=e.l,(o=e.a)<1?"hsla("+t+", "+r+"%, "+n+"%, "+o+")":"hsl("+t+", "+r+"%, "+n+"%)";var e,t,r,n,o},e.prototype.toHsv=function(){return e=x(this.rgba),{h:_(e.h),s:_(e.s),v:_(e.v),a:_(e.a,3)};var e},e.prototype.invert=function(){return $({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),$(I(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),$(I(this.rgba,-e))},e.prototype.grayscale=function(){return $(I(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),$(H(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),$(H(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?$({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):_(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=N(this.rgba);return"number"==typeof e?$({h:e,s:t.s,l:t.l,a:t.a}):_(t.h)},e.prototype.isEqual=function(e){return this.toHex()===$(e).toHex()},e}(),$=function(e){return e instanceof V?e:new V(e)},U=[];var F=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},q=function(e){return.2126*F(e.r)+.7152*F(e.g)+.0722*F(e.b)};const G=window.wp.element,K=window.wp.dom,W=window.wp.richText,Y=window.wp.deprecated;var Q=r.n(Y);const Z="block-default",X=["attributes","supports","save","migrate","isEligible","apiVersion"],J={"--wp--style--color--link":{value:["color","link"],support:["color","link"]},aspectRatio:{value:["dimensions","aspectRatio"],support:["dimensions","aspectRatio"],useEngine:!0},background:{value:["color","gradient"],support:["color","gradients"],useEngine:!0},backgroundColor:{value:["color","background"],support:["color","background"],requiresOptOut:!0,useEngine:!0},backgroundImage:{value:["background","backgroundImage"],support:["background","backgroundImage"],useEngine:!0},backgroundRepeat:{value:["background","backgroundRepeat"],support:["background","backgroundRepeat"],useEngine:!0},backgroundSize:{value:["background","backgroundSize"],support:["background","backgroundSize"],useEngine:!0},backgroundPosition:{value:["background","backgroundPosition"],support:["background","backgroundPosition"],useEngine:!0},borderColor:{value:["border","color"],support:["__experimentalBorder","color"],useEngine:!0},borderRadius:{value:["border","radius"],support:["__experimentalBorder","radius"],properties:{borderTopLeftRadius:"topLeft",borderTopRightRadius:"topRight",borderBottomLeftRadius:"bottomLeft",borderBottomRightRadius:"bottomRight"},useEngine:!0},borderStyle:{value:["border","style"],support:["__experimentalBorder","style"],useEngine:!0},borderWidth:{value:["border","width"],support:["__experimentalBorder","width"],useEngine:!0},borderTopColor:{value:["border","top","color"],support:["__experimentalBorder","color"],useEngine:!0},borderTopStyle:{value:["border","top","style"],support:["__experimentalBorder","style"],useEngine:!0},borderTopWidth:{value:["border","top","width"],support:["__experimentalBorder","width"],useEngine:!0},borderRightColor:{value:["border","right","color"],support:["__experimentalBorder","color"],useEngine:!0},borderRightStyle:{value:["border","right","style"],support:["__experimentalBorder","style"],useEngine:!0},borderRightWidth:{value:["border","right","width"],support:["__experimentalBorder","width"],useEngine:!0},borderBottomColor:{value:["border","bottom","color"],support:["__experimentalBorder","color"],useEngine:!0},borderBottomStyle:{value:["border","bottom","style"],support:["__experimentalBorder","style"],useEngine:!0},borderBottomWidth:{value:["border","bottom","width"],support:["__experimentalBorder","width"],useEngine:!0},borderLeftColor:{value:["border","left","color"],support:["__experimentalBorder","color"],useEngine:!0},borderLeftStyle:{value:["border","left","style"],support:["__experimentalBorder","style"],useEngine:!0},borderLeftWidth:{value:["border","left","width"],support:["__experimentalBorder","width"],useEngine:!0},color:{value:["color","text"],support:["color","text"],requiresOptOut:!0,useEngine:!0},columnCount:{value:["typography","textColumns"],support:["typography","textColumns"],useEngine:!0},filter:{value:["filter","duotone"],support:["filter","duotone"]},linkColor:{value:["elements","link","color","text"],support:["color","link"]},captionColor:{value:["elements","caption","color","text"],support:["color","caption"]},buttonColor:{value:["elements","button","color","text"],support:["color","button"]},buttonBackgroundColor:{value:["elements","button","color","background"],support:["color","button"]},headingColor:{value:["elements","heading","color","text"],support:["color","heading"]},headingBackgroundColor:{value:["elements","heading","color","background"],support:["color","heading"]},fontFamily:{value:["typography","fontFamily"],support:["typography","__experimentalFontFamily"],useEngine:!0},fontSize:{value:["typography","fontSize"],support:["typography","fontSize"],useEngine:!0},fontStyle:{value:["typography","fontStyle"],support:["typography","__experimentalFontStyle"],useEngine:!0},fontWeight:{value:["typography","fontWeight"],support:["typography","__experimentalFontWeight"],useEngine:!0},lineHeight:{value:["typography","lineHeight"],support:["typography","lineHeight"],useEngine:!0},margin:{value:["spacing","margin"],support:["spacing","margin"],properties:{marginTop:"top",marginRight:"right",marginBottom:"bottom",marginLeft:"left"},useEngine:!0},minHeight:{value:["dimensions","minHeight"],support:["dimensions","minHeight"],useEngine:!0},padding:{value:["spacing","padding"],support:["spacing","padding"],properties:{paddingTop:"top",paddingRight:"right",paddingBottom:"bottom",paddingLeft:"left"},useEngine:!0},textAlign:{value:["typography","textAlign"],support:["typography","textAlign"],useEngine:!1},textDecoration:{value:["typography","textDecoration"],support:["typography","__experimentalTextDecoration"],useEngine:!0},textTransform:{value:["typography","textTransform"],support:["typography","__experimentalTextTransform"],useEngine:!0},letterSpacing:{value:["typography","letterSpacing"],support:["typography","__experimentalLetterSpacing"],useEngine:!0},writingMode:{value:["typography","writingMode"],support:["typography","__experimentalWritingMode"],useEngine:!0},"--wp--style--root--padding":{value:["spacing","padding"],support:["spacing","padding"],properties:{"--wp--style--root--padding-top":"top","--wp--style--root--padding-right":"right","--wp--style--root--padding-bottom":"bottom","--wp--style--root--padding-left":"left"},rootOnly:!0}},ee={link:"a:where(:not(.wp-element-button))",heading:"h1, h2, h3, h4, h5, h6",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",button:".wp-element-button, .wp-block-button__link",caption:".wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption",cite:"cite"},te={"color.duotone":!0,"color.gradients":!0,"color.palette":!0,"dimensions.aspectRatios":!0,"typography.fontSizes":!0,"spacing.spacingSizes":!0},re=(window.wp.warning,window.wp.privateApis),{lock:ne,unlock:oe}=(0,re.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/blocks"),ae={title:"block title",description:"block description",keywords:["block keyword"],styles:[{label:"block style label"}],variations:[{title:"block variation title",description:"block variation description",keywords:["block variation keyword"]}]};function ie(e){return null!==e&&"object"==typeof e}function se(e){const{addBootstrappedBlockType:t}=oe((0,i.dispatch)(gr));for(const[r,n]of Object.entries(e))t(r,n)}function ce({textdomain:e,...t}){const r=["apiVersion","title","category","parent","ancestor","icon","description","keywords","attributes","providesContext","usesContext","selectors","supports","styles","example","variations","blockHooks","allowedBlocks"],n=Object.fromEntries(Object.entries(t).filter((([e])=>r.includes(e))));return e&&Object.keys(ae).forEach((t=>{n[t]&&(n[t]=ue(ae[t],n[t],e))})),n}function le(e,t){const r=ie(e)?e.name:e;if("string"!=typeof r)return;if(!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(r))return;if((0,i.select)(gr).getBlockType(r))return;const{addBootstrappedBlockType:n,addUnprocessedBlockType:o}=oe((0,i.dispatch)(gr));if(ie(e)){n(r,ce(e))}return o(r,t),(0,i.select)(gr).getBlockType(r)}function ue(e,t,r){return"string"==typeof e&&"string"==typeof t?(0,g._x)(t,e,r):Array.isArray(e)&&e.length&&Array.isArray(t)?t.map((t=>ue(e[0],t,r))):ie(e)&&Object.entries(e).length&&ie(t)?Object.keys(t).reduce(((n,o)=>e[o]?(n[o]=ue(e[o],t[o],r),n):(n[o]=t[o],n)),{}):t}function de(e,{title:t,icon:r}){(0,i.dispatch)(gr).addBlockCollection(e,t,r)}function pe(e){const t=(0,i.select)(gr).getBlockType(e);if(t)return(0,i.dispatch)(gr).removeBlockTypes(e),t}function fe(e){(0,i.dispatch)(gr).setFreeformFallbackBlockName(e)}function he(){return(0,i.select)(gr).getFreeformFallbackBlockName()}function ge(){return(0,i.select)(gr).getGroupingBlockName()}function me(e){(0,i.dispatch)(gr).setUnregisteredFallbackBlockName(e)}function be(){return(0,i.select)(gr).getUnregisteredFallbackBlockName()}function _e(e){(0,i.dispatch)(gr).setDefaultBlockName(e)}function ye(e){(0,i.dispatch)(gr).setGroupingBlockName(e)}function ke(){return(0,i.select)(gr).getDefaultBlockName()}function we(e){return(0,i.select)(gr)?.getBlockType(e)}function ve(){return(0,i.select)(gr).getBlockTypes()}function Te(e,t,r){return(0,i.select)(gr).getBlockSupport(e,t,r)}function Ce(e,t,r){return(0,i.select)(gr).hasBlockSupport(e,t,r)}function xe(e){return"core/block"===e?.name}function Ee(e){return"core/template-part"===e?.name}const Se=e=>(0,i.select)(gr).getChildBlockNames(e),Be=e=>(0,i.select)(gr).hasChildBlocks(e),Ae=e=>(0,i.select)(gr).hasChildBlocksWithInserterSupport(e),Ne=(e,t)=>{(0,i.dispatch)(gr).addBlockStyles(e,t)},Pe=(e,t)=>{(0,i.dispatch)(gr).removeBlockStyles(e,t)},Oe=(e,t)=>(0,i.select)(gr).getBlockVariations(e,t),Le=(e,t)=>{t.name,(0,i.dispatch)(gr).addBlockVariations(e,t)},Me=(e,t)=>{(0,i.dispatch)(gr).removeBlockVariations(e,t)},je=e=>{const{name:t,label:r,usesContext:n,getValues:o,setValues:a,canUserEditValue:s,getFieldsList:c}=e,l=oe((0,i.select)(gr)).getBlockBindingsSource(t),u=["label","usesContext"];for(const e in l)if(!u.includes(e)&&l[e])return;if(t&&"string"==typeof t&&!/[A-Z]+/.test(t)&&/^[a-z0-9/-]+$/.test(t)&&/^[a-z0-9-]+\/[a-z0-9-]+$/.test(t)&&(r||l?.label)&&(!r||"string"==typeof r)&&(!n||Array.isArray(n))&&!(o&&"function"!=typeof o||a&&"function"!=typeof a||s&&"function"!=typeof s||c&&"function"!=typeof c))return oe((0,i.dispatch)(gr)).addBlockBindingsSource(e)};function De(e){ze(e)&&oe((0,i.dispatch)(gr)).removeBlockBindingsSource(e)}function ze(e){return oe((0,i.select)(gr)).getBlockBindingsSource(e)}function Ie(){return oe((0,i.select)(gr)).getAllBlockBindingsSources()}!function(e){e.forEach((function(e){U.indexOf(e)<0&&(e(V,j),U.push(e))}))}([function(e,t){var r={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},n={};for(var o in r)n[r[o]]=o;var a={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,i,s=n[this.toHex()];if(s)return s;if(null==t?void 0:t.closest){var c=this.toRgb(),l=1/0,u="black";if(!a.length)for(var d in r)a[d]=new e(r[d]).toRgb();for(var p in r){var f=(o=c,i=a[p],Math.pow(o.r-i.r,2)+Math.pow(o.g-i.g,2)+Math.pow(o.b-i.b,2));f<l&&(l=f,u=p)}return u}},t.string.push([function(t){var n=t.toLowerCase(),o="transparent"===n?"#0000":r[n];return o?new e(o).toRgb():null},"name"])},function(e){e.prototype.luminance=function(){return e=q(this.rgba),void 0===(t=2)&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r+0;var e,t,r},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var r,n,o,a,i,s,c,l=t instanceof e?t:new e(t);return a=this.rgba,i=l.toRgb(),r=(s=q(a))>(c=q(i))?(s+.05)/(c+.05):(c+.05)/(s+.05),void 0===(n=2)&&(n=0),void 0===o&&(o=Math.pow(10,n)),Math.floor(o*r)/o+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(i=void 0===(a=(r=t).size)?"normal":a,"AAA"===(o=void 0===(n=r.level)?"AA":n)&&"normal"===i?7:"AA"===o&&"large"===i?3:4.5);var r,n,o,a,i}}]);const Re=["#191e23","#f8f9f9"];function He(e){var t;return Object.entries(null!==(t=we(e.name)?.attributes)&&void 0!==t?t:{}).every((([t,r])=>{const n=e.attributes[t];return r.hasOwnProperty("default")?n===r.default:"rich-text"===r.type?!n?.length:void 0===n}))}function Ve(e){return e.name===ke()&&He(e)}function $e(e){return!!e&&("string"==typeof e||(0,G.isValidElement)(e)||"function"==typeof e||e instanceof G.Component)}function Ue(e){if($e(e=e||Z))return{src:e};if("background"in e){const t=$(e.background),r=e=>t.contrast(e),n=Math.max(...Re.map(r));return{...e,foreground:e.foreground?e.foreground:Re.find((e=>r(e)===n)),shadowColor:t.alpha(.3).toRgbString()}}return e}function Fe(e){return"string"==typeof e?we(e):e}function qe(e,t,r="visual"){const{__experimentalLabel:n,title:o}=e,a=n&&n(t,{context:r});return a?a.toPlainText?a.toPlainText():(0,K.__unstableStripHTML)(a):o}function Ge(e,t,r,n="vertical"){const o=e?.title,a=e?qe(e,t,"accessibility"):"",i=void 0!==r,s=a&&a!==o;return i&&"vertical"===n?s?(0,g.sprintf)((0,g.__)("%1$s Block. Row %2$d. %3$s"),o,r,a):(0,g.sprintf)((0,g.__)("%1$s Block. Row %2$d"),o,r):i&&"horizontal"===n?s?(0,g.sprintf)((0,g.__)("%1$s Block. Column %2$d. %3$s"),o,r,a):(0,g.sprintf)((0,g.__)("%1$s Block. Column %2$d"),o,r):s?(0,g.sprintf)((0,g.__)("%1$s Block. %2$s"),o,a):(0,g.sprintf)((0,g.__)("%s Block"),o)}function Ke(e){return void 0!==e.default?e.default:"rich-text"===e.type?new W.RichTextData:void 0}function We(e){return void 0!==we(e)}function Ye(e,t){const r=we(e);if(void 0===r)throw new Error(`Block type '${e}' is not registered.`);return Object.entries(r.attributes).reduce(((e,[r,n])=>{const o=t[r];if(void 0!==o)"rich-text"===n.type?o instanceof W.RichTextData?e[r]=o:"string"==typeof o&&(e[r]=W.RichTextData.fromHTMLString(o)):"string"===n.type&&o instanceof W.RichTextData?e[r]=o.toHTMLString():e[r]=o;else{const t=Ke(n);void 0!==t&&(e[r]=t)}return-1!==["node","children"].indexOf(n.source)&&("string"==typeof e[r]?e[r]=[e[r]]:Array.isArray(e[r])||(e[r]=[])),e}),{})}function Qe(e,t){const r=we(e)?.attributes;if(!r)return[];const n=Object.keys(r);return t?n.filter((n=>{const o=r[n];return o?.role===t||o?.__experimentalRole===t&&(Q()("__experimentalRole attribute",{since:"6.7",version:"6.8",alternative:"role attribute",hint:`Check the block.json of the ${e} block.`}),!0)})):n}const Ze=(...e)=>(Q()("__experimentalGetBlockAttributesNamesByRole",{since:"6.7",version:"6.8",alternative:"getBlockAttributesNamesByRole"}),Qe(...e));function Xe(e,t){return Object.fromEntries(Object.entries(e).filter((([e])=>!t.includes(e))))}const Je=[{slug:"text",title:(0,g.__)("Text")},{slug:"media",title:(0,g.__)("Media")},{slug:"design",title:(0,g.__)("Design")},{slug:"widgets",title:(0,g.__)("Widgets")},{slug:"theme",title:(0,g.__)("Theme")},{slug:"embed",title:(0,g.__)("Embeds")},{slug:"reusable",title:(0,g.__)("Reusable blocks")}];function et(e){return e.reduce(((e,t)=>({...e,[t.name]:t})),{})}function tt(e){return e.reduce(((e,t)=>(e.some((e=>e.name===t.name))||e.push(t),e)),[])}function rt(e){return(t=null,r)=>{switch(r.type){case"REMOVE_BLOCK_TYPES":return-1!==r.names.indexOf(t)?null:t;case e:return r.name||null}return t}}const nt=rt("SET_DEFAULT_BLOCK_NAME"),ot=rt("SET_FREEFORM_FALLBACK_BLOCK_NAME"),at=rt("SET_UNREGISTERED_FALLBACK_BLOCK_NAME"),it=rt("SET_GROUPING_BLOCK_NAME");function st(e=[],t=[]){const r=Array.from(new Set(e.concat(t)));return r.length>0?r:void 0}const ct=(0,i.combineReducers)({bootstrappedBlockTypes:function(e={},t){switch(t.type){case"ADD_BOOTSTRAPPED_BLOCK_TYPE":const{name:r,blockType:n}=t,o=e[r];let a;return o?(void 0===o.blockHooks&&n.blockHooks&&(a={...o,...a,blockHooks:n.blockHooks}),void 0===o.allowedBlocks&&n.allowedBlocks&&(a={...o,...a,allowedBlocks:n.allowedBlocks})):(a=Object.fromEntries(Object.entries(n).filter((([,e])=>null!=e)).map((([e,t])=>{return[(r=e,void 0===n&&(n={}),f(r,s({transform:h},n))),t];var r,n}))),a.name=r),a?{...e,[r]:a}:e;case"REMOVE_BLOCK_TYPES":return Xe(e,t.names)}return e},unprocessedBlockTypes:function(e={},t){switch(t.type){case"ADD_UNPROCESSED_BLOCK_TYPE":return{...e,[t.name]:t.blockType};case"REMOVE_BLOCK_TYPES":return Xe(e,t.names)}return e},blockTypes:function(e={},t){switch(t.type){case"ADD_BLOCK_TYPES":return{...e,...et(t.blockTypes)};case"REMOVE_BLOCK_TYPES":return Xe(e,t.names)}return e},blockStyles:function(e={},t){var r;switch(t.type){case"ADD_BLOCK_TYPES":return{...e,...Object.fromEntries(Object.entries(et(t.blockTypes)).map((([t,r])=>{var n,o;return[t,tt([...(null!==(n=r.styles)&&void 0!==n?n:[]).map((e=>({...e,source:"block"}))),...(null!==(o=e[r.name])&&void 0!==o?o:[]).filter((({source:e})=>"block"!==e))])]})))};case"ADD_BLOCK_STYLES":const n={};return t.blockNames.forEach((r=>{var o;n[r]=tt([...null!==(o=e[r])&&void 0!==o?o:[],...t.styles])})),{...e,...n};case"REMOVE_BLOCK_STYLES":return{...e,[t.blockName]:(null!==(r=e[t.blockName])&&void 0!==r?r:[]).filter((e=>-1===t.styleNames.indexOf(e.name)))}}return e},blockVariations:function(e={},t){var r,n;switch(t.type){case"ADD_BLOCK_TYPES":return{...e,...Object.fromEntries(Object.entries(et(t.blockTypes)).map((([t,r])=>{var n,o;return[t,tt([...(null!==(n=r.variations)&&void 0!==n?n:[]).map((e=>({...e,source:"block"}))),...(null!==(o=e[r.name])&&void 0!==o?o:[]).filter((({source:e})=>"block"!==e))])]})))};case"ADD_BLOCK_VARIATIONS":return{...e,[t.blockName]:tt([...null!==(r=e[t.blockName])&&void 0!==r?r:[],...t.variations])};case"REMOVE_BLOCK_VARIATIONS":return{...e,[t.blockName]:(null!==(n=e[t.blockName])&&void 0!==n?n:[]).filter((e=>-1===t.variationNames.indexOf(e.name)))}}return e},defaultBlockName:nt,freeformFallbackBlockName:ot,unregisteredFallbackBlockName:at,groupingBlockName:it,categories:function(e=Je,t){switch(t.type){case"SET_CATEGORIES":const r=new Map;return(t.categories||[]).forEach((e=>{r.set(e.slug,e)})),[...r.values()];case"UPDATE_CATEGORY":if(!t.category||!Object.keys(t.category).length)return e;if(e.find((({slug:e})=>e===t.slug)))return e.map((e=>e.slug===t.slug?{...e,...t.category}:e))}return e},collections:function(e={},t){switch(t.type){case"ADD_BLOCK_COLLECTION":return{...e,[t.namespace]:{title:t.title,icon:t.icon}};case"REMOVE_BLOCK_COLLECTION":return Xe(e,t.namespace)}return e},blockBindingsSources:function(e={},t){switch(t.type){case"ADD_BLOCK_BINDINGS_SOURCE":let r;return"core/post-meta"===t.name&&(r=t.getFieldsList),{...e,[t.name]:{label:t.label||e[t.name]?.label,usesContext:st(e[t.name]?.usesContext,t.usesContext),getValues:t.getValues,setValues:t.setValues,canUserEditValue:t.setValues&&t.canUserEditValue,getFieldsList:r}};case"REMOVE_BLOCK_BINDINGS_SOURCE":return Xe(e,t.name)}return e}});var lt=r(9681),ut=r.n(lt);const dt=(e,t,r)=>{var n;const o=Array.isArray(t)?t:t.split(".");let a=e;return o.forEach((e=>{a=a?.[e]})),null!==(n=a)&&void 0!==n?n:r};function pt(e){return"object"==typeof e&&e.constructor===Object&&null!==e}function ft(e,t){return pt(e)&&pt(t)?Object.entries(t).every((([t,r])=>ft(e?.[t],r))):e===t}const ht=["background","backgroundColor","color","linkColor","captionColor","buttonColor","headingColor","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","padding","contentSize","wideSize","blockGap","textDecoration","textTransform","letterSpacing"];function gt(e,t,r){return e.filter((e=>("fontSize"!==e||"heading"!==r)&&(!("textDecoration"===e&&!t&&"link"!==r)&&(!("textTransform"===e&&!t&&!["heading","h1","h2","h3","h4","h5","h6"].includes(r)&&"button"!==r&&"caption"!==r&&"text"!==r)&&(!("letterSpacing"===e&&!t&&!["heading","h1","h2","h3","h4","h5","h6"].includes(r)&&"button"!==r&&"caption"!==r&&"text"!==r)&&!("textColumns"===e&&!t))))))}const mt=(0,i.createSelector)(((e,t,r)=>{if(!t)return gt(ht,t,r);const n=Ct(e,t);if(!n)return[];const o=[];return n?.supports?.spacing?.blockGap&&o.push("blockGap"),n?.supports?.shadow&&o.push("shadow"),Object.keys(J).forEach((e=>{J[e].support&&(J[e].requiresOptOut&&J[e].support[0]in n.supports&&!1!==dt(n.supports,J[e].support)||dt(n.supports,J[e].support,!1))&&o.push(e)})),gt(o,t,r)}),((e,t)=>[e.blockTypes[t]]));function bt(e,t){return e.bootstrappedBlockTypes[t]}function _t(e){return e.unprocessedBlockTypes}function yt(e){return e.blockBindingsSources}function kt(e,t){return e.blockBindingsSources[t]}const wt=(e,t)=>{const r=Ct(e,t);return!!r&&Object.values(r.attributes).some((({role:e,__experimentalRole:r})=>"content"===e||"content"===r&&(Q()("__experimentalRole attribute",{since:"6.7",version:"6.8",alternative:"role attribute",hint:`Check the block.json of the ${t} block.`}),!0)))},vt=(e,t)=>"string"==typeof t?Ct(e,t):t,Tt=(0,i.createSelector)((e=>Object.values(e.blockTypes)),(e=>[e.blockTypes]));function Ct(e,t){return e.blockTypes[t]}function xt(e,t){return e.blockStyles[t]}const Et=(0,i.createSelector)(((e,t,r)=>{const n=e.blockVariations[t];return n&&r?n.filter((e=>(e.scope||["block","inserter"]).includes(r))):n}),((e,t)=>[e.blockVariations[t]]));function St(e,t,r,n){const o=Et(e,t,n);if(!o)return o;const a=Ct(e,t),i=Object.keys(a?.attributes||{});let s,c=0;for(const e of o)if(Array.isArray(e.isActive)){const t=e.isActive.filter((e=>{const t=e.split(".")[0];return i.includes(t)})),n=t.length;if(0===n)continue;t.every((t=>{const n=dt(e.attributes,t);if(void 0===n)return!1;let o=dt(r,t);return o instanceof W.RichTextData&&(o=o.toHTMLString()),ft(o,n)}))&&n>c&&(s=e,c=n)}else if(e.isActive?.(r,e.attributes))return s||e;return s}function Bt(e,t,r){const n=Et(e,t,r);return[...n].reverse().find((({isDefault:e})=>!!e))||n[0]}function At(e){return e.categories}function Nt(e){return e.collections}function Pt(e){return e.defaultBlockName}function Ot(e){return e.freeformFallbackBlockName}function Lt(e){return e.unregisteredFallbackBlockName}function Mt(e){return e.groupingBlockName}const jt=(0,i.createSelector)(((e,t)=>Tt(e).filter((e=>e.parent?.includes(t))).map((({name:e})=>e))),(e=>[e.blockTypes])),Dt=(e,t,r,n)=>{const o=vt(e,t);return o?.supports?dt(o.supports,r,n):n};function zt(e,t,r,n){return!!Dt(e,t,r,n)}function It(e){return ut()(null!=e?e:"").toLowerCase().trim()}function Rt(e,t,r=""){const n=vt(e,t),o=It(r),a=e=>It(e).includes(o);return a(n.title)||n.keywords?.some(a)||a(n.category)||"string"==typeof n.description&&a(n.description)}const Ht=(e,t)=>jt(e,t).length>0,Vt=(e,t)=>jt(e,t).some((t=>zt(e,t,"inserter",!0))),$t=(...e)=>(Q()("__experimentalHasContentRoleAttribute",{since:"6.7",version:"6.8",hint:"This is a private selector."}),wt(...e)); /*! * is-plain-object <https://github.com/jonschlinkert/is-plain-object> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function Ut(e){return"[object Object]"===Object.prototype.toString.call(e)}var Ft=r(8529);const qt=window.wp.hooks,Gt={common:"text",formatting:"text",layout:"design"};function Kt(e=[],t=[]){const r=[...e];return t.forEach((e=>{const t=r.findIndex((t=>t.name===e.name));-1!==t?r[t]={...r[t],...e}:r.push(e)})),r}const Wt=(e,t)=>({select:r})=>{const n=r.getBootstrappedBlockType(e),o={name:e,icon:Z,keywords:[],attributes:{},providesContext:{},usesContext:[],selectors:{},supports:{},styles:[],blockHooks:{},save:()=>null,...n,...t,variations:Kt(Array.isArray(n?.variations)?n.variations:[],Array.isArray(t?.variations)?t.variations:[])},a=(0,qt.applyFilters)("blocks.registerBlockType",o,e,null);if(a.description&&"string"!=typeof a.description&&Q()("Declaring non-string block descriptions",{since:"6.2"}),a.deprecated&&(a.deprecated=a.deprecated.map((e=>Object.fromEntries(Object.entries((0,qt.applyFilters)("blocks.registerBlockType",{...Xe(o,X),...e},o.name,e)).filter((([e])=>X.includes(e))))))),function(e){var t,r;return!1!==Ut(e)&&(void 0===(t=e.constructor)||!1!==Ut(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}(a)&&"function"==typeof a.save&&(!("edit"in a)||(0,Ft.isValidElementType)(a.edit))&&(Gt.hasOwnProperty(a.category)&&(a.category=Gt[a.category]),"category"in a&&!r.getCategories().some((({slug:e})=>e===a.category))&&delete a.category,"title"in a&&""!==a.title&&"string"==typeof a.title&&(a.icon=Ue(a.icon),$e(a.icon.src)&&(("string"==typeof a?.parent||a?.parent instanceof String)&&(a.parent=[a.parent]),(Array.isArray(a?.parent)||void 0===a?.parent)&&(1!==a?.parent?.length||e!==a.parent[0])))))return a};function Yt(e){return{type:"ADD_BLOCK_TYPES",blockTypes:Array.isArray(e)?e:[e]}}function Qt(){return({dispatch:e,select:t})=>{const r=[];for(const[n,o]of Object.entries(t.getUnprocessedBlockTypes())){const t=e(Wt(n,o));t&&r.push(t)}r.length&&e.addBlockTypes(r)}}function Zt(){return Q()('wp.data.dispatch( "core/blocks" ).__experimentalReapplyBlockFilters',{since:"6.4",alternative:"reapplyBlockFilters"}),Qt()}function Xt(e){return{type:"REMOVE_BLOCK_TYPES",names:Array.isArray(e)?e:[e]}}function Jt(e,t){return{type:"ADD_BLOCK_STYLES",styles:Array.isArray(t)?t:[t],blockNames:Array.isArray(e)?e:[e]}}function er(e,t){return{type:"REMOVE_BLOCK_STYLES",styleNames:Array.isArray(t)?t:[t],blockName:e}}function tr(e,t){return{type:"ADD_BLOCK_VARIATIONS",variations:Array.isArray(t)?t:[t],blockName:e}}function rr(e,t){return{type:"REMOVE_BLOCK_VARIATIONS",variationNames:Array.isArray(t)?t:[t],blockName:e}}function nr(e){return{type:"SET_DEFAULT_BLOCK_NAME",name:e}}function or(e){return{type:"SET_FREEFORM_FALLBACK_BLOCK_NAME",name:e}}function ar(e){return{type:"SET_UNREGISTERED_FALLBACK_BLOCK_NAME",name:e}}function ir(e){return{type:"SET_GROUPING_BLOCK_NAME",name:e}}function sr(e){return{type:"SET_CATEGORIES",categories:e}}function cr(e,t){return{type:"UPDATE_CATEGORY",slug:e,category:t}}function lr(e,t,r){return{type:"ADD_BLOCK_COLLECTION",namespace:e,title:t,icon:r}}function ur(e){return{type:"REMOVE_BLOCK_COLLECTION",namespace:e}}function dr(e,t){return{type:"ADD_BOOTSTRAPPED_BLOCK_TYPE",name:e,blockType:t}}function pr(e,t){return({dispatch:r})=>{r({type:"ADD_UNPROCESSED_BLOCK_TYPE",name:e,blockType:t});const n=r(Wt(e,t));n&&r.addBlockTypes(n)}}function fr(e){return{type:"ADD_BLOCK_BINDINGS_SOURCE",name:e.name,label:e.label,usesContext:e.usesContext,getValues:e.getValues,setValues:e.setValues,canUserEditValue:e.canUserEditValue,getFieldsList:e.getFieldsList}}function hr(e){return{type:"REMOVE_BLOCK_BINDINGS_SOURCE",name:e}}const gr=(0,i.createReduxStore)("core/blocks",{reducer:ct,selectors:t,actions:o});(0,i.register)(gr),oe(gr).registerPrivateSelectors(e),oe(gr).registerPrivateActions(a);const mr={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let br;const _r=new Uint8Array(16);function yr(){if(!br&&(br="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!br))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return br(_r)}const kr=[];for(let e=0;e<256;++e)kr.push((e+256).toString(16).slice(1));function wr(e,t=0){return kr[e[t+0]]+kr[e[t+1]]+kr[e[t+2]]+kr[e[t+3]]+"-"+kr[e[t+4]]+kr[e[t+5]]+"-"+kr[e[t+6]]+kr[e[t+7]]+"-"+kr[e[t+8]]+kr[e[t+9]]+"-"+kr[e[t+10]]+kr[e[t+11]]+kr[e[t+12]]+kr[e[t+13]]+kr[e[t+14]]+kr[e[t+15]]}const vr=function(e,t,r){if(mr.randomUUID&&!t&&!e)return mr.randomUUID();const n=(e=e||{}).random||(e.rng||yr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return wr(n)};function Tr(e,t={},r=[]){if(!We(e))return Tr("core/missing",{originalName:e,originalContent:"",originalUndelimitedContent:""});const n=Ye(e,t);return{clientId:vr(),name:e,isValid:!0,attributes:n,innerBlocks:r}}function Cr(e=[]){return e.map((e=>{const t=Array.isArray(e)?e:[e.name,e.attributes,e.innerBlocks],[r,n,o=[]]=t;return Tr(r,n,Cr(o))}))}function xr(e,t={},r){const{name:n}=e;if(!We(n))return Tr("core/missing",{originalName:n,originalContent:"",originalUndelimitedContent:""});const o=vr(),a=Ye(n,{...e.attributes,...t});return{...e,clientId:o,attributes:a,innerBlocks:r||e.innerBlocks.map((e=>xr(e)))}}function Er(e,t={},r){const n=vr();return{...e,clientId:n,attributes:{...e.attributes,...t},innerBlocks:r||e.innerBlocks.map((e=>Er(e)))}}const Sr=(e,t,r)=>{if(!r.length)return!1;const n=r.length>1,o=r[0].name;if(!(Nr(e)||!n||e.isMultiBlock))return!1;if(!Nr(e)&&!r.every((e=>e.name===o)))return!1;if(!("block"===e.type))return!1;const a=r[0];return!("from"===t&&-1===e.blocks.indexOf(a.name)&&!Nr(e))&&(!(!n&&"from"===t&&Pr(a.name)&&Pr(e.blockName))&&!!jr(e,r))},Br=e=>{if(!e.length)return[];return ve().filter((t=>!!Lr(Mr("from",t.name),(t=>Sr(t,"from",e)))))},Ar=e=>{if(!e.length)return[];const t=we(e[0].name);return(t?Mr("to",t.name):[]).filter((t=>t&&Sr(t,"to",e))).map((e=>e.blocks)).flat().map(we)},Nr=e=>e&&"block"===e.type&&Array.isArray(e.blocks)&&e.blocks.includes("*"),Pr=e=>e===ge();function Or(e){if(!e.length)return[];const t=Br(e),r=Ar(e);return[...new Set([...t,...r])]}function Lr(e,t){const r=(0,qt.createHooks)();for(let n=0;n<e.length;n++){const o=e[n];t(o)&&r.addFilter("transform","transform/"+n.toString(),(e=>e||o),o.priority)}return r.applyFilters("transform",null)}function Mr(e,t){if(void 0===t)return ve().map((({name:t})=>Mr(e,t))).flat();const r=Fe(t),{name:n,transforms:o}=r||{};if(!o||!Array.isArray(o[e]))return[];const a=o.supportedMobileTransforms&&Array.isArray(o.supportedMobileTransforms),i=a?o[e].filter((e=>"raw"===e.type||("prefix"===e.type||!(!e.blocks||!e.blocks.length)&&(!!Nr(e)||e.blocks.every((e=>o.supportedMobileTransforms.includes(e))))))):o[e];return i.map((e=>({...e,blockName:n,usingMobileTransformations:a})))}function jr(e,t){if("function"!=typeof e.isMatch)return!0;const r=t[0],n=e.isMultiBlock?t.map((e=>e.attributes)):r.attributes,o=e.isMultiBlock?t:r;return e.isMatch(n,o)}function Dr(e,t){const r=Array.isArray(e)?e:[e],n=r.length>1,o=r[0],a=o.name,i=Mr("from",t),s=Lr(Mr("to",a),(e=>"block"===e.type&&(Nr(e)||-1!==e.blocks.indexOf(t))&&(!n||e.isMultiBlock)&&jr(e,r)))||Lr(i,(e=>"block"===e.type&&(Nr(e)||-1!==e.blocks.indexOf(a))&&(!n||e.isMultiBlock)&&jr(e,r)));if(!s)return null;let c;if(c=s.isMultiBlock?"__experimentalConvert"in s?s.__experimentalConvert(r):s.transform(r.map((e=>e.attributes)),r.map((e=>e.innerBlocks))):"__experimentalConvert"in s?s.__experimentalConvert(o):s.transform(o.attributes,o.innerBlocks),null===c||"object"!=typeof c)return null;if(c=Array.isArray(c)?c:[c],c.some((e=>!we(e.name))))return null;if(!c.some((e=>e.name===t)))return null;return c.map(((t,r,n)=>(0,qt.applyFilters)("blocks.switchToBlockType.transformedBlock",t,e,r,n)))}const zr=(e,t)=>{var r;return Tr(e,t.attributes,(null!==(r=t.innerBlocks)&&void 0!==r?r:[]).map((e=>zr(e.name,e))))},Ir=window.wp.blockSerializationDefaultParser,Rr=window.wp.autop,Hr=window.wp.isShallowEqual;var Vr=r.n(Hr);function $r(e,t={}){const{isCommentDelimited:r=!0}=t,{blockName:n,attrs:o={},innerBlocks:a=[],innerContent:i=[]}=e;let s=0;const c=i.map((e=>null!==e?e:$r(a[s++],t))).join("\n").replace(/\n+/g,"\n").trim();return r?Jr(n,o,c):c}const Ur=window.ReactJSXRuntime;function Fr(e){const t="wp-block-"+e.replace(/\//,"-").replace(/^core-/,"");return(0,qt.applyFilters)("blocks.getBlockDefaultClassName",t,e)}function qr(e){const t="editor-block-list-item-"+e.replace(/\//,"-").replace(/^core-/,"");return(0,qt.applyFilters)("blocks.getBlockMenuDefaultClassName",t,e)}const Gr={},Kr={};function Wr(e={}){const{blockType:t,attributes:r}=Gr;return Wr.skipFilters?e:(0,qt.applyFilters)("blocks.getSaveContent.extraProps",{...e},t,r)}function Yr(e={}){const{innerBlocks:t}=Kr;if(!Array.isArray(t))return{...e,children:t};const r=rn(t,{isInnerBlocks:!0}),n=(0,Ur.jsx)(G.RawHTML,{children:r});return{...e,children:n}}function Qr(e,t,r=[]){const n=Fe(e);if(!n?.save)return null;let{save:o}=n;if(o.prototype instanceof G.Component){const e=new o({attributes:t});o=e.render.bind(e)}Gr.blockType=n,Gr.attributes=t,Kr.innerBlocks=r;let a=o({attributes:t,innerBlocks:r});if(null!==a&&"object"==typeof a&&(0,qt.hasFilter)("blocks.getSaveContent.extraProps")&&!(n.apiVersion>1)){const e=(0,qt.applyFilters)("blocks.getSaveContent.extraProps",{...a.props},n,t);Vr()(e,a.props)||(a=(0,G.cloneElement)(a,e))}return(0,qt.applyFilters)("blocks.getSaveElement",a,n,t)}function Zr(e,t,r){const n=Fe(e);return(0,G.renderToString)(Qr(n,t,r))}function Xr(e){let t=e.originalContent;if(e.isValid||e.innerBlocks.length)try{t=Zr(e.name,e.attributes,e.innerBlocks)}catch(e){}return t}function Jr(e,t,r){const n=t&&Object.entries(t).length?function(e){return JSON.stringify(e).replace(/--/g,"\\u002d\\u002d").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\\"/g,"\\u0022")}(t)+" ":"",o=e?.startsWith("core/")?e.slice(5):e;return r?`\x3c!-- wp:${o} ${n}--\x3e\n`+r+`\n\x3c!-- /wp:${o} --\x3e`:`\x3c!-- wp:${o} ${n}/--\x3e`}function en(e,{isInnerBlocks:t=!1}={}){if(!e.isValid&&e.__unstableBlockSource)return $r(e.__unstableBlockSource);const r=e.name,n=Xr(e);if(r===be()||!t&&r===he())return n;const o=we(r);if(!o)return n;const a=function(e,t){var r;return Object.entries(null!==(r=e.attributes)&&void 0!==r?r:{}).reduce(((r,[n,o])=>{const a=t[n];return void 0===a||void 0!==o.source||"local"===o.role?r:"local"===o.__experimentalRole?(Q()("__experimentalRole attribute",{since:"6.7",version:"6.8",alternative:"role attribute",hint:`Check the block.json of the ${e?.name} block.`}),r):("default"in o&&JSON.stringify(o.default)===JSON.stringify(a)||(r[n]=a),r)}),{})}(o,e.attributes);return Jr(r,a,n)}function tn(e){1===e.length&&Ve(e[0])&&(e=[]);let t=rn(e);return 1===e.length&&e[0].name===he()&&"core/freeform"===e[0].name&&(t=(0,Rr.removep)(t)),t}function rn(e,t){return(Array.isArray(e)?e:[e]).map((e=>en(e,t))).join("\n\n")}var nn=/^#[xX]([A-Fa-f0-9]+)$/,on=/^#([0-9]+)$/,an=/^([A-Za-z0-9]+)$/,sn=(function(){function e(e){this.named=e}e.prototype.parse=function(e){if(e){var t=e.match(nn);return t?String.fromCharCode(parseInt(t[1],16)):(t=e.match(on))?String.fromCharCode(parseInt(t[1],10)):(t=e.match(an))?this.named[t[1]]:void 0}}}(),/[\t\n\f ]/),cn=/[A-Za-z]/,ln=/\r\n?/g;function un(e){return sn.test(e)}function dn(e){return cn.test(e)}var pn=function(){function e(e,t,r){void 0===r&&(r="precompile"),this.delegate=e,this.entityParser=t,this.mode=r,this.state="beforeData",this.line=-1,this.column=-1,this.input="",this.index=-1,this.tagNameBuffer="",this.states={beforeData:function(){var e=this.peek();if("<"!==e||this.isIgnoredEndTag()){if("precompile"===this.mode&&"\n"===e){var t=this.tagNameBuffer.toLowerCase();"pre"!==t&&"textarea"!==t||this.consume()}this.transitionTo("data"),this.delegate.beginData()}else this.transitionTo("tagOpen"),this.markTagStart(),this.consume()},data:function(){var e=this.peek(),t=this.tagNameBuffer;"<"!==e||this.isIgnoredEndTag()?"&"===e&&"script"!==t&&"style"!==t?(this.consume(),this.delegate.appendToData(this.consumeCharRef()||"&")):(this.consume(),this.delegate.appendToData(e)):(this.delegate.finishData(),this.transitionTo("tagOpen"),this.markTagStart(),this.consume())},tagOpen:function(){var e=this.consume();"!"===e?this.transitionTo("markupDeclarationOpen"):"/"===e?this.transitionTo("endTagOpen"):("@"===e||":"===e||dn(e))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginStartTag(),this.appendToTagName(e))},markupDeclarationOpen:function(){var e=this.consume();"-"===e&&"-"===this.peek()?(this.consume(),this.transitionTo("commentStart"),this.delegate.beginComment()):"DOCTYPE"===e.toUpperCase()+this.input.substring(this.index,this.index+6).toUpperCase()&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.transitionTo("doctype"),this.delegate.beginDoctype&&this.delegate.beginDoctype())},doctype:function(){un(this.consume())&&this.transitionTo("beforeDoctypeName")},beforeDoctypeName:function(){var e=this.consume();un(e)||(this.transitionTo("doctypeName"),this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(e.toLowerCase()))},doctypeName:function(){var e=this.consume();un(e)?this.transitionTo("afterDoctypeName"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(e.toLowerCase())},afterDoctypeName:function(){var e=this.consume();if(!un(e))if(">"===e)this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData");else{var t=e.toUpperCase()+this.input.substring(this.index,this.index+5).toUpperCase(),r="PUBLIC"===t.toUpperCase(),n="SYSTEM"===t.toUpperCase();(r||n)&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume()),r?this.transitionTo("afterDoctypePublicKeyword"):n&&this.transitionTo("afterDoctypeSystemKeyword")}},afterDoctypePublicKeyword:function(){var e=this.peek();un(e)?(this.transitionTo("beforeDoctypePublicIdentifier"),this.consume()):'"'===e?(this.transitionTo("doctypePublicIdentifierDoubleQuoted"),this.consume()):"'"===e?(this.transitionTo("doctypePublicIdentifierSingleQuoted"),this.consume()):">"===e&&(this.consume(),this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},doctypePublicIdentifierDoubleQuoted:function(){var e=this.consume();'"'===e?this.transitionTo("afterDoctypePublicIdentifier"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(e)},doctypePublicIdentifierSingleQuoted:function(){var e=this.consume();"'"===e?this.transitionTo("afterDoctypePublicIdentifier"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(e)},afterDoctypePublicIdentifier:function(){var e=this.consume();un(e)?this.transitionTo("betweenDoctypePublicAndSystemIdentifiers"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):'"'===e?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):"'"===e&&this.transitionTo("doctypeSystemIdentifierSingleQuoted")},betweenDoctypePublicAndSystemIdentifiers:function(){var e=this.consume();un(e)||(">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):'"'===e?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):"'"===e&&this.transitionTo("doctypeSystemIdentifierSingleQuoted"))},doctypeSystemIdentifierDoubleQuoted:function(){var e=this.consume();'"'===e?this.transitionTo("afterDoctypeSystemIdentifier"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeSystemIdentifier&&this.delegate.appendToDoctypeSystemIdentifier(e)},doctypeSystemIdentifierSingleQuoted:function(){var e=this.consume();"'"===e?this.transitionTo("afterDoctypeSystemIdentifier"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeSystemIdentifier&&this.delegate.appendToDoctypeSystemIdentifier(e)},afterDoctypeSystemIdentifier:function(){var e=this.consume();un(e)||">"===e&&(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},commentStart:function(){var e=this.consume();"-"===e?this.transitionTo("commentStartDash"):">"===e?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData(e),this.transitionTo("comment"))},commentStartDash:function(){var e=this.consume();"-"===e?this.transitionTo("commentEnd"):">"===e?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("-"),this.transitionTo("comment"))},comment:function(){var e=this.consume();"-"===e?this.transitionTo("commentEndDash"):this.delegate.appendToCommentData(e)},commentEndDash:function(){var e=this.consume();"-"===e?this.transitionTo("commentEnd"):(this.delegate.appendToCommentData("-"+e),this.transitionTo("comment"))},commentEnd:function(){var e=this.consume();">"===e?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("--"+e),this.transitionTo("comment"))},tagName:function(){var e=this.consume();un(e)?this.transitionTo("beforeAttributeName"):"/"===e?this.transitionTo("selfClosingStartTag"):">"===e?(this.delegate.finishTag(),this.transitionTo("beforeData")):this.appendToTagName(e)},endTagName:function(){var e=this.consume();un(e)?(this.transitionTo("beforeAttributeName"),this.tagNameBuffer=""):"/"===e?(this.transitionTo("selfClosingStartTag"),this.tagNameBuffer=""):">"===e?(this.delegate.finishTag(),this.transitionTo("beforeData"),this.tagNameBuffer=""):this.appendToTagName(e)},beforeAttributeName:function(){var e=this.peek();un(e)?this.consume():"/"===e?(this.transitionTo("selfClosingStartTag"),this.consume()):">"===e?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):"="===e?(this.delegate.reportSyntaxError("attribute name cannot start with equals sign"),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(e)):(this.transitionTo("attributeName"),this.delegate.beginAttribute())},attributeName:function(){var e=this.peek();un(e)?(this.transitionTo("afterAttributeName"),this.consume()):"/"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===e?(this.transitionTo("beforeAttributeValue"),this.consume()):">"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):'"'===e||"'"===e||"<"===e?(this.delegate.reportSyntaxError(e+" is not a valid character within attribute names"),this.consume(),this.delegate.appendToAttributeName(e)):(this.consume(),this.delegate.appendToAttributeName(e))},afterAttributeName:function(){var e=this.peek();un(e)?this.consume():"/"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===e?(this.consume(),this.transitionTo("beforeAttributeValue")):">"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(e))},beforeAttributeValue:function(){var e=this.peek();un(e)?this.consume():'"'===e?(this.transitionTo("attributeValueDoubleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):"'"===e?(this.transitionTo("attributeValueSingleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):">"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.transitionTo("attributeValueUnquoted"),this.delegate.beginAttributeValue(!1),this.consume(),this.delegate.appendToAttributeValue(e))},attributeValueDoubleQuoted:function(){var e=this.consume();'"'===e?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===e?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(e)},attributeValueSingleQuoted:function(){var e=this.consume();"'"===e?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===e?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(e)},attributeValueUnquoted:function(){var e=this.peek();un(e)?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("beforeAttributeName")):"/"===e?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"&"===e?(this.consume(),this.delegate.appendToAttributeValue(this.consumeCharRef()||"&")):">"===e?(this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.consume(),this.delegate.appendToAttributeValue(e))},afterAttributeValueQuoted:function(){var e=this.peek();un(e)?(this.consume(),this.transitionTo("beforeAttributeName")):"/"===e?(this.consume(),this.transitionTo("selfClosingStartTag")):">"===e?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},selfClosingStartTag:function(){">"===this.peek()?(this.consume(),this.delegate.markTagAsSelfClosing(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},endTagOpen:function(){var e=this.consume();("@"===e||":"===e||dn(e))&&(this.transitionTo("endTagName"),this.tagNameBuffer="",this.delegate.beginEndTag(),this.appendToTagName(e))}},this.reset()}return e.prototype.reset=function(){this.transitionTo("beforeData"),this.input="",this.tagNameBuffer="",this.index=0,this.line=1,this.column=0,this.delegate.reset()},e.prototype.transitionTo=function(e){this.state=e},e.prototype.tokenize=function(e){this.reset(),this.tokenizePart(e),this.tokenizeEOF()},e.prototype.tokenizePart=function(e){for(this.input+=function(e){return e.replace(ln,"\n")}(e);this.index<this.input.length;){var t=this.states[this.state];if(void 0===t)throw new Error("unhandled state "+this.state);t.call(this)}},e.prototype.tokenizeEOF=function(){this.flushData()},e.prototype.flushData=function(){"data"===this.state&&(this.delegate.finishData(),this.transitionTo("beforeData"))},e.prototype.peek=function(){return this.input.charAt(this.index)},e.prototype.consume=function(){var e=this.peek();return this.index++,"\n"===e?(this.line++,this.column=0):this.column++,e},e.prototype.consumeCharRef=function(){var e=this.input.indexOf(";",this.index);if(-1!==e){var t=this.input.slice(this.index,e),r=this.entityParser.parse(t);if(r){for(var n=t.length;n;)this.consume(),n--;return this.consume(),r}}},e.prototype.markTagStart=function(){this.delegate.tagOpen()},e.prototype.appendToTagName=function(e){this.tagNameBuffer+=e,this.delegate.appendToTagName(e)},e.prototype.isIgnoredEndTag=function(){var e=this.tagNameBuffer;return"title"===e&&"</title>"!==this.input.substring(this.index,this.index+8)||"style"===e&&"</style>"!==this.input.substring(this.index,this.index+8)||"script"===e&&"<\/script>"!==this.input.substring(this.index,this.index+9)},e}(),fn=function(){function e(e,t){void 0===t&&(t={}),this.options=t,this.token=null,this.startLine=1,this.startColumn=0,this.tokens=[],this.tokenizer=new pn(this,e,t.mode),this._currentAttribute=void 0}return e.prototype.tokenize=function(e){return this.tokens=[],this.tokenizer.tokenize(e),this.tokens},e.prototype.tokenizePart=function(e){return this.tokens=[],this.tokenizer.tokenizePart(e),this.tokens},e.prototype.tokenizeEOF=function(){return this.tokens=[],this.tokenizer.tokenizeEOF(),this.tokens[0]},e.prototype.reset=function(){this.token=null,this.startLine=1,this.startColumn=0},e.prototype.current=function(){var e=this.token;if(null===e)throw new Error("token was unexpectedly null");if(0===arguments.length)return e;for(var t=0;t<arguments.length;t++)if(e.type===arguments[t])return e;throw new Error("token type was unexpectedly "+e.type)},e.prototype.push=function(e){this.token=e,this.tokens.push(e)},e.prototype.currentAttribute=function(){return this._currentAttribute},e.prototype.addLocInfo=function(){this.options.loc&&(this.current().loc={start:{line:this.startLine,column:this.startColumn},end:{line:this.tokenizer.line,column:this.tokenizer.column}}),this.startLine=this.tokenizer.line,this.startColumn=this.tokenizer.column},e.prototype.beginDoctype=function(){this.push({type:"Doctype",name:""})},e.prototype.appendToDoctypeName=function(e){this.current("Doctype").name+=e},e.prototype.appendToDoctypePublicIdentifier=function(e){var t=this.current("Doctype");void 0===t.publicIdentifier?t.publicIdentifier=e:t.publicIdentifier+=e},e.prototype.appendToDoctypeSystemIdentifier=function(e){var t=this.current("Doctype");void 0===t.systemIdentifier?t.systemIdentifier=e:t.systemIdentifier+=e},e.prototype.endDoctype=function(){this.addLocInfo()},e.prototype.beginData=function(){this.push({type:"Chars",chars:""})},e.prototype.appendToData=function(e){this.current("Chars").chars+=e},e.prototype.finishData=function(){this.addLocInfo()},e.prototype.beginComment=function(){this.push({type:"Comment",chars:""})},e.prototype.appendToCommentData=function(e){this.current("Comment").chars+=e},e.prototype.finishComment=function(){this.addLocInfo()},e.prototype.tagOpen=function(){},e.prototype.beginStartTag=function(){this.push({type:"StartTag",tagName:"",attributes:[],selfClosing:!1})},e.prototype.beginEndTag=function(){this.push({type:"EndTag",tagName:""})},e.prototype.finishTag=function(){this.addLocInfo()},e.prototype.markTagAsSelfClosing=function(){this.current("StartTag").selfClosing=!0},e.prototype.appendToTagName=function(e){this.current("StartTag","EndTag").tagName+=e},e.prototype.beginAttribute=function(){this._currentAttribute=["","",!1]},e.prototype.appendToAttributeName=function(e){this.currentAttribute()[0]+=e},e.prototype.beginAttributeValue=function(e){this.currentAttribute()[2]=e},e.prototype.appendToAttributeValue=function(e){this.currentAttribute()[1]+=e},e.prototype.finishAttributeValue=function(){this.current("StartTag").attributes.push(this._currentAttribute)},e.prototype.reportSyntaxError=function(e){this.current().syntaxError=e},e}();var hn=r(7734),gn=r.n(hn);const mn=window.wp.htmlEntities;function bn(){function e(e){return(t,...r)=>e("Block validation: "+t,...r)}return{error:e(console.error),warning:e(console.warn),getItems:()=>[]}}const _n=/[\t\n\r\v\f ]+/g,yn=/^[\t\n\r\v\f ]*$/,kn=/^url\s*\(['"\s]*(.*?)['"\s]*\)$/,wn=["allowfullscreen","allowpaymentrequest","allowusermedia","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","typemustmatch"],vn=[...wn,"autocapitalize","autocomplete","charset","contenteditable","crossorigin","decoding","dir","draggable","enctype","formenctype","formmethod","http-equiv","inputmode","kind","method","preload","scope","shape","spellcheck","translate","type","wrap"],Tn=[e=>e,function(e){return Bn(e).join(" ")}],Cn=/^[\da-z]+$/i,xn=/^#\d+$/,En=/^#x[\da-f]+$/i;class Sn{parse(e){if(t=e,Cn.test(t)||xn.test(t)||En.test(t))return(0,mn.decodeEntities)("&"+e+";");var t}}function Bn(e){return e.trim().split(_n)}function An(e){return e.attributes.filter((e=>{const[t,r]=e;return r||0===t.indexOf("data-")||vn.includes(t)}))}function Nn(e,t,r=bn()){let n=e.chars,o=t.chars;for(let e=0;e<Tn.length;e++){const t=Tn[e];if(n=t(n),o=t(o),n===o)return!0}return r.warning("Expected text `%s`, saw `%s`.",t.chars,e.chars),!1}function Pn(e){return 0===parseFloat(e)?"0":0===e.indexOf(".")?"0"+e:e}function On(e){return Bn(e).map(Pn).join(" ").replace(kn,"url($1)")}function Ln(e){const t=e.replace(/;?\s*$/,"").split(";").map((e=>{const[t,...r]=e.split(":"),n=r.join(":");return[t.trim(),On(n.trim())]}));return Object.fromEntries(t)}const Mn={class:(e,t)=>{const[r,n]=[e,t].map(Bn),o=r.filter((e=>!n.includes(e))),a=n.filter((e=>!r.includes(e)));return 0===o.length&&0===a.length},style:(e,t)=>gn()(...[e,t].map(Ln)),...Object.fromEntries(wn.map((e=>[e,()=>!0])))};const jn={StartTag:(e,t,r=bn())=>e.tagName!==t.tagName&&e.tagName.toLowerCase()!==t.tagName.toLowerCase()?(r.warning("Expected tag name `%s`, instead saw `%s`.",t.tagName,e.tagName),!1):function(e,t,r=bn()){if(e.length!==t.length)return r.warning("Expected attributes %o, instead saw %o.",t,e),!1;const n={};for(let e=0;e<t.length;e++)n[t[e][0].toLowerCase()]=t[e][1];for(let t=0;t<e.length;t++){const[o,a]=e[t],i=o.toLowerCase();if(!n.hasOwnProperty(i))return r.warning("Encountered unexpected attribute `%s`.",o),!1;const s=n[i],c=Mn[i];if(c){if(!c(a,s))return r.warning("Expected attribute `%s` of value `%s`, saw `%s`.",o,s,a),!1}else if(a!==s)return r.warning("Expected attribute `%s` of value `%s`, saw `%s`.",o,s,a),!1}return!0}(...[e,t].map(An),r),Chars:Nn,Comment:Nn};function Dn(e){let t;for(;t=e.shift();){if("Chars"!==t.type)return t;if(!yn.test(t.chars))return t}}function zn(e,t){return!!e.selfClosing&&!(!t||t.tagName!==e.tagName||"EndTag"!==t.type)}function In(e,t,r=bn()){if(e===t)return!0;const[n,o]=[e,t].map((e=>function(e,t=bn()){try{return new fn(new Sn).tokenize(e)}catch(r){t.warning("Malformed HTML detected: %s",e)}return null}(e,r)));if(!n||!o)return!1;let a,i;for(;a=Dn(n);){if(i=Dn(o),!i)return r.warning("Expected end of content, instead saw %o.",a),!1;if(a.type!==i.type)return r.warning("Expected token of type `%s` (%o), instead saw `%s` (%o).",i.type,i,a.type,a),!1;const e=jn[a.type];if(e&&!e(a,i,r))return!1;zn(a,o[0])?Dn(o):zn(i,n[0])&&Dn(n)}return!(i=Dn(o))||(r.warning("Expected %o, instead saw end of content.",i),!1)}function Rn(e,t=e.name){if(e.name===he()||e.name===be())return[!0,[]];const r=function(){const e=[],t=bn();return{error(...r){e.push({log:t.error,args:r})},warning(...r){e.push({log:t.warning,args:r})},getItems:()=>e}}(),n=Fe(t);let o;try{o=Zr(n,e.attributes)}catch(e){return r.error("Block validation failed because an error occurred while generating block content:\n\n%s",e.toString()),[!1,r.getItems()]}const a=In(e.originalContent,o,r);return a||r.error("Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s",n.name,n,o,e.originalContent),[a,r.getItems()]}function Hn(e,t,r){Q()("isValidBlockContent introduces opportunity for data loss",{since:"12.6",plugin:"Gutenberg",alternative:"validateBlock"});const n=Fe(e),o={name:n.name,attributes:t,innerBlocks:[],originalContent:r},[a]=Rn(o,n);return a}function Vn(e,t){const r={...t};if("core/cover-image"===e&&(e="core/cover"),"core/text"!==e&&"core/cover-text"!==e||(e="core/paragraph"),e&&0===e.indexOf("core/social-link-")&&(r.service=e.substring(17),e="core/social-link"),e&&0===e.indexOf("core-embed/")){const t=e.substring(11),n={speaker:"speaker-deck",polldaddy:"crowdsignal"};r.providerNameSlug=t in n?n[t]:t,["amazon-kindle","wordpress"].includes(t)||(r.responsive=!0),e="core/embed"}if("core/post-comment-author"===e&&(e="core/comment-author-name"),"core/post-comment-content"===e&&(e="core/comment-content"),"core/post-comment-date"===e&&(e="core/comment-date"),"core/comments-query-loop"===e){e="core/comments";const{className:t=""}=r;t.includes("wp-block-comments-query-loop")||(r.className=["wp-block-comments-query-loop",t].join(" "))}if("core/post-comments"===e&&(e="core/comments",r.legacy=!0),"grid"===t.layout?.type&&"string"==typeof t.layout?.columnCount&&(r.layout={...r.layout,columnCount:parseInt(t.layout.columnCount,10)}),"string"==typeof t.style?.layout?.columnSpan){const e=parseInt(t.style.layout.columnSpan,10);r.style={...r.style,layout:{...r.style.layout,columnSpan:isNaN(e)?void 0:e}}}if("string"==typeof t.style?.layout?.rowSpan){const e=parseInt(t.style.layout.rowSpan,10);r.style={...r.style,layout:{...r.style.layout,rowSpan:isNaN(e)?void 0:e}}}return[e,r]}var $n,Un=function(){return $n||($n=document.implementation.createHTMLDocument("")),$n};function Fn(e,t){if(t){if("string"==typeof e){var r=Un();r.body.innerHTML=e,e=r.body}if("function"==typeof t)return t(e);if(Object===t.constructor)return Object.keys(t).reduce((function(r,n){return r[n]=Fn(e,t[n]),r}),{})}}function qn(e,t){return 1===arguments.length&&(t=e,e=void 0),function(r){var n=r;if(e&&(n=r.querySelector(e)),n)return function(e,t){for(var r,n=t.split(".");r=n.shift();){if(!(r in e))return;e=e[r]}return e}(n,t)}}function Gn(e){const t={};for(let r=0;r<e.length;r++){const{name:n,value:o}=e[r];t[n]=o}return t}function Kn(e){if(Q()("wp.blocks.node.fromDOM",{since:"6.1",version:"6.3",alternative:"wp.richText.create",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),e.nodeType===e.TEXT_NODE)return e.nodeValue;if(e.nodeType!==e.ELEMENT_NODE)throw new TypeError("A block node can only be created from a node of type text or element.");return{type:e.nodeName.toLowerCase(),props:{...Gn(e.attributes),children:Qn(e.childNodes)}}}function Wn(e){return Q()("wp.blocks.node.matcher",{since:"6.1",version:"6.3",alternative:"html source",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),t=>{let r=t;e&&(r=t.querySelector(e));try{return Kn(r)}catch(e){return null}}}const Yn={isNodeOfType:function(e,t){return Q()("wp.blocks.node.isNodeOfType",{since:"6.1",version:"6.3",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),e&&e.type===t},fromDOM:Kn,toHTML:function(e){return Q()("wp.blocks.node.toHTML",{since:"6.1",version:"6.3",alternative:"wp.richText.toHTMLString",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),Zn([e])},matcher:Wn};function Qn(e){Q()("wp.blocks.children.fromDOM",{since:"6.1",version:"6.3",alternative:"wp.richText.create",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"});const t=[];for(let r=0;r<e.length;r++)try{t.push(Kn(e[r]))}catch(e){}return t}function Zn(e){Q()("wp.blocks.children.toHTML",{since:"6.1",version:"6.3",alternative:"wp.richText.toHTMLString",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"});const t=e;return(0,G.renderToString)(t)}function Xn(e){return Q()("wp.blocks.children.matcher",{since:"6.1",version:"6.3",alternative:"html source",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),t=>{let r=t;return e&&(r=t.querySelector(e)),r?Qn(r.childNodes):[]}}const Jn={concat:function(...e){Q()("wp.blocks.children.concat",{since:"6.1",version:"6.3",alternative:"wp.richText.concat",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"});const t=[];for(let r=0;r<e.length;r++){const n=Array.isArray(e[r])?e[r]:[e[r]];for(let e=0;e<n.length;e++){const r=n[e];"string"==typeof r&&"string"==typeof t[t.length-1]?t[t.length-1]+=r:t.push(r)}}return t},getChildrenArray:function(e){return Q()("wp.blocks.children.getChildrenArray",{since:"6.1",version:"6.3",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),e},fromDOM:Qn,toHTML:Zn,matcher:Xn};function eo(e,t){return t.some((t=>function(e,t){switch(t){case"rich-text":return e instanceof W.RichTextData;case"string":return"string"==typeof e;case"boolean":return"boolean"==typeof e;case"object":return!!e&&e.constructor===Object;case"null":return null===e;case"array":return Array.isArray(e);case"integer":case"number":return"number"==typeof e}return!0}(e,t)))}function to(e,t,r,n,o){let a;switch(t.source){case void 0:a=n?n[e]:void 0;break;case"raw":a=o;break;case"attribute":case"property":case"html":case"text":case"rich-text":case"children":case"node":case"query":case"tag":a=oo(r,t)}return function(e,t){return void 0===t||eo(e,Array.isArray(t)?t:[t])}(a,t.type)&&function(e,t){return!Array.isArray(t)||t.includes(e)}(a,t.enum)||(a=void 0),void 0===a&&(a=Ke(t)),a}const ro=function(e,t){var r,n,o=0;function a(){var a,i,s=r,c=arguments.length;e:for(;s;){if(s.args.length===arguments.length){for(i=0;i<c;i++)if(s.args[i]!==arguments[i]){s=s.next;continue e}return s!==r&&(s===n&&(n=s.prev),s.prev.next=s.next,s.next&&(s.next.prev=s.prev),s.next=r,s.prev=null,r.prev=s,r=s),s.val}s=s.next}for(a=new Array(c),i=0;i<c;i++)a[i]=arguments[i];return s={args:a,val:e.apply(null,a)},r?(r.prev=s,s.next=r):n=s,o===t.maxSize?(n=n.prev).next=null:o++,r=s,s.val}return t=t||{},a.clear=function(){r=null,n=null,o=0},a}((e=>{switch(e.source){case"attribute":{let t=function(e,t){return 1===arguments.length&&(t=e,e=void 0),function(r){var n=qn(e,"attributes")(r);if(n&&n.hasOwnProperty(t))return n[t].value}}(e.selector,e.attribute);return"boolean"===e.type&&(t=(e=>t=>void 0!==e(t))(t)),t}case"html":return t=e.selector,r=e.multiline,e=>{let n=e;if(t&&(n=e.querySelector(t)),!n)return"";if(r){let e="";const t=n.children.length;for(let o=0;o<t;o++){const t=n.children[o];t.nodeName.toLowerCase()===r&&(e+=t.outerHTML)}return e}return n.innerHTML};case"text":return function(e){return qn(e,"textContent")}(e.selector);case"rich-text":return((e,t)=>r=>{const n=e?r.querySelector(e):r;return n?W.RichTextData.fromHTMLElement(n,{preserveWhiteSpace:t}):W.RichTextData.empty()})(e.selector,e.__unstablePreserveWhiteSpace);case"children":return Xn(e.selector);case"node":return Wn(e.selector);case"query":const n=Object.fromEntries(Object.entries(e.query).map((([e,t])=>[e,ro(t)])));return function(e,t){return function(r){var n=r.querySelectorAll(e);return[].map.call(n,(function(e){return Fn(e,t)}))}}(e.selector,n);case"tag":{const t=qn(e.selector,"nodeName");return e=>t(e)?.toLowerCase()}default:console.error(`Unknown source type "${e.source}"`)}var t,r}));function no(e){return Fn(e,(e=>e))}function oo(e,t){return ro(t)(no(e))}function ao(e,t,r={}){var n;const o=no(t),a=Fe(e),i=Object.fromEntries(Object.entries(null!==(n=a.attributes)&&void 0!==n?n:{}).map((([e,n])=>[e,to(e,n,o,r,t)])));return(0,qt.applyFilters)("blocks.getBlockAttributes",i,a,t,r)}const io={type:"string",source:"attribute",selector:"[data-custom-class-name] > *",attribute:"class"};function so(e){const t=oo(`<div data-custom-class-name>${e}</div>`,io);return t?t.trim().split(/\s+/):[]}const co={type:"string",source:"attribute",selector:"[data-aria-label] > *",attribute:"aria-label"};function lo(e,t,r){if(!Ce(t,"ariaLabel",!1))return e;const n={...e},o=function(e){return oo(`<div data-aria-label>${e}</div>`,co)}(r);return o&&(n.ariaLabel=o),n}function uo(e,t){const{attributes:r,originalContent:n}=e;let o=r;return o=function(e,t,r){if(!Ce(t,"customClassName",!0))return e;const n={...e},{className:o,...a}=n,i=Zr(t,a),s=so(i),c=so(r).filter((e=>!s.includes(e)));return c.length?n.className=c.join(" "):i&&delete n.className,n}(r,t,n),o=lo(o,t,n),{...e,attributes:o}}function po(){return!1}function fo(e,t){let r=function(e,t){const r=he(),n=e.blockName||he(),o=e.attrs||{},a=e.innerBlocks||[];let i=e.innerHTML.trim();return n!==r||"core/freeform"!==n||t?.__unstableSkipAutop||(i=(0,Rr.autop)(i).trim()),{...e,blockName:n,attrs:o,innerHTML:i,innerBlocks:a}}(e,t);r=function(e){const[t,r]=Vn(e.blockName,e.attrs);return{...e,blockName:t,attrs:r}}(r);let n=we(r.blockName);n||(r=function(e){const t=be()||he(),r=$r(e,{isCommentDelimited:!1}),n=$r(e,{isCommentDelimited:!0});return{blockName:t,attrs:{originalName:e.blockName,originalContent:n,originalUndelimitedContent:r},innerHTML:e.blockName?n:e.innerHTML,innerBlocks:e.innerBlocks,innerContent:e.innerContent}}(r),n=we(r.blockName));const o=r.blockName===he()||r.blockName===be();if(!n||!r.innerHTML&&o)return;const a=r.innerBlocks.map((e=>fo(e,t))).filter((e=>!!e)),i=Tr(r.blockName,ao(n,r.innerHTML,r.attrs),a);i.originalContent=r.innerHTML;const s=function(e,t){const[r]=Rn(e,t);if(r)return{...e,isValid:r,validationIssues:[]};const n=uo(e,t),[o,a]=Rn(n,t);return{...n,isValid:o,validationIssues:a}}(i,n),{validationIssues:c}=s,l=function(e,t,r){const n=t.attrs,{deprecated:o}=r;if(!o||!o.length)return e;for(let a=0;a<o.length;a++){const{isEligible:i=po}=o[a];if(e.isValid&&!i(n,e.innerBlocks,{blockNode:t,block:e}))continue;const s=Object.assign(Xe(r,X),o[a]);let c={...e,attributes:ao(s,e.originalContent,n)},[l]=Rn(c,s);if(l||(c=uo(c,s),[l]=Rn(c,s)),!l)continue;let u=c.innerBlocks,d=c.attributes;const{migrate:p}=s;if(p){let t=p(d,e.innerBlocks);Array.isArray(t)||(t=[t]),[d=n,u=e.innerBlocks]=t}e={...e,attributes:d,innerBlocks:u,isValid:!0,validationIssues:[]}}return e}(s,r,n);return l.isValid||(l.__unstableBlockSource=e),s.isValid||!l.isValid||t?.__unstableSkipMigrationLogs?s.isValid||l.isValid||c.forEach((({log:e,args:t})=>e(...t))):(console.groupCollapsed("Updated Block: %s",n.name),console.info("Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s",n.name,n,Zr(n,l.attributes),l.originalContent),console.groupEnd()),l}function ho(e,t){return(0,Ir.parse)(e).reduce(((e,r)=>{const n=fo(r,t);return n&&e.push(n),e}),[])}function go(){return Mr("from").filter((({type:e})=>"raw"===e)).map((e=>e.isMatch?e:{...e,isMatch:t=>e.selector&&t.matches(e.selector)}))}function mo(e,t){const r=document.implementation.createHTMLDocument("");return r.body.innerHTML=e,Array.from(r.body.children).flatMap((e=>{const r=Lr(go(),(({isMatch:t})=>t(e)));if(!r)return G.Platform.isNative?ho(`\x3c!-- wp:html --\x3e${e.outerHTML}\x3c!-- /wp:html --\x3e`):Tr("core/html",ao("core/html",e.outerHTML));const{transform:n,blockName:o}=r;if(n){const r=n(e,t);return e.hasAttribute("class")&&(r.attributes.className=e.getAttribute("class")),r}return Tr(o,ao(o,e.outerHTML))}))}function bo(e,t={}){const r=document.implementation.createHTMLDocument(""),n=document.implementation.createHTMLDocument(""),o=r.body,a=n.body;for(o.innerHTML=e;o.firstChild;){const e=o.firstChild;e.nodeType===e.TEXT_NODE?(0,K.isEmpty)(e)?o.removeChild(e):(a.lastChild&&"P"===a.lastChild.nodeName||a.appendChild(n.createElement("P")),a.lastChild.appendChild(e)):e.nodeType===e.ELEMENT_NODE?"BR"===e.nodeName?(e.nextSibling&&"BR"===e.nextSibling.nodeName&&(a.appendChild(n.createElement("P")),o.removeChild(e.nextSibling)),a.lastChild&&"P"===a.lastChild.nodeName&&a.lastChild.hasChildNodes()?a.lastChild.appendChild(e):o.removeChild(e)):"P"===e.nodeName?(0,K.isEmpty)(e)&&!t.raw?o.removeChild(e):a.appendChild(e):(0,K.isPhrasingContent)(e)?(a.lastChild&&"P"===a.lastChild.nodeName||a.appendChild(n.createElement("P")),a.lastChild.appendChild(e)):a.appendChild(e):o.removeChild(e)}return a.innerHTML}function _o(e,t){if(e.nodeType!==e.COMMENT_NODE)return;if("nextpage"!==e.nodeValue&&0!==e.nodeValue.indexOf("more"))return;const r=function(e,t){if("nextpage"===e.nodeValue)return function(e){const t=e.createElement("wp-block");return t.dataset.block="core/nextpage",t}(t);const r=e.nodeValue.slice(4).trim();let n=e,o=!1;for(;n=n.nextSibling;)if(n.nodeType===n.COMMENT_NODE&&"noteaser"===n.nodeValue){o=!0,(0,K.remove)(n);break}return function(e,t,r){const n=r.createElement("wp-block");n.dataset.block="core/more",e&&(n.dataset.customText=e);t&&(n.dataset.noTeaser="");return n}(r,o,t)}(e,t);if(e.parentNode&&"P"===e.parentNode.nodeName){const n=Array.from(e.parentNode.childNodes),o=n.indexOf(e),a=e.parentNode.parentNode||t.body,i=(e,r)=>(e||(e=t.createElement("p")),e.appendChild(r),e);[n.slice(0,o).reduce(i,null),r,n.slice(o+1).reduce(i,null)].forEach((t=>t&&a.insertBefore(t,e.parentNode))),(0,K.remove)(e.parentNode)}else(0,K.replace)(e,r)}function yo(e){return"OL"===e.nodeName||"UL"===e.nodeName}function ko(e){if(!yo(e))return;const t=e,r=e.previousElementSibling;if(r&&r.nodeName===e.nodeName&&1===t.children.length){for(;t.firstChild;)r.appendChild(t.firstChild);t.parentNode.removeChild(t)}const n=e.parentNode;if(n&&"LI"===n.nodeName&&1===n.children.length&&!/\S/.test((o=n,Array.from(o.childNodes).map((({nodeValue:e=""})=>e)).join("")))){const e=n,r=e.previousElementSibling,o=e.parentNode;r&&(r.appendChild(t),o.removeChild(e))}var o;if(n&&yo(n)){const t=e.previousElementSibling;t?t.appendChild(e):(0,K.unwrap)(e)}}function wo(e){return t=>{"BLOCKQUOTE"===t.nodeName&&(t.innerHTML=bo(t.innerHTML,e))}}function vo(e,t=e){const r=e.ownerDocument.createElement("figure");t.parentNode.insertBefore(r,t),r.appendChild(e)}function To(e,t,r){if(!function(e,t){var r;const n=e.nodeName.toLowerCase();return"figcaption"!==n&&!(0,K.isTextContent)(e)&&n in(null!==(r=t?.figure?.children)&&void 0!==r?r:{})}(e,r))return;let n=e;const o=e.parentNode;(function(e,t){var r;return e.nodeName.toLowerCase()in(null!==(r=t?.figure?.children?.a?.children)&&void 0!==r?r:{})})(e,r)&&"A"===o.nodeName&&1===o.childNodes.length&&(n=e.parentNode);const a=n.closest("p,div");a?e.classList?(e.classList.contains("alignright")||e.classList.contains("alignleft")||e.classList.contains("aligncenter")||!a.textContent.trim())&&vo(n,a):vo(n,a):vo(n)}const Co=window.wp.shortcode,xo=e=>Array.isArray(e)?e:[e],Eo=/(\n|<p>)\s*$/,So=/^\s*(\n|<\/p>)/;const Bo=function e(t,r=0,n=[]){const o=Lr(Mr("from"),(e=>-1===n.indexOf(e.blockName)&&"shortcode"===e.type&&xo(e.tag).some((e=>(0,Co.regexp)(e).test(t)))));if(!o)return[t];const a=xo(o.tag).find((e=>(0,Co.regexp)(e).test(t)));let i;const s=r;if(i=(0,Co.next)(a,t,r)){r=i.index+i.content.length;const a=t.substr(0,i.index),c=t.substr(r);if(!(i.shortcode.content?.includes("<")||Eo.test(a)&&So.test(c)))return e(t,r);if(o.isMatch&&!o.isMatch(i.shortcode.attrs))return e(t,s,[...n,o.blockName]);let l=[];if("function"==typeof o.transform)l=[].concat(o.transform(i.shortcode.attrs,i)),l=l.map((e=>(e.originalContent=i.shortcode.content,uo(e,we(e.name)))));else{const e=Object.fromEntries(Object.entries(o.attributes).filter((([,e])=>e.shortcode)).map((([e,t])=>[e,t.shortcode(i.shortcode.attrs,i)]))),r=we(o.blockName);if(!r)return[t];const n={...r,attributes:o.attributes};let a=Tr(o.blockName,ao(n,i.shortcode.content,e));a.originalContent=i.shortcode.content,a=uo(a,n),l=[a]}return[...e(a.replace(Eo,"")),...l,...e(c.replace(So,""))]}return[t]};function Ao(e){return function(e,t){const r={phrasingContentSchema:(0,K.getPhrasingContentSchema)(t),isPaste:"paste"===t};function n(e,t,r){switch(r){case"children":return"*"===e||"*"===t?"*":{...e,...t};case"attributes":case"require":return[...e||[],...t||[]];case"isMatch":if(!e||!t)return;return(...r)=>e(...r)||t(...r)}}function o(e,t){for(const r in t)e[r]=e[r]?n(e[r],t[r],r):{...t[r]};return e}return e.map((({isMatch:e,blockName:t,schema:n})=>{const o=Ce(t,"anchor");return n="function"==typeof n?n(r):n,o||e?n?Object.fromEntries(Object.entries(n).map((([t,r])=>{let n=r.attributes||[];return o&&(n=[...n,"id"]),[t,{...r,attributes:n,isMatch:e||void 0}]}))):{}:n})).reduce((function(e,t){for(const r in t)e[r]=e[r]?o(e[r],t[r]):{...t[r]};return e}),{})}(go(),e)}function No(e,t,r,n){Array.from(e).forEach((e=>{No(e.childNodes,t,r,n),t.forEach((t=>{r.contains(e)&&t(e,r,n)}))}))}function Po(e,t=[],r){const n=document.implementation.createHTMLDocument("");return n.body.innerHTML=e,No(n.body.childNodes,t,n,r),n.body.innerHTML}function Oo(e,t){const r=e[`${t}Sibling`];if(r&&(0,K.isPhrasingContent)(r))return r;const{parentNode:n}=e;return n&&(0,K.isPhrasingContent)(n)?Oo(n,t):void 0}function Lo(e){return Q()("wp.blocks.getPhrasingContentSchema",{since:"5.6",alternative:"wp.dom.getPhrasingContentSchema"}),(0,K.getPhrasingContentSchema)(e)}function Mo({HTML:e=""}){if(-1!==e.indexOf("\x3c!-- wp:")){const t=ho(e);if(!(1===t.length&&"core/freeform"===t[0].name))return t}const t=Bo(e),r=Ao();return t.map((e=>{if("string"!=typeof e)return e;return mo(e=bo(e=Po(e,[ko,_o,To,wo({raw:!0})],r),{raw:!0}),Mo)})).flat().filter(Boolean)}function jo(e){e.nodeType===e.COMMENT_NODE&&(0,K.remove)(e)}function Do(e,t){return e.every((e=>function(e,t){if((0,K.isTextContent)(e))return!0;if(!t)return!1;const r=e.nodeName.toLowerCase();return[["ul","li","ol"],["h1","h2","h3","h4","h5","h6"]].some((e=>0===[r,t].filter((t=>!e.includes(t))).length))}(e,t)&&Do(Array.from(e.children),t)))}function zo(e){return"BR"===e.nodeName&&e.previousSibling&&"BR"===e.previousSibling.nodeName}function Io(e,t){if("SPAN"===e.nodeName&&e.style){const{fontWeight:r,fontStyle:n,textDecorationLine:o,textDecoration:a,verticalAlign:i}=e.style;"bold"!==r&&"700"!==r||(0,K.wrap)(t.createElement("strong"),e),"italic"===n&&(0,K.wrap)(t.createElement("em"),e),("line-through"===o||a.includes("line-through"))&&(0,K.wrap)(t.createElement("s"),e),"super"===i?(0,K.wrap)(t.createElement("sup"),e):"sub"===i&&(0,K.wrap)(t.createElement("sub"),e)}else"B"===e.nodeName?e=(0,K.replaceTag)(e,"strong"):"I"===e.nodeName?e=(0,K.replaceTag)(e,"em"):"A"===e.nodeName&&(e.target&&"_blank"===e.target.toLowerCase()?e.rel="noreferrer noopener":(e.removeAttribute("target"),e.removeAttribute("rel")),e.name&&!e.id&&(e.id=e.name),e.id&&!e.ownerDocument.querySelector(`[href="#${e.id}"]`)&&e.removeAttribute("id"))}function Ro(e){"SCRIPT"!==e.nodeName&&"NOSCRIPT"!==e.nodeName&&"TEMPLATE"!==e.nodeName&&"STYLE"!==e.nodeName||e.parentNode.removeChild(e)}function Ho(e){if(e.nodeType!==e.ELEMENT_NODE)return;const t=e.getAttribute("style");if(!t||!t.includes("mso-list"))return;"ignore"===t.split(";").reduce(((e,t)=>{const[r,n]=t.split(":");return r&&n&&(e[r.trim().toLowerCase()]=n.trim().toLowerCase()),e}),{})["mso-list"]&&e.remove()}function Vo(e){return"OL"===e.nodeName||"UL"===e.nodeName}function $o(e,t){if("P"!==e.nodeName)return;const r=e.getAttribute("style");if(!r||!r.includes("mso-list"))return;const n=e.previousElementSibling;if(!n||!Vo(n)){const r=e.textContent.trim().slice(0,1),n=/[1iIaA]/.test(r),o=t.createElement(n?"ol":"ul");n&&o.setAttribute("type",r),e.parentNode.insertBefore(o,e)}const o=e.previousElementSibling,a=o.nodeName,i=t.createElement("li");let s=o;i.innerHTML=Po(e.innerHTML,[Ho]);const c=/mso-list\s*:[^;]+level([0-9]+)/i.exec(r);let l=c&&parseInt(c[1],10)-1||0;for(;l--;)s=s.lastChild||s,Vo(s)&&(s=s.lastChild||s);Vo(s)||(s=s.appendChild(t.createElement(a))),s.appendChild(i),e.parentNode.removeChild(e)}const Uo=window.wp.blob;function Fo(e){if("IMG"===e.nodeName){if(0===e.src.indexOf("file:")&&(e.src=""),0===e.src.indexOf("data:")){const[t,r]=e.src.split(","),[n]=t.slice(5).split(";");if(!r||!n)return void(e.src="");let o;try{o=atob(r)}catch(t){return void(e.src="")}const a=new Uint8Array(o.length);for(let e=0;e<a.length;e++)a[e]=o.charCodeAt(e);const i=n.replace("/","."),s=new window.File([a],i,{type:n});e.src=(0,Uo.createBlobURL)(s)}1!==e.height&&1!==e.width||e.parentNode.removeChild(e)}}function qo(e){"DIV"===e.nodeName&&(e.innerHTML=bo(e.innerHTML))}var Go=r(1030);const Ko=new(r.n(Go)().Converter)({noHeaderId:!0,tables:!0,literalMidWordUnderscores:!0,omitExtraWLInCodeBlocks:!0,simpleLineBreaks:!0,strikethrough:!0});function Wo(e){if("IFRAME"===e.nodeName){const t=e.ownerDocument.createTextNode(e.src);e.parentNode.replaceChild(t,e)}}function Yo(e){e.id&&0===e.id.indexOf("docs-internal-guid-")&&("B"===e.tagName?(0,K.unwrap)(e):e.removeAttribute("id"))}function Qo(e){if(e.nodeType!==e.TEXT_NODE)return;let t=e;for(;t=t.parentNode;)if(t.nodeType===t.ELEMENT_NODE&&"PRE"===t.nodeName)return;let r=e.data.replace(/[ \r\n\t]+/g," ");if(" "===r[0]){const t=Oo(e,"previous");t&&"BR"!==t.nodeName&&" "!==t.textContent.slice(-1)||(r=r.slice(1))}if(" "===r[r.length-1]){const t=Oo(e,"next");(!t||"BR"===t.nodeName||t.nodeType===t.TEXT_NODE&&(" "===(n=t.textContent[0])||"\r"===n||"\n"===n||"\t"===n))&&(r=r.slice(0,-1))}var n;r?e.data=r:e.parentNode.removeChild(e)}function Zo(e){"BR"===e.nodeName&&(Oo(e,"next")||e.parentNode.removeChild(e))}function Xo(e){"P"===e.nodeName&&(e.hasChildNodes()||e.parentNode.removeChild(e))}function Jo(e){if("SPAN"!==e.nodeName)return;if("paragraph-break"!==e.getAttribute("data-stringify-type"))return;const{parentNode:t}=e;t.insertBefore(e.ownerDocument.createElement("br"),e),t.insertBefore(e.ownerDocument.createElement("br"),e),t.removeChild(e)}const ea=(...e)=>window?.console?.log?.(...e);function ta(e){return e=Po(e,[Ro,Yo,Ho,Io,jo]),e=Po(e=(0,K.removeInvalidHTML)(e,(0,K.getPhrasingContentSchema)("paste"),{inline:!0}),[Qo,Zo]),ea("Processed inline HTML:\n\n",e),e}function ra({HTML:e="",plainText:t="",mode:r="AUTO",tagName:n}){if(e=(e=(e=e.replace(/<meta[^>]+>/g,"")).replace(/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i,"")).replace(/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i,""),"INLINE"!==r){const r=e||t;if(-1!==r.indexOf("\x3c!-- wp:")){const e=ho(r);if(!(1===e.length&&"core/freeform"===e[0].name))return e}}String.prototype.normalize&&(e=e.normalize()),e=Po(e,[Jo]);const o=t&&(!e||function(e){return!/<(?!br[ />])/i.test(e)}(e));var a;o&&(e=t,/^\s+$/.test(t)||(a=e,e=Ko.makeHtml(function(e){return e.replace(/((?:^|\n)```)([^\n`]+)(```(?:$|\n))/,((e,t,r,n)=>`${t}\n${r}\n${n}`))}(function(e){return e.replace(/(^|\n)•( +)/g,"$1*$2")}(a)))));const i=Bo(e),s=i.length>1;if(o&&!s&&"AUTO"===r&&-1===t.indexOf("\n")&&0!==t.indexOf("<p>")&&0===e.indexOf("<p>")&&(r="INLINE"),"INLINE"===r)return ta(e);if("AUTO"===r&&!s&&function(e,t){const r=document.implementation.createHTMLDocument("");r.body.innerHTML=e;const n=Array.from(r.body.children);return!n.some(zo)&&Do(n,t)}(e,n))return ta(e);const c=(0,K.getPhrasingContentSchema)("paste"),l=Ao("paste"),u=i.map((e=>{if("string"!=typeof e)return e;const t=[Yo,$o,Ro,ko,Fo,Io,_o,jo,Wo,To,wo(),qo],r={...l,...c};return e=Po(e,t,l),e=Po(e=bo(e=(0,K.removeInvalidHTML)(e,r)),[Qo,Zo,Xo],l),ea("Processed HTML piece:\n\n",e),mo(e,ra)})).flat().filter(Boolean);if("AUTO"===r&&1===u.length&&Ce(u[0].name,"__unstablePasteTextInline",!1)){const e=/^[\n]+|[\n]+$/g,r=t.replace(e,"");if(""!==r&&-1===r.indexOf("\n"))return(0,K.removeInvalidHTML)(Xr(u[0]),c).replace(e,"")}return u}function na(){return(0,i.select)(gr).getCategories()}function oa(e){(0,i.dispatch)(gr).setCategories(e)}function aa(e,t){(0,i.dispatch)(gr).updateCategory(e,t)}function ia(e=[],t=[]){return e.length===t.length&&t.every((([t,,r],n)=>{const o=e[n];return t===o.name&&ia(o.innerBlocks,r)}))}const sa=e=>"html"===e?.source,ca=e=>"query"===e?.source;function la(e,t){return t?Object.fromEntries(Object.entries(t).map((([t,r])=>[t,ua(e[t],r)]))):{}}function ua(e,t){return sa(e)&&Array.isArray(t)?(0,G.renderToString)(t):ca(e)&&t?t.map((t=>la(e.query,t))):t}function da(e=[],t){return t?t.map((([t,r,n],o)=>{var a;const i=e[o];if(i&&i.name===t){const e=da(i.innerBlocks,n);return{...i,innerBlocks:e}}const s=we(t),c=la(null!==(a=s?.attributes)&&void 0!==a?a:{},r),[l,u]=Vn(t,c);return Tr(l,u,da([],n))})):e}const pa={};function fa(e){return Q()("wp.blocks.withBlockContentContext",{since:"6.1"}),e}ne(pa,{isContentBlock:function(e){const t=we(e)?.attributes;return!!t&&!!Object.keys(t)?.some((e=>{const r=t[e];return"content"===r?.role||"content"===r?.__experimentalRole}))}})})(),(window.wp=window.wp||{}).blocks=n})(); dist/core-commands.min.js 0000644 00000022310 15125140777 0011365 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(t,a)=>{for(var o in a)e.o(a,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:a[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{privateApis:()=>P});const a=window.wp.commands,o=window.wp.i18n,s=window.wp.primitives,n=window.ReactJSXRuntime,i=(0,n.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(s.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),r=window.wp.url,c=window.wp.coreData,d=window.wp.data,l=window.wp.element,p=window.wp.notices,m=window.wp.router,w=window.wp.privateApis,{lock:h,unlock:u}=(0,w.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/core-commands"),{useHistory:g}=u(m.privateApis);const v=(0,n.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(s.Path,{d:"m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"})}),_=(0,n.jsxs)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,n.jsx)(s.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,n.jsx)(s.Path,{d:"M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"})]}),y=(0,n.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(s.Path,{d:"M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})}),b=(0,n.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(s.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})}),k=(0,n.jsx)(s.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)(s.Path,{d:"M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"})}),f=(0,n.jsx)(s.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)(s.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"})}),x=(0,n.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(s.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})}),T=window.wp.compose,L=window.wp.htmlEntities;const{useHistory:V}=u(m.privateApis),C={post:v,page:_,wp_template:y,wp_template_part:b};const S=e=>function({search:t}){const a=V(),{isBlockBasedTheme:s,canCreateTemplate:n}=(0,d.useSelect)((e=>({isBlockBasedTheme:e(c.store).getCurrentTheme()?.is_block_theme,canCreateTemplate:e(c.store).canUser("create",{kind:"postType",name:"wp_template"})})),[]),i=function(e){const[t,a]=(0,l.useState)(""),o=(0,T.useDebounce)(a,250);return(0,l.useEffect)((()=>(o(e),()=>o.cancel())),[o,e]),t}(t),{records:p,isLoading:m}=(0,d.useSelect)((t=>{if(!i)return{isLoading:!1};const a={search:i,per_page:10,orderby:"relevance",status:["publish","future","draft","pending","private"]};return{records:t(c.store).getEntityRecords("postType",e,a),isLoading:!t(c.store).hasFinishedResolution("getEntityRecords",["postType",e,a])}}),[i]);return{commands:(0,l.useMemo)((()=>(null!=p?p:[]).map((t=>{const i={name:e+"-"+t.id,searchLabel:t.title?.rendered+" "+t.id,label:t.title?.rendered?(0,L.decodeEntities)(t.title?.rendered):(0,o.__)("(no title)"),icon:C[e]};if(!n||"post"===e||"page"===e&&!s)return{...i,callback:({close:e})=>{const a={post:t.id,action:"edit"},o=(0,r.addQueryArgs)("post.php",a);document.location=o,e()}};const c=(0,r.getPath)(window.location.href)?.includes("site-editor.php");return{...i,callback:({close:o})=>{c?a.navigate(`/${e}/${t.id}?canvas=edit`):document.location=(0,r.addQueryArgs)("site-editor.php",{p:`/${e}/${t.id}`,canvas:"edit"}),o()}}}))),[n,p,s,a]),isLoading:m}},j=e=>function({search:t}){const a=V(),{isBlockBasedTheme:s,canCreateTemplate:n}=(0,d.useSelect)((t=>({isBlockBasedTheme:t(c.store).getCurrentTheme()?.is_block_theme,canCreateTemplate:t(c.store).canUser("create",{kind:"postType",name:e})})),[]),{records:i,isLoading:p}=(0,d.useSelect)((t=>{const{getEntityRecords:a}=t(c.store),o={per_page:-1};return{records:a("postType",e,o),isLoading:!t(c.store).hasFinishedResolution("getEntityRecords",["postType",e,o])}}),[]),m=(0,l.useMemo)((()=>function(e=[],t=""){if(!Array.isArray(e)||!e.length)return[];if(!t)return e;const a=[],o=[];for(let s=0;s<e.length;s++){const n=e[s];n?.title?.raw?.toLowerCase()?.includes(t?.toLowerCase())?a.push(n):o.push(n)}return a.concat(o)}(i,t).slice(0,10)),[i,t]);return{commands:(0,l.useMemo)((()=>{if(!n||!s&&"wp_template_part"===!e)return[];const t=(0,r.getPath)(window.location.href)?.includes("site-editor.php"),i=[];return i.push(...m.map((s=>({name:e+"-"+s.id,searchLabel:s.title?.rendered+" "+s.id,label:s.title?.rendered?s.title?.rendered:(0,o.__)("(no title)"),icon:C[e],callback:({close:o})=>{t?a.navigate(`/${e}/${s.id}?canvas=edit`):document.location=(0,r.addQueryArgs)("site-editor.php",{p:`/${e}/${s.id}`,canvas:"edit"}),o()}})))),m?.length>0&&"wp_template_part"===e&&i.push({name:"core/edit-site/open-template-parts",label:(0,o.__)("Template parts"),icon:b,callback:({close:e})=>{t?a.navigate("/pattern?postType=wp_template_part&categoryId=all-parts"):document.location=(0,r.addQueryArgs)("site-editor.php",{p:"/pattern",postType:"wp_template_part",categoryId:"all-parts"}),e()}}),i}),[n,s,m,a]),isLoading:p}};const P={};h(P,{useCommands:function(){(0,a.useCommand)({name:"core/add-new-post",label:(0,o.__)("Add new post"),icon:i,callback:()=>{document.location.assign("post-new.php")}}),(0,a.useCommandLoader)({name:"core/add-new-page",hook:function(){const e=(0,r.getPath)(window.location.href)?.includes("site-editor.php"),t=g(),a=(0,d.useSelect)((e=>e(c.store).getCurrentTheme()?.is_block_theme),[]),{saveEntityRecord:s}=(0,d.useDispatch)(c.store),{createErrorNotice:n}=(0,d.useDispatch)(p.store),m=(0,l.useCallback)((async({close:e})=>{try{const e=await s("postType","page",{status:"draft"},{throwOnError:!0});e?.id&&t.navigate(`/page/${e.id}?canvas=edit`)}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,o.__)("An error occurred while creating the item.");n(t,{type:"snackbar"})}finally{e()}}),[n,t,s]);return{isLoading:!1,commands:(0,l.useMemo)((()=>{const t=e&&a?m:()=>document.location.href="post-new.php?post_type=page";return[{name:"core/add-new-page",label:(0,o.__)("Add new page"),icon:i,callback:t}]}),[m,e,a])}}}),(0,a.useCommandLoader)({name:"core/edit-site/navigate-pages",hook:S("page")}),(0,a.useCommandLoader)({name:"core/edit-site/navigate-posts",hook:S("post")}),(0,a.useCommandLoader)({name:"core/edit-site/navigate-templates",hook:j("wp_template")}),(0,a.useCommandLoader)({name:"core/edit-site/navigate-template-parts",hook:j("wp_template_part")}),(0,a.useCommandLoader)({name:"core/edit-site/basic-navigation",hook:function(){const e=V(),t=(0,r.getPath)(window.location.href)?.includes("site-editor.php"),{isBlockBasedTheme:a,canCreateTemplate:s}=(0,d.useSelect)((e=>({isBlockBasedTheme:e(c.store).getCurrentTheme()?.is_block_theme,canCreateTemplate:e(c.store).canUser("create",{kind:"postType",name:"wp_template"})})),[]);return{commands:(0,l.useMemo)((()=>{const n=[];return s&&a&&(n.push({name:"core/edit-site/open-navigation",label:(0,o.__)("Navigation"),icon:k,callback:({close:a})=>{t?e.navigate("/navigation"):document.location=(0,r.addQueryArgs)("site-editor.php",{p:"/navigation"}),a()}}),n.push({name:"core/edit-site/open-styles",label:(0,o.__)("Styles"),icon:f,callback:({close:a})=>{t?e.navigate("/styles"):document.location=(0,r.addQueryArgs)("site-editor.php",{p:"/styles"}),a()}}),n.push({name:"core/edit-site/open-pages",label:(0,o.__)("Pages"),icon:_,callback:({close:a})=>{t?e.navigate("/page"):document.location=(0,r.addQueryArgs)("site-editor.php",{p:"/page"}),a()}}),n.push({name:"core/edit-site/open-templates",label:(0,o.__)("Templates"),icon:y,callback:({close:a})=>{t?e.navigate("/template"):document.location=(0,r.addQueryArgs)("site-editor.php",{p:"/template"}),a()}})),n.push({name:"core/edit-site/open-patterns",label:(0,o.__)("Patterns"),icon:x,callback:({close:a})=>{s?(t?e.navigate("/pattern"):document.location=(0,r.addQueryArgs)("site-editor.php",{p:"/pattern"}),a()):document.location.href="edit.php?post_type=wp_block"}}),n}),[e,t,s,a]),isLoading:!1}},context:"site-editor"})}}),(window.wp=window.wp||{}).coreCommands=t})(); dist/compose.js 0000644 00000607154 15125140777 0007540 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 1933: /***/ ((module, exports, __webpack_require__) => { var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */ /** * Copyright 2012-2017 Craig Campbell * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Mousetrap is a simple keyboard shortcut library for Javascript with * no external dependencies * * @version 1.6.5 * @url craig.is/killing/mice */ (function(window, document, undefined) { // Check if mousetrap is used inside browser, if not, return if (!window) { return; } /** * mapping of special keycodes to their corresponding keys * * everything in this dictionary cannot use keypress events * so it has to be here to map to the correct keycodes for * keyup/keydown events * * @type {Object} */ var _MAP = { 8: 'backspace', 9: 'tab', 13: 'enter', 16: 'shift', 17: 'ctrl', 18: 'alt', 20: 'capslock', 27: 'esc', 32: 'space', 33: 'pageup', 34: 'pagedown', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down', 45: 'ins', 46: 'del', 91: 'meta', 93: 'meta', 224: 'meta' }; /** * mapping for special characters so they can support * * this dictionary is only used incase you want to bind a * keyup or keydown event to one of these keys * * @type {Object} */ var _KEYCODE_MAP = { 106: '*', 107: '+', 109: '-', 110: '.', 111 : '/', 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\', 221: ']', 222: '\'' }; /** * this is a mapping of keys that require shift on a US keypad * back to the non shift equivelents * * this is so you can use keyup events with these keys * * note that this will only work reliably on US keyboards * * @type {Object} */ var _SHIFT_MAP = { '~': '`', '!': '1', '@': '2', '#': '3', '$': '4', '%': '5', '^': '6', '&': '7', '*': '8', '(': '9', ')': '0', '_': '-', '+': '=', ':': ';', '\"': '\'', '<': ',', '>': '.', '?': '/', '|': '\\' }; /** * this is a list of special strings you can use to map * to modifier keys when you specify your keyboard shortcuts * * @type {Object} */ var _SPECIAL_ALIASES = { 'option': 'alt', 'command': 'meta', 'return': 'enter', 'escape': 'esc', 'plus': '+', 'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl' }; /** * variable to store the flipped version of _MAP from above * needed to check if we should use keypress or not when no action * is specified * * @type {Object|undefined} */ var _REVERSE_MAP; /** * loop through the f keys, f1 to f19 and add them to the map * programatically */ for (var i = 1; i < 20; ++i) { _MAP[111 + i] = 'f' + i; } /** * loop through to map numbers on the numeric keypad */ for (i = 0; i <= 9; ++i) { // This needs to use a string cause otherwise since 0 is falsey // mousetrap will never fire for numpad 0 pressed as part of a keydown // event. // // @see https://github.com/ccampbell/mousetrap/pull/258 _MAP[i + 96] = i.toString(); } /** * cross browser add event method * * @param {Element|HTMLDocument} object * @param {string} type * @param {Function} callback * @returns void */ function _addEvent(object, type, callback) { if (object.addEventListener) { object.addEventListener(type, callback, false); return; } object.attachEvent('on' + type, callback); } /** * takes the event and returns the key character * * @param {Event} e * @return {string} */ function _characterFromEvent(e) { // for keypress events we should return the character as is if (e.type == 'keypress') { var character = String.fromCharCode(e.which); // if the shift key is not pressed then it is safe to assume // that we want the character to be lowercase. this means if // you accidentally have caps lock on then your key bindings // will continue to work // // the only side effect that might not be desired is if you // bind something like 'A' cause you want to trigger an // event when capital A is pressed caps lock will no longer // trigger the event. shift+a will though. if (!e.shiftKey) { character = character.toLowerCase(); } return character; } // for non keypress events the special maps are needed if (_MAP[e.which]) { return _MAP[e.which]; } if (_KEYCODE_MAP[e.which]) { return _KEYCODE_MAP[e.which]; } // if it is not in the special map // with keydown and keyup events the character seems to always // come in as an uppercase character whether you are pressing shift // or not. we should make sure it is always lowercase for comparisons return String.fromCharCode(e.which).toLowerCase(); } /** * checks if two arrays are equal * * @param {Array} modifiers1 * @param {Array} modifiers2 * @returns {boolean} */ function _modifiersMatch(modifiers1, modifiers2) { return modifiers1.sort().join(',') === modifiers2.sort().join(','); } /** * takes a key event and figures out what the modifiers are * * @param {Event} e * @returns {Array} */ function _eventModifiers(e) { var modifiers = []; if (e.shiftKey) { modifiers.push('shift'); } if (e.altKey) { modifiers.push('alt'); } if (e.ctrlKey) { modifiers.push('ctrl'); } if (e.metaKey) { modifiers.push('meta'); } return modifiers; } /** * prevents default for this event * * @param {Event} e * @returns void */ function _preventDefault(e) { if (e.preventDefault) { e.preventDefault(); return; } e.returnValue = false; } /** * stops propogation for this event * * @param {Event} e * @returns void */ function _stopPropagation(e) { if (e.stopPropagation) { e.stopPropagation(); return; } e.cancelBubble = true; } /** * determines if the keycode specified is a modifier key or not * * @param {string} key * @returns {boolean} */ function _isModifier(key) { return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta'; } /** * reverses the map lookup so that we can look for specific keys * to see what can and can't use keypress * * @return {Object} */ function _getReverseMap() { if (!_REVERSE_MAP) { _REVERSE_MAP = {}; for (var key in _MAP) { // pull out the numeric keypad from here cause keypress should // be able to detect the keys from the character if (key > 95 && key < 112) { continue; } if (_MAP.hasOwnProperty(key)) { _REVERSE_MAP[_MAP[key]] = key; } } } return _REVERSE_MAP; } /** * picks the best action based on the key combination * * @param {string} key - character for key * @param {Array} modifiers * @param {string=} action passed in */ function _pickBestAction(key, modifiers, action) { // if no action was picked in we should try to pick the one // that we think would work best for this key if (!action) { action = _getReverseMap()[key] ? 'keydown' : 'keypress'; } // modifier keys don't work as expected with keypress, // switch to keydown if (action == 'keypress' && modifiers.length) { action = 'keydown'; } return action; } /** * Converts from a string key combination to an array * * @param {string} combination like "command+shift+l" * @return {Array} */ function _keysFromString(combination) { if (combination === '+') { return ['+']; } combination = combination.replace(/\+{2}/g, '+plus'); return combination.split('+'); } /** * Gets info for a specific key combination * * @param {string} combination key combination ("command+s" or "a" or "*") * @param {string=} action * @returns {Object} */ function _getKeyInfo(combination, action) { var keys; var key; var i; var modifiers = []; // take the keys from this pattern and figure out what the actual // pattern is all about keys = _keysFromString(combination); for (i = 0; i < keys.length; ++i) { key = keys[i]; // normalize key names if (_SPECIAL_ALIASES[key]) { key = _SPECIAL_ALIASES[key]; } // if this is not a keypress event then we should // be smart about using shift keys // this will only work for US keyboards however if (action && action != 'keypress' && _SHIFT_MAP[key]) { key = _SHIFT_MAP[key]; modifiers.push('shift'); } // if this key is a modifier then add it to the list of modifiers if (_isModifier(key)) { modifiers.push(key); } } // depending on what the key combination is // we will try to pick the best event for it action = _pickBestAction(key, modifiers, action); return { key: key, modifiers: modifiers, action: action }; } function _belongsTo(element, ancestor) { if (element === null || element === document) { return false; } if (element === ancestor) { return true; } return _belongsTo(element.parentNode, ancestor); } function Mousetrap(targetElement) { var self = this; targetElement = targetElement || document; if (!(self instanceof Mousetrap)) { return new Mousetrap(targetElement); } /** * element to attach key events to * * @type {Element} */ self.target = targetElement; /** * a list of all the callbacks setup via Mousetrap.bind() * * @type {Object} */ self._callbacks = {}; /** * direct map of string combinations to callbacks used for trigger() * * @type {Object} */ self._directMap = {}; /** * keeps track of what level each sequence is at since multiple * sequences can start out with the same sequence * * @type {Object} */ var _sequenceLevels = {}; /** * variable to store the setTimeout call * * @type {null|number} */ var _resetTimer; /** * temporary state where we will ignore the next keyup * * @type {boolean|string} */ var _ignoreNextKeyup = false; /** * temporary state where we will ignore the next keypress * * @type {boolean} */ var _ignoreNextKeypress = false; /** * are we currently inside of a sequence? * type of action ("keyup" or "keydown" or "keypress") or false * * @type {boolean|string} */ var _nextExpectedAction = false; /** * resets all sequence counters except for the ones passed in * * @param {Object} doNotReset * @returns void */ function _resetSequences(doNotReset) { doNotReset = doNotReset || {}; var activeSequences = false, key; for (key in _sequenceLevels) { if (doNotReset[key]) { activeSequences = true; continue; } _sequenceLevels[key] = 0; } if (!activeSequences) { _nextExpectedAction = false; } } /** * finds all callbacks that match based on the keycode, modifiers, * and action * * @param {string} character * @param {Array} modifiers * @param {Event|Object} e * @param {string=} sequenceName - name of the sequence we are looking for * @param {string=} combination * @param {number=} level * @returns {Array} */ function _getMatches(character, modifiers, e, sequenceName, combination, level) { var i; var callback; var matches = []; var action = e.type; // if there are no events related to this keycode if (!self._callbacks[character]) { return []; } // if a modifier key is coming up on its own we should allow it if (action == 'keyup' && _isModifier(character)) { modifiers = [character]; } // loop through all callbacks for the key that was pressed // and see if any of them match for (i = 0; i < self._callbacks[character].length; ++i) { callback = self._callbacks[character][i]; // if a sequence name is not specified, but this is a sequence at // the wrong level then move onto the next match if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) { continue; } // if the action we are looking for doesn't match the action we got // then we should keep going if (action != callback.action) { continue; } // if this is a keypress event and the meta key and control key // are not pressed that means that we need to only look at the // character, otherwise check the modifiers as well // // chrome will not fire a keypress if meta or control is down // safari will fire a keypress if meta or meta+shift is down // firefox will fire a keypress if meta or control is down if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) { // when you bind a combination or sequence a second time it // should overwrite the first one. if a sequenceName or // combination is specified in this call it does just that // // @todo make deleting its own method? var deleteCombo = !sequenceName && callback.combo == combination; var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level; if (deleteCombo || deleteSequence) { self._callbacks[character].splice(i, 1); } matches.push(callback); } } return matches; } /** * actually calls the callback function * * if your callback function returns false this will use the jquery * convention - prevent default and stop propogation on the event * * @param {Function} callback * @param {Event} e * @returns void */ function _fireCallback(callback, e, combo, sequence) { // if this event should not happen stop here if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) { return; } if (callback(e, combo) === false) { _preventDefault(e); _stopPropagation(e); } } /** * handles a character key event * * @param {string} character * @param {Array} modifiers * @param {Event} e * @returns void */ self._handleKey = function(character, modifiers, e) { var callbacks = _getMatches(character, modifiers, e); var i; var doNotReset = {}; var maxLevel = 0; var processedSequenceCallback = false; // Calculate the maxLevel for sequences so we can only execute the longest callback sequence for (i = 0; i < callbacks.length; ++i) { if (callbacks[i].seq) { maxLevel = Math.max(maxLevel, callbacks[i].level); } } // loop through matching callbacks for this key event for (i = 0; i < callbacks.length; ++i) { // fire for all sequence callbacks // this is because if for example you have multiple sequences // bound such as "g i" and "g t" they both need to fire the // callback for matching g cause otherwise you can only ever // match the first one if (callbacks[i].seq) { // only fire callbacks for the maxLevel to prevent // subsequences from also firing // // for example 'a option b' should not cause 'option b' to fire // even though 'option b' is part of the other sequence // // any sequences that do not match here will be discarded // below by the _resetSequences call if (callbacks[i].level != maxLevel) { continue; } processedSequenceCallback = true; // keep a list of which sequences were matches for later doNotReset[callbacks[i].seq] = 1; _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq); continue; } // if there were no sequence matches but we are still here // that means this is a regular match so we should fire that if (!processedSequenceCallback) { _fireCallback(callbacks[i].callback, e, callbacks[i].combo); } } // if the key you pressed matches the type of sequence without // being a modifier (ie "keyup" or "keypress") then we should // reset all sequences that were not matched by this event // // this is so, for example, if you have the sequence "h a t" and you // type "h e a r t" it does not match. in this case the "e" will // cause the sequence to reset // // modifier keys are ignored because you can have a sequence // that contains modifiers such as "enter ctrl+space" and in most // cases the modifier key will be pressed before the next key // // also if you have a sequence such as "ctrl+b a" then pressing the // "b" key will trigger a "keypress" and a "keydown" // // the "keydown" is expected when there is a modifier, but the // "keypress" ends up matching the _nextExpectedAction since it occurs // after and that causes the sequence to reset // // we ignore keypresses in a sequence that directly follow a keydown // for the same character var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress; if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) { _resetSequences(doNotReset); } _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown'; }; /** * handles a keydown event * * @param {Event} e * @returns void */ function _handleKeyEvent(e) { // normalize e.which for key events // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion if (typeof e.which !== 'number') { e.which = e.keyCode; } var character = _characterFromEvent(e); // no character found then stop if (!character) { return; } // need to use === for the character check because the character can be 0 if (e.type == 'keyup' && _ignoreNextKeyup === character) { _ignoreNextKeyup = false; return; } self.handleKey(character, _eventModifiers(e), e); } /** * called to set a 1 second timeout on the specified sequence * * this is so after each key press in the sequence you have 1 second * to press the next key before you have to start over * * @returns void */ function _resetSequenceTimer() { clearTimeout(_resetTimer); _resetTimer = setTimeout(_resetSequences, 1000); } /** * binds a key sequence to an event * * @param {string} combo - combo specified in bind call * @param {Array} keys * @param {Function} callback * @param {string=} action * @returns void */ function _bindSequence(combo, keys, callback, action) { // start off by adding a sequence level record for this combination // and setting the level to 0 _sequenceLevels[combo] = 0; /** * callback to increase the sequence level for this sequence and reset * all other sequences that were active * * @param {string} nextAction * @returns {Function} */ function _increaseSequence(nextAction) { return function() { _nextExpectedAction = nextAction; ++_sequenceLevels[combo]; _resetSequenceTimer(); }; } /** * wraps the specified callback inside of another function in order * to reset all sequence counters as soon as this sequence is done * * @param {Event} e * @returns void */ function _callbackAndReset(e) { _fireCallback(callback, e, combo); // we should ignore the next key up if the action is key down // or keypress. this is so if you finish a sequence and // release the key the final key will not trigger a keyup if (action !== 'keyup') { _ignoreNextKeyup = _characterFromEvent(e); } // weird race condition if a sequence ends with the key // another sequence begins with setTimeout(_resetSequences, 10); } // loop through keys one at a time and bind the appropriate callback // function. for any key leading up to the final one it should // increase the sequence. after the final, it should reset all sequences // // if an action is specified in the original bind call then that will // be used throughout. otherwise we will pass the action that the // next key in the sequence should match. this allows a sequence // to mix and match keypress and keydown events depending on which // ones are better suited to the key provided for (var i = 0; i < keys.length; ++i) { var isFinal = i + 1 === keys.length; var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action); _bindSingle(keys[i], wrappedCallback, action, combo, i); } } /** * binds a single keyboard combination * * @param {string} combination * @param {Function} callback * @param {string=} action * @param {string=} sequenceName - name of sequence if part of sequence * @param {number=} level - what part of the sequence the command is * @returns void */ function _bindSingle(combination, callback, action, sequenceName, level) { // store a direct mapped reference for use with Mousetrap.trigger self._directMap[combination + ':' + action] = callback; // make sure multiple spaces in a row become a single space combination = combination.replace(/\s+/g, ' '); var sequence = combination.split(' '); var info; // if this pattern is a sequence of keys then run through this method // to reprocess each pattern one key at a time if (sequence.length > 1) { _bindSequence(combination, sequence, callback, action); return; } info = _getKeyInfo(combination, action); // make sure to initialize array if this is the first time // a callback is added for this key self._callbacks[info.key] = self._callbacks[info.key] || []; // remove an existing match if there is one _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level); // add this call back to the array // if it is a sequence put it at the beginning // if not put it at the end // // this is important because the way these are processed expects // the sequence ones to come first self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({ callback: callback, modifiers: info.modifiers, action: info.action, seq: sequenceName, level: level, combo: combination }); } /** * binds multiple combinations to the same callback * * @param {Array} combinations * @param {Function} callback * @param {string|undefined} action * @returns void */ self._bindMultiple = function(combinations, callback, action) { for (var i = 0; i < combinations.length; ++i) { _bindSingle(combinations[i], callback, action); } }; // start! _addEvent(targetElement, 'keypress', _handleKeyEvent); _addEvent(targetElement, 'keydown', _handleKeyEvent); _addEvent(targetElement, 'keyup', _handleKeyEvent); } /** * binds an event to mousetrap * * can be a single key, a combination of keys separated with +, * an array of keys, or a sequence of keys separated by spaces * * be sure to list the modifier keys first to make sure that the * correct key ends up getting bound (the last key in the pattern) * * @param {string|Array} keys * @param {Function} callback * @param {string=} action - 'keypress', 'keydown', or 'keyup' * @returns void */ Mousetrap.prototype.bind = function(keys, callback, action) { var self = this; keys = keys instanceof Array ? keys : [keys]; self._bindMultiple.call(self, keys, callback, action); return self; }; /** * unbinds an event to mousetrap * * the unbinding sets the callback function of the specified key combo * to an empty function and deletes the corresponding key in the * _directMap dict. * * TODO: actually remove this from the _callbacks dictionary instead * of binding an empty function * * the keycombo+action has to be exactly the same as * it was defined in the bind method * * @param {string|Array} keys * @param {string} action * @returns void */ Mousetrap.prototype.unbind = function(keys, action) { var self = this; return self.bind.call(self, keys, function() {}, action); }; /** * triggers an event that has already been bound * * @param {string} keys * @param {string=} action * @returns void */ Mousetrap.prototype.trigger = function(keys, action) { var self = this; if (self._directMap[keys + ':' + action]) { self._directMap[keys + ':' + action]({}, keys); } return self; }; /** * resets the library back to its initial state. this is useful * if you want to clear out the current keyboard shortcuts and bind * new ones - for example if you switch to another page * * @returns void */ Mousetrap.prototype.reset = function() { var self = this; self._callbacks = {}; self._directMap = {}; return self; }; /** * should we stop this event before firing off callbacks * * @param {Event} e * @param {Element} element * @return {boolean} */ Mousetrap.prototype.stopCallback = function(e, element) { var self = this; // if the element has the class "mousetrap" then no need to stop if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) { return false; } if (_belongsTo(element, self.target)) { return false; } // Events originating from a shadow DOM are re-targetted and `e.target` is the shadow host, // not the initial event target in the shadow tree. Note that not all events cross the // shadow boundary. // For shadow trees with `mode: 'open'`, the initial event target is the first element in // the event’s composed path. For shadow trees with `mode: 'closed'`, the initial event // target cannot be obtained. if ('composedPath' in e && typeof e.composedPath === 'function') { // For open shadow trees, update `element` so that the following check works. var initialEventTarget = e.composedPath()[0]; if (initialEventTarget !== e.target) { element = initialEventTarget; } } // stop for input, select, and textarea return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable; }; /** * exposes _handleKey publicly so it can be overwritten by extensions */ Mousetrap.prototype.handleKey = function() { var self = this; return self._handleKey.apply(self, arguments); }; /** * allow custom key mappings */ Mousetrap.addKeycodes = function(object) { for (var key in object) { if (object.hasOwnProperty(key)) { _MAP[key] = object[key]; } } _REVERSE_MAP = null; }; /** * Init the global mousetrap functions * * This method is needed to allow the global mousetrap functions to work * now that mousetrap is a constructor function. */ Mousetrap.init = function() { var documentMousetrap = Mousetrap(document); for (var method in documentMousetrap) { if (method.charAt(0) !== '_') { Mousetrap[method] = (function(method) { return function() { return documentMousetrap[method].apply(documentMousetrap, arguments); }; } (method)); } } }; Mousetrap.init(); // expose mousetrap to the global object window.Mousetrap = Mousetrap; // expose as a common js module if ( true && module.exports) { module.exports = Mousetrap; } // expose mousetrap as an AMD module if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return Mousetrap; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } }) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null); /***/ }), /***/ 3758: /***/ (function(module) { /*! * clipboard.js v2.0.11 * https://clipboardjs.com/ * * Licensed MIT © Zeno Rocha */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); else {} })(this, function() { return /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 686: /***/ (function(__unused_webpack_module, __nested_webpack_exports__, __nested_webpack_require_623__) { "use strict"; // EXPORTS __nested_webpack_require_623__.d(__nested_webpack_exports__, { "default": function() { return /* binding */ clipboard; } }); // EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js var tiny_emitter = __nested_webpack_require_623__(279); var tiny_emitter_default = /*#__PURE__*/__nested_webpack_require_623__.n(tiny_emitter); // EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js var listen = __nested_webpack_require_623__(370); var listen_default = /*#__PURE__*/__nested_webpack_require_623__.n(listen); // EXTERNAL MODULE: ./node_modules/select/src/select.js var src_select = __nested_webpack_require_623__(817); var select_default = /*#__PURE__*/__nested_webpack_require_623__.n(src_select); ;// CONCATENATED MODULE: ./src/common/command.js /** * Executes a given operation type. * @param {String} type * @return {Boolean} */ function command(type) { try { return document.execCommand(type); } catch (err) { return false; } } ;// CONCATENATED MODULE: ./src/actions/cut.js /** * Cut action wrapper. * @param {String|HTMLElement} target * @return {String} */ var ClipboardActionCut = function ClipboardActionCut(target) { var selectedText = select_default()(target); command('cut'); return selectedText; }; /* harmony default export */ var actions_cut = (ClipboardActionCut); ;// CONCATENATED MODULE: ./src/common/create-fake-element.js /** * Creates a fake textarea element with a value. * @param {String} value * @return {HTMLElement} */ function createFakeElement(value) { var isRTL = document.documentElement.getAttribute('dir') === 'rtl'; var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS fakeElement.style.fontSize = '12pt'; // Reset box model fakeElement.style.border = '0'; fakeElement.style.padding = '0'; fakeElement.style.margin = '0'; // Move element out of screen horizontally fakeElement.style.position = 'absolute'; fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically var yPosition = window.pageYOffset || document.documentElement.scrollTop; fakeElement.style.top = "".concat(yPosition, "px"); fakeElement.setAttribute('readonly', ''); fakeElement.value = value; return fakeElement; } ;// CONCATENATED MODULE: ./src/actions/copy.js /** * Create fake copy action wrapper using a fake element. * @param {String} target * @param {Object} options * @return {String} */ var fakeCopyAction = function fakeCopyAction(value, options) { var fakeElement = createFakeElement(value); options.container.appendChild(fakeElement); var selectedText = select_default()(fakeElement); command('copy'); fakeElement.remove(); return selectedText; }; /** * Copy action wrapper. * @param {String|HTMLElement} target * @param {Object} options * @return {String} */ var ClipboardActionCopy = function ClipboardActionCopy(target) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { container: document.body }; var selectedText = ''; if (typeof target === 'string') { selectedText = fakeCopyAction(target, options); } else if (target instanceof HTMLInputElement && !['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) { // If input type doesn't support `setSelectionRange`. Simulate it. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange selectedText = fakeCopyAction(target.value, options); } else { selectedText = select_default()(target); command('copy'); } return selectedText; }; /* harmony default export */ var actions_copy = (ClipboardActionCopy); ;// CONCATENATED MODULE: ./src/actions/default.js function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /** * Inner function which performs selection from either `text` or `target` * properties and then executes copy or cut operations. * @param {Object} options */ var ClipboardActionDefault = function ClipboardActionDefault() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // Defines base properties passed from constructor. var _options$action = options.action, action = _options$action === void 0 ? 'copy' : _options$action, container = options.container, target = options.target, text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'. if (action !== 'copy' && action !== 'cut') { throw new Error('Invalid "action" value, use either "copy" or "cut"'); } // Sets the `target` property using an element that will be have its content copied. if (target !== undefined) { if (target && _typeof(target) === 'object' && target.nodeType === 1) { if (action === 'copy' && target.hasAttribute('disabled')) { throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); } if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); } } else { throw new Error('Invalid "target" value, use a valid Element'); } } // Define selection strategy based on `text` property. if (text) { return actions_copy(text, { container: container }); } // Defines which selection strategy based on `target` property. if (target) { return action === 'cut' ? actions_cut(target) : actions_copy(target, { container: container }); } }; /* harmony default export */ var actions_default = (ClipboardActionDefault); ;// CONCATENATED MODULE: ./src/clipboard.js function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Helper function to retrieve attribute value. * @param {String} suffix * @param {Element} element */ function getAttributeValue(suffix, element) { var attribute = "data-clipboard-".concat(suffix); if (!element.hasAttribute(attribute)) { return; } return element.getAttribute(attribute); } /** * Base class which takes one or more elements, adds event listeners to them, * and instantiates a new `ClipboardAction` on each click. */ var Clipboard = /*#__PURE__*/function (_Emitter) { _inherits(Clipboard, _Emitter); var _super = _createSuper(Clipboard); /** * @param {String|HTMLElement|HTMLCollection|NodeList} trigger * @param {Object} options */ function Clipboard(trigger, options) { var _this; _classCallCheck(this, Clipboard); _this = _super.call(this); _this.resolveOptions(options); _this.listenClick(trigger); return _this; } /** * Defines if attributes would be resolved using internal setter functions * or custom functions that were passed in the constructor. * @param {Object} options */ _createClass(Clipboard, [{ key: "resolveOptions", value: function resolveOptions() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; this.action = typeof options.action === 'function' ? options.action : this.defaultAction; this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; this.text = typeof options.text === 'function' ? options.text : this.defaultText; this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body; } /** * Adds a click event listener to the passed trigger. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger */ }, { key: "listenClick", value: function listenClick(trigger) { var _this2 = this; this.listener = listen_default()(trigger, 'click', function (e) { return _this2.onClick(e); }); } /** * Defines a new `ClipboardAction` on each click event. * @param {Event} e */ }, { key: "onClick", value: function onClick(e) { var trigger = e.delegateTarget || e.currentTarget; var action = this.action(trigger) || 'copy'; var text = actions_default({ action: action, container: this.container, target: this.target(trigger), text: this.text(trigger) }); // Fires an event based on the copy operation result. this.emit(text ? 'success' : 'error', { action: action, text: text, trigger: trigger, clearSelection: function clearSelection() { if (trigger) { trigger.focus(); } window.getSelection().removeAllRanges(); } }); } /** * Default `action` lookup function. * @param {Element} trigger */ }, { key: "defaultAction", value: function defaultAction(trigger) { return getAttributeValue('action', trigger); } /** * Default `target` lookup function. * @param {Element} trigger */ }, { key: "defaultTarget", value: function defaultTarget(trigger) { var selector = getAttributeValue('target', trigger); if (selector) { return document.querySelector(selector); } } /** * Allow fire programmatically a copy action * @param {String|HTMLElement} target * @param {Object} options * @returns Text copied. */ }, { key: "defaultText", /** * Default `text` lookup function. * @param {Element} trigger */ value: function defaultText(trigger) { return getAttributeValue('text', trigger); } /** * Destroy lifecycle. */ }, { key: "destroy", value: function destroy() { this.listener.destroy(); } }], [{ key: "copy", value: function copy(target) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { container: document.body }; return actions_copy(target, options); } /** * Allow fire programmatically a cut action * @param {String|HTMLElement} target * @returns Text cutted. */ }, { key: "cut", value: function cut(target) { return actions_cut(target); } /** * Returns the support of the given action, or all actions if no action is * given. * @param {String} [action] */ }, { key: "isSupported", value: function isSupported() { var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; var actions = typeof action === 'string' ? [action] : action; var support = !!document.queryCommandSupported; actions.forEach(function (action) { support = support && !!document.queryCommandSupported(action); }); return support; } }]); return Clipboard; }((tiny_emitter_default())); /* harmony default export */ var clipboard = (Clipboard); /***/ }), /***/ 828: /***/ (function(module) { var DOCUMENT_NODE_TYPE = 9; /** * A polyfill for Element.matches() */ if (typeof Element !== 'undefined' && !Element.prototype.matches) { var proto = Element.prototype; proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; } /** * Finds the closest parent that matches a selector. * * @param {Element} element * @param {String} selector * @return {Function} */ function closest (element, selector) { while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { if (typeof element.matches === 'function' && element.matches(selector)) { return element; } element = element.parentNode; } } module.exports = closest; /***/ }), /***/ 438: /***/ (function(module, __unused_webpack_exports, __nested_webpack_require_15749__) { var closest = __nested_webpack_require_15749__(828); /** * Delegates event to a selector. * * @param {Element} element * @param {String} selector * @param {String} type * @param {Function} callback * @param {Boolean} useCapture * @return {Object} */ function _delegate(element, selector, type, callback, useCapture) { var listenerFn = listener.apply(this, arguments); element.addEventListener(type, listenerFn, useCapture); return { destroy: function() { element.removeEventListener(type, listenerFn, useCapture); } } } /** * Delegates event to a selector. * * @param {Element|String|Array} [elements] * @param {String} selector * @param {String} type * @param {Function} callback * @param {Boolean} useCapture * @return {Object} */ function delegate(elements, selector, type, callback, useCapture) { // Handle the regular Element usage if (typeof elements.addEventListener === 'function') { return _delegate.apply(null, arguments); } // Handle Element-less usage, it defaults to global delegation if (typeof type === 'function') { // Use `document` as the first parameter, then apply arguments // This is a short way to .unshift `arguments` without running into deoptimizations return _delegate.bind(null, document).apply(null, arguments); } // Handle Selector-based usage if (typeof elements === 'string') { elements = document.querySelectorAll(elements); } // Handle Array-like based usage return Array.prototype.map.call(elements, function (element) { return _delegate(element, selector, type, callback, useCapture); }); } /** * Finds closest match and invokes callback. * * @param {Element} element * @param {String} selector * @param {String} type * @param {Function} callback * @return {Function} */ function listener(element, selector, type, callback) { return function(e) { e.delegateTarget = closest(e.target, selector); if (e.delegateTarget) { callback.call(element, e); } } } module.exports = delegate; /***/ }), /***/ 879: /***/ (function(__unused_webpack_module, exports) { /** * Check if argument is a HTML element. * * @param {Object} value * @return {Boolean} */ exports.node = function(value) { return value !== undefined && value instanceof HTMLElement && value.nodeType === 1; }; /** * Check if argument is a list of HTML elements. * * @param {Object} value * @return {Boolean} */ exports.nodeList = function(value) { var type = Object.prototype.toString.call(value); return value !== undefined && (type === '[object NodeList]' || type === '[object HTMLCollection]') && ('length' in value) && (value.length === 0 || exports.node(value[0])); }; /** * Check if argument is a string. * * @param {Object} value * @return {Boolean} */ exports.string = function(value) { return typeof value === 'string' || value instanceof String; }; /** * Check if argument is a function. * * @param {Object} value * @return {Boolean} */ exports.fn = function(value) { var type = Object.prototype.toString.call(value); return type === '[object Function]'; }; /***/ }), /***/ 370: /***/ (function(module, __unused_webpack_exports, __nested_webpack_require_19113__) { var is = __nested_webpack_require_19113__(879); var delegate = __nested_webpack_require_19113__(438); /** * Validates all params and calls the right * listener function based on its target type. * * @param {String|HTMLElement|HTMLCollection|NodeList} target * @param {String} type * @param {Function} callback * @return {Object} */ function listen(target, type, callback) { if (!target && !type && !callback) { throw new Error('Missing required arguments'); } if (!is.string(type)) { throw new TypeError('Second argument must be a String'); } if (!is.fn(callback)) { throw new TypeError('Third argument must be a Function'); } if (is.node(target)) { return listenNode(target, type, callback); } else if (is.nodeList(target)) { return listenNodeList(target, type, callback); } else if (is.string(target)) { return listenSelector(target, type, callback); } else { throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); } } /** * Adds an event listener to a HTML element * and returns a remove listener function. * * @param {HTMLElement} node * @param {String} type * @param {Function} callback * @return {Object} */ function listenNode(node, type, callback) { node.addEventListener(type, callback); return { destroy: function() { node.removeEventListener(type, callback); } } } /** * Add an event listener to a list of HTML elements * and returns a remove listener function. * * @param {NodeList|HTMLCollection} nodeList * @param {String} type * @param {Function} callback * @return {Object} */ function listenNodeList(nodeList, type, callback) { Array.prototype.forEach.call(nodeList, function(node) { node.addEventListener(type, callback); }); return { destroy: function() { Array.prototype.forEach.call(nodeList, function(node) { node.removeEventListener(type, callback); }); } } } /** * Add an event listener to a selector * and returns a remove listener function. * * @param {String} selector * @param {String} type * @param {Function} callback * @return {Object} */ function listenSelector(selector, type, callback) { return delegate(document.body, selector, type, callback); } module.exports = listen; /***/ }), /***/ 817: /***/ (function(module) { function select(element) { var selectedText; if (element.nodeName === 'SELECT') { element.focus(); selectedText = element.value; } else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { var isReadOnly = element.hasAttribute('readonly'); if (!isReadOnly) { element.setAttribute('readonly', ''); } element.select(); element.setSelectionRange(0, element.value.length); if (!isReadOnly) { element.removeAttribute('readonly'); } selectedText = element.value; } else { if (element.hasAttribute('contenteditable')) { element.focus(); } var selection = window.getSelection(); var range = document.createRange(); range.selectNodeContents(element); selection.removeAllRanges(); selection.addRange(range); selectedText = selection.toString(); } return selectedText; } module.exports = select; /***/ }), /***/ 279: /***/ (function(module) { function E () { // Keep this empty so it's easier to inherit from // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) } E.prototype = { on: function (name, callback, ctx) { var e = this.e || (this.e = {}); (e[name] || (e[name] = [])).push({ fn: callback, ctx: ctx }); return this; }, once: function (name, callback, ctx) { var self = this; function listener () { self.off(name, listener); callback.apply(ctx, arguments); }; listener._ = callback return this.on(name, listener, ctx); }, emit: function (name) { var data = [].slice.call(arguments, 1); var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); var i = 0; var len = evtArr.length; for (i; i < len; i++) { evtArr[i].fn.apply(evtArr[i].ctx, data); } return this; }, off: function (name, callback) { var e = this.e || (this.e = {}); var evts = e[name]; var liveEvents = []; if (evts && callback) { for (var i = 0, len = evts.length; i < len; i++) { if (evts[i].fn !== callback && evts[i].fn._ !== callback) liveEvents.push(evts[i]); } } // Remove event from queue to prevent memory leak // Suggested by https://github.com/lazd // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 (liveEvents.length) ? e[name] = liveEvents : delete e[name]; return this; } }; module.exports = E; module.exports.TinyEmitter = E; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __nested_webpack_require_24495__(moduleId) { /******/ // Check if module is in cache /******/ if(__webpack_module_cache__[moduleId]) { /******/ return __webpack_module_cache__[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_24495__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ !function() { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __nested_webpack_require_24495__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function() { return module['default']; } : /******/ function() { return module; }; /******/ __nested_webpack_require_24495__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ !function() { /******/ // define getter functions for harmony exports /******/ __nested_webpack_require_24495__.d = function(exports, definition) { /******/ for(var key in definition) { /******/ if(__nested_webpack_require_24495__.o(definition, key) && !__nested_webpack_require_24495__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ !function() { /******/ __nested_webpack_require_24495__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } /******/ }(); /******/ /************************************************************************/ /******/ // module exports must be returned from runtime so entry inlining is disabled /******/ // startup /******/ // Load entry module and return exports /******/ return __nested_webpack_require_24495__(686); /******/ })() .default; }); /***/ }), /***/ 5760: /***/ (() => { /** * adds a bindGlobal method to Mousetrap that allows you to * bind specific keyboard shortcuts that will still work * inside a text input field * * usage: * Mousetrap.bindGlobal('ctrl+s', _saveChanges); */ /* global Mousetrap:true */ (function(Mousetrap) { if (! Mousetrap) { return; } var _globalCallbacks = {}; var _originalStopCallback = Mousetrap.prototype.stopCallback; Mousetrap.prototype.stopCallback = function(e, element, combo, sequence) { var self = this; if (self.paused) { return true; } if (_globalCallbacks[combo] || _globalCallbacks[sequence]) { return false; } return _originalStopCallback.call(self, e, element, combo); }; Mousetrap.prototype.bindGlobal = function(keys, callback, action) { var self = this; self.bind(keys, callback, action); if (keys instanceof Array) { for (var i = 0; i < keys.length; i++) { _globalCallbacks[keys[i]] = true; } return; } _globalCallbacks[keys] = true; }; Mousetrap.init(); }) (typeof Mousetrap !== "undefined" ? Mousetrap : undefined); /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { __experimentalUseDialog: () => (/* reexport */ use_dialog), __experimentalUseDragging: () => (/* reexport */ useDragging), __experimentalUseDropZone: () => (/* reexport */ useDropZone), __experimentalUseFixedWindowList: () => (/* reexport */ useFixedWindowList), __experimentalUseFocusOutside: () => (/* reexport */ useFocusOutside), compose: () => (/* reexport */ higher_order_compose), createHigherOrderComponent: () => (/* reexport */ createHigherOrderComponent), debounce: () => (/* reexport */ debounce), ifCondition: () => (/* reexport */ if_condition), observableMap: () => (/* reexport */ observableMap), pipe: () => (/* reexport */ higher_order_pipe), pure: () => (/* reexport */ higher_order_pure), throttle: () => (/* reexport */ throttle), useAsyncList: () => (/* reexport */ use_async_list), useConstrainedTabbing: () => (/* reexport */ use_constrained_tabbing), useCopyOnClick: () => (/* reexport */ useCopyOnClick), useCopyToClipboard: () => (/* reexport */ useCopyToClipboard), useDebounce: () => (/* reexport */ useDebounce), useDebouncedInput: () => (/* reexport */ useDebouncedInput), useDisabled: () => (/* reexport */ useDisabled), useEvent: () => (/* reexport */ useEvent), useFocusOnMount: () => (/* reexport */ useFocusOnMount), useFocusReturn: () => (/* reexport */ use_focus_return), useFocusableIframe: () => (/* reexport */ useFocusableIframe), useInstanceId: () => (/* reexport */ use_instance_id), useIsomorphicLayoutEffect: () => (/* reexport */ use_isomorphic_layout_effect), useKeyboardShortcut: () => (/* reexport */ use_keyboard_shortcut), useMediaQuery: () => (/* reexport */ useMediaQuery), useMergeRefs: () => (/* reexport */ useMergeRefs), useObservableValue: () => (/* reexport */ useObservableValue), usePrevious: () => (/* reexport */ usePrevious), useReducedMotion: () => (/* reexport */ use_reduced_motion), useRefEffect: () => (/* reexport */ useRefEffect), useResizeObserver: () => (/* reexport */ use_resize_observer_useResizeObserver), useStateWithHistory: () => (/* reexport */ useStateWithHistory), useThrottle: () => (/* reexport */ useThrottle), useViewportMatch: () => (/* reexport */ use_viewport_match), useWarnOnChange: () => (/* reexport */ use_warn_on_change), withGlobalEvents: () => (/* reexport */ withGlobalEvents), withInstanceId: () => (/* reexport */ with_instance_id), withSafeTimeout: () => (/* reexport */ with_safe_timeout), withState: () => (/* reexport */ withState) }); ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/pascal-case/dist.es2015/index.js function pascalCaseTransform(input, index) { var firstChar = input.charAt(0); var lowerChars = input.substr(1).toLowerCase(); if (index > 0 && firstChar >= "0" && firstChar <= "9") { return "_" + firstChar + lowerChars; } return "" + firstChar.toUpperCase() + lowerChars; } function pascalCaseTransformMerge(input) { return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase(); } function pascalCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options)); } ;// ./node_modules/@wordpress/compose/build-module/utils/create-higher-order-component/index.js /** * External dependencies */ /** * Given a function mapping a component to an enhanced component and modifier * name, returns the enhanced component augmented with a generated displayName. * * @param mapComponent Function mapping component to enhanced component. * @param modifierName Seed name from which to generated display name. * * @return Component class with generated display name assigned. */ function createHigherOrderComponent(mapComponent, modifierName) { return Inner => { const Outer = mapComponent(Inner); Outer.displayName = hocName(modifierName, Inner); return Outer; }; } /** * Returns a displayName for a higher-order component, given a wrapper name. * * @example * hocName( 'MyMemo', Widget ) === 'MyMemo(Widget)'; * hocName( 'MyMemo', <div /> ) === 'MyMemo(Component)'; * * @param name Name assigned to higher-order component's wrapper component. * @param Inner Wrapped component inside higher-order component. * @return Wrapped name of higher-order component. */ const hocName = (name, Inner) => { const inner = Inner.displayName || Inner.name || 'Component'; const outer = pascalCase(name !== null && name !== void 0 ? name : ''); return `${outer}(${inner})`; }; ;// ./node_modules/@wordpress/compose/build-module/utils/debounce/index.js /** * Parts of this source were derived and modified from lodash, * released under the MIT license. * * https://github.com/lodash/lodash * * Copyright JS Foundation and other contributors <https://js.foundation/> * * Based on Underscore.js, copyright Jeremy Ashkenas, * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision history * available at https://github.com/lodash/lodash * * The following license applies to all parts of this software except as * documented below: * * ==== * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * A simplified and properly typed version of lodash's `debounce`, that * always uses timers instead of sometimes using rAF. * * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel delayed * `func` invocations and a `flush` method to immediately invoke them. Provide * `options` to indicate whether `func` should be invoked on the leading and/or * trailing edge of the `wait` timeout. The `func` is invoked with the last * arguments provided to the debounced function. Subsequent calls to the debounced * function return the result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until the next tick, similar to `setTimeout` with a timeout of `0`. * * @param {Function} func The function to debounce. * @param {number} wait The number of milliseconds to delay. * @param {Partial< DebounceOptions >} options The options object. * @param {boolean} options.leading Specify invoking on the leading edge of the timeout. * @param {number} options.maxWait The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} options.trailing Specify invoking on the trailing edge of the timeout. * * @return Returns the new debounced function. */ const debounce = (func, wait, options) => { let lastArgs; let lastThis; let maxWait = 0; let result; let timerId; let lastCallTime; let lastInvokeTime = 0; let leading = false; let maxing = false; let trailing = true; if (options) { leading = !!options.leading; maxing = 'maxWait' in options; if (options.maxWait !== undefined) { maxWait = Math.max(options.maxWait, wait); } trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { const args = lastArgs; const thisArg = lastThis; lastArgs = undefined; lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function startTimer(pendingFunc, waitTime) { timerId = setTimeout(pendingFunc, waitTime); } function cancelTimer() { if (timerId !== undefined) { clearTimeout(timerId); } } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. startTimer(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function getTimeSinceLastCall(time) { return time - (lastCallTime || 0); } function remainingWait(time) { const timeSinceLastCall = getTimeSinceLastCall(time); const timeSinceLastInvoke = time - lastInvokeTime; const timeWaiting = wait - timeSinceLastCall; return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { const timeSinceLastCall = getTimeSinceLastCall(time); const timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; } function timerExpired() { const time = Date.now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. startTimer(timerExpired, remainingWait(time)); return undefined; } function clearTimer() { timerId = undefined; } function trailingEdge(time) { clearTimer(); // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { cancelTimer(); lastInvokeTime = 0; clearTimer(); lastArgs = lastCallTime = lastThis = undefined; } function flush() { return pending() ? trailingEdge(Date.now()) : result; } function pending() { return timerId !== undefined; } function debounced(...args) { const time = Date.now(); const isInvoking = shouldInvoke(time); lastArgs = args; lastThis = this; lastCallTime = time; if (isInvoking) { if (!pending()) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. startTimer(timerExpired, wait); return invokeFunc(lastCallTime); } } if (!pending()) { startTimer(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; debounced.pending = pending; return debounced; }; ;// ./node_modules/@wordpress/compose/build-module/utils/throttle/index.js /** * Parts of this source were derived and modified from lodash, * released under the MIT license. * * https://github.com/lodash/lodash * * Copyright JS Foundation and other contributors <https://js.foundation/> * * Based on Underscore.js, copyright Jeremy Ashkenas, * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision history * available at https://github.com/lodash/lodash * * The following license applies to all parts of this software except as * documented below: * * ==== * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Internal dependencies */ /** * A simplified and properly typed version of lodash's `throttle`, that * always uses timers instead of sometimes using rAF. * * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to * immediately invoke them. Provide `options` to indicate whether `func` * should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return * the result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the throttled function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until the next tick, similar to `setTimeout` with a timeout of `0`. * * @param {Function} func The function to throttle. * @param {number} wait The number of milliseconds to throttle invocations to. * @param {Partial< ThrottleOptions >} options The options object. * @param {boolean} options.leading Specify invoking on the leading edge of the timeout. * @param {boolean} options.trailing Specify invoking on the trailing edge of the timeout. * @return Returns the new throttled function. */ const throttle = (func, wait, options) => { let leading = true; let trailing = true; if (options) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { leading, trailing, maxWait: wait }); }; ;// ./node_modules/@wordpress/compose/build-module/utils/observable-map/index.js /** * A constructor (factory) for `ObservableMap`, a map-like key/value data structure * where the individual entries are observable: using the `subscribe` method, you can * subscribe to updates for a particular keys. Each subscriber always observes one * specific key and is not notified about any unrelated changes (for different keys) * in the `ObservableMap`. * * @template K The type of the keys in the map. * @template V The type of the values in the map. * @return A new instance of the `ObservableMap` type. */ function observableMap() { const map = new Map(); const listeners = new Map(); function callListeners(name) { const list = listeners.get(name); if (!list) { return; } for (const listener of list) { listener(); } } return { get(name) { return map.get(name); }, set(name, value) { map.set(name, value); callListeners(name); }, delete(name) { map.delete(name); callListeners(name); }, subscribe(name, listener) { let list = listeners.get(name); if (!list) { list = new Set(); listeners.set(name, list); } list.add(listener); return () => { list.delete(listener); if (list.size === 0) { listeners.delete(name); } }; } }; } ;// ./node_modules/@wordpress/compose/build-module/higher-order/pipe.js /** * Parts of this source were derived and modified from lodash, * released under the MIT license. * * https://github.com/lodash/lodash * * Copyright JS Foundation and other contributors <https://js.foundation/> * * Based on Underscore.js, copyright Jeremy Ashkenas, * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision history * available at https://github.com/lodash/lodash * * The following license applies to all parts of this software except as * documented below: * * ==== * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Creates a pipe function. * * Allows to choose whether to perform left-to-right or right-to-left composition. * * @see https://lodash.com/docs/4#flow * * @param {boolean} reverse True if right-to-left, false for left-to-right composition. */ const basePipe = (reverse = false) => (...funcs) => (...args) => { const functions = funcs.flat(); if (reverse) { functions.reverse(); } return functions.reduce((prev, func) => [func(...prev)], args)[0]; }; /** * Composes multiple higher-order components into a single higher-order component. Performs left-to-right function * composition, where each successive invocation is supplied the return value of the previous. * * This is inspired by `lodash`'s `flow` function. * * @see https://lodash.com/docs/4#flow */ const pipe = basePipe(); /* harmony default export */ const higher_order_pipe = (pipe); ;// ./node_modules/@wordpress/compose/build-module/higher-order/compose.js /** * Internal dependencies */ /** * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function * composition, where each successive invocation is supplied the return value of the previous. * * This is inspired by `lodash`'s `flowRight` function. * * @see https://lodash.com/docs/4#flow-right */ const compose = basePipe(true); /* harmony default export */ const higher_order_compose = (compose); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/compose/build-module/higher-order/if-condition/index.js /** * External dependencies */ /** * Internal dependencies */ /** * Higher-order component creator, creating a new component which renders if * the given condition is satisfied or with the given optional prop name. * * @example * ```ts * type Props = { foo: string }; * const Component = ( props: Props ) => <div>{ props.foo }</div>; * const ConditionalComponent = ifCondition( ( props: Props ) => props.foo.length !== 0 )( Component ); * <ConditionalComponent foo="" />; // => null * <ConditionalComponent foo="bar" />; // => <div>bar</div>; * ``` * * @param predicate Function to test condition. * * @return Higher-order component. */ function ifCondition(predicate) { return createHigherOrderComponent(WrappedComponent => props => { if (!predicate(props)) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props }); }, 'ifCondition'); } /* harmony default export */ const if_condition = (ifCondition); ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// ./node_modules/@wordpress/compose/build-module/higher-order/pure/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Given a component returns the enhanced component augmented with a component * only re-rendering when its props/state change * * @deprecated Use `memo` or `PureComponent` instead. */ const pure = createHigherOrderComponent(function (WrappedComponent) { if (WrappedComponent.prototype instanceof external_wp_element_namespaceObject.Component) { return class extends WrappedComponent { shouldComponentUpdate(nextProps, nextState) { return !external_wp_isShallowEqual_default()(nextProps, this.props) || !external_wp_isShallowEqual_default()(nextState, this.state); } }; } return class extends external_wp_element_namespaceObject.Component { shouldComponentUpdate(nextProps) { return !external_wp_isShallowEqual_default()(nextProps, this.props); } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...this.props }); } }; }, 'pure'); /* harmony default export */ const higher_order_pure = (pure); ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/listener.js /** * Class responsible for orchestrating event handling on the global window, * binding a single event to be shared across all handling instances, and * removing the handler when no instances are listening for the event. */ class Listener { constructor() { /** @type {any} */ this.listeners = {}; this.handleEvent = this.handleEvent.bind(this); } add(/** @type {any} */eventType, /** @type {any} */instance) { if (!this.listeners[eventType]) { // Adding first listener for this type, so bind event. window.addEventListener(eventType, this.handleEvent); this.listeners[eventType] = []; } this.listeners[eventType].push(instance); } remove(/** @type {any} */eventType, /** @type {any} */instance) { if (!this.listeners[eventType]) { return; } this.listeners[eventType] = this.listeners[eventType].filter((/** @type {any} */listener) => listener !== instance); if (!this.listeners[eventType].length) { // Removing last listener for this type, so unbind event. window.removeEventListener(eventType, this.handleEvent); delete this.listeners[eventType]; } } handleEvent(/** @type {any} */event) { this.listeners[event.type]?.forEach((/** @type {any} */instance) => { instance.handleEvent(event); }); } } /* harmony default export */ const listener = (Listener); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Listener instance responsible for managing document event handling. */ const with_global_events_listener = new listener(); /* eslint-disable jsdoc/no-undefined-types */ /** * Higher-order component creator which, given an object of DOM event types and * values corresponding to a callback function name on the component, will * create or update a window event handler to invoke the callback when an event * occurs. On behalf of the consuming developer, the higher-order component * manages unbinding when the component unmounts, and binding at most a single * event handler for the entire application. * * @deprecated * * @param {Record<keyof GlobalEventHandlersEventMap, string>} eventTypesToHandlers Object with keys of DOM * event type, the value a * name of the function on * the original component's * instance which handles * the event. * * @return {any} Higher-order component. */ function withGlobalEvents(eventTypesToHandlers) { external_wp_deprecated_default()('wp.compose.withGlobalEvents', { since: '5.7', alternative: 'useEffect' }); // @ts-ignore We don't need to fix the type-related issues because this is deprecated. return createHigherOrderComponent(WrappedComponent => { class Wrapper extends external_wp_element_namespaceObject.Component { constructor(/** @type {any} */props) { super(props); this.handleEvent = this.handleEvent.bind(this); this.handleRef = this.handleRef.bind(this); } componentDidMount() { Object.keys(eventTypesToHandlers).forEach(eventType => { with_global_events_listener.add(eventType, this); }); } componentWillUnmount() { Object.keys(eventTypesToHandlers).forEach(eventType => { with_global_events_listener.remove(eventType, this); }); } handleEvent(/** @type {any} */event) { const handler = eventTypesToHandlers[(/** @type {keyof GlobalEventHandlersEventMap} */ event.type /* eslint-enable jsdoc/no-undefined-types */)]; if (typeof this.wrappedRef[handler] === 'function') { this.wrappedRef[handler](event); } } handleRef(/** @type {any} */el) { this.wrappedRef = el; // Any component using `withGlobalEvents` that is not setting a `ref` // will cause `this.props.forwardedRef` to be `null`, so we need this // check. if (this.props.forwardedRef) { this.props.forwardedRef(el); } } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...this.props.ownProps, ref: this.handleRef }); } } return (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { ownProps: props, forwardedRef: ref }); }); }, 'withGlobalEvents'); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js /** * WordPress dependencies */ const instanceMap = new WeakMap(); /** * Creates a new id for a given object. * * @param object Object reference to create an id for. * @return The instance id (index). */ function createId(object) { const instances = instanceMap.get(object) || 0; instanceMap.set(object, instances + 1); return instances; } /** * Specify the useInstanceId *function* signatures. * * More accurately, useInstanceId distinguishes between three different * signatures: * * 1. When only object is given, the returned value is a number * 2. When object and prefix is given, the returned value is a string * 3. When preferredId is given, the returned value is the type of preferredId * * @param object Object reference to create an id for. */ /** * Provides a unique instance ID. * * @param object Object reference to create an id for. * @param [prefix] Prefix for the unique id. * @param [preferredId] Default ID to use. * @return The unique instance id. */ function useInstanceId(object, prefix, preferredId) { return (0,external_wp_element_namespaceObject.useMemo)(() => { if (preferredId) { return preferredId; } const id = createId(object); return prefix ? `${prefix}-${id}` : id; }, [object, preferredId, prefix]); } /* harmony default export */ const use_instance_id = (useInstanceId); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-instance-id/index.js /** * Internal dependencies */ /** * A Higher Order Component used to provide a unique instance ID by component. */ const withInstanceId = createHigherOrderComponent(WrappedComponent => { return props => { const instanceId = use_instance_id(WrappedComponent); // @ts-ignore return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, instanceId: instanceId }); }; }, 'instanceId'); /* harmony default export */ const with_instance_id = (withInstanceId); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-safe-timeout/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * We cannot use the `Window['setTimeout']` and `Window['clearTimeout']` * types here because those functions include functionality that is not handled * by this component, like the ability to pass extra arguments. * * In the case of this component, we only handle the simplest case where * `setTimeout` only accepts a function (not a string) and an optional delay. */ /** * A higher-order component used to provide and manage delayed function calls * that ought to be bound to a component's lifecycle. */ const withSafeTimeout = createHigherOrderComponent(OriginalComponent => { return class WrappedComponent extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.timeouts = []; this.setTimeout = this.setTimeout.bind(this); this.clearTimeout = this.clearTimeout.bind(this); } componentWillUnmount() { this.timeouts.forEach(clearTimeout); } setTimeout(fn, delay) { const id = setTimeout(() => { fn(); this.clearTimeout(id); }, delay); this.timeouts.push(id); return id; } clearTimeout(id) { clearTimeout(id); this.timeouts = this.timeouts.filter(timeoutId => timeoutId !== id); } render() { return ( /*#__PURE__*/ // @ts-ignore (0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { ...this.props, setTimeout: this.setTimeout, clearTimeout: this.clearTimeout }) ); } }; }, 'withSafeTimeout'); /* harmony default export */ const with_safe_timeout = (withSafeTimeout); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-state/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A Higher Order Component used to provide and manage internal component state * via props. * * @deprecated Use `useState` instead. * * @param {any} initialState Optional initial state of the component. * * @return {any} A higher order component wrapper accepting a component that takes the state props + its own props + `setState` and returning a component that only accepts the own props. */ function withState(initialState = {}) { external_wp_deprecated_default()('wp.compose.withState', { since: '5.8', alternative: 'wp.element.useState' }); return createHigherOrderComponent(OriginalComponent => { return class WrappedComponent extends external_wp_element_namespaceObject.Component { constructor(/** @type {any} */props) { super(props); this.setState = this.setState.bind(this); this.state = initialState; } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { ...this.props, ...this.state, setState: this.setState }); } }; }, 'withState'); } ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/compose/build-module/hooks/use-ref-effect/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Effect-like ref callback. Just like with `useEffect`, this allows you to * return a cleanup function to be run if the ref changes or one of the * dependencies changes. The ref is provided as an argument to the callback * functions. The main difference between this and `useEffect` is that * the `useEffect` callback is not called when the ref changes, but this is. * Pass the returned ref callback as the component's ref and merge multiple refs * with `useMergeRefs`. * * It's worth noting that if the dependencies array is empty, there's not * strictly a need to clean up event handlers for example, because the node is * to be removed. It *is* necessary if you add dependencies because the ref * callback will be called multiple times for the same node. * * @param callback Callback with ref as argument. * @param dependencies Dependencies of the callback. * * @return Ref callback. */ function useRefEffect(callback, dependencies) { const cleanupRef = (0,external_wp_element_namespaceObject.useRef)(); return (0,external_wp_element_namespaceObject.useCallback)(node => { if (node) { cleanupRef.current = callback(node); } else if (cleanupRef.current) { cleanupRef.current(); } }, dependencies); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-constrained-tabbing/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * In Dialogs/modals, the tabbing must be constrained to the content of * the wrapper element. This hook adds the behavior to the returned ref. * * @return {import('react').RefCallback<Element>} Element Ref. * * @example * ```js * import { useConstrainedTabbing } from '@wordpress/compose'; * * const ConstrainedTabbingExample = () => { * const constrainedTabbingRef = useConstrainedTabbing() * return ( * <div ref={ constrainedTabbingRef }> * <Button /> * <Button /> * </div> * ); * } * ``` */ function useConstrainedTabbing() { return useRefEffect((/** @type {HTMLElement} */node) => { function onKeyDown(/** @type {KeyboardEvent} */event) { const { key, shiftKey, target } = event; if (key !== 'Tab') { return; } const action = shiftKey ? 'findPrevious' : 'findNext'; const nextElement = external_wp_dom_namespaceObject.focus.tabbable[action](/** @type {HTMLElement} */target) || null; // When the target element contains the element that is about to // receive focus, for example when the target is a tabbable // container, browsers may disagree on where to move focus next. // In this case we can't rely on native browsers behavior. We need // to manage focus instead. // See https://github.com/WordPress/gutenberg/issues/46041. if (/** @type {HTMLElement} */target.contains(nextElement)) { event.preventDefault(); nextElement?.focus(); return; } // If the element that is about to receive focus is inside the // area, rely on native browsers behavior and let tabbing follow // the native tab sequence. if (node.contains(nextElement)) { return; } // If the element that is about to receive focus is outside the // area, move focus to a div and insert it at the start or end of // the area, depending on the direction. Without preventing default // behaviour, the browser will then move focus to the next element. const domAction = shiftKey ? 'append' : 'prepend'; const { ownerDocument } = node; const trap = ownerDocument.createElement('div'); trap.tabIndex = -1; node[domAction](trap); // Remove itself when the trap loses focus. trap.addEventListener('blur', () => node.removeChild(trap)); trap.focus(); } node.addEventListener('keydown', onKeyDown); return () => { node.removeEventListener('keydown', onKeyDown); }; }, []); } /* harmony default export */ const use_constrained_tabbing = (useConstrainedTabbing); // EXTERNAL MODULE: ./node_modules/clipboard/dist/clipboard.js var dist_clipboard = __webpack_require__(3758); var clipboard_default = /*#__PURE__*/__webpack_require__.n(dist_clipboard); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-copy-on-click/index.js /** * External dependencies */ /** * WordPress dependencies */ /* eslint-disable jsdoc/no-undefined-types */ /** * Copies the text to the clipboard when the element is clicked. * * @deprecated * * @param {import('react').RefObject<string | Element | NodeListOf<Element>>} ref Reference with the element. * @param {string|Function} text The text to copy. * @param {number} [timeout] Optional timeout to reset the returned * state. 4 seconds by default. * * @return {boolean} Whether or not the text has been copied. Resets after the * timeout. */ function useCopyOnClick(ref, text, timeout = 4000) { /* eslint-enable jsdoc/no-undefined-types */ external_wp_deprecated_default()('wp.compose.useCopyOnClick', { since: '5.8', alternative: 'wp.compose.useCopyToClipboard' }); /** @type {import('react').MutableRefObject<Clipboard | undefined>} */ const clipboardRef = (0,external_wp_element_namespaceObject.useRef)(); const [hasCopied, setHasCopied] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { /** @type {number | undefined} */ let timeoutId; if (!ref.current) { return; } // Clipboard listens to click events. clipboardRef.current = new (clipboard_default())(ref.current, { text: () => typeof text === 'function' ? text() : text }); clipboardRef.current.on('success', ({ clearSelection, trigger }) => { // Clearing selection will move focus back to the triggering button, // ensuring that it is not reset to the body, and further that it is // kept within the rendered node. clearSelection(); // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680 if (trigger) { /** @type {HTMLElement} */trigger.focus(); } if (timeout) { setHasCopied(true); clearTimeout(timeoutId); timeoutId = setTimeout(() => setHasCopied(false), timeout); } }); return () => { if (clipboardRef.current) { clipboardRef.current.destroy(); } clearTimeout(timeoutId); }; }, [text, timeout, setHasCopied]); return hasCopied; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-copy-to-clipboard/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * @template T * @param {T} value * @return {import('react').RefObject<T>} The updated ref */ function useUpdatedRef(value) { const ref = (0,external_wp_element_namespaceObject.useRef)(value); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { ref.current = value; }, [value]); return ref; } /** * Copies the given text to the clipboard when the element is clicked. * * @template {HTMLElement} TElementType * @param {string | (() => string)} text The text to copy. Use a function if not * already available and expensive to compute. * @param {Function} onSuccess Called when to text is copied. * * @return {import('react').Ref<TElementType>} A ref to assign to the target element. */ function useCopyToClipboard(text, onSuccess) { // Store the dependencies as refs and continuously update them so they're // fresh when the callback is called. const textRef = useUpdatedRef(text); const onSuccessRef = useUpdatedRef(onSuccess); return useRefEffect(node => { // Clipboard listens to click events. const clipboard = new (clipboard_default())(node, { text() { return typeof textRef.current === 'function' ? textRef.current() : textRef.current || ''; } }); clipboard.on('success', ({ clearSelection }) => { // Clearing selection will move focus back to the triggering // button, ensuring that it is not reset to the body, and // further that it is kept within the rendered node. clearSelection(); if (onSuccessRef.current) { onSuccessRef.current(); } }); return () => { clipboard.destroy(); }; }, []); } ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/compose/build-module/hooks/use-focus-on-mount/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Hook used to focus the first tabbable element on mount. * * @param {boolean | 'firstElement'} focusOnMount Focus on mount mode. * @return {import('react').RefCallback<HTMLElement>} Ref callback. * * @example * ```js * import { useFocusOnMount } from '@wordpress/compose'; * * const WithFocusOnMount = () => { * const ref = useFocusOnMount() * return ( * <div ref={ ref }> * <Button /> * <Button /> * </div> * ); * } * ``` */ function useFocusOnMount(focusOnMount = 'firstElement') { const focusOnMountRef = (0,external_wp_element_namespaceObject.useRef)(focusOnMount); /** * Sets focus on a DOM element. * * @param {HTMLElement} target The DOM element to set focus to. * @return {void} */ const setFocus = target => { target.focus({ // When focusing newly mounted dialogs, // the position of the popover is often not right on the first render // This prevents the layout shifts when focusing the dialogs. preventScroll: true }); }; /** @type {import('react').MutableRefObject<ReturnType<setTimeout> | undefined>} */ const timerIdRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { focusOnMountRef.current = focusOnMount; }, [focusOnMount]); return useRefEffect(node => { var _node$ownerDocument$a; if (!node || focusOnMountRef.current === false) { return; } if (node.contains((_node$ownerDocument$a = node.ownerDocument?.activeElement) !== null && _node$ownerDocument$a !== void 0 ? _node$ownerDocument$a : null)) { return; } if (focusOnMountRef.current !== 'firstElement') { setFocus(node); return; } timerIdRef.current = setTimeout(() => { const firstTabbable = external_wp_dom_namespaceObject.focus.tabbable.find(node)[0]; if (firstTabbable) { setFocus(firstTabbable); } }, 0); return () => { if (timerIdRef.current) { clearTimeout(timerIdRef.current); } }; }, []); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-focus-return/index.js /** * WordPress dependencies */ /** @type {Element|null} */ let origin = null; /** * Adds the unmount behavior of returning focus to the element which had it * previously as is expected for roles like menus or dialogs. * * @param {() => void} [onFocusReturn] Overrides the default return behavior. * @return {import('react').RefCallback<HTMLElement>} Element Ref. * * @example * ```js * import { useFocusReturn } from '@wordpress/compose'; * * const WithFocusReturn = () => { * const ref = useFocusReturn() * return ( * <div ref={ ref }> * <Button /> * <Button /> * </div> * ); * } * ``` */ function useFocusReturn(onFocusReturn) { /** @type {import('react').MutableRefObject<null | HTMLElement>} */ const ref = (0,external_wp_element_namespaceObject.useRef)(null); /** @type {import('react').MutableRefObject<null | Element>} */ const focusedBeforeMount = (0,external_wp_element_namespaceObject.useRef)(null); const onFocusReturnRef = (0,external_wp_element_namespaceObject.useRef)(onFocusReturn); (0,external_wp_element_namespaceObject.useEffect)(() => { onFocusReturnRef.current = onFocusReturn; }, [onFocusReturn]); return (0,external_wp_element_namespaceObject.useCallback)(node => { if (node) { var _activeDocument$activ; // Set ref to be used when unmounting. ref.current = node; // Only set when the node mounts. if (focusedBeforeMount.current) { return; } const activeDocument = node.ownerDocument.activeElement instanceof window.HTMLIFrameElement ? node.ownerDocument.activeElement.contentDocument : node.ownerDocument; focusedBeforeMount.current = (_activeDocument$activ = activeDocument?.activeElement) !== null && _activeDocument$activ !== void 0 ? _activeDocument$activ : null; } else if (focusedBeforeMount.current) { const isFocused = ref.current?.contains(ref.current?.ownerDocument.activeElement); if (ref.current?.isConnected && !isFocused) { var _origin; (_origin = origin) !== null && _origin !== void 0 ? _origin : origin = focusedBeforeMount.current; return; } // Defer to the component's own explicit focus return behavior, if // specified. This allows for support that the `onFocusReturn` // decides to allow the default behavior to occur under some // conditions. if (onFocusReturnRef.current) { onFocusReturnRef.current(); } else { /** @type {null|HTMLElement} */(!focusedBeforeMount.current.isConnected ? origin : focusedBeforeMount.current)?.focus(); } origin = null; } }, []); } /* harmony default export */ const use_focus_return = (useFocusReturn); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-focus-outside/index.js /** * WordPress dependencies */ /** * Input types which are classified as button types, for use in considering * whether element is a (focus-normalized) button. */ const INPUT_BUTTON_TYPES = ['button', 'submit']; /** * List of HTML button elements subject to focus normalization * * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus */ /** * Returns true if the given element is a button element subject to focus * normalization, or false otherwise. * * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus * * @param eventTarget The target from a mouse or touch event. * * @return Whether the element is a button element subject to focus normalization. */ function isFocusNormalizedButton(eventTarget) { if (!(eventTarget instanceof window.HTMLElement)) { return false; } switch (eventTarget.nodeName) { case 'A': case 'BUTTON': return true; case 'INPUT': return INPUT_BUTTON_TYPES.includes(eventTarget.type); } return false; } /** * A react hook that can be used to check whether focus has moved outside the * element the event handlers are bound to. * * @param onFocusOutside A callback triggered when focus moves outside * the element the event handlers are bound to. * * @return An object containing event handlers. Bind the event handlers to a * wrapping element element to capture when focus moves outside that element. */ function useFocusOutside(onFocusOutside) { const currentOnFocusOutsideRef = (0,external_wp_element_namespaceObject.useRef)(onFocusOutside); (0,external_wp_element_namespaceObject.useEffect)(() => { currentOnFocusOutsideRef.current = onFocusOutside; }, [onFocusOutside]); const preventBlurCheckRef = (0,external_wp_element_namespaceObject.useRef)(false); const blurCheckTimeoutIdRef = (0,external_wp_element_namespaceObject.useRef)(); /** * Cancel a blur check timeout. */ const cancelBlurCheck = (0,external_wp_element_namespaceObject.useCallback)(() => { clearTimeout(blurCheckTimeoutIdRef.current); }, []); // Cancel blur checks on unmount. (0,external_wp_element_namespaceObject.useEffect)(() => { return () => cancelBlurCheck(); }, []); // Cancel a blur check if the callback or ref is no longer provided. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!onFocusOutside) { cancelBlurCheck(); } }, [onFocusOutside, cancelBlurCheck]); /** * Handles a mousedown or mouseup event to respectively assign and * unassign a flag for preventing blur check on button elements. Some * browsers, namely Firefox and Safari, do not emit a focus event on * button elements when clicked, while others do. The logic here * intends to normalize this as treating click on buttons as focus. * * @param event * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus */ const normalizeButtonFocus = (0,external_wp_element_namespaceObject.useCallback)(event => { const { type, target } = event; const isInteractionEnd = ['mouseup', 'touchend'].includes(type); if (isInteractionEnd) { preventBlurCheckRef.current = false; } else if (isFocusNormalizedButton(target)) { preventBlurCheckRef.current = true; } }, []); /** * A callback triggered when a blur event occurs on the element the handler * is bound to. * * Calls the `onFocusOutside` callback in an immediate timeout if focus has * move outside the bound element and is still within the document. */ const queueBlurCheck = (0,external_wp_element_namespaceObject.useCallback)(event => { // React does not allow using an event reference asynchronously // due to recycling behavior, except when explicitly persisted. event.persist(); // Skip blur check if clicking button. See `normalizeButtonFocus`. if (preventBlurCheckRef.current) { return; } // The usage of this attribute should be avoided. The only use case // would be when we load modals that are not React components and // therefore don't exist in the React tree. An example is opening // the Media Library modal from another dialog. // This attribute should contain a selector of the related target // we want to ignore, because we still need to trigger the blur event // on all other cases. const ignoreForRelatedTarget = event.target.getAttribute('data-unstable-ignore-focus-outside-for-relatedtarget'); if (ignoreForRelatedTarget && event.relatedTarget?.closest(ignoreForRelatedTarget)) { return; } blurCheckTimeoutIdRef.current = setTimeout(() => { // If document is not focused then focus should remain // inside the wrapped component and therefore we cancel // this blur event thereby leaving focus in place. // https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus. if (!document.hasFocus()) { event.preventDefault(); return; } if ('function' === typeof currentOnFocusOutsideRef.current) { currentOnFocusOutsideRef.current(event); } }, 0); }, []); return { onFocus: cancelBlurCheck, onMouseDown: normalizeButtonFocus, onMouseUp: normalizeButtonFocus, onTouchStart: normalizeButtonFocus, onTouchEnd: normalizeButtonFocus, onBlur: queueBlurCheck }; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js /** * WordPress dependencies */ /* eslint-disable jsdoc/valid-types */ /** * @template T * @typedef {T extends import('react').Ref<infer R> ? R : never} TypeFromRef */ /* eslint-enable jsdoc/valid-types */ /** * @template T * @param {import('react').Ref<T>} ref * @param {T} value */ function assignRef(ref, value) { if (typeof ref === 'function') { ref(value); } else if (ref && ref.hasOwnProperty('current')) { /* eslint-disable jsdoc/no-undefined-types */ /** @type {import('react').MutableRefObject<T>} */ref.current = value; /* eslint-enable jsdoc/no-undefined-types */ } } /** * Merges refs into one ref callback. * * It also ensures that the merged ref callbacks are only called when they * change (as a result of a `useCallback` dependency update) OR when the ref * value changes, just as React does when passing a single ref callback to the * component. * * As expected, if you pass a new function on every render, the ref callback * will be called after every render. * * If you don't wish a ref callback to be called after every render, wrap it * with `useCallback( callback, dependencies )`. When a dependency changes, the * old ref callback will be called with `null` and the new ref callback will be * called with the same value. * * To make ref callbacks easier to use, you can also pass the result of * `useRefEffect`, which makes cleanup easier by allowing you to return a * cleanup function instead of handling `null`. * * It's also possible to _disable_ a ref (and its behaviour) by simply not * passing the ref. * * ```jsx * const ref = useRefEffect( ( node ) => { * node.addEventListener( ... ); * return () => { * node.removeEventListener( ... ); * }; * }, [ ...dependencies ] ); * const otherRef = useRef(); * const mergedRefs useMergeRefs( [ * enabled && ref, * otherRef, * ] ); * return <div ref={ mergedRefs } />; * ``` * * @template {import('react').Ref<any>} TRef * @param {Array<TRef>} refs The refs to be merged. * * @return {import('react').RefCallback<TypeFromRef<TRef>>} The merged ref callback. */ function useMergeRefs(refs) { const element = (0,external_wp_element_namespaceObject.useRef)(); const isAttachedRef = (0,external_wp_element_namespaceObject.useRef)(false); const didElementChangeRef = (0,external_wp_element_namespaceObject.useRef)(false); /* eslint-disable jsdoc/no-undefined-types */ /** @type {import('react').MutableRefObject<TRef[]>} */ /* eslint-enable jsdoc/no-undefined-types */ const previousRefsRef = (0,external_wp_element_namespaceObject.useRef)([]); const currentRefsRef = (0,external_wp_element_namespaceObject.useRef)(refs); // Update on render before the ref callback is called, so the ref callback // always has access to the current refs. currentRefsRef.current = refs; // If any of the refs change, call the previous ref with `null` and the new // ref with the node, except when the element changes in the same cycle, in // which case the ref callbacks will already have been called. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (didElementChangeRef.current === false && isAttachedRef.current === true) { refs.forEach((ref, index) => { const previousRef = previousRefsRef.current[index]; if (ref !== previousRef) { assignRef(previousRef, null); assignRef(ref, element.current); } }); } previousRefsRef.current = refs; }, refs); // No dependencies, must be reset after every render so ref callbacks are // correctly called after a ref change. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { didElementChangeRef.current = false; }); // There should be no dependencies so that `callback` is only called when // the node changes. return (0,external_wp_element_namespaceObject.useCallback)(value => { // Update the element so it can be used when calling ref callbacks on a // dependency change. assignRef(element, value); didElementChangeRef.current = true; isAttachedRef.current = value !== null; // When an element changes, the current ref callback should be called // with the new element and the previous one with `null`. const refsToAssign = value ? currentRefsRef.current : previousRefsRef.current; // Update the latest refs. for (const ref of refsToAssign) { assignRef(ref, value); } }, []); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-dialog/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns a ref and props to apply to a dialog wrapper to enable the following behaviors: * - constrained tabbing. * - focus on mount. * - return focus on unmount. * - focus outside. * * @param options Dialog Options. */ function useDialog(options) { const currentOptions = (0,external_wp_element_namespaceObject.useRef)(); const { constrainTabbing = options.focusOnMount !== false } = options; (0,external_wp_element_namespaceObject.useEffect)(() => { currentOptions.current = options; }, Object.values(options)); const constrainedTabbingRef = use_constrained_tabbing(); const focusOnMountRef = useFocusOnMount(options.focusOnMount); const focusReturnRef = use_focus_return(); const focusOutsideProps = useFocusOutside(event => { // This unstable prop is here only to manage backward compatibility // for the Popover component otherwise, the onClose should be enough. if (currentOptions.current?.__unstableOnClose) { currentOptions.current.__unstableOnClose('focus-outside', event); } else if (currentOptions.current?.onClose) { currentOptions.current.onClose(); } }); const closeOnEscapeRef = (0,external_wp_element_namespaceObject.useCallback)(node => { if (!node) { return; } node.addEventListener('keydown', event => { // Close on escape. if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented && currentOptions.current?.onClose) { event.preventDefault(); currentOptions.current.onClose(); } }); }, []); return [useMergeRefs([constrainTabbing ? constrainedTabbingRef : null, options.focusOnMount !== false ? focusReturnRef : null, options.focusOnMount !== false ? focusOnMountRef : null, closeOnEscapeRef]), { ...focusOutsideProps, tabIndex: -1 }]; } /* harmony default export */ const use_dialog = (useDialog); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-disabled/index.js /** * Internal dependencies */ /** * In some circumstances, such as block previews, all focusable DOM elements * (input fields, links, buttons, etc.) need to be disabled. This hook adds the * behavior to disable nested DOM elements to the returned ref. * * If you can, prefer the use of the inert HTML attribute. * * @param {Object} config Configuration object. * @param {boolean=} config.isDisabled Whether the element should be disabled. * @return {import('react').RefCallback<HTMLElement>} Element Ref. * * @example * ```js * import { useDisabled } from '@wordpress/compose'; * * const DisabledExample = () => { * const disabledRef = useDisabled(); * return ( * <div ref={ disabledRef }> * <a href="#">This link will have tabindex set to -1</a> * <input placeholder="This input will have the disabled attribute added to it." type="text" /> * </div> * ); * }; * ``` */ function useDisabled({ isDisabled: isDisabledProp = false } = {}) { return useRefEffect(node => { if (isDisabledProp) { return; } const defaultView = node?.ownerDocument?.defaultView; if (!defaultView) { return; } /** A variable keeping track of the previous updates in order to restore them. */ const updates = []; const disable = () => { node.childNodes.forEach(child => { if (!(child instanceof defaultView.HTMLElement)) { return; } if (!child.getAttribute('inert')) { child.setAttribute('inert', 'true'); updates.push(() => { child.removeAttribute('inert'); }); } }); }; // Debounce re-disable since disabling process itself will incur // additional mutations which should be ignored. const debouncedDisable = debounce(disable, 0, { leading: true }); disable(); /** @type {MutationObserver | undefined} */ const observer = new window.MutationObserver(debouncedDisable); observer.observe(node, { childList: true }); return () => { if (observer) { observer.disconnect(); } debouncedDisable.cancel(); updates.forEach(update => update()); }; }, [isDisabledProp]); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-event/index.js /** * WordPress dependencies */ /** * Any function. */ /** * Creates a stable callback function that has access to the latest state and * can be used within event handlers and effect callbacks. Throws when used in * the render phase. * * @param callback The callback function to wrap. * * @example * * ```tsx * function Component( props ) { * const onClick = useEvent( props.onClick ); * useEffect( () => { * onClick(); * // Won't trigger the effect again when props.onClick is updated. * }, [ onClick ] ); * // Won't re-render Button when props.onClick is updated (if `Button` is * // wrapped in `React.memo`). * return <Button onClick={ onClick } />; * } * ``` */ function useEvent( /** * The callback function to wrap. */ callback) { const ref = (0,external_wp_element_namespaceObject.useRef)(() => { throw new Error('Callbacks created with `useEvent` cannot be called during rendering.'); }); (0,external_wp_element_namespaceObject.useInsertionEffect)(() => { ref.current = callback; }); return (0,external_wp_element_namespaceObject.useCallback)((...args) => ref.current?.(...args), []); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-isomorphic-layout-effect/index.js /** * WordPress dependencies */ /** * Preferred over direct usage of `useLayoutEffect` when supporting * server rendered components (SSR) because currently React * throws a warning when using useLayoutEffect in that environment. */ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_wp_element_namespaceObject.useLayoutEffect : external_wp_element_namespaceObject.useEffect; /* harmony default export */ const use_isomorphic_layout_effect = (useIsomorphicLayoutEffect); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-dragging/index.js /** * WordPress dependencies */ /** * Internal dependencies */ // Event handlers that are triggered from `document` listeners accept a MouseEvent, // while those triggered from React listeners accept a React.MouseEvent. /** * @param {Object} props * @param {(e: import('react').MouseEvent) => void} props.onDragStart * @param {(e: MouseEvent) => void} props.onDragMove * @param {(e?: MouseEvent) => void} props.onDragEnd */ function useDragging({ onDragStart, onDragMove, onDragEnd }) { const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false); const eventsRef = (0,external_wp_element_namespaceObject.useRef)({ onDragStart, onDragMove, onDragEnd }); use_isomorphic_layout_effect(() => { eventsRef.current.onDragStart = onDragStart; eventsRef.current.onDragMove = onDragMove; eventsRef.current.onDragEnd = onDragEnd; }, [onDragStart, onDragMove, onDragEnd]); /** @type {(e: MouseEvent) => void} */ const onMouseMove = (0,external_wp_element_namespaceObject.useCallback)(event => eventsRef.current.onDragMove && eventsRef.current.onDragMove(event), []); /** @type {(e?: MouseEvent) => void} */ const endDrag = (0,external_wp_element_namespaceObject.useCallback)(event => { if (eventsRef.current.onDragEnd) { eventsRef.current.onDragEnd(event); } document.removeEventListener('mousemove', onMouseMove); document.removeEventListener('mouseup', endDrag); setIsDragging(false); }, []); /** @type {(e: import('react').MouseEvent) => void} */ const startDrag = (0,external_wp_element_namespaceObject.useCallback)(event => { if (eventsRef.current.onDragStart) { eventsRef.current.onDragStart(event); } document.addEventListener('mousemove', onMouseMove); document.addEventListener('mouseup', endDrag); setIsDragging(true); }, []); // Remove the global events when unmounting if needed. (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { if (isDragging) { document.removeEventListener('mousemove', onMouseMove); document.removeEventListener('mouseup', endDrag); } }; }, [isDragging]); return { startDrag, endDrag, isDragging }; } // EXTERNAL MODULE: ./node_modules/mousetrap/mousetrap.js var mousetrap_mousetrap = __webpack_require__(1933); var mousetrap_default = /*#__PURE__*/__webpack_require__.n(mousetrap_mousetrap); // EXTERNAL MODULE: ./node_modules/mousetrap/plugins/global-bind/mousetrap-global-bind.js var mousetrap_global_bind = __webpack_require__(5760); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-keyboard-shortcut/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * A block selection object. * * @typedef {Object} WPKeyboardShortcutConfig * * @property {boolean} [bindGlobal] Handle keyboard events anywhere including inside textarea/input fields. * @property {string} [eventName] Event name used to trigger the handler, defaults to keydown. * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true. * @property {import('react').RefObject<HTMLElement>} [target] React reference to the DOM element used to catch the keyboard event. */ /* eslint-disable jsdoc/valid-types */ /** * Attach a keyboard shortcut handler. * * @see https://craig.is/killing/mice#api.bind for information about the `callback` parameter. * * @param {string[]|string} shortcuts Keyboard Shortcuts. * @param {(e: import('mousetrap').ExtendedKeyboardEvent, combo: string) => void} callback Shortcut callback. * @param {WPKeyboardShortcutConfig} options Shortcut options. */ function useKeyboardShortcut(/* eslint-enable jsdoc/valid-types */ shortcuts, callback, { bindGlobal = false, eventName = 'keydown', isDisabled = false, // This is important for performance considerations. target } = {}) { const currentCallbackRef = (0,external_wp_element_namespaceObject.useRef)(callback); (0,external_wp_element_namespaceObject.useEffect)(() => { currentCallbackRef.current = callback; }, [callback]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isDisabled) { return; } const mousetrap = new (mousetrap_default())(target && target.current ? target.current : // We were passing `document` here previously, so to successfully cast it to Element we must cast it first to `unknown`. // Not sure if this is a mistake but it was the behavior previous to the addition of types so we're just doing what's // necessary to maintain the existing behavior. /** @type {Element} */ /** @type {unknown} */ document); const shortcutsArray = Array.isArray(shortcuts) ? shortcuts : [shortcuts]; shortcutsArray.forEach(shortcut => { const keys = shortcut.split('+'); // Determines whether a key is a modifier by the length of the string. // E.g. if I add a pass a shortcut Shift+Cmd+M, it'll determine that // the modifiers are Shift and Cmd because they're not a single character. const modifiers = new Set(keys.filter(value => value.length > 1)); const hasAlt = modifiers.has('alt'); const hasShift = modifiers.has('shift'); // This should be better moved to the shortcut registration instead. if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() && (modifiers.size === 1 && hasAlt || modifiers.size === 2 && hasAlt && hasShift)) { throw new Error(`Cannot bind ${shortcut}. Alt and Shift+Alt modifiers are reserved for character input.`); } const bindFn = bindGlobal ? 'bindGlobal' : 'bind'; // @ts-ignore `bindGlobal` is an undocumented property mousetrap[bindFn](shortcut, (/* eslint-disable jsdoc/valid-types */ /** @type {[e: import('mousetrap').ExtendedKeyboardEvent, combo: string]} */...args) => /* eslint-enable jsdoc/valid-types */ currentCallbackRef.current(...args), eventName); }); return () => { mousetrap.reset(); }; }, [shortcuts, bindGlobal, eventName, target, isDisabled]); } /* harmony default export */ const use_keyboard_shortcut = (useKeyboardShortcut); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-media-query/index.js /** * WordPress dependencies */ const matchMediaCache = new Map(); /** * A new MediaQueryList object for the media query * * @param {string} [query] Media Query. * @return {MediaQueryList|null} A new object for the media query */ function getMediaQueryList(query) { if (!query) { return null; } let match = matchMediaCache.get(query); if (match) { return match; } if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') { match = window.matchMedia(query); matchMediaCache.set(query, match); return match; } return null; } /** * Runs a media query and returns its value when it changes. * * @param {string} [query] Media Query. * @return {boolean} return value of the media query. */ function useMediaQuery(query) { const source = (0,external_wp_element_namespaceObject.useMemo)(() => { const mediaQueryList = getMediaQueryList(query); return { /** @type {(onStoreChange: () => void) => () => void} */ subscribe(onStoreChange) { if (!mediaQueryList) { return () => {}; } // Avoid a fatal error when browsers don't support `addEventListener` on MediaQueryList. mediaQueryList.addEventListener?.('change', onStoreChange); return () => { mediaQueryList.removeEventListener?.('change', onStoreChange); }; }, getValue() { var _mediaQueryList$match; return (_mediaQueryList$match = mediaQueryList?.matches) !== null && _mediaQueryList$match !== void 0 ? _mediaQueryList$match : false; } }; }, [query]); return (0,external_wp_element_namespaceObject.useSyncExternalStore)(source.subscribe, source.getValue, () => false); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-previous/index.js /** * WordPress dependencies */ /** * Use something's value from the previous render. * Based on https://usehooks.com/usePrevious/. * * @param value The value to track. * * @return The value from the previous render. */ function usePrevious(value) { const ref = (0,external_wp_element_namespaceObject.useRef)(); // Store current value in ref. (0,external_wp_element_namespaceObject.useEffect)(() => { ref.current = value; }, [value]); // Re-run when value changes. // Return previous value (happens before update in useEffect above). return ref.current; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js /** * Internal dependencies */ /** * Hook returning whether the user has a preference for reduced motion. * * @return {boolean} Reduced motion preference value. */ const useReducedMotion = () => useMediaQuery('(prefers-reduced-motion: reduce)'); /* harmony default export */ const use_reduced_motion = (useReducedMotion); ;// ./node_modules/@wordpress/undo-manager/build-module/index.js /** * WordPress dependencies */ /** @typedef {import('./types').HistoryRecord} HistoryRecord */ /** @typedef {import('./types').HistoryChange} HistoryChange */ /** @typedef {import('./types').HistoryChanges} HistoryChanges */ /** @typedef {import('./types').UndoManager} UndoManager */ /** * Merge changes for a single item into a record of changes. * * @param {Record< string, HistoryChange >} changes1 Previous changes * @param {Record< string, HistoryChange >} changes2 NextChanges * * @return {Record< string, HistoryChange >} Merged changes */ function mergeHistoryChanges(changes1, changes2) { /** * @type {Record< string, HistoryChange >} */ const newChanges = { ...changes1 }; Object.entries(changes2).forEach(([key, value]) => { if (newChanges[key]) { newChanges[key] = { ...newChanges[key], to: value.to }; } else { newChanges[key] = value; } }); return newChanges; } /** * Adds history changes for a single item into a record of changes. * * @param {HistoryRecord} record The record to merge into. * @param {HistoryChanges} changes The changes to merge. */ const addHistoryChangesIntoRecord = (record, changes) => { const existingChangesIndex = record?.findIndex(({ id: recordIdentifier }) => { return typeof recordIdentifier === 'string' ? recordIdentifier === changes.id : external_wp_isShallowEqual_default()(recordIdentifier, changes.id); }); const nextRecord = [...record]; if (existingChangesIndex !== -1) { // If the edit is already in the stack leave the initial "from" value. nextRecord[existingChangesIndex] = { id: changes.id, changes: mergeHistoryChanges(nextRecord[existingChangesIndex].changes, changes.changes) }; } else { nextRecord.push(changes); } return nextRecord; }; /** * Creates an undo manager. * * @return {UndoManager} Undo manager. */ function createUndoManager() { /** * @type {HistoryRecord[]} */ let history = []; /** * @type {HistoryRecord} */ let stagedRecord = []; /** * @type {number} */ let offset = 0; const dropPendingRedos = () => { history = history.slice(0, offset || undefined); offset = 0; }; const appendStagedRecordToLatestHistoryRecord = () => { var _history$index; const index = history.length === 0 ? 0 : history.length - 1; let latestRecord = (_history$index = history[index]) !== null && _history$index !== void 0 ? _history$index : []; stagedRecord.forEach(changes => { latestRecord = addHistoryChangesIntoRecord(latestRecord, changes); }); stagedRecord = []; history[index] = latestRecord; }; /** * Checks whether a record is empty. * A record is considered empty if it the changes keep the same values. * Also updates to function values are ignored. * * @param {HistoryRecord} record * @return {boolean} Whether the record is empty. */ const isRecordEmpty = record => { const filteredRecord = record.filter(({ changes }) => { return Object.values(changes).some(({ from, to }) => typeof from !== 'function' && typeof to !== 'function' && !external_wp_isShallowEqual_default()(from, to)); }); return !filteredRecord.length; }; return { /** * Record changes into the history. * * @param {HistoryRecord=} record A record of changes to record. * @param {boolean} isStaged Whether to immediately create an undo point or not. */ addRecord(record, isStaged = false) { const isEmpty = !record || isRecordEmpty(record); if (isStaged) { if (isEmpty) { return; } record.forEach(changes => { stagedRecord = addHistoryChangesIntoRecord(stagedRecord, changes); }); } else { dropPendingRedos(); if (stagedRecord.length) { appendStagedRecordToLatestHistoryRecord(); } if (isEmpty) { return; } history.push(record); } }, undo() { if (stagedRecord.length) { dropPendingRedos(); appendStagedRecordToLatestHistoryRecord(); } const undoRecord = history[history.length - 1 + offset]; if (!undoRecord) { return; } offset -= 1; return undoRecord; }, redo() { const redoRecord = history[history.length + offset]; if (!redoRecord) { return; } offset += 1; return redoRecord; }, hasUndo() { return !!history[history.length - 1 + offset]; }, hasRedo() { return !!history[history.length + offset]; } }; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-state-with-history/index.js /** * WordPress dependencies */ function undoRedoReducer(state, action) { switch (action.type) { case 'UNDO': { const undoRecord = state.manager.undo(); if (undoRecord) { return { ...state, value: undoRecord[0].changes.prop.from }; } return state; } case 'REDO': { const redoRecord = state.manager.redo(); if (redoRecord) { return { ...state, value: redoRecord[0].changes.prop.to }; } return state; } case 'RECORD': { state.manager.addRecord([{ id: 'object', changes: { prop: { from: state.value, to: action.value } } }], action.isStaged); return { ...state, value: action.value }; } } return state; } function initReducer(value) { return { manager: createUndoManager(), value }; } /** * useState with undo/redo history. * * @param initialValue Initial value. * @return Value, setValue, hasUndo, hasRedo, undo, redo. */ function useStateWithHistory(initialValue) { const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(undoRedoReducer, initialValue, initReducer); return { value: state.value, setValue: (0,external_wp_element_namespaceObject.useCallback)((newValue, isStaged) => { dispatch({ type: 'RECORD', value: newValue, isStaged }); }, []), hasUndo: state.manager.hasUndo(), hasRedo: state.manager.hasRedo(), undo: (0,external_wp_element_namespaceObject.useCallback)(() => { dispatch({ type: 'UNDO' }); }, []), redo: (0,external_wp_element_namespaceObject.useCallback)(() => { dispatch({ type: 'REDO' }); }, []) }; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-viewport-match/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @typedef {"xhuge" | "huge" | "wide" | "xlarge" | "large" | "medium" | "small" | "mobile"} WPBreakpoint */ /** * Hash of breakpoint names with pixel width at which it becomes effective. * * @see _breakpoints.scss * * @type {Record<WPBreakpoint, number>} */ const BREAKPOINTS = { xhuge: 1920, huge: 1440, wide: 1280, xlarge: 1080, large: 960, medium: 782, small: 600, mobile: 480 }; /** * @typedef {">=" | "<"} WPViewportOperator */ /** * Object mapping media query operators to the condition to be used. * * @type {Record<WPViewportOperator, string>} */ const CONDITIONS = { '>=': 'min-width', '<': 'max-width' }; /** * Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values. * * @type {Record<WPViewportOperator, (breakpointValue: number, width: number) => boolean>} */ const OPERATOR_EVALUATORS = { '>=': (breakpointValue, width) => width >= breakpointValue, '<': (breakpointValue, width) => width < breakpointValue }; const ViewportMatchWidthContext = (0,external_wp_element_namespaceObject.createContext)(/** @type {null | number} */null); /** * Returns true if the viewport matches the given query, or false otherwise. * * @param {WPBreakpoint} breakpoint Breakpoint size name. * @param {WPViewportOperator} [operator=">="] Viewport operator. * * @example * * ```js * useViewportMatch( 'huge', '<' ); * useViewportMatch( 'medium' ); * ``` * * @return {boolean} Whether viewport matches query. */ const useViewportMatch = (breakpoint, operator = '>=') => { const simulatedWidth = (0,external_wp_element_namespaceObject.useContext)(ViewportMatchWidthContext); const mediaQuery = !simulatedWidth && `(${CONDITIONS[operator]}: ${BREAKPOINTS[breakpoint]}px)`; const mediaQueryResult = useMediaQuery(mediaQuery || undefined); if (simulatedWidth) { return OPERATOR_EVALUATORS[operator](BREAKPOINTS[breakpoint], simulatedWidth); } return mediaQueryResult; }; useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider; /* harmony default export */ const use_viewport_match = (useViewportMatch); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-resize-observer/use-resize-observer.js /** * WordPress dependencies */ /** * Internal dependencies */ // This is the current implementation of `useResizeObserver`. // // The legacy implementation is still supported for backwards compatibility. // This is achieved by overloading the exported function with both signatures, // and detecting which API is being used at runtime. function useResizeObserver(callback, resizeObserverOptions = {}) { const callbackEvent = useEvent(callback); const observedElementRef = (0,external_wp_element_namespaceObject.useRef)(); const resizeObserverRef = (0,external_wp_element_namespaceObject.useRef)(); return useEvent(element => { var _resizeObserverRef$cu; if (element === observedElementRef.current) { return; } // Set up `ResizeObserver`. (_resizeObserverRef$cu = resizeObserverRef.current) !== null && _resizeObserverRef$cu !== void 0 ? _resizeObserverRef$cu : resizeObserverRef.current = new ResizeObserver(callbackEvent); const { current: resizeObserver } = resizeObserverRef; // Unobserve previous element. if (observedElementRef.current) { resizeObserver.unobserve(observedElementRef.current); } // Observe new element. observedElementRef.current = element; if (element) { resizeObserver.observe(element, resizeObserverOptions); } }); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-resize-observer/legacy/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ // We're only using the first element of the size sequences, until future versions of the spec solidify on how // exactly it'll be used for fragments in multi-column scenarios: // From the spec: // > The box size properties are exposed as FrozenArray in order to support elements that have multiple fragments, // > which occur in multi-column scenarios. However the current definitions of content rect and border box do not // > mention how those boxes are affected by multi-column layout. In this spec, there will only be a single // > ResizeObserverSize returned in the FrozenArray, which will correspond to the dimensions of the first column. // > A future version of this spec will extend the returned FrozenArray to contain the per-fragment size information. // (https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface) // // Also, testing these new box options revealed that in both Chrome and FF everything is returned in the callback, // regardless of the "box" option. // The spec states the following on this: // > This does not have any impact on which box dimensions are returned to the defined callback when the event // > is fired, it solely defines which box the author wishes to observe layout changes on. // (https://drafts.csswg.org/resize-observer/#resize-observer-interface) // I'm not exactly clear on what this means, especially when you consider a later section stating the following: // > This section is non-normative. An author may desire to observe more than one CSS box. // > In this case, author will need to use multiple ResizeObservers. // (https://drafts.csswg.org/resize-observer/#resize-observer-interface) // Which is clearly not how current browser implementations behave, and seems to contradict the previous quote. // For this reason I decided to only return the requested size, // even though it seems we have access to results for all box types. // This also means that we get to keep the current api, being able to return a simple { width, height } pair, // regardless of box option. const extractSize = entry => { let entrySize; if (!entry.contentBoxSize) { // The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec. // See the 6th step in the description for the RO algorithm: // https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h // > Set this.contentRect to logical this.contentBoxSize given target and observedBox of "content-box". // In real browser implementations of course these objects differ, but the width/height values should be equivalent. entrySize = [entry.contentRect.width, entry.contentRect.height]; } else if (entry.contentBoxSize[0]) { const contentBoxSize = entry.contentBoxSize[0]; entrySize = [contentBoxSize.inlineSize, contentBoxSize.blockSize]; } else { // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's buggy // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`. const contentBoxSize = entry.contentBoxSize; entrySize = [contentBoxSize.inlineSize, contentBoxSize.blockSize]; } const [width, height] = entrySize.map(d => Math.round(d)); return { width, height }; }; const RESIZE_ELEMENT_STYLES = { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, pointerEvents: 'none', opacity: 0, overflow: 'hidden', zIndex: -1 }; function ResizeElement({ onResize }) { const resizeElementRef = useResizeObserver(entries => { const newSize = extractSize(entries.at(-1)); // Entries are never empty. onResize(newSize); }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: resizeElementRef, style: RESIZE_ELEMENT_STYLES, "aria-hidden": "true" }); } function sizeEquals(a, b) { return a.width === b.width && a.height === b.height; } const NULL_SIZE = { width: null, height: null }; /** * Hook which allows to listen to the resize event of any target element when it changes size. * _Note: `useResizeObserver` will report `null` sizes until after first render. * * @example * * ```js * const App = () => { * const [ resizeListener, sizes ] = useResizeObserver(); * * return ( * <div> * { resizeListener } * Your content here * </div> * ); * }; * ``` */ function useLegacyResizeObserver() { const [size, setSize] = (0,external_wp_element_namespaceObject.useState)(NULL_SIZE); // Using a ref to track the previous width / height to avoid unnecessary renders. const previousSizeRef = (0,external_wp_element_namespaceObject.useRef)(NULL_SIZE); const handleResize = (0,external_wp_element_namespaceObject.useCallback)(newSize => { if (!sizeEquals(previousSizeRef.current, newSize)) { previousSizeRef.current = newSize; setSize(newSize); } }, []); const resizeElement = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizeElement, { onResize: handleResize }); return [resizeElement, size]; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-resize-observer/index.js /** * Internal dependencies */ /** * External dependencies */ /** * Sets up a [`ResizeObserver`](https://developer.mozilla.org/en-US/docs/Web/API/Resize_Observer_API) * for an HTML or SVG element. * * Pass the returned setter as a callback ref to the React element you want * to observe, or use it in layout effects for advanced use cases. * * @example * * ```tsx * const setElement = useResizeObserver( * ( resizeObserverEntries ) => console.log( resizeObserverEntries ), * { box: 'border-box' } * ); * <div ref={ setElement } />; * * // The setter can be used in other ways, for example: * useLayoutEffect( () => { * setElement( document.querySelector( `data-element-id="${ elementId }"` ) ); * }, [ elementId ] ); * ``` * * @param callback The `ResizeObserver` callback - [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/ResizeObserver#callback). * @param options Options passed to `ResizeObserver.observe` when called - [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/observe#options). Changes will be ignored. */ /** * **This is a legacy API and should not be used.** * * @deprecated Use the other `useResizeObserver` API instead: `const ref = useResizeObserver( ( entries ) => { ... } )`. * * Hook which allows to listen to the resize event of any target element when it changes size. * _Note: `useResizeObserver` will report `null` sizes until after first render. * * @example * * ```js * const App = () => { * const [ resizeListener, sizes ] = useResizeObserver(); * * return ( * <div> * { resizeListener } * Your content here * </div> * ); * }; * ``` */ function use_resize_observer_useResizeObserver(callback, options = {}) { return callback ? useResizeObserver(callback, options) : useLegacyResizeObserver(); } ;// external ["wp","priorityQueue"] const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"]; ;// ./node_modules/@wordpress/compose/build-module/hooks/use-async-list/index.js /** * WordPress dependencies */ /** * Returns the first items from list that are present on state. * * @param list New array. * @param state Current state. * @return First items present in state. */ function getFirstItemsPresentInState(list, state) { const firstItems = []; for (let i = 0; i < list.length; i++) { const item = list[i]; if (!state.includes(item)) { break; } firstItems.push(item); } return firstItems; } /** * React hook returns an array which items get asynchronously appended from a source array. * This behavior is useful if we want to render a list of items asynchronously for performance reasons. * * @param list Source array. * @param config Configuration object. * * @return Async array. */ function useAsyncList(list, config = { step: 1 }) { const { step = 1 } = config; const [current, setCurrent] = (0,external_wp_element_namespaceObject.useState)([]); (0,external_wp_element_namespaceObject.useEffect)(() => { // On reset, we keep the first items that were previously rendered. let firstItems = getFirstItemsPresentInState(list, current); if (firstItems.length < step) { firstItems = firstItems.concat(list.slice(firstItems.length, step)); } setCurrent(firstItems); const asyncQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)(); for (let i = firstItems.length; i < list.length; i += step) { asyncQueue.add({}, () => { (0,external_wp_element_namespaceObject.flushSync)(() => { setCurrent(state => [...state, ...list.slice(i, i + step)]); }); }); } return () => asyncQueue.reset(); }, [list]); return current; } /* harmony default export */ const use_async_list = (useAsyncList); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-warn-on-change/index.js /** * Internal dependencies */ // Disable reason: Object and object are distinctly different types in TypeScript and we mean the lowercase object in this case // but eslint wants to force us to use `Object`. See https://stackoverflow.com/questions/49464634/difference-between-object-and-object-in-typescript /* eslint-disable jsdoc/check-types */ /** * Hook that performs a shallow comparison between the preview value of an object * and the new one, if there's a difference, it prints it to the console. * this is useful in performance related work, to check why a component re-renders. * * @example * * ```jsx * function MyComponent(props) { * useWarnOnChange(props); * * return "Something"; * } * ``` * * @param {object} object Object which changes to compare. * @param {string} prefix Just a prefix to show when console logging. */ function useWarnOnChange(object, prefix = 'Change detection') { const previousValues = usePrevious(object); Object.entries(previousValues !== null && previousValues !== void 0 ? previousValues : []).forEach(([key, value]) => { if (value !== object[(/** @type {keyof typeof object} */key)]) { // eslint-disable-next-line no-console console.warn(`${prefix}: ${key} key changed:`, value, object[(/** @type {keyof typeof object} */key)] /* eslint-enable jsdoc/check-types */); } }); } /* harmony default export */ const use_warn_on_change = (useWarnOnChange); ;// external "React" const external_React_namespaceObject = window["React"]; ;// ./node_modules/use-memo-one/dist/use-memo-one.esm.js function areInputsEqual(newInputs, lastInputs) { if (newInputs.length !== lastInputs.length) { return false; } for (var i = 0; i < newInputs.length; i++) { if (newInputs[i] !== lastInputs[i]) { return false; } } return true; } function useMemoOne(getResult, inputs) { var initial = (0,external_React_namespaceObject.useState)(function () { return { inputs: inputs, result: getResult() }; })[0]; var isFirstRun = (0,external_React_namespaceObject.useRef)(true); var committed = (0,external_React_namespaceObject.useRef)(initial); var useCache = isFirstRun.current || Boolean(inputs && committed.current.inputs && areInputsEqual(inputs, committed.current.inputs)); var cache = useCache ? committed.current : { inputs: inputs, result: getResult() }; (0,external_React_namespaceObject.useEffect)(function () { isFirstRun.current = false; committed.current = cache; }, [cache]); return cache.result; } function useCallbackOne(callback, inputs) { return useMemoOne(function () { return callback; }, inputs); } var useMemo = (/* unused pure expression or super */ null && (useMemoOne)); var useCallback = (/* unused pure expression or super */ null && (useCallbackOne)); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-debounce/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Debounces a function similar to Lodash's `debounce`. A new debounced function will * be returned and any scheduled calls cancelled if any of the arguments change, * including the function to debounce, so please wrap functions created on * render in components in `useCallback`. * * @see https://lodash.com/docs/4#debounce * * @template {(...args: any[]) => void} TFunc * * @param {TFunc} fn The function to debounce. * @param {number} [wait] The number of milliseconds to delay. * @param {import('../../utils/debounce').DebounceOptions} [options] The options object. * @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Debounced function. */ function useDebounce(fn, wait, options) { const debounced = useMemoOne(() => debounce(fn, wait !== null && wait !== void 0 ? wait : 0, options), [fn, wait, options]); (0,external_wp_element_namespaceObject.useEffect)(() => () => debounced.cancel(), [debounced]); return debounced; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-debounced-input/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Helper hook for input fields that need to debounce the value before using it. * * @param defaultValue The default value to use. * @return The input value, the setter and the debounced input value. */ function useDebouncedInput(defaultValue = '') { const [input, setInput] = (0,external_wp_element_namespaceObject.useState)(defaultValue); const [debouncedInput, setDebouncedState] = (0,external_wp_element_namespaceObject.useState)(defaultValue); const setDebouncedInput = useDebounce(setDebouncedState, 250); (0,external_wp_element_namespaceObject.useEffect)(() => { setDebouncedInput(input); }, [input, setDebouncedInput]); return [input, setInput, debouncedInput]; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-throttle/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Throttles a function similar to Lodash's `throttle`. A new throttled function will * be returned and any scheduled calls cancelled if any of the arguments change, * including the function to throttle, so please wrap functions created on * render in components in `useCallback`. * * @see https://lodash.com/docs/4#throttle * * @template {(...args: any[]) => void} TFunc * * @param {TFunc} fn The function to throttle. * @param {number} [wait] The number of milliseconds to throttle invocations to. * @param {import('../../utils/throttle').ThrottleOptions} [options] The options object. See linked documentation for details. * @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Throttled function. */ function useThrottle(fn, wait, options) { const throttled = useMemoOne(() => throttle(fn, wait !== null && wait !== void 0 ? wait : 0, options), [fn, wait, options]); (0,external_wp_element_namespaceObject.useEffect)(() => () => throttled.cancel(), [throttled]); return throttled; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-drop-zone/index.js /** * Internal dependencies */ /** * A hook to facilitate drag and drop handling. * * @param {Object} props Named parameters. * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone. * @param {boolean} [props.isDisabled] Whether or not to disable the drop zone. * @param {(e: DragEvent) => void} [props.onDragStart] Called when dragging has started. * @param {(e: DragEvent) => void} [props.onDragEnter] Called when the zone is entered. * @param {(e: DragEvent) => void} [props.onDragOver] Called when the zone is moved within. * @param {(e: DragEvent) => void} [props.onDragLeave] Called when the zone is left. * @param {(e: MouseEvent) => void} [props.onDragEnd] Called when dragging has ended. * @param {(e: DragEvent) => void} [props.onDrop] Called when dropping in the zone. * * @return {import('react').RefCallback<HTMLElement>} Ref callback to be passed to the drop zone element. */ function useDropZone({ dropZoneElement, isDisabled, onDrop: _onDrop, onDragStart: _onDragStart, onDragEnter: _onDragEnter, onDragLeave: _onDragLeave, onDragEnd: _onDragEnd, onDragOver: _onDragOver }) { const onDropEvent = useEvent(_onDrop); const onDragStartEvent = useEvent(_onDragStart); const onDragEnterEvent = useEvent(_onDragEnter); const onDragLeaveEvent = useEvent(_onDragLeave); const onDragEndEvent = useEvent(_onDragEnd); const onDragOverEvent = useEvent(_onDragOver); return useRefEffect(elem => { if (isDisabled) { return; } // If a custom dropZoneRef is passed, use that instead of the element. // This allows the dropzone to cover an expanded area, rather than // be restricted to the area of the ref returned by this hook. const element = dropZoneElement !== null && dropZoneElement !== void 0 ? dropZoneElement : elem; let isDragging = false; const { ownerDocument } = element; /** * Checks if an element is in the drop zone. * * @param {EventTarget|null} targetToCheck * * @return {boolean} True if in drop zone, false if not. */ function isElementInZone(targetToCheck) { const { defaultView } = ownerDocument; if (!targetToCheck || !defaultView || !(targetToCheck instanceof defaultView.HTMLElement) || !element.contains(targetToCheck)) { return false; } /** @type {HTMLElement|null} */ let elementToCheck = targetToCheck; do { if (elementToCheck.dataset.isDropZone) { return elementToCheck === element; } } while (elementToCheck = elementToCheck.parentElement); return false; } function maybeDragStart(/** @type {DragEvent} */event) { if (isDragging) { return; } isDragging = true; // Note that `dragend` doesn't fire consistently for file and // HTML drag events where the drag origin is outside the browser // window. In Firefox it may also not fire if the originating // node is removed. ownerDocument.addEventListener('dragend', maybeDragEnd); ownerDocument.addEventListener('mousemove', maybeDragEnd); if (_onDragStart) { onDragStartEvent(event); } } function onDragEnter(/** @type {DragEvent} */event) { event.preventDefault(); // The `dragenter` event will also fire when entering child // elements, but we only want to call `onDragEnter` when // entering the drop zone, which means the `relatedTarget` // (element that has been left) should be outside the drop zone. if (element.contains(/** @type {Node} */event.relatedTarget)) { return; } if (_onDragEnter) { onDragEnterEvent(event); } } function onDragOver(/** @type {DragEvent} */event) { // Only call onDragOver for the innermost hovered drop zones. if (!event.defaultPrevented && _onDragOver) { onDragOverEvent(event); } // Prevent the browser default while also signalling to parent // drop zones that `onDragOver` is already handled. event.preventDefault(); } function onDragLeave(/** @type {DragEvent} */event) { // The `dragleave` event will also fire when leaving child // elements, but we only want to call `onDragLeave` when // leaving the drop zone, which means the `relatedTarget` // (element that has been entered) should be outside the drop // zone. // Note: This is not entirely reliable in Safari due to this bug // https://bugs.webkit.org/show_bug.cgi?id=66547 if (isElementInZone(event.relatedTarget)) { return; } if (_onDragLeave) { onDragLeaveEvent(event); } } function onDrop(/** @type {DragEvent} */event) { // Don't handle drop if an inner drop zone already handled it. if (event.defaultPrevented) { return; } // Prevent the browser default while also signalling to parent // drop zones that `onDrop` is already handled. event.preventDefault(); // This seemingly useless line has been shown to resolve a // Safari issue where files dragged directly from the dock are // not recognized. // eslint-disable-next-line no-unused-expressions event.dataTransfer && event.dataTransfer.files.length; if (_onDrop) { onDropEvent(event); } maybeDragEnd(event); } function maybeDragEnd(/** @type {MouseEvent} */event) { if (!isDragging) { return; } isDragging = false; ownerDocument.removeEventListener('dragend', maybeDragEnd); ownerDocument.removeEventListener('mousemove', maybeDragEnd); if (_onDragEnd) { onDragEndEvent(event); } } element.setAttribute('data-is-drop-zone', 'true'); element.addEventListener('drop', onDrop); element.addEventListener('dragenter', onDragEnter); element.addEventListener('dragover', onDragOver); element.addEventListener('dragleave', onDragLeave); // The `dragstart` event doesn't fire if the drag started outside // the document. ownerDocument.addEventListener('dragenter', maybeDragStart); return () => { element.removeAttribute('data-is-drop-zone'); element.removeEventListener('drop', onDrop); element.removeEventListener('dragenter', onDragEnter); element.removeEventListener('dragover', onDragOver); element.removeEventListener('dragleave', onDragLeave); ownerDocument.removeEventListener('dragend', maybeDragEnd); ownerDocument.removeEventListener('mousemove', maybeDragEnd); ownerDocument.removeEventListener('dragenter', maybeDragStart); }; }, [isDisabled, dropZoneElement] // Refresh when the passed in dropZoneElement changes. ); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-focusable-iframe/index.js /** * External dependencies */ /** * Internal dependencies */ /** * Dispatches a bubbling focus event when the iframe receives focus. Use * `onFocus` as usual on the iframe or a parent element. * * @return Ref to pass to the iframe. */ function useFocusableIframe() { return useRefEffect(element => { const { ownerDocument } = element; if (!ownerDocument) { return; } const { defaultView } = ownerDocument; if (!defaultView) { return; } /** * Checks whether the iframe is the activeElement, inferring that it has * then received focus, and dispatches a focus event. */ function checkFocus() { if (ownerDocument && ownerDocument.activeElement === element) { element.focus(); } } defaultView.addEventListener('blur', checkFocus); return () => { defaultView.removeEventListener('blur', checkFocus); }; }, []); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-fixed-window-list/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_INIT_WINDOW_SIZE = 30; /** * @typedef {Object} WPFixedWindowList * * @property {number} visibleItems Items visible in the current viewport * @property {number} start Start index of the window * @property {number} end End index of the window * @property {(index:number)=>boolean} itemInView Returns true if item is in the window */ /** * @typedef {Object} WPFixedWindowListOptions * * @property {number} [windowOverscan] Renders windowOverscan number of items before and after the calculated visible window. * @property {boolean} [useWindowing] When false avoids calculating the window size * @property {number} [initWindowSize] Initial window size to use on first render before we can calculate the window size. * @property {any} [expandedState] Used to recalculate the window size when the expanded state of a list changes. */ /** * * @param {import('react').RefObject<HTMLElement>} elementRef Used to find the closest scroll container that contains element. * @param { number } itemHeight Fixed item height in pixels * @param { number } totalItems Total items in list * @param { WPFixedWindowListOptions } [options] Options object * @return {[ WPFixedWindowList, setFixedListWindow:(nextWindow:WPFixedWindowList)=>void]} Array with the fixed window list and setter */ function useFixedWindowList(elementRef, itemHeight, totalItems, options) { var _options$initWindowSi, _options$useWindowing; const initWindowSize = (_options$initWindowSi = options?.initWindowSize) !== null && _options$initWindowSi !== void 0 ? _options$initWindowSi : DEFAULT_INIT_WINDOW_SIZE; const useWindowing = (_options$useWindowing = options?.useWindowing) !== null && _options$useWindowing !== void 0 ? _options$useWindowing : true; const [fixedListWindow, setFixedListWindow] = (0,external_wp_element_namespaceObject.useState)({ visibleItems: initWindowSize, start: 0, end: initWindowSize, itemInView: (/** @type {number} */index) => { return index >= 0 && index <= initWindowSize; } }); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!useWindowing) { return; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(elementRef.current); const measureWindow = (/** @type {boolean | undefined} */initRender) => { var _options$windowOversc; if (!scrollContainer) { return; } const visibleItems = Math.ceil(scrollContainer.clientHeight / itemHeight); // Aim to keep opening list view fast, afterward we can optimize for scrolling. const windowOverscan = initRender ? visibleItems : (_options$windowOversc = options?.windowOverscan) !== null && _options$windowOversc !== void 0 ? _options$windowOversc : visibleItems; const firstViewableIndex = Math.floor(scrollContainer.scrollTop / itemHeight); const start = Math.max(0, firstViewableIndex - windowOverscan); const end = Math.min(totalItems - 1, firstViewableIndex + visibleItems + windowOverscan); setFixedListWindow(lastWindow => { const nextWindow = { visibleItems, start, end, itemInView: (/** @type {number} */index) => { return start <= index && index <= end; } }; if (lastWindow.start !== nextWindow.start || lastWindow.end !== nextWindow.end || lastWindow.visibleItems !== nextWindow.visibleItems) { return nextWindow; } return lastWindow; }); }; measureWindow(true); const debounceMeasureList = debounce(() => { measureWindow(); }, 16); scrollContainer?.addEventListener('scroll', debounceMeasureList); scrollContainer?.ownerDocument?.defaultView?.addEventListener('resize', debounceMeasureList); scrollContainer?.ownerDocument?.defaultView?.addEventListener('resize', debounceMeasureList); return () => { scrollContainer?.removeEventListener('scroll', debounceMeasureList); scrollContainer?.ownerDocument?.defaultView?.removeEventListener('resize', debounceMeasureList); }; }, [itemHeight, elementRef, totalItems, options?.expandedState, options?.windowOverscan, useWindowing]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!useWindowing) { return; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(elementRef.current); const handleKeyDown = (/** @type {KeyboardEvent} */event) => { switch (event.keyCode) { case external_wp_keycodes_namespaceObject.HOME: { return scrollContainer?.scrollTo({ top: 0 }); } case external_wp_keycodes_namespaceObject.END: { return scrollContainer?.scrollTo({ top: totalItems * itemHeight }); } case external_wp_keycodes_namespaceObject.PAGEUP: { return scrollContainer?.scrollTo({ top: scrollContainer.scrollTop - fixedListWindow.visibleItems * itemHeight }); } case external_wp_keycodes_namespaceObject.PAGEDOWN: { return scrollContainer?.scrollTo({ top: scrollContainer.scrollTop + fixedListWindow.visibleItems * itemHeight }); } } }; scrollContainer?.ownerDocument?.defaultView?.addEventListener('keydown', handleKeyDown); return () => { scrollContainer?.ownerDocument?.defaultView?.removeEventListener('keydown', handleKeyDown); }; }, [totalItems, itemHeight, elementRef, fixedListWindow.visibleItems, useWindowing, options?.expandedState]); return [fixedListWindow, setFixedListWindow]; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-observable-value/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * React hook that lets you observe an entry in an `ObservableMap`. The hook returns the * current value corresponding to the key, or `undefined` when there is no value stored. * It also observes changes to the value and triggers an update of the calling component * in case the value changes. * * @template K The type of the keys in the map. * @template V The type of the values in the map. * @param map The `ObservableMap` to observe. * @param name The map key to observe. * @return The value corresponding to the map key requested. */ function useObservableValue(map, name) { const [subscribe, getValue] = (0,external_wp_element_namespaceObject.useMemo)(() => [listener => map.subscribe(name, listener), () => map.get(name)], [map, name]); return (0,external_wp_element_namespaceObject.useSyncExternalStore)(subscribe, getValue, getValue); } ;// ./node_modules/@wordpress/compose/build-module/index.js // The `createHigherOrderComponent` helper and helper types. // The `debounce` helper and its types. // The `throttle` helper and its types. // The `ObservableMap` data structure // The `compose` and `pipe` helpers (inspired by `flowRight` and `flow` from Lodash). // Higher-order components. // Hooks. })(); (window.wp = window.wp || {}).compose = __webpack_exports__; /******/ })() ; dist/customize-widgets.js 0000644 00000276517 15125140777 0011566 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ 7734: /***/ ((module) => { // do not edit .js files directly - edit src/index.jst var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if ((a instanceof Map) && (b instanceof Map)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false; return true; } if ((a instanceof Set) && (b instanceof Set)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; return true; } if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { initialize: () => (/* binding */ initialize), store: () => (/* reexport */ store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/customize-widgets/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), isInserterOpened: () => (isInserterOpened) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { setIsInserterOpened: () => (setIsInserterOpened) }); ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","blockLibrary"] const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; ;// external ["wp","widgets"] const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","preferences"] const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/customize-widgets/build-module/components/error-boundary/index.js /** * WordPress dependencies */ function CopyButton({ text, children }) { const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "secondary", ref: ref, children: children }); } class ErrorBoundary extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.state = { error: null }; } componentDidCatch(error) { this.setState({ error }); (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error); } render() { const { error } = this.state; if (!error) { return this.props.children; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { className: "customize-widgets-error-boundary", actions: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { text: error.stack, children: (0,external_wp_i18n_namespaceObject.__)('Copy Error') }, "copy-error")], children: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.') }); } } ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// external ["wp","mediaUtils"] const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; ;// ./node_modules/@wordpress/customize-widgets/build-module/components/block-inspector-button/index.js /** * WordPress dependencies */ function BlockInspectorButton({ inspector, closeMenu, ...props }) { const selectedBlockClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId(), []); const selectedBlock = (0,external_wp_element_namespaceObject.useMemo)(() => document.getElementById(`block-${selectedBlockClientId}`), [selectedBlockClientId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { // Open the inspector. inspector.open({ returnFocusWhenClose: selectedBlock }); // Then close the dropdown menu. closeMenu(); }, ...props, children: (0,external_wp_i18n_namespaceObject.__)('Show more settings') }); } /* harmony default export */ const block_inspector_button = (BlockInspectorButton); ;// ./node_modules/clsx/dist/clsx.mjs function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/undo.js /** * WordPress dependencies */ const undo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" }) }); /* harmony default export */ const library_undo = (undo); ;// ./node_modules/@wordpress/icons/build-module/library/redo.js /** * WordPress dependencies */ const redo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" }) }); /* harmony default export */ const library_redo = (redo); ;// ./node_modules/@wordpress/icons/build-module/library/plus.js /** * WordPress dependencies */ const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); /* harmony default export */ const library_plus = (plus); ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js /** * WordPress dependencies */ const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); /* harmony default export */ const close_small = (closeSmall); ;// ./node_modules/@wordpress/customize-widgets/build-module/store/reducer.js /** * WordPress dependencies */ /** * Reducer tracking whether the inserter is open. * * @param {boolean|Object} state * @param {Object} action */ function blockInserterPanel(state = false, action) { switch (action.type) { case 'SET_IS_INSERTER_OPENED': return action.value; } return state; } /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ blockInserterPanel })); ;// ./node_modules/@wordpress/customize-widgets/build-module/store/selectors.js const EMPTY_INSERTION_POINT = { rootClientId: undefined, insertionIndex: undefined }; /** * Returns true if the inserter is opened. * * @param {Object} state Global application state. * * @example * ```js * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets'; * import { __ } from '@wordpress/i18n'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const { isInserterOpened } = useSelect( * ( select ) => select( customizeWidgetsStore ), * [] * ); * * return isInserterOpened() * ? __( 'Inserter is open' ) * : __( 'Inserter is closed.' ); * }; * ``` * * @return {boolean} Whether the inserter is opened. */ function isInserterOpened(state) { return !!state.blockInserterPanel; } /** * Get the insertion point for the inserter. * * @param {Object} state Global application state. * * @return {Object} The root client ID and index to insert at. */ function __experimentalGetInsertionPoint(state) { if (typeof state.blockInserterPanel === 'boolean') { return EMPTY_INSERTION_POINT; } return state.blockInserterPanel; } ;// ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js /** * Returns an action object used to open/close the inserter. * * @param {boolean|Object} value Whether the inserter should be * opened (true) or closed (false). * To specify an insertion point, * use an object. * @param {string} value.rootClientId The root client ID to insert at. * @param {number} value.insertionIndex The index to insert at. * * @example * ```js * import { useState } from 'react'; * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets'; * import { __ } from '@wordpress/i18n'; * import { useDispatch } from '@wordpress/data'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * const { setIsInserterOpened } = useDispatch( customizeWidgetsStore ); * const [ isOpen, setIsOpen ] = useState( false ); * * return ( * <Button * onClick={ () => { * setIsInserterOpened( ! isOpen ); * setIsOpen( ! isOpen ); * } } * > * { __( 'Open/close inserter' ) } * </Button> * ); * }; * ``` * * @return {Object} Action object. */ function setIsInserterOpened(value) { return { type: 'SET_IS_INSERTER_OPENED', value }; } ;// ./node_modules/@wordpress/customize-widgets/build-module/store/constants.js /** * Module Constants */ const STORE_NAME = 'core/customize-widgets'; ;// ./node_modules/@wordpress/customize-widgets/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block editor data store configuration. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store * * @type {Object} */ const storeConfig = { reducer: reducer, selectors: selectors_namespaceObject, actions: actions_namespaceObject }; /** * Store definition for the edit widgets namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore * * @type {Object} */ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/customize-widgets/build-module/components/inserter/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function Inserter({ setIsOpened }) { const inserterTitleId = (0,external_wp_compose_namespaceObject.useInstanceId)(Inserter, 'customize-widget-layout__inserter-panel-title'); const insertionPoint = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__experimentalGetInsertionPoint(), []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "customize-widgets-layout__inserter-panel", "aria-labelledby": inserterTitleId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "customize-widgets-layout__inserter-panel-header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { id: inserterTitleId, className: "customize-widgets-layout__inserter-panel-header-title", children: (0,external_wp_i18n_namespaceObject.__)('Add a block') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: close_small, onClick: () => setIsOpened(false), "aria-label": (0,external_wp_i18n_namespaceObject.__)('Close inserter') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "customize-widgets-layout__inserter-panel-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, { rootClientId: insertionPoint.rootClientId, __experimentalInsertionIndex: insertionPoint.insertionIndex, showInserterHelpPanel: true, onSelect: () => setIsOpened(false) }) })] }); } /* harmony default export */ const components_inserter = (Inserter); ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js /** * WordPress dependencies */ const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); /* harmony default export */ const more_vertical = (moreVertical); ;// ./node_modules/@wordpress/icons/build-module/library/external.js /** * WordPress dependencies */ const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); /* harmony default export */ const library_external = (external); ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/config.js /** * WordPress dependencies */ const textFormattingShortcuts = [{ keyCombination: { modifier: 'primary', character: 'b' }, description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') }, { keyCombination: { modifier: 'primary', character: 'i' }, description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') }, { keyCombination: { modifier: 'primary', character: 'k' }, description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') }, { keyCombination: { modifier: 'primaryShift', character: 'k' }, description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') }, { keyCombination: { character: '[[' }, description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.') }, { keyCombination: { modifier: 'primary', character: 'u' }, description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') }, { keyCombination: { modifier: 'access', character: 'd' }, description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.') }, { keyCombination: { modifier: 'access', character: 'x' }, description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.') }, { keyCombination: { modifier: 'access', character: '0' }, aliases: [{ modifier: 'access', character: '7' }], description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.') }, { keyCombination: { modifier: 'access', character: '1-6' }, description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.') }, { keyCombination: { modifier: 'primaryShift', character: 'SPACE' }, description: (0,external_wp_i18n_namespaceObject.__)('Add non breaking space.') }]; ;// ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js /** * WordPress dependencies */ function KeyCombination({ keyCombination, forceAriaLabel }) { const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", "aria-label": forceAriaLabel || ariaLabel, children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => { if (character === '+') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: character }, index); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key", children: character }, index); }) }); } function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-description", children: description }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-term", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { keyCombination: keyCombination, forceAriaLabel: ariaLabel }), aliases.map((alias, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { keyCombination: alias, forceAriaLabel: ariaLabel }, index))] })] }); } /* harmony default export */ const keyboard_shortcut_help_modal_shortcut = (Shortcut); ;// ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js /** * WordPress dependencies */ /** * Internal dependencies */ function DynamicShortcut({ name }) { const { keyCombination, description, aliases } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getShortcutKeyCombination, getShortcutDescription, getShortcutAliases } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { keyCombination: getShortcutKeyCombination(name), aliases: getShortcutAliases(name), description: getShortcutDescription(name) }; }, [name]); if (!keyCombination) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { keyCombination: keyCombination, description: description, aliases: aliases }); } /* harmony default export */ const dynamic_shortcut = (DynamicShortcut); ;// ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ShortcutList = ({ shortcuts }) => /*#__PURE__*/ /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-list", role: "list", children: shortcuts.map((shortcut, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut", children: typeof shortcut === 'string' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dynamic_shortcut, { name: shortcut }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { ...shortcut }) }, index)) }) /* eslint-enable jsx-a11y/no-redundant-roles */; const ShortcutSection = ({ title, shortcuts, className }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { className: dist_clsx('customize-widgets-keyboard-shortcut-help-modal__section', className), children: [!!title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "customize-widgets-keyboard-shortcut-help-modal__section-title", children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutList, { shortcuts: shortcuts })] }); const ShortcutCategorySection = ({ title, categoryName, additionalShortcuts = [] }) => { const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); }, [categoryName]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { title: title, shortcuts: categoryShortcuts.concat(additionalShortcuts) }); }; function KeyboardShortcutHelpModal({ isModalActive, toggleModal }) { const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); registerShortcut({ name: 'core/customize-widgets/keyboard-shortcuts', category: 'main', description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), keyCombination: { modifier: 'access', character: 'h' } }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleModal); if (!isModalActive) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { className: "customize-widgets-keyboard-shortcut-help-modal", title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), onRequestClose: toggleModal, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { className: "customize-widgets-keyboard-shortcut-help-modal__main-shortcuts", shortcuts: ['core/customize-widgets/keyboard-shortcuts'] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), categoryName: "global" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), categoryName: "selection" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), categoryName: "block", additionalShortcuts: [{ keyCombination: { character: '/' }, description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), /* translators: The forward-slash character. e.g. '/'. */ ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') }] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), shortcuts: textFormattingShortcuts })] }); } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/more-menu/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function MoreMenu() { const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0,external_wp_element_namespaceObject.useState)(false); const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarDropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Options'), popoverProps: { placement: 'bottom-end', className: 'more-menu-dropdown__content' }, toggleProps: { tooltipPosition: 'bottom', size: 'compact' }, children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/customize-widgets", name: "fixedToolbar", label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Tools'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { setIsKeyboardShortcutsModalVisible(true); }, shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h'), children: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/customize-widgets", name: "welcomeGuide", label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { role: "menuitem", icon: library_external, href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/block-based-widgets-editor/'), target: "_blank", rel: "noopener noreferrer", children: [(0,external_wp_i18n_namespaceObject.__)('Help'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: /* translators: accessibility text */ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Preferences'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/customize-widgets", name: "keepCaretInsideBlock", label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block'), info: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block activated'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block deactivated') }) })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyboardShortcutHelpModal, { isModalActive: isKeyboardShortcutsModalActive, toggleModal: toggleKeyboardShortcutsModal })] }); } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/header/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function Header({ sidebar, inserter, isInserterOpened, setIsInserterOpened, isFixedToolbarActive }) { const [[hasUndo, hasRedo], setUndoRedo] = (0,external_wp_element_namespaceObject.useState)([sidebar.hasUndo(), sidebar.hasRedo()]); const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y'); (0,external_wp_element_namespaceObject.useEffect)(() => { return sidebar.subscribeHistory(() => { setUndoRedo([sidebar.hasUndo(), sidebar.hasRedo()]); }); }, [sidebar]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('customize-widgets-header', { 'is-fixed-toolbar-active': isFixedToolbarActive }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.NavigableToolbar, { className: "customize-widgets-header-toolbar", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document tools'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('Undo'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z'), disabled: !hasUndo, onClick: sidebar.undo, className: "customize-widgets-editor-history-button undo-button" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('Redo'), shortcut: shortcut, disabled: !hasRedo, onClick: sidebar.redo, className: "customize-widgets-editor-history-button redo-button" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { className: "customize-widgets-header-toolbar__inserter-toggle", isPressed: isInserterOpened, variant: "primary", icon: library_plus, label: (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button'), onClick: () => { setIsInserterOpened(isOpen => !isOpen); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {})] }) }), (0,external_wp_element_namespaceObject.createPortal)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_inserter, { setIsOpened: setIsInserterOpened }), inserter.contentContainer[0])] }); } /* harmony default export */ const header = (Header); ;// ./node_modules/@wordpress/customize-widgets/build-module/components/inserter/use-inserter.js /** * WordPress dependencies */ /** * Internal dependencies */ function useInserter(inserter) { const isInserterOpened = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInserterOpened(), []); const { setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isInserterOpened) { inserter.open(); } else { inserter.close(); } }, [inserter, isInserterOpened]); return [isInserterOpened, (0,external_wp_element_namespaceObject.useCallback)(updater => { let isOpen = updater; if (typeof updater === 'function') { isOpen = updater((0,external_wp_data_namespaceObject.select)(store).isInserterOpened()); } setIsInserterOpened(isOpen); }, [setIsInserterOpened])]; } // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js var es6 = __webpack_require__(7734); var es6_default = /*#__PURE__*/__webpack_require__.n(es6); ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// ./node_modules/@wordpress/customize-widgets/build-module/utils.js // @ts-check /** * WordPress dependencies */ /** * Convert settingId to widgetId. * * @param {string} settingId The setting id. * @return {string} The widget id. */ function settingIdToWidgetId(settingId) { const matches = settingId.match(/^widget_(.+)(?:\[(\d+)\])$/); if (matches) { const idBase = matches[1]; const number = parseInt(matches[2], 10); return `${idBase}-${number}`; } return settingId; } /** * Transform a block to a customizable widget. * * @param {WPBlock} block The block to be transformed from. * @param {Object} existingWidget The widget to be extended from. * @return {Object} The transformed widget. */ function blockToWidget(block, existingWidget = null) { let widget; const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance); if (isValidLegacyWidgetBlock) { if (block.attributes.id) { // Widget that does not extend WP_Widget. widget = { id: block.attributes.id }; } else { const { encoded, hash, raw, ...rest } = block.attributes.instance; // Widget that extends WP_Widget. widget = { idBase: block.attributes.idBase, instance: { ...existingWidget?.instance, // Required only for the customizer. is_widget_customizer_js_value: true, encoded_serialized_instance: encoded, instance_hash_key: hash, raw_instance: raw, ...rest } }; } } else { const instance = { content: (0,external_wp_blocks_namespaceObject.serialize)(block) }; widget = { idBase: 'block', widgetClass: 'WP_Widget_Block', instance: { raw_instance: instance } }; } const { form, rendered, ...restExistingWidget } = existingWidget || {}; return { ...restExistingWidget, ...widget }; } /** * Transform a widget to a block. * * @param {Object} widget The widget to be transformed from. * @param {string} widget.id The widget id. * @param {string} widget.idBase The id base of the widget. * @param {number} widget.number The number/index of the widget. * @param {Object} widget.instance The instance of the widget. * @return {WPBlock} The transformed block. */ function widgetToBlock({ id, idBase, number, instance }) { let block; const { encoded_serialized_instance: encoded, instance_hash_key: hash, raw_instance: raw, ...rest } = instance; if (idBase === 'block') { var _raw$content; const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)((_raw$content = raw.content) !== null && _raw$content !== void 0 ? _raw$content : '', { __unstableSkipAutop: true }); block = parsedBlocks.length ? parsedBlocks[0] : (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {}); } else if (number) { // Widget that extends WP_Widget. block = (0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', { idBase, instance: { encoded, hash, raw, ...rest } }); } else { // Widget that does not extend WP_Widget. block = (0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', { id }); } return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(block, id); } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function widgetsToBlocks(widgets) { return widgets.map(widget => widgetToBlock(widget)); } function useSidebarBlockEditor(sidebar) { const [blocks, setBlocks] = (0,external_wp_element_namespaceObject.useState)(() => widgetsToBlocks(sidebar.getWidgets())); (0,external_wp_element_namespaceObject.useEffect)(() => { return sidebar.subscribe((prevWidgets, nextWidgets) => { setBlocks(prevBlocks => { const prevWidgetsMap = new Map(prevWidgets.map(widget => [widget.id, widget])); const prevBlocksMap = new Map(prevBlocks.map(block => [(0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block), block])); const nextBlocks = nextWidgets.map(nextWidget => { const prevWidget = prevWidgetsMap.get(nextWidget.id); // Bail out updates. if (prevWidget && prevWidget === nextWidget) { return prevBlocksMap.get(nextWidget.id); } return widgetToBlock(nextWidget); }); // Bail out updates. if (external_wp_isShallowEqual_default()(prevBlocks, nextBlocks)) { return prevBlocks; } return nextBlocks; }); }); }, [sidebar]); const onChangeBlocks = (0,external_wp_element_namespaceObject.useCallback)(nextBlocks => { setBlocks(prevBlocks => { if (external_wp_isShallowEqual_default()(prevBlocks, nextBlocks)) { return prevBlocks; } const prevBlocksMap = new Map(prevBlocks.map(block => [(0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block), block])); const nextWidgets = nextBlocks.map(nextBlock => { const widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(nextBlock); // Update existing widgets. if (widgetId && prevBlocksMap.has(widgetId)) { const prevBlock = prevBlocksMap.get(widgetId); const prevWidget = sidebar.getWidget(widgetId); // Bail out updates by returning the previous widgets. // Deep equality is necessary until the block editor's internals changes. if (es6_default()(nextBlock, prevBlock) && prevWidget) { return prevWidget; } return blockToWidget(nextBlock, prevWidget); } // Add a new widget. return blockToWidget(nextBlock); }); // Bail out updates if the updated widgets are the same. if (external_wp_isShallowEqual_default()(sidebar.getWidgets(), nextWidgets)) { return prevBlocks; } const addedWidgetIds = sidebar.setWidgets(nextWidgets); return nextBlocks.reduce((updatedNextBlocks, nextBlock, index) => { const addedWidgetId = addedWidgetIds[index]; if (addedWidgetId !== null) { // Only create a new instance if necessary to prevent // the whole editor from re-rendering on every edit. if (updatedNextBlocks === nextBlocks) { updatedNextBlocks = nextBlocks.slice(); } updatedNextBlocks[index] = (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(nextBlock, addedWidgetId); } return updatedNextBlocks; }, nextBlocks); }); }, [sidebar]); return [blocks, onChangeBlocks, onChangeBlocks]; } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/focus-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const FocusControlContext = (0,external_wp_element_namespaceObject.createContext)(); function FocusControl({ api, sidebarControls, children }) { const [focusedWidgetIdRef, setFocusedWidgetIdRef] = (0,external_wp_element_namespaceObject.useState)({ current: null }); const focusWidget = (0,external_wp_element_namespaceObject.useCallback)(widgetId => { for (const sidebarControl of sidebarControls) { const widgets = sidebarControl.setting.get(); if (widgets.includes(widgetId)) { sidebarControl.sectionInstance.expand({ // Schedule it after the complete callback so that // it won't be overridden by the "Back" button focus. completeCallback() { // Create a "ref-like" object every time to ensure // the same widget id can also triggers the focus control. setFocusedWidgetIdRef({ current: widgetId }); } }); break; } } }, [sidebarControls]); (0,external_wp_element_namespaceObject.useEffect)(() => { function handleFocus(settingId) { const widgetId = settingIdToWidgetId(settingId); focusWidget(widgetId); } let previewBound = false; function handleReady() { api.previewer.preview.bind('focus-control-for-setting', handleFocus); previewBound = true; } api.previewer.bind('ready', handleReady); return () => { api.previewer.unbind('ready', handleReady); if (previewBound) { api.previewer.preview.unbind('focus-control-for-setting', handleFocus); } }; }, [api, focusWidget]); const context = (0,external_wp_element_namespaceObject.useMemo)(() => [focusedWidgetIdRef, focusWidget], [focusedWidgetIdRef, focusWidget]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FocusControlContext.Provider, { value: context, children: children }); } const useFocusControl = () => (0,external_wp_element_namespaceObject.useContext)(FocusControlContext); ;// ./node_modules/@wordpress/customize-widgets/build-module/components/focus-control/use-blocks-focus-control.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBlocksFocusControl(blocks) { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const [focusedWidgetIdRef] = useFocusControl(); const blocksRef = (0,external_wp_element_namespaceObject.useRef)(blocks); (0,external_wp_element_namespaceObject.useEffect)(() => { blocksRef.current = blocks; }, [blocks]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (focusedWidgetIdRef.current) { const focusedBlock = blocksRef.current.find(block => (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block) === focusedWidgetIdRef.current); if (focusedBlock) { selectBlock(focusedBlock.clientId); // If the block is already being selected, the DOM node won't // get focused again automatically. // We select the DOM and focus it manually here. const blockNode = document.querySelector(`[data-block="${focusedBlock.clientId}"]`); blockNode?.focus(); } } }, [focusedWidgetIdRef, selectBlock]); } ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/customize-widgets/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/customize-widgets'); ;// ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/sidebar-editor-provider.js /** * WordPress dependencies */ /** * Internal dependencies */ const { ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function SidebarEditorProvider({ sidebar, settings, children }) { const [blocks, onInput, onChange] = useSidebarBlockEditor(sidebar); useBlocksFocusControl(blocks); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { value: blocks, onInput: onInput, onChange: onChange, settings: settings, useSubRegistry: false, children: children }); } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/welcome-guide/index.js /** * WordPress dependencies */ function WelcomeGuide({ sidebar }) { const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-')); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "customize-widgets-welcome-guide", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "customize-widgets-welcome-guide__image__wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg", media: "(prefers-reduced-motion: reduce)" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { className: "customize-widgets-welcome-guide__image", src: "https://s.w.org/images/block-editor/welcome-editor.gif", width: "312", height: "240", alt: "" })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "customize-widgets-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "customize-widgets-welcome-guide__text", children: isEntirelyBlockWidgets ? (0,external_wp_i18n_namespaceObject.__)('Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.') : (0,external_wp_i18n_namespaceObject.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "primary", onClick: () => toggle('core/customize-widgets', 'welcomeGuide'), children: (0,external_wp_i18n_namespaceObject.__)('Got it') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("hr", { className: "customize-widgets-welcome-guide__separator" }), !isEntirelyBlockWidgets && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [(0,external_wp_i18n_namespaceObject.__)('Want to stick with the old widgets?'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/plugins/classic-widgets/'), children: (0,external_wp_i18n_namespaceObject.__)('Get the Classic Widgets plugin.') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [(0,external_wp_i18n_namespaceObject.__)('New to the block editor?'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'), children: (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide.") })] })] }); } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcuts/index.js /** * WordPress dependencies */ function KeyboardShortcuts({ undo, redo, save }) { (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/undo', event => { undo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/redo', event => { redo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/save', event => { event.preventDefault(); save(); }); return null; } function KeyboardShortcutsRegister() { const { registerShortcut, unregisterShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: 'core/customize-widgets/undo', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), keyCombination: { modifier: 'primary', character: 'z' } }); registerShortcut({ name: 'core/customize-widgets/redo', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), keyCombination: { modifier: 'primaryShift', character: 'z' }, // Disable on Apple OS because it conflicts with the browser's // history shortcut. It's a fine alias for both Windows and Linux. // Since there's no conflict for Ctrl+Shift+Z on both Windows and // Linux, we keep it as the default for consistency. aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{ modifier: 'primary', character: 'y' }] }); registerShortcut({ name: 'core/customize-widgets/save', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), keyCombination: { modifier: 'primary', character: 's' } }); return () => { unregisterShortcut('core/customize-widgets/undo'); unregisterShortcut('core/customize-widgets/redo'); unregisterShortcut('core/customize-widgets/save'); }; }, [registerShortcut]); return null; } KeyboardShortcuts.Register = KeyboardShortcutsRegister; /* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); ;// ./node_modules/@wordpress/customize-widgets/build-module/components/block-appender/index.js /** * WordPress dependencies */ function BlockAppender(props) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const isBlocksListEmpty = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlockCount() === 0); // Move the focus to the block appender to prevent focus from // being lost when emptying the widget area. (0,external_wp_element_namespaceObject.useEffect)(() => { if (isBlocksListEmpty && ref.current) { const { ownerDocument } = ref.current; if (!ownerDocument.activeElement || ownerDocument.activeElement === ownerDocument.body) { ref.current.focus(); } } }, [isBlocksListEmpty]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, { ...props, ref: ref }); } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { ExperimentalBlockCanvas: BlockCanvas } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { BlockKeyboardShortcuts } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); function SidebarBlockEditor({ blockEditorSettings, sidebar, inserter, inspector }) { const [isInserterOpened, setIsInserterOpened] = useInserter(inserter); const isMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); const { hasUploadPermissions, isFixedToolbarActive, keepCaretInsideBlock, isWelcomeGuideActive } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$canUser; const { get } = select(external_wp_preferences_namespaceObject.store); return { hasUploadPermissions: (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'root', name: 'media' })) !== null && _select$canUser !== void 0 ? _select$canUser : true, isFixedToolbarActive: !!get('core/customize-widgets', 'fixedToolbar'), keepCaretInsideBlock: !!get('core/customize-widgets', 'keepCaretInsideBlock'), isWelcomeGuideActive: !!get('core/customize-widgets', 'welcomeGuide') }; }, []); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { let mediaUploadBlockEditor; if (hasUploadPermissions) { mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => { (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, onError: ({ message }) => onError(message), ...argumentsObject }); }; } return { ...blockEditorSettings, __experimentalSetIsInserterOpened: setIsInserterOpened, mediaUpload: mediaUploadBlockEditor, hasFixedToolbar: isFixedToolbarActive || !isMediumViewport, keepCaretInsideBlock, editorTool: 'edit', __unstableHasCustomAppender: true }; }, [hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, isMediumViewport, keepCaretInsideBlock, setIsInserterOpened]); if (isWelcomeGuideActive) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, { sidebar: sidebar }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts.Register, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SidebarEditorProvider, { sidebar: sidebar, settings: settings, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts, { undo: sidebar.undo, redo: sidebar.redo, save: sidebar.save }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { sidebar: sidebar, inserter: inserter, isInserterOpened: isInserterOpened, setIsInserterOpened: setIsInserterOpened, isFixedToolbarActive: isFixedToolbarActive || !isMediumViewport }), (isFixedToolbarActive || !isMediumViewport) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockCanvas, { shouldIframe: false, styles: settings.defaultEditorStyles, height: "100%", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: BlockAppender }) }), (0,external_wp_element_namespaceObject.createPortal)( /*#__PURE__*/ // This is a temporary hack to prevent button component inside <BlockInspector> // from submitting form when type="button" is not specified. (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: event => event.preventDefault(), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockInspector, {}) }), inspector.contentContainer[0])] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_inspector_button, { inspector: inspector, closeMenu: onClose }) })] }); } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-controls/index.js /** * WordPress dependencies */ const SidebarControlsContext = (0,external_wp_element_namespaceObject.createContext)(); function SidebarControls({ sidebarControls, activeSidebarControl, children }) { const context = (0,external_wp_element_namespaceObject.useMemo)(() => ({ sidebarControls, activeSidebarControl }), [sidebarControls, activeSidebarControl]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarControlsContext.Provider, { value: context, children: children }); } function useSidebarControls() { const { sidebarControls } = (0,external_wp_element_namespaceObject.useContext)(SidebarControlsContext); return sidebarControls; } function useActiveSidebarControl() { const { activeSidebarControl } = (0,external_wp_element_namespaceObject.useContext)(SidebarControlsContext); return activeSidebarControl; } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/customize-widgets/use-clear-selected-block.js /** * WordPress dependencies */ /** * We can't just use <BlockSelectionClearer> because the customizer has * many root nodes rather than just one in the post editor. * We need to listen to the focus events in all those roots, and also in * the preview iframe. * This hook will clear the selected block when focusing outside the editor, * with a few exceptions: * 1. Focusing on popovers. * 2. Focusing on the inspector. * 3. Focusing on any modals/dialogs. * These cases are normally triggered by user interactions from the editor, * not by explicitly focusing outside the editor, hence no need for clearing. * * @param {Object} sidebarControl The sidebar control instance. * @param {Object} popoverRef The ref object of the popover node container. */ function useClearSelectedBlock(sidebarControl, popoverRef) { const { hasSelectedBlock, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (popoverRef.current && sidebarControl) { const inspector = sidebarControl.inspector; const container = sidebarControl.container[0]; const ownerDocument = container.ownerDocument; const ownerWindow = ownerDocument.defaultView; function handleClearSelectedBlock(element) { if ( // 1. Make sure there are blocks being selected. (hasSelectedBlock() || hasMultiSelection()) && // 2. The element should exist in the DOM (not deleted). element && ownerDocument.contains(element) && // 3. It should also not exist in the container, the popover, nor the dialog. !container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') && // 4. The inspector should not be opened. !inspector.expanded()) { clearSelectedBlock(); } } // Handle mouse down in the same document. function handleMouseDown(event) { handleClearSelectedBlock(event.target); } // Handle focusing outside the current document, like to iframes. function handleBlur() { handleClearSelectedBlock(ownerDocument.activeElement); } ownerDocument.addEventListener('mousedown', handleMouseDown); ownerWindow.addEventListener('blur', handleBlur); return () => { ownerDocument.removeEventListener('mousedown', handleMouseDown); ownerWindow.removeEventListener('blur', handleBlur); }; } }, [popoverRef, sidebarControl, hasSelectedBlock, hasMultiSelection, clearSelectedBlock]); } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/customize-widgets/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function CustomizeWidgets({ api, sidebarControls, blockEditorSettings }) { const [activeSidebarControl, setActiveSidebarControl] = (0,external_wp_element_namespaceObject.useState)(null); const parentContainer = document.getElementById('customize-theme-controls'); const popoverRef = (0,external_wp_element_namespaceObject.useRef)(); useClearSelectedBlock(activeSidebarControl, popoverRef); (0,external_wp_element_namespaceObject.useEffect)(() => { const unsubscribers = sidebarControls.map(sidebarControl => sidebarControl.subscribe(expanded => { if (expanded) { setActiveSidebarControl(sidebarControl); } })); return () => { unsubscribers.forEach(unsubscriber => unsubscriber()); }; }, [sidebarControls]); const activeSidebar = activeSidebarControl && (0,external_wp_element_namespaceObject.createPortal)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ErrorBoundary, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarBlockEditor, { blockEditorSettings: blockEditorSettings, sidebar: activeSidebarControl.sidebarAdapter, inserter: activeSidebarControl.inserter, inspector: activeSidebarControl.inspector }, activeSidebarControl.id) }), activeSidebarControl.container[0]); // We have to portal this to the parent of both the editor and the inspector, // so that the popovers will appear above both of them. const popover = parentContainer && (0,external_wp_element_namespaceObject.createPortal)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "customize-widgets-popover", ref: popoverRef, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, {}) }), parentContainer); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarControls, { sidebarControls: sidebarControls, activeSidebarControl: activeSidebarControl, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(FocusControl, { api: api, sidebarControls: sidebarControls, children: [activeSidebar, popover] }) }) }); } ;// ./node_modules/@wordpress/customize-widgets/build-module/controls/inspector-section.js function getInspectorSection() { const { wp: { customize } } = window; return class InspectorSection extends customize.Section { constructor(id, options) { super(id, options); this.parentSection = options.parentSection; this.returnFocusWhenClose = null; this._isOpen = false; } get isOpen() { return this._isOpen; } set isOpen(value) { this._isOpen = value; this.triggerActiveCallbacks(); } ready() { this.contentContainer[0].classList.add('customize-widgets-layout__inspector'); } isContextuallyActive() { return this.isOpen; } onChangeExpanded(expanded, args) { super.onChangeExpanded(expanded, args); if (this.parentSection && !args.unchanged) { if (expanded) { this.parentSection.collapse({ manualTransition: true }); } else { this.parentSection.expand({ manualTransition: true, completeCallback: () => { // Return focus after finishing the transition. if (this.returnFocusWhenClose && !this.contentContainer[0].contains(this.returnFocusWhenClose)) { this.returnFocusWhenClose.focus(); } } }); } } } open({ returnFocusWhenClose } = {}) { this.isOpen = true; this.returnFocusWhenClose = returnFocusWhenClose; this.expand({ allowMultiple: true }); } close() { this.collapse({ allowMultiple: true }); } collapse(options) { // Overridden collapse() function. Mostly call the parent collapse(), but also // move our .isOpen to false. // Initially, I tried tracking this with onChangeExpanded(), but it doesn't work // because the block settings sidebar is a layer "on top of" the G editor sidebar. // // For example, when closing the block settings sidebar, the G // editor sidebar would display, and onChangeExpanded in // inspector-section would run with expanded=true, but I want // isOpen to be false when the block settings is closed. this.isOpen = false; super.collapse(options); } triggerActiveCallbacks() { // Manually fire the callbacks associated with moving this.active // from false to true. "active" is always true for this section, // and "isContextuallyActive" reflects if the block settings // sidebar is currently visible, that is, it has replaced the main // Gutenberg view. // The WP customizer only checks ".isContextuallyActive()" when // ".active" changes values. But our ".active" never changes value. // The WP customizer never foresaw a section being used a way we // fit the block settings sidebar into a section. By manually // triggering the "this.active" callbacks, we force the WP // customizer to query our .isContextuallyActive() function and // update its view of our status. this.active.callbacks.fireWith(this.active, [false, true]); } }; } ;// ./node_modules/@wordpress/customize-widgets/build-module/controls/sidebar-section.js /** * WordPress dependencies */ /** * Internal dependencies */ const getInspectorSectionId = sidebarId => `widgets-inspector-${sidebarId}`; function getSidebarSection() { const { wp: { customize } } = window; const reduceMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)'); let isReducedMotion = reduceMotionMediaQuery.matches; reduceMotionMediaQuery.addEventListener('change', event => { isReducedMotion = event.matches; }); return class SidebarSection extends customize.Section { ready() { const InspectorSection = getInspectorSection(); this.inspector = new InspectorSection(getInspectorSectionId(this.id), { title: (0,external_wp_i18n_namespaceObject.__)('Block Settings'), parentSection: this, customizeAction: [(0,external_wp_i18n_namespaceObject.__)('Customizing'), (0,external_wp_i18n_namespaceObject.__)('Widgets'), this.params.title].join(' ▸ ') }); customize.section.add(this.inspector); this.contentContainer[0].classList.add('customize-widgets__sidebar-section'); } hasSubSectionOpened() { return this.inspector.expanded(); } onChangeExpanded(expanded, _args) { const controls = this.controls(); const args = { ..._args, completeCallback() { controls.forEach(control => { control.onChangeSectionExpanded?.(expanded, args); }); _args.completeCallback?.(); } }; if (args.manualTransition) { if (expanded) { this.contentContainer.addClass(['busy', 'open']); this.contentContainer.removeClass('is-sub-section-open'); this.contentContainer.closest('.wp-full-overlay').addClass('section-open'); } else { this.contentContainer.addClass(['busy', 'is-sub-section-open']); this.contentContainer.closest('.wp-full-overlay').addClass('section-open'); this.contentContainer.removeClass('open'); } const handleTransitionEnd = () => { this.contentContainer.removeClass('busy'); args.completeCallback(); }; if (isReducedMotion) { handleTransitionEnd(); } else { this.contentContainer.one('transitionend', handleTransitionEnd); } } else { super.onChangeExpanded(expanded, args); } } }; } ;// ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/sidebar-adapter.js /** * Internal dependencies */ const { wp } = window; function parseWidgetId(widgetId) { const matches = widgetId.match(/^(.+)-(\d+)$/); if (matches) { return { idBase: matches[1], number: parseInt(matches[2], 10) }; } // Likely an old single widget. return { idBase: widgetId }; } function widgetIdToSettingId(widgetId) { const { idBase, number } = parseWidgetId(widgetId); if (number) { return `widget_${idBase}[${number}]`; } return `widget_${idBase}`; } /** * This is a custom debounce function to call different callbacks depending on * whether it's the _leading_ call or not. * * @param {Function} leading The callback that gets called first. * @param {Function} callback The callback that gets called after the first time. * @param {number} timeout The debounced time in milliseconds. * @return {Function} The debounced function. */ function debounce(leading, callback, timeout) { let isLeading = false; let timerID; function debounced(...args) { const result = (isLeading ? callback : leading).apply(this, args); isLeading = true; clearTimeout(timerID); timerID = setTimeout(() => { isLeading = false; }, timeout); return result; } debounced.cancel = () => { isLeading = false; clearTimeout(timerID); }; return debounced; } class SidebarAdapter { constructor(setting, api) { this.setting = setting; this.api = api; this.locked = false; this.widgetsCache = new WeakMap(); this.subscribers = new Set(); this.history = [this._getWidgetIds().map(widgetId => this.getWidget(widgetId))]; this.historyIndex = 0; this.historySubscribers = new Set(); // Debounce the input for 1 second. this._debounceSetHistory = debounce(this._pushHistory, this._replaceHistory, 1000); this.setting.bind(this._handleSettingChange.bind(this)); this.api.bind('change', this._handleAllSettingsChange.bind(this)); this.undo = this.undo.bind(this); this.redo = this.redo.bind(this); this.save = this.save.bind(this); } subscribe(callback) { this.subscribers.add(callback); return () => { this.subscribers.delete(callback); }; } getWidgets() { return this.history[this.historyIndex]; } _emit(...args) { for (const callback of this.subscribers) { callback(...args); } } _getWidgetIds() { return this.setting.get(); } _pushHistory() { this.history = [...this.history.slice(0, this.historyIndex + 1), this._getWidgetIds().map(widgetId => this.getWidget(widgetId))]; this.historyIndex += 1; this.historySubscribers.forEach(listener => listener()); } _replaceHistory() { this.history[this.historyIndex] = this._getWidgetIds().map(widgetId => this.getWidget(widgetId)); } _handleSettingChange() { if (this.locked) { return; } const prevWidgets = this.getWidgets(); this._pushHistory(); this._emit(prevWidgets, this.getWidgets()); } _handleAllSettingsChange(setting) { if (this.locked) { return; } if (!setting.id.startsWith('widget_')) { return; } const widgetId = settingIdToWidgetId(setting.id); if (!this.setting.get().includes(widgetId)) { return; } const prevWidgets = this.getWidgets(); this._pushHistory(); this._emit(prevWidgets, this.getWidgets()); } _createWidget(widget) { const widgetModel = wp.customize.Widgets.availableWidgets.findWhere({ id_base: widget.idBase }); let number = widget.number; if (widgetModel.get('is_multi') && !number) { widgetModel.set('multi_number', widgetModel.get('multi_number') + 1); number = widgetModel.get('multi_number'); } const settingId = number ? `widget_${widget.idBase}[${number}]` : `widget_${widget.idBase}`; const settingArgs = { transport: wp.customize.Widgets.data.selectiveRefreshableWidgets[widgetModel.get('id_base')] ? 'postMessage' : 'refresh', previewer: this.setting.previewer }; const setting = this.api.create(settingId, settingId, '', settingArgs); setting.set(widget.instance); const widgetId = settingIdToWidgetId(settingId); return widgetId; } _removeWidget(widget) { const settingId = widgetIdToSettingId(widget.id); const setting = this.api(settingId); if (setting) { const instance = setting.get(); this.widgetsCache.delete(instance); } this.api.remove(settingId); } _updateWidget(widget) { const prevWidget = this.getWidget(widget.id); // Bail out update if nothing changed. if (prevWidget === widget) { return widget.id; } // Update existing setting if only the widget's instance changed. if (prevWidget.idBase && widget.idBase && prevWidget.idBase === widget.idBase) { const settingId = widgetIdToSettingId(widget.id); this.api(settingId).set(widget.instance); return widget.id; } // Otherwise delete and re-create. this._removeWidget(widget); return this._createWidget(widget); } getWidget(widgetId) { if (!widgetId) { return null; } const { idBase, number } = parseWidgetId(widgetId); const settingId = widgetIdToSettingId(widgetId); const setting = this.api(settingId); if (!setting) { return null; } const instance = setting.get(); if (this.widgetsCache.has(instance)) { return this.widgetsCache.get(instance); } const widget = { id: widgetId, idBase, number, instance }; this.widgetsCache.set(instance, widget); return widget; } _updateWidgets(nextWidgets) { this.locked = true; const addedWidgetIds = []; const nextWidgetIds = nextWidgets.map(nextWidget => { if (nextWidget.id && this.getWidget(nextWidget.id)) { addedWidgetIds.push(null); return this._updateWidget(nextWidget); } const widgetId = this._createWidget(nextWidget); addedWidgetIds.push(widgetId); return widgetId; }); const deletedWidgets = this.getWidgets().filter(widget => !nextWidgetIds.includes(widget.id)); deletedWidgets.forEach(widget => this._removeWidget(widget)); this.setting.set(nextWidgetIds); this.locked = false; return addedWidgetIds; } setWidgets(nextWidgets) { const addedWidgetIds = this._updateWidgets(nextWidgets); this._debounceSetHistory(); return addedWidgetIds; } /** * Undo/Redo related features */ hasUndo() { return this.historyIndex > 0; } hasRedo() { return this.historyIndex < this.history.length - 1; } _seek(historyIndex) { const currentWidgets = this.getWidgets(); this.historyIndex = historyIndex; const widgets = this.history[this.historyIndex]; this._updateWidgets(widgets); this._emit(currentWidgets, this.getWidgets()); this.historySubscribers.forEach(listener => listener()); this._debounceSetHistory.cancel(); } undo() { if (!this.hasUndo()) { return; } this._seek(this.historyIndex - 1); } redo() { if (!this.hasRedo()) { return; } this._seek(this.historyIndex + 1); } subscribeHistory(listener) { this.historySubscribers.add(listener); return () => { this.historySubscribers.delete(listener); }; } save() { this.api.previewer.save(); } } ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/customize-widgets/build-module/controls/inserter-outer-section.js /** * WordPress dependencies */ /** * Internal dependencies */ function getInserterOuterSection() { const { wp: { customize } } = window; const OuterSection = customize.OuterSection; // Override the OuterSection class to handle multiple outer sections. // It closes all the other outer sections whenever one is opened. // The result is that at most one outer section can be opened at the same time. customize.OuterSection = class extends OuterSection { onChangeExpanded(expanded, args) { if (expanded) { customize.section.each(section => { if (section.params.type === 'outer' && section.id !== this.id) { if (section.expanded()) { section.collapse(); } } }); } return super.onChangeExpanded(expanded, args); } }; // Handle constructor so that "params.type" can be correctly pointed to "outer". customize.sectionConstructor.outer = customize.OuterSection; return class InserterOuterSection extends customize.OuterSection { constructor(...args) { super(...args); // This is necessary since we're creating a new class which is not identical to the original OuterSection. // @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436 this.params.type = 'outer'; this.activeElementBeforeExpanded = null; const ownerWindow = this.contentContainer[0].ownerDocument.defaultView; // Handle closing the inserter when pressing the Escape key. ownerWindow.addEventListener('keydown', event => { if (this.expanded() && (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE || event.code === 'Escape') && !event.defaultPrevented) { event.preventDefault(); event.stopPropagation(); (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(false); } }, // Use capture mode to make this run before other event listeners. true); this.contentContainer.addClass('widgets-inserter'); // Set a flag if the state is being changed from open() or close(). // Don't propagate the event if it's an internal action to prevent infinite loop. this.isFromInternalAction = false; this.expanded.bind(() => { if (!this.isFromInternalAction) { // Propagate the event to React to sync the state. (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(this.expanded()); } this.isFromInternalAction = false; }); } open() { if (!this.expanded()) { const contentContainer = this.contentContainer[0]; this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement; this.isFromInternalAction = true; this.expand({ completeCallback() { // We have to do this in a "completeCallback" or else the elements will not yet be visible/tabbable. // The first one should be the close button, // we want to skip it and choose the second one instead, which is the search box. const searchBox = external_wp_dom_namespaceObject.focus.tabbable.find(contentContainer)[1]; if (searchBox) { searchBox.focus(); } } }); } } close() { if (this.expanded()) { const contentContainer = this.contentContainer[0]; const activeElement = contentContainer.ownerDocument.activeElement; this.isFromInternalAction = true; this.collapse({ completeCallback() { // Return back the focus when closing the inserter. // Only do this if the active element which triggers the action is inside the inserter, // (the close button for instance). In that case the focus will be lost. // Otherwise, we don't hijack the focus when the user is focusing on other elements // (like the quick inserter). if (contentContainer.contains(activeElement)) { // Return back the focus when closing the inserter. if (this.activeElementBeforeExpanded) { this.activeElementBeforeExpanded.focus(); } } } }); } } }; } ;// ./node_modules/@wordpress/customize-widgets/build-module/controls/sidebar-control.js /** * WordPress dependencies */ /** * Internal dependencies */ const getInserterId = controlId => `widgets-inserter-${controlId}`; function getSidebarControl() { const { wp: { customize } } = window; return class SidebarControl extends customize.Control { constructor(...args) { super(...args); this.subscribers = new Set(); } ready() { const InserterOuterSection = getInserterOuterSection(); this.inserter = new InserterOuterSection(getInserterId(this.id), {}); customize.section.add(this.inserter); this.sectionInstance = customize.section(this.section()); this.inspector = this.sectionInstance.inspector; this.sidebarAdapter = new SidebarAdapter(this.setting, customize); } subscribe(callback) { this.subscribers.add(callback); return () => { this.subscribers.delete(callback); }; } onChangeSectionExpanded(expanded, args) { if (!args.unchanged) { // Close the inserter when the section collapses. if (!expanded) { (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(false); } this.subscribers.forEach(subscriber => subscriber(expanded, args)); } } }; } ;// ./node_modules/@wordpress/customize-widgets/build-module/filters/move-to-sidebar.js /** * WordPress dependencies */ /** * Internal dependencies */ const withMoveToSidebarToolbarItem = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { let widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(props); const sidebarControls = useSidebarControls(); const activeSidebarControl = useActiveSidebarControl(); const hasMultipleSidebars = sidebarControls?.length > 1; const blockName = props.name; const clientId = props.clientId; const canInsertBlockInSidebar = (0,external_wp_data_namespaceObject.useSelect)(select => { // Use an empty string to represent the root block list, which // in the customizer editor represents a sidebar/widget area. return select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType(blockName, ''); }, [blockName]); const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId), [clientId]); const { removeBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const [, focusWidget] = useFocusControl(); function moveToSidebar(sidebarControlId) { const newSidebarControl = sidebarControls.find(sidebarControl => sidebarControl.id === sidebarControlId); if (widgetId) { /** * If there's a widgetId, move it to the other sidebar. */ const oldSetting = activeSidebarControl.setting; const newSetting = newSidebarControl.setting; oldSetting(oldSetting().filter(id => id !== widgetId)); newSetting([...newSetting(), widgetId]); } else { /** * If there isn't a widgetId, it's most likely a inner block. * First, remove the block in the original sidebar, * then, create a new widget in the new sidebar and get back its widgetId. */ const sidebarAdapter = newSidebarControl.sidebarAdapter; removeBlock(clientId); const addedWidgetIds = sidebarAdapter.setWidgets([...sidebarAdapter.getWidgets(), blockToWidget(block)]); // The last non-null id is the added widget's id. widgetId = addedWidgetIds.reverse().find(id => !!id); } // Move focus to the moved widget and expand the sidebar. focusWidget(widgetId); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), hasMultipleSidebars && canInsertBlockInSidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_widgets_namespaceObject.MoveToWidgetArea, { widgetAreas: sidebarControls.map(sidebarControl => ({ id: sidebarControl.id, name: sidebarControl.params.label, description: sidebarControl.params.description })), currentWidgetAreaId: activeSidebarControl?.id, onSelect: moveToSidebar }) })] }); }, 'withMoveToSidebarToolbarItem'); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/customize-widgets/block-edit', withMoveToSidebarToolbarItem); ;// ./node_modules/@wordpress/customize-widgets/build-module/filters/replace-media-upload.js /** * WordPress dependencies */ const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload; (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload); ;// ./node_modules/@wordpress/customize-widgets/build-module/filters/wide-widget-display.js /** * WordPress dependencies */ const { wp: wide_widget_display_wp } = window; const withWideWidgetDisplay = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { var _wp$customize$Widgets; const { idBase } = props.attributes; const isWide = (_wp$customize$Widgets = wide_widget_display_wp.customize.Widgets.data.availableWidgets.find(widget => widget.id_base === idBase)?.is_wide) !== null && _wp$customize$Widgets !== void 0 ? _wp$customize$Widgets : false; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props, isWide: isWide }, "edit"); }, 'withWideWidgetDisplay'); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/customize-widgets/wide-widget-display', withWideWidgetDisplay); ;// ./node_modules/@wordpress/customize-widgets/build-module/filters/index.js /** * Internal dependencies */ ;// ./node_modules/@wordpress/customize-widgets/build-module/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { wp: build_module_wp } = window; const DISABLED_BLOCKS = ['core/more', 'core/block', 'core/freeform', 'core/template-part']; const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false; /** * Initializes the widgets block editor in the customizer. * * @param {string} editorName The editor name. * @param {Object} blockEditorSettings Block editor settings. */ function initialize(editorName, blockEditorSettings) { (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/customize-widgets', { fixedToolbar: false, welcomeGuide: true }); (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(block => { return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation')); }); (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)(); if (false) {} (0,external_wp_widgets_namespaceObject.registerLegacyWidgetVariations)(blockEditorSettings); (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)(); // As we are unregistering `core/freeform` to avoid the Classic block, we must // replace it with something as the default freeform content handler. Failure to // do this will result in errors in the default block parser. // see: https://github.com/WordPress/gutenberg/issues/33097 (0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)('core/html'); const SidebarControl = getSidebarControl(blockEditorSettings); build_module_wp.customize.sectionConstructor.sidebar = getSidebarSection(); build_module_wp.customize.controlConstructor.sidebar_block_editor = SidebarControl; const container = document.createElement('div'); document.body.appendChild(container); build_module_wp.customize.bind('ready', () => { const sidebarControls = []; build_module_wp.customize.control.each(control => { if (control instanceof SidebarControl) { sidebarControls.push(control); } }); (0,external_wp_element_namespaceObject.createRoot)(container).render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomizeWidgets, { api: build_module_wp.customize, sidebarControls: sidebarControls, blockEditorSettings: blockEditorSettings }) })); }); } (window.wp = window.wp || {}).customizeWidgets = __webpack_exports__; /******/ })() ; dist/widgets.js 0000644 00000150751 15125140777 0007535 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { MoveToWidgetArea: () => (/* reexport */ MoveToWidgetArea), addWidgetIdToBlock: () => (/* reexport */ addWidgetIdToBlock), getWidgetIdFromBlock: () => (/* reexport */ getWidgetIdFromBlock), registerLegacyWidgetBlock: () => (/* binding */ registerLegacyWidgetBlock), registerLegacyWidgetVariations: () => (/* reexport */ registerLegacyWidgetVariations), registerWidgetGroupBlock: () => (/* binding */ registerWidgetGroupBlock) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/index.js var legacy_widget_namespaceObject = {}; __webpack_require__.r(legacy_widget_namespaceObject); __webpack_require__.d(legacy_widget_namespaceObject, { yu: () => (metadata), UU: () => (legacy_widget_name), W0: () => (settings) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/index.js var widget_group_namespaceObject = {}; __webpack_require__.r(widget_group_namespaceObject); __webpack_require__.d(widget_group_namespaceObject, { yu: () => (widget_group_metadata), UU: () => (widget_group_name), W0: () => (widget_group_settings) }); ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/icons/build-module/library/widget.js /** * WordPress dependencies */ const widget = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z" }) }); /* harmony default export */ const library_widget = (widget); ;// ./node_modules/clsx/dist/clsx.mjs function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// ./node_modules/@wordpress/icons/build-module/library/brush.js /** * WordPress dependencies */ const brush = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z" }) }); /* harmony default export */ const library_brush = (brush); ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/widget-type-selector.js /** * WordPress dependencies */ function WidgetTypeSelector({ selectedId, onSelect }) { const widgetTypes = (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getSettings$w; const hiddenIds = (_select$getSettings$w = select(external_wp_blockEditor_namespaceObject.store).getSettings()?.widgetTypesToHideFromLegacyWidgetBlock) !== null && _select$getSettings$w !== void 0 ? _select$getSettings$w : []; return select(external_wp_coreData_namespaceObject.store).getWidgetTypes({ per_page: -1 })?.filter(widgetType => !hiddenIds.includes(widgetType.id)); }, []); if (!widgetTypes) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); } if (widgetTypes.length === 0) { return (0,external_wp_i18n_namespaceObject.__)('There are no widgets available.'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Legacy widget'), value: selectedId !== null && selectedId !== void 0 ? selectedId : '', options: [{ value: '', label: (0,external_wp_i18n_namespaceObject.__)('Select widget') }, ...widgetTypes.map(widgetType => ({ value: widgetType.id, label: widgetType.name }))], onChange: value => { if (value) { const selected = widgetTypes.find(widgetType => widgetType.id === value); onSelect({ selectedId: selected.id, isMulti: selected.is_multi }); } else { onSelect({ selectedId: null }); } } }); } ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/inspector-card.js function InspectorCard({ name, description }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "wp-block-legacy-widget-inspector-card", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "wp-block-legacy-widget-inspector-card__name", children: name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: description })] }); } ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/control.js /* wp:polyfill */ /** * WordPress dependencies */ /** * An API for creating and loading a widget control (a <div class="widget"> * element) that is compatible with most third party widget scripts. By not * using React for this, we ensure that we have complete control over the DOM * and do not accidentally remove any elements that a third party widget script * has attached an event listener to. * * @property {Element} element The control's DOM element. */ class Control { /** * Creates and loads a new control. * * @access public * @param {Object} params * @param {string} params.id * @param {string} params.idBase * @param {Object} params.instance * @param {Function} params.onChangeInstance * @param {Function} params.onChangeHasPreview * @param {Function} params.onError */ constructor({ id, idBase, instance, onChangeInstance, onChangeHasPreview, onError }) { this.id = id; this.idBase = idBase; this._instance = instance; this._hasPreview = null; this.onChangeInstance = onChangeInstance; this.onChangeHasPreview = onChangeHasPreview; this.onError = onError; // We can't use the real widget number as this is calculated by the // server and we may not ever *actually* save this widget. Instead, use // a fake but unique number. this.number = ++lastNumber; this.handleFormChange = (0,external_wp_compose_namespaceObject.debounce)(this.handleFormChange.bind(this), 200); this.handleFormSubmit = this.handleFormSubmit.bind(this); this.initDOM(); this.bindEvents(); this.loadContent(); } /** * Clean up the control so that it can be garbage collected. * * @access public */ destroy() { this.unbindEvents(); this.element.remove(); // TODO: How do we make third party widget scripts remove their event // listeners? } /** * Creates the control's DOM structure. * * @access private */ initDOM() { var _this$id, _this$idBase; this.element = el('div', { class: 'widget open' }, [el('div', { class: 'widget-inside' }, [this.form = el('form', { class: 'form', method: 'post' }, [ // These hidden form inputs are what most widgets' scripts // use to access data about the widget. el('input', { class: 'widget-id', type: 'hidden', name: 'widget-id', value: (_this$id = this.id) !== null && _this$id !== void 0 ? _this$id : `${this.idBase}-${this.number}` }), el('input', { class: 'id_base', type: 'hidden', name: 'id_base', value: (_this$idBase = this.idBase) !== null && _this$idBase !== void 0 ? _this$idBase : this.id }), el('input', { class: 'widget-width', type: 'hidden', name: 'widget-width', value: '250' }), el('input', { class: 'widget-height', type: 'hidden', name: 'widget-height', value: '200' }), el('input', { class: 'widget_number', type: 'hidden', name: 'widget_number', value: this.idBase ? this.number.toString() : '' }), this.content = el('div', { class: 'widget-content' }), // Non-multi widgets can be saved via a Save button. this.id && el('button', { class: 'button is-primary', type: 'submit' }, (0,external_wp_i18n_namespaceObject.__)('Save'))])])]); } /** * Adds the control's event listeners. * * @access private */ bindEvents() { // Prefer jQuery 'change' event instead of the native 'change' event // because many widgets use jQuery's event bus to trigger an update. if (window.jQuery) { const { jQuery: $ } = window; $(this.form).on('change', null, this.handleFormChange); $(this.form).on('input', null, this.handleFormChange); $(this.form).on('submit', this.handleFormSubmit); } else { this.form.addEventListener('change', this.handleFormChange); this.form.addEventListener('input', this.handleFormChange); this.form.addEventListener('submit', this.handleFormSubmit); } } /** * Removes the control's event listeners. * * @access private */ unbindEvents() { if (window.jQuery) { const { jQuery: $ } = window; $(this.form).off('change', null, this.handleFormChange); $(this.form).off('input', null, this.handleFormChange); $(this.form).off('submit', this.handleFormSubmit); } else { this.form.removeEventListener('change', this.handleFormChange); this.form.removeEventListener('input', this.handleFormChange); this.form.removeEventListener('submit', this.handleFormSubmit); } } /** * Fetches the widget's form HTML from the REST API and loads it into the * control's form. * * @access private */ async loadContent() { try { if (this.id) { const { form } = await saveWidget(this.id); this.content.innerHTML = form; } else if (this.idBase) { const { form, preview } = await encodeWidget({ idBase: this.idBase, instance: this.instance, number: this.number }); this.content.innerHTML = form; this.hasPreview = !isEmptyHTML(preview); // If we don't have an instance, perform a save right away. This // happens when creating a new Legacy Widget block. if (!this.instance.hash) { const { instance } = await encodeWidget({ idBase: this.idBase, instance: this.instance, number: this.number, formData: serializeForm(this.form) }); this.instance = instance; } } // Trigger 'widget-added' when widget is ready. This event is what // widgets' scripts use to initialize, attach events, etc. The event // must be fired using jQuery's event bus as this is what widget // scripts expect. If jQuery is not loaded, do nothing - some // widgets will still work regardless. if (window.jQuery) { const { jQuery: $ } = window; $(document).trigger('widget-added', [$(this.element)]); } } catch (error) { this.onError(error); } } /** * Perform a save when a multi widget's form is changed. Non-multi widgets * are saved manually. * * @access private */ handleFormChange() { if (this.idBase) { this.saveForm(); } } /** * Perform a save when the control's form is manually submitted. * * @access private * @param {Event} event */ handleFormSubmit(event) { event.preventDefault(); this.saveForm(); } /** * Serialize the control's form, send it to the REST API, and update the * instance with the encoded instance that the REST API returns. * * @access private */ async saveForm() { const formData = serializeForm(this.form); try { if (this.id) { const { form } = await saveWidget(this.id, formData); this.content.innerHTML = form; if (window.jQuery) { const { jQuery: $ } = window; $(document).trigger('widget-updated', [$(this.element)]); } } else if (this.idBase) { const { instance, preview } = await encodeWidget({ idBase: this.idBase, instance: this.instance, number: this.number, formData }); this.instance = instance; this.hasPreview = !isEmptyHTML(preview); } } catch (error) { this.onError(error); } } /** * The widget's instance object. * * @access private */ get instance() { return this._instance; } /** * The widget's instance object. * * @access private */ set instance(instance) { if (this._instance !== instance) { this._instance = instance; this.onChangeInstance(instance); } } /** * Whether or not the widget can be previewed. * * @access public */ get hasPreview() { return this._hasPreview; } /** * Whether or not the widget can be previewed. * * @access private */ set hasPreview(hasPreview) { if (this._hasPreview !== hasPreview) { this._hasPreview = hasPreview; this.onChangeHasPreview(hasPreview); } } } let lastNumber = 0; function el(tagName, attributes = {}, content = null) { const element = document.createElement(tagName); for (const [attribute, value] of Object.entries(attributes)) { element.setAttribute(attribute, value); } if (Array.isArray(content)) { for (const child of content) { if (child) { element.appendChild(child); } } } else if (typeof content === 'string') { element.innerText = content; } return element; } async function saveWidget(id, formData = null) { let widget; if (formData) { widget = await external_wp_apiFetch_default()({ path: `/wp/v2/widgets/${id}?context=edit`, method: 'PUT', data: { form_data: formData } }); } else { widget = await external_wp_apiFetch_default()({ path: `/wp/v2/widgets/${id}?context=edit`, method: 'GET' }); } return { form: widget.rendered_form }; } async function encodeWidget({ idBase, instance, number, formData = null }) { const response = await external_wp_apiFetch_default()({ path: `/wp/v2/widget-types/${idBase}/encode`, method: 'POST', data: { instance, number, form_data: formData } }); return { instance: response.instance, form: response.form, preview: response.preview }; } function isEmptyHTML(html) { const element = document.createElement('div'); element.innerHTML = html; return isEmptyNode(element); } function isEmptyNode(node) { switch (node.nodeType) { case node.TEXT_NODE: // Text nodes are empty if it's entirely whitespace. return node.nodeValue.trim() === ''; case node.ELEMENT_NODE: // Elements that are "embedded content" are not empty. // https://dev.w3.org/html5/spec-LC/content-models.html#embedded-content-0 if (['AUDIO', 'CANVAS', 'EMBED', 'IFRAME', 'IMG', 'MATH', 'OBJECT', 'SVG', 'VIDEO'].includes(node.tagName)) { return false; } // Elements with no children are empty. if (!node.hasChildNodes()) { return true; } // Elements with children are empty if all their children are empty. return Array.from(node.childNodes).every(isEmptyNode); default: return true; } } function serializeForm(form) { return new window.URLSearchParams(Array.from(new window.FormData(form))).toString(); } ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/form.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function Form({ title, isVisible, id, idBase, instance, isWide, onChangeInstance, onChangeHasPreview }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const isMediumLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); // We only want to remount the control when the instance changes // *externally*. For example, if the user performs an undo. To do this, we // keep track of changes made to instance by the control itself and then // ignore those. const outgoingInstances = (0,external_wp_element_namespaceObject.useRef)(new Set()); const incomingInstances = (0,external_wp_element_namespaceObject.useRef)(new Set()); const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (incomingInstances.current.has(instance)) { incomingInstances.current.delete(instance); return; } const control = new Control({ id, idBase, instance, onChangeInstance(nextInstance) { outgoingInstances.current.add(instance); incomingInstances.current.add(nextInstance); onChangeInstance(nextInstance); }, onChangeHasPreview, onError(error) { window.console.error(error); createNotice('error', (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: the name of the affected block. */ (0,external_wp_i18n_namespaceObject.__)('The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'), idBase || id)); } }); ref.current.appendChild(control.element); return () => { if (outgoingInstances.current.has(instance)) { outgoingInstances.current.delete(instance); return; } control.destroy(); }; }, [id, idBase, instance, onChangeInstance, onChangeHasPreview, isMediumLargeViewport]); if (isWide && isMediumLargeViewport) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx({ 'wp-block-legacy-widget__container': isVisible }), children: [isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "wp-block-legacy-widget__edit-form-title", children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { focusOnMount: false, placement: "right", offset: 32, resize: false, flip: false, shift: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, className: "wp-block-legacy-widget__edit-form", hidden: !isVisible }) })] }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, className: "wp-block-legacy-widget__edit-form", hidden: !isVisible, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "wp-block-legacy-widget__edit-form-title", children: title }) }); } ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/preview.js /** * External dependencies */ /** * WordPress dependencies */ function Preview({ idBase, instance, isVisible }) { const [isLoaded, setIsLoaded] = (0,external_wp_element_namespaceObject.useState)(false); const [srcDoc, setSrcDoc] = (0,external_wp_element_namespaceObject.useState)(''); (0,external_wp_element_namespaceObject.useEffect)(() => { const abortController = typeof window.AbortController === 'undefined' ? undefined : new window.AbortController(); async function fetchPreviewHTML() { const restRoute = `/wp/v2/widget-types/${idBase}/render`; return await external_wp_apiFetch_default()({ path: restRoute, method: 'POST', signal: abortController?.signal, data: instance ? { instance } : {} }); } fetchPreviewHTML().then(response => { setSrcDoc(response.preview); }).catch(error => { if ('AbortError' === error.name) { // We don't want to log aborted requests. return; } throw error; }); return () => abortController?.abort(); }, [idBase, instance]); // Resize the iframe on either the load event, or when the iframe becomes visible. const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(iframe => { // Only set height if the iframe is loaded, // or it will grow to an unexpected large height in Safari if it's hidden initially. if (!isLoaded) { return; } // If the preview frame has another origin then this won't work. // One possible solution is to add custom script to call `postMessage` in the preview frame. // Or, better yet, we migrate away from iframe. function setHeight() { var _iframe$contentDocume, _iframe$contentDocume2; // Pick the maximum of these two values to account for margin collapsing. const height = Math.max((_iframe$contentDocume = iframe.contentDocument.documentElement?.offsetHeight) !== null && _iframe$contentDocume !== void 0 ? _iframe$contentDocume : 0, (_iframe$contentDocume2 = iframe.contentDocument.body?.offsetHeight) !== null && _iframe$contentDocume2 !== void 0 ? _iframe$contentDocume2 : 0); // Fallback to a height of 100px if the height cannot be determined. // This ensures the block is still selectable. 100px should hopefully // be not so big that it's annoying, and not so small that nothing // can be seen. iframe.style.height = `${height !== 0 ? height : 100}px`; } const { IntersectionObserver } = iframe.ownerDocument.defaultView; // Observe for intersections that might cause a change in the height of // the iframe, e.g. a Widget Area becoming expanded. const intersectionObserver = new IntersectionObserver(([entry]) => { if (entry.isIntersecting) { setHeight(); } }, { threshold: 1 }); intersectionObserver.observe(iframe); iframe.addEventListener('load', setHeight); return () => { intersectionObserver.disconnect(); iframe.removeEventListener('load', setHeight); }; }, [isLoaded]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isVisible && !isLoaded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('wp-block-legacy-widget__edit-preview', { 'is-offscreen': !isVisible || !isLoaded }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { ref: ref, className: "wp-block-legacy-widget__edit-preview-iframe", tabIndex: "-1", title: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget Preview'), srcDoc: srcDoc, onLoad: event => { // To hide the scrollbars of the preview frame for some edge cases, // such as negative margins in the Gallery Legacy Widget. // It can't be scrolled anyway. // TODO: Ideally, this should be fixed in core. event.target.contentDocument.body.style.overflow = 'hidden'; setIsLoaded(true); }, height: 100 }) }) })] }); } ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/no-preview.js /** * WordPress dependencies */ function NoPreview({ name }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "wp-block-legacy-widget__edit-no-preview", children: [name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { children: name }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('No preview available.') })] }); } ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js /** * WordPress dependencies */ function ConvertToBlocksButton({ clientId, rawInstance }) { const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: () => { if (rawInstance.title) { replaceBlocks(clientId, [(0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { content: rawInstance.title }), ...(0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: rawInstance.text })]); } else { replaceBlocks(clientId, (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: rawInstance.text })); } }, children: (0,external_wp_i18n_namespaceObject.__)('Convert to blocks') }); } ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function Edit(props) { const { id, idBase } = props.attributes; const { isWide = false } = props; const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: dist_clsx({ 'is-wide-widget': isWide }) }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: !id && !idBase ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Empty, { ...props }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NotEmpty, { ...props }) }); } function Empty({ attributes: { id, idBase }, setAttributes }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: library_brush }), label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WidgetTypeSelector, { selectedId: id !== null && id !== void 0 ? id : idBase, onSelect: ({ selectedId, isMulti }) => { if (!selectedId) { setAttributes({ id: null, idBase: null, instance: null }); } else if (isMulti) { setAttributes({ id: null, idBase: selectedId, instance: {} }); } else { setAttributes({ id: selectedId, idBase: null, instance: null }); } } }) }) }) }); } function NotEmpty({ attributes: { id, idBase, instance }, setAttributes, clientId, isSelected, isWide = false }) { const [hasPreview, setHasPreview] = (0,external_wp_element_namespaceObject.useState)(null); const widgetTypeId = id !== null && id !== void 0 ? id : idBase; const { record: widgetType, hasResolved: hasResolvedWidgetType } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'widgetType', widgetTypeId); const setInstance = (0,external_wp_element_namespaceObject.useCallback)(nextInstance => { setAttributes({ instance: nextInstance }); }, []); if (!widgetType && hasResolvedWidgetType) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: library_brush }), label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget'), children: (0,external_wp_i18n_namespaceObject.__)('Widget is missing.') }); } if (!hasResolvedWidgetType) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }); } const mode = idBase && !isSelected ? 'preview' : 'edit'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [idBase === 'text' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "other", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToBlocksButton, { clientId: clientId, rawInstance: instance.raw }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorCard, { name: widgetType.name, description: widgetType.description }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Form, { title: widgetType.name, isVisible: mode === 'edit', id: id, idBase: idBase, instance: instance, isWide: isWide, onChangeInstance: setInstance, onChangeHasPreview: setHasPreview }), idBase && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [hasPreview === null && mode === 'preview' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }), hasPreview === true && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Preview, { idBase: idBase, instance: instance, isVisible: mode === 'preview' }), hasPreview === false && mode === 'preview' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NoPreview, { name: widgetType.name })] })] }); } ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/transforms.js /** * WordPress dependencies */ const legacyWidgetTransforms = [{ block: 'core/calendar', widget: 'calendar' }, { block: 'core/search', widget: 'search' }, { block: 'core/html', widget: 'custom_html', transform: ({ content }) => ({ content }) }, { block: 'core/archives', widget: 'archives', transform: ({ count, dropdown }) => { return { displayAsDropdown: !!dropdown, showPostCounts: !!count }; } }, { block: 'core/latest-posts', widget: 'recent-posts', transform: ({ show_date: displayPostDate, number }) => { return { displayPostDate: !!displayPostDate, postsToShow: number }; } }, { block: 'core/latest-comments', widget: 'recent-comments', transform: ({ number }) => { return { commentsToShow: number }; } }, { block: 'core/tag-cloud', widget: 'tag_cloud', transform: ({ taxonomy, count }) => { return { showTagCounts: !!count, taxonomy }; } }, { block: 'core/categories', widget: 'categories', transform: ({ count, dropdown, hierarchical }) => { return { displayAsDropdown: !!dropdown, showPostCounts: !!count, showHierarchy: !!hierarchical }; } }, { block: 'core/audio', widget: 'media_audio', transform: ({ url, preload, loop, attachment_id: id }) => { return { src: url, id, preload, loop }; } }, { block: 'core/video', widget: 'media_video', transform: ({ url, preload, loop, attachment_id: id }) => { return { src: url, id, preload, loop }; } }, { block: 'core/image', widget: 'media_image', transform: ({ alt, attachment_id: id, caption, height, link_classes: linkClass, link_rel: rel, link_target_blank: targetBlack, link_type: linkDestination, link_url: link, size: sizeSlug, url, width }) => { return { alt, caption, height, id, link, linkClass, linkDestination, linkTarget: targetBlack ? '_blank' : undefined, rel, sizeSlug, url, width }; } }, { block: 'core/gallery', widget: 'media_gallery', transform: ({ ids, link_type: linkTo, size, number }) => { return { ids, columns: number, linkTo, sizeSlug: size, images: ids.map(id => ({ id })) }; } }, { block: 'core/rss', widget: 'rss', transform: ({ url, show_author: displayAuthor, show_date: displayDate, show_summary: displayExcerpt, items }) => { return { feedURL: url, displayAuthor: !!displayAuthor, displayDate: !!displayDate, displayExcerpt: !!displayExcerpt, itemsToShow: items }; } }].map(({ block, widget, transform }) => { return { type: 'block', blocks: [block], isMatch: ({ idBase, instance }) => { return idBase === widget && !!instance?.raw; }, transform: ({ instance }) => { const transformedBlock = (0,external_wp_blocks_namespaceObject.createBlock)(block, transform ? transform(instance.raw) : undefined); if (!instance.raw?.title) { return transformedBlock; } return [(0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { content: instance.raw.title }), transformedBlock]; } }; }); const transforms = { to: legacyWidgetTransforms }; /* harmony default export */ const legacy_widget_transforms = (transforms); ;// ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/legacy-widget", title: "Legacy Widget", category: "widgets", description: "Display a legacy widget.", textdomain: "default", attributes: { id: { type: "string", "default": null }, idBase: { type: "string", "default": null }, instance: { type: "object", "default": null } }, supports: { html: false, customClassName: false, reusable: false }, editorStyle: "wp-block-legacy-widget-editor" }; const { name: legacy_widget_name } = metadata; const settings = { icon: library_widget, edit: Edit, transforms: legacy_widget_transforms }; ;// ./node_modules/@wordpress/icons/build-module/library/group.js /** * WordPress dependencies */ const group = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" }) }); /* harmony default export */ const library_group = (group); ;// ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/edit.js /** * WordPress dependencies */ function edit_Edit(props) { const { clientId } = props; const { innerBlocks } = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId), [clientId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: 'widget' }), children: innerBlocks.length === 0 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PlaceholderContent, { ...props }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewContent, { ...props }) }); } function PlaceholderContent({ clientId }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { className: "wp-block-widget-group__placeholder", icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: library_group }), label: (0,external_wp_i18n_namespaceObject.__)('Widget Group'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, { rootClientId: clientId }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks, { renderAppender: false })] }); } function PreviewContent({ attributes, setAttributes }) { var _attributes$title; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { tagName: "h2", identifier: "title", className: "widget-title", allowedFormats: [], placeholder: (0,external_wp_i18n_namespaceObject.__)('Title'), value: (_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : '', onChange: title => setAttributes({ title }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks, {})] }); } ;// ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/save.js /** * WordPress dependencies */ function save({ attributes }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "h2", className: "widget-title", value: attributes.title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-widget-group__inner-blocks", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) })] }); } ;// ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/deprecated.js /** * WordPress dependencies */ const v1 = { attributes: { title: { type: 'string' } }, supports: { html: false, inserter: true, customClassName: true, reusable: false }, save({ attributes }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "h2", className: "widget-title", value: attributes.title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {})] }); } }; /* harmony default export */ const deprecated = ([v1]); ;// ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const widget_group_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/widget-group", title: "Widget Group", category: "widgets", attributes: { title: { type: "string" } }, supports: { html: false, inserter: true, customClassName: true, reusable: false }, editorStyle: "wp-block-widget-group-editor", style: "wp-block-widget-group" }; const { name: widget_group_name } = widget_group_metadata; const widget_group_settings = { title: (0,external_wp_i18n_namespaceObject.__)('Widget Group'), description: (0,external_wp_i18n_namespaceObject.__)('Create a classic widget layout with a title that’s styled by your theme for your widget areas.'), icon: library_group, __experimentalLabel: ({ name: label }) => label, edit: edit_Edit, save: save, transforms: { from: [{ type: 'block', isMultiBlock: true, blocks: ['*'], isMatch(attributes, blocks) { // Avoid transforming existing `widget-group` blocks. return !blocks.some(block => block.name === 'core/widget-group'); }, __experimentalConvert(blocks) { // Put the selected blocks inside the new Widget Group's innerBlocks. let innerBlocks = [...blocks.map(block => { return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks); })]; // If the first block is a heading then assume this is intended // to be the Widget's "title". const firstHeadingBlock = innerBlocks[0].name === 'core/heading' ? innerBlocks[0] : null; // Remove the first heading block as we're copying // it's content into the Widget Group's title attribute. innerBlocks = innerBlocks.filter(block => block !== firstHeadingBlock); return (0,external_wp_blocks_namespaceObject.createBlock)('core/widget-group', { ...(firstHeadingBlock && { title: firstHeadingBlock.attributes.content }) }, innerBlocks); } }] }, deprecated: deprecated }; ;// ./node_modules/@wordpress/icons/build-module/library/move-to.js /** * WordPress dependencies */ const moveTo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z" }) }); /* harmony default export */ const move_to = (moveTo); ;// ./node_modules/@wordpress/widgets/build-module/components/move-to-widget-area/index.js /** * WordPress dependencies */ function MoveToWidgetArea({ currentWidgetAreaId, widgetAreas, onSelect }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: move_to, label: (0,external_wp_i18n_namespaceObject.__)('Move to widget area'), toggleProps: toggleProps, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Move to'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { choices: widgetAreas.map(widgetArea => ({ value: widgetArea.id, label: widgetArea.name, info: widgetArea.description })), value: currentWidgetAreaId, onSelect: value => { onSelect(value); onClose(); } }) }) }) }) }); } ;// ./node_modules/@wordpress/widgets/build-module/components/index.js ;// ./node_modules/@wordpress/widgets/build-module/utils.js // @ts-check /** * Get the internal widget id from block. * * @typedef {Object} Attributes * @property {string} __internalWidgetId The internal widget id. * @typedef {Object} Block * @property {Attributes} attributes The attributes of the block. * * @param {Block} block The block. * @return {string} The internal widget id. */ function getWidgetIdFromBlock(block) { return block.attributes.__internalWidgetId; } /** * Add internal widget id to block's attributes. * * @param {Block} block The block. * @param {string} widgetId The widget id. * @return {Block} The updated block. */ function addWidgetIdToBlock(block, widgetId) { return { ...block, attributes: { ...(block.attributes || {}), __internalWidgetId: widgetId } }; } ;// ./node_modules/@wordpress/widgets/build-module/register-legacy-widget-variations.js /** * WordPress dependencies */ function registerLegacyWidgetVariations(settings) { const unsubscribe = (0,external_wp_data_namespaceObject.subscribe)(() => { var _settings$widgetTypes; const hiddenIds = (_settings$widgetTypes = settings?.widgetTypesToHideFromLegacyWidgetBlock) !== null && _settings$widgetTypes !== void 0 ? _settings$widgetTypes : []; const widgetTypes = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getWidgetTypes({ per_page: -1 })?.filter(widgetType => !hiddenIds.includes(widgetType.id)); if (widgetTypes) { unsubscribe(); (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).addBlockVariations('core/legacy-widget', widgetTypes.map(widgetType => ({ name: widgetType.id, title: widgetType.name, description: widgetType.description, attributes: widgetType.is_multi ? { idBase: widgetType.id, instance: {} } : { id: widgetType.id } }))); } }); } ;// ./node_modules/@wordpress/widgets/build-module/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Registers the Legacy Widget block. * * Note that for the block to be useful, any scripts required by a widget must * be loaded into the page. * * @param {Object} supports Block support settings. * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/ */ function registerLegacyWidgetBlock(supports = {}) { const { /* metadata */ "yu": metadata, /* settings */ "W0": settings, /* name */ "UU": name } = legacy_widget_namespaceObject; (0,external_wp_blocks_namespaceObject.registerBlockType)({ name, ...metadata }, { ...settings, supports: { ...settings.supports, ...supports } }); } /** * Registers the Widget Group block. * * @param {Object} supports Block support settings. */ function registerWidgetGroupBlock(supports = {}) { const { /* metadata */ "yu": metadata, /* settings */ "W0": settings, /* name */ "UU": name } = widget_group_namespaceObject; (0,external_wp_blocks_namespaceObject.registerBlockType)({ name, ...metadata }, { ...settings, supports: { ...settings.supports, ...supports } }); } (window.wp = window.wp || {}).widgets = __webpack_exports__; /******/ })() ; dist/token-list.js 0000644 00000013641 15125140777 0010154 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ TokenList) /* harmony export */ }); /** * A set of tokens. * * @see https://dom.spec.whatwg.org/#domtokenlist */ class TokenList { /** * Constructs a new instance of TokenList. * * @param initialValue Initial value to assign. */ constructor(initialValue = '') { this._currentValue = ''; this._valueAsArray = []; this.value = initialValue; } entries(...args) { return this._valueAsArray.entries(...args); } forEach(...args) { return this._valueAsArray.forEach(...args); } keys(...args) { return this._valueAsArray.keys(...args); } values(...args) { return this._valueAsArray.values(...args); } /** * Returns the associated set as string. * * @see https://dom.spec.whatwg.org/#dom-domtokenlist-value * * @return Token set as string. */ get value() { return this._currentValue; } /** * Replaces the associated set with a new string value. * * @see https://dom.spec.whatwg.org/#dom-domtokenlist-value * * @param value New token set as string. */ set value(value) { value = String(value); this._valueAsArray = [...new Set(value.split(/\s+/g).filter(Boolean))]; this._currentValue = this._valueAsArray.join(' '); } /** * Returns the number of tokens. * * @see https://dom.spec.whatwg.org/#dom-domtokenlist-length * * @return Number of tokens. */ get length() { return this._valueAsArray.length; } /** * Returns the stringified form of the TokenList. * * @see https://dom.spec.whatwg.org/#DOMTokenList-stringification-behavior * @see https://www.ecma-international.org/ecma-262/9.0/index.html#sec-tostring * * @return Token set as string. */ toString() { return this.value; } /** * Returns an iterator for the TokenList, iterating items of the set. * * @see https://dom.spec.whatwg.org/#domtokenlist * * @return TokenList iterator. */ *[Symbol.iterator]() { return yield* this._valueAsArray; } /** * Returns the token with index `index`. * * @see https://dom.spec.whatwg.org/#dom-domtokenlist-item * * @param index Index at which to return token. * * @return Token at index. */ item(index) { return this._valueAsArray[index]; } /** * Returns true if `token` is present, and false otherwise. * * @see https://dom.spec.whatwg.org/#dom-domtokenlist-contains * * @param item Token to test. * * @return Whether token is present. */ contains(item) { return this._valueAsArray.indexOf(item) !== -1; } /** * Adds all arguments passed, except those already present. * * @see https://dom.spec.whatwg.org/#dom-domtokenlist-add * * @param items Items to add. */ add(...items) { this.value += ' ' + items.join(' '); } /** * Removes arguments passed, if they are present. * * @see https://dom.spec.whatwg.org/#dom-domtokenlist-remove * * @param items Items to remove. */ remove(...items) { this.value = this._valueAsArray.filter(val => !items.includes(val)).join(' '); } /** * If `force` is not given, "toggles" `token`, removing it if it’s present * and adding it if it’s not present. If `force` is true, adds token (same * as add()). If force is false, removes token (same as remove()). Returns * true if `token` is now present, and false otherwise. * * @see https://dom.spec.whatwg.org/#dom-domtokenlist-toggle * * @param token Token to toggle. * @param [force] Presence to force. * * @return Whether token is present after toggle. */ toggle(token, force) { if (undefined === force) { force = !this.contains(token); } if (force) { this.add(token); } else { this.remove(token); } return force; } /** * Replaces `token` with `newToken`. Returns true if `token` was replaced * with `newToken`, and false otherwise. * * @see https://dom.spec.whatwg.org/#dom-domtokenlist-replace * * @param token Token to replace with `newToken`. * @param newToken Token to use in place of `token`. * * @return Whether replacement occurred. */ replace(token, newToken) { if (!this.contains(token)) { return false; } this.remove(token); this.add(newToken); return true; } /* eslint-disable @typescript-eslint/no-unused-vars */ /** * Returns true if `token` is in the associated attribute’s supported * tokens. Returns false otherwise. * * Always returns `true` in this implementation. * * @param _token * @see https://dom.spec.whatwg.org/#dom-domtokenlist-supports * * @return Whether token is supported. */ supports(_token) { return true; } /* eslint-enable @typescript-eslint/no-unused-vars */ } (window.wp = window.wp || {}).tokenList = __webpack_exports__["default"]; /******/ })() ; dist/element.js 0000644 00000205042 15125140777 0007512 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ 4140: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { var m = __webpack_require__(5795); if (true) { exports.H = m.createRoot; exports.c = m.hydrateRoot; } else { var i; } /***/ }), /***/ 5795: /***/ ((module) => { module.exports = window["ReactDOM"]; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { Children: () => (/* reexport */ external_React_namespaceObject.Children), Component: () => (/* reexport */ external_React_namespaceObject.Component), Fragment: () => (/* reexport */ external_React_namespaceObject.Fragment), Platform: () => (/* reexport */ platform), PureComponent: () => (/* reexport */ external_React_namespaceObject.PureComponent), RawHTML: () => (/* reexport */ RawHTML), StrictMode: () => (/* reexport */ external_React_namespaceObject.StrictMode), Suspense: () => (/* reexport */ external_React_namespaceObject.Suspense), cloneElement: () => (/* reexport */ external_React_namespaceObject.cloneElement), concatChildren: () => (/* reexport */ concatChildren), createContext: () => (/* reexport */ external_React_namespaceObject.createContext), createElement: () => (/* reexport */ external_React_namespaceObject.createElement), createInterpolateElement: () => (/* reexport */ create_interpolate_element), createPortal: () => (/* reexport */ external_ReactDOM_.createPortal), createRef: () => (/* reexport */ external_React_namespaceObject.createRef), createRoot: () => (/* reexport */ client/* createRoot */.H), findDOMNode: () => (/* reexport */ external_ReactDOM_.findDOMNode), flushSync: () => (/* reexport */ external_ReactDOM_.flushSync), forwardRef: () => (/* reexport */ external_React_namespaceObject.forwardRef), hydrate: () => (/* reexport */ external_ReactDOM_.hydrate), hydrateRoot: () => (/* reexport */ client/* hydrateRoot */.c), isEmptyElement: () => (/* reexport */ isEmptyElement), isValidElement: () => (/* reexport */ external_React_namespaceObject.isValidElement), lazy: () => (/* reexport */ external_React_namespaceObject.lazy), memo: () => (/* reexport */ external_React_namespaceObject.memo), render: () => (/* reexport */ external_ReactDOM_.render), renderToString: () => (/* reexport */ serialize), startTransition: () => (/* reexport */ external_React_namespaceObject.startTransition), switchChildrenNodeName: () => (/* reexport */ switchChildrenNodeName), unmountComponentAtNode: () => (/* reexport */ external_ReactDOM_.unmountComponentAtNode), useCallback: () => (/* reexport */ external_React_namespaceObject.useCallback), useContext: () => (/* reexport */ external_React_namespaceObject.useContext), useDebugValue: () => (/* reexport */ external_React_namespaceObject.useDebugValue), useDeferredValue: () => (/* reexport */ external_React_namespaceObject.useDeferredValue), useEffect: () => (/* reexport */ external_React_namespaceObject.useEffect), useId: () => (/* reexport */ external_React_namespaceObject.useId), useImperativeHandle: () => (/* reexport */ external_React_namespaceObject.useImperativeHandle), useInsertionEffect: () => (/* reexport */ external_React_namespaceObject.useInsertionEffect), useLayoutEffect: () => (/* reexport */ external_React_namespaceObject.useLayoutEffect), useMemo: () => (/* reexport */ external_React_namespaceObject.useMemo), useReducer: () => (/* reexport */ external_React_namespaceObject.useReducer), useRef: () => (/* reexport */ external_React_namespaceObject.useRef), useState: () => (/* reexport */ external_React_namespaceObject.useState), useSyncExternalStore: () => (/* reexport */ external_React_namespaceObject.useSyncExternalStore), useTransition: () => (/* reexport */ external_React_namespaceObject.useTransition) }); ;// external "React" const external_React_namespaceObject = window["React"]; ;// ./node_modules/@wordpress/element/build-module/create-interpolate-element.js /** * Internal dependencies */ /** * Object containing a React element. * * @typedef {import('react').ReactElement} Element */ let indoc, offset, output, stack; /** * Matches tags in the localized string * * This is used for extracting the tag pattern groups for parsing the localized * string and along with the map converting it to a react element. * * There are four references extracted using this tokenizer: * * match: Full match of the tag (i.e. <strong>, </strong>, <br/>) * isClosing: The closing slash, if it exists. * name: The name portion of the tag (strong, br) (if ) * isSelfClosed: The slash on a self closing tag, if it exists. * * @type {RegExp} */ const tokenizer = /<(\/)?(\w+)\s*(\/)?>/g; /** * The stack frame tracking parse progress. * * @typedef Frame * * @property {Element} element A parent element which may still have * @property {number} tokenStart Offset at which parent element first * appears. * @property {number} tokenLength Length of string marking start of parent * element. * @property {number} [prevOffset] Running offset at which parsing should * continue. * @property {number} [leadingTextStart] Offset at which last closing element * finished, used for finding text between * elements. * @property {Element[]} children Children. */ /** * Tracks recursive-descent parse state. * * This is a Stack frame holding parent elements until all children have been * parsed. * * @private * @param {Element} element A parent element which may still have * nested children not yet parsed. * @param {number} tokenStart Offset at which parent element first * appears. * @param {number} tokenLength Length of string marking start of parent * element. * @param {number} [prevOffset] Running offset at which parsing should * continue. * @param {number} [leadingTextStart] Offset at which last closing element * finished, used for finding text between * elements. * * @return {Frame} The stack frame tracking parse progress. */ function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextStart) { return { element, tokenStart, tokenLength, prevOffset, leadingTextStart, children: [] }; } /** * This function creates an interpolated element from a passed in string with * specific tags matching how the string should be converted to an element via * the conversion map value. * * @example * For example, for the given string: * * "This is a <span>string</span> with <a>a link</a> and a self-closing * <CustomComponentB/> tag" * * You would have something like this as the conversionMap value: * * ```js * { * span: <span />, * a: <a href={ 'https://github.com' } />, * CustomComponentB: <CustomComponent />, * } * ``` * * @param {string} interpolatedString The interpolation string to be parsed. * @param {Record<string, Element>} conversionMap The map used to convert the string to * a react element. * @throws {TypeError} * @return {Element} A wp element. */ const createInterpolateElement = (interpolatedString, conversionMap) => { indoc = interpolatedString; offset = 0; output = []; stack = []; tokenizer.lastIndex = 0; if (!isValidConversionMap(conversionMap)) { throw new TypeError('The conversionMap provided is not valid. It must be an object with values that are React Elements'); } do { // twiddle our thumbs } while (proceed(conversionMap)); return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, ...output); }; /** * Validate conversion map. * * A map is considered valid if it's an object and every value in the object * is a React Element * * @private * * @param {Object} conversionMap The map being validated. * * @return {boolean} True means the map is valid. */ const isValidConversionMap = conversionMap => { const isObject = typeof conversionMap === 'object'; const values = isObject && Object.values(conversionMap); return isObject && values.length && values.every(element => (0,external_React_namespaceObject.isValidElement)(element)); }; /** * This is the iterator over the matches in the string. * * @private * * @param {Object} conversionMap The conversion map for the string. * * @return {boolean} true for continuing to iterate, false for finished. */ function proceed(conversionMap) { const next = nextToken(); const [tokenType, name, startOffset, tokenLength] = next; const stackDepth = stack.length; const leadingTextStart = startOffset > offset ? offset : null; if (!conversionMap[name]) { addText(); return false; } switch (tokenType) { case 'no-more-tokens': if (stackDepth !== 0) { const { leadingTextStart: stackLeadingText, tokenStart } = stack.pop(); output.push(indoc.substr(stackLeadingText, tokenStart)); } addText(); return false; case 'self-closed': if (0 === stackDepth) { if (null !== leadingTextStart) { output.push(indoc.substr(leadingTextStart, startOffset - leadingTextStart)); } output.push(conversionMap[name]); offset = startOffset + tokenLength; return true; } // Otherwise we found an inner element. addChild(createFrame(conversionMap[name], startOffset, tokenLength)); offset = startOffset + tokenLength; return true; case 'opener': stack.push(createFrame(conversionMap[name], startOffset, tokenLength, startOffset + tokenLength, leadingTextStart)); offset = startOffset + tokenLength; return true; case 'closer': // If we're not nesting then this is easy - close the block. if (1 === stackDepth) { closeOuterElement(startOffset); offset = startOffset + tokenLength; return true; } // Otherwise we're nested and we have to close out the current // block and add it as a innerBlock to the parent. const stackTop = stack.pop(); const text = indoc.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset); stackTop.children.push(text); stackTop.prevOffset = startOffset + tokenLength; const frame = createFrame(stackTop.element, stackTop.tokenStart, stackTop.tokenLength, startOffset + tokenLength); frame.children = stackTop.children; addChild(frame); offset = startOffset + tokenLength; return true; default: addText(); return false; } } /** * Grabs the next token match in the string and returns it's details. * * @private * * @return {Array} An array of details for the token matched. */ function nextToken() { const matches = tokenizer.exec(indoc); // We have no more tokens. if (null === matches) { return ['no-more-tokens']; } const startedAt = matches.index; const [match, isClosing, name, isSelfClosed] = matches; const length = match.length; if (isSelfClosed) { return ['self-closed', name, startedAt, length]; } if (isClosing) { return ['closer', name, startedAt, length]; } return ['opener', name, startedAt, length]; } /** * Pushes text extracted from the indoc string to the output stack given the * current rawLength value and offset (if rawLength is provided ) or the * indoc.length and offset. * * @private */ function addText() { const length = indoc.length - offset; if (0 === length) { return; } output.push(indoc.substr(offset, length)); } /** * Pushes a child element to the associated parent element's children for the * parent currently active in the stack. * * @private * * @param {Frame} frame The Frame containing the child element and it's * token information. */ function addChild(frame) { const { element, tokenStart, tokenLength, prevOffset, children } = frame; const parent = stack[stack.length - 1]; const text = indoc.substr(parent.prevOffset, tokenStart - parent.prevOffset); if (text) { parent.children.push(text); } parent.children.push((0,external_React_namespaceObject.cloneElement)(element, null, ...children)); parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength; } /** * This is called for closing tags. It creates the element currently active in * the stack. * * @private * * @param {number} endOffset Offset at which the closing tag for the element * begins in the string. If this is greater than the * prevOffset attached to the element, then this * helps capture any remaining nested text nodes in * the element. */ function closeOuterElement(endOffset) { const { element, leadingTextStart, prevOffset, tokenStart, children } = stack.pop(); const text = endOffset ? indoc.substr(prevOffset, endOffset - prevOffset) : indoc.substr(prevOffset); if (text) { children.push(text); } if (null !== leadingTextStart) { output.push(indoc.substr(leadingTextStart, tokenStart - leadingTextStart)); } output.push((0,external_React_namespaceObject.cloneElement)(element, null, ...children)); } /* harmony default export */ const create_interpolate_element = (createInterpolateElement); ;// ./node_modules/@wordpress/element/build-module/react.js /** * External dependencies */ // eslint-disable-next-line @typescript-eslint/no-restricted-imports /** * Object containing a React element. * * @typedef {import('react').ReactElement} Element */ /** * Object containing a React component. * * @typedef {import('react').ComponentType} ComponentType */ /** * Object containing a React synthetic event. * * @typedef {import('react').SyntheticEvent} SyntheticEvent */ /** * Object containing a React ref object. * * @template T * @typedef {import('react').RefObject<T>} RefObject<T> */ /** * Object containing a React ref callback. * * @template T * @typedef {import('react').RefCallback<T>} RefCallback<T> */ /** * Object containing a React ref. * * @template T * @typedef {import('react').Ref<T>} Ref<T> */ /** * Object that provides utilities for dealing with React children. */ /** * Creates a copy of an element with extended props. * * @param {Element} element Element * @param {?Object} props Props to apply to cloned element * * @return {Element} Cloned element. */ /** * A base class to create WordPress Components (Refs, state and lifecycle hooks) */ /** * Creates a context object containing two components: a provider and consumer. * * @param {Object} defaultValue A default data stored in the context. * * @return {Object} Context object. */ /** * Returns a new element of given type. Type can be either a string tag name or * another function which itself returns an element. * * @param {?(string|Function)} type Tag name or element creator * @param {Object} props Element properties, either attribute * set to apply to DOM node or values to * pass through to element creator * @param {...Element} children Descendant elements * * @return {Element} Element. */ /** * Returns an object tracking a reference to a rendered element via its * `current` property as either a DOMElement or Element, dependent upon the * type of element rendered with the ref attribute. * * @return {Object} Ref object. */ /** * Component enhancer used to enable passing a ref to its wrapped component. * Pass a function argument which receives `props` and `ref` as its arguments, * returning an element using the forwarded ref. The return value is a new * component which forwards its ref. * * @param {Function} forwarder Function passed `props` and `ref`, expected to * return an element. * * @return {Component} Enhanced component. */ /** * A component which renders its children without any wrapping element. */ /** * Checks if an object is a valid React Element. * * @param {Object} objectToCheck The object to be checked. * * @return {boolean} true if objectToTest is a valid React Element and false otherwise. */ /** * @see https://react.dev/reference/react/memo */ /** * Component that activates additional checks and warnings for its descendants. */ /** * @see https://react.dev/reference/react/useCallback */ /** * @see https://react.dev/reference/react/useContext */ /** * @see https://react.dev/reference/react/useDebugValue */ /** * @see https://react.dev/reference/react/useDeferredValue */ /** * @see https://react.dev/reference/react/useEffect */ /** * @see https://react.dev/reference/react/useId */ /** * @see https://react.dev/reference/react/useImperativeHandle */ /** * @see https://react.dev/reference/react/useInsertionEffect */ /** * @see https://react.dev/reference/react/useLayoutEffect */ /** * @see https://react.dev/reference/react/useMemo */ /** * @see https://react.dev/reference/react/useReducer */ /** * @see https://react.dev/reference/react/useRef */ /** * @see https://react.dev/reference/react/useState */ /** * @see https://react.dev/reference/react/useSyncExternalStore */ /** * @see https://react.dev/reference/react/useTransition */ /** * @see https://react.dev/reference/react/startTransition */ /** * @see https://react.dev/reference/react/lazy */ /** * @see https://react.dev/reference/react/Suspense */ /** * @see https://react.dev/reference/react/PureComponent */ /** * Concatenate two or more React children objects. * * @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate. * * @return {Array} The concatenated value. */ function concatChildren(...childrenArguments) { return childrenArguments.reduce((accumulator, children, i) => { external_React_namespaceObject.Children.forEach(children, (child, j) => { if (child && 'string' !== typeof child) { child = (0,external_React_namespaceObject.cloneElement)(child, { key: [i, j].join() }); } accumulator.push(child); }); return accumulator; }, []); } /** * Switches the nodeName of all the elements in the children object. * * @param {?Object} children Children object. * @param {string} nodeName Node name. * * @return {?Object} The updated children object. */ function switchChildrenNodeName(children, nodeName) { return children && external_React_namespaceObject.Children.map(children, (elt, index) => { if (typeof elt?.valueOf() === 'string') { return (0,external_React_namespaceObject.createElement)(nodeName, { key: index }, elt); } const { children: childrenProp, ...props } = elt.props; return (0,external_React_namespaceObject.createElement)(nodeName, { key: index, ...props }, childrenProp); }); } // EXTERNAL MODULE: external "ReactDOM" var external_ReactDOM_ = __webpack_require__(5795); // EXTERNAL MODULE: ./node_modules/react-dom/client.js var client = __webpack_require__(4140); ;// ./node_modules/@wordpress/element/build-module/react-platform.js /** * External dependencies */ /** * Creates a portal into which a component can be rendered. * * @see https://github.com/facebook/react/issues/10309#issuecomment-318433235 * * @param {import('react').ReactElement} child Any renderable child, such as an element, * string, or fragment. * @param {HTMLElement} container DOM node into which element should be rendered. */ /** * Finds the dom node of a React component. * * @param {import('react').ComponentType} component Component's instance. */ /** * Forces React to flush any updates inside the provided callback synchronously. * * @param {Function} callback Callback to run synchronously. */ /** * Renders a given element into the target DOM node. * * @deprecated since WordPress 6.2.0. Use `createRoot` instead. * @see https://react.dev/reference/react-dom/render */ /** * Hydrates a given element into the target DOM node. * * @deprecated since WordPress 6.2.0. Use `hydrateRoot` instead. * @see https://react.dev/reference/react-dom/hydrate */ /** * Creates a new React root for the target DOM node. * * @since 6.2.0 Introduced in WordPress core. * @see https://react.dev/reference/react-dom/client/createRoot */ /** * Creates a new React root for the target DOM node and hydrates it with a pre-generated markup. * * @since 6.2.0 Introduced in WordPress core. * @see https://react.dev/reference/react-dom/client/hydrateRoot */ /** * Removes any mounted element from the target DOM node. * * @deprecated since WordPress 6.2.0. Use `root.unmount()` instead. * @see https://react.dev/reference/react-dom/unmountComponentAtNode */ ;// ./node_modules/@wordpress/element/build-module/utils.js /** * Checks if the provided WP element is empty. * * @param {*} element WP element to check. * @return {boolean} True when an element is considered empty. */ const isEmptyElement = element => { if (typeof element === 'number') { return false; } if (typeof element?.valueOf() === 'string' || Array.isArray(element)) { return !element.length; } return !element; }; ;// ./node_modules/@wordpress/element/build-module/platform.js /** * Parts of this source were derived and modified from react-native-web, * released under the MIT license. * * Copyright (c) 2016-present, Nicolas Gallagher. * Copyright (c) 2015-present, Facebook, Inc. * */ const Platform = { OS: 'web', select: spec => 'web' in spec ? spec.web : spec.default, isWeb: true }; /** * Component used to detect the current Platform being used. * Use Platform.OS === 'web' to detect if running on web environment. * * This is the same concept as the React Native implementation. * * @see https://reactnative.dev/docs/platform-specific-code#platform-module * * Here is an example of how to use the select method: * @example * ```js * import { Platform } from '@wordpress/element'; * * const placeholderLabel = Platform.select( { * native: __( 'Add media' ), * web: __( 'Drag images, upload new ones or select files from your library.' ), * } ); * ``` */ /* harmony default export */ const platform = (Platform); ;// ./node_modules/is-plain-object/dist/is-plain-object.mjs /*! * is-plain-object <https://github.com/jonschlinkert/is-plain-object> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function isObject(o) { return Object.prototype.toString.call(o) === '[object Object]'; } function isPlainObject(o) { var ctor,prot; if (isObject(o) === false) return false; // If has modified constructor ctor = o.constructor; if (ctor === undefined) return true; // If has modified prototype prot = ctor.prototype; if (isObject(prot) === false) return false; // If constructor does not have an Object-specific method if (prot.hasOwnProperty('isPrototypeOf') === false) { return false; } // Most likely a plain Object return true; } ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/dot-case/dist.es2015/index.js function dotCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "." }, options)); } ;// ./node_modules/param-case/dist.es2015/index.js function paramCase(input, options) { if (options === void 0) { options = {}; } return dotCase(input, __assign({ delimiter: "-" }, options)); } ;// external ["wp","escapeHtml"] const external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"]; ;// ./node_modules/@wordpress/element/build-module/raw-html.js /** * Internal dependencies */ /** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */ /** * Component used as equivalent of Fragment with unescaped HTML, in cases where * it is desirable to render dangerous HTML without needing a wrapper element. * To preserve additional props, a `div` wrapper _will_ be created if any props * aside from `children` are passed. * * @param {RawHTMLProps} props Children should be a string of HTML or an array * of strings. Other props will be passed through * to the div wrapper. * * @return {JSX.Element} Dangerously-rendering component. */ function RawHTML({ children, ...props }) { let rawHtml = ''; // Cast children as an array, and concatenate each element if it is a string. external_React_namespaceObject.Children.toArray(children).forEach(child => { if (typeof child === 'string' && child.trim() !== '') { rawHtml += child; } }); // The `div` wrapper will be stripped by the `renderElement` serializer in // `./serialize.js` unless there are non-children props present. return (0,external_React_namespaceObject.createElement)('div', { dangerouslySetInnerHTML: { __html: rawHtml }, ...props }); } ;// ./node_modules/@wordpress/element/build-module/serialize.js /** * Parts of this source were derived and modified from fast-react-render, * released under the MIT license. * * https://github.com/alt-j/fast-react-render * * Copyright (c) 2016 Andrey Morozov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('react').ReactElement} ReactElement */ const { Provider, Consumer } = (0,external_React_namespaceObject.createContext)(undefined); const ForwardRef = (0,external_React_namespaceObject.forwardRef)(() => { return null; }); /** * Valid attribute types. * * @type {Set<string>} */ const ATTRIBUTES_TYPES = new Set(['string', 'boolean', 'number']); /** * Element tags which can be self-closing. * * @type {Set<string>} */ const SELF_CLOSING_TAGS = new Set(['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']); /** * Boolean attributes are attributes whose presence as being assigned is * meaningful, even if only empty. * * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 * * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 ) * .reduce( ( result, tr ) => Object.assign( result, { * [ tr.firstChild.textContent.trim() ]: true * } ), {} ) ).sort(); * * @type {Set<string>} */ const BOOLEAN_ATTRIBUTES = new Set(['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch']); /** * Enumerated attributes are attributes which must be of a specific value form. * Like boolean attributes, these are meaningful if specified, even if not of a * valid enumerated value. * * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 * * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) ) * .reduce( ( result, tr ) => Object.assign( result, { * [ tr.firstChild.textContent.trim() ]: true * } ), {} ) ).sort(); * * Some notable omissions: * * - `alt`: https://blog.whatwg.org/omit-alt * * @type {Set<string>} */ const ENUMERATED_ATTRIBUTES = new Set(['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap']); /** * Set of CSS style properties which support assignment of unitless numbers. * Used in rendering of style properties, where `px` unit is assumed unless * property is included in this set or value is zero. * * Generated via: * * Object.entries( document.createElement( 'div' ).style ) * .filter( ( [ key ] ) => ( * ! /^(webkit|ms|moz)/.test( key ) && * ( e.style[ key ] = 10 ) && * e.style[ key ] === '10' * ) ) * .map( ( [ key ] ) => key ) * .sort(); * * @type {Set<string>} */ const CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set(['animation', 'animationIterationCount', 'baselineShift', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'columnCount', 'cx', 'cy', 'fillOpacity', 'flexGrow', 'flexShrink', 'floodOpacity', 'fontWeight', 'gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart', 'lineHeight', 'opacity', 'order', 'orphans', 'r', 'rx', 'ry', 'shapeImageThreshold', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'tabSize', 'widows', 'x', 'y', 'zIndex', 'zoom']); /** * Returns true if the specified string is prefixed by one of an array of * possible prefixes. * * @param {string} string String to check. * @param {string[]} prefixes Possible prefixes. * * @return {boolean} Whether string has prefix. */ function hasPrefix(string, prefixes) { return prefixes.some(prefix => string.indexOf(prefix) === 0); } /** * Returns true if the given prop name should be ignored in attributes * serialization, or false otherwise. * * @param {string} attribute Attribute to check. * * @return {boolean} Whether attribute should be ignored. */ function isInternalAttribute(attribute) { return 'key' === attribute || 'children' === attribute; } /** * Returns the normal form of the element's attribute value for HTML. * * @param {string} attribute Attribute name. * @param {*} value Non-normalized attribute value. * * @return {*} Normalized attribute value. */ function getNormalAttributeValue(attribute, value) { switch (attribute) { case 'style': return renderStyle(value); } return value; } /** * This is a map of all SVG attributes that have dashes. Map(lower case prop => dashed lower case attribute). * We need this to render e.g strokeWidth as stroke-width. * * List from: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute. */ const SVG_ATTRIBUTE_WITH_DASHES_LIST = ['accentHeight', 'alignmentBaseline', 'arabicForm', 'baselineShift', 'capHeight', 'clipPath', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'dominantBaseline', 'enableBackground', 'fillOpacity', 'fillRule', 'floodColor', 'floodOpacity', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'horizAdvX', 'horizOriginX', 'imageRendering', 'letterSpacing', 'lightingColor', 'markerEnd', 'markerMid', 'markerStart', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pointerEvents', 'renderingIntent', 'shapeRendering', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'textAnchor', 'textDecoration', 'textRendering', 'underlinePosition', 'underlineThickness', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'vHanging', 'vIdeographic', 'vMathematical', 'vectorEffect', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'wordSpacing', 'writingMode', 'xmlnsXlink', 'xHeight'].reduce((map, attribute) => { // The keys are lower-cased for more robust lookup. map[attribute.toLowerCase()] = attribute; return map; }, {}); /** * This is a map of all case-sensitive SVG attributes. Map(lowercase key => proper case attribute). * The keys are lower-cased for more robust lookup. * Note that this list only contains attributes that contain at least one capital letter. * Lowercase attributes don't need mapping, since we lowercase all attributes by default. */ const CASE_SENSITIVE_SVG_ATTRIBUTES = ['allowReorder', 'attributeName', 'attributeType', 'autoReverse', 'baseFrequency', 'baseProfile', 'calcMode', 'clipPathUnits', 'contentScriptType', 'contentStyleType', 'diffuseConstant', 'edgeMode', 'externalResourcesRequired', 'filterRes', 'filterUnits', 'glyphRef', 'gradientTransform', 'gradientUnits', 'kernelMatrix', 'kernelUnitLength', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'limitingConeAngle', 'markerHeight', 'markerUnits', 'markerWidth', 'maskContentUnits', 'maskUnits', 'numOctaves', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'refX', 'refY', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'specularConstant', 'specularExponent', 'spreadMethod', 'startOffset', 'stdDeviation', 'stitchTiles', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textLength', 'viewBox', 'viewTarget', 'xChannelSelector', 'yChannelSelector'].reduce((map, attribute) => { // The keys are lower-cased for more robust lookup. map[attribute.toLowerCase()] = attribute; return map; }, {}); /** * This is a map of all SVG attributes that have colons. * Keys are lower-cased and stripped of their colons for more robust lookup. */ const SVG_ATTRIBUTES_WITH_COLONS = ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'xmlns:xlink'].reduce((map, attribute) => { map[attribute.replace(':', '').toLowerCase()] = attribute; return map; }, {}); /** * Returns the normal form of the element's attribute name for HTML. * * @param {string} attribute Non-normalized attribute name. * * @return {string} Normalized attribute name. */ function getNormalAttributeName(attribute) { switch (attribute) { case 'htmlFor': return 'for'; case 'className': return 'class'; } const attributeLowerCase = attribute.toLowerCase(); if (CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]) { return CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]; } else if (SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]) { return paramCase(SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]); } else if (SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]) { return SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]; } return attributeLowerCase; } /** * Returns the normal form of the style property name for HTML. * * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color' * - Leaves custom attributes alone, e.g. '--myBackgroundColor' → '--myBackgroundColor' * - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' → '-moz-transform' * * @param {string} property Property name. * * @return {string} Normalized property name. */ function getNormalStylePropertyName(property) { if (property.startsWith('--')) { return property; } if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) { return '-' + paramCase(property); } return paramCase(property); } /** * Returns the normal form of the style property value for HTML. Appends a * default pixel unit if numeric, not a unitless property, and not zero. * * @param {string} property Property name. * @param {*} value Non-normalized property value. * * @return {*} Normalized property value. */ function getNormalStylePropertyValue(property, value) { if (typeof value === 'number' && 0 !== value && !CSS_PROPERTIES_SUPPORTS_UNITLESS.has(property)) { return value + 'px'; } return value; } /** * Serializes a React element to string. * * @param {import('react').ReactNode} element Element to serialize. * @param {Object} [context] Context object. * @param {Object} [legacyContext] Legacy context object. * * @return {string} Serialized element. */ function renderElement(element, context, legacyContext = {}) { if (null === element || undefined === element || false === element) { return ''; } if (Array.isArray(element)) { return renderChildren(element, context, legacyContext); } switch (typeof element) { case 'string': return (0,external_wp_escapeHtml_namespaceObject.escapeHTML)(element); case 'number': return element.toString(); } const { type, props } = /** @type {{type?: any, props?: any}} */ element; switch (type) { case external_React_namespaceObject.StrictMode: case external_React_namespaceObject.Fragment: return renderChildren(props.children, context, legacyContext); case RawHTML: const { children, ...wrapperProps } = props; return renderNativeComponent(!Object.keys(wrapperProps).length ? null : 'div', { ...wrapperProps, dangerouslySetInnerHTML: { __html: children } }, context, legacyContext); } switch (typeof type) { case 'string': return renderNativeComponent(type, props, context, legacyContext); case 'function': if (type.prototype && typeof type.prototype.render === 'function') { return renderComponent(type, props, context, legacyContext); } return renderElement(type(props, legacyContext), context, legacyContext); } switch (type && type.$$typeof) { case Provider.$$typeof: return renderChildren(props.children, props.value, legacyContext); case Consumer.$$typeof: return renderElement(props.children(context || type._currentValue), context, legacyContext); case ForwardRef.$$typeof: return renderElement(type.render(props), context, legacyContext); } return ''; } /** * Serializes a native component type to string. * * @param {?string} type Native component type to serialize, or null if * rendering as fragment of children content. * @param {Object} props Props object. * @param {Object} [context] Context object. * @param {Object} [legacyContext] Legacy context object. * * @return {string} Serialized element. */ function renderNativeComponent(type, props, context, legacyContext = {}) { let content = ''; if (type === 'textarea' && props.hasOwnProperty('value')) { // Textarea children can be assigned as value prop. If it is, render in // place of children. Ensure to omit so it is not assigned as attribute // as well. content = renderChildren(props.value, context, legacyContext); const { value, ...restProps } = props; props = restProps; } else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') { // Dangerous content is left unescaped. content = props.dangerouslySetInnerHTML.__html; } else if (typeof props.children !== 'undefined') { content = renderChildren(props.children, context, legacyContext); } if (!type) { return content; } const attributes = renderAttributes(props); if (SELF_CLOSING_TAGS.has(type)) { return '<' + type + attributes + '/>'; } return '<' + type + attributes + '>' + content + '</' + type + '>'; } /** @typedef {import('react').ComponentType} ComponentType */ /** * Serializes a non-native component type to string. * * @param {ComponentType} Component Component type to serialize. * @param {Object} props Props object. * @param {Object} [context] Context object. * @param {Object} [legacyContext] Legacy context object. * * @return {string} Serialized element */ function renderComponent(Component, props, context, legacyContext = {}) { const instance = new (/** @type {import('react').ComponentClass} */ Component)(props, legacyContext); if (typeof // Ignore reason: Current prettier reformats parens and mangles type assertion // prettier-ignore /** @type {{getChildContext?: () => unknown}} */ instance.getChildContext === 'function') { Object.assign(legacyContext, /** @type {{getChildContext?: () => unknown}} */instance.getChildContext()); } const html = renderElement(instance.render(), context, legacyContext); return html; } /** * Serializes an array of children to string. * * @param {import('react').ReactNodeArray} children Children to serialize. * @param {Object} [context] Context object. * @param {Object} [legacyContext] Legacy context object. * * @return {string} Serialized children. */ function renderChildren(children, context, legacyContext = {}) { let result = ''; children = Array.isArray(children) ? children : [children]; for (let i = 0; i < children.length; i++) { const child = children[i]; result += renderElement(child, context, legacyContext); } return result; } /** * Renders a props object as a string of HTML attributes. * * @param {Object} props Props object. * * @return {string} Attributes string. */ function renderAttributes(props) { let result = ''; for (const key in props) { const attribute = getNormalAttributeName(key); if (!(0,external_wp_escapeHtml_namespaceObject.isValidAttributeName)(attribute)) { continue; } let value = getNormalAttributeValue(key, props[key]); // If value is not of serializable type, skip. if (!ATTRIBUTES_TYPES.has(typeof value)) { continue; } // Don't render internal attribute names. if (isInternalAttribute(key)) { continue; } const isBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attribute); // Boolean attribute should be omitted outright if its value is false. if (isBooleanAttribute && value === false) { continue; } const isMeaningfulAttribute = isBooleanAttribute || hasPrefix(key, ['data-', 'aria-']) || ENUMERATED_ATTRIBUTES.has(attribute); // Only write boolean value as attribute if meaningful. if (typeof value === 'boolean' && !isMeaningfulAttribute) { continue; } result += ' ' + attribute; // Boolean attributes should write attribute name, but without value. // Mere presence of attribute name is effective truthiness. if (isBooleanAttribute) { continue; } if (typeof value === 'string') { value = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(value); } result += '="' + value + '"'; } return result; } /** * Renders a style object as a string attribute value. * * @param {Object} style Style object. * * @return {string} Style attribute value. */ function renderStyle(style) { // Only generate from object, e.g. tolerate string value. if (!isPlainObject(style)) { return style; } let result; for (const property in style) { const value = style[property]; if (null === value || undefined === value) { continue; } if (result) { result += ';'; } else { result = ''; } const normalName = getNormalStylePropertyName(property); const normalValue = getNormalStylePropertyValue(property, value); result += normalName + ':' + normalValue; } return result; } /* harmony default export */ const serialize = (renderElement); ;// ./node_modules/@wordpress/element/build-module/index.js (window.wp = window.wp || {}).element = __webpack_exports__; /******/ })() ; dist/autop.min.js 0000644 00000012756 15125140777 0010003 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(p,n)=>{for(var r in n)e.o(n,r)&&!e.o(p,r)&&Object.defineProperty(p,r,{enumerable:!0,get:n[r]})},o:(e,p)=>Object.prototype.hasOwnProperty.call(e,p),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},p={};e.r(p),e.d(p,{autop:()=>t,removep:()=>c});const n=new RegExp("(<((?=!--|!\\[CDATA\\[)((?=!-)!(?:-(?!->)[^\\-]*)*(?:--\x3e)?|!\\[CDATA\\[[^\\]]*(?:](?!]>)[^\\]]*)*?(?:]]>)?)|[^>]*>?))");function r(e,p){const r=function(e){const p=[];let r,t=e;for(;r=t.match(n);){const e=r.index;p.push(t.slice(0,e)),p.push(r[0]),t=t.slice(e+r[0].length)}return t.length&&p.push(t),p}(e);let t=!1;const c=Object.keys(p);for(let e=1;e<r.length;e+=2)for(let n=0;n<c.length;n++){const l=c[n];if(-1!==r[e].indexOf(l)){r[e]=r[e].replace(new RegExp(l,"g"),p[l]),t=!0;break}}return t&&(e=r.join("")),e}function t(e,p=!0){const n=[];if(""===e.trim())return"";if(-1!==(e+="\n").indexOf("<pre")){const p=e.split("</pre>"),r=p.pop();e="";for(let r=0;r<p.length;r++){const t=p[r],c=t.indexOf("<pre");if(-1===c){e+=t;continue}const l="<pre wp-pre-tag-"+r+"></pre>";n.push([l,t.substr(c)+"</pre>"]),e+=t.substr(0,c)+l}e+=r}const t="(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)";-1!==(e=r(e=(e=(e=(e=e.replace(/<br\s*\/?>\s*<br\s*\/?>/g,"\n\n")).replace(new RegExp("(<"+t+"[\\s/>])","g"),"\n\n$1")).replace(new RegExp("(</"+t+">)","g"),"$1\n\n")).replace(/\r\n|\r/g,"\n"),{"\n":" \x3c!-- wpnl --\x3e "})).indexOf("<option")&&(e=(e=e.replace(/\s*<option/g,"<option")).replace(/<\/option>\s*/g,"</option>")),-1!==e.indexOf("</object>")&&(e=(e=(e=e.replace(/(<object[^>]*>)\s*/g,"$1")).replace(/\s*<\/object>/g,"</object>")).replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g,"$1")),-1===e.indexOf("<source")&&-1===e.indexOf("<track")||(e=(e=(e=e.replace(/([<\[](?:audio|video)[^>\]]*[>\]])\s*/g,"$1")).replace(/\s*([<\[]\/(?:audio|video)[>\]])/g,"$1")).replace(/\s*(<(?:source|track)[^>]*>)\s*/g,"$1")),-1!==e.indexOf("<figcaption")&&(e=(e=e.replace(/\s*(<figcaption[^>]*>)/,"$1")).replace(/<\/figcaption>\s*/,"</figcaption>"));const c=(e=e.replace(/\n\n+/g,"\n\n")).split(/\n\s*\n/).filter(Boolean);return e="",c.forEach((p=>{e+="<p>"+p.replace(/^\n*|\n*$/g,"")+"</p>\n"})),e=(e=(e=(e=(e=(e=(e=(e=e.replace(/<p>\s*<\/p>/g,"")).replace(/<p>([^<]+)<\/(div|address|form)>/g,"<p>$1</p></$2>")).replace(new RegExp("<p>\\s*(</?"+t+"[^>]*>)\\s*</p>","g"),"$1")).replace(/<p>(<li.+?)<\/p>/g,"$1")).replace(/<p><blockquote([^>]*)>/gi,"<blockquote$1><p>")).replace(/<\/blockquote><\/p>/g,"</p></blockquote>")).replace(new RegExp("<p>\\s*(</?"+t+"[^>]*>)","g"),"$1")).replace(new RegExp("(</?"+t+"[^>]*>)\\s*</p>","g"),"$1"),p&&(e=(e=(e=(e=e.replace(/<(script|style).*?<\/\\1>/g,(e=>e[0].replace(/\n/g,"<WPPreserveNewline />")))).replace(/<br>|<br\/>/g,"<br />")).replace(/(<br \/>)?\s*\n/g,((e,p)=>p?e:"<br />\n"))).replace(/<WPPreserveNewline \/>/g,"\n")),e=(e=(e=e.replace(new RegExp("(</?"+t+"[^>]*>)\\s*<br />","g"),"$1")).replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g,"$1")).replace(/\n<\/p>$/g,"</p>"),n.forEach((p=>{const[n,r]=p;e=e.replace(n,r)})),-1!==e.indexOf("\x3c!-- wpnl --\x3e")&&(e=e.replace(/\s?<!-- wpnl -->\s?/g,"\n")),e}function c(e){const p="blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure",n=p+"|div|p",r=p+"|pre",t=[];let c=!1,l=!1;return e?(-1===e.indexOf("<script")&&-1===e.indexOf("<style")||(e=e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,(e=>(t.push(e),"<wp-preserve>")))),-1!==e.indexOf("<pre")&&(c=!0,e=e.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g,(e=>(e=(e=e.replace(/<br ?\/?>(\r\n|\n)?/g,"<wp-line-break>")).replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"<wp-line-break>")).replace(/\r?\n/g,"<wp-line-break>")))),-1!==e.indexOf("[caption")&&(l=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,(e=>e.replace(/<br([^>]*)>/g,"<wp-temp-br$1>").replace(/[\r\n\t]+/,"")))),-1!==(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(new RegExp("\\s*</("+n+")>\\s*","g"),"</$1>\n")).replace(new RegExp("\\s*<((?:"+n+")(?: [^>]*)?)>","g"),"\n<$1>")).replace(/(<p [^>]+>[\s\S]*?)<\/p>/g,"$1</p#>")).replace(/<div( [^>]*)?>\s*<p>/gi,"<div$1>\n\n")).replace(/\s*<p>/gi,"")).replace(/\s*<\/p>\s*/gi,"\n\n")).replace(/\n[\s\u00a0]+\n/g,"\n\n")).replace(/(\s*)<br ?\/?>\s*/gi,((e,p)=>p&&-1!==p.indexOf("\n")?"\n\n":"\n"))).replace(/\s*<div/g,"\n<div")).replace(/<\/div>\s*/g,"</div>\n")).replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n")).replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption")).replace(new RegExp("\\s*<((?:"+r+")(?: [^>]*)?)\\s*>","g"),"\n<$1>")).replace(new RegExp("\\s*</("+r+")>\\s*","g"),"</$1>\n")).replace(/<((li|dt|dd)[^>]*)>/g," \t<$1>")).indexOf("<option")&&(e=(e=e.replace(/\s*<option/g,"\n<option")).replace(/\s*<\/select>/g,"\n</select>")),-1!==e.indexOf("<hr")&&(e=e.replace(/\s*<hr( [^>]*)?>\s*/g,"\n\n<hr$1>\n\n")),-1!==e.indexOf("<object")&&(e=e.replace(/<object[\s\S]+?<\/object>/g,(e=>e.replace(/[\r\n]+/g,"")))),e=(e=(e=(e=e.replace(/<\/p#>/g,"</p>\n")).replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g,"\n$1")).replace(/^\s+/,"")).replace(/[\s\u00a0]+$/,""),c&&(e=e.replace(/<wp-line-break>/g,"\n")),l&&(e=e.replace(/<wp-temp-br([^>]*)>/g,"<br$1>")),t.length&&(e=e.replace(/<wp-preserve>/g,(()=>t.shift()))),e):""}(window.wp=window.wp||{}).autop=p})(); dist/dom.min.js 0000644 00000030403 15125140777 0007417 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{__unstableStripHTML:()=>J,computeCaretRect:()=>b,documentHasSelection:()=>w,documentHasTextSelection:()=>N,documentHasUncollapsedSelection:()=>C,focus:()=>ct,getFilesFromDataTransfer:()=>st,getOffsetParent:()=>S,getPhrasingContentSchema:()=>et,getRectangleFromRange:()=>g,getScrollContainer:()=>v,insertAfter:()=>q,isEmpty:()=>K,isEntirelySelected:()=>A,isFormElement:()=>D,isHorizontalEdge:()=>H,isNumberInput:()=>V,isPhrasingContent:()=>nt,isRTL:()=>P,isSelectionForward:()=>L,isTextContent:()=>rt,isTextField:()=>E,isVerticalEdge:()=>B,placeCaretAtHorizontalEdge:()=>U,placeCaretAtVerticalEdge:()=>z,remove:()=>W,removeInvalidHTML:()=>at,replace:()=>k,replaceTag:()=>G,safeHTML:()=>$,unwrap:()=>X,wrap:()=>Y});var n={};t.r(n),t.d(n,{find:()=>i});var r={};function o(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0}function i(t,{sequential:e=!1}={}){const n=t.querySelectorAll(function(t){return[t?'[tabindex]:not([tabindex^="-"])':"[tabindex]","a[href]","button:not([disabled])",'input:not([type="hidden"]):not([disabled])',"select:not([disabled])","textarea:not([disabled])",'iframe:not([tabindex^="-"])',"object","embed","summary","area[href]","[contenteditable]:not([contenteditable=false])"].join(",")}(e));return Array.from(n).filter((t=>{if(!o(t))return!1;const{nodeName:e}=t;return"AREA"!==e||function(t){const e=t.closest("map[name]");if(!e)return!1;const n=t.ownerDocument.querySelector('img[usemap="#'+e.name+'"]');return!!n&&o(n)}(t)}))}function a(t){const e=t.getAttribute("tabindex");return null===e?0:parseInt(e,10)}function s(t){return-1!==a(t)}function c(t,e){return{element:t,index:e}}function u(t){return t.element}function l(t,e){const n=a(t.element),r=a(e.element);return n===r?t.index-e.index:n-r}function d(t){return t.filter(s).map(c).sort(l).map(u).reduce(function(){const t={};return function(e,n){const{nodeName:r,type:o,checked:i,name:a}=n;if("INPUT"!==r||"radio"!==o||!a)return e.concat(n);const s=t.hasOwnProperty(a);if(!i&&s)return e;if(s){const n=t[a];e=e.filter((t=>t!==n))}return t[a]=n,e.concat(n)}}(),[])}function f(t){return d(i(t))}function m(t){return d(i(t.ownerDocument.body)).reverse().find((e=>t.compareDocumentPosition(e)&t.DOCUMENT_POSITION_PRECEDING))}function h(t){return d(i(t.ownerDocument.body)).find((e=>t.compareDocumentPosition(e)&t.DOCUMENT_POSITION_FOLLOWING))}function p(t,e){0}function g(t){if(!t.collapsed){const e=Array.from(t.getClientRects());if(1===e.length)return e[0];const n=e.filter((({width:t})=>t>1));if(0===n.length)return t.getBoundingClientRect();if(1===n.length)return n[0];let{top:r,bottom:o,left:i,right:a}=n[0];for(const{top:t,bottom:e,left:s,right:c}of n)t<r&&(r=t),e>o&&(o=e),s<i&&(i=s),c>a&&(a=c);return new window.DOMRect(i,r,a-i,o-r)}const{startContainer:e}=t,{ownerDocument:n}=e;if("BR"===e.nodeName){const{parentNode:r}=e;p();const o=Array.from(r.childNodes).indexOf(e);p(),(t=n.createRange()).setStart(r,o),t.setEnd(r,o)}const r=t.getClientRects();if(r.length>1)return null;let o=r[0];if(!o||0===o.height){p();const e=n.createTextNode("");(t=t.cloneRange()).insertNode(e),o=t.getClientRects()[0],p(e.parentNode),e.parentNode.removeChild(e)}return o}function b(t){const e=t.getSelection();p();const n=e.rangeCount?e.getRangeAt(0):null;return n?g(n):null}function N(t){p(t.defaultView);const e=t.defaultView.getSelection();p();const n=e.rangeCount?e.getRangeAt(0):null;return!!n&&!n.collapsed}function y(t){return"INPUT"===t?.nodeName}function E(t){return y(t)&&t.type&&!["button","checkbox","hidden","file","radio","image","range","reset","submit","number","email","time"].includes(t.type)||"TEXTAREA"===t.nodeName||"true"===t.contentEditable}function C(t){return N(t)||!!t.activeElement&&function(t){if(!y(t)&&!E(t))return!1;try{const{selectionStart:e,selectionEnd:n}=t;return null===e||e!==n}catch(t){return!0}}(t.activeElement)}function w(t){return!!t.activeElement&&(y(t.activeElement)||E(t.activeElement)||N(t))}function T(t){return p(t.ownerDocument.defaultView),t.ownerDocument.defaultView.getComputedStyle(t)}function v(t,e="vertical"){if(t){if(("vertical"===e||"all"===e)&&t.scrollHeight>t.clientHeight){const{overflowY:e}=T(t);if(/(auto|scroll)/.test(e))return t}if(("horizontal"===e||"all"===e)&&t.scrollWidth>t.clientWidth){const{overflowX:e}=T(t);if(/(auto|scroll)/.test(e))return t}return t.ownerDocument===t.parentNode?t:v(t.parentNode,e)}}function S(t){let e;for(;(e=t.parentNode)&&e.nodeType!==e.ELEMENT_NODE;);return e?"static"!==T(e).position?e:e.offsetParent:null}function O(t){return"INPUT"===t.tagName||"TEXTAREA"===t.tagName}function A(t){if(O(t))return 0===t.selectionStart&&t.value.length===t.selectionEnd;if(!t.isContentEditable)return!0;const{ownerDocument:e}=t,{defaultView:n}=e;p();const r=n.getSelection();p();const o=r.rangeCount?r.getRangeAt(0):null;if(!o)return!0;const{startContainer:i,endContainer:a,startOffset:s,endOffset:c}=o;if(i===t&&a===t&&0===s&&c===t.childNodes.length)return!0;t.lastChild;p();const u=a.nodeType===a.TEXT_NODE?a.data.length:a.childNodes.length;return R(i,t,"firstChild")&&R(a,t,"lastChild")&&0===s&&c===u}function R(t,e,n){let r=e;do{if(t===r)return!0;r=r[n]}while(r);return!1}function D(t){if(!t)return!1;const{tagName:e}=t;return O(t)||"BUTTON"===e||"SELECT"===e}function P(t){return"rtl"===T(t).direction}function L(t){const{anchorNode:e,focusNode:n,anchorOffset:r,focusOffset:o}=t;p(),p();const i=e.compareDocumentPosition(n);return!(i&e.DOCUMENT_POSITION_PRECEDING)&&(!!(i&e.DOCUMENT_POSITION_FOLLOWING)||(0!==i||r<=o))}function M(t,e,n,r){const o=r.style.zIndex,i=r.style.position,{position:a="static"}=T(r);"static"===a&&(r.style.position="relative"),r.style.zIndex="10000";const s=function(t,e,n){if(t.caretRangeFromPoint)return t.caretRangeFromPoint(e,n);if(!t.caretPositionFromPoint)return null;const r=t.caretPositionFromPoint(e,n);if(!r)return null;const o=t.createRange();return o.setStart(r.offsetNode,r.offset),o.collapse(!0),o}(t,e,n);return r.style.zIndex=o,r.style.position=i,s}function x(t,e,n){let r=n();return r&&r.startContainer&&t.contains(r.startContainer)||(t.scrollIntoView(e),r=n(),r&&r.startContainer&&t.contains(r.startContainer))?r:null}function I(t,e,n=!1){if(O(t)&&"number"==typeof t.selectionStart)return t.selectionStart===t.selectionEnd&&(e?0===t.selectionStart:t.value.length===t.selectionStart);if(!t.isContentEditable)return!0;const{ownerDocument:r}=t,{defaultView:o}=r;p();const i=o.getSelection();if(!i||!i.rangeCount)return!1;const a=i.getRangeAt(0),s=a.cloneRange(),c=L(i),u=i.isCollapsed;u||s.collapse(!c);const l=g(s),d=g(a);if(!l||!d)return!1;const f=function(t){const e=Array.from(t.getClientRects());if(!e.length)return;const n=Math.min(...e.map((({top:t})=>t)));return Math.max(...e.map((({bottom:t})=>t)))-n}(a);if(!u&&f&&f>l.height&&c===e)return!1;const m=P(t)?!e:e,h=t.getBoundingClientRect(),b=m?h.left+1:h.right-1,N=e?h.top+1:h.bottom-1,y=x(t,e,(()=>M(r,b,N,t)));if(!y)return!1;const E=g(y);if(!E)return!1;const C=e?"top":"bottom",w=m?"left":"right",T=E[C]-d[C],v=E[w]-l[w],S=Math.abs(T)<=1,A=Math.abs(v)<=1;return n?S:S&&A}function H(t,e){return I(t,e)}t.r(r),t.d(r,{find:()=>f,findNext:()=>h,findPrevious:()=>m,isTabbableIndex:()=>s});const _=window.wp.deprecated;var F=t.n(_);function V(t){return F()("wp.dom.isNumberInput",{since:"6.1",version:"6.5"}),y(t)&&"number"===t.type&&!isNaN(t.valueAsNumber)}function B(t,e){return I(t,e,!0)}function j(t,e,n){if(!t)return;if(t.focus(),O(t)){if("number"!=typeof t.selectionStart)return;return void(e?(t.selectionStart=t.value.length,t.selectionEnd=t.value.length):(t.selectionStart=0,t.selectionEnd=0))}if(!t.isContentEditable)return;const r=x(t,e,(()=>function(t,e,n){const{ownerDocument:r}=t,o=P(t)?!e:e,i=t.getBoundingClientRect();return void 0===n?n=e?i.right-1:i.left+1:n<=i.left?n=i.left+1:n>=i.right&&(n=i.right-1),M(r,n,o?i.bottom-1:i.top+1,t)}(t,e,n)));if(!r)return;const{ownerDocument:o}=t,{defaultView:i}=o;p();const a=i.getSelection();p(),a.removeAllRanges(),a.addRange(r)}function U(t,e){return j(t,e,void 0)}function z(t,e,n){return j(t,e,n?.left)}function q(t,e){p(e.parentNode),e.parentNode.insertBefore(t,e.nextSibling)}function W(t){p(t.parentNode),t.parentNode.removeChild(t)}function k(t,e){p(t.parentNode),q(e,t.parentNode),W(t)}function X(t){const e=t.parentNode;for(p();t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}function G(t,e){const n=t.ownerDocument.createElement(e);for(;t.firstChild;)n.appendChild(t.firstChild);return p(t.parentNode),t.parentNode.replaceChild(n,t),n}function Y(t,e){p(e.parentNode),e.parentNode.insertBefore(t,e),t.appendChild(e)}function $(t){const{body:e}=document.implementation.createHTMLDocument("");e.innerHTML=t;const n=e.getElementsByTagName("*");let r=n.length;for(;r--;){const t=n[r];if("SCRIPT"===t.tagName)W(t);else{let e=t.attributes.length;for(;e--;){const{name:n}=t.attributes[e];n.startsWith("on")&&t.removeAttribute(n)}}}return e.innerHTML}function J(t){t=$(t);const e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body.textContent||""}function K(t){switch(t.nodeType){case t.TEXT_NODE:return/^[ \f\n\r\t\v\u00a0]*$/.test(t.nodeValue||"");case t.ELEMENT_NODE:return!t.hasAttributes()&&(!t.hasChildNodes()||Array.from(t.childNodes).every(K));default:return!0}}const Q={strong:{},em:{},s:{},del:{},ins:{},a:{attributes:["href","target","rel","id"]},code:{},abbr:{attributes:["title"]},sub:{},sup:{},br:{},small:{},q:{attributes:["cite"]},dfn:{attributes:["title"]},data:{attributes:["value"]},time:{attributes:["datetime"]},var:{},samp:{},kbd:{},i:{},b:{},u:{},mark:{},ruby:{},rt:{},rp:{},bdi:{attributes:["dir"]},bdo:{attributes:["dir"]},wbr:{},"#text":{}},Z=["#text","br"];Object.keys(Q).filter((t=>!Z.includes(t))).forEach((t=>{const{[t]:e,...n}=Q;Q[t].children=n}));const tt={...Q,audio:{attributes:["src","preload","autoplay","mediagroup","loop","muted"]},canvas:{attributes:["width","height"]},embed:{attributes:["src","type","width","height"]},img:{attributes:["alt","src","srcset","usemap","ismap","width","height"]},object:{attributes:["data","type","name","usemap","form","width","height"]},video:{attributes:["src","poster","preload","playsinline","autoplay","mediagroup","loop","muted","controls","width","height"]}};function et(t){if("paste"!==t)return tt;const{u:e,abbr:n,data:r,time:o,wbr:i,bdi:a,bdo:s,...c}={...tt,ins:{children:tt.ins.children},del:{children:tt.del.children}};return c}function nt(t){const e=t.nodeName.toLowerCase();return et().hasOwnProperty(e)||"span"===e}function rt(t){const e=t.nodeName.toLowerCase();return Q.hasOwnProperty(e)||"span"===e}const ot=()=>{};function it(t,e,n,r){Array.from(t).forEach((t=>{const o=t.nodeName.toLowerCase();if(!n.hasOwnProperty(o)||n[o].isMatch&&!n[o].isMatch?.(t))it(t.childNodes,e,n,r),r&&!nt(t)&&t.nextElementSibling&&q(e.createElement("br"),t),X(t);else if(function(t){return!!t&&t.nodeType===t.ELEMENT_NODE}(t)){const{attributes:i=[],classes:a=[],children:s,require:c=[],allowEmpty:u}=n[o];if(s&&!u&&K(t))return void W(t);if(t.hasAttributes()&&(Array.from(t.attributes).forEach((({name:e})=>{"class"===e||i.includes(e)||t.removeAttribute(e)})),t.classList&&t.classList.length)){const e=a.map((t=>"*"===t?()=>!0:"string"==typeof t?e=>e===t:t instanceof RegExp?e=>t.test(e):ot));Array.from(t.classList).forEach((n=>{e.some((t=>t(n)))||t.classList.remove(n)})),t.classList.length||t.removeAttribute("class")}if(t.hasChildNodes()){if("*"===s)return;if(s)c.length&&!t.querySelector(c.join(","))?(it(t.childNodes,e,n,r),X(t)):t.parentNode&&"BODY"===t.parentNode.nodeName&&nt(t)?(it(t.childNodes,e,n,r),Array.from(t.childNodes).some((t=>!nt(t)))&&X(t)):it(t.childNodes,e,s,r);else for(;t.firstChild;)W(t.firstChild)}}}))}function at(t,e,n){const r=document.implementation.createHTMLDocument("");return r.body.innerHTML=t,it(r.body.childNodes,r,e,n),r.body.innerHTML}function st(t){const e=Array.from(t.files);return Array.from(t.items).forEach((t=>{const n=t.getAsFile();n&&!e.find((({name:t,type:e,size:r})=>t===n.name&&e===n.type&&r===n.size))&&e.push(n)})),e}const ct={focusable:n,tabbable:r};(window.wp=window.wp||{}).dom=e})(); dist/widgets.min.js 0000644 00000047102 15125140777 0010312 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={n:t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MoveToWidgetArea:()=>X,addWidgetIdToBlock:()=>K,getWidgetIdFromBlock:()=>q,registerLegacyWidgetBlock:()=>ee,registerLegacyWidgetVariations:()=>Y,registerWidgetGroupBlock:()=>te});var i={};e.r(i),e.d(i,{yu:()=>W,UU:()=>A,W0:()=>O});var n={};e.r(n),e.d(n,{yu:()=>$,UU:()=>Q,W0:()=>Z});const s=window.wp.blocks,r=window.wp.primitives,o=window.ReactJSXRuntime,a=(0,o.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(r.Path,{d:"M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z"})});function c(e){var t,i,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(i=c(e[t]))&&(n&&(n+=" "),n+=i)}else for(i in e)e[i]&&(n&&(n+=" "),n+=i);return n}const l=function(){for(var e,t,i=0,n="",s=arguments.length;i<s;i++)(e=arguments[i])&&(t=c(e))&&(n&&(n+=" "),n+=t);return n},d=window.wp.blockEditor,h=window.wp.components,u=(0,o.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(r.Path,{d:"M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"})}),m=window.wp.i18n,w=window.wp.element,g=window.wp.coreData,p=window.wp.data;function f({selectedId:e,onSelect:t}){const i=(0,p.useSelect)((e=>{var t;const i=null!==(t=e(d.store).getSettings()?.widgetTypesToHideFromLegacyWidgetBlock)&&void 0!==t?t:[];return e(g.store).getWidgetTypes({per_page:-1})?.filter((e=>!i.includes(e.id)))}),[]);return i?0===i.length?(0,m.__)("There are no widgets available."):(0,o.jsx)(h.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,m.__)("Legacy widget"),value:null!=e?e:"",options:[{value:"",label:(0,m.__)("Select widget")},...i.map((e=>({value:e.id,label:e.name})))],onChange:e=>{if(e){const n=i.find((t=>t.id===e));t({selectedId:n.id,isMulti:n.is_multi})}else t({selectedId:null})}}):(0,o.jsx)(h.Spinner,{})}function b({name:e,description:t}){return(0,o.jsxs)("div",{className:"wp-block-legacy-widget-inspector-card",children:[(0,o.jsx)("h3",{className:"wp-block-legacy-widget-inspector-card__name",children:e}),(0,o.jsx)("span",{children:t})]})}const v=window.wp.notices,y=window.wp.compose,_=window.wp.apiFetch;var x=e.n(_);class j{constructor({id:e,idBase:t,instance:i,onChangeInstance:n,onChangeHasPreview:s,onError:r}){this.id=e,this.idBase=t,this._instance=i,this._hasPreview=null,this.onChangeInstance=n,this.onChangeHasPreview=s,this.onError=r,this.number=++k,this.handleFormChange=(0,y.debounce)(this.handleFormChange.bind(this),200),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.initDOM(),this.bindEvents(),this.loadContent()}destroy(){this.unbindEvents(),this.element.remove()}initDOM(){var e,t;this.element=B("div",{class:"widget open"},[B("div",{class:"widget-inside"},[this.form=B("form",{class:"form",method:"post"},[B("input",{class:"widget-id",type:"hidden",name:"widget-id",value:null!==(e=this.id)&&void 0!==e?e:`${this.idBase}-${this.number}`}),B("input",{class:"id_base",type:"hidden",name:"id_base",value:null!==(t=this.idBase)&&void 0!==t?t:this.id}),B("input",{class:"widget-width",type:"hidden",name:"widget-width",value:"250"}),B("input",{class:"widget-height",type:"hidden",name:"widget-height",value:"200"}),B("input",{class:"widget_number",type:"hidden",name:"widget_number",value:this.idBase?this.number.toString():""}),this.content=B("div",{class:"widget-content"}),this.id&&B("button",{class:"button is-primary",type:"submit"},(0,m.__)("Save"))])])])}bindEvents(){if(window.jQuery){const{jQuery:e}=window;e(this.form).on("change",null,this.handleFormChange),e(this.form).on("input",null,this.handleFormChange),e(this.form).on("submit",this.handleFormSubmit)}else this.form.addEventListener("change",this.handleFormChange),this.form.addEventListener("input",this.handleFormChange),this.form.addEventListener("submit",this.handleFormSubmit)}unbindEvents(){if(window.jQuery){const{jQuery:e}=window;e(this.form).off("change",null,this.handleFormChange),e(this.form).off("input",null,this.handleFormChange),e(this.form).off("submit",this.handleFormSubmit)}else this.form.removeEventListener("change",this.handleFormChange),this.form.removeEventListener("input",this.handleFormChange),this.form.removeEventListener("submit",this.handleFormSubmit)}async loadContent(){try{if(this.id){const{form:e}=await C(this.id);this.content.innerHTML=e}else if(this.idBase){const{form:e,preview:t}=await S({idBase:this.idBase,instance:this.instance,number:this.number});if(this.content.innerHTML=e,this.hasPreview=!T(t),!this.instance.hash){const{instance:e}=await S({idBase:this.idBase,instance:this.instance,number:this.number,formData:M(this.form)});this.instance=e}}if(window.jQuery){const{jQuery:e}=window;e(document).trigger("widget-added",[e(this.element)])}}catch(e){this.onError(e)}}handleFormChange(){this.idBase&&this.saveForm()}handleFormSubmit(e){e.preventDefault(),this.saveForm()}async saveForm(){const e=M(this.form);try{if(this.id){const{form:t}=await C(this.id,e);if(this.content.innerHTML=t,window.jQuery){const{jQuery:e}=window;e(document).trigger("widget-updated",[e(this.element)])}}else if(this.idBase){const{instance:t,preview:i}=await S({idBase:this.idBase,instance:this.instance,number:this.number,formData:e});this.instance=t,this.hasPreview=!T(i)}}catch(e){this.onError(e)}}get instance(){return this._instance}set instance(e){this._instance!==e&&(this._instance=e,this.onChangeInstance(e))}get hasPreview(){return this._hasPreview}set hasPreview(e){this._hasPreview!==e&&(this._hasPreview=e,this.onChangeHasPreview(e))}}let k=0;function B(e,t={},i=null){const n=document.createElement(e);for(const[e,i]of Object.entries(t))n.setAttribute(e,i);if(Array.isArray(i))for(const e of i)e&&n.appendChild(e);else"string"==typeof i&&(n.innerText=i);return n}async function C(e,t=null){let i;return i=t?await x()({path:`/wp/v2/widgets/${e}?context=edit`,method:"PUT",data:{form_data:t}}):await x()({path:`/wp/v2/widgets/${e}?context=edit`,method:"GET"}),{form:i.rendered_form}}async function S({idBase:e,instance:t,number:i,formData:n=null}){const s=await x()({path:`/wp/v2/widget-types/${e}/encode`,method:"POST",data:{instance:t,number:i,form_data:n}});return{instance:s.instance,form:s.form,preview:s.preview}}function T(e){const t=document.createElement("div");return t.innerHTML=e,H(t)}function H(e){switch(e.nodeType){case e.TEXT_NODE:return""===e.nodeValue.trim();case e.ELEMENT_NODE:return!["AUDIO","CANVAS","EMBED","IFRAME","IMG","MATH","OBJECT","SVG","VIDEO"].includes(e.tagName)&&(!e.hasChildNodes()||Array.from(e.childNodes).every(H));default:return!0}}function M(e){return new window.URLSearchParams(Array.from(new window.FormData(e))).toString()}function I({title:e,isVisible:t,id:i,idBase:n,instance:s,isWide:r,onChangeInstance:a,onChangeHasPreview:c}){const d=(0,w.useRef)(),u=(0,y.useViewportMatch)("small"),g=(0,w.useRef)(new Set),f=(0,w.useRef)(new Set),{createNotice:b}=(0,p.useDispatch)(v.store);return(0,w.useEffect)((()=>{if(f.current.has(s))return void f.current.delete(s);const e=new j({id:i,idBase:n,instance:s,onChangeInstance(e){g.current.add(s),f.current.add(e),a(e)},onChangeHasPreview:c,onError(e){window.console.error(e),b("error",(0,m.sprintf)((0,m.__)('The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'),n||i))}});return d.current.appendChild(e.element),()=>{g.current.has(s)?g.current.delete(s):e.destroy()}}),[i,n,s,a,c,u]),r&&u?(0,o.jsxs)("div",{className:l({"wp-block-legacy-widget__container":t}),children:[t&&(0,o.jsx)("h3",{className:"wp-block-legacy-widget__edit-form-title",children:e}),(0,o.jsx)(h.Popover,{focusOnMount:!1,placement:"right",offset:32,resize:!1,flip:!1,shift:!0,children:(0,o.jsx)("div",{ref:d,className:"wp-block-legacy-widget__edit-form",hidden:!t})})]}):(0,o.jsx)("div",{ref:d,className:"wp-block-legacy-widget__edit-form",hidden:!t,children:(0,o.jsx)("h3",{className:"wp-block-legacy-widget__edit-form-title",children:e})})}function V({idBase:e,instance:t,isVisible:i}){const[n,s]=(0,w.useState)(!1),[r,a]=(0,w.useState)("");(0,w.useEffect)((()=>{const i=void 0===window.AbortController?void 0:new window.AbortController;return async function(){const n=`/wp/v2/widget-types/${e}/render`;return await x()({path:n,method:"POST",signal:i?.signal,data:t?{instance:t}:{}})}().then((e=>{a(e.preview)})).catch((e=>{if("AbortError"!==e.name)throw e})),()=>i?.abort()}),[e,t]);const c=(0,y.useRefEffect)((e=>{if(!n)return;function t(){var t,i;const n=Math.max(null!==(t=e.contentDocument.documentElement?.offsetHeight)&&void 0!==t?t:0,null!==(i=e.contentDocument.body?.offsetHeight)&&void 0!==i?i:0);e.style.height=`${0!==n?n:100}px`}const{IntersectionObserver:i}=e.ownerDocument.defaultView,s=new i((([e])=>{e.isIntersecting&&t()}),{threshold:1});return s.observe(e),e.addEventListener("load",t),()=>{s.disconnect(),e.removeEventListener("load",t)}}),[n]);return(0,o.jsxs)(o.Fragment,{children:[i&&!n&&(0,o.jsx)(h.Placeholder,{children:(0,o.jsx)(h.Spinner,{})}),(0,o.jsx)("div",{className:l("wp-block-legacy-widget__edit-preview",{"is-offscreen":!i||!n}),children:(0,o.jsx)(h.Disabled,{children:(0,o.jsx)("iframe",{ref:c,className:"wp-block-legacy-widget__edit-preview-iframe",tabIndex:"-1",title:(0,m.__)("Legacy Widget Preview"),srcDoc:r,onLoad:e=>{e.target.contentDocument.body.style.overflow="hidden",s(!0)},height:100})})})]})}function P({name:e}){return(0,o.jsxs)("div",{className:"wp-block-legacy-widget__edit-no-preview",children:[e&&(0,o.jsx)("h3",{children:e}),(0,o.jsx)("p",{children:(0,m.__)("No preview available.")})]})}function E({clientId:e,rawInstance:t}){const{replaceBlocks:i}=(0,p.useDispatch)(d.store);return(0,o.jsx)(h.ToolbarButton,{onClick:()=>{t.title?i(e,[(0,s.createBlock)("core/heading",{content:t.title}),...(0,s.rawHandler)({HTML:t.text})]):i(e,(0,s.rawHandler)({HTML:t.text}))},children:(0,m.__)("Convert to blocks")})}function F({attributes:{id:e,idBase:t},setAttributes:i}){return(0,o.jsx)(h.Placeholder,{icon:(0,o.jsx)(d.BlockIcon,{icon:u}),label:(0,m.__)("Legacy Widget"),children:(0,o.jsx)(h.Flex,{children:(0,o.jsx)(h.FlexBlock,{children:(0,o.jsx)(f,{selectedId:null!=e?e:t,onSelect:({selectedId:e,isMulti:t})=>{i(e?t?{id:null,idBase:e,instance:{}}:{id:e,idBase:null,instance:null}:{id:null,idBase:null,instance:null})}})})})})}function N({attributes:{id:e,idBase:t,instance:i},setAttributes:n,clientId:s,isSelected:r,isWide:a=!1}){const[c,l]=(0,w.useState)(null),p=null!=e?e:t,{record:f,hasResolved:v}=(0,g.useEntityRecord)("root","widgetType",p),y=(0,w.useCallback)((e=>{n({instance:e})}),[]);if(!f&&v)return(0,o.jsx)(h.Placeholder,{icon:(0,o.jsx)(d.BlockIcon,{icon:u}),label:(0,m.__)("Legacy Widget"),children:(0,m.__)("Widget is missing.")});if(!v)return(0,o.jsx)(h.Placeholder,{children:(0,o.jsx)(h.Spinner,{})});const _=t&&!r?"preview":"edit";return(0,o.jsxs)(o.Fragment,{children:["text"===t&&(0,o.jsx)(d.BlockControls,{group:"other",children:(0,o.jsx)(E,{clientId:s,rawInstance:i.raw})}),(0,o.jsx)(d.InspectorControls,{children:(0,o.jsx)(b,{name:f.name,description:f.description})}),(0,o.jsx)(I,{title:f.name,isVisible:"edit"===_,id:e,idBase:t,instance:i,isWide:a,onChangeInstance:y,onChangeHasPreview:l}),t&&(0,o.jsxs)(o.Fragment,{children:[null===c&&"preview"===_&&(0,o.jsx)(h.Placeholder,{children:(0,o.jsx)(h.Spinner,{})}),!0===c&&(0,o.jsx)(V,{idBase:t,instance:i,isVisible:"preview"===_}),!1===c&&"preview"===_&&(0,o.jsx)(P,{name:f.name})]})]})}const L=[{block:"core/calendar",widget:"calendar"},{block:"core/search",widget:"search"},{block:"core/html",widget:"custom_html",transform:({content:e})=>({content:e})},{block:"core/archives",widget:"archives",transform:({count:e,dropdown:t})=>({displayAsDropdown:!!t,showPostCounts:!!e})},{block:"core/latest-posts",widget:"recent-posts",transform:({show_date:e,number:t})=>({displayPostDate:!!e,postsToShow:t})},{block:"core/latest-comments",widget:"recent-comments",transform:({number:e})=>({commentsToShow:e})},{block:"core/tag-cloud",widget:"tag_cloud",transform:({taxonomy:e,count:t})=>({showTagCounts:!!t,taxonomy:e})},{block:"core/categories",widget:"categories",transform:({count:e,dropdown:t,hierarchical:i})=>({displayAsDropdown:!!t,showPostCounts:!!e,showHierarchy:!!i})},{block:"core/audio",widget:"media_audio",transform:({url:e,preload:t,loop:i,attachment_id:n})=>({src:e,id:n,preload:t,loop:i})},{block:"core/video",widget:"media_video",transform:({url:e,preload:t,loop:i,attachment_id:n})=>({src:e,id:n,preload:t,loop:i})},{block:"core/image",widget:"media_image",transform:({alt:e,attachment_id:t,caption:i,height:n,link_classes:s,link_rel:r,link_target_blank:o,link_type:a,link_url:c,size:l,url:d,width:h})=>({alt:e,caption:i,height:n,id:t,link:c,linkClass:s,linkDestination:a,linkTarget:o?"_blank":void 0,rel:r,sizeSlug:l,url:d,width:h})},{block:"core/gallery",widget:"media_gallery",transform:({ids:e,link_type:t,size:i,number:n})=>({ids:e,columns:n,linkTo:t,sizeSlug:i,images:e.map((e=>({id:e})))})},{block:"core/rss",widget:"rss",transform:({url:e,show_author:t,show_date:i,show_summary:n,items:s})=>({feedURL:e,displayAuthor:!!t,displayDate:!!i,displayExcerpt:!!n,itemsToShow:s})}].map((({block:e,widget:t,transform:i})=>({type:"block",blocks:[e],isMatch:({idBase:e,instance:i})=>e===t&&!!i?.raw,transform:({instance:t})=>{const n=(0,s.createBlock)(e,i?i(t.raw):void 0);return t.raw?.title?[(0,s.createBlock)("core/heading",{content:t.raw.title}),n]:n}}))),D={to:L},W={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/legacy-widget",title:"Legacy Widget",category:"widgets",description:"Display a legacy widget.",textdomain:"default",attributes:{id:{type:"string",default:null},idBase:{type:"string",default:null},instance:{type:"object",default:null}},supports:{html:!1,customClassName:!1,reusable:!1},editorStyle:"wp-block-legacy-widget-editor"},{name:A}=W,O={icon:a,edit:function(e){const{id:t,idBase:i}=e.attributes,{isWide:n=!1}=e,s=(0,d.useBlockProps)({className:l({"is-wide-widget":n})});return(0,o.jsx)("div",{...s,children:t||i?(0,o.jsx)(N,{...e}):(0,o.jsx)(F,{...e})})},transforms:D},z=(0,o.jsx)(r.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(r.Path,{d:"M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z"})});function R({clientId:e}){return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(h.Placeholder,{className:"wp-block-widget-group__placeholder",icon:(0,o.jsx)(d.BlockIcon,{icon:z}),label:(0,m.__)("Widget Group"),children:(0,o.jsx)(d.ButtonBlockAppender,{rootClientId:e})}),(0,o.jsx)(d.InnerBlocks,{renderAppender:!1})]})}function G({attributes:e,setAttributes:t}){var i;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.RichText,{tagName:"h2",identifier:"title",className:"widget-title",allowedFormats:[],placeholder:(0,m.__)("Title"),value:null!==(i=e.title)&&void 0!==i?i:"",onChange:e=>t({title:e})}),(0,o.jsx)(d.InnerBlocks,{})]})}const U=[{attributes:{title:{type:"string"}},supports:{html:!1,inserter:!0,customClassName:!0,reusable:!1},save:({attributes:e})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.RichText.Content,{tagName:"h2",className:"widget-title",value:e.title}),(0,o.jsx)(d.InnerBlocks.Content,{})]})}],$={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/widget-group",title:"Widget Group",category:"widgets",attributes:{title:{type:"string"}},supports:{html:!1,inserter:!0,customClassName:!0,reusable:!1},editorStyle:"wp-block-widget-group-editor",style:"wp-block-widget-group"},{name:Q}=$,Z={title:(0,m.__)("Widget Group"),description:(0,m.__)("Create a classic widget layout with a title that’s styled by your theme for your widget areas."),icon:z,__experimentalLabel:({name:e})=>e,edit:function(e){const{clientId:t}=e,{innerBlocks:i}=(0,p.useSelect)((e=>e(d.store).getBlock(t)),[t]);return(0,o.jsx)("div",{...(0,d.useBlockProps)({className:"widget"}),children:0===i.length?(0,o.jsx)(R,{...e}):(0,o.jsx)(G,{...e})})},save:function({attributes:e}){return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.RichText.Content,{tagName:"h2",className:"widget-title",value:e.title}),(0,o.jsx)("div",{className:"wp-widget-group__inner-blocks",children:(0,o.jsx)(d.InnerBlocks.Content,{})})]})},transforms:{from:[{type:"block",isMultiBlock:!0,blocks:["*"],isMatch:(e,t)=>!t.some((e=>"core/widget-group"===e.name)),__experimentalConvert(e){let t=[...e.map((e=>(0,s.createBlock)(e.name,e.attributes,e.innerBlocks)))];const i="core/heading"===t[0].name?t[0]:null;return t=t.filter((e=>e!==i)),(0,s.createBlock)("core/widget-group",{...i&&{title:i.attributes.content}},t)}}]},deprecated:U},J=(0,o.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(r.Path,{d:"M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z"})});function X({currentWidgetAreaId:e,widgetAreas:t,onSelect:i}){return(0,o.jsx)(h.ToolbarGroup,{children:(0,o.jsx)(h.ToolbarItem,{children:n=>(0,o.jsx)(h.DropdownMenu,{icon:J,label:(0,m.__)("Move to widget area"),toggleProps:n,children:({onClose:n})=>(0,o.jsx)(h.MenuGroup,{label:(0,m.__)("Move to"),children:(0,o.jsx)(h.MenuItemsChoice,{choices:t.map((e=>({value:e.id,label:e.name,info:e.description}))),value:e,onSelect:e=>{i(e),n()}})})})})})}function q(e){return e.attributes.__internalWidgetId}function K(e,t){return{...e,attributes:{...e.attributes||{},__internalWidgetId:t}}}function Y(e){const t=(0,p.subscribe)((()=>{var i;const n=null!==(i=e?.widgetTypesToHideFromLegacyWidgetBlock)&&void 0!==i?i:[],r=(0,p.select)(g.store).getWidgetTypes({per_page:-1})?.filter((e=>!n.includes(e.id)));r&&(t(),(0,p.dispatch)(s.store).addBlockVariations("core/legacy-widget",r.map((e=>({name:e.id,title:e.name,description:e.description,attributes:e.is_multi?{idBase:e.id,instance:{}}:{id:e.id}})))))}))}function ee(e={}){const{yu:t,W0:n,UU:r}=i;(0,s.registerBlockType)({name:r,...t},{...n,supports:{...n.supports,...e}})}function te(e={}){const{yu:t,W0:i,UU:r}=n;(0,s.registerBlockType)({name:r,...t},{...i,supports:{...i.supports,...e}})}(window.wp=window.wp||{}).widgets=t})(); dist/block-editor.js 0000644 00012310771 15125140777 0010450 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 197: /***/ (() => { /* (ignored) */ /***/ }), /***/ 271: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let LazyResult, Processor class Document extends Container { constructor(defaults) { // type needs to be passed to super, otherwise child roots won't be normalized correctly super({ type: 'document', ...defaults }) if (!this.nodes) { this.nodes = [] } } toResult(opts = {}) { let lazy = new LazyResult(new Processor(), this, opts) return lazy.stringify() } } Document.registerLazyResult = dependant => { LazyResult = dependant } Document.registerProcessor = dependant => { Processor = dependant } module.exports = Document Document.default = Document /***/ }), /***/ 346: /***/ ((module) => { "use strict"; const DEFAULT_RAW = { after: '\n', beforeClose: '\n', beforeComment: '\n', beforeDecl: '\n', beforeOpen: ' ', beforeRule: '\n', colon: ': ', commentLeft: ' ', commentRight: ' ', emptyBody: '', indent: ' ', semicolon: false } function capitalize(str) { return str[0].toUpperCase() + str.slice(1) } class Stringifier { constructor(builder) { this.builder = builder } atrule(node, semicolon) { let name = '@' + node.name let params = node.params ? this.rawValue(node, 'params') : '' if (typeof node.raws.afterName !== 'undefined') { name += node.raws.afterName } else if (params) { name += ' ' } if (node.nodes) { this.block(node, name + params) } else { let end = (node.raws.between || '') + (semicolon ? ';' : '') this.builder(name + params + end, node) } } beforeAfter(node, detect) { let value if (node.type === 'decl') { value = this.raw(node, null, 'beforeDecl') } else if (node.type === 'comment') { value = this.raw(node, null, 'beforeComment') } else if (detect === 'before') { value = this.raw(node, null, 'beforeRule') } else { value = this.raw(node, null, 'beforeClose') } let buf = node.parent let depth = 0 while (buf && buf.type !== 'root') { depth += 1 buf = buf.parent } if (value.includes('\n')) { let indent = this.raw(node, null, 'indent') if (indent.length) { for (let step = 0; step < depth; step++) value += indent } } return value } block(node, start) { let between = this.raw(node, 'between', 'beforeOpen') this.builder(start + between + '{', node, 'start') let after if (node.nodes && node.nodes.length) { this.body(node) after = this.raw(node, 'after') } else { after = this.raw(node, 'after', 'emptyBody') } if (after) this.builder(after) this.builder('}', node, 'end') } body(node) { let last = node.nodes.length - 1 while (last > 0) { if (node.nodes[last].type !== 'comment') break last -= 1 } let semicolon = this.raw(node, 'semicolon') for (let i = 0; i < node.nodes.length; i++) { let child = node.nodes[i] let before = this.raw(child, 'before') if (before) this.builder(before) this.stringify(child, last !== i || semicolon) } } comment(node) { let left = this.raw(node, 'left', 'commentLeft') let right = this.raw(node, 'right', 'commentRight') this.builder('/*' + left + node.text + right + '*/', node) } decl(node, semicolon) { let between = this.raw(node, 'between', 'colon') let string = node.prop + between + this.rawValue(node, 'value') if (node.important) { string += node.raws.important || ' !important' } if (semicolon) string += ';' this.builder(string, node) } document(node) { this.body(node) } raw(node, own, detect) { let value if (!detect) detect = own // Already had if (own) { value = node.raws[own] if (typeof value !== 'undefined') return value } let parent = node.parent if (detect === 'before') { // Hack for first rule in CSS if (!parent || (parent.type === 'root' && parent.first === node)) { return '' } // `root` nodes in `document` should use only their own raws if (parent && parent.type === 'document') { return '' } } // Floating child without parent if (!parent) return DEFAULT_RAW[detect] // Detect style by other nodes let root = node.root() if (!root.rawCache) root.rawCache = {} if (typeof root.rawCache[detect] !== 'undefined') { return root.rawCache[detect] } if (detect === 'before' || detect === 'after') { return this.beforeAfter(node, detect) } else { let method = 'raw' + capitalize(detect) if (this[method]) { value = this[method](root, node) } else { root.walk(i => { value = i.raws[own] if (typeof value !== 'undefined') return false }) } } if (typeof value === 'undefined') value = DEFAULT_RAW[detect] root.rawCache[detect] = value return value } rawBeforeClose(root) { let value root.walk(i => { if (i.nodes && i.nodes.length > 0) { if (typeof i.raws.after !== 'undefined') { value = i.raws.after if (value.includes('\n')) { value = value.replace(/[^\n]+$/, '') } return false } } }) if (value) value = value.replace(/\S/g, '') return value } rawBeforeComment(root, node) { let value root.walkComments(i => { if (typeof i.raws.before !== 'undefined') { value = i.raws.before if (value.includes('\n')) { value = value.replace(/[^\n]+$/, '') } return false } }) if (typeof value === 'undefined') { value = this.raw(node, null, 'beforeDecl') } else if (value) { value = value.replace(/\S/g, '') } return value } rawBeforeDecl(root, node) { let value root.walkDecls(i => { if (typeof i.raws.before !== 'undefined') { value = i.raws.before if (value.includes('\n')) { value = value.replace(/[^\n]+$/, '') } return false } }) if (typeof value === 'undefined') { value = this.raw(node, null, 'beforeRule') } else if (value) { value = value.replace(/\S/g, '') } return value } rawBeforeOpen(root) { let value root.walk(i => { if (i.type !== 'decl') { value = i.raws.between if (typeof value !== 'undefined') return false } }) return value } rawBeforeRule(root) { let value root.walk(i => { if (i.nodes && (i.parent !== root || root.first !== i)) { if (typeof i.raws.before !== 'undefined') { value = i.raws.before if (value.includes('\n')) { value = value.replace(/[^\n]+$/, '') } return false } } }) if (value) value = value.replace(/\S/g, '') return value } rawColon(root) { let value root.walkDecls(i => { if (typeof i.raws.between !== 'undefined') { value = i.raws.between.replace(/[^\s:]/g, '') return false } }) return value } rawEmptyBody(root) { let value root.walk(i => { if (i.nodes && i.nodes.length === 0) { value = i.raws.after if (typeof value !== 'undefined') return false } }) return value } rawIndent(root) { if (root.raws.indent) return root.raws.indent let value root.walk(i => { let p = i.parent if (p && p !== root && p.parent && p.parent === root) { if (typeof i.raws.before !== 'undefined') { let parts = i.raws.before.split('\n') value = parts[parts.length - 1] value = value.replace(/\S/g, '') return false } } }) return value } rawSemicolon(root) { let value root.walk(i => { if (i.nodes && i.nodes.length && i.last.type === 'decl') { value = i.raws.semicolon if (typeof value !== 'undefined') return false } }) return value } rawValue(node, prop) { let value = node[prop] let raw = node.raws[prop] if (raw && raw.value === value) { return raw.raw } return value } root(node) { this.body(node) if (node.raws.after) this.builder(node.raws.after) } rule(node) { this.block(node, this.rawValue(node, 'selector')) if (node.raws.ownSemicolon) { this.builder(node.raws.ownSemicolon, node, 'end') } } stringify(node, semicolon) { /* c8 ignore start */ if (!this[node.type]) { throw new Error( 'Unknown AST node type ' + node.type + '. ' + 'Maybe you need to change PostCSS stringifier.' ) } /* c8 ignore stop */ this[node.type](node, semicolon) } } module.exports = Stringifier Stringifier.default = Stringifier /***/ }), /***/ 356: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let pico = __webpack_require__(2775) let terminalHighlight = __webpack_require__(9746) class CssSyntaxError extends Error { constructor(message, line, column, source, file, plugin) { super(message) this.name = 'CssSyntaxError' this.reason = message if (file) { this.file = file } if (source) { this.source = source } if (plugin) { this.plugin = plugin } if (typeof line !== 'undefined' && typeof column !== 'undefined') { if (typeof line === 'number') { this.line = line this.column = column } else { this.line = line.line this.column = line.column this.endLine = column.line this.endColumn = column.column } } this.setMessage() if (Error.captureStackTrace) { Error.captureStackTrace(this, CssSyntaxError) } } setMessage() { this.message = this.plugin ? this.plugin + ': ' : '' this.message += this.file ? this.file : '<css input>' if (typeof this.line !== 'undefined') { this.message += ':' + this.line + ':' + this.column } this.message += ': ' + this.reason } showSourceCode(color) { if (!this.source) return '' let css = this.source if (color == null) color = pico.isColorSupported let aside = text => text let mark = text => text let highlight = text => text if (color) { let { bold, gray, red } = pico.createColors(true) mark = text => bold(red(text)) aside = text => gray(text) if (terminalHighlight) { highlight = text => terminalHighlight(text) } } let lines = css.split(/\r?\n/) let start = Math.max(this.line - 3, 0) let end = Math.min(this.line + 2, lines.length) let maxWidth = String(end).length return lines .slice(start, end) .map((line, index) => { let number = start + 1 + index let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ' if (number === this.line) { if (line.length > 160) { let padding = 20 let subLineStart = Math.max(0, this.column - padding) let subLineEnd = Math.max( this.column + padding, this.endColumn + padding ) let subLine = line.slice(subLineStart, subLineEnd) let spacing = aside(gutter.replace(/\d/g, ' ')) + line .slice(0, Math.min(this.column - 1, padding - 1)) .replace(/[^\t]/g, ' ') return ( mark('>') + aside(gutter) + highlight(subLine) + '\n ' + spacing + mark('^') ) } let spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, this.column - 1).replace(/[^\t]/g, ' ') return ( mark('>') + aside(gutter) + highlight(line) + '\n ' + spacing + mark('^') ) } return ' ' + aside(gutter) + highlight(line) }) .join('\n') } toString() { let code = this.showSourceCode() if (code) { code = '\n\n' + code + '\n' } return this.name + ': ' + this.message + code } } module.exports = CssSyntaxError CssSyntaxError.default = CssSyntaxError /***/ }), /***/ 448: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let Document = __webpack_require__(271) let MapGenerator = __webpack_require__(1670) let parse = __webpack_require__(4295) let Result = __webpack_require__(9055) let Root = __webpack_require__(9434) let stringify = __webpack_require__(633) let { isClean, my } = __webpack_require__(1381) let warnOnce = __webpack_require__(3122) const TYPE_TO_CLASS_NAME = { atrule: 'AtRule', comment: 'Comment', decl: 'Declaration', document: 'Document', root: 'Root', rule: 'Rule' } const PLUGIN_PROPS = { AtRule: true, AtRuleExit: true, Comment: true, CommentExit: true, Declaration: true, DeclarationExit: true, Document: true, DocumentExit: true, Once: true, OnceExit: true, postcssPlugin: true, prepare: true, Root: true, RootExit: true, Rule: true, RuleExit: true } const NOT_VISITORS = { Once: true, postcssPlugin: true, prepare: true } const CHILDREN = 0 function isPromise(obj) { return typeof obj === 'object' && typeof obj.then === 'function' } function getEvents(node) { let key = false let type = TYPE_TO_CLASS_NAME[node.type] if (node.type === 'decl') { key = node.prop.toLowerCase() } else if (node.type === 'atrule') { key = node.name.toLowerCase() } if (key && node.append) { return [ type, type + '-' + key, CHILDREN, type + 'Exit', type + 'Exit-' + key ] } else if (key) { return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key] } else if (node.append) { return [type, CHILDREN, type + 'Exit'] } else { return [type, type + 'Exit'] } } function toStack(node) { let events if (node.type === 'document') { events = ['Document', CHILDREN, 'DocumentExit'] } else if (node.type === 'root') { events = ['Root', CHILDREN, 'RootExit'] } else { events = getEvents(node) } return { eventIndex: 0, events, iterator: 0, node, visitorIndex: 0, visitors: [] } } function cleanMarks(node) { node[isClean] = false if (node.nodes) node.nodes.forEach(i => cleanMarks(i)) return node } let postcss = {} class LazyResult { get content() { return this.stringify().content } get css() { return this.stringify().css } get map() { return this.stringify().map } get messages() { return this.sync().messages } get opts() { return this.result.opts } get processor() { return this.result.processor } get root() { return this.sync().root } get [Symbol.toStringTag]() { return 'LazyResult' } constructor(processor, css, opts) { this.stringified = false this.processed = false let root if ( typeof css === 'object' && css !== null && (css.type === 'root' || css.type === 'document') ) { root = cleanMarks(css) } else if (css instanceof LazyResult || css instanceof Result) { root = cleanMarks(css.root) if (css.map) { if (typeof opts.map === 'undefined') opts.map = {} if (!opts.map.inline) opts.map.inline = false opts.map.prev = css.map } } else { let parser = parse if (opts.syntax) parser = opts.syntax.parse if (opts.parser) parser = opts.parser if (parser.parse) parser = parser.parse try { root = parser(css, opts) } catch (error) { this.processed = true this.error = error } if (root && !root[my]) { /* c8 ignore next 2 */ Container.rebuild(root) } } this.result = new Result(processor, root, opts) this.helpers = { ...postcss, postcss, result: this.result } this.plugins = this.processor.plugins.map(plugin => { if (typeof plugin === 'object' && plugin.prepare) { return { ...plugin, ...plugin.prepare(this.result) } } else { return plugin } }) } async() { if (this.error) return Promise.reject(this.error) if (this.processed) return Promise.resolve(this.result) if (!this.processing) { this.processing = this.runAsync() } return this.processing } catch(onRejected) { return this.async().catch(onRejected) } finally(onFinally) { return this.async().then(onFinally, onFinally) } getAsyncError() { throw new Error('Use process(css).then(cb) to work with async plugins') } handleError(error, node) { let plugin = this.result.lastPlugin try { if (node) node.addToError(error) this.error = error if (error.name === 'CssSyntaxError' && !error.plugin) { error.plugin = plugin.postcssPlugin error.setMessage() } else if (plugin.postcssVersion) { if (false) {} } } catch (err) { /* c8 ignore next 3 */ // eslint-disable-next-line no-console if (console && console.error) console.error(err) } return error } prepareVisitors() { this.listeners = {} let add = (plugin, type, cb) => { if (!this.listeners[type]) this.listeners[type] = [] this.listeners[type].push([plugin, cb]) } for (let plugin of this.plugins) { if (typeof plugin === 'object') { for (let event in plugin) { if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) { throw new Error( `Unknown event ${event} in ${plugin.postcssPlugin}. ` + `Try to update PostCSS (${this.processor.version} now).` ) } if (!NOT_VISITORS[event]) { if (typeof plugin[event] === 'object') { for (let filter in plugin[event]) { if (filter === '*') { add(plugin, event, plugin[event][filter]) } else { add( plugin, event + '-' + filter.toLowerCase(), plugin[event][filter] ) } } } else if (typeof plugin[event] === 'function') { add(plugin, event, plugin[event]) } } } } } this.hasListener = Object.keys(this.listeners).length > 0 } async runAsync() { this.plugin = 0 for (let i = 0; i < this.plugins.length; i++) { let plugin = this.plugins[i] let promise = this.runOnRoot(plugin) if (isPromise(promise)) { try { await promise } catch (error) { throw this.handleError(error) } } } this.prepareVisitors() if (this.hasListener) { let root = this.result.root while (!root[isClean]) { root[isClean] = true let stack = [toStack(root)] while (stack.length > 0) { let promise = this.visitTick(stack) if (isPromise(promise)) { try { await promise } catch (e) { let node = stack[stack.length - 1].node throw this.handleError(e, node) } } } } if (this.listeners.OnceExit) { for (let [plugin, visitor] of this.listeners.OnceExit) { this.result.lastPlugin = plugin try { if (root.type === 'document') { let roots = root.nodes.map(subRoot => visitor(subRoot, this.helpers) ) await Promise.all(roots) } else { await visitor(root, this.helpers) } } catch (e) { throw this.handleError(e) } } } } this.processed = true return this.stringify() } runOnRoot(plugin) { this.result.lastPlugin = plugin try { if (typeof plugin === 'object' && plugin.Once) { if (this.result.root.type === 'document') { let roots = this.result.root.nodes.map(root => plugin.Once(root, this.helpers) ) if (isPromise(roots[0])) { return Promise.all(roots) } return roots } return plugin.Once(this.result.root, this.helpers) } else if (typeof plugin === 'function') { return plugin(this.result.root, this.result) } } catch (error) { throw this.handleError(error) } } stringify() { if (this.error) throw this.error if (this.stringified) return this.result this.stringified = true this.sync() let opts = this.result.opts let str = stringify if (opts.syntax) str = opts.syntax.stringify if (opts.stringifier) str = opts.stringifier if (str.stringify) str = str.stringify let map = new MapGenerator(str, this.result.root, this.result.opts) let data = map.generate() this.result.css = data[0] this.result.map = data[1] return this.result } sync() { if (this.error) throw this.error if (this.processed) return this.result this.processed = true if (this.processing) { throw this.getAsyncError() } for (let plugin of this.plugins) { let promise = this.runOnRoot(plugin) if (isPromise(promise)) { throw this.getAsyncError() } } this.prepareVisitors() if (this.hasListener) { let root = this.result.root while (!root[isClean]) { root[isClean] = true this.walkSync(root) } if (this.listeners.OnceExit) { if (root.type === 'document') { for (let subRoot of root.nodes) { this.visitSync(this.listeners.OnceExit, subRoot) } } else { this.visitSync(this.listeners.OnceExit, root) } } } return this.result } then(onFulfilled, onRejected) { if (false) {} return this.async().then(onFulfilled, onRejected) } toString() { return this.css } visitSync(visitors, node) { for (let [plugin, visitor] of visitors) { this.result.lastPlugin = plugin let promise try { promise = visitor(node, this.helpers) } catch (e) { throw this.handleError(e, node.proxyOf) } if (node.type !== 'root' && node.type !== 'document' && !node.parent) { return true } if (isPromise(promise)) { throw this.getAsyncError() } } } visitTick(stack) { let visit = stack[stack.length - 1] let { node, visitors } = visit if (node.type !== 'root' && node.type !== 'document' && !node.parent) { stack.pop() return } if (visitors.length > 0 && visit.visitorIndex < visitors.length) { let [plugin, visitor] = visitors[visit.visitorIndex] visit.visitorIndex += 1 if (visit.visitorIndex === visitors.length) { visit.visitors = [] visit.visitorIndex = 0 } this.result.lastPlugin = plugin try { return visitor(node.toProxy(), this.helpers) } catch (e) { throw this.handleError(e, node) } } if (visit.iterator !== 0) { let iterator = visit.iterator let child while ((child = node.nodes[node.indexes[iterator]])) { node.indexes[iterator] += 1 if (!child[isClean]) { child[isClean] = true stack.push(toStack(child)) return } } visit.iterator = 0 delete node.indexes[iterator] } let events = visit.events while (visit.eventIndex < events.length) { let event = events[visit.eventIndex] visit.eventIndex += 1 if (event === CHILDREN) { if (node.nodes && node.nodes.length) { node[isClean] = true visit.iterator = node.getIterator() } return } else if (this.listeners[event]) { visit.visitors = this.listeners[event] return } } stack.pop() } walkSync(node) { node[isClean] = true let events = getEvents(node) for (let event of events) { if (event === CHILDREN) { if (node.nodes) { node.each(child => { if (!child[isClean]) this.walkSync(child) }) } } else { let visitors = this.listeners[event] if (visitors) { if (this.visitSync(visitors, node.toProxy())) return } } } } warnings() { return this.sync().warnings() } } LazyResult.registerPostcss = dependant => { postcss = dependant } module.exports = LazyResult LazyResult.default = LazyResult Root.registerLazyResult(LazyResult) Document.registerLazyResult(LazyResult) /***/ }), /***/ 461: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // Load in dependencies var computedStyle = __webpack_require__(6109); /** * Calculate the `line-height` of a given node * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. * @returns {Number} `line-height` of the element in pixels */ function lineHeight(node) { // Grab the line-height via style var lnHeightStr = computedStyle(node, 'line-height'); var lnHeight = parseFloat(lnHeightStr, 10); // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') if (lnHeightStr === lnHeight + '') { // Save the old lineHeight style and update the em unit to the element var _lnHeightStyle = node.style.lineHeight; node.style.lineHeight = lnHeightStr + 'em'; // Calculate the em based height lnHeightStr = computedStyle(node, 'line-height'); lnHeight = parseFloat(lnHeightStr, 10); // Revert the lineHeight style if (_lnHeightStyle) { node.style.lineHeight = _lnHeightStyle; } else { delete node.style.lineHeight; } } // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) // DEV: `em` units are converted to `pt` in IE6 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length if (lnHeightStr.indexOf('pt') !== -1) { lnHeight *= 4; lnHeight /= 3; // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) } else if (lnHeightStr.indexOf('mm') !== -1) { lnHeight *= 96; lnHeight /= 25.4; // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) } else if (lnHeightStr.indexOf('cm') !== -1) { lnHeight *= 96; lnHeight /= 2.54; // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) } else if (lnHeightStr.indexOf('in') !== -1) { lnHeight *= 96; // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) } else if (lnHeightStr.indexOf('pc') !== -1) { lnHeight *= 16; } // Continue our computation lnHeight = Math.round(lnHeight); // If the line-height is "normal", calculate by font-size if (lnHeightStr === 'normal') { // Create a temporary node var nodeName = node.nodeName; var _node = document.createElement(nodeName); _node.innerHTML = ' '; // If we have a text area, reset it to only 1 row // https://github.com/twolfson/line-height/issues/4 if (nodeName.toUpperCase() === 'TEXTAREA') { _node.setAttribute('rows', '1'); } // Set the font-size of the element var fontSizeStr = computedStyle(node, 'font-size'); _node.style.fontSize = fontSizeStr; // Remove default padding/border which can affect offset height // https://github.com/twolfson/line-height/issues/4 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight _node.style.padding = '0px'; _node.style.border = '0px'; // Append it to the body var body = document.body; body.appendChild(_node); // Assume the line height of the element is the height var height = _node.offsetHeight; lnHeight = height; // Remove our child from the DOM body.removeChild(_node); } // Return the calculated height return lnHeight; } // Export lineHeight module.exports = lineHeight; /***/ }), /***/ 628: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = __webpack_require__(4067); function emptyFunction() {} function emptyFunctionWithReset() {} emptyFunctionWithReset.resetWarningCache = emptyFunction; module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret) { // It is still safe when called from React. return; } var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); err.name = 'Invariant Violation'; throw err; }; shim.isRequired = shim; function getShim() { return shim; }; // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bigint: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, elementType: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, exact: getShim, checkPropTypes: emptyFunctionWithReset, resetWarningCache: emptyFunction }; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /***/ }), /***/ 633: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Stringifier = __webpack_require__(346) function stringify(node, builder) { let str = new Stringifier(builder) str.stringify(node) } module.exports = stringify stringify.default = stringify /***/ }), /***/ 683: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Comment = __webpack_require__(6589) let Declaration = __webpack_require__(1516) let Node = __webpack_require__(7490) let { isClean, my } = __webpack_require__(1381) let AtRule, parse, Root, Rule function cleanSource(nodes) { return nodes.map(i => { if (i.nodes) i.nodes = cleanSource(i.nodes) delete i.source return i }) } function markTreeDirty(node) { node[isClean] = false if (node.proxyOf.nodes) { for (let i of node.proxyOf.nodes) { markTreeDirty(i) } } } class Container extends Node { get first() { if (!this.proxyOf.nodes) return undefined return this.proxyOf.nodes[0] } get last() { if (!this.proxyOf.nodes) return undefined return this.proxyOf.nodes[this.proxyOf.nodes.length - 1] } append(...children) { for (let child of children) { let nodes = this.normalize(child, this.last) for (let node of nodes) this.proxyOf.nodes.push(node) } this.markDirty() return this } cleanRaws(keepBetween) { super.cleanRaws(keepBetween) if (this.nodes) { for (let node of this.nodes) node.cleanRaws(keepBetween) } } each(callback) { if (!this.proxyOf.nodes) return undefined let iterator = this.getIterator() let index, result while (this.indexes[iterator] < this.proxyOf.nodes.length) { index = this.indexes[iterator] result = callback(this.proxyOf.nodes[index], index) if (result === false) break this.indexes[iterator] += 1 } delete this.indexes[iterator] return result } every(condition) { return this.nodes.every(condition) } getIterator() { if (!this.lastEach) this.lastEach = 0 if (!this.indexes) this.indexes = {} this.lastEach += 1 let iterator = this.lastEach this.indexes[iterator] = 0 return iterator } getProxyProcessor() { return { get(node, prop) { if (prop === 'proxyOf') { return node } else if (!node[prop]) { return node[prop] } else if ( prop === 'each' || (typeof prop === 'string' && prop.startsWith('walk')) ) { return (...args) => { return node[prop]( ...args.map(i => { if (typeof i === 'function') { return (child, index) => i(child.toProxy(), index) } else { return i } }) ) } } else if (prop === 'every' || prop === 'some') { return cb => { return node[prop]((child, ...other) => cb(child.toProxy(), ...other) ) } } else if (prop === 'root') { return () => node.root().toProxy() } else if (prop === 'nodes') { return node.nodes.map(i => i.toProxy()) } else if (prop === 'first' || prop === 'last') { return node[prop].toProxy() } else { return node[prop] } }, set(node, prop, value) { if (node[prop] === value) return true node[prop] = value if (prop === 'name' || prop === 'params' || prop === 'selector') { node.markDirty() } return true } } } index(child) { if (typeof child === 'number') return child if (child.proxyOf) child = child.proxyOf return this.proxyOf.nodes.indexOf(child) } insertAfter(exist, add) { let existIndex = this.index(exist) let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse() existIndex = this.index(exist) for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node) let index for (let id in this.indexes) { index = this.indexes[id] if (existIndex < index) { this.indexes[id] = index + nodes.length } } this.markDirty() return this } insertBefore(exist, add) { let existIndex = this.index(exist) let type = existIndex === 0 ? 'prepend' : false let nodes = this.normalize( add, this.proxyOf.nodes[existIndex], type ).reverse() existIndex = this.index(exist) for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node) let index for (let id in this.indexes) { index = this.indexes[id] if (existIndex <= index) { this.indexes[id] = index + nodes.length } } this.markDirty() return this } normalize(nodes, sample) { if (typeof nodes === 'string') { nodes = cleanSource(parse(nodes).nodes) } else if (typeof nodes === 'undefined') { nodes = [] } else if (Array.isArray(nodes)) { nodes = nodes.slice(0) for (let i of nodes) { if (i.parent) i.parent.removeChild(i, 'ignore') } } else if (nodes.type === 'root' && this.type !== 'document') { nodes = nodes.nodes.slice(0) for (let i of nodes) { if (i.parent) i.parent.removeChild(i, 'ignore') } } else if (nodes.type) { nodes = [nodes] } else if (nodes.prop) { if (typeof nodes.value === 'undefined') { throw new Error('Value field is missed in node creation') } else if (typeof nodes.value !== 'string') { nodes.value = String(nodes.value) } nodes = [new Declaration(nodes)] } else if (nodes.selector || nodes.selectors) { nodes = [new Rule(nodes)] } else if (nodes.name) { nodes = [new AtRule(nodes)] } else if (nodes.text) { nodes = [new Comment(nodes)] } else { throw new Error('Unknown node type in node creation') } let processed = nodes.map(i => { /* c8 ignore next */ if (!i[my]) Container.rebuild(i) i = i.proxyOf if (i.parent) i.parent.removeChild(i) if (i[isClean]) markTreeDirty(i) if (!i.raws) i.raws = {} if (typeof i.raws.before === 'undefined') { if (sample && typeof sample.raws.before !== 'undefined') { i.raws.before = sample.raws.before.replace(/\S/g, '') } } i.parent = this.proxyOf return i }) return processed } prepend(...children) { children = children.reverse() for (let child of children) { let nodes = this.normalize(child, this.first, 'prepend').reverse() for (let node of nodes) this.proxyOf.nodes.unshift(node) for (let id in this.indexes) { this.indexes[id] = this.indexes[id] + nodes.length } } this.markDirty() return this } push(child) { child.parent = this this.proxyOf.nodes.push(child) return this } removeAll() { for (let node of this.proxyOf.nodes) node.parent = undefined this.proxyOf.nodes = [] this.markDirty() return this } removeChild(child) { child = this.index(child) this.proxyOf.nodes[child].parent = undefined this.proxyOf.nodes.splice(child, 1) let index for (let id in this.indexes) { index = this.indexes[id] if (index >= child) { this.indexes[id] = index - 1 } } this.markDirty() return this } replaceValues(pattern, opts, callback) { if (!callback) { callback = opts opts = {} } this.walkDecls(decl => { if (opts.props && !opts.props.includes(decl.prop)) return if (opts.fast && !decl.value.includes(opts.fast)) return decl.value = decl.value.replace(pattern, callback) }) this.markDirty() return this } some(condition) { return this.nodes.some(condition) } walk(callback) { return this.each((child, i) => { let result try { result = callback(child, i) } catch (e) { throw child.addToError(e) } if (result !== false && child.walk) { result = child.walk(callback) } return result }) } walkAtRules(name, callback) { if (!callback) { callback = name return this.walk((child, i) => { if (child.type === 'atrule') { return callback(child, i) } }) } if (name instanceof RegExp) { return this.walk((child, i) => { if (child.type === 'atrule' && name.test(child.name)) { return callback(child, i) } }) } return this.walk((child, i) => { if (child.type === 'atrule' && child.name === name) { return callback(child, i) } }) } walkComments(callback) { return this.walk((child, i) => { if (child.type === 'comment') { return callback(child, i) } }) } walkDecls(prop, callback) { if (!callback) { callback = prop return this.walk((child, i) => { if (child.type === 'decl') { return callback(child, i) } }) } if (prop instanceof RegExp) { return this.walk((child, i) => { if (child.type === 'decl' && prop.test(child.prop)) { return callback(child, i) } }) } return this.walk((child, i) => { if (child.type === 'decl' && child.prop === prop) { return callback(child, i) } }) } walkRules(selector, callback) { if (!callback) { callback = selector return this.walk((child, i) => { if (child.type === 'rule') { return callback(child, i) } }) } if (selector instanceof RegExp) { return this.walk((child, i) => { if (child.type === 'rule' && selector.test(child.selector)) { return callback(child, i) } }) } return this.walk((child, i) => { if (child.type === 'rule' && child.selector === selector) { return callback(child, i) } }) } } Container.registerParse = dependant => { parse = dependant } Container.registerRule = dependant => { Rule = dependant } Container.registerAtRule = dependant => { AtRule = dependant } Container.registerRoot = dependant => { Root = dependant } module.exports = Container Container.default = Container /* c8 ignore start */ Container.rebuild = node => { if (node.type === 'atrule') { Object.setPrototypeOf(node, AtRule.prototype) } else if (node.type === 'rule') { Object.setPrototypeOf(node, Rule.prototype) } else if (node.type === 'decl') { Object.setPrototypeOf(node, Declaration.prototype) } else if (node.type === 'comment') { Object.setPrototypeOf(node, Comment.prototype) } else if (node.type === 'root') { Object.setPrototypeOf(node, Root.prototype) } node[my] = true if (node.nodes) { node.nodes.forEach(child => { Container.rebuild(child) }) } } /* c8 ignore stop */ /***/ }), /***/ 1087: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isEventSupported */ var ExecutionEnvironment = __webpack_require__(8202); var useHasFeature; if (ExecutionEnvironment.canUseDOM) { useHasFeature = document.implementation && document.implementation.hasFeature && // always returns true in newer browsers as per the standard. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature document.implementation.hasFeature('', '') !== true; } /** * Checks if an event is supported in the current execution environment. * * NOTE: This will not work correctly for non-generic events such as `change`, * `reset`, `load`, `error`, and `select`. * * Borrows from Modernizr. * * @param {string} eventNameSuffix Event name, e.g. "click". * @param {?boolean} capture Check if the capture phase is supported. * @return {boolean} True if the event is supported. * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT */ function isEventSupported(eventNameSuffix, capture) { if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { return false; } var eventName = 'on' + eventNameSuffix; var isSupported = eventName in document; if (!isSupported) { var element = document.createElement('div'); element.setAttribute(eventName, 'return;'); isSupported = typeof element[eventName] === 'function'; } if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { // This is the only way to test support for the `wheel` event in IE9+. isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); } return isSupported; } module.exports = isEventSupported; /***/ }), /***/ 1326: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) class AtRule extends Container { constructor(defaults) { super(defaults) this.type = 'atrule' } append(...children) { if (!this.proxyOf.nodes) this.nodes = [] return super.append(...children) } prepend(...children) { if (!this.proxyOf.nodes) this.nodes = [] return super.prepend(...children) } } module.exports = AtRule AtRule.default = AtRule Container.registerAtRule(AtRule) /***/ }), /***/ 1381: /***/ ((module) => { "use strict"; module.exports.isClean = Symbol('isClean') module.exports.my = Symbol('my') /***/ }), /***/ 1443: /***/ ((module) => { module.exports = function postcssPrefixSelector(options) { const prefix = options.prefix; const prefixWithSpace = /\s+$/.test(prefix) ? prefix : `${prefix} `; const ignoreFiles = options.ignoreFiles ? [].concat(options.ignoreFiles) : []; const includeFiles = options.includeFiles ? [].concat(options.includeFiles) : []; return function (root) { if ( ignoreFiles.length && root.source.input.file && isFileInArray(root.source.input.file, ignoreFiles) ) { return; } if ( includeFiles.length && root.source.input.file && !isFileInArray(root.source.input.file, includeFiles) ) { return; } root.walkRules((rule) => { const keyframeRules = [ 'keyframes', '-webkit-keyframes', '-moz-keyframes', '-o-keyframes', '-ms-keyframes', ]; if (rule.parent && keyframeRules.includes(rule.parent.name)) { return; } rule.selectors = rule.selectors.map((selector) => { if (options.exclude && excludeSelector(selector, options.exclude)) { return selector; } if (options.transform) { return options.transform( prefix, selector, prefixWithSpace + selector, root.source.input.file, rule ); } return prefixWithSpace + selector; }); }); }; }; function isFileInArray(file, arr) { return arr.some((ruleOrString) => { if (ruleOrString instanceof RegExp) { return ruleOrString.test(file); } return file.includes(ruleOrString); }); } function excludeSelector(selector, excludeArr) { return excludeArr.some((excludeRule) => { if (excludeRule instanceof RegExp) { return excludeRule.test(selector); } return selector === excludeRule; }); } /***/ }), /***/ 1516: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Node = __webpack_require__(7490) class Declaration extends Node { get variable() { return this.prop.startsWith('--') || this.prop[0] === '$' } constructor(defaults) { if ( defaults && typeof defaults.value !== 'undefined' && typeof defaults.value !== 'string' ) { defaults = { ...defaults, value: String(defaults.value) } } super(defaults) this.type = 'decl' } } module.exports = Declaration Declaration.default = Declaration /***/ }), /***/ 1524: /***/ ((module) => { var minus = "-".charCodeAt(0); var plus = "+".charCodeAt(0); var dot = ".".charCodeAt(0); var exp = "e".charCodeAt(0); var EXP = "E".charCodeAt(0); // Check if three code points would start a number // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number function likeNumber(value) { var code = value.charCodeAt(0); var nextCode; if (code === plus || code === minus) { nextCode = value.charCodeAt(1); if (nextCode >= 48 && nextCode <= 57) { return true; } var nextNextCode = value.charCodeAt(2); if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) { return true; } return false; } if (code === dot) { nextCode = value.charCodeAt(1); if (nextCode >= 48 && nextCode <= 57) { return true; } return false; } if (code >= 48 && code <= 57) { return true; } return false; } // Consume a number // https://www.w3.org/TR/css-syntax-3/#consume-number module.exports = function(value) { var pos = 0; var length = value.length; var code; var nextCode; var nextNextCode; if (length === 0 || !likeNumber(value)) { return false; } code = value.charCodeAt(pos); if (code === plus || code === minus) { pos++; } while (pos < length) { code = value.charCodeAt(pos); if (code < 48 || code > 57) { break; } pos += 1; } code = value.charCodeAt(pos); nextCode = value.charCodeAt(pos + 1); if (code === dot && nextCode >= 48 && nextCode <= 57) { pos += 2; while (pos < length) { code = value.charCodeAt(pos); if (code < 48 || code > 57) { break; } pos += 1; } } code = value.charCodeAt(pos); nextCode = value.charCodeAt(pos + 1); nextNextCode = value.charCodeAt(pos + 2); if ( (code === exp || code === EXP) && ((nextCode >= 48 && nextCode <= 57) || ((nextCode === plus || nextCode === minus) && nextNextCode >= 48 && nextNextCode <= 57)) ) { pos += nextCode === plus || nextCode === minus ? 3 : 2; while (pos < length) { code = value.charCodeAt(pos); if (code < 48 || code > 57) { break; } pos += 1; } } return { number: value.slice(0, pos), unit: value.slice(pos) }; }; /***/ }), /***/ 1544: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var parse = __webpack_require__(8491); var walk = __webpack_require__(3815); var stringify = __webpack_require__(4725); function ValueParser(value) { if (this instanceof ValueParser) { this.nodes = parse(value); return this; } return new ValueParser(value); } ValueParser.prototype.toString = function() { return Array.isArray(this.nodes) ? stringify(this.nodes) : ""; }; ValueParser.prototype.walk = function(cb, bubble) { walk(this.nodes, cb, bubble); return this; }; ValueParser.unit = __webpack_require__(1524); ValueParser.walk = walk; ValueParser.stringify = stringify; module.exports = ValueParser; /***/ }), /***/ 1609: /***/ ((module) => { "use strict"; module.exports = window["React"]; /***/ }), /***/ 1670: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let { dirname, relative, resolve, sep } = __webpack_require__(197) let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866) let { pathToFileURL } = __webpack_require__(2739) let Input = __webpack_require__(5380) let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) let pathAvailable = Boolean(dirname && resolve && relative && sep) class MapGenerator { constructor(stringify, root, opts, cssString) { this.stringify = stringify this.mapOpts = opts.map || {} this.root = root this.opts = opts this.css = cssString this.originalCSS = cssString this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute this.memoizedFileURLs = new Map() this.memoizedPaths = new Map() this.memoizedURLs = new Map() } addAnnotation() { let content if (this.isInline()) { content = 'data:application/json;base64,' + this.toBase64(this.map.toString()) } else if (typeof this.mapOpts.annotation === 'string') { content = this.mapOpts.annotation } else if (typeof this.mapOpts.annotation === 'function') { content = this.mapOpts.annotation(this.opts.to, this.root) } else { content = this.outputFile() + '.map' } let eol = '\n' if (this.css.includes('\r\n')) eol = '\r\n' this.css += eol + '/*# sourceMappingURL=' + content + ' */' } applyPrevMaps() { for (let prev of this.previous()) { let from = this.toUrl(this.path(prev.file)) let root = prev.root || dirname(prev.file) let map if (this.mapOpts.sourcesContent === false) { map = new SourceMapConsumer(prev.text) if (map.sourcesContent) { map.sourcesContent = null } } else { map = prev.consumer() } this.map.applySourceMap(map, from, this.toUrl(this.path(root))) } } clearAnnotation() { if (this.mapOpts.annotation === false) return if (this.root) { let node for (let i = this.root.nodes.length - 1; i >= 0; i--) { node = this.root.nodes[i] if (node.type !== 'comment') continue if (node.text.startsWith('# sourceMappingURL=')) { this.root.removeChild(i) } } } else if (this.css) { this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '') } } generate() { this.clearAnnotation() if (pathAvailable && sourceMapAvailable && this.isMap()) { return this.generateMap() } else { let result = '' this.stringify(this.root, i => { result += i }) return [result] } } generateMap() { if (this.root) { this.generateString() } else if (this.previous().length === 1) { let prev = this.previous()[0].consumer() prev.file = this.outputFile() this.map = SourceMapGenerator.fromSourceMap(prev, { ignoreInvalidMapping: true }) } else { this.map = new SourceMapGenerator({ file: this.outputFile(), ignoreInvalidMapping: true }) this.map.addMapping({ generated: { column: 0, line: 1 }, original: { column: 0, line: 1 }, source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : '<no source>' }) } if (this.isSourcesContent()) this.setSourcesContent() if (this.root && this.previous().length > 0) this.applyPrevMaps() if (this.isAnnotation()) this.addAnnotation() if (this.isInline()) { return [this.css] } else { return [this.css, this.map] } } generateString() { this.css = '' this.map = new SourceMapGenerator({ file: this.outputFile(), ignoreInvalidMapping: true }) let line = 1 let column = 1 let noSource = '<no source>' let mapping = { generated: { column: 0, line: 0 }, original: { column: 0, line: 0 }, source: '' } let last, lines this.stringify(this.root, (str, node, type) => { this.css += str if (node && type !== 'end') { mapping.generated.line = line mapping.generated.column = column - 1 if (node.source && node.source.start) { mapping.source = this.sourcePath(node) mapping.original.line = node.source.start.line mapping.original.column = node.source.start.column - 1 this.map.addMapping(mapping) } else { mapping.source = noSource mapping.original.line = 1 mapping.original.column = 0 this.map.addMapping(mapping) } } lines = str.match(/\n/g) if (lines) { line += lines.length last = str.lastIndexOf('\n') column = str.length - last } else { column += str.length } if (node && type !== 'start') { let p = node.parent || { raws: {} } let childless = node.type === 'decl' || (node.type === 'atrule' && !node.nodes) if (!childless || node !== p.last || p.raws.semicolon) { if (node.source && node.source.end) { mapping.source = this.sourcePath(node) mapping.original.line = node.source.end.line mapping.original.column = node.source.end.column - 1 mapping.generated.line = line mapping.generated.column = column - 2 this.map.addMapping(mapping) } else { mapping.source = noSource mapping.original.line = 1 mapping.original.column = 0 mapping.generated.line = line mapping.generated.column = column - 1 this.map.addMapping(mapping) } } } }) } isAnnotation() { if (this.isInline()) { return true } if (typeof this.mapOpts.annotation !== 'undefined') { return this.mapOpts.annotation } if (this.previous().length) { return this.previous().some(i => i.annotation) } return true } isInline() { if (typeof this.mapOpts.inline !== 'undefined') { return this.mapOpts.inline } let annotation = this.mapOpts.annotation if (typeof annotation !== 'undefined' && annotation !== true) { return false } if (this.previous().length) { return this.previous().some(i => i.inline) } return true } isMap() { if (typeof this.opts.map !== 'undefined') { return !!this.opts.map } return this.previous().length > 0 } isSourcesContent() { if (typeof this.mapOpts.sourcesContent !== 'undefined') { return this.mapOpts.sourcesContent } if (this.previous().length) { return this.previous().some(i => i.withContent()) } return true } outputFile() { if (this.opts.to) { return this.path(this.opts.to) } else if (this.opts.from) { return this.path(this.opts.from) } else { return 'to.css' } } path(file) { if (this.mapOpts.absolute) return file if (file.charCodeAt(0) === 60 /* `<` */) return file if (/^\w+:\/\//.test(file)) return file let cached = this.memoizedPaths.get(file) if (cached) return cached let from = this.opts.to ? dirname(this.opts.to) : '.' if (typeof this.mapOpts.annotation === 'string') { from = dirname(resolve(from, this.mapOpts.annotation)) } let path = relative(from, file) this.memoizedPaths.set(file, path) return path } previous() { if (!this.previousMaps) { this.previousMaps = [] if (this.root) { this.root.walk(node => { if (node.source && node.source.input.map) { let map = node.source.input.map if (!this.previousMaps.includes(map)) { this.previousMaps.push(map) } } }) } else { let input = new Input(this.originalCSS, this.opts) if (input.map) this.previousMaps.push(input.map) } } return this.previousMaps } setSourcesContent() { let already = {} if (this.root) { this.root.walk(node => { if (node.source) { let from = node.source.input.from if (from && !already[from]) { already[from] = true let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from)) this.map.setSourceContent(fromUrl, node.source.input.css) } } }) } else if (this.css) { let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : '<no source>' this.map.setSourceContent(from, this.css) } } sourcePath(node) { if (this.mapOpts.from) { return this.toUrl(this.mapOpts.from) } else if (this.usesFileUrls) { return this.toFileUrl(node.source.input.from) } else { return this.toUrl(this.path(node.source.input.from)) } } toBase64(str) { if (Buffer) { return Buffer.from(str).toString('base64') } else { return window.btoa(unescape(encodeURIComponent(str))) } } toFileUrl(path) { let cached = this.memoizedFileURLs.get(path) if (cached) return cached if (pathToFileURL) { let fileURL = pathToFileURL(path).toString() this.memoizedFileURLs.set(path, fileURL) return fileURL } else { throw new Error( '`map.absolute` option is not available in this PostCSS build' ) } } toUrl(path) { let cached = this.memoizedURLs.get(path) if (cached) return cached if (sep === '\\') { path = path.replace(/\\/g, '/') } let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent) this.memoizedURLs.set(path, url) return url } } module.exports = MapGenerator /***/ }), /***/ 1866: /***/ (() => { /* (ignored) */ /***/ }), /***/ 2213: /***/ ((module) => { /** * Copyright 2004-present Facebook. All Rights Reserved. * * @providesModule UserAgent_DEPRECATED */ /** * Provides entirely client-side User Agent and OS detection. You should prefer * the non-deprecated UserAgent module when possible, which exposes our * authoritative server-side PHP-based detection to the client. * * Usage is straightforward: * * if (UserAgent_DEPRECATED.ie()) { * // IE * } * * You can also do version checks: * * if (UserAgent_DEPRECATED.ie() >= 7) { * // IE7 or better * } * * The browser functions will return NaN if the browser does not match, so * you can also do version compares the other way: * * if (UserAgent_DEPRECATED.ie() < 7) { * // IE6 or worse * } * * Note that the version is a float and may include a minor version number, * so you should always use range operators to perform comparisons, not * strict equality. * * **Note:** You should **strongly** prefer capability detection to browser * version detection where it's reasonable: * * http://www.quirksmode.org/js/support.html * * Further, we have a large number of mature wrapper functions and classes * which abstract away many browser irregularities. Check the documentation, * grep for things, or ask on javascript@lists.facebook.com before writing yet * another copy of "event || window.event". * */ var _populated = false; // Browsers var _ie, _firefox, _opera, _webkit, _chrome; // Actual IE browser for compatibility mode var _ie_real_version; // Platforms var _osx, _windows, _linux, _android; // Architectures var _win64; // Devices var _iphone, _ipad, _native; var _mobile; function _populate() { if (_populated) { return; } _populated = true; // To work around buggy JS libraries that can't handle multi-digit // version numbers, Opera 10's user agent string claims it's Opera // 9, then later includes a Version/X.Y field: // // Opera/9.80 (foo) Presto/2.2.15 Version/10.10 var uas = navigator.userAgent; var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas); var os = /(Mac OS X)|(Windows)|(Linux)/.exec(uas); _iphone = /\b(iPhone|iP[ao]d)/.exec(uas); _ipad = /\b(iP[ao]d)/.exec(uas); _android = /Android/i.exec(uas); _native = /FBAN\/\w+;/i.exec(uas); _mobile = /Mobile/i.exec(uas); // Note that the IE team blog would have you believe you should be checking // for 'Win64; x64'. But MSDN then reveals that you can actually be coming // from either x64 or ia64; so ultimately, you should just check for Win64 // as in indicator of whether you're in 64-bit IE. 32-bit IE on 64-bit // Windows will send 'WOW64' instead. _win64 = !!(/Win64/.exec(uas)); if (agent) { _ie = agent[1] ? parseFloat(agent[1]) : ( agent[5] ? parseFloat(agent[5]) : NaN); // IE compatibility mode if (_ie && document && document.documentMode) { _ie = document.documentMode; } // grab the "true" ie version from the trident token if available var trident = /(?:Trident\/(\d+.\d+))/.exec(uas); _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie; _firefox = agent[2] ? parseFloat(agent[2]) : NaN; _opera = agent[3] ? parseFloat(agent[3]) : NaN; _webkit = agent[4] ? parseFloat(agent[4]) : NaN; if (_webkit) { // We do not add the regexp to the above test, because it will always // match 'safari' only since 'AppleWebKit' appears before 'Chrome' in // the userAgent string. agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas); _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN; } else { _chrome = NaN; } } else { _ie = _firefox = _opera = _chrome = _webkit = NaN; } if (os) { if (os[1]) { // Detect OS X version. If no version number matches, set _osx to true. // Version examples: 10, 10_6_1, 10.7 // Parses version number as a float, taking only first two sets of // digits. If only one set of digits is found, returns just the major // version number. var ver = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas); _osx = ver ? parseFloat(ver[1].replace('_', '.')) : true; } else { _osx = false; } _windows = !!os[2]; _linux = !!os[3]; } else { _osx = _windows = _linux = false; } } var UserAgent_DEPRECATED = { /** * Check if the UA is Internet Explorer. * * * @return float|NaN Version number (if match) or NaN. */ ie: function() { return _populate() || _ie; }, /** * Check if we're in Internet Explorer compatibility mode. * * @return bool true if in compatibility mode, false if * not compatibility mode or not ie */ ieCompatibilityMode: function() { return _populate() || (_ie_real_version > _ie); }, /** * Whether the browser is 64-bit IE. Really, this is kind of weak sauce; we * only need this because Skype can't handle 64-bit IE yet. We need to remove * this when we don't need it -- tracked by #601957. */ ie64: function() { return UserAgent_DEPRECATED.ie() && _win64; }, /** * Check if the UA is Firefox. * * * @return float|NaN Version number (if match) or NaN. */ firefox: function() { return _populate() || _firefox; }, /** * Check if the UA is Opera. * * * @return float|NaN Version number (if match) or NaN. */ opera: function() { return _populate() || _opera; }, /** * Check if the UA is WebKit. * * * @return float|NaN Version number (if match) or NaN. */ webkit: function() { return _populate() || _webkit; }, /** * For Push * WILL BE REMOVED VERY SOON. Use UserAgent_DEPRECATED.webkit */ safari: function() { return UserAgent_DEPRECATED.webkit(); }, /** * Check if the UA is a Chrome browser. * * * @return float|NaN Version number (if match) or NaN. */ chrome : function() { return _populate() || _chrome; }, /** * Check if the user is running Windows. * * @return bool `true' if the user's OS is Windows. */ windows: function() { return _populate() || _windows; }, /** * Check if the user is running Mac OS X. * * @return float|bool Returns a float if a version number is detected, * otherwise true/false. */ osx: function() { return _populate() || _osx; }, /** * Check if the user is running Linux. * * @return bool `true' if the user's OS is some flavor of Linux. */ linux: function() { return _populate() || _linux; }, /** * Check if the user is running on an iPhone or iPod platform. * * @return bool `true' if the user is running some flavor of the * iPhone OS. */ iphone: function() { return _populate() || _iphone; }, mobile: function() { return _populate() || (_iphone || _ipad || _android || _mobile); }, nativeApp: function() { // webviews inside of the native apps return _populate() || _native; }, android: function() { return _populate() || _android; }, ipad: function() { return _populate() || _ipad; } }; module.exports = UserAgent_DEPRECATED; /***/ }), /***/ 2327: /***/ ((module) => { "use strict"; const SINGLE_QUOTE = "'".charCodeAt(0) const DOUBLE_QUOTE = '"'.charCodeAt(0) const BACKSLASH = '\\'.charCodeAt(0) const SLASH = '/'.charCodeAt(0) const NEWLINE = '\n'.charCodeAt(0) const SPACE = ' '.charCodeAt(0) const FEED = '\f'.charCodeAt(0) const TAB = '\t'.charCodeAt(0) const CR = '\r'.charCodeAt(0) const OPEN_SQUARE = '['.charCodeAt(0) const CLOSE_SQUARE = ']'.charCodeAt(0) const OPEN_PARENTHESES = '('.charCodeAt(0) const CLOSE_PARENTHESES = ')'.charCodeAt(0) const OPEN_CURLY = '{'.charCodeAt(0) const CLOSE_CURLY = '}'.charCodeAt(0) const SEMICOLON = ';'.charCodeAt(0) const ASTERISK = '*'.charCodeAt(0) const COLON = ':'.charCodeAt(0) const AT = '@'.charCodeAt(0) const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g const RE_BAD_BRACKET = /.[\r\n"'(/\\]/ const RE_HEX_ESCAPE = /[\da-f]/i module.exports = function tokenizer(input, options = {}) { let css = input.css.valueOf() let ignore = options.ignoreErrors let code, content, escape, next, quote let currentToken, escaped, escapePos, n, prev let length = css.length let pos = 0 let buffer = [] let returned = [] function position() { return pos } function unclosed(what) { throw input.error('Unclosed ' + what, pos) } function endOfFile() { return returned.length === 0 && pos >= length } function nextToken(opts) { if (returned.length) return returned.pop() if (pos >= length) return let ignoreUnclosed = opts ? opts.ignoreUnclosed : false code = css.charCodeAt(pos) switch (code) { case NEWLINE: case SPACE: case TAB: case CR: case FEED: { next = pos do { next += 1 code = css.charCodeAt(next) } while ( code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED ) currentToken = ['space', css.slice(pos, next)] pos = next - 1 break } case OPEN_SQUARE: case CLOSE_SQUARE: case OPEN_CURLY: case CLOSE_CURLY: case COLON: case SEMICOLON: case CLOSE_PARENTHESES: { let controlChar = String.fromCharCode(code) currentToken = [controlChar, controlChar, pos] break } case OPEN_PARENTHESES: { prev = buffer.length ? buffer.pop()[1] : '' n = css.charCodeAt(pos + 1) if ( prev === 'url' && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR ) { next = pos do { escaped = false next = css.indexOf(')', next + 1) if (next === -1) { if (ignore || ignoreUnclosed) { next = pos break } else { unclosed('bracket') } } escapePos = next while (css.charCodeAt(escapePos - 1) === BACKSLASH) { escapePos -= 1 escaped = !escaped } } while (escaped) currentToken = ['brackets', css.slice(pos, next + 1), pos, next] pos = next } else { next = css.indexOf(')', pos + 1) content = css.slice(pos, next + 1) if (next === -1 || RE_BAD_BRACKET.test(content)) { currentToken = ['(', '(', pos] } else { currentToken = ['brackets', content, pos, next] pos = next } } break } case SINGLE_QUOTE: case DOUBLE_QUOTE: { quote = code === SINGLE_QUOTE ? "'" : '"' next = pos do { escaped = false next = css.indexOf(quote, next + 1) if (next === -1) { if (ignore || ignoreUnclosed) { next = pos + 1 break } else { unclosed('string') } } escapePos = next while (css.charCodeAt(escapePos - 1) === BACKSLASH) { escapePos -= 1 escaped = !escaped } } while (escaped) currentToken = ['string', css.slice(pos, next + 1), pos, next] pos = next break } case AT: { RE_AT_END.lastIndex = pos + 1 RE_AT_END.test(css) if (RE_AT_END.lastIndex === 0) { next = css.length - 1 } else { next = RE_AT_END.lastIndex - 2 } currentToken = ['at-word', css.slice(pos, next + 1), pos, next] pos = next break } case BACKSLASH: { next = pos escape = true while (css.charCodeAt(next + 1) === BACKSLASH) { next += 1 escape = !escape } code = css.charCodeAt(next + 1) if ( escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED ) { next += 1 if (RE_HEX_ESCAPE.test(css.charAt(next))) { while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) { next += 1 } if (css.charCodeAt(next + 1) === SPACE) { next += 1 } } } currentToken = ['word', css.slice(pos, next + 1), pos, next] pos = next break } default: { if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) { next = css.indexOf('*/', pos + 2) + 1 if (next === 0) { if (ignore || ignoreUnclosed) { next = css.length } else { unclosed('comment') } } currentToken = ['comment', css.slice(pos, next + 1), pos, next] pos = next } else { RE_WORD_END.lastIndex = pos + 1 RE_WORD_END.test(css) if (RE_WORD_END.lastIndex === 0) { next = css.length - 1 } else { next = RE_WORD_END.lastIndex - 2 } currentToken = ['word', css.slice(pos, next + 1), pos, next] buffer.push(currentToken) pos = next } break } } pos++ return currentToken } function back(token) { returned.push(token) } return { back, endOfFile, nextToken, position } } /***/ }), /***/ 2739: /***/ (() => { /* (ignored) */ /***/ }), /***/ 2775: /***/ ((module) => { var x=String; var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x,blackBright:x,redBright:x,greenBright:x,yellowBright:x,blueBright:x,magentaBright:x,cyanBright:x,whiteBright:x,bgBlackBright:x,bgRedBright:x,bgGreenBright:x,bgYellowBright:x,bgBlueBright:x,bgMagentaBright:x,bgCyanBright:x,bgWhiteBright:x}}; module.exports=create(); module.exports.createColors = create; /***/ }), /***/ 3122: /***/ ((module) => { "use strict"; /* eslint-disable no-console */ let printed = {} module.exports = function warnOnce(message) { if (printed[message]) return printed[message] = true if (typeof console !== 'undefined' && console.warn) { console.warn(message) } } /***/ }), /***/ 3815: /***/ ((module) => { module.exports = function walk(nodes, cb, bubble) { var i, max, node, result; for (i = 0, max = nodes.length; i < max; i += 1) { node = nodes[i]; if (!bubble) { result = cb(node, i, nodes); } if ( result !== false && node.type === "function" && Array.isArray(node.nodes) ) { walk(node.nodes, cb, bubble); } if (bubble) { cb(node, i, nodes); } } }; /***/ }), /***/ 3937: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let AtRule = __webpack_require__(1326) let Comment = __webpack_require__(6589) let Declaration = __webpack_require__(1516) let Root = __webpack_require__(9434) let Rule = __webpack_require__(4092) let tokenizer = __webpack_require__(2327) const SAFE_COMMENT_NEIGHBOR = { empty: true, space: true } function findLastWithPosition(tokens) { for (let i = tokens.length - 1; i >= 0; i--) { let token = tokens[i] let pos = token[3] || token[2] if (pos) return pos } } class Parser { constructor(input) { this.input = input this.root = new Root() this.current = this.root this.spaces = '' this.semicolon = false this.createTokenizer() this.root.source = { input, start: { column: 1, line: 1, offset: 0 } } } atrule(token) { let node = new AtRule() node.name = token[1].slice(1) if (node.name === '') { this.unnamedAtrule(node, token) } this.init(node, token[2]) let type let prev let shift let last = false let open = false let params = [] let brackets = [] while (!this.tokenizer.endOfFile()) { token = this.tokenizer.nextToken() type = token[0] if (type === '(' || type === '[') { brackets.push(type === '(' ? ')' : ']') } else if (type === '{' && brackets.length > 0) { brackets.push('}') } else if (type === brackets[brackets.length - 1]) { brackets.pop() } if (brackets.length === 0) { if (type === ';') { node.source.end = this.getPosition(token[2]) node.source.end.offset++ this.semicolon = true break } else if (type === '{') { open = true break } else if (type === '}') { if (params.length > 0) { shift = params.length - 1 prev = params[shift] while (prev && prev[0] === 'space') { prev = params[--shift] } if (prev) { node.source.end = this.getPosition(prev[3] || prev[2]) node.source.end.offset++ } } this.end(token) break } else { params.push(token) } } else { params.push(token) } if (this.tokenizer.endOfFile()) { last = true break } } node.raws.between = this.spacesAndCommentsFromEnd(params) if (params.length) { node.raws.afterName = this.spacesAndCommentsFromStart(params) this.raw(node, 'params', params) if (last) { token = params[params.length - 1] node.source.end = this.getPosition(token[3] || token[2]) node.source.end.offset++ this.spaces = node.raws.between node.raws.between = '' } } else { node.raws.afterName = '' node.params = '' } if (open) { node.nodes = [] this.current = node } } checkMissedSemicolon(tokens) { let colon = this.colon(tokens) if (colon === false) return let founded = 0 let token for (let j = colon - 1; j >= 0; j--) { token = tokens[j] if (token[0] !== 'space') { founded += 1 if (founded === 2) break } } // If the token is a word, e.g. `!important`, `red` or any other valid property's value. // Then we need to return the colon after that word token. [3] is the "end" colon of that word. // And because we need it after that one we do +1 to get the next one. throw this.input.error( 'Missed semicolon', token[0] === 'word' ? token[3] + 1 : token[2] ) } colon(tokens) { let brackets = 0 let prev, token, type for (let [i, element] of tokens.entries()) { token = element type = token[0] if (type === '(') { brackets += 1 } if (type === ')') { brackets -= 1 } if (brackets === 0 && type === ':') { if (!prev) { this.doubleColon(token) } else if (prev[0] === 'word' && prev[1] === 'progid') { continue } else { return i } } prev = token } return false } comment(token) { let node = new Comment() this.init(node, token[2]) node.source.end = this.getPosition(token[3] || token[2]) node.source.end.offset++ let text = token[1].slice(2, -2) if (/^\s*$/.test(text)) { node.text = '' node.raws.left = text node.raws.right = '' } else { let match = text.match(/^(\s*)([^]*\S)(\s*)$/) node.text = match[2] node.raws.left = match[1] node.raws.right = match[3] } } createTokenizer() { this.tokenizer = tokenizer(this.input) } decl(tokens, customProperty) { let node = new Declaration() this.init(node, tokens[0][2]) let last = tokens[tokens.length - 1] if (last[0] === ';') { this.semicolon = true tokens.pop() } node.source.end = this.getPosition( last[3] || last[2] || findLastWithPosition(tokens) ) node.source.end.offset++ while (tokens[0][0] !== 'word') { if (tokens.length === 1) this.unknownWord(tokens) node.raws.before += tokens.shift()[1] } node.source.start = this.getPosition(tokens[0][2]) node.prop = '' while (tokens.length) { let type = tokens[0][0] if (type === ':' || type === 'space' || type === 'comment') { break } node.prop += tokens.shift()[1] } node.raws.between = '' let token while (tokens.length) { token = tokens.shift() if (token[0] === ':') { node.raws.between += token[1] break } else { if (token[0] === 'word' && /\w/.test(token[1])) { this.unknownWord([token]) } node.raws.between += token[1] } } if (node.prop[0] === '_' || node.prop[0] === '*') { node.raws.before += node.prop[0] node.prop = node.prop.slice(1) } let firstSpaces = [] let next while (tokens.length) { next = tokens[0][0] if (next !== 'space' && next !== 'comment') break firstSpaces.push(tokens.shift()) } this.precheckMissedSemicolon(tokens) for (let i = tokens.length - 1; i >= 0; i--) { token = tokens[i] if (token[1].toLowerCase() === '!important') { node.important = true let string = this.stringFrom(tokens, i) string = this.spacesFromEnd(tokens) + string if (string !== ' !important') node.raws.important = string break } else if (token[1].toLowerCase() === 'important') { let cache = tokens.slice(0) let str = '' for (let j = i; j > 0; j--) { let type = cache[j][0] if (str.trim().startsWith('!') && type !== 'space') { break } str = cache.pop()[1] + str } if (str.trim().startsWith('!')) { node.important = true node.raws.important = str tokens = cache } } if (token[0] !== 'space' && token[0] !== 'comment') { break } } let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment') if (hasWord) { node.raws.between += firstSpaces.map(i => i[1]).join('') firstSpaces = [] } this.raw(node, 'value', firstSpaces.concat(tokens), customProperty) if (node.value.includes(':') && !customProperty) { this.checkMissedSemicolon(tokens) } } doubleColon(token) { throw this.input.error( 'Double colon', { offset: token[2] }, { offset: token[2] + token[1].length } ) } emptyRule(token) { let node = new Rule() this.init(node, token[2]) node.selector = '' node.raws.between = '' this.current = node } end(token) { if (this.current.nodes && this.current.nodes.length) { this.current.raws.semicolon = this.semicolon } this.semicolon = false this.current.raws.after = (this.current.raws.after || '') + this.spaces this.spaces = '' if (this.current.parent) { this.current.source.end = this.getPosition(token[2]) this.current.source.end.offset++ this.current = this.current.parent } else { this.unexpectedClose(token) } } endFile() { if (this.current.parent) this.unclosedBlock() if (this.current.nodes && this.current.nodes.length) { this.current.raws.semicolon = this.semicolon } this.current.raws.after = (this.current.raws.after || '') + this.spaces this.root.source.end = this.getPosition(this.tokenizer.position()) } freeSemicolon(token) { this.spaces += token[1] if (this.current.nodes) { let prev = this.current.nodes[this.current.nodes.length - 1] if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) { prev.raws.ownSemicolon = this.spaces this.spaces = '' prev.source.end = this.getPosition(token[2]) prev.source.end.offset += prev.raws.ownSemicolon.length } } } // Helpers getPosition(offset) { let pos = this.input.fromOffset(offset) return { column: pos.col, line: pos.line, offset } } init(node, offset) { this.current.push(node) node.source = { input: this.input, start: this.getPosition(offset) } node.raws.before = this.spaces this.spaces = '' if (node.type !== 'comment') this.semicolon = false } other(start) { let end = false let type = null let colon = false let bracket = null let brackets = [] let customProperty = start[1].startsWith('--') let tokens = [] let token = start while (token) { type = token[0] tokens.push(token) if (type === '(' || type === '[') { if (!bracket) bracket = token brackets.push(type === '(' ? ')' : ']') } else if (customProperty && colon && type === '{') { if (!bracket) bracket = token brackets.push('}') } else if (brackets.length === 0) { if (type === ';') { if (colon) { this.decl(tokens, customProperty) return } else { break } } else if (type === '{') { this.rule(tokens) return } else if (type === '}') { this.tokenizer.back(tokens.pop()) end = true break } else if (type === ':') { colon = true } } else if (type === brackets[brackets.length - 1]) { brackets.pop() if (brackets.length === 0) bracket = null } token = this.tokenizer.nextToken() } if (this.tokenizer.endOfFile()) end = true if (brackets.length > 0) this.unclosedBracket(bracket) if (end && colon) { if (!customProperty) { while (tokens.length) { token = tokens[tokens.length - 1][0] if (token !== 'space' && token !== 'comment') break this.tokenizer.back(tokens.pop()) } } this.decl(tokens, customProperty) } else { this.unknownWord(tokens) } } parse() { let token while (!this.tokenizer.endOfFile()) { token = this.tokenizer.nextToken() switch (token[0]) { case 'space': this.spaces += token[1] break case ';': this.freeSemicolon(token) break case '}': this.end(token) break case 'comment': this.comment(token) break case 'at-word': this.atrule(token) break case '{': this.emptyRule(token) break default: this.other(token) break } } this.endFile() } precheckMissedSemicolon(/* tokens */) { // Hook for Safe Parser } raw(node, prop, tokens, customProperty) { let token, type let length = tokens.length let value = '' let clean = true let next, prev for (let i = 0; i < length; i += 1) { token = tokens[i] type = token[0] if (type === 'space' && i === length - 1 && !customProperty) { clean = false } else if (type === 'comment') { prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty' next = tokens[i + 1] ? tokens[i + 1][0] : 'empty' if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) { if (value.slice(-1) === ',') { clean = false } else { value += token[1] } } else { clean = false } } else { value += token[1] } } if (!clean) { let raw = tokens.reduce((all, i) => all + i[1], '') node.raws[prop] = { raw, value } } node[prop] = value } rule(tokens) { tokens.pop() let node = new Rule() this.init(node, tokens[0][2]) node.raws.between = this.spacesAndCommentsFromEnd(tokens) this.raw(node, 'selector', tokens) this.current = node } spacesAndCommentsFromEnd(tokens) { let lastTokenType let spaces = '' while (tokens.length) { lastTokenType = tokens[tokens.length - 1][0] if (lastTokenType !== 'space' && lastTokenType !== 'comment') break spaces = tokens.pop()[1] + spaces } return spaces } // Errors spacesAndCommentsFromStart(tokens) { let next let spaces = '' while (tokens.length) { next = tokens[0][0] if (next !== 'space' && next !== 'comment') break spaces += tokens.shift()[1] } return spaces } spacesFromEnd(tokens) { let lastTokenType let spaces = '' while (tokens.length) { lastTokenType = tokens[tokens.length - 1][0] if (lastTokenType !== 'space') break spaces = tokens.pop()[1] + spaces } return spaces } stringFrom(tokens, from) { let result = '' for (let i = from; i < tokens.length; i++) { result += tokens[i][1] } tokens.splice(from, tokens.length - from) return result } unclosedBlock() { let pos = this.current.source.start throw this.input.error('Unclosed block', pos.line, pos.column) } unclosedBracket(bracket) { throw this.input.error( 'Unclosed bracket', { offset: bracket[2] }, { offset: bracket[2] + 1 } ) } unexpectedClose(token) { throw this.input.error( 'Unexpected }', { offset: token[2] }, { offset: token[2] + 1 } ) } unknownWord(tokens) { throw this.input.error( 'Unknown word ' + tokens[0][1], { offset: tokens[0][2] }, { offset: tokens[0][2] + tokens[0][1].length } ) } unnamedAtrule(node, token) { throw this.input.error( 'At-rule without name', { offset: token[2] }, { offset: token[2] + token[1].length } ) } } module.exports = Parser /***/ }), /***/ 4067: /***/ ((module) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; /***/ }), /***/ 4092: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let list = __webpack_require__(7374) class Rule extends Container { get selectors() { return list.comma(this.selector) } set selectors(values) { let match = this.selector ? this.selector.match(/,\s*/) : null let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen') this.selector = values.join(sep) } constructor(defaults) { super(defaults) this.type = 'rule' if (!this.nodes) this.nodes = [] } } module.exports = Rule Rule.default = Rule Container.registerRule(Rule) /***/ }), /***/ 4132: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = true; var TextareaAutosize_1 = __webpack_require__(4462); exports.A = TextareaAutosize_1.TextareaAutosize; /***/ }), /***/ 4295: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let Input = __webpack_require__(5380) let Parser = __webpack_require__(3937) function parse(css, opts) { let input = new Input(css, opts) let parser = new Parser(input) try { parser.parse() } catch (e) { if (false) {} throw e } return parser.root } module.exports = parse parse.default = parse Container.registerParse(parse) /***/ }), /***/ 4306: /***/ (function(module, exports) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize */ (function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { var mod; } })(this, function (module, exports) { 'use strict'; var map = typeof Map === "function" ? new Map() : function () { var keys = []; var values = []; return { has: function has(key) { return keys.indexOf(key) > -1; }, get: function get(key) { return values[keys.indexOf(key)]; }, set: function set(key, value) { if (keys.indexOf(key) === -1) { keys.push(key); values.push(value); } }, delete: function _delete(key) { var index = keys.indexOf(key); if (index > -1) { keys.splice(index, 1); values.splice(index, 1); } } }; }(); var createEvent = function createEvent(name) { return new Event(name, { bubbles: true }); }; try { new Event('test'); } catch (e) { // IE does not support `new Event()` createEvent = function createEvent(name) { var evt = document.createEvent('Event'); evt.initEvent(name, true, false); return evt; }; } function assign(ta) { if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; var heightOffset = null; var clientWidth = null; var cachedHeight = null; function init() { var style = window.getComputedStyle(ta, null); if (style.resize === 'vertical') { ta.style.resize = 'none'; } else if (style.resize === 'both') { ta.style.resize = 'horizontal'; } if (style.boxSizing === 'content-box') { heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); } else { heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); } // Fix when a textarea is not on document body and heightOffset is Not a Number if (isNaN(heightOffset)) { heightOffset = 0; } update(); } function changeOverflow(value) { { // Chrome/Safari-specific fix: // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space // made available by removing the scrollbar. The following forces the necessary text reflow. var width = ta.style.width; ta.style.width = '0px'; // Force reflow: /* jshint ignore:start */ ta.offsetWidth; /* jshint ignore:end */ ta.style.width = width; } ta.style.overflowY = value; } function getParentOverflows(el) { var arr = []; while (el && el.parentNode && el.parentNode instanceof Element) { if (el.parentNode.scrollTop) { arr.push({ node: el.parentNode, scrollTop: el.parentNode.scrollTop }); } el = el.parentNode; } return arr; } function resize() { if (ta.scrollHeight === 0) { // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. return; } var overflows = getParentOverflows(ta); var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) ta.style.height = ''; ta.style.height = ta.scrollHeight + heightOffset + 'px'; // used to check if an update is actually necessary on window.resize clientWidth = ta.clientWidth; // prevents scroll-position jumping overflows.forEach(function (el) { el.node.scrollTop = el.scrollTop; }); if (docTop) { document.documentElement.scrollTop = docTop; } } function update() { resize(); var styleHeight = Math.round(parseFloat(ta.style.height)); var computed = window.getComputedStyle(ta, null); // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; // The actual height not matching the style height (set via the resize method) indicates that // the max-height has been exceeded, in which case the overflow should be allowed. if (actualHeight < styleHeight) { if (computed.overflowY === 'hidden') { changeOverflow('scroll'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } else { // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. if (computed.overflowY !== 'hidden') { changeOverflow('hidden'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } if (cachedHeight !== actualHeight) { cachedHeight = actualHeight; var evt = createEvent('autosize:resized'); try { ta.dispatchEvent(evt); } catch (err) { // Firefox will throw an error on dispatchEvent for a detached element // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 } } } var pageResize = function pageResize() { if (ta.clientWidth !== clientWidth) { update(); } }; var destroy = function (style) { window.removeEventListener('resize', pageResize, false); ta.removeEventListener('input', update, false); ta.removeEventListener('keyup', update, false); ta.removeEventListener('autosize:destroy', destroy, false); ta.removeEventListener('autosize:update', update, false); Object.keys(style).forEach(function (key) { ta.style[key] = style[key]; }); map.delete(ta); }.bind(ta, { height: ta.style.height, resize: ta.style.resize, overflowY: ta.style.overflowY, overflowX: ta.style.overflowX, wordWrap: ta.style.wordWrap }); ta.addEventListener('autosize:destroy', destroy, false); // IE9 does not fire onpropertychange or oninput for deletions, // so binding to onkeyup to catch most of those events. // There is no way that I know of to detect something like 'cut' in IE9. if ('onpropertychange' in ta && 'oninput' in ta) { ta.addEventListener('keyup', update, false); } window.addEventListener('resize', pageResize, false); ta.addEventListener('input', update, false); ta.addEventListener('autosize:update', update, false); ta.style.overflowX = 'hidden'; ta.style.wordWrap = 'break-word'; map.set(ta, { destroy: destroy, update: update }); init(); } function destroy(ta) { var methods = map.get(ta); if (methods) { methods.destroy(); } } function update(ta) { var methods = map.get(ta); if (methods) { methods.update(); } } var autosize = null; // Do nothing in Node.js environment and IE8 (or lower) if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { autosize = function autosize(el) { return el; }; autosize.destroy = function (el) { return el; }; autosize.update = function (el) { return el; }; } else { autosize = function autosize(el, options) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], function (x) { return assign(x, options); }); } return el; }; autosize.destroy = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], destroy); } return el; }; autosize.update = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], update); } return el; }; } exports.default = autosize; module.exports = exports['default']; }); /***/ }), /***/ 4462: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; exports.__esModule = true; var React = __webpack_require__(1609); var PropTypes = __webpack_require__(5826); var autosize = __webpack_require__(4306); var _getLineHeight = __webpack_require__(461); var getLineHeight = _getLineHeight; var RESIZED = "autosize:resized"; /** * A light replacement for built-in textarea component * which automaticaly adjusts its height to match the content */ var TextareaAutosizeClass = /** @class */ (function (_super) { __extends(TextareaAutosizeClass, _super); function TextareaAutosizeClass() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.state = { lineHeight: null }; _this.textarea = null; _this.onResize = function (e) { if (_this.props.onResize) { _this.props.onResize(e); } }; _this.updateLineHeight = function () { if (_this.textarea) { _this.setState({ lineHeight: getLineHeight(_this.textarea) }); } }; _this.onChange = function (e) { var onChange = _this.props.onChange; _this.currentValue = e.currentTarget.value; onChange && onChange(e); }; return _this; } TextareaAutosizeClass.prototype.componentDidMount = function () { var _this = this; var _a = this.props, maxRows = _a.maxRows, async = _a.async; if (typeof maxRows === "number") { this.updateLineHeight(); } if (typeof maxRows === "number" || async) { /* the defer is needed to: - force "autosize" to activate the scrollbar when this.props.maxRows is passed - support StyledComponents (see #71) */ setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); } else { this.textarea && autosize(this.textarea); } if (this.textarea) { this.textarea.addEventListener(RESIZED, this.onResize); } }; TextareaAutosizeClass.prototype.componentWillUnmount = function () { if (this.textarea) { this.textarea.removeEventListener(RESIZED, this.onResize); autosize.destroy(this.textarea); } }; TextareaAutosizeClass.prototype.render = function () { var _this = this; var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { _this.textarea = element; if (typeof _this.props.innerRef === 'function') { _this.props.innerRef(element); } else if (_this.props.innerRef) { _this.props.innerRef.current = element; } } }), children)); }; TextareaAutosizeClass.prototype.componentDidUpdate = function () { this.textarea && autosize.update(this.textarea); }; TextareaAutosizeClass.defaultProps = { rows: 1, async: false }; TextareaAutosizeClass.propTypes = { rows: PropTypes.number, maxRows: PropTypes.number, onResize: PropTypes.func, innerRef: PropTypes.any, async: PropTypes.bool }; return TextareaAutosizeClass; }(React.Component)); exports.TextareaAutosize = React.forwardRef(function (props, ref) { return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); }); /***/ }), /***/ 4725: /***/ ((module) => { function stringifyNode(node, custom) { var type = node.type; var value = node.value; var buf; var customResult; if (custom && (customResult = custom(node)) !== undefined) { return customResult; } else if (type === "word" || type === "space") { return value; } else if (type === "string") { buf = node.quote || ""; return buf + value + (node.unclosed ? "" : buf); } else if (type === "comment") { return "/*" + value + (node.unclosed ? "" : "*/"); } else if (type === "div") { return (node.before || "") + value + (node.after || ""); } else if (Array.isArray(node.nodes)) { buf = stringify(node.nodes, custom); if (type !== "function") { return buf; } return ( value + "(" + (node.before || "") + buf + (node.after || "") + (node.unclosed ? "" : ")") ); } return value; } function stringify(nodes, custom) { var result, i; if (Array.isArray(nodes)) { result = ""; for (i = nodes.length - 1; ~i; i -= 1) { result = stringifyNode(nodes[i], custom) + result; } return result; } return stringifyNode(nodes, custom); } module.exports = stringify; /***/ }), /***/ 5042: /***/ ((module) => { // This alphabet uses `A-Za-z0-9_-` symbols. // The order of characters is optimized for better gzip and brotli compression. // References to the same file (works both for gzip and brotli): // `'use`, `andom`, and `rict'` // References to the brotli default dictionary: // `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf` let urlAlphabet = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' let customAlphabet = (alphabet, defaultSize = 21) => { return (size = defaultSize) => { let id = '' // A compact alternative for `for (var i = 0; i < step; i++)`. let i = size | 0 while (i--) { // `| 0` is more compact and faster than `Math.floor()`. id += alphabet[(Math.random() * alphabet.length) | 0] } return id } } let nanoid = (size = 21) => { let id = '' // A compact alternative for `for (var i = 0; i < step; i++)`. let i = size | 0 while (i--) { // `| 0` is more compact and faster than `Math.floor()`. id += urlAlphabet[(Math.random() * 64) | 0] } return id } module.exports = { nanoid, customAlphabet } /***/ }), /***/ 5215: /***/ ((module) => { "use strict"; // do not edit .js files directly - edit src/index.jst module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }), /***/ 5380: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let { nanoid } = __webpack_require__(5042) let { isAbsolute, resolve } = __webpack_require__(197) let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866) let { fileURLToPath, pathToFileURL } = __webpack_require__(2739) let CssSyntaxError = __webpack_require__(356) let PreviousMap = __webpack_require__(5696) let terminalHighlight = __webpack_require__(9746) let fromOffsetCache = Symbol('fromOffsetCache') let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) let pathAvailable = Boolean(resolve && isAbsolute) class Input { get from() { return this.file || this.id } constructor(css, opts = {}) { if ( css === null || typeof css === 'undefined' || (typeof css === 'object' && !css.toString) ) { throw new Error(`PostCSS received ${css} instead of CSS string`) } this.css = css.toString() if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') { this.hasBOM = true this.css = this.css.slice(1) } else { this.hasBOM = false } this.document = this.css if (opts.document) this.document = opts.document.toString() if (opts.from) { if ( !pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from) ) { this.file = opts.from } else { this.file = resolve(opts.from) } } if (pathAvailable && sourceMapAvailable) { let map = new PreviousMap(this.css, opts) if (map.text) { this.map = map let file = map.consumer().file if (!this.file && file) this.file = this.mapResolve(file) } } if (!this.file) { this.id = '<input css ' + nanoid(6) + '>' } if (this.map) this.map.file = this.from } error(message, line, column, opts = {}) { let endColumn, endLine, result if (line && typeof line === 'object') { let start = line let end = column if (typeof start.offset === 'number') { let pos = this.fromOffset(start.offset) line = pos.line column = pos.col } else { line = start.line column = start.column } if (typeof end.offset === 'number') { let pos = this.fromOffset(end.offset) endLine = pos.line endColumn = pos.col } else { endLine = end.line endColumn = end.column } } else if (!column) { let pos = this.fromOffset(line) line = pos.line column = pos.col } let origin = this.origin(line, column, endLine, endColumn) if (origin) { result = new CssSyntaxError( message, origin.endLine === undefined ? origin.line : { column: origin.column, line: origin.line }, origin.endLine === undefined ? origin.column : { column: origin.endColumn, line: origin.endLine }, origin.source, origin.file, opts.plugin ) } else { result = new CssSyntaxError( message, endLine === undefined ? line : { column, line }, endLine === undefined ? column : { column: endColumn, line: endLine }, this.css, this.file, opts.plugin ) } result.input = { column, endColumn, endLine, line, source: this.css } if (this.file) { if (pathToFileURL) { result.input.url = pathToFileURL(this.file).toString() } result.input.file = this.file } return result } fromOffset(offset) { let lastLine, lineToIndex if (!this[fromOffsetCache]) { let lines = this.css.split('\n') lineToIndex = new Array(lines.length) let prevIndex = 0 for (let i = 0, l = lines.length; i < l; i++) { lineToIndex[i] = prevIndex prevIndex += lines[i].length + 1 } this[fromOffsetCache] = lineToIndex } else { lineToIndex = this[fromOffsetCache] } lastLine = lineToIndex[lineToIndex.length - 1] let min = 0 if (offset >= lastLine) { min = lineToIndex.length - 1 } else { let max = lineToIndex.length - 2 let mid while (min < max) { mid = min + ((max - min) >> 1) if (offset < lineToIndex[mid]) { max = mid - 1 } else if (offset >= lineToIndex[mid + 1]) { min = mid + 1 } else { min = mid break } } } return { col: offset - lineToIndex[min] + 1, line: min + 1 } } mapResolve(file) { if (/^\w+:\/\//.test(file)) { return file } return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file) } origin(line, column, endLine, endColumn) { if (!this.map) return false let consumer = this.map.consumer() let from = consumer.originalPositionFor({ column, line }) if (!from.source) return false let to if (typeof endLine === 'number') { to = consumer.originalPositionFor({ column: endColumn, line: endLine }) } let fromUrl if (isAbsolute(from.source)) { fromUrl = pathToFileURL(from.source) } else { fromUrl = new URL( from.source, this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile) ) } let result = { column: from.column, endColumn: to && to.column, endLine: to && to.line, line: from.line, url: fromUrl.toString() } if (fromUrl.protocol === 'file:') { if (fileURLToPath) { result.file = fileURLToPath(fromUrl) } else { /* c8 ignore next 2 */ throw new Error(`file: protocol is not available in this PostCSS build`) } } let source = consumer.sourceContentFor(from.source) if (source) result.source = source return result } toJSON() { let json = {} for (let name of ['hasBOM', 'css', 'file', 'id']) { if (this[name] != null) { json[name] = this[name] } } if (this.map) { json.map = { ...this.map } if (json.map.consumerCache) { json.map.consumerCache = undefined } } return json } } module.exports = Input Input.default = Input if (terminalHighlight && terminalHighlight.registerInput) { terminalHighlight.registerInput(Input) } /***/ }), /***/ 5404: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const CSSValueParser = __webpack_require__(1544) /** * @type {import('postcss').PluginCreator} */ module.exports = (opts) => { const DEFAULTS = { skipHostRelativeUrls: true, } const config = Object.assign(DEFAULTS, opts) return { postcssPlugin: 'rebaseUrl', Declaration(decl) { // The faster way to find Declaration node const parsedValue = CSSValueParser(decl.value) let valueChanged = false parsedValue.walk(node => { if (node.type !== 'function' || node.value !== 'url') { return } const urlVal = node.nodes[0].value // bases relative URLs with rootUrl const basedUrl = new URL(urlVal, opts.rootUrl) // skip host-relative, already normalized URLs (e.g. `/images/image.jpg`, without `..`s) if ((basedUrl.pathname === urlVal) && config.skipHostRelativeUrls) { return false // skip this value } node.nodes[0].value = basedUrl.toString() valueChanged = true return false // do not walk deeper }) if (valueChanged) { decl.value = CSSValueParser.stringify(parsedValue) } } } } module.exports.postcss = true /***/ }), /***/ 5417: /***/ ((__unused_webpack_module, exports) => { "use strict"; /*istanbul ignore start*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = Diff; /*istanbul ignore end*/ function Diff() {} Diff.prototype = { /*istanbul ignore start*/ /*istanbul ignore end*/ diff: function diff(oldString, newString) { /*istanbul ignore start*/ var /*istanbul ignore end*/ options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var callback = options.callback; if (typeof options === 'function') { callback = options; options = {}; } this.options = options; var self = this; function done(value) { if (callback) { setTimeout(function () { callback(undefined, value); }, 0); return true; } else { return value; } } // Allow subclasses to massage the input prior to running oldString = this.castInput(oldString); newString = this.castInput(newString); oldString = this.removeEmpty(this.tokenize(oldString)); newString = this.removeEmpty(this.tokenize(newString)); var newLen = newString.length, oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; var bestPath = [{ newPos: -1, components: [] }]; // Seed editLength = 0, i.e. the content starts with the same values var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { // Identity per the equality and tokenizer return done([{ value: this.join(newString), count: newString.length }]); } // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { var basePath = /*istanbul ignore start*/ void 0 /*istanbul ignore end*/ ; var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; if (addPath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; } // Select the diagonal that we want to branch from. We select the prior // path whose position in the new string is the farthest from the origin // and does not pass the bounds of the diff graph if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { basePath = clonePath(removePath); self.pushComponent(basePath.components, undefined, true); } else { basePath = addPath; // No need to clone, we've pulled it from the list basePath.newPos++; self.pushComponent(basePath.components, true, undefined); } _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); } else { // Otherwise track this path as a potential candidate and continue. bestPath[diagonalPath] = basePath; } } editLength++; } // Performs the length of edit iteration. Is a bit fugly as this has to support the // sync and async mode which is never fun. Loops over execEditLength until a value // is produced. if (callback) { (function exec() { setTimeout(function () { // This should not happen, but we want to be safe. /* istanbul ignore next */ if (editLength > maxEditLength) { return callback(); } if (!execEditLength()) { exec(); } }, 0); })(); } else { while (editLength <= maxEditLength) { var ret = execEditLength(); if (ret) { return ret; } } } }, /*istanbul ignore start*/ /*istanbul ignore end*/ pushComponent: function pushComponent(components, added, removed) { var last = components[components.length - 1]; if (last && last.added === added && last.removed === removed) { // We need to clone here as the component clone operation is just // as shallow array clone components[components.length - 1] = { count: last.count + 1, added: added, removed: removed }; } else { components.push({ count: 1, added: added, removed: removed }); } }, /*istanbul ignore start*/ /*istanbul ignore end*/ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0; while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { newPos++; oldPos++; commonCount++; } if (commonCount) { basePath.components.push({ count: commonCount }); } basePath.newPos = newPos; return oldPos; }, /*istanbul ignore start*/ /*istanbul ignore end*/ equals: function equals(left, right) { if (this.options.comparator) { return this.options.comparator(left, right); } else { return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, /*istanbul ignore start*/ /*istanbul ignore end*/ removeEmpty: function removeEmpty(array) { var ret = []; for (var i = 0; i < array.length; i++) { if (array[i]) { ret.push(array[i]); } } return ret; }, /*istanbul ignore start*/ /*istanbul ignore end*/ castInput: function castInput(value) { return value; }, /*istanbul ignore start*/ /*istanbul ignore end*/ tokenize: function tokenize(value) { return value.split(''); }, /*istanbul ignore start*/ /*istanbul ignore end*/ join: function join(chars) { return chars.join(''); } }; function buildValues(diff, components, newString, oldString, useLongestToken) { var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); value = value.map(function (value, i) { var oldValue = oldString[oldPos + i]; return oldValue.length > value.length ? oldValue : value; }); component.value = diff.join(value); } else { component.value = diff.join(newString.slice(newPos, newPos + component.count)); } newPos += component.count; // Common case if (!component.added) { oldPos += component.count; } } else { component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); oldPos += component.count; // Reverse add and remove so removes are output first to match common convention // The diffing algorithm is tied to add then remove output and this is the simplest // route to get the desired output with minimal overhead. if (componentPos && components[componentPos - 1].added) { var tmp = components[componentPos - 1]; components[componentPos - 1] = components[componentPos]; components[componentPos] = tmp; } } } // Special case handle for when one terminal is ignored (i.e. whitespace). // For this case we merge the terminal into the prior string and drop the change. // This is only available for string mode. var lastComponent = components[componentLen - 1]; if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { components[componentLen - 2].value += lastComponent.value; components.pop(); } return components; } function clonePath(path) { return { newPos: path.newPos, components: path.components.slice(0) }; } /***/ }), /***/ 5696: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let { existsSync, readFileSync } = __webpack_require__(9977) let { dirname, join } = __webpack_require__(197) let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866) function fromBase64(str) { if (Buffer) { return Buffer.from(str, 'base64').toString() } else { /* c8 ignore next 2 */ return window.atob(str) } } class PreviousMap { constructor(css, opts) { if (opts.map === false) return this.loadAnnotation(css) this.inline = this.startWith(this.annotation, 'data:') let prev = opts.map ? opts.map.prev : undefined let text = this.loadMap(opts.from, prev) if (!this.mapFile && opts.from) { this.mapFile = opts.from } if (this.mapFile) this.root = dirname(this.mapFile) if (text) this.text = text } consumer() { if (!this.consumerCache) { this.consumerCache = new SourceMapConsumer(this.text) } return this.consumerCache } decodeInline(text) { let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/ let baseUri = /^data:application\/json;base64,/ let charsetUri = /^data:application\/json;charset=utf-?8,/ let uri = /^data:application\/json,/ let uriMatch = text.match(charsetUri) || text.match(uri) if (uriMatch) { return decodeURIComponent(text.substr(uriMatch[0].length)) } let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri) if (baseUriMatch) { return fromBase64(text.substr(baseUriMatch[0].length)) } let encoding = text.match(/data:application\/json;([^,]+),/)[1] throw new Error('Unsupported source map encoding ' + encoding) } getAnnotationURL(sourceMapString) { return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim() } isMap(map) { if (typeof map !== 'object') return false return ( typeof map.mappings === 'string' || typeof map._mappings === 'string' || Array.isArray(map.sections) ) } loadAnnotation(css) { let comments = css.match(/\/\*\s*# sourceMappingURL=/g) if (!comments) return // sourceMappingURLs from comments, strings, etc. let start = css.lastIndexOf(comments.pop()) let end = css.indexOf('*/', start) if (start > -1 && end > -1) { // Locate the last sourceMappingURL to avoid pickin this.annotation = this.getAnnotationURL(css.substring(start, end)) } } loadFile(path) { this.root = dirname(path) if (existsSync(path)) { this.mapFile = path return readFileSync(path, 'utf-8').toString().trim() } } loadMap(file, prev) { if (prev === false) return false if (prev) { if (typeof prev === 'string') { return prev } else if (typeof prev === 'function') { let prevPath = prev(file) if (prevPath) { let map = this.loadFile(prevPath) if (!map) { throw new Error( 'Unable to load previous source map: ' + prevPath.toString() ) } return map } } else if (prev instanceof SourceMapConsumer) { return SourceMapGenerator.fromSourceMap(prev).toString() } else if (prev instanceof SourceMapGenerator) { return prev.toString() } else if (this.isMap(prev)) { return JSON.stringify(prev) } else { throw new Error( 'Unsupported previous source map format: ' + prev.toString() ) } } else if (this.inline) { return this.decodeInline(this.annotation) } else if (this.annotation) { let map = this.annotation if (file) map = join(dirname(file), map) return this.loadFile(map) } } startWith(string, start) { if (!string) return false return string.substr(0, start.length) === start } withContent() { return !!( this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0 ) } } module.exports = PreviousMap PreviousMap.default = PreviousMap /***/ }), /***/ 5776: /***/ ((module) => { "use strict"; class Warning { constructor(text, opts = {}) { this.type = 'warning' this.text = text if (opts.node && opts.node.source) { let range = opts.node.rangeBy(opts) this.line = range.start.line this.column = range.start.column this.endLine = range.end.line this.endColumn = range.end.column } for (let opt in opts) this[opt] = opts[opt] } toString() { if (this.node) { return this.node.error(this.text, { index: this.index, plugin: this.plugin, word: this.word }).message } if (this.plugin) { return this.plugin + ': ' + this.text } return this.text } } module.exports = Warning Warning.default = Warning /***/ }), /***/ 5826: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (false) { var throwOnDirectAccess, ReactIs; } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = __webpack_require__(628)(); } /***/ }), /***/ 6109: /***/ ((module) => { // This code has been refactored for 140 bytes // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js var computedStyle = function (el, prop, getComputedStyle) { getComputedStyle = window.getComputedStyle; // In one fell swoop return ( // If we have getComputedStyle getComputedStyle ? // Query it // TODO: From CSS-Query notes, we might need (node, null) for FF getComputedStyle(el) : // Otherwise, we are in IE and use currentStyle el.currentStyle )[ // Switch to camelCase for CSSOM // DEV: Grabbed from jQuery // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 prop.replace(/-(\w)/gi, function (word, letter) { return letter.toUpperCase(); }) ]; }; module.exports = computedStyle; /***/ }), /***/ 6589: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Node = __webpack_require__(7490) class Comment extends Node { constructor(defaults) { super(defaults) this.type = 'comment' } } module.exports = Comment Comment.default = Comment /***/ }), /***/ 7191: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule normalizeWheel * @typechecks */ var UserAgent_DEPRECATED = __webpack_require__(2213); var isEventSupported = __webpack_require__(1087); // Reasonable defaults var PIXEL_STEP = 10; var LINE_HEIGHT = 40; var PAGE_HEIGHT = 800; /** * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is * complicated, thus this doc is long and (hopefully) detailed enough to answer * your questions. * * If you need to react to the mouse wheel in a predictable way, this code is * like your bestest friend. * hugs * * * As of today, there are 4 DOM event types you can listen to: * * 'wheel' -- Chrome(31+), FF(17+), IE(9+) * 'mousewheel' -- Chrome, IE(6+), Opera, Safari * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother! * 'DOMMouseScroll' -- FF(0.9.7+) since 2003 * * So what to do? The is the best: * * normalizeWheel.getEventType(); * * In your event callback, use this code to get sane interpretation of the * deltas. This code will return an object with properties: * * spinX -- normalized spin speed (use for zoom) - x plane * spinY -- " - y plane * pixelX -- normalized distance (to pixels) - x plane * pixelY -- " - y plane * * Wheel values are provided by the browser assuming you are using the wheel to * scroll a web page by a number of lines or pixels (or pages). Values can vary * significantly on different platforms and browsers, forgetting that you can * scroll at different speeds. Some devices (like trackpads) emit more events * at smaller increments with fine granularity, and some emit massive jumps with * linear speed or acceleration. * * This code does its best to normalize the deltas for you: * * - spin is trying to normalize how far the wheel was spun (or trackpad * dragged). This is super useful for zoom support where you want to * throw away the chunky scroll steps on the PC and make those equal to * the slow and smooth tiny steps on the Mac. Key data: This code tries to * resolve a single slow step on a wheel to 1. * * - pixel is normalizing the desired scroll delta in pixel units. You'll * get the crazy differences between browsers, but at least it'll be in * pixels! * * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This * should translate to positive value zooming IN, negative zooming OUT. * This matches the newer 'wheel' event. * * Why are there spinX, spinY (or pixels)? * * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn * with a mouse. It results in side-scrolling in the browser by default. * * - spinY is what you expect -- it's the classic axis of a mouse wheel. * * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and * probably is by browsers in conjunction with fancy 3D controllers .. but * you know. * * Implementation info: * * Examples of 'wheel' event if you scroll slowly (down) by one step with an * average mouse: * * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120) * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12) * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A) * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120) * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120) * * On the trackpad: * * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6) * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A) * * On other/older browsers.. it's more complicated as there can be multiple and * also missing delta values. * * The 'wheel' event is more standard: * * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents * * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain * backward compatibility with older events. Those other values help us * better normalize spin speed. Example of what the browsers provide: * * | event.wheelDelta | event.detail * ------------------+------------------+-------------- * Safari v5/OS X | -120 | 0 * Safari v5/Win7 | -120 | 0 * Chrome v17/OS X | -120 | 0 * Chrome v17/Win7 | -120 | 0 * IE9/Win7 | -120 | undefined * Firefox v4/OS X | undefined | 1 * Firefox v4/Win7 | undefined | 3 * */ function normalizeWheel(/*object*/ event) /*object*/ { var sX = 0, sY = 0, // spinX, spinY pX = 0, pY = 0; // pixelX, pixelY // Legacy if ('detail' in event) { sY = event.detail; } if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; } if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; } if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; } // side scrolling on FF with DOMMouseScroll if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if ('deltaY' in event) { pY = event.deltaY; } if ('deltaX' in event) { pX = event.deltaX; } if ((pX || pY) && event.deltaMode) { if (event.deltaMode == 1) { // delta in LINE units pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { // delta in PAGE units pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } // Fall-back if spin cannot be determined if (pX && !sX) { sX = (pX < 1) ? -1 : 1; } if (pY && !sY) { sY = (pY < 1) ? -1 : 1; } return { spinX : sX, spinY : sY, pixelX : pX, pixelY : pY }; } /** * The best combination if you prefer spinX + spinY normalization. It favors * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with * 'wheel' event, making spin speed determination impossible. */ normalizeWheel.getEventType = function() /*string*/ { return (UserAgent_DEPRECATED.firefox()) ? 'DOMMouseScroll' : (isEventSupported('wheel')) ? 'wheel' : 'mousewheel'; }; module.exports = normalizeWheel; /***/ }), /***/ 7374: /***/ ((module) => { "use strict"; let list = { comma(string) { return list.split(string, [','], true) }, space(string) { let spaces = [' ', '\n', '\t'] return list.split(string, spaces) }, split(string, separators, last) { let array = [] let current = '' let split = false let func = 0 let inQuote = false let prevQuote = '' let escape = false for (let letter of string) { if (escape) { escape = false } else if (letter === '\\') { escape = true } else if (inQuote) { if (letter === prevQuote) { inQuote = false } } else if (letter === '"' || letter === "'") { inQuote = true prevQuote = letter } else if (letter === '(') { func += 1 } else if (letter === ')') { if (func > 0) func -= 1 } else if (func === 0) { if (separators.includes(letter)) split = true } if (split) { if (current !== '') array.push(current.trim()) current = '' split = false } else { current += letter } } if (last || current !== '') array.push(current.trim()) return array } } module.exports = list list.default = list /***/ }), /***/ 7490: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let CssSyntaxError = __webpack_require__(356) let Stringifier = __webpack_require__(346) let stringify = __webpack_require__(633) let { isClean, my } = __webpack_require__(1381) function cloneNode(obj, parent) { let cloned = new obj.constructor() for (let i in obj) { if (!Object.prototype.hasOwnProperty.call(obj, i)) { /* c8 ignore next 2 */ continue } if (i === 'proxyCache') continue let value = obj[i] let type = typeof value if (i === 'parent' && type === 'object') { if (parent) cloned[i] = parent } else if (i === 'source') { cloned[i] = value } else if (Array.isArray(value)) { cloned[i] = value.map(j => cloneNode(j, cloned)) } else { if (type === 'object' && value !== null) value = cloneNode(value) cloned[i] = value } } return cloned } function sourceOffset(inputCSS, position) { // Not all custom syntaxes support `offset` in `source.start` and `source.end` if ( position && typeof position.offset !== 'undefined' ) { return position.offset; } let column = 1 let line = 1 let offset = 0 for (let i = 0; i < inputCSS.length; i++) { if (line === position.line && column === position.column) { offset = i break } if (inputCSS[i] === '\n') { column = 1 line += 1 } else { column += 1 } } return offset } class Node { get proxyOf() { return this } constructor(defaults = {}) { this.raws = {} this[isClean] = false this[my] = true for (let name in defaults) { if (name === 'nodes') { this.nodes = [] for (let node of defaults[name]) { if (typeof node.clone === 'function') { this.append(node.clone()) } else { this.append(node) } } } else { this[name] = defaults[name] } } } addToError(error) { error.postcssNode = this if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) { let s = this.source error.stack = error.stack.replace( /\n\s{4}at /, `$&${s.input.from}:${s.start.line}:${s.start.column}$&` ) } return error } after(add) { this.parent.insertAfter(this, add) return this } assign(overrides = {}) { for (let name in overrides) { this[name] = overrides[name] } return this } before(add) { this.parent.insertBefore(this, add) return this } cleanRaws(keepBetween) { delete this.raws.before delete this.raws.after if (!keepBetween) delete this.raws.between } clone(overrides = {}) { let cloned = cloneNode(this) for (let name in overrides) { cloned[name] = overrides[name] } return cloned } cloneAfter(overrides = {}) { let cloned = this.clone(overrides) this.parent.insertAfter(this, cloned) return cloned } cloneBefore(overrides = {}) { let cloned = this.clone(overrides) this.parent.insertBefore(this, cloned) return cloned } error(message, opts = {}) { if (this.source) { let { end, start } = this.rangeBy(opts) return this.source.input.error( message, { column: start.column, line: start.line }, { column: end.column, line: end.line }, opts ) } return new CssSyntaxError(message) } getProxyProcessor() { return { get(node, prop) { if (prop === 'proxyOf') { return node } else if (prop === 'root') { return () => node.root().toProxy() } else { return node[prop] } }, set(node, prop, value) { if (node[prop] === value) return true node[prop] = value if ( prop === 'prop' || prop === 'value' || prop === 'name' || prop === 'params' || prop === 'important' || /* c8 ignore next */ prop === 'text' ) { node.markDirty() } return true } } } /* c8 ignore next 3 */ markClean() { this[isClean] = true } markDirty() { if (this[isClean]) { this[isClean] = false let next = this while ((next = next.parent)) { next[isClean] = false } } } next() { if (!this.parent) return undefined let index = this.parent.index(this) return this.parent.nodes[index + 1] } positionBy(opts) { let pos = this.source.start if (opts.index) { pos = this.positionInside(opts.index) } else if (opts.word) { let inputString = ('document' in this.source.input) ? this.source.input.document : this.source.input.css let stringRepresentation = inputString.slice( sourceOffset(inputString, this.source.start), sourceOffset(inputString, this.source.end) ) let index = stringRepresentation.indexOf(opts.word) if (index !== -1) pos = this.positionInside(index) } return pos } positionInside(index) { let column = this.source.start.column let line = this.source.start.line let inputString = ('document' in this.source.input) ? this.source.input.document : this.source.input.css let offset = sourceOffset(inputString, this.source.start) let end = offset + index for (let i = offset; i < end; i++) { if (inputString[i] === '\n') { column = 1 line += 1 } else { column += 1 } } return { column, line } } prev() { if (!this.parent) return undefined let index = this.parent.index(this) return this.parent.nodes[index - 1] } rangeBy(opts) { let start = { column: this.source.start.column, line: this.source.start.line } let end = this.source.end ? { column: this.source.end.column + 1, line: this.source.end.line } : { column: start.column + 1, line: start.line } if (opts.word) { let inputString = ('document' in this.source.input) ? this.source.input.document : this.source.input.css let stringRepresentation = inputString.slice( sourceOffset(inputString, this.source.start), sourceOffset(inputString, this.source.end) ) let index = stringRepresentation.indexOf(opts.word) if (index !== -1) { start = this.positionInside(index) end = this.positionInside( index + opts.word.length, ) } } else { if (opts.start) { start = { column: opts.start.column, line: opts.start.line } } else if (opts.index) { start = this.positionInside(opts.index) } if (opts.end) { end = { column: opts.end.column, line: opts.end.line } } else if (typeof opts.endIndex === 'number') { end = this.positionInside(opts.endIndex) } else if (opts.index) { end = this.positionInside(opts.index + 1) } } if ( end.line < start.line || (end.line === start.line && end.column <= start.column) ) { end = { column: start.column + 1, line: start.line } } return { end, start } } raw(prop, defaultType) { let str = new Stringifier() return str.raw(this, prop, defaultType) } remove() { if (this.parent) { this.parent.removeChild(this) } this.parent = undefined return this } replaceWith(...nodes) { if (this.parent) { let bookmark = this let foundSelf = false for (let node of nodes) { if (node === this) { foundSelf = true } else if (foundSelf) { this.parent.insertAfter(bookmark, node) bookmark = node } else { this.parent.insertBefore(bookmark, node) } } if (!foundSelf) { this.remove() } } return this } root() { let result = this while (result.parent && result.parent.type !== 'document') { result = result.parent } return result } toJSON(_, inputs) { let fixed = {} let emitInputs = inputs == null inputs = inputs || new Map() let inputsNextIndex = 0 for (let name in this) { if (!Object.prototype.hasOwnProperty.call(this, name)) { /* c8 ignore next 2 */ continue } if (name === 'parent' || name === 'proxyCache') continue let value = this[name] if (Array.isArray(value)) { fixed[name] = value.map(i => { if (typeof i === 'object' && i.toJSON) { return i.toJSON(null, inputs) } else { return i } }) } else if (typeof value === 'object' && value.toJSON) { fixed[name] = value.toJSON(null, inputs) } else if (name === 'source') { let inputId = inputs.get(value.input) if (inputId == null) { inputId = inputsNextIndex inputs.set(value.input, inputsNextIndex) inputsNextIndex++ } fixed[name] = { end: value.end, inputId, start: value.start } } else { fixed[name] = value } } if (emitInputs) { fixed.inputs = [...inputs.keys()].map(input => input.toJSON()) } return fixed } toProxy() { if (!this.proxyCache) { this.proxyCache = new Proxy(this, this.getProxyProcessor()) } return this.proxyCache } toString(stringifier = stringify) { if (stringifier.stringify) stringifier = stringifier.stringify let result = '' stringifier(this, i => { result += i }) return result } warn(result, text, opts) { let data = { node: this } for (let i in opts) data[i] = opts[i] return result.warn(text, data) } } module.exports = Node Node.default = Node /***/ }), /***/ 7520: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { module.exports = __webpack_require__(7191); /***/ }), /***/ 7661: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let MapGenerator = __webpack_require__(1670) let parse = __webpack_require__(4295) const Result = __webpack_require__(9055) let stringify = __webpack_require__(633) let warnOnce = __webpack_require__(3122) class NoWorkResult { get content() { return this.result.css } get css() { return this.result.css } get map() { return this.result.map } get messages() { return [] } get opts() { return this.result.opts } get processor() { return this.result.processor } get root() { if (this._root) { return this._root } let root let parser = parse try { root = parser(this._css, this._opts) } catch (error) { this.error = error } if (this.error) { throw this.error } else { this._root = root return root } } get [Symbol.toStringTag]() { return 'NoWorkResult' } constructor(processor, css, opts) { css = css.toString() this.stringified = false this._processor = processor this._css = css this._opts = opts this._map = undefined let root let str = stringify this.result = new Result(this._processor, root, this._opts) this.result.css = css let self = this Object.defineProperty(this.result, 'root', { get() { return self.root } }) let map = new MapGenerator(str, root, this._opts, css) if (map.isMap()) { let [generatedCSS, generatedMap] = map.generate() if (generatedCSS) { this.result.css = generatedCSS } if (generatedMap) { this.result.map = generatedMap } } else { map.clearAnnotation() this.result.css = map.css } } async() { if (this.error) return Promise.reject(this.error) return Promise.resolve(this.result) } catch(onRejected) { return this.async().catch(onRejected) } finally(onFinally) { return this.async().then(onFinally, onFinally) } sync() { if (this.error) throw this.error return this.result } then(onFulfilled, onRejected) { if (false) {} return this.async().then(onFulfilled, onRejected) } toString() { return this._css } warnings() { return [] } } module.exports = NoWorkResult NoWorkResult.default = NoWorkResult /***/ }), /***/ 7734: /***/ ((module) => { "use strict"; // do not edit .js files directly - edit src/index.jst var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if ((a instanceof Map) && (b instanceof Map)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false; return true; } if ((a instanceof Set) && (b instanceof Set)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; return true; } if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }), /***/ 8021: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__; /*istanbul ignore start*/ __webpack_unused_export__ = ({ value: true }); exports.JJ = diffChars; __webpack_unused_export__ = void 0; /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(__webpack_require__(5417)) /*istanbul ignore end*/ ; /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /*istanbul ignore end*/ var characterDiff = new /*istanbul ignore start*/ _base /*istanbul ignore end*/ . /*istanbul ignore start*/ default /*istanbul ignore end*/ (); /*istanbul ignore start*/ __webpack_unused_export__ = characterDiff; /*istanbul ignore end*/ function diffChars(oldStr, newStr, options) { return characterDiff.diff(oldStr, newStr, options); } /***/ }), /***/ 8202: /***/ ((module) => { "use strict"; /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ExecutionEnvironment */ /*jslint evil: true */ var canUseDOM = !!( typeof window !== 'undefined' && window.document && window.document.createElement ); /** * Simple, lightweight module assisting with the detection and context of * Worker. Helps avoid circular dependencies and allows code to reason about * whether or not they are in a Worker, even if they never include the main * `ReactWorker` dependency. */ var ExecutionEnvironment = { canUseDOM: canUseDOM, canUseWorkers: typeof Worker !== 'undefined', canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), canUseViewport: canUseDOM && !!window.screen, isInWorker: !canUseDOM // For now, this is true - might change in the future. }; module.exports = ExecutionEnvironment; /***/ }), /***/ 8491: /***/ ((module) => { var openParentheses = "(".charCodeAt(0); var closeParentheses = ")".charCodeAt(0); var singleQuote = "'".charCodeAt(0); var doubleQuote = '"'.charCodeAt(0); var backslash = "\\".charCodeAt(0); var slash = "/".charCodeAt(0); var comma = ",".charCodeAt(0); var colon = ":".charCodeAt(0); var star = "*".charCodeAt(0); var uLower = "u".charCodeAt(0); var uUpper = "U".charCodeAt(0); var plus = "+".charCodeAt(0); var isUnicodeRange = /^[a-f0-9?-]+$/i; module.exports = function(input) { var tokens = []; var value = input; var next, quote, prev, token, escape, escapePos, whitespacePos, parenthesesOpenPos; var pos = 0; var code = value.charCodeAt(pos); var max = value.length; var stack = [{ nodes: tokens }]; var balanced = 0; var parent; var name = ""; var before = ""; var after = ""; while (pos < max) { // Whitespaces if (code <= 32) { next = pos; do { next += 1; code = value.charCodeAt(next); } while (code <= 32); token = value.slice(pos, next); prev = tokens[tokens.length - 1]; if (code === closeParentheses && balanced) { after = token; } else if (prev && prev.type === "div") { prev.after = token; prev.sourceEndIndex += token.length; } else if ( code === comma || code === colon || (code === slash && value.charCodeAt(next + 1) !== star && (!parent || (parent && parent.type === "function" && parent.value !== "calc"))) ) { before = token; } else { tokens.push({ type: "space", sourceIndex: pos, sourceEndIndex: next, value: token }); } pos = next; // Quotes } else if (code === singleQuote || code === doubleQuote) { next = pos; quote = code === singleQuote ? "'" : '"'; token = { type: "string", sourceIndex: pos, quote: quote }; do { escape = false; next = value.indexOf(quote, next + 1); if (~next) { escapePos = next; while (value.charCodeAt(escapePos - 1) === backslash) { escapePos -= 1; escape = !escape; } } else { value += quote; next = value.length - 1; token.unclosed = true; } } while (escape); token.value = value.slice(pos + 1, next); token.sourceEndIndex = token.unclosed ? next : next + 1; tokens.push(token); pos = next + 1; code = value.charCodeAt(pos); // Comments } else if (code === slash && value.charCodeAt(pos + 1) === star) { next = value.indexOf("*/", pos); token = { type: "comment", sourceIndex: pos, sourceEndIndex: next + 2 }; if (next === -1) { token.unclosed = true; next = value.length; token.sourceEndIndex = next; } token.value = value.slice(pos + 2, next); tokens.push(token); pos = next + 2; code = value.charCodeAt(pos); // Operation within calc } else if ( (code === slash || code === star) && parent && parent.type === "function" && parent.value === "calc" ) { token = value[pos]; tokens.push({ type: "word", sourceIndex: pos - before.length, sourceEndIndex: pos + token.length, value: token }); pos += 1; code = value.charCodeAt(pos); // Dividers } else if (code === slash || code === comma || code === colon) { token = value[pos]; tokens.push({ type: "div", sourceIndex: pos - before.length, sourceEndIndex: pos + token.length, value: token, before: before, after: "" }); before = ""; pos += 1; code = value.charCodeAt(pos); // Open parentheses } else if (openParentheses === code) { // Whitespaces after open parentheses next = pos; do { next += 1; code = value.charCodeAt(next); } while (code <= 32); parenthesesOpenPos = pos; token = { type: "function", sourceIndex: pos - name.length, value: name, before: value.slice(parenthesesOpenPos + 1, next) }; pos = next; if (name === "url" && code !== singleQuote && code !== doubleQuote) { next -= 1; do { escape = false; next = value.indexOf(")", next + 1); if (~next) { escapePos = next; while (value.charCodeAt(escapePos - 1) === backslash) { escapePos -= 1; escape = !escape; } } else { value += ")"; next = value.length - 1; token.unclosed = true; } } while (escape); // Whitespaces before closed whitespacePos = next; do { whitespacePos -= 1; code = value.charCodeAt(whitespacePos); } while (code <= 32); if (parenthesesOpenPos < whitespacePos) { if (pos !== whitespacePos + 1) { token.nodes = [ { type: "word", sourceIndex: pos, sourceEndIndex: whitespacePos + 1, value: value.slice(pos, whitespacePos + 1) } ]; } else { token.nodes = []; } if (token.unclosed && whitespacePos + 1 !== next) { token.after = ""; token.nodes.push({ type: "space", sourceIndex: whitespacePos + 1, sourceEndIndex: next, value: value.slice(whitespacePos + 1, next) }); } else { token.after = value.slice(whitespacePos + 1, next); token.sourceEndIndex = next; } } else { token.after = ""; token.nodes = []; } pos = next + 1; token.sourceEndIndex = token.unclosed ? next : pos; code = value.charCodeAt(pos); tokens.push(token); } else { balanced += 1; token.after = ""; token.sourceEndIndex = pos + 1; tokens.push(token); stack.push(token); tokens = token.nodes = []; parent = token; } name = ""; // Close parentheses } else if (closeParentheses === code && balanced) { pos += 1; code = value.charCodeAt(pos); parent.after = after; parent.sourceEndIndex += after.length; after = ""; balanced -= 1; stack[stack.length - 1].sourceEndIndex = pos; stack.pop(); parent = stack[balanced]; tokens = parent.nodes; // Words } else { next = pos; do { if (code === backslash) { next += 1; } next += 1; code = value.charCodeAt(next); } while ( next < max && !( code <= 32 || code === singleQuote || code === doubleQuote || code === comma || code === colon || code === slash || code === openParentheses || (code === star && parent && parent.type === "function" && parent.value === "calc") || (code === slash && parent.type === "function" && parent.value === "calc") || (code === closeParentheses && balanced) ) ); token = value.slice(pos, next); if (openParentheses === code) { name = token; } else if ( (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) && plus === token.charCodeAt(1) && isUnicodeRange.test(token.slice(2)) ) { tokens.push({ type: "unicode-range", sourceIndex: pos, sourceEndIndex: next, value: token }); } else { tokens.push({ type: "word", sourceIndex: pos, sourceEndIndex: next, value: token }); } pos = next; } } for (pos = stack.length - 1; pos; pos -= 1) { stack[pos].unclosed = true; stack[pos].sourceEndIndex = value.length; } return stack[0].nodes; }; /***/ }), /***/ 9055: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Warning = __webpack_require__(5776) class Result { get content() { return this.css } constructor(processor, root, opts) { this.processor = processor this.messages = [] this.root = root this.opts = opts this.css = undefined this.map = undefined } toString() { return this.css } warn(text, opts = {}) { if (!opts.plugin) { if (this.lastPlugin && this.lastPlugin.postcssPlugin) { opts.plugin = this.lastPlugin.postcssPlugin } } let warning = new Warning(text, opts) this.messages.push(warning) return warning } warnings() { return this.messages.filter(i => i.type === 'warning') } } module.exports = Result Result.default = Result /***/ }), /***/ 9434: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let LazyResult, Processor class Root extends Container { constructor(defaults) { super(defaults) this.type = 'root' if (!this.nodes) this.nodes = [] } normalize(child, sample, type) { let nodes = super.normalize(child) if (sample) { if (type === 'prepend') { if (this.nodes.length > 1) { sample.raws.before = this.nodes[1].raws.before } else { delete sample.raws.before } } else if (this.first !== sample) { for (let node of nodes) { node.raws.before = sample.raws.before } } } return nodes } removeChild(child, ignore) { let index = this.index(child) if (!ignore && index === 0 && this.nodes.length > 1) { this.nodes[1].raws.before = this.nodes[index].raws.before } return super.removeChild(child) } toResult(opts = {}) { let lazy = new LazyResult(new Processor(), this, opts) return lazy.stringify() } } Root.registerLazyResult = dependant => { LazyResult = dependant } Root.registerProcessor = dependant => { Processor = dependant } module.exports = Root Root.default = Root Container.registerRoot(Root) /***/ }), /***/ 9656: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Document = __webpack_require__(271) let LazyResult = __webpack_require__(448) let NoWorkResult = __webpack_require__(7661) let Root = __webpack_require__(9434) class Processor { constructor(plugins = []) { this.version = '8.5.3' this.plugins = this.normalize(plugins) } normalize(plugins) { let normalized = [] for (let i of plugins) { if (i.postcss === true) { i = i() } else if (i.postcss) { i = i.postcss } if (typeof i === 'object' && Array.isArray(i.plugins)) { normalized = normalized.concat(i.plugins) } else if (typeof i === 'object' && i.postcssPlugin) { normalized.push(i) } else if (typeof i === 'function') { normalized.push(i) } else if (typeof i === 'object' && (i.parse || i.stringify)) { if (false) {} } else { throw new Error(i + ' is not a PostCSS plugin') } } return normalized } process(css, opts = {}) { if ( !this.plugins.length && !opts.parser && !opts.stringifier && !opts.syntax ) { return new NoWorkResult(this, css, opts) } else { return new LazyResult(this, css, opts) } } use(plugin) { this.plugins = this.plugins.concat(this.normalize([plugin])) return this } } module.exports = Processor Processor.default = Processor Root.registerProcessor(Processor) Document.registerProcessor(Processor) /***/ }), /***/ 9681: /***/ ((module) => { var characterMap = { "À": "A", "Á": "A", "Â": "A", "Ã": "A", "Ä": "A", "Å": "A", "Ấ": "A", "Ắ": "A", "Ẳ": "A", "Ẵ": "A", "Ặ": "A", "Æ": "AE", "Ầ": "A", "Ằ": "A", "Ȃ": "A", "Ả": "A", "Ạ": "A", "Ẩ": "A", "Ẫ": "A", "Ậ": "A", "Ç": "C", "Ḉ": "C", "È": "E", "É": "E", "Ê": "E", "Ë": "E", "Ế": "E", "Ḗ": "E", "Ề": "E", "Ḕ": "E", "Ḝ": "E", "Ȇ": "E", "Ẻ": "E", "Ẽ": "E", "Ẹ": "E", "Ể": "E", "Ễ": "E", "Ệ": "E", "Ì": "I", "Í": "I", "Î": "I", "Ï": "I", "Ḯ": "I", "Ȋ": "I", "Ỉ": "I", "Ị": "I", "Ð": "D", "Ñ": "N", "Ò": "O", "Ó": "O", "Ô": "O", "Õ": "O", "Ö": "O", "Ø": "O", "Ố": "O", "Ṍ": "O", "Ṓ": "O", "Ȏ": "O", "Ỏ": "O", "Ọ": "O", "Ổ": "O", "Ỗ": "O", "Ộ": "O", "Ờ": "O", "Ở": "O", "Ỡ": "O", "Ớ": "O", "Ợ": "O", "Ù": "U", "Ú": "U", "Û": "U", "Ü": "U", "Ủ": "U", "Ụ": "U", "Ử": "U", "Ữ": "U", "Ự": "U", "Ý": "Y", "à": "a", "á": "a", "â": "a", "ã": "a", "ä": "a", "å": "a", "ấ": "a", "ắ": "a", "ẳ": "a", "ẵ": "a", "ặ": "a", "æ": "ae", "ầ": "a", "ằ": "a", "ȃ": "a", "ả": "a", "ạ": "a", "ẩ": "a", "ẫ": "a", "ậ": "a", "ç": "c", "ḉ": "c", "è": "e", "é": "e", "ê": "e", "ë": "e", "ế": "e", "ḗ": "e", "ề": "e", "ḕ": "e", "ḝ": "e", "ȇ": "e", "ẻ": "e", "ẽ": "e", "ẹ": "e", "ể": "e", "ễ": "e", "ệ": "e", "ì": "i", "í": "i", "î": "i", "ï": "i", "ḯ": "i", "ȋ": "i", "ỉ": "i", "ị": "i", "ð": "d", "ñ": "n", "ò": "o", "ó": "o", "ô": "o", "õ": "o", "ö": "o", "ø": "o", "ố": "o", "ṍ": "o", "ṓ": "o", "ȏ": "o", "ỏ": "o", "ọ": "o", "ổ": "o", "ỗ": "o", "ộ": "o", "ờ": "o", "ở": "o", "ỡ": "o", "ớ": "o", "ợ": "o", "ù": "u", "ú": "u", "û": "u", "ü": "u", "ủ": "u", "ụ": "u", "ử": "u", "ữ": "u", "ự": "u", "ý": "y", "ÿ": "y", "Ā": "A", "ā": "a", "Ă": "A", "ă": "a", "Ą": "A", "ą": "a", "Ć": "C", "ć": "c", "Ĉ": "C", "ĉ": "c", "Ċ": "C", "ċ": "c", "Č": "C", "č": "c", "C̆": "C", "c̆": "c", "Ď": "D", "ď": "d", "Đ": "D", "đ": "d", "Ē": "E", "ē": "e", "Ĕ": "E", "ĕ": "e", "Ė": "E", "ė": "e", "Ę": "E", "ę": "e", "Ě": "E", "ě": "e", "Ĝ": "G", "Ǵ": "G", "ĝ": "g", "ǵ": "g", "Ğ": "G", "ğ": "g", "Ġ": "G", "ġ": "g", "Ģ": "G", "ģ": "g", "Ĥ": "H", "ĥ": "h", "Ħ": "H", "ħ": "h", "Ḫ": "H", "ḫ": "h", "Ĩ": "I", "ĩ": "i", "Ī": "I", "ī": "i", "Ĭ": "I", "ĭ": "i", "Į": "I", "į": "i", "İ": "I", "ı": "i", "IJ": "IJ", "ij": "ij", "Ĵ": "J", "ĵ": "j", "Ķ": "K", "ķ": "k", "Ḱ": "K", "ḱ": "k", "K̆": "K", "k̆": "k", "Ĺ": "L", "ĺ": "l", "Ļ": "L", "ļ": "l", "Ľ": "L", "ľ": "l", "Ŀ": "L", "ŀ": "l", "Ł": "l", "ł": "l", "Ḿ": "M", "ḿ": "m", "M̆": "M", "m̆": "m", "Ń": "N", "ń": "n", "Ņ": "N", "ņ": "n", "Ň": "N", "ň": "n", "ʼn": "n", "N̆": "N", "n̆": "n", "Ō": "O", "ō": "o", "Ŏ": "O", "ŏ": "o", "Ő": "O", "ő": "o", "Œ": "OE", "œ": "oe", "P̆": "P", "p̆": "p", "Ŕ": "R", "ŕ": "r", "Ŗ": "R", "ŗ": "r", "Ř": "R", "ř": "r", "R̆": "R", "r̆": "r", "Ȓ": "R", "ȓ": "r", "Ś": "S", "ś": "s", "Ŝ": "S", "ŝ": "s", "Ş": "S", "Ș": "S", "ș": "s", "ş": "s", "Š": "S", "š": "s", "Ţ": "T", "ţ": "t", "ț": "t", "Ț": "T", "Ť": "T", "ť": "t", "Ŧ": "T", "ŧ": "t", "T̆": "T", "t̆": "t", "Ũ": "U", "ũ": "u", "Ū": "U", "ū": "u", "Ŭ": "U", "ŭ": "u", "Ů": "U", "ů": "u", "Ű": "U", "ű": "u", "Ų": "U", "ų": "u", "Ȗ": "U", "ȗ": "u", "V̆": "V", "v̆": "v", "Ŵ": "W", "ŵ": "w", "Ẃ": "W", "ẃ": "w", "X̆": "X", "x̆": "x", "Ŷ": "Y", "ŷ": "y", "Ÿ": "Y", "Y̆": "Y", "y̆": "y", "Ź": "Z", "ź": "z", "Ż": "Z", "ż": "z", "Ž": "Z", "ž": "z", "ſ": "s", "ƒ": "f", "Ơ": "O", "ơ": "o", "Ư": "U", "ư": "u", "Ǎ": "A", "ǎ": "a", "Ǐ": "I", "ǐ": "i", "Ǒ": "O", "ǒ": "o", "Ǔ": "U", "ǔ": "u", "Ǖ": "U", "ǖ": "u", "Ǘ": "U", "ǘ": "u", "Ǚ": "U", "ǚ": "u", "Ǜ": "U", "ǜ": "u", "Ứ": "U", "ứ": "u", "Ṹ": "U", "ṹ": "u", "Ǻ": "A", "ǻ": "a", "Ǽ": "AE", "ǽ": "ae", "Ǿ": "O", "ǿ": "o", "Þ": "TH", "þ": "th", "Ṕ": "P", "ṕ": "p", "Ṥ": "S", "ṥ": "s", "X́": "X", "x́": "x", "Ѓ": "Г", "ѓ": "г", "Ќ": "К", "ќ": "к", "A̋": "A", "a̋": "a", "E̋": "E", "e̋": "e", "I̋": "I", "i̋": "i", "Ǹ": "N", "ǹ": "n", "Ồ": "O", "ồ": "o", "Ṑ": "O", "ṑ": "o", "Ừ": "U", "ừ": "u", "Ẁ": "W", "ẁ": "w", "Ỳ": "Y", "ỳ": "y", "Ȁ": "A", "ȁ": "a", "Ȅ": "E", "ȅ": "e", "Ȉ": "I", "ȉ": "i", "Ȍ": "O", "ȍ": "o", "Ȑ": "R", "ȑ": "r", "Ȕ": "U", "ȕ": "u", "B̌": "B", "b̌": "b", "Č̣": "C", "č̣": "c", "Ê̌": "E", "ê̌": "e", "F̌": "F", "f̌": "f", "Ǧ": "G", "ǧ": "g", "Ȟ": "H", "ȟ": "h", "J̌": "J", "ǰ": "j", "Ǩ": "K", "ǩ": "k", "M̌": "M", "m̌": "m", "P̌": "P", "p̌": "p", "Q̌": "Q", "q̌": "q", "Ř̩": "R", "ř̩": "r", "Ṧ": "S", "ṧ": "s", "V̌": "V", "v̌": "v", "W̌": "W", "w̌": "w", "X̌": "X", "x̌": "x", "Y̌": "Y", "y̌": "y", "A̧": "A", "a̧": "a", "B̧": "B", "b̧": "b", "Ḑ": "D", "ḑ": "d", "Ȩ": "E", "ȩ": "e", "Ɛ̧": "E", "ɛ̧": "e", "Ḩ": "H", "ḩ": "h", "I̧": "I", "i̧": "i", "Ɨ̧": "I", "ɨ̧": "i", "M̧": "M", "m̧": "m", "O̧": "O", "o̧": "o", "Q̧": "Q", "q̧": "q", "U̧": "U", "u̧": "u", "X̧": "X", "x̧": "x", "Z̧": "Z", "z̧": "z", "й":"и", "Й":"И", "ё":"е", "Ё":"Е", }; var chars = Object.keys(characterMap).join('|'); var allAccents = new RegExp(chars, 'g'); var firstAccent = new RegExp(chars, ''); function matcher(match) { return characterMap[match]; } var removeAccents = function(string) { return string.replace(allAccents, matcher); }; var hasAccents = function(string) { return !!string.match(firstAccent); }; module.exports = removeAccents; module.exports.has = hasAccents; module.exports.remove = removeAccents; /***/ }), /***/ 9746: /***/ (() => { /* (ignored) */ /***/ }), /***/ 9977: /***/ (() => { /* (ignored) */ /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { AlignmentControl: () => (/* reexport */ AlignmentControl), AlignmentToolbar: () => (/* reexport */ AlignmentToolbar), Autocomplete: () => (/* reexport */ autocomplete), BlockAlignmentControl: () => (/* reexport */ BlockAlignmentControl), BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar), BlockBreadcrumb: () => (/* reexport */ block_breadcrumb), BlockCanvas: () => (/* reexport */ block_canvas), BlockColorsStyleSelector: () => (/* reexport */ color_style_selector), BlockContextProvider: () => (/* reexport */ BlockContextProvider), BlockControls: () => (/* reexport */ block_controls), BlockEdit: () => (/* reexport */ BlockEdit), BlockEditorKeyboardShortcuts: () => (/* reexport */ keyboard_shortcuts), BlockEditorProvider: () => (/* reexport */ components_provider), BlockFormatControls: () => (/* reexport */ BlockFormatControls), BlockIcon: () => (/* reexport */ block_icon), BlockInspector: () => (/* reexport */ block_inspector), BlockList: () => (/* reexport */ BlockList), BlockMover: () => (/* reexport */ block_mover), BlockNavigationDropdown: () => (/* reexport */ dropdown), BlockPopover: () => (/* reexport */ block_popover), BlockPreview: () => (/* reexport */ block_preview), BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer), BlockSettingsMenu: () => (/* reexport */ block_settings_menu), BlockSettingsMenuControls: () => (/* reexport */ block_settings_menu_controls), BlockStyles: () => (/* reexport */ block_styles), BlockTitle: () => (/* reexport */ BlockTitle), BlockToolbar: () => (/* reexport */ BlockToolbar), BlockTools: () => (/* reexport */ BlockTools), BlockVerticalAlignmentControl: () => (/* reexport */ BlockVerticalAlignmentControl), BlockVerticalAlignmentToolbar: () => (/* reexport */ BlockVerticalAlignmentToolbar), ButtonBlockAppender: () => (/* reexport */ button_block_appender), ButtonBlockerAppender: () => (/* reexport */ ButtonBlockerAppender), ColorPalette: () => (/* reexport */ color_palette), ColorPaletteControl: () => (/* reexport */ ColorPaletteControl), ContrastChecker: () => (/* reexport */ contrast_checker), CopyHandler: () => (/* reexport */ CopyHandler), DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender), FontSizePicker: () => (/* reexport */ font_size_picker), HeadingLevelDropdown: () => (/* reexport */ HeadingLevelDropdown), HeightControl: () => (/* reexport */ HeightControl), InnerBlocks: () => (/* reexport */ inner_blocks), Inserter: () => (/* reexport */ inserter), InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls), InspectorControls: () => (/* reexport */ inspector_controls), JustifyContentControl: () => (/* reexport */ JustifyContentControl), JustifyToolbar: () => (/* reexport */ JustifyToolbar), LineHeightControl: () => (/* reexport */ line_height_control), LinkControl: () => (/* reexport */ link_control), MediaPlaceholder: () => (/* reexport */ media_placeholder), MediaReplaceFlow: () => (/* reexport */ media_replace_flow), MediaUpload: () => (/* reexport */ media_upload), MediaUploadCheck: () => (/* reexport */ check), MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView), NavigableToolbar: () => (/* reexport */ NavigableToolbar), ObserveTyping: () => (/* reexport */ observe_typing), PanelColorSettings: () => (/* reexport */ panel_color_settings), PlainText: () => (/* reexport */ plain_text), RecursionProvider: () => (/* reexport */ RecursionProvider), RichText: () => (/* reexport */ rich_text), RichTextShortcut: () => (/* reexport */ RichTextShortcut), RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), SETTINGS_DEFAULTS: () => (/* reexport */ SETTINGS_DEFAULTS), SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), ToolSelector: () => (/* reexport */ tool_selector), Typewriter: () => (/* reexport */ typewriter), URLInput: () => (/* reexport */ url_input), URLInputButton: () => (/* reexport */ url_input_button), URLPopover: () => (/* reexport */ url_popover), Warning: () => (/* reexport */ warning), WritingFlow: () => (/* reexport */ writing_flow), __experimentalBlockAlignmentMatrixControl: () => (/* reexport */ block_alignment_matrix_control), __experimentalBlockFullHeightAligmentControl: () => (/* reexport */ block_full_height_alignment_control), __experimentalBlockPatternSetup: () => (/* reexport */ block_pattern_setup), __experimentalBlockPatternsList: () => (/* reexport */ block_patterns_list), __experimentalBlockVariationPicker: () => (/* reexport */ block_variation_picker), __experimentalBlockVariationTransforms: () => (/* reexport */ block_variation_transforms), __experimentalBorderRadiusControl: () => (/* reexport */ BorderRadiusControl), __experimentalColorGradientControl: () => (/* reexport */ control), __experimentalColorGradientSettingsDropdown: () => (/* reexport */ ColorGradientSettingsDropdown), __experimentalDateFormatPicker: () => (/* reexport */ DateFormatPicker), __experimentalDuotoneControl: () => (/* reexport */ duotone_control), __experimentalFontAppearanceControl: () => (/* reexport */ FontAppearanceControl), __experimentalFontFamilyControl: () => (/* reexport */ FontFamilyControl), __experimentalGetBorderClassesAndStyles: () => (/* reexport */ getBorderClassesAndStyles), __experimentalGetColorClassesAndStyles: () => (/* reexport */ getColorClassesAndStyles), __experimentalGetElementClassName: () => (/* reexport */ __experimentalGetElementClassName), __experimentalGetGapCSSValue: () => (/* reexport */ getGapCSSValue), __experimentalGetGradientClass: () => (/* reexport */ __experimentalGetGradientClass), __experimentalGetGradientObjectByGradientValue: () => (/* reexport */ __experimentalGetGradientObjectByGradientValue), __experimentalGetShadowClassesAndStyles: () => (/* reexport */ getShadowClassesAndStyles), __experimentalGetSpacingClassesAndStyles: () => (/* reexport */ getSpacingClassesAndStyles), __experimentalImageEditor: () => (/* reexport */ ImageEditor), __experimentalImageSizeControl: () => (/* reexport */ ImageSizeControl), __experimentalImageURLInputUI: () => (/* reexport */ ImageURLInputUI), __experimentalInspectorPopoverHeader: () => (/* reexport */ InspectorPopoverHeader), __experimentalLetterSpacingControl: () => (/* reexport */ LetterSpacingControl), __experimentalLibrary: () => (/* reexport */ library), __experimentalLinkControl: () => (/* reexport */ DeprecatedExperimentalLinkControl), __experimentalLinkControlSearchInput: () => (/* reexport */ __experimentalLinkControlSearchInput), __experimentalLinkControlSearchItem: () => (/* reexport */ __experimentalLinkControlSearchItem), __experimentalLinkControlSearchResults: () => (/* reexport */ __experimentalLinkControlSearchResults), __experimentalListView: () => (/* reexport */ components_list_view), __experimentalPanelColorGradientSettings: () => (/* reexport */ panel_color_gradient_settings), __experimentalPreviewOptions: () => (/* reexport */ PreviewOptions), __experimentalPublishDateTimePicker: () => (/* reexport */ publish_date_time_picker), __experimentalRecursionProvider: () => (/* reexport */ DeprecatedExperimentalRecursionProvider), __experimentalResponsiveBlockControl: () => (/* reexport */ responsive_block_control), __experimentalSpacingSizesControl: () => (/* reexport */ SpacingSizesControl), __experimentalTextDecorationControl: () => (/* reexport */ TextDecorationControl), __experimentalTextTransformControl: () => (/* reexport */ TextTransformControl), __experimentalUnitControl: () => (/* reexport */ UnitControl), __experimentalUseBlockOverlayActive: () => (/* reexport */ useBlockOverlayActive), __experimentalUseBlockPreview: () => (/* reexport */ useBlockPreview), __experimentalUseBorderProps: () => (/* reexport */ useBorderProps), __experimentalUseColorProps: () => (/* reexport */ useColorProps), __experimentalUseCustomSides: () => (/* reexport */ useCustomSides), __experimentalUseGradient: () => (/* reexport */ __experimentalUseGradient), __experimentalUseHasRecursion: () => (/* reexport */ DeprecatedExperimentalUseHasRecursion), __experimentalUseMultipleOriginColorsAndGradients: () => (/* reexport */ useMultipleOriginColorsAndGradients), __experimentalUseResizeCanvas: () => (/* reexport */ useResizeCanvas), __experimentalWritingModeControl: () => (/* reexport */ WritingModeControl), __unstableBlockNameContext: () => (/* reexport */ block_name_context), __unstableBlockSettingsMenuFirstItem: () => (/* reexport */ block_settings_menu_first_item), __unstableBlockToolbarLastItem: () => (/* reexport */ block_toolbar_last_item), __unstableEditorStyles: () => (/* reexport */ editor_styles), __unstableIframe: () => (/* reexport */ iframe), __unstableInserterMenuExtension: () => (/* reexport */ inserter_menu_extension), __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), __unstableUseBlockSelectionClearer: () => (/* reexport */ useBlockSelectionClearer), __unstableUseClipboardHandler: () => (/* reexport */ __unstableUseClipboardHandler), __unstableUseMouseMoveTypingReset: () => (/* reexport */ useMouseMoveTypingReset), __unstableUseTypewriter: () => (/* reexport */ useTypewriter), __unstableUseTypingObserver: () => (/* reexport */ useTypingObserver), createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC), getColorClassName: () => (/* reexport */ getColorClassName), getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues), getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue), getComputedFluidTypographyValue: () => (/* reexport */ getComputedFluidTypographyValue), getCustomValueFromPreset: () => (/* reexport */ getCustomValueFromPreset), getFontSize: () => (/* reexport */ utils_getFontSize), getFontSizeClass: () => (/* reexport */ getFontSizeClass), getFontSizeObjectByValue: () => (/* reexport */ utils_getFontSizeObjectByValue), getGradientSlugByValue: () => (/* reexport */ getGradientSlugByValue), getGradientValueBySlug: () => (/* reexport */ getGradientValueBySlug), getPxFromCssUnit: () => (/* reexport */ get_px_from_css_unit), getSpacingPresetCssVar: () => (/* reexport */ getSpacingPresetCssVar), getTypographyClassesAndStyles: () => (/* reexport */ getTypographyClassesAndStyles), isValueSpacingPreset: () => (/* reexport */ isValueSpacingPreset), privateApis: () => (/* reexport */ privateApis), store: () => (/* reexport */ store), storeConfig: () => (/* reexport */ storeConfig), transformStyles: () => (/* reexport */ transform_styles), useBlockBindingsUtils: () => (/* reexport */ useBlockBindingsUtils), useBlockCommands: () => (/* reexport */ useBlockCommands), useBlockDisplayInformation: () => (/* reexport */ useBlockDisplayInformation), useBlockEditContext: () => (/* reexport */ useBlockEditContext), useBlockEditingMode: () => (/* reexport */ useBlockEditingMode), useBlockProps: () => (/* reexport */ use_block_props_useBlockProps), useCachedTruthy: () => (/* reexport */ useCachedTruthy), useHasRecursion: () => (/* reexport */ useHasRecursion), useInnerBlocksProps: () => (/* reexport */ useInnerBlocksProps), useSetting: () => (/* reexport */ useSetting), useSettings: () => (/* reexport */ use_settings_useSettings), useStyleOverride: () => (/* reexport */ useStyleOverride), withColorContext: () => (/* reexport */ with_color_context), withColors: () => (/* reexport */ withColors), withFontSizes: () => (/* reexport */ with_font_sizes) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js var private_selectors_namespaceObject = {}; __webpack_require__.r(private_selectors_namespaceObject); __webpack_require__.d(private_selectors_namespaceObject, { getAllPatterns: () => (getAllPatterns), getBlockRemovalRules: () => (getBlockRemovalRules), getBlockSettings: () => (getBlockSettings), getBlockStyles: () => (getBlockStyles), getBlockWithoutAttributes: () => (getBlockWithoutAttributes), getClosestAllowedInsertionPoint: () => (getClosestAllowedInsertionPoint), getClosestAllowedInsertionPointForPattern: () => (getClosestAllowedInsertionPointForPattern), getContentLockingParent: () => (getContentLockingParent), getEnabledBlockParents: () => (getEnabledBlockParents), getEnabledClientIdsTree: () => (getEnabledClientIdsTree), getExpandedBlock: () => (getExpandedBlock), getInserterMediaCategories: () => (getInserterMediaCategories), getInsertionPoint: () => (getInsertionPoint), getLastFocus: () => (getLastFocus), getLastInsertedBlocksClientIds: () => (getLastInsertedBlocksClientIds), getOpenedBlockSettingsMenu: () => (getOpenedBlockSettingsMenu), getParentSectionBlock: () => (getParentSectionBlock), getPatternBySlug: () => (getPatternBySlug), getRegisteredInserterMediaCategories: () => (getRegisteredInserterMediaCategories), getRemovalPromptData: () => (getRemovalPromptData), getReusableBlocks: () => (getReusableBlocks), getSectionRootClientId: () => (getSectionRootClientId), getStyleOverrides: () => (getStyleOverrides), getTemporarilyEditingAsBlocks: () => (getTemporarilyEditingAsBlocks), getTemporarilyEditingFocusModeToRevert: () => (getTemporarilyEditingFocusModeToRevert), getZoomLevel: () => (getZoomLevel), hasAllowedPatterns: () => (hasAllowedPatterns), isBlockInterfaceHidden: () => (private_selectors_isBlockInterfaceHidden), isBlockSubtreeDisabled: () => (isBlockSubtreeDisabled), isDragging: () => (private_selectors_isDragging), isSectionBlock: () => (isSectionBlock), isZoomOut: () => (isZoomOut) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { __experimentalGetActiveBlockIdByBlockNames: () => (__experimentalGetActiveBlockIdByBlockNames), __experimentalGetAllowedBlocks: () => (__experimentalGetAllowedBlocks), __experimentalGetAllowedPatterns: () => (__experimentalGetAllowedPatterns), __experimentalGetBlockListSettingsForBlocks: () => (__experimentalGetBlockListSettingsForBlocks), __experimentalGetDirectInsertBlock: () => (__experimentalGetDirectInsertBlock), __experimentalGetGlobalBlocksByName: () => (__experimentalGetGlobalBlocksByName), __experimentalGetLastBlockAttributeChanges: () => (__experimentalGetLastBlockAttributeChanges), __experimentalGetParsedPattern: () => (__experimentalGetParsedPattern), __experimentalGetPatternTransformItems: () => (__experimentalGetPatternTransformItems), __experimentalGetPatternsByBlockTypes: () => (__experimentalGetPatternsByBlockTypes), __experimentalGetReusableBlockTitle: () => (__experimentalGetReusableBlockTitle), __unstableGetBlockWithoutInnerBlocks: () => (__unstableGetBlockWithoutInnerBlocks), __unstableGetClientIdWithClientIdsTree: () => (__unstableGetClientIdWithClientIdsTree), __unstableGetClientIdsTree: () => (__unstableGetClientIdsTree), __unstableGetContentLockingParent: () => (__unstableGetContentLockingParent), __unstableGetEditorMode: () => (__unstableGetEditorMode), __unstableGetSelectedBlocksWithPartialSelection: () => (__unstableGetSelectedBlocksWithPartialSelection), __unstableGetTemporarilyEditingAsBlocks: () => (__unstableGetTemporarilyEditingAsBlocks), __unstableGetTemporarilyEditingFocusModeToRevert: () => (__unstableGetTemporarilyEditingFocusModeToRevert), __unstableGetVisibleBlocks: () => (__unstableGetVisibleBlocks), __unstableHasActiveBlockOverlayActive: () => (__unstableHasActiveBlockOverlayActive), __unstableIsFullySelected: () => (__unstableIsFullySelected), __unstableIsLastBlockChangeIgnored: () => (__unstableIsLastBlockChangeIgnored), __unstableIsSelectionCollapsed: () => (__unstableIsSelectionCollapsed), __unstableIsSelectionMergeable: () => (__unstableIsSelectionMergeable), __unstableIsWithinBlockOverlay: () => (__unstableIsWithinBlockOverlay), __unstableSelectionHasUnmergeableBlock: () => (__unstableSelectionHasUnmergeableBlock), areInnerBlocksControlled: () => (areInnerBlocksControlled), canEditBlock: () => (canEditBlock), canInsertBlockType: () => (canInsertBlockType), canInsertBlocks: () => (canInsertBlocks), canLockBlockType: () => (canLockBlockType), canMoveBlock: () => (canMoveBlock), canMoveBlocks: () => (canMoveBlocks), canRemoveBlock: () => (canRemoveBlock), canRemoveBlocks: () => (canRemoveBlocks), didAutomaticChange: () => (didAutomaticChange), getAdjacentBlockClientId: () => (getAdjacentBlockClientId), getAllowedBlocks: () => (getAllowedBlocks), getBlock: () => (getBlock), getBlockAttributes: () => (getBlockAttributes), getBlockCount: () => (getBlockCount), getBlockEditingMode: () => (getBlockEditingMode), getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId), getBlockIndex: () => (getBlockIndex), getBlockInsertionPoint: () => (getBlockInsertionPoint), getBlockListSettings: () => (getBlockListSettings), getBlockMode: () => (getBlockMode), getBlockName: () => (getBlockName), getBlockNamesByClientId: () => (getBlockNamesByClientId), getBlockOrder: () => (getBlockOrder), getBlockParents: () => (getBlockParents), getBlockParentsByBlockName: () => (getBlockParentsByBlockName), getBlockRootClientId: () => (getBlockRootClientId), getBlockSelectionEnd: () => (getBlockSelectionEnd), getBlockSelectionStart: () => (getBlockSelectionStart), getBlockTransformItems: () => (getBlockTransformItems), getBlocks: () => (getBlocks), getBlocksByClientId: () => (getBlocksByClientId), getBlocksByName: () => (getBlocksByName), getClientIdsOfDescendants: () => (getClientIdsOfDescendants), getClientIdsWithDescendants: () => (getClientIdsWithDescendants), getDirectInsertBlock: () => (getDirectInsertBlock), getDraggedBlockClientIds: () => (getDraggedBlockClientIds), getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId), getGlobalBlockCount: () => (getGlobalBlockCount), getHoveredBlockClientId: () => (getHoveredBlockClientId), getInserterItems: () => (getInserterItems), getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId), getLowestCommonAncestorWithSelectedBlock: () => (getLowestCommonAncestorWithSelectedBlock), getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds), getMultiSelectedBlocks: () => (getMultiSelectedBlocks), getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId), getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId), getNextBlockClientId: () => (getNextBlockClientId), getPatternsByBlockTypes: () => (getPatternsByBlockTypes), getPreviousBlockClientId: () => (getPreviousBlockClientId), getSelectedBlock: () => (getSelectedBlock), getSelectedBlockClientId: () => (getSelectedBlockClientId), getSelectedBlockClientIds: () => (getSelectedBlockClientIds), getSelectedBlockCount: () => (getSelectedBlockCount), getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition), getSelectionEnd: () => (getSelectionEnd), getSelectionStart: () => (getSelectionStart), getSettings: () => (getSettings), getTemplate: () => (getTemplate), getTemplateLock: () => (getTemplateLock), hasBlockMovingClientId: () => (hasBlockMovingClientId), hasDraggedInnerBlock: () => (hasDraggedInnerBlock), hasInserterItems: () => (hasInserterItems), hasMultiSelection: () => (hasMultiSelection), hasSelectedBlock: () => (hasSelectedBlock), hasSelectedInnerBlock: () => (hasSelectedInnerBlock), isAncestorBeingDragged: () => (isAncestorBeingDragged), isAncestorMultiSelected: () => (isAncestorMultiSelected), isBlockBeingDragged: () => (isBlockBeingDragged), isBlockHighlighted: () => (isBlockHighlighted), isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible), isBlockMultiSelected: () => (isBlockMultiSelected), isBlockSelected: () => (isBlockSelected), isBlockValid: () => (isBlockValid), isBlockVisible: () => (isBlockVisible), isBlockWithinSelection: () => (isBlockWithinSelection), isCaretWithinFormattedText: () => (isCaretWithinFormattedText), isDraggingBlocks: () => (isDraggingBlocks), isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock), isGroupable: () => (isGroupable), isLastBlockChangePersistent: () => (isLastBlockChangePersistent), isMultiSelecting: () => (selectors_isMultiSelecting), isNavigationMode: () => (isNavigationMode), isSelectionEnabled: () => (selectors_isSelectionEnabled), isTyping: () => (selectors_isTyping), isUngroupable: () => (isUngroupable), isValidTemplate: () => (isValidTemplate), wasBlockJustInserted: () => (wasBlockJustInserted) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js var private_actions_namespaceObject = {}; __webpack_require__.r(private_actions_namespaceObject); __webpack_require__.d(private_actions_namespaceObject, { __experimentalUpdateSettings: () => (__experimentalUpdateSettings), clearBlockRemovalPrompt: () => (clearBlockRemovalPrompt), deleteStyleOverride: () => (deleteStyleOverride), ensureDefaultBlock: () => (ensureDefaultBlock), expandBlock: () => (expandBlock), hideBlockInterface: () => (hideBlockInterface), modifyContentLockBlock: () => (modifyContentLockBlock), privateRemoveBlocks: () => (privateRemoveBlocks), resetZoomLevel: () => (resetZoomLevel), setBlockRemovalRules: () => (setBlockRemovalRules), setInsertionPoint: () => (setInsertionPoint), setLastFocus: () => (setLastFocus), setOpenedBlockSettingsMenu: () => (setOpenedBlockSettingsMenu), setStyleOverride: () => (setStyleOverride), setZoomLevel: () => (setZoomLevel), showBlockInterface: () => (showBlockInterface), startDragging: () => (startDragging), stopDragging: () => (stopDragging), stopEditingAsBlocks: () => (stopEditingAsBlocks) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { __unstableDeleteSelection: () => (__unstableDeleteSelection), __unstableExpandSelection: () => (__unstableExpandSelection), __unstableMarkAutomaticChange: () => (__unstableMarkAutomaticChange), __unstableMarkLastChangeAsPersistent: () => (__unstableMarkLastChangeAsPersistent), __unstableMarkNextChangeAsNotPersistent: () => (__unstableMarkNextChangeAsNotPersistent), __unstableSaveReusableBlock: () => (__unstableSaveReusableBlock), __unstableSetEditorMode: () => (__unstableSetEditorMode), __unstableSetTemporarilyEditingAsBlocks: () => (__unstableSetTemporarilyEditingAsBlocks), __unstableSplitSelection: () => (__unstableSplitSelection), clearSelectedBlock: () => (clearSelectedBlock), duplicateBlocks: () => (duplicateBlocks), enterFormattedText: () => (enterFormattedText), exitFormattedText: () => (exitFormattedText), flashBlock: () => (flashBlock), hideInsertionPoint: () => (hideInsertionPoint), hoverBlock: () => (hoverBlock), insertAfterBlock: () => (insertAfterBlock), insertBeforeBlock: () => (insertBeforeBlock), insertBlock: () => (insertBlock), insertBlocks: () => (insertBlocks), insertDefaultBlock: () => (insertDefaultBlock), mergeBlocks: () => (mergeBlocks), moveBlockToPosition: () => (moveBlockToPosition), moveBlocksDown: () => (moveBlocksDown), moveBlocksToPosition: () => (moveBlocksToPosition), moveBlocksUp: () => (moveBlocksUp), multiSelect: () => (multiSelect), receiveBlocks: () => (receiveBlocks), registerInserterMediaCategory: () => (registerInserterMediaCategory), removeBlock: () => (removeBlock), removeBlocks: () => (removeBlocks), replaceBlock: () => (replaceBlock), replaceBlocks: () => (replaceBlocks), replaceInnerBlocks: () => (replaceInnerBlocks), resetBlocks: () => (resetBlocks), resetSelection: () => (resetSelection), selectBlock: () => (selectBlock), selectNextBlock: () => (selectNextBlock), selectPreviousBlock: () => (selectPreviousBlock), selectionChange: () => (selectionChange), setBlockEditingMode: () => (setBlockEditingMode), setBlockMovingClientId: () => (setBlockMovingClientId), setBlockVisibility: () => (setBlockVisibility), setHasControlledInnerBlocks: () => (setHasControlledInnerBlocks), setNavigationMode: () => (setNavigationMode), setTemplateValidity: () => (setTemplateValidity), showInsertionPoint: () => (showInsertionPoint), startDraggingBlocks: () => (startDraggingBlocks), startMultiSelect: () => (startMultiSelect), startTyping: () => (startTyping), stopDraggingBlocks: () => (stopDraggingBlocks), stopMultiSelect: () => (stopMultiSelect), stopTyping: () => (stopTyping), synchronizeTemplate: () => (synchronizeTemplate), toggleBlockHighlight: () => (toggleBlockHighlight), toggleBlockMode: () => (toggleBlockMode), toggleSelection: () => (toggleSelection), unsetBlockEditingMode: () => (unsetBlockEditingMode), updateBlock: () => (updateBlock), updateBlockAttributes: () => (updateBlockAttributes), updateBlockListSettings: () => (updateBlockListSettings), updateSettings: () => (updateSettings), validateBlocksToTemplate: () => (validateBlocksToTemplate) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/selectors.js var store_selectors_namespaceObject = {}; __webpack_require__.r(store_selectors_namespaceObject); __webpack_require__.d(store_selectors_namespaceObject, { getItems: () => (getItems), getSettings: () => (selectors_getSettings), isUploading: () => (isUploading), isUploadingById: () => (isUploadingById), isUploadingByUrl: () => (isUploadingByUrl) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/private-selectors.js var store_private_selectors_namespaceObject = {}; __webpack_require__.r(store_private_selectors_namespaceObject); __webpack_require__.d(store_private_selectors_namespaceObject, { getAllItems: () => (getAllItems), getBlobUrls: () => (getBlobUrls), getItem: () => (getItem), getPausedUploadForPost: () => (getPausedUploadForPost), isBatchUploaded: () => (isBatchUploaded), isPaused: () => (isPaused), isUploadingToPost: () => (isUploadingToPost) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/actions.js var store_actions_namespaceObject = {}; __webpack_require__.r(store_actions_namespaceObject); __webpack_require__.d(store_actions_namespaceObject, { addItems: () => (addItems), cancelItem: () => (cancelItem) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/private-actions.js var store_private_actions_namespaceObject = {}; __webpack_require__.r(store_private_actions_namespaceObject); __webpack_require__.d(store_private_actions_namespaceObject, { addItem: () => (addItem), finishOperation: () => (finishOperation), pauseQueue: () => (pauseQueue), prepareItem: () => (prepareItem), processItem: () => (processItem), removeItem: () => (removeItem), resumeQueue: () => (resumeQueue), revokeBlobUrls: () => (revokeBlobUrls), updateSettings: () => (private_actions_updateSettings), uploadItem: () => (uploadItem) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js var global_styles_namespaceObject = {}; __webpack_require__.r(global_styles_namespaceObject); __webpack_require__.d(global_styles_namespaceObject, { AdvancedPanel: () => (AdvancedPanel), BackgroundPanel: () => (background_panel_BackgroundImagePanel), BorderPanel: () => (BorderPanel), ColorPanel: () => (ColorPanel), DimensionsPanel: () => (DimensionsPanel), FiltersPanel: () => (FiltersPanel), GlobalStylesContext: () => (GlobalStylesContext), ImageSettingsPanel: () => (ImageSettingsPanel), TypographyPanel: () => (TypographyPanel), areGlobalStyleConfigsEqual: () => (areGlobalStyleConfigsEqual), getBlockCSSSelector: () => (getBlockCSSSelector), getBlockSelectors: () => (getBlockSelectors), getGlobalStylesChanges: () => (getGlobalStylesChanges), getLayoutStyles: () => (getLayoutStyles), toStyles: () => (toStyles), useGlobalSetting: () => (useGlobalSetting), useGlobalStyle: () => (useGlobalStyle), useGlobalStylesOutput: () => (useGlobalStylesOutput), useGlobalStylesOutputWithConfig: () => (useGlobalStylesOutputWithConfig), useGlobalStylesReset: () => (useGlobalStylesReset), useHasBackgroundPanel: () => (useHasBackgroundPanel), useHasBorderPanel: () => (useHasBorderPanel), useHasBorderPanelControls: () => (useHasBorderPanelControls), useHasColorPanel: () => (useHasColorPanel), useHasDimensionsPanel: () => (useHasDimensionsPanel), useHasFiltersPanel: () => (useHasFiltersPanel), useHasImageSettingsPanel: () => (useHasImageSettingsPanel), useHasTypographyPanel: () => (useHasTypographyPanel), useSettingsForBlockElement: () => (useSettingsForBlockElement) }); ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/context.js /** * WordPress dependencies */ const mayDisplayControlsKey = Symbol('mayDisplayControls'); const mayDisplayParentControlsKey = Symbol('mayDisplayParentControls'); const blockEditingModeKey = Symbol('blockEditingMode'); const blockBindingsKey = Symbol('blockBindings'); const isPreviewModeKey = Symbol('isPreviewMode'); const DEFAULT_BLOCK_EDIT_CONTEXT = { name: '', isSelected: false }; const Context = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_BLOCK_EDIT_CONTEXT); const { Provider } = Context; /** * A hook that returns the block edit context. * * @return {Object} Block edit context */ function useBlockEditContext() { return (0,external_wp_element_namespaceObject.useContext)(Context); } ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js var es6 = __webpack_require__(7734); var es6_default = /*#__PURE__*/__webpack_require__.n(es6); ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/@wordpress/block-editor/build-module/store/defaults.js /** * WordPress dependencies */ const PREFERENCES_DEFAULTS = { insertUsage: {} }; /** * The default editor settings * * @typedef {Object} SETTINGS_DEFAULT * @property {boolean} alignWide Enable/Disable Wide/Full Alignments * @property {boolean} supportsLayout Enable/disable layouts support in container blocks. * @property {boolean} imageEditing Image Editing settings set to false to disable. * @property {Array} imageSizes Available image sizes * @property {number} maxWidth Max width to constraint resizing * @property {boolean|Array} allowedBlockTypes Allowed block types * @property {boolean} hasFixedToolbar Whether or not the editor toolbar is fixed * @property {boolean} distractionFree Whether or not the editor UI is distraction free * @property {boolean} focusMode Whether the focus mode is enabled or not * @property {Array} styles Editor Styles * @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode * @property {string} bodyPlaceholder Empty post placeholder * @property {string} titlePlaceholder Empty title placeholder * @property {boolean} canLockBlocks Whether the user can manage Block Lock state * @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor * @property {boolean} generateAnchors Enable/Disable auto anchor generation for Heading blocks * @property {boolean} enableOpenverseMediaCategory Enable/Disable the Openverse media category in the inserter. * @property {boolean} clearBlockSelection Whether the block editor should clear selection on mousedown when a block is not clicked. * @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes. * @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory * @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns * @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories */ const SETTINGS_DEFAULTS = { alignWide: false, supportsLayout: true, // colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. colors: [{ name: (0,external_wp_i18n_namespaceObject.__)('Black'), slug: 'black', color: '#000000' }, { name: (0,external_wp_i18n_namespaceObject.__)('Cyan bluish gray'), slug: 'cyan-bluish-gray', color: '#abb8c3' }, { name: (0,external_wp_i18n_namespaceObject.__)('White'), slug: 'white', color: '#ffffff' }, { name: (0,external_wp_i18n_namespaceObject.__)('Pale pink'), slug: 'pale-pink', color: '#f78da7' }, { name: (0,external_wp_i18n_namespaceObject.__)('Vivid red'), slug: 'vivid-red', color: '#cf2e2e' }, { name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid orange'), slug: 'luminous-vivid-orange', color: '#ff6900' }, { name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid amber'), slug: 'luminous-vivid-amber', color: '#fcb900' }, { name: (0,external_wp_i18n_namespaceObject.__)('Light green cyan'), slug: 'light-green-cyan', color: '#7bdcb5' }, { name: (0,external_wp_i18n_namespaceObject.__)('Vivid green cyan'), slug: 'vivid-green-cyan', color: '#00d084' }, { name: (0,external_wp_i18n_namespaceObject.__)('Pale cyan blue'), slug: 'pale-cyan-blue', color: '#8ed1fc' }, { name: (0,external_wp_i18n_namespaceObject.__)('Vivid cyan blue'), slug: 'vivid-cyan-blue', color: '#0693e3' }, { name: (0,external_wp_i18n_namespaceObject.__)('Vivid purple'), slug: 'vivid-purple', color: '#9b51e0' }], // fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. fontSizes: [{ name: (0,external_wp_i18n_namespaceObject._x)('Small', 'font size name'), size: 13, slug: 'small' }, { name: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font size name'), size: 16, slug: 'normal' }, { name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font size name'), size: 20, slug: 'medium' }, { name: (0,external_wp_i18n_namespaceObject._x)('Large', 'font size name'), size: 36, slug: 'large' }, { name: (0,external_wp_i18n_namespaceObject._x)('Huge', 'font size name'), size: 42, slug: 'huge' }], // Image default size slug. imageDefaultSize: 'large', imageSizes: [{ slug: 'thumbnail', name: (0,external_wp_i18n_namespaceObject.__)('Thumbnail') }, { slug: 'medium', name: (0,external_wp_i18n_namespaceObject.__)('Medium') }, { slug: 'large', name: (0,external_wp_i18n_namespaceObject.__)('Large') }, { slug: 'full', name: (0,external_wp_i18n_namespaceObject.__)('Full Size') }], // Allow plugin to disable Image Editor if need be. imageEditing: true, // This is current max width of the block inner area // It's used to constraint image resizing and this value could be overridden later by themes maxWidth: 580, // Allowed block types for the editor, defaulting to true (all supported). allowedBlockTypes: true, // Maximum upload size in bytes allowed for the site. maxUploadFileSize: 0, // List of allowed mime types and file extensions. allowedMimeTypes: null, // Allows to disable block locking interface. canLockBlocks: true, // Allows to disable Openverse media category in the inserter. enableOpenverseMediaCategory: true, clearBlockSelection: true, __experimentalCanUserUseUnfilteredHTML: false, __experimentalBlockDirectory: false, __mobileEnablePageTemplates: false, __experimentalBlockPatterns: [], __experimentalBlockPatternCategories: [], isPreviewMode: false, // These settings will be completely revamped in the future. // The goal is to evolve this into an API which will instruct // the block inspector to animate transitions between what it // displays based on the relationship between the selected block // and its parent, and only enable it if the parent is controlling // its children blocks. blockInspectorAnimation: { animationParent: 'core/navigation', 'core/navigation': { enterDirection: 'leftToRight' }, 'core/navigation-submenu': { enterDirection: 'rightToLeft' }, 'core/navigation-link': { enterDirection: 'rightToLeft' }, 'core/search': { enterDirection: 'rightToLeft' }, 'core/social-links': { enterDirection: 'rightToLeft' }, 'core/page-list': { enterDirection: 'rightToLeft' }, 'core/spacer': { enterDirection: 'rightToLeft' }, 'core/home-link': { enterDirection: 'rightToLeft' }, 'core/site-title': { enterDirection: 'rightToLeft' }, 'core/site-logo': { enterDirection: 'rightToLeft' } }, generateAnchors: false, // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. gradients: [{ name: (0,external_wp_i18n_namespaceObject.__)('Vivid cyan blue to vivid purple'), gradient: 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)', slug: 'vivid-cyan-blue-to-vivid-purple' }, { name: (0,external_wp_i18n_namespaceObject.__)('Light green cyan to vivid green cyan'), gradient: 'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)', slug: 'light-green-cyan-to-vivid-green-cyan' }, { name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid amber to luminous vivid orange'), gradient: 'linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)', slug: 'luminous-vivid-amber-to-luminous-vivid-orange' }, { name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid orange to vivid red'), gradient: 'linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)', slug: 'luminous-vivid-orange-to-vivid-red' }, { name: (0,external_wp_i18n_namespaceObject.__)('Very light gray to cyan bluish gray'), gradient: 'linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)', slug: 'very-light-gray-to-cyan-bluish-gray' }, { name: (0,external_wp_i18n_namespaceObject.__)('Cool to warm spectrum'), gradient: 'linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)', slug: 'cool-to-warm-spectrum' }, { name: (0,external_wp_i18n_namespaceObject.__)('Blush light purple'), gradient: 'linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)', slug: 'blush-light-purple' }, { name: (0,external_wp_i18n_namespaceObject.__)('Blush bordeaux'), gradient: 'linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)', slug: 'blush-bordeaux' }, { name: (0,external_wp_i18n_namespaceObject.__)('Luminous dusk'), gradient: 'linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)', slug: 'luminous-dusk' }, { name: (0,external_wp_i18n_namespaceObject.__)('Pale ocean'), gradient: 'linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)', slug: 'pale-ocean' }, { name: (0,external_wp_i18n_namespaceObject.__)('Electric grass'), gradient: 'linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)', slug: 'electric-grass' }, { name: (0,external_wp_i18n_namespaceObject.__)('Midnight'), gradient: 'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)', slug: 'midnight' }], __unstableResolvedAssets: { styles: [], scripts: [] } }; ;// ./node_modules/@wordpress/block-editor/build-module/store/array.js /** * Insert one or multiple elements into a given position of an array. * * @param {Array} array Source array. * @param {*} elements Elements to insert. * @param {number} index Insert Position. * * @return {Array} Result. */ function insertAt(array, elements, index) { return [...array.slice(0, index), ...(Array.isArray(elements) ? elements : [elements]), ...array.slice(index)]; } /** * Moves an element in an array. * * @param {Array} array Source array. * @param {number} from Source index. * @param {number} to Destination index. * @param {number} count Number of elements to move. * * @return {Array} Result. */ function moveTo(array, from, to, count = 1) { const withoutMovedElements = [...array]; withoutMovedElements.splice(from, count); return insertAt(withoutMovedElements, array.slice(from, from + count), to); } ;// ./node_modules/@wordpress/block-editor/build-module/store/private-keys.js const globalStylesDataKey = Symbol('globalStylesDataKey'); const globalStylesLinksDataKey = Symbol('globalStylesLinks'); const selectBlockPatternsKey = Symbol('selectBlockPatternsKey'); const reusableBlocksSelectKey = Symbol('reusableBlocksSelect'); const sectionRootClientIdKey = Symbol('sectionRootClientIdKey'); ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/block-editor/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/block-editor'); ;// ./node_modules/@wordpress/block-editor/build-module/store/reducer.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis); const identity = x => x; /** * Given an array of blocks, returns an object where each key is a nesting * context, the value of which is an array of block client IDs existing within * that nesting context. * * @param {Array} blocks Blocks to map. * @param {?string} rootClientId Assumed root client ID. * * @return {Object} Block order map object. */ function mapBlockOrder(blocks, rootClientId = '') { const result = new Map(); const current = []; result.set(rootClientId, current); blocks.forEach(block => { const { clientId, innerBlocks } = block; current.push(clientId); mapBlockOrder(innerBlocks, clientId).forEach((order, subClientId) => { result.set(subClientId, order); }); }); return result; } /** * Given an array of blocks, returns an object where each key contains * the clientId of the block and the value is the parent of the block. * * @param {Array} blocks Blocks to map. * @param {?string} rootClientId Assumed root client ID. * * @return {Object} Block order map object. */ function mapBlockParents(blocks, rootClientId = '') { const result = []; const stack = [[rootClientId, blocks]]; while (stack.length) { const [parent, currentBlocks] = stack.shift(); currentBlocks.forEach(({ innerBlocks, ...block }) => { result.push([block.clientId, parent]); if (innerBlocks?.length) { stack.push([block.clientId, innerBlocks]); } }); } return result; } /** * Helper method to iterate through all blocks, recursing into inner blocks, * applying a transformation function to each one. * Returns a flattened object with the transformed blocks. * * @param {Array} blocks Blocks to flatten. * @param {Function} transform Transforming function to be applied to each block. * * @return {Array} Flattened object. */ function flattenBlocks(blocks, transform = identity) { const result = []; const stack = [...blocks]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); stack.push(...innerBlocks); result.push([block.clientId, transform(block)]); } return result; } function getFlattenedClientIds(blocks) { const result = {}; const stack = [...blocks]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); stack.push(...innerBlocks); result[block.clientId] = true; } return result; } /** * Given an array of blocks, returns an object containing all blocks, without * attributes, recursing into inner blocks. Keys correspond to the block client * ID, the value of which is the attributes object. * * @param {Array} blocks Blocks to flatten. * * @return {Array} Flattened block attributes object. */ function getFlattenedBlocksWithoutAttributes(blocks) { return flattenBlocks(blocks, block => { const { attributes, ...restBlock } = block; return restBlock; }); } /** * Given an array of blocks, returns an object containing all block attributes, * recursing into inner blocks. Keys correspond to the block client ID, the * value of which is the attributes object. * * @param {Array} blocks Blocks to flatten. * * @return {Array} Flattened block attributes object. */ function getFlattenedBlockAttributes(blocks) { return flattenBlocks(blocks, block => block.attributes); } /** * Returns true if the two object arguments have the same keys, or false * otherwise. * * @param {Object} a First object. * @param {Object} b Second object. * * @return {boolean} Whether the two objects have the same keys. */ function hasSameKeys(a, b) { return es6_default()(Object.keys(a), Object.keys(b)); } /** * Returns true if, given the currently dispatching action and the previously * dispatched action, the two actions are updating the same block attribute, or * false otherwise. * * @param {Object} action Currently dispatching action. * @param {Object} lastAction Previously dispatched action. * * @return {boolean} Whether actions are updating the same block attribute. */ function isUpdatingSameBlockAttribute(action, lastAction) { return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && es6_default()(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes); } function updateBlockTreeForBlocks(state, blocks) { const treeToUpdate = state.tree; const stack = [...blocks]; const flattenedBlocks = [...blocks]; while (stack.length) { const block = stack.shift(); stack.push(...block.innerBlocks); flattenedBlocks.push(...block.innerBlocks); } // Create objects before mutating them, that way it's always defined. for (const block of flattenedBlocks) { treeToUpdate.set(block.clientId, {}); } for (const block of flattenedBlocks) { treeToUpdate.set(block.clientId, Object.assign(treeToUpdate.get(block.clientId), { ...state.byClientId.get(block.clientId), attributes: state.attributes.get(block.clientId), innerBlocks: block.innerBlocks.map(subBlock => treeToUpdate.get(subBlock.clientId)) })); } } function updateParentInnerBlocksInTree(state, updatedClientIds, updateChildrenOfUpdatedClientIds = false) { const treeToUpdate = state.tree; const uncontrolledParents = new Set([]); const controlledParents = new Set(); for (const clientId of updatedClientIds) { let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(clientId); do { if (state.controlledInnerBlocks[current]) { // Should stop on controlled blocks. // If we reach a controlled parent, break out of the loop. controlledParents.add(current); break; } else { // Else continue traversing up through parents. uncontrolledParents.add(current); current = state.parents.get(current); } } while (current !== undefined); } // To make sure the order of assignments doesn't matter, // we first create empty objects and mutates the inner blocks later. for (const clientId of uncontrolledParents) { treeToUpdate.set(clientId, { ...treeToUpdate.get(clientId) }); } for (const clientId of uncontrolledParents) { treeToUpdate.get(clientId).innerBlocks = (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId)); } // Controlled parent blocks, need a dedicated key for their inner blocks // to be used when doing getBlocks( controlledBlockClientId ). for (const clientId of controlledParents) { treeToUpdate.set('controlled||' + clientId, { innerBlocks: (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId)) }); } } /** * Higher-order reducer intended to compute full block objects key for each block in the post. * This is a denormalization to optimize the performance of the getBlock selectors and avoid * recomputing the block objects and avoid heavy memoization. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ const withBlockTree = reducer => (state = {}, action) => { const newState = reducer(state, action); if (newState === state) { return state; } newState.tree = state.tree ? state.tree : new Map(); switch (action.type) { case 'RECEIVE_BLOCKS': case 'INSERT_BLOCKS': { newState.tree = new Map(newState.tree); updateBlockTreeForBlocks(newState, action.blocks); updateParentInnerBlocksInTree(newState, action.rootClientId ? [action.rootClientId] : [''], true); break; } case 'UPDATE_BLOCK': newState.tree = new Map(newState.tree); newState.tree.set(action.clientId, { ...newState.tree.get(action.clientId), ...newState.byClientId.get(action.clientId), attributes: newState.attributes.get(action.clientId) }); updateParentInnerBlocksInTree(newState, [action.clientId], false); break; case 'SYNC_DERIVED_BLOCK_ATTRIBUTES': case 'UPDATE_BLOCK_ATTRIBUTES': { newState.tree = new Map(newState.tree); action.clientIds.forEach(clientId => { newState.tree.set(clientId, { ...newState.tree.get(clientId), attributes: newState.attributes.get(clientId) }); }); updateParentInnerBlocksInTree(newState, action.clientIds, false); break; } case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': { const inserterClientIds = getFlattenedClientIds(action.blocks); newState.tree = new Map(newState.tree); action.replacedClientIds.forEach(clientId => { newState.tree.delete(clientId); // Controlled inner blocks are only removed // if the block doesn't move to another position // otherwise their content will be lost. if (!inserterClientIds[clientId]) { newState.tree.delete('controlled||' + clientId); } }); updateBlockTreeForBlocks(newState, action.blocks); updateParentInnerBlocksInTree(newState, action.blocks.map(b => b.clientId), false); // If there are no replaced blocks, it means we're removing blocks so we need to update their parent. const parentsOfRemovedBlocks = []; for (const clientId of action.clientIds) { const parentId = state.parents.get(clientId); if (parentId !== undefined && (parentId === '' || newState.byClientId.get(parentId))) { parentsOfRemovedBlocks.push(parentId); } } updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true); break; } case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': const parentsOfRemovedBlocks = []; for (const clientId of action.clientIds) { const parentId = state.parents.get(clientId); if (parentId !== undefined && (parentId === '' || newState.byClientId.get(parentId))) { parentsOfRemovedBlocks.push(parentId); } } newState.tree = new Map(newState.tree); action.removedClientIds.forEach(clientId => { newState.tree.delete(clientId); newState.tree.delete('controlled||' + clientId); }); updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true); break; case 'MOVE_BLOCKS_TO_POSITION': { const updatedBlockUids = []; if (action.fromRootClientId) { updatedBlockUids.push(action.fromRootClientId); } else { updatedBlockUids.push(''); } if (action.toRootClientId) { updatedBlockUids.push(action.toRootClientId); } newState.tree = new Map(newState.tree); updateParentInnerBlocksInTree(newState, updatedBlockUids, true); break; } case 'MOVE_BLOCKS_UP': case 'MOVE_BLOCKS_DOWN': { const updatedBlockUids = [action.rootClientId ? action.rootClientId : '']; newState.tree = new Map(newState.tree); updateParentInnerBlocksInTree(newState, updatedBlockUids, true); break; } case 'SAVE_REUSABLE_BLOCK_SUCCESS': { const updatedBlockUids = []; newState.attributes.forEach((attributes, clientId) => { if (newState.byClientId.get(clientId).name === 'core/block' && attributes.ref === action.updatedId) { updatedBlockUids.push(clientId); } }); newState.tree = new Map(newState.tree); updatedBlockUids.forEach(clientId => { newState.tree.set(clientId, { ...newState.byClientId.get(clientId), attributes: newState.attributes.get(clientId), innerBlocks: newState.tree.get(clientId).innerBlocks }); }); updateParentInnerBlocksInTree(newState, updatedBlockUids, false); } } return newState; }; /** * Higher-order reducer intended to augment the blocks reducer, assigning an * `isPersistentChange` property value corresponding to whether a change in * state can be considered as persistent. All changes are considered persistent * except when updating the same block attribute as in the previous action. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ function withPersistentBlockChange(reducer) { let lastAction; let markNextChangeAsNotPersistent = false; let explicitPersistent; return (state, action) => { let nextState = reducer(state, action); let nextIsPersistentChange; if (action.type === 'SET_EXPLICIT_PERSISTENT') { var _state$isPersistentCh; explicitPersistent = action.isPersistentChange; nextIsPersistentChange = (_state$isPersistentCh = state.isPersistentChange) !== null && _state$isPersistentCh !== void 0 ? _state$isPersistentCh : true; } if (explicitPersistent !== undefined) { nextIsPersistentChange = explicitPersistent; return nextIsPersistentChange === nextState.isPersistentChange ? nextState : { ...nextState, isPersistentChange: nextIsPersistentChange }; } const isExplicitPersistentChange = action.type === 'MARK_LAST_CHANGE_AS_PERSISTENT' || markNextChangeAsNotPersistent; // Defer to previous state value (or default) unless changing or // explicitly marking as persistent. if (state === nextState && !isExplicitPersistentChange) { var _state$isPersistentCh2; markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT'; nextIsPersistentChange = (_state$isPersistentCh2 = state?.isPersistentChange) !== null && _state$isPersistentCh2 !== void 0 ? _state$isPersistentCh2 : true; if (state.isPersistentChange === nextIsPersistentChange) { return state; } return { ...nextState, isPersistentChange: nextIsPersistentChange }; } nextState = { ...nextState, isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction) }; // In comparing against the previous action, consider only those which // would have qualified as one which would have been ignored or not // have resulted in a changed state. lastAction = action; markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT'; return nextState; }; } /** * Higher-order reducer intended to augment the blocks reducer, assigning an * `isIgnoredChange` property value corresponding to whether a change in state * can be considered as ignored. A change is considered ignored when the result * of an action not incurred by direct user interaction. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ function withIgnoredBlockChange(reducer) { /** * Set of action types for which a blocks state change should be ignored. * * @type {Set} */ const IGNORED_ACTION_TYPES = new Set(['RECEIVE_BLOCKS']); return (state, action) => { const nextState = reducer(state, action); if (nextState !== state) { nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type); } return nextState; }; } /** * Higher-order reducer targeting the combined blocks reducer, augmenting * block client IDs in remove action to include cascade of inner blocks. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ const withInnerBlocksRemoveCascade = reducer => (state, action) => { // Gets all children which need to be removed. const getAllChildren = clientIds => { let result = clientIds; for (let i = 0; i < result.length; i++) { if (!state.order.get(result[i]) || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) { continue; } if (result === clientIds) { result = [...result]; } result.push(...state.order.get(result[i])); } return result; }; if (state) { switch (action.type) { case 'REMOVE_BLOCKS': action = { ...action, type: 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN', removedClientIds: getAllChildren(action.clientIds) }; break; case 'REPLACE_BLOCKS': action = { ...action, type: 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN', replacedClientIds: getAllChildren(action.clientIds) }; break; } } return reducer(state, action); }; /** * Higher-order reducer which targets the combined blocks reducer and handles * the `RESET_BLOCKS` action. When dispatched, this action will replace all * blocks that exist in the post, leaving blocks that exist only in state (e.g. * reusable blocks and blocks controlled by inner blocks controllers) alone. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ const withBlockReset = reducer => (state, action) => { if (action.type === 'RESET_BLOCKS') { const newState = { ...state, byClientId: new Map(getFlattenedBlocksWithoutAttributes(action.blocks)), attributes: new Map(getFlattenedBlockAttributes(action.blocks)), order: mapBlockOrder(action.blocks), parents: new Map(mapBlockParents(action.blocks)), controlledInnerBlocks: {} }; newState.tree = new Map(state?.tree); updateBlockTreeForBlocks(newState, action.blocks); newState.tree.set('', { innerBlocks: action.blocks.map(subBlock => newState.tree.get(subBlock.clientId)) }); return newState; } return reducer(state, action); }; /** * Higher-order reducer which targets the combined blocks reducer and handles * the `REPLACE_INNER_BLOCKS` action. When dispatched, this action the state * should become equivalent to the execution of a `REMOVE_BLOCKS` action * containing all the child's of the root block followed by the execution of * `INSERT_BLOCKS` with the new blocks. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ const withReplaceInnerBlocks = reducer => (state, action) => { if (action.type !== 'REPLACE_INNER_BLOCKS') { return reducer(state, action); } // Finds every nested inner block controller. We must check the action blocks // and not just the block parent state because some inner block controllers // should be deleted if specified, whereas others should not be deleted. If // a controlled should not be deleted, then we need to avoid deleting its // inner blocks from the block state because its inner blocks will not be // attached to the block in the action. const nestedControllers = {}; if (Object.keys(state.controlledInnerBlocks).length) { const stack = [...action.blocks]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); stack.push(...innerBlocks); if (!!state.controlledInnerBlocks[block.clientId]) { nestedControllers[block.clientId] = true; } } } // The `keepControlledInnerBlocks` prop will keep the inner blocks of the // marked block in the block state so that they can be reattached to the // marked block when we re-insert everything a few lines below. let stateAfterBlocksRemoval = state; if (state.order.get(action.rootClientId)) { stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, { type: 'REMOVE_BLOCKS', keepControlledInnerBlocks: nestedControllers, clientIds: state.order.get(action.rootClientId) }); } let stateAfterInsert = stateAfterBlocksRemoval; if (action.blocks.length) { stateAfterInsert = reducer(stateAfterInsert, { ...action, type: 'INSERT_BLOCKS', index: 0 }); // We need to re-attach the controlled inner blocks to the blocks tree and // preserve their block order. Otherwise, an inner block controller's blocks // will be deleted entirely from its entity. const stateAfterInsertOrder = new Map(stateAfterInsert.order); Object.keys(nestedControllers).forEach(key => { if (state.order.get(key)) { stateAfterInsertOrder.set(key, state.order.get(key)); } }); stateAfterInsert.order = stateAfterInsertOrder; stateAfterInsert.tree = new Map(stateAfterInsert.tree); Object.keys(nestedControllers).forEach(_key => { const key = `controlled||${_key}`; if (state.tree.has(key)) { stateAfterInsert.tree.set(key, state.tree.get(key)); } }); } return stateAfterInsert; }; /** * Higher-order reducer which targets the combined blocks reducer and handles * the `SAVE_REUSABLE_BLOCK_SUCCESS` action. This action can't be handled by * regular reducers and needs a higher-order reducer since it needs access to * both `byClientId` and `attributes` simultaneously. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ const withSaveReusableBlock = reducer => (state, action) => { if (state && action.type === 'SAVE_REUSABLE_BLOCK_SUCCESS') { const { id, updatedId } = action; // If a temporary reusable block is saved, we swap the temporary id with the final one. if (id === updatedId) { return state; } state = { ...state }; state.attributes = new Map(state.attributes); state.attributes.forEach((attributes, clientId) => { const { name } = state.byClientId.get(clientId); if (name === 'core/block' && attributes.ref === id) { state.attributes.set(clientId, { ...attributes, ref: updatedId }); } }); } return reducer(state, action); }; /** * Higher-order reducer which removes blocks from state when switching parent block controlled state. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ const withResetControlledBlocks = reducer => (state, action) => { if (action.type === 'SET_HAS_CONTROLLED_INNER_BLOCKS') { // when switching a block from controlled to uncontrolled or inverse, // we need to remove its content first. const tempState = reducer(state, { type: 'REPLACE_INNER_BLOCKS', rootClientId: action.clientId, blocks: [] }); return reducer(tempState, action); } return reducer(state, action); }; /** * Reducer returning the blocks state. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const blocks = (0,external_wp_compose_namespaceObject.pipe)(external_wp_data_namespaceObject.combineReducers, withSaveReusableBlock, // Needs to be before withBlockCache. withBlockTree, // Needs to be before withInnerBlocksRemoveCascade. withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // Needs to be after withInnerBlocksRemoveCascade. withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetControlledBlocks)({ // The state is using a Map instead of a plain object for performance reasons. // You can run the "./test/performance.js" unit test to check the impact // code changes can have on this reducer. byClientId(state = new Map(), action) { switch (action.type) { case 'RECEIVE_BLOCKS': case 'INSERT_BLOCKS': { const newState = new Map(state); getFlattenedBlocksWithoutAttributes(action.blocks).forEach(([key, value]) => { newState.set(key, value); }); return newState; } case 'UPDATE_BLOCK': { // Ignore updates if block isn't known. if (!state.has(action.clientId)) { return state; } // Do nothing if only attributes change. const { attributes, ...changes } = action.updates; if (Object.values(changes).length === 0) { return state; } const newState = new Map(state); newState.set(action.clientId, { ...state.get(action.clientId), ...changes }); return newState; } case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': { if (!action.blocks) { return state; } const newState = new Map(state); action.replacedClientIds.forEach(clientId => { newState.delete(clientId); }); getFlattenedBlocksWithoutAttributes(action.blocks).forEach(([key, value]) => { newState.set(key, value); }); return newState; } case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': { const newState = new Map(state); action.removedClientIds.forEach(clientId => { newState.delete(clientId); }); return newState; } } return state; }, // The state is using a Map instead of a plain object for performance reasons. // You can run the "./test/performance.js" unit test to check the impact // code changes can have on this reducer. attributes(state = new Map(), action) { switch (action.type) { case 'RECEIVE_BLOCKS': case 'INSERT_BLOCKS': { const newState = new Map(state); getFlattenedBlockAttributes(action.blocks).forEach(([key, value]) => { newState.set(key, value); }); return newState; } case 'UPDATE_BLOCK': { // Ignore updates if block isn't known or there are no attribute changes. if (!state.get(action.clientId) || !action.updates.attributes) { return state; } const newState = new Map(state); newState.set(action.clientId, { ...state.get(action.clientId), ...action.updates.attributes }); return newState; } case 'SYNC_DERIVED_BLOCK_ATTRIBUTES': case 'UPDATE_BLOCK_ATTRIBUTES': { // Avoid a state change if none of the block IDs are known. if (action.clientIds.every(id => !state.get(id))) { return state; } let hasChange = false; const newState = new Map(state); for (const clientId of action.clientIds) { var _action$attributes; const updatedAttributeEntries = Object.entries(action.uniqueByBlock ? action.attributes[clientId] : (_action$attributes = action.attributes) !== null && _action$attributes !== void 0 ? _action$attributes : {}); if (updatedAttributeEntries.length === 0) { continue; } let hasUpdatedAttributes = false; const existingAttributes = state.get(clientId); const newAttributes = {}; updatedAttributeEntries.forEach(([key, value]) => { if (existingAttributes[key] !== value) { hasUpdatedAttributes = true; newAttributes[key] = value; } }); hasChange = hasChange || hasUpdatedAttributes; if (hasUpdatedAttributes) { newState.set(clientId, { ...existingAttributes, ...newAttributes }); } } return hasChange ? newState : state; } case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': { if (!action.blocks) { return state; } const newState = new Map(state); action.replacedClientIds.forEach(clientId => { newState.delete(clientId); }); getFlattenedBlockAttributes(action.blocks).forEach(([key, value]) => { newState.set(key, value); }); return newState; } case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': { const newState = new Map(state); action.removedClientIds.forEach(clientId => { newState.delete(clientId); }); return newState; } } return state; }, // The state is using a Map instead of a plain object for performance reasons. // You can run the "./test/performance.js" unit test to check the impact // code changes can have on this reducer. order(state = new Map(), action) { switch (action.type) { case 'RECEIVE_BLOCKS': { var _state$get; const blockOrder = mapBlockOrder(action.blocks); const newState = new Map(state); blockOrder.forEach((order, clientId) => { if (clientId !== '') { newState.set(clientId, order); } }); newState.set('', ((_state$get = state.get('')) !== null && _state$get !== void 0 ? _state$get : []).concat(blockOrder[''])); return newState; } case 'INSERT_BLOCKS': { const { rootClientId = '' } = action; const subState = state.get(rootClientId) || []; const mappedBlocks = mapBlockOrder(action.blocks, rootClientId); const { index = subState.length } = action; const newState = new Map(state); mappedBlocks.forEach((order, clientId) => { newState.set(clientId, order); }); newState.set(rootClientId, insertAt(subState, mappedBlocks.get(rootClientId), index)); return newState; } case 'MOVE_BLOCKS_TO_POSITION': { var _state$get$filter; const { fromRootClientId = '', toRootClientId = '', clientIds } = action; const { index = state.get(toRootClientId).length } = action; // Moving inside the same parent block. if (fromRootClientId === toRootClientId) { const subState = state.get(toRootClientId); const fromIndex = subState.indexOf(clientIds[0]); const newState = new Map(state); newState.set(toRootClientId, moveTo(state.get(toRootClientId), fromIndex, index, clientIds.length)); return newState; } // Moving from a parent block to another. const newState = new Map(state); newState.set(fromRootClientId, (_state$get$filter = state.get(fromRootClientId)?.filter(id => !clientIds.includes(id))) !== null && _state$get$filter !== void 0 ? _state$get$filter : []); newState.set(toRootClientId, insertAt(state.get(toRootClientId), clientIds, index)); return newState; } case 'MOVE_BLOCKS_UP': { const { clientIds, rootClientId = '' } = action; const firstClientId = clientIds[0]; const subState = state.get(rootClientId); if (!subState.length || firstClientId === subState[0]) { return state; } const firstIndex = subState.indexOf(firstClientId); const newState = new Map(state); newState.set(rootClientId, moveTo(subState, firstIndex, firstIndex - 1, clientIds.length)); return newState; } case 'MOVE_BLOCKS_DOWN': { const { clientIds, rootClientId = '' } = action; const firstClientId = clientIds[0]; const lastClientId = clientIds[clientIds.length - 1]; const subState = state.get(rootClientId); if (!subState.length || lastClientId === subState[subState.length - 1]) { return state; } const firstIndex = subState.indexOf(firstClientId); const newState = new Map(state); newState.set(rootClientId, moveTo(subState, firstIndex, firstIndex + 1, clientIds.length)); return newState; } case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': { const { clientIds } = action; if (!action.blocks) { return state; } const mappedBlocks = mapBlockOrder(action.blocks); const newState = new Map(state); action.replacedClientIds.forEach(clientId => { newState.delete(clientId); }); mappedBlocks.forEach((order, clientId) => { if (clientId !== '') { newState.set(clientId, order); } }); newState.forEach((order, clientId) => { const newSubOrder = Object.values(order).reduce((result, subClientId) => { if (subClientId === clientIds[0]) { return [...result, ...mappedBlocks.get('')]; } if (clientIds.indexOf(subClientId) === -1) { result.push(subClientId); } return result; }, []); newState.set(clientId, newSubOrder); }); return newState; } case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': { const newState = new Map(state); // Remove inner block ordering for removed blocks. action.removedClientIds.forEach(clientId => { newState.delete(clientId); }); newState.forEach((order, clientId) => { var _order$filter; const newSubOrder = (_order$filter = order?.filter(id => !action.removedClientIds.includes(id))) !== null && _order$filter !== void 0 ? _order$filter : []; if (newSubOrder.length !== order.length) { newState.set(clientId, newSubOrder); } }); return newState; } } return state; }, // While technically redundant data as the inverse of `order`, it serves as // an optimization for the selectors which derive the ancestry of a block. parents(state = new Map(), action) { switch (action.type) { case 'RECEIVE_BLOCKS': { const newState = new Map(state); mapBlockParents(action.blocks).forEach(([key, value]) => { newState.set(key, value); }); return newState; } case 'INSERT_BLOCKS': { const newState = new Map(state); mapBlockParents(action.blocks, action.rootClientId || '').forEach(([key, value]) => { newState.set(key, value); }); return newState; } case 'MOVE_BLOCKS_TO_POSITION': { const newState = new Map(state); action.clientIds.forEach(id => { newState.set(id, action.toRootClientId || ''); }); return newState; } case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': { const newState = new Map(state); action.replacedClientIds.forEach(clientId => { newState.delete(clientId); }); mapBlockParents(action.blocks, state.get(action.clientIds[0])).forEach(([key, value]) => { newState.set(key, value); }); return newState; } case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': { const newState = new Map(state); action.removedClientIds.forEach(clientId => { newState.delete(clientId); }); return newState; } } return state; }, controlledInnerBlocks(state = {}, { type, clientId, hasControlledInnerBlocks }) { if (type === 'SET_HAS_CONTROLLED_INNER_BLOCKS') { return { ...state, [clientId]: hasControlledInnerBlocks }; } return state; } }); /** * Reducer returning visibility status of block interface. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function isBlockInterfaceHidden(state = false, action) { switch (action.type) { case 'HIDE_BLOCK_INTERFACE': return true; case 'SHOW_BLOCK_INTERFACE': return false; } return state; } /** * Reducer returning typing state. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function isTyping(state = false, action) { switch (action.type) { case 'START_TYPING': return true; case 'STOP_TYPING': return false; } return state; } /** * Reducer returning dragging state. It is possible for a user to be dragging * data from outside of the editor, so this state is separate from `draggedBlocks`. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function isDragging(state = false, action) { switch (action.type) { case 'START_DRAGGING': return true; case 'STOP_DRAGGING': return false; } return state; } /** * Reducer returning dragged block client id. * * @param {string[]} state Current state. * @param {Object} action Dispatched action. * * @return {string[]} Updated state. */ function draggedBlocks(state = [], action) { switch (action.type) { case 'START_DRAGGING_BLOCKS': return action.clientIds; case 'STOP_DRAGGING_BLOCKS': return []; } return state; } /** * Reducer tracking the visible blocks. * * @param {Record<string,boolean>} state Current state. * @param {Object} action Dispatched action. * * @return {Record<string,boolean>} Block visibility. */ function blockVisibility(state = {}, action) { if (action.type === 'SET_BLOCK_VISIBILITY') { return { ...state, ...action.updates }; } return state; } /** * Internal helper reducer for selectionStart and selectionEnd. Can hold a block * selection, represented by an object with property clientId. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function selectionHelper(state = {}, action) { switch (action.type) { case 'CLEAR_SELECTED_BLOCK': { if (state.clientId) { return {}; } return state; } case 'SELECT_BLOCK': if (action.clientId === state.clientId) { return state; } return { clientId: action.clientId }; case 'REPLACE_INNER_BLOCKS': case 'INSERT_BLOCKS': { if (!action.updateSelection || !action.blocks.length) { return state; } return { clientId: action.blocks[0].clientId }; } case 'REMOVE_BLOCKS': if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.clientId) === -1) { return state; } return {}; case 'REPLACE_BLOCKS': { if (action.clientIds.indexOf(state.clientId) === -1) { return state; } const blockToSelect = action.blocks[action.indexToSelect] || action.blocks[action.blocks.length - 1]; if (!blockToSelect) { return {}; } if (blockToSelect.clientId === state.clientId) { return state; } return { clientId: blockToSelect.clientId }; } } return state; } /** * Reducer returning the selection state. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function selection(state = {}, action) { switch (action.type) { case 'SELECTION_CHANGE': if (action.clientId) { return { selectionStart: { clientId: action.clientId, attributeKey: action.attributeKey, offset: action.startOffset }, selectionEnd: { clientId: action.clientId, attributeKey: action.attributeKey, offset: action.endOffset } }; } return { selectionStart: action.start || state.selectionStart, selectionEnd: action.end || state.selectionEnd }; case 'RESET_SELECTION': const { selectionStart, selectionEnd } = action; return { selectionStart, selectionEnd }; case 'MULTI_SELECT': const { start, end } = action; if (start === state.selectionStart?.clientId && end === state.selectionEnd?.clientId) { return state; } return { selectionStart: { clientId: start }, selectionEnd: { clientId: end } }; case 'RESET_BLOCKS': const startClientId = state?.selectionStart?.clientId; const endClientId = state?.selectionEnd?.clientId; // Do nothing if there's no selected block. if (!startClientId && !endClientId) { return state; } // If the start of the selection won't exist after reset, remove selection. if (!action.blocks.some(block => block.clientId === startClientId)) { return { selectionStart: {}, selectionEnd: {} }; } // If the end of the selection won't exist after reset, collapse selection. if (!action.blocks.some(block => block.clientId === endClientId)) { return { ...state, selectionEnd: state.selectionStart }; } } const selectionStart = selectionHelper(state.selectionStart, action); const selectionEnd = selectionHelper(state.selectionEnd, action); if (selectionStart === state.selectionStart && selectionEnd === state.selectionEnd) { return state; } return { selectionStart, selectionEnd }; } /** * Reducer returning whether the user is multi-selecting. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function isMultiSelecting(state = false, action) { switch (action.type) { case 'START_MULTI_SELECT': return true; case 'STOP_MULTI_SELECT': return false; } return state; } /** * Reducer returning whether selection is enabled. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function isSelectionEnabled(state = true, action) { switch (action.type) { case 'TOGGLE_SELECTION': return action.isSelectionEnabled; } return state; } /** * Reducer returning the data needed to display a prompt when certain blocks * are removed, or `false` if no such prompt is requested. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {Object|false} Data for removal prompt display, if any. */ function removalPromptData(state = false, action) { switch (action.type) { case 'DISPLAY_BLOCK_REMOVAL_PROMPT': const { clientIds, selectPrevious, message } = action; return { clientIds, selectPrevious, message }; case 'CLEAR_BLOCK_REMOVAL_PROMPT': return false; } return state; } /** * Reducer returning any rules that a block editor may provide in order to * prevent a user from accidentally removing certain blocks. These rules are * then used to display a confirmation prompt to the user. For instance, in the * Site Editor, the Query Loop block is important enough to warrant such * confirmation. * * The data is a record whose keys are block types (e.g. 'core/query') and * whose values are the explanation to be shown to users (e.g. 'Query Loop * displays a list of posts or pages.'). * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {Record<string,string>} Updated state. */ function blockRemovalRules(state = false, action) { switch (action.type) { case 'SET_BLOCK_REMOVAL_RULES': return action.rules; } return state; } /** * Reducer returning the initial block selection. * * Currently this in only used to restore the selection after block deletion and * pasting new content.This reducer should eventually be removed in favour of setting * selection directly. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {number|null} Initial position: 0, -1 or null. */ function initialPosition(state = null, action) { if (action.type === 'REPLACE_BLOCKS' && action.initialPosition !== undefined) { return action.initialPosition; } else if (['MULTI_SELECT', 'SELECT_BLOCK', 'RESET_SELECTION', 'INSERT_BLOCKS', 'REPLACE_INNER_BLOCKS'].includes(action.type)) { return action.initialPosition; } return state; } function blocksMode(state = {}, action) { if (action.type === 'TOGGLE_BLOCK_MODE') { const { clientId } = action; return { ...state, [clientId]: state[clientId] && state[clientId] === 'html' ? 'visual' : 'html' }; } return state; } /** * Reducer returning the block insertion point visibility, either null if there * is not an explicit insertion point assigned, or an object of its `index` and * `rootClientId`. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function insertionCue(state = null, action) { switch (action.type) { case 'SHOW_INSERTION_POINT': { const { rootClientId, index, __unstableWithInserter, operation, nearestSide } = action; const nextState = { rootClientId, index, __unstableWithInserter, operation, nearestSide }; // Bail out updates if the states are the same. return es6_default()(state, nextState) ? state : nextState; } case 'HIDE_INSERTION_POINT': return null; } return state; } /** * Reducer returning whether the post blocks match the defined template or not. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function template(state = { isValid: true }, action) { switch (action.type) { case 'SET_TEMPLATE_VALIDITY': return { ...state, isValid: action.isValid }; } return state; } /** * Reducer returning the editor setting. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function settings(state = SETTINGS_DEFAULTS, action) { switch (action.type) { case 'UPDATE_SETTINGS': { const updatedSettings = action.reset ? { ...SETTINGS_DEFAULTS, ...action.settings } : { ...state, ...action.settings }; Object.defineProperty(updatedSettings, '__unstableIsPreviewMode', { get() { external_wp_deprecated_default()('__unstableIsPreviewMode', { since: '6.8', alternative: 'isPreviewMode' }); return this.isPreviewMode; } }); return updatedSettings; } } return state; } /** * Reducer returning the user preferences. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {string} Updated state. */ function preferences(state = PREFERENCES_DEFAULTS, action) { switch (action.type) { case 'INSERT_BLOCKS': case 'REPLACE_BLOCKS': { const nextInsertUsage = action.blocks.reduce((prevUsage, block) => { const { attributes, name: blockName } = block; let id = blockName; // If a block variation match is found change the name to be the same with the // one that is used for block variations in the Inserter (`getItemFromVariation`). const match = (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getActiveBlockVariation(blockName, attributes); if (match?.name) { id += '/' + match.name; } if (blockName === 'core/block') { id += '/' + attributes.ref; } return { ...prevUsage, [id]: { time: action.time, count: prevUsage[id] ? prevUsage[id].count + 1 : 1 } }; }, state.insertUsage); return { ...state, insertUsage: nextInsertUsage }; } } return state; } /** * Reducer returning an object where each key is a block client ID, its value * representing the settings for its nested blocks. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const blockListSettings = (state = {}, action) => { switch (action.type) { // Even if the replaced blocks have the same client ID, our logic // should correct the state. case 'REPLACE_BLOCKS': case 'REMOVE_BLOCKS': { return Object.fromEntries(Object.entries(state).filter(([id]) => !action.clientIds.includes(id))); } case 'UPDATE_BLOCK_LIST_SETTINGS': { const updates = typeof action.clientId === 'string' ? { [action.clientId]: action.settings } : action.clientId; // Remove settings that are the same as the current state. for (const clientId in updates) { if (!updates[clientId]) { if (!state[clientId]) { delete updates[clientId]; } } else if (es6_default()(state[clientId], updates[clientId])) { delete updates[clientId]; } } if (Object.keys(updates).length === 0) { return state; } const merged = { ...state, ...updates }; for (const clientId in updates) { if (!updates[clientId]) { delete merged[clientId]; } } return merged; } } return state; }; /** * Reducer return an updated state representing the most recent block attribute * update. The state is structured as an object where the keys represent the * client IDs of blocks, the values a subset of attributes from the most recent * block update. The state is always reset to null if the last action is * anything other than an attributes update. * * @param {Object<string,Object>} state Current state. * @param {Object} action Action object. * * @return {[string,Object]} Updated state. */ function lastBlockAttributesChange(state = null, action) { switch (action.type) { case 'UPDATE_BLOCK': if (!action.updates.attributes) { break; } return { [action.clientId]: action.updates.attributes }; case 'UPDATE_BLOCK_ATTRIBUTES': return action.clientIds.reduce((accumulator, id) => ({ ...accumulator, [id]: action.uniqueByBlock ? action.attributes[id] : action.attributes }), {}); } return state; } /** * Reducer returning current highlighted block. * * @param {boolean} state Current highlighted block. * @param {Object} action Dispatched action. * * @return {string} Updated state. */ function highlightedBlock(state, action) { switch (action.type) { case 'TOGGLE_BLOCK_HIGHLIGHT': const { clientId, isHighlighted } = action; if (isHighlighted) { return clientId; } else if (state === clientId) { return null; } return state; case 'SELECT_BLOCK': if (action.clientId !== state) { return null; } } return state; } /** * Reducer returning current expanded block in the list view. * * @param {string|null} state Current expanded block. * @param {Object} action Dispatched action. * * @return {string|null} Updated state. */ function expandedBlock(state = null, action) { switch (action.type) { case 'SET_BLOCK_EXPANDED_IN_LIST_VIEW': return action.clientId; case 'SELECT_BLOCK': if (action.clientId !== state) { return null; } } return state; } /** * Reducer returning the block insertion event list state. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function lastBlockInserted(state = {}, action) { switch (action.type) { case 'INSERT_BLOCKS': case 'REPLACE_BLOCKS': if (!action.blocks.length) { return state; } const clientIds = action.blocks.map(block => { return block.clientId; }); const source = action.meta?.source; return { clientIds, source }; case 'RESET_BLOCKS': return {}; } return state; } /** * Reducer returning the block that is eding temporarily edited as blocks. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function temporarilyEditingAsBlocks(state = '', action) { if (action.type === 'SET_TEMPORARILY_EDITING_AS_BLOCKS') { return action.temporarilyEditingAsBlocks; } return state; } /** * Reducer returning the focus mode that should be used when temporarily edit as blocks finishes. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function temporarilyEditingFocusModeRevert(state = '', action) { if (action.type === 'SET_TEMPORARILY_EDITING_AS_BLOCKS') { return action.focusModeToRevert; } return state; } /** * Reducer returning a map of block client IDs to block editing modes. * * @param {Map} state Current state. * @param {Object} action Dispatched action. * * @return {Map} Updated state. */ function blockEditingModes(state = new Map(), action) { switch (action.type) { case 'SET_BLOCK_EDITING_MODE': if (state.get(action.clientId) === action.mode) { return state; } return new Map(state).set(action.clientId, action.mode); case 'UNSET_BLOCK_EDITING_MODE': { if (!state.has(action.clientId)) { return state; } const newState = new Map(state); newState.delete(action.clientId); return newState; } case 'RESET_BLOCKS': { return state.has('') ? new Map().set('', state.get('')) : state; } } return state; } /** * Reducer returning the clientId of the block settings menu that is currently open. * * @param {string|null} state Current state. * @param {Object} action Dispatched action. * * @return {string|null} Updated state. */ function openedBlockSettingsMenu(state = null, action) { if ('SET_OPENED_BLOCK_SETTINGS_MENU' === action.type) { var _action$clientId; return (_action$clientId = action?.clientId) !== null && _action$clientId !== void 0 ? _action$clientId : null; } return state; } /** * Reducer returning a map of style IDs to style overrides. * * @param {Map} state Current state. * @param {Object} action Dispatched action. * * @return {Map} Updated state. */ function styleOverrides(state = new Map(), action) { switch (action.type) { case 'SET_STYLE_OVERRIDE': return new Map(state).set(action.id, action.style); case 'DELETE_STYLE_OVERRIDE': { const newState = new Map(state); newState.delete(action.id); return newState; } } return state; } /** * Reducer returning a map of the registered inserter media categories. * * @param {Array} state Current state. * @param {Object} action Dispatched action. * * @return {Array} Updated state. */ function registeredInserterMediaCategories(state = [], action) { switch (action.type) { case 'REGISTER_INSERTER_MEDIA_CATEGORY': return [...state, action.category]; } return state; } /** * Reducer setting last focused element * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function lastFocus(state = false, action) { switch (action.type) { case 'LAST_FOCUS': return action.lastFocus; } return state; } /** * Reducer setting currently hovered block. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function hoveredBlockClientId(state = false, action) { switch (action.type) { case 'HOVER_BLOCK': return action.clientId; } return state; } /** * Reducer setting zoom out state. * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {number} Updated state. */ function zoomLevel(state = 100, action) { switch (action.type) { case 'SET_ZOOM_LEVEL': return action.zoom; case 'RESET_ZOOM_LEVEL': return 100; } return state; } /** * Reducer setting the insertion point * * @param {boolean} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function insertionPoint(state = null, action) { switch (action.type) { case 'SET_INSERTION_POINT': return action.value; case 'SELECT_BLOCK': return null; } return state; } const combinedReducers = (0,external_wp_data_namespaceObject.combineReducers)({ blocks, isDragging, isTyping, isBlockInterfaceHidden, draggedBlocks, selection, isMultiSelecting, isSelectionEnabled, initialPosition, blocksMode, blockListSettings, insertionPoint, insertionCue, template, settings, preferences, lastBlockAttributesChange, lastFocus, expandedBlock, highlightedBlock, lastBlockInserted, temporarilyEditingAsBlocks, temporarilyEditingFocusModeRevert, blockVisibility, blockEditingModes, styleOverrides, removalPromptData, blockRemovalRules, openedBlockSettingsMenu, registeredInserterMediaCategories, hoveredBlockClientId, zoomLevel }); /** * Retrieves a block's tree structure, handling both controlled and uncontrolled inner blocks. * * @param {Object} state The current state object. * @param {string} clientId The client ID of the block to retrieve. * * @return {Object|undefined} The block tree object, or undefined if not found. For controlled blocks, * returns a merged tree with controlled inner blocks. */ function getBlockTreeBlock(state, clientId) { if (clientId === '') { const rootBlock = state.blocks.tree.get(clientId); if (!rootBlock) { return; } // Patch the root block to have a clientId property. // TODO - consider updating the blocks reducer so that the root block has this property. return { clientId: '', ...rootBlock }; } if (!state.blocks.controlledInnerBlocks[clientId]) { return state.blocks.tree.get(clientId); } const controlledTree = state.blocks.tree.get(`controlled||${clientId}`); const regularTree = state.blocks.tree.get(clientId); return { ...regularTree, innerBlocks: controlledTree?.innerBlocks }; } /** * Recursively traverses through a block tree of a given block and executes a callback for each block. * * @param {Object} state The store state. * @param {string} clientId The clientId of the block to start traversing from. * @param {Function} callback Function to execute for each block encountered during traversal. * The callback receives the current block as its argument. */ function traverseBlockTree(state, clientId, callback) { const tree = getBlockTreeBlock(state, clientId); if (!tree) { return; } callback(tree); if (!tree?.innerBlocks?.length) { return; } for (const innerBlock of tree?.innerBlocks) { traverseBlockTree(state, innerBlock.clientId, callback); } } /** * Checks if a block has a parent in a list of client IDs, and if so returns the client ID of the parent. * * @param {Object} state The current state object. * @param {string} clientId The client ID of the block to search the parents of. * @param {Array} clientIds The client IDs of the blocks to check. * * @return {string|undefined} The client ID of the parent block if found, undefined otherwise. */ function findParentInClientIdsList(state, clientId, clientIds) { if (!clientIds.length) { return; } let parent = state.blocks.parents.get(clientId); while (parent !== undefined) { if (clientIds.includes(parent)) { return parent; } parent = state.blocks.parents.get(parent); } } /** * Checks if a block has any bindings in its metadata attributes. * * @param {Object} block The block object to check for bindings. * @return {boolean} True if the block has bindings, false otherwise. */ function hasBindings(block) { return block?.attributes?.metadata?.bindings && Object.keys(block?.attributes?.metadata?.bindings).length; } /** * Computes and returns derived block editing modes for a given block tree. * * This function calculates the editing modes for each block in the tree, taking into account * various factors such as zoom level, navigation mode, sections, and synced patterns. * * @param {Object} state The current state object. * @param {boolean} isNavMode Whether the navigation mode is active. * @param {string} treeClientId The client ID of the root block for the tree. Defaults to an empty string. * @return {Map} A Map containing the derived block editing modes, keyed by block client ID. */ function getDerivedBlockEditingModesForTree(state, isNavMode = false, treeClientId = '') { const isZoomedOut = state?.zoomLevel < 100 || state?.zoomLevel === 'auto-scaled'; const derivedBlockEditingModes = new Map(); // When there are sections, the majority of blocks are disabled, // so the default block editing mode is set to disabled. const sectionRootClientId = state.settings?.[sectionRootClientIdKey]; const sectionClientIds = state.blocks.order.get(sectionRootClientId); const hasDisabledBlocks = Array.from(state.blockEditingModes).some(([, mode]) => mode === 'disabled'); const templatePartClientIds = []; const syncedPatternClientIds = []; Object.keys(state.blocks.controlledInnerBlocks).forEach(clientId => { const block = state.blocks.byClientId?.get(clientId); if (block?.name === 'core/template-part') { templatePartClientIds.push(clientId); } if (block?.name === 'core/block') { syncedPatternClientIds.push(clientId); } }); traverseBlockTree(state, treeClientId, block => { const { clientId, name: blockName } = block; // If the block already has an explicit block editing mode set, // don't override it. if (state.blockEditingModes.has(clientId)) { return; } // Disabled explicit block editing modes are inherited by children. // It's an expensive calculation, so only do it if there are disabled blocks. if (hasDisabledBlocks) { // Look through parents to find one with an explicit block editing mode. let ancestorBlockEditingMode; let parent = state.blocks.parents.get(clientId); while (parent !== undefined) { // There's a chance we only just calculated this for the parent, // if so we can return that value for a faster lookup. if (derivedBlockEditingModes.has(parent)) { ancestorBlockEditingMode = derivedBlockEditingModes.get(parent); } else if (state.blockEditingModes.has(parent)) { // Checking the explicit block editing mode will be slower, // as the block editing mode is more likely to be set on a // distant ancestor. ancestorBlockEditingMode = state.blockEditingModes.get(parent); } if (ancestorBlockEditingMode) { break; } parent = state.blocks.parents.get(parent); } // If the ancestor block editing mode is disabled, it's inherited by the child. if (ancestorBlockEditingMode === 'disabled') { derivedBlockEditingModes.set(clientId, 'disabled'); return; } } if (isZoomedOut || isNavMode) { // If the root block is the section root set its editing mode to contentOnly. if (clientId === sectionRootClientId) { derivedBlockEditingModes.set(clientId, 'contentOnly'); return; } // There are no sections, so everything else is disabled. if (!sectionClientIds?.length) { derivedBlockEditingModes.set(clientId, 'disabled'); return; } if (sectionClientIds.includes(clientId)) { derivedBlockEditingModes.set(clientId, 'contentOnly'); return; } // If zoomed out, all blocks that aren't sections or the section root are // disabled. if (isZoomedOut) { derivedBlockEditingModes.set(clientId, 'disabled'); return; } const isInSection = !!findParentInClientIdsList(state, clientId, sectionClientIds); if (!isInSection) { if (clientId === '') { derivedBlockEditingModes.set(clientId, 'disabled'); return; } // Allow selection of template parts outside of sections. if (blockName === 'core/template-part') { derivedBlockEditingModes.set(clientId, 'contentOnly'); return; } const isInTemplatePart = !!findParentInClientIdsList(state, clientId, templatePartClientIds); // Allow contentOnly blocks in template parts outside of sections // to be editable. Only disable blocks that don't fit this criteria. if (!isInTemplatePart && !isContentBlock(blockName)) { derivedBlockEditingModes.set(clientId, 'disabled'); return; } } // Handle synced pattern content so the inner blocks of a synced pattern are // properly disabled. if (syncedPatternClientIds.length) { const parentPatternClientId = findParentInClientIdsList(state, clientId, syncedPatternClientIds); if (parentPatternClientId) { // This is a pattern nested in another pattern, it should be disabled. if (findParentInClientIdsList(state, parentPatternClientId, syncedPatternClientIds)) { derivedBlockEditingModes.set(clientId, 'disabled'); return; } if (hasBindings(block)) { derivedBlockEditingModes.set(clientId, 'contentOnly'); return; } // Synced pattern content without a binding isn't editable // from the instance, the user has to edit the pattern source, // so return 'disabled'. derivedBlockEditingModes.set(clientId, 'disabled'); return; } } if (blockName && isContentBlock(blockName)) { derivedBlockEditingModes.set(clientId, 'contentOnly'); return; } derivedBlockEditingModes.set(clientId, 'disabled'); return; } if (syncedPatternClientIds.length) { // Synced pattern blocks (core/block). if (syncedPatternClientIds.includes(clientId)) { // This is a pattern nested in another pattern, it should be disabled. if (findParentInClientIdsList(state, clientId, syncedPatternClientIds)) { derivedBlockEditingModes.set(clientId, 'disabled'); return; } // Else do nothing, use the default block editing mode. return; } // Inner blocks of synced patterns. const parentPatternClientId = findParentInClientIdsList(state, clientId, syncedPatternClientIds); if (parentPatternClientId) { // This is a pattern nested in another pattern, it should be disabled. if (findParentInClientIdsList(state, parentPatternClientId, syncedPatternClientIds)) { derivedBlockEditingModes.set(clientId, 'disabled'); return; } if (hasBindings(block)) { derivedBlockEditingModes.set(clientId, 'contentOnly'); return; } // Synced pattern content without a binding isn't editable // from the instance, the user has to edit the pattern source, // so return 'disabled'. derivedBlockEditingModes.set(clientId, 'disabled'); } } }); return derivedBlockEditingModes; } /** * Updates the derived block editing modes based on added and removed blocks. * * This function handles the updating of block editing modes when blocks are added, * removed, or moved within the editor. * * It only returns a value when modifications are made to the block editing modes. * * @param {Object} options The options for updating derived block editing modes. * @param {Object} options.prevState The previous state object. * @param {Object} options.nextState The next state object. * @param {Array} [options.addedBlocks] An array of blocks that were added. * @param {Array} [options.removedClientIds] An array of client IDs of blocks that were removed. * @param {boolean} [options.isNavMode] Whether the navigation mode is active. * @return {Map|undefined} The updated derived block editing modes, or undefined if no changes were made. */ function getDerivedBlockEditingModesUpdates({ prevState, nextState, addedBlocks, removedClientIds, isNavMode = false }) { const prevDerivedBlockEditingModes = isNavMode ? prevState.derivedNavModeBlockEditingModes : prevState.derivedBlockEditingModes; let nextDerivedBlockEditingModes; // Perform removals before additions to handle cases like the `MOVE_BLOCKS_TO_POSITION` action. // That action removes a set of clientIds, but adds the same blocks back in a different location. // If removals were performed after additions, those moved clientIds would be removed incorrectly. removedClientIds?.forEach(clientId => { // The actions only receive parent block IDs for removal. // Recurse through the block tree to ensure all blocks are removed. // Specifically use the previous state, before the blocks were removed. traverseBlockTree(prevState, clientId, block => { if (prevDerivedBlockEditingModes.has(block.clientId)) { if (!nextDerivedBlockEditingModes) { nextDerivedBlockEditingModes = new Map(prevDerivedBlockEditingModes); } nextDerivedBlockEditingModes.delete(block.clientId); } }); }); addedBlocks?.forEach(addedBlock => { traverseBlockTree(nextState, addedBlock.clientId, block => { const updates = getDerivedBlockEditingModesForTree(nextState, isNavMode, block.clientId); if (updates.size) { if (!nextDerivedBlockEditingModes) { nextDerivedBlockEditingModes = new Map([...(prevDerivedBlockEditingModes?.size ? prevDerivedBlockEditingModes : []), ...updates]); } else { nextDerivedBlockEditingModes = new Map([...(nextDerivedBlockEditingModes?.size ? nextDerivedBlockEditingModes : []), ...updates]); } } }); }); return nextDerivedBlockEditingModes; } /** * Higher-order reducer that adds derived block editing modes to the state. * * This function wraps a reducer and enhances it to handle actions that affect * block editing modes. It updates the derivedBlockEditingModes in the state * based on various actions such as adding, removing, or moving blocks, or changing * the editor mode. * * @param {Function} reducer The original reducer function to be wrapped. * @return {Function} A new reducer function that includes derived block editing modes handling. */ function withDerivedBlockEditingModes(reducer) { return (state, action) => { var _state$derivedBlockEd, _state$derivedNavMode; const nextState = reducer(state, action); // An exception is needed here to still recompute the block editing modes when // the editor mode changes since the editor mode isn't stored within the // block editor state and changing it won't trigger an altered new state. if (action.type !== 'SET_EDITOR_MODE' && nextState === state) { return state; } switch (action.type) { case 'REMOVE_BLOCKS': { const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, removedClientIds: action.clientIds, isNavMode: false }); const nextDerivedNavModeBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, removedClientIds: action.clientIds, isNavMode: true }); if (nextDerivedBlockEditingModes || nextDerivedNavModeBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes !== null && nextDerivedBlockEditingModes !== void 0 ? nextDerivedBlockEditingModes : state.derivedBlockEditingModes, derivedNavModeBlockEditingModes: nextDerivedNavModeBlockEditingModes !== null && nextDerivedNavModeBlockEditingModes !== void 0 ? nextDerivedNavModeBlockEditingModes : state.derivedNavModeBlockEditingModes }; } break; } case 'RECEIVE_BLOCKS': case 'INSERT_BLOCKS': { const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks: action.blocks, isNavMode: false }); const nextDerivedNavModeBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks: action.blocks, isNavMode: true }); if (nextDerivedBlockEditingModes || nextDerivedNavModeBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes !== null && nextDerivedBlockEditingModes !== void 0 ? nextDerivedBlockEditingModes : state.derivedBlockEditingModes, derivedNavModeBlockEditingModes: nextDerivedNavModeBlockEditingModes !== null && nextDerivedNavModeBlockEditingModes !== void 0 ? nextDerivedNavModeBlockEditingModes : state.derivedNavModeBlockEditingModes }; } break; } case 'SET_BLOCK_EDITING_MODE': case 'UNSET_BLOCK_EDITING_MODE': case 'SET_HAS_CONTROLLED_INNER_BLOCKS': { const updatedBlock = getBlockTreeBlock(nextState, action.clientId); // The block might have been removed in which case it'll be // handled by the `REMOVE_BLOCKS` action. if (!updatedBlock) { break; } const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, removedClientIds: [action.clientId], addedBlocks: [updatedBlock], isNavMode: false }); const nextDerivedNavModeBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, removedClientIds: [action.clientId], addedBlocks: [updatedBlock], isNavMode: true }); if (nextDerivedBlockEditingModes || nextDerivedNavModeBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes !== null && nextDerivedBlockEditingModes !== void 0 ? nextDerivedBlockEditingModes : state.derivedBlockEditingModes, derivedNavModeBlockEditingModes: nextDerivedNavModeBlockEditingModes !== null && nextDerivedNavModeBlockEditingModes !== void 0 ? nextDerivedNavModeBlockEditingModes : state.derivedNavModeBlockEditingModes }; } break; } case 'REPLACE_BLOCKS': { const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks: action.blocks, removedClientIds: action.clientIds, isNavMode: false }); const nextDerivedNavModeBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks: action.blocks, removedClientIds: action.clientIds, isNavMode: true }); if (nextDerivedBlockEditingModes || nextDerivedNavModeBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes !== null && nextDerivedBlockEditingModes !== void 0 ? nextDerivedBlockEditingModes : state.derivedBlockEditingModes, derivedNavModeBlockEditingModes: nextDerivedNavModeBlockEditingModes !== null && nextDerivedNavModeBlockEditingModes !== void 0 ? nextDerivedNavModeBlockEditingModes : state.derivedNavModeBlockEditingModes }; } break; } case 'REPLACE_INNER_BLOCKS': { // Get the clientIds of the blocks that are being replaced // from the old state, before they were removed. const removedClientIds = state.blocks.order.get(action.rootClientId); const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks: action.blocks, removedClientIds, isNavMode: false }); const nextDerivedNavModeBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks: action.blocks, removedClientIds, isNavMode: true }); if (nextDerivedBlockEditingModes || nextDerivedNavModeBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes !== null && nextDerivedBlockEditingModes !== void 0 ? nextDerivedBlockEditingModes : state.derivedBlockEditingModes, derivedNavModeBlockEditingModes: nextDerivedNavModeBlockEditingModes !== null && nextDerivedNavModeBlockEditingModes !== void 0 ? nextDerivedNavModeBlockEditingModes : state.derivedNavModeBlockEditingModes }; } break; } case 'MOVE_BLOCKS_TO_POSITION': { const addedBlocks = action.clientIds.map(clientId => { return nextState.blocks.byClientId.get(clientId); }); const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks, removedClientIds: action.clientIds, isNavMode: false }); const nextDerivedNavModeBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks, removedClientIds: action.clientIds, isNavMode: true }); if (nextDerivedBlockEditingModes || nextDerivedNavModeBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes !== null && nextDerivedBlockEditingModes !== void 0 ? nextDerivedBlockEditingModes : state.derivedBlockEditingModes, derivedNavModeBlockEditingModes: nextDerivedNavModeBlockEditingModes !== null && nextDerivedNavModeBlockEditingModes !== void 0 ? nextDerivedNavModeBlockEditingModes : state.derivedNavModeBlockEditingModes }; } break; } case 'UPDATE_SETTINGS': { // Recompute the entire tree if the section root changes. if (state?.settings?.[sectionRootClientIdKey] !== nextState?.settings?.[sectionRootClientIdKey]) { return { ...nextState, derivedBlockEditingModes: getDerivedBlockEditingModesForTree(nextState, false /* Nav mode off */), derivedNavModeBlockEditingModes: getDerivedBlockEditingModesForTree(nextState, true /* Nav mode on */) }; } break; } case 'RESET_BLOCKS': case 'SET_EDITOR_MODE': case 'RESET_ZOOM_LEVEL': case 'SET_ZOOM_LEVEL': { // Recompute the entire tree if the editor mode or zoom level changes, // or if all the blocks are reset. return { ...nextState, derivedBlockEditingModes: getDerivedBlockEditingModesForTree(nextState, false /* Nav mode off */), derivedNavModeBlockEditingModes: getDerivedBlockEditingModesForTree(nextState, true /* Nav mode on */) }; } } // If there's no change, the derivedBlockEditingModes from the previous // state need to be preserved. nextState.derivedBlockEditingModes = (_state$derivedBlockEd = state?.derivedBlockEditingModes) !== null && _state$derivedBlockEd !== void 0 ? _state$derivedBlockEd : new Map(); nextState.derivedNavModeBlockEditingModes = (_state$derivedNavMode = state?.derivedNavModeBlockEditingModes) !== null && _state$derivedNavMode !== void 0 ? _state$derivedNavMode : new Map(); return nextState; }; } function withAutomaticChangeReset(reducer) { return (state, action) => { const nextState = reducer(state, action); if (!state) { return nextState; } // Take over the last value without creating a new reference. nextState.automaticChangeStatus = state.automaticChangeStatus; if (action.type === 'MARK_AUTOMATIC_CHANGE') { return { ...nextState, automaticChangeStatus: 'pending' }; } if (action.type === 'MARK_AUTOMATIC_CHANGE_FINAL' && state.automaticChangeStatus === 'pending') { return { ...nextState, automaticChangeStatus: 'final' }; } // If there's a change that doesn't affect blocks or selection, maintain // the current status. if (nextState.blocks === state.blocks && nextState.selection === state.selection) { return nextState; } // As long as the state is not final, ignore any selection changes. if (nextState.automaticChangeStatus !== 'final' && nextState.selection !== state.selection) { return nextState; } // Reset the status if blocks change or selection changes (when status is final). return { ...nextState, automaticChangeStatus: undefined }; }; } /* harmony default export */ const reducer = ((0,external_wp_compose_namespaceObject.pipe)(withDerivedBlockEditingModes, withAutomaticChangeReset)(combinedReducers)); ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js /** * WordPress dependencies */ const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); /* harmony default export */ const library_symbol = (symbol); ;// external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// external ["wp","preferences"] const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// external ["wp","blockSerializationDefaultParser"] const external_wp_blockSerializationDefaultParser_namespaceObject = window["wp"]["blockSerializationDefaultParser"]; ;// ./node_modules/@wordpress/block-editor/build-module/store/constants.js const STORE_NAME = 'core/block-editor'; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/utils.js /** * WordPress dependencies */ const INSERTER_PATTERN_TYPES = { user: 'user', theme: 'theme', directory: 'directory' }; const INSERTER_SYNC_TYPES = { full: 'fully', unsynced: 'unsynced' }; const allPatternsCategory = { name: 'allPatterns', label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns') }; const myPatternsCategory = { name: 'myPatterns', label: (0,external_wp_i18n_namespaceObject.__)('My patterns') }; const starterPatternsCategory = { name: 'core/starter-content', label: (0,external_wp_i18n_namespaceObject.__)('Starter content') }; function isPatternFiltered(pattern, sourceFilter, syncFilter) { const isUserPattern = pattern.name.startsWith('core/block'); const isDirectoryPattern = pattern.source === 'core' || pattern.source?.startsWith('pattern-directory'); // If theme source selected, filter out user created patterns and those from // the core patterns directory. if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) { return true; } // If the directory source is selected, filter out user created patterns // and those bundled with the theme. if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) { return true; } // If user source selected, filter out theme patterns. if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) { return true; } // Filter by sync status. if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== '') { return true; } if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== 'unsynced' && isUserPattern) { return true; } return false; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/object.js /** * Immutably sets a value inside an object. Like `lodash#set`, but returning a * new object. Treats nullish initial values as empty objects. Clones any * nested objects. Supports arrays, too. * * @param {Object} object Object to set a value in. * @param {number|string|Array} path Path in the object to modify. * @param {*} value New value to set. * @return {Object} Cloned object with the new value set. */ function setImmutably(object, path, value) { // Normalize path path = Array.isArray(path) ? [...path] : [path]; // Shallowly clone the base of the object object = Array.isArray(object) ? [...object] : { ...object }; const leaf = path.pop(); // Traverse object from root to leaf, shallowly cloning at each level let prev = object; for (const key of path) { const lvl = prev[key]; prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl }; } prev[leaf] = value; return object; } /** * Helper util to return a value from a certain path of the object. * Path is specified as either: * - a string of properties, separated by dots, for example: "x.y". * - an array of properties, for example `[ 'x', 'y' ]`. * You can also specify a default value in case the result is nullish. * * @param {Object} object Input object. * @param {string|Array} path Path to the object property. * @param {*} defaultValue Default value if the value at the specified path is nullish. * @return {*} Value of the object property at the specified path. */ const getValueFromObjectPath = (object, path, defaultValue) => { var _value; const arrayPath = Array.isArray(path) ? path : path.split('.'); let value = object; arrayPath.forEach(fieldName => { value = value?.[fieldName]; }); return (_value = value) !== null && _value !== void 0 ? _value : defaultValue; }; /** * Helper util to filter out objects with duplicate values for a given property. * * @param {Object[]} array Array of objects to filter. * @param {string} property Property to filter unique values by. * * @return {Object[]} Array of objects with unique values for the specified property. */ function uniqByProperty(array, property) { const seen = new Set(); return array.filter(item => { const value = item[property]; return seen.has(value) ? false : seen.add(value); }); } ;// ./node_modules/@wordpress/block-editor/build-module/store/get-block-settings.js /** * WordPress dependencies */ /** * Internal dependencies */ const blockedPaths = ['color', 'border', 'dimensions', 'typography', 'spacing']; const deprecatedFlags = { 'color.palette': settings => settings.colors, 'color.gradients': settings => settings.gradients, 'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors, 'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients, 'typography.fontSizes': settings => settings.fontSizes, 'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes, 'typography.lineHeight': settings => settings.enableCustomLineHeight, 'spacing.units': settings => { if (settings.enableCustomUnits === undefined) { return; } if (settings.enableCustomUnits === true) { return ['px', 'em', 'rem', 'vh', 'vw', '%']; } return settings.enableCustomUnits; }, 'spacing.padding': settings => settings.enableCustomSpacing }; const prefixedFlags = { /* * These were only available in the plugin * and can be removed when the minimum WordPress version * for the plugin is 5.9. */ 'border.customColor': 'border.color', 'border.customStyle': 'border.style', 'border.customWidth': 'border.width', 'typography.customFontStyle': 'typography.fontStyle', 'typography.customFontWeight': 'typography.fontWeight', 'typography.customLetterSpacing': 'typography.letterSpacing', 'typography.customTextDecorations': 'typography.textDecoration', 'typography.customTextTransforms': 'typography.textTransform', /* * These were part of WordPress 5.8 and we need to keep them. */ 'border.customRadius': 'border.radius', 'spacing.customMargin': 'spacing.margin', 'spacing.customPadding': 'spacing.padding', 'typography.customLineHeight': 'typography.lineHeight' }; /** * Remove `custom` prefixes for flags that did not land in 5.8. * * This provides continued support for `custom` prefixed properties. It will * be removed once third party devs have had sufficient time to update themes, * plugins, etc. * * @see https://github.com/WordPress/gutenberg/pull/34485 * * @param {string} path Path to desired value in settings. * @return {string} The value for defined setting. */ const removeCustomPrefixes = path => { return prefixedFlags[path] || path; }; function getBlockSettings(state, clientId, ...paths) { const blockName = getBlockName(state, clientId); const candidates = []; if (clientId) { let id = clientId; do { const name = getBlockName(state, id); if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, '__experimentalSettings', false)) { candidates.push(id); } } while (id = state.blocks.parents.get(id)); } return paths.map(path => { if (blockedPaths.includes(path)) { // eslint-disable-next-line no-console console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.'); return undefined; } // 0. Allow third parties to filter the block's settings at runtime. let result = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.useSetting.before', undefined, path, clientId, blockName); if (undefined !== result) { return result; } const normalizedPath = removeCustomPrefixes(path); // 1. Take settings from the block instance or its ancestors. // Start from the current block and work our way up the ancestors. for (const candidateClientId of candidates) { var _getValueFromObjectPa; const candidateAtts = getBlockAttributes(state, candidateClientId); result = (_getValueFromObjectPa = getValueFromObjectPath(candidateAtts.settings?.blocks?.[blockName], normalizedPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(candidateAtts.settings, normalizedPath); if (result !== undefined) { // Stop the search for more distant ancestors and move on. break; } } // 2. Fall back to the settings from the block editor store (__experimentalFeatures). const settings = getSettings(state); if (result === undefined && blockName) { result = getValueFromObjectPath(settings.__experimentalFeatures?.blocks?.[blockName], normalizedPath); } if (result === undefined) { result = getValueFromObjectPath(settings.__experimentalFeatures, normalizedPath); } // Return if the setting was found in either the block instance or the store. if (result !== undefined) { if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[normalizedPath]) { var _ref, _result$custom; return (_ref = (_result$custom = result.custom) !== null && _result$custom !== void 0 ? _result$custom : result.theme) !== null && _ref !== void 0 ? _ref : result.default; } return result; } // 3. Otherwise, use deprecated settings. const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings); if (deprecatedSettingsValue !== undefined) { return deprecatedSettingsValue; } // 4. Fallback for typography.dropCap: // This is only necessary to support typography.dropCap. // when __experimentalFeatures are not present (core without plugin). // To remove when __experimentalFeatures are ported to core. return normalizedPath === 'typography.dropCap' ? true : undefined; }); } ;// ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns true if the block interface is hidden, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the block toolbar is hidden. */ function private_selectors_isBlockInterfaceHidden(state) { return state.isBlockInterfaceHidden; } /** * Gets the client ids of the last inserted blocks. * * @param {Object} state Global application state. * @return {Array|undefined} Client Ids of the last inserted block(s). */ function getLastInsertedBlocksClientIds(state) { return state?.lastBlockInserted?.clientIds; } function getBlockWithoutAttributes(state, clientId) { return state.blocks.byClientId.get(clientId); } /** * Returns true if all of the descendants of a block with the given client ID * have an editing mode of 'disabled', or false otherwise. * * @param {Object} state Global application state. * @param {string} clientId The block client ID. * * @return {boolean} Whether the block descendants are disabled. */ const isBlockSubtreeDisabled = (state, clientId) => { const isChildSubtreeDisabled = childClientId => { return getBlockEditingMode(state, childClientId) === 'disabled' && getBlockOrder(state, childClientId).every(isChildSubtreeDisabled); }; return getBlockOrder(state, clientId).every(isChildSubtreeDisabled); }; function getEnabledClientIdsTreeUnmemoized(state, rootClientId) { const blockOrder = getBlockOrder(state, rootClientId); const result = []; for (const clientId of blockOrder) { const innerBlocks = getEnabledClientIdsTreeUnmemoized(state, clientId); if (getBlockEditingMode(state, clientId) !== 'disabled') { result.push({ clientId, innerBlocks }); } else { result.push(...innerBlocks); } } return result; } /** * Returns a tree of block objects with only clientID and innerBlocks set. * Blocks with a 'disabled' editing mode are not included. * * @param {Object} state Global application state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {Object[]} Tree of block objects with only clientID and innerBlocks set. */ const getEnabledClientIdsTree = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(getEnabledClientIdsTreeUnmemoized, state => [state.blocks.order, state.derivedBlockEditingModes, state.derivedNavModeBlockEditingModes, state.blockEditingModes, state.settings.templateLock, state.blockListSettings, select(STORE_NAME).__unstableGetEditorMode(state)])); /** * Returns a list of a given block's ancestors, from top to bottom. Blocks with * a 'disabled' editing mode are excluded. * * @see getBlockParents * * @param {Object} state Global application state. * @param {string} clientId The block client ID. * @param {boolean} ascending Order results from bottom to top (true) or top * to bottom (false). */ const getEnabledBlockParents = (0,external_wp_data_namespaceObject.createSelector)((state, clientId, ascending = false) => { return getBlockParents(state, clientId, ascending).filter(parent => getBlockEditingMode(state, parent) !== 'disabled'); }, state => [state.blocks.parents, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]); /** * Selector that returns the data needed to display a prompt when certain * blocks are removed, or `false` if no such prompt is requested. * * @param {Object} state Global application state. * * @return {Object|false} Data for removal prompt display, if any. */ function getRemovalPromptData(state) { return state.removalPromptData; } /** * Returns true if removal prompt exists, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether removal prompt exists. */ function getBlockRemovalRules(state) { return state.blockRemovalRules; } /** * Returns the client ID of the block settings menu that is currently open. * * @param {Object} state Global application state. * @return {string|null} The client ID of the block menu that is currently open. */ function getOpenedBlockSettingsMenu(state) { return state.openedBlockSettingsMenu; } /** * Returns all style overrides, intended to be merged with global editor styles. * * Overrides are sorted to match the order of the blocks they relate to. This * is useful to maintain correct CSS cascade order. * * @param {Object} state Global application state. * * @return {Array} An array of style ID to style override pairs. */ const getStyleOverrides = (0,external_wp_data_namespaceObject.createSelector)(state => { const clientIds = getClientIdsWithDescendants(state); const clientIdMap = clientIds.reduce((acc, clientId, index) => { acc[clientId] = index; return acc; }, {}); return [...state.styleOverrides].sort((overrideA, overrideB) => { var _clientIdMap$clientId, _clientIdMap$clientId2; // Once the overrides Map is spread to an array, the first element // is the key, while the second is the override itself including // the clientId to sort by. const [, { clientId: clientIdA }] = overrideA; const [, { clientId: clientIdB }] = overrideB; const aIndex = (_clientIdMap$clientId = clientIdMap[clientIdA]) !== null && _clientIdMap$clientId !== void 0 ? _clientIdMap$clientId : -1; const bIndex = (_clientIdMap$clientId2 = clientIdMap[clientIdB]) !== null && _clientIdMap$clientId2 !== void 0 ? _clientIdMap$clientId2 : -1; return aIndex - bIndex; }); }, state => [state.blocks.order, state.styleOverrides]); /** @typedef {import('./actions').InserterMediaCategory} InserterMediaCategory */ /** * Returns the registered inserter media categories through the public API. * * @param {Object} state Editor state. * * @return {InserterMediaCategory[]} Inserter media categories. */ function getRegisteredInserterMediaCategories(state) { return state.registeredInserterMediaCategories; } /** * Returns an array containing the allowed inserter media categories. * It merges the registered media categories from extenders with the * core ones. It also takes into account the allowed `mime_types`, which * can be altered by `upload_mimes` filter and restrict some of them. * * @param {Object} state Global application state. * * @return {InserterMediaCategory[]} Client IDs of descendants. */ const getInserterMediaCategories = (0,external_wp_data_namespaceObject.createSelector)(state => { const { settings: { inserterMediaCategories, allowedMimeTypes, enableOpenverseMediaCategory }, registeredInserterMediaCategories } = state; // The allowed `mime_types` can be altered by `upload_mimes` filter and restrict // some of them. In this case we shouldn't add the category to the available media // categories list in the inserter. if (!inserterMediaCategories && !registeredInserterMediaCategories.length || !allowedMimeTypes) { return; } const coreInserterMediaCategoriesNames = inserterMediaCategories?.map(({ name }) => name) || []; const mergedCategories = [...(inserterMediaCategories || []), ...(registeredInserterMediaCategories || []).filter(({ name }) => !coreInserterMediaCategoriesNames.includes(name))]; return mergedCategories.filter(category => { // Check if Openverse category is enabled. if (!enableOpenverseMediaCategory && category.name === 'openverse') { return false; } return Object.values(allowedMimeTypes).some(mimeType => mimeType.startsWith(`${category.mediaType}/`)); }); }, state => [state.settings.inserterMediaCategories, state.settings.allowedMimeTypes, state.settings.enableOpenverseMediaCategory, state.registeredInserterMediaCategories]); /** * Returns whether there is at least one allowed pattern for inner blocks children. * This is useful for deferring the parsing of all patterns until needed. * * @param {Object} state Editor state. * @param {string} [rootClientId=null] Target root client ID. * * @return {boolean} If there is at least one allowed pattern. */ const hasAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => { const { getAllPatterns } = unlock(select(STORE_NAME)); const patterns = getAllPatterns(); const { allowedBlockTypes } = getSettings(state); return patterns.some(pattern => { const { inserter = true } = pattern; if (!inserter) { return false; } const grammar = getGrammar(pattern); return checkAllowListRecursive(grammar, allowedBlockTypes) && grammar.every(({ name: blockName }) => canInsertBlockType(state, blockName, rootClientId)); }); }, (state, rootClientId) => [...getAllPatternsDependants(select)(state), ...getInsertBlockTypeDependants(select)(state, rootClientId)])); function mapUserPattern(userPattern, __experimentalUserPatternCategories = []) { return { name: `core/block/${userPattern.id}`, id: userPattern.id, type: INSERTER_PATTERN_TYPES.user, title: userPattern.title.raw, categories: userPattern.wp_pattern_category?.map(catId => { const category = __experimentalUserPatternCategories.find(({ id }) => id === catId); return category ? category.slug : catId; }), content: userPattern.content.raw, syncStatus: userPattern.wp_pattern_sync_status }; } const getPatternBySlug = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, patternName) => { var _state$settings$__exp, _state$settings$selec; // Only fetch reusable blocks if we know we need them. To do: maybe // use the entity record API to retrieve the block by slug. if (patternName?.startsWith('core/block/')) { const _id = parseInt(patternName.slice('core/block/'.length), 10); const block = unlock(select(STORE_NAME)).getReusableBlocks().find(({ id }) => id === _id); if (!block) { return null; } return mapUserPattern(block, state.settings.__experimentalUserPatternCategories); } return [ // This setting is left for back compat. ...((_state$settings$__exp = state.settings.__experimentalBlockPatterns) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : []), ...((_state$settings$selec = state.settings[selectBlockPatternsKey]?.(select)) !== null && _state$settings$selec !== void 0 ? _state$settings$selec : [])].find(({ name }) => name === patternName); }, (state, patternName) => patternName?.startsWith('core/block/') ? [unlock(select(STORE_NAME)).getReusableBlocks(), state.settings.__experimentalReusableBlocks] : [state.settings.__experimentalBlockPatterns, state.settings[selectBlockPatternsKey]?.(select)])); const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { var _state$settings$__exp2, _state$settings$selec2; return [...unlock(select(STORE_NAME)).getReusableBlocks().map(userPattern => mapUserPattern(userPattern, state.settings.__experimentalUserPatternCategories)), // This setting is left for back compat. ...((_state$settings$__exp2 = state.settings.__experimentalBlockPatterns) !== null && _state$settings$__exp2 !== void 0 ? _state$settings$__exp2 : []), ...((_state$settings$selec2 = state.settings[selectBlockPatternsKey]?.(select)) !== null && _state$settings$selec2 !== void 0 ? _state$settings$selec2 : [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)); }, getAllPatternsDependants(select))); const EMPTY_ARRAY = []; const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { var _ref; const reusableBlocksSelect = state.settings[reusableBlocksSelectKey]; return (_ref = reusableBlocksSelect ? reusableBlocksSelect(select) : state.settings.__experimentalReusableBlocks) !== null && _ref !== void 0 ? _ref : EMPTY_ARRAY; }); /** * Returns the element of the last element that had focus when focus left the editor canvas. * * @param {Object} state Block editor state. * * @return {Object} Element. */ function getLastFocus(state) { return state.lastFocus; } /** * Returns true if the user is dragging anything, or false otherwise. It is possible for a * user to be dragging data from outside of the editor, so this selector is separate from * the `isDraggingBlocks` selector which only returns true if the user is dragging blocks. * * @param {Object} state Global application state. * * @return {boolean} Whether user is dragging. */ function private_selectors_isDragging(state) { return state.isDragging; } /** * Retrieves the expanded block from the state. * * @param {Object} state Block editor state. * * @return {string|null} The client ID of the expanded block, if set. */ function getExpandedBlock(state) { return state.expandedBlock; } /** * Retrieves the client ID of the ancestor block that is content locking the block * with the provided client ID. * * @param {Object} state Global application state. * @param {string} clientId Client Id of the block. * * @return {?string} Client ID of the ancestor block that is content locking the block. */ const getContentLockingParent = (state, clientId) => { let current = clientId; let result; while (!result && (current = state.blocks.parents.get(current))) { if (getTemplateLock(state, current) === 'contentOnly') { result = current; } } return result; }; /** * Retrieves the client ID of the parent section block. * * @param {Object} state Global application state. * @param {string} clientId Client Id of the block. * * @return {?string} Client ID of the ancestor block that is content locking the block. */ const getParentSectionBlock = (state, clientId) => { let current = clientId; let result; while (!result && (current = state.blocks.parents.get(current))) { if (isSectionBlock(state, current)) { result = current; } } return result; }; /** * Retrieves the client ID is a content locking parent * * @param {Object} state Global application state. * @param {string} clientId Client Id of the block. * * @return {boolean} Whether the block is a content locking parent. */ function isSectionBlock(state, clientId) { const blockName = getBlockName(state, clientId); if (blockName === 'core/block' || getTemplateLock(state, clientId) === 'contentOnly') { return true; } // Template parts become sections in navigation mode. const _isNavigationMode = isNavigationMode(state); if (_isNavigationMode && blockName === 'core/template-part') { return true; } const sectionRootClientId = getSectionRootClientId(state); const sectionClientIds = getBlockOrder(state, sectionRootClientId); return _isNavigationMode && sectionClientIds.includes(clientId); } /** * Retrieves the client ID of the block that is content locked but is * currently being temporarily edited as a non-locked block. * * @param {Object} state Global application state. * * @return {?string} The client ID of the block being temporarily edited as a non-locked block. */ function getTemporarilyEditingAsBlocks(state) { return state.temporarilyEditingAsBlocks; } /** * Returns the focus mode that should be reapplied when the user stops editing * a content locked blocks as a block without locking. * * @param {Object} state Global application state. * * @return {?string} The focus mode that should be re-set when temporarily editing as blocks stops. */ function getTemporarilyEditingFocusModeToRevert(state) { return state.temporarilyEditingFocusModeRevert; } /** * Returns the style attributes of multiple blocks. * * @param {Object} state Global application state. * @param {string[]} clientIds An array of block client IDs. * * @return {Object} An object where keys are client IDs and values are the corresponding block styles or undefined. */ const getBlockStyles = (0,external_wp_data_namespaceObject.createSelector)((state, clientIds) => clientIds.reduce((styles, clientId) => { styles[clientId] = state.blocks.attributes.get(clientId)?.style; return styles; }, {}), (state, clientIds) => [...clientIds.map(clientId => state.blocks.attributes.get(clientId)?.style)]); /** * Retrieves the client ID of the block which contains the blocks * acting as "sections" in the editor. This is typically the "main content" * of the template/post. * * @param {Object} state Editor state. * * @return {string|undefined} The section root client ID or undefined if not set. */ function getSectionRootClientId(state) { return state.settings?.[sectionRootClientIdKey]; } /** * Returns whether the editor is considered zoomed out. * * @param {Object} state Global application state. * @return {boolean} Whether the editor is zoomed. */ function isZoomOut(state) { return state.zoomLevel === 'auto-scaled' || state.zoomLevel < 100; } /** * Returns whether the zoom level. * * @param {Object} state Global application state. * @return {number|"auto-scaled"} Zoom level. */ function getZoomLevel(state) { return state.zoomLevel; } /** * Finds the closest block where the block is allowed to be inserted. * * @param {Object} state Editor state. * @param {string[] | string} name Block name or names. * @param {string} clientId Default insertion point. * * @return {string} clientID of the closest container when the block name can be inserted. */ function getClosestAllowedInsertionPoint(state, name, clientId = '') { const blockNames = Array.isArray(name) ? name : [name]; const areBlockNamesAllowedInClientId = id => blockNames.every(currentName => canInsertBlockType(state, currentName, id)); // If we're trying to insert at the root level and it's not allowed // Try the section root instead. if (!clientId) { if (areBlockNamesAllowedInClientId(clientId)) { return clientId; } const sectionRootClientId = getSectionRootClientId(state); if (sectionRootClientId && areBlockNamesAllowedInClientId(sectionRootClientId)) { return sectionRootClientId; } return null; } // Traverse the block tree up until we find a place where we can insert. let current = clientId; while (current !== null && !areBlockNamesAllowedInClientId(current)) { const parentClientId = getBlockRootClientId(state, current); current = parentClientId; } return current; } function getClosestAllowedInsertionPointForPattern(state, pattern, clientId) { const { allowedBlockTypes } = getSettings(state); const isAllowed = checkAllowListRecursive(getGrammar(pattern), allowedBlockTypes); if (!isAllowed) { return null; } const names = getGrammar(pattern).map(({ blockName: name }) => name); return getClosestAllowedInsertionPoint(state, names, clientId); } /** * Where the point where the next block will be inserted into. * * @param {Object} state * @return {Object} where the insertion point in the block editor is or null if none is set. */ function getInsertionPoint(state) { return state.insertionPoint; } ;// ./node_modules/@wordpress/block-editor/build-module/store/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ const isFiltered = Symbol('isFiltered'); const parsedPatternCache = new WeakMap(); const grammarMapCache = new WeakMap(); function parsePattern(pattern) { const blocks = (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { __unstableSkipMigrationLogs: true }); if (blocks.length === 1) { blocks[0].attributes = { ...blocks[0].attributes, metadata: { ...(blocks[0].attributes.metadata || {}), categories: pattern.categories, patternName: pattern.name, name: blocks[0].attributes.metadata?.name || pattern.title } }; } return { ...pattern, blocks }; } function getParsedPattern(pattern) { let parsedPattern = parsedPatternCache.get(pattern); if (!parsedPattern) { parsedPattern = parsePattern(pattern); parsedPatternCache.set(pattern, parsedPattern); } return parsedPattern; } function getGrammar(pattern) { let grammarMap = grammarMapCache.get(pattern); if (!grammarMap) { grammarMap = (0,external_wp_blockSerializationDefaultParser_namespaceObject.parse)(pattern.content); // Block names are null only at the top level for whitespace. grammarMap = grammarMap.filter(block => block.blockName !== null); grammarMapCache.set(pattern, grammarMap); } return grammarMap; } const checkAllowList = (list, item, defaultResult = null) => { if (typeof list === 'boolean') { return list; } if (Array.isArray(list)) { // TODO: when there is a canonical way to detect that we are editing a post // the following check should be changed to something like: // if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null ) if (list.includes('core/post-content') && item === null) { return true; } return list.includes(item); } return defaultResult; }; const checkAllowListRecursive = (blocks, allowedBlockTypes) => { if (typeof allowedBlockTypes === 'boolean') { return allowedBlockTypes; } const blocksQueue = [...blocks]; while (blocksQueue.length > 0) { const block = blocksQueue.shift(); const isAllowed = checkAllowList(allowedBlockTypes, block.name || block.blockName, true); if (!isAllowed) { return false; } block.innerBlocks?.forEach(innerBlock => { blocksQueue.push(innerBlock); }); } return true; }; const getAllPatternsDependants = select => state => { return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns, unlock(select(STORE_NAME)).getReusableBlocks()]; }; const getInsertBlockTypeDependants = select => (state, rootClientId) => { return [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockEditingModes, select(STORE_NAME).__unstableGetEditorMode(state), getSectionRootClientId(state)]; }; ;// ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js /** * Recursive stable sorting comparator function. * * @param {string|Function} field Field to sort by. * @param {Array} items Items to sort. * @param {string} order Order, 'asc' or 'desc'. * @return {Function} Comparison function to be used in a `.sort()`. */ const comparator = (field, items, order) => { return (a, b) => { let cmpA, cmpB; if (typeof field === 'function') { cmpA = field(a); cmpB = field(b); } else { cmpA = a[field]; cmpB = b[field]; } if (cmpA > cmpB) { return order === 'asc' ? 1 : -1; } else if (cmpB > cmpA) { return order === 'asc' ? -1 : 1; } const orderA = items.findIndex(item => item === a); const orderB = items.findIndex(item => item === b); // Stable sort: maintaining original array order if (orderA > orderB) { return 1; } else if (orderB > orderA) { return -1; } return 0; }; }; /** * Order items by a certain key. * Supports decorator functions that allow complex picking of a comparison field. * Sorts in ascending order by default, but supports descending as well. * Stable sort - maintains original order of equal items. * * @param {Array} items Items to order. * @param {string|Function} field Field to order by. * @param {string} order Sorting order, `asc` or `desc`. * @return {Array} Sorted items. */ function orderBy(items, field, order = 'asc') { return items.concat().sort(comparator(field, items, order)); } ;// ./node_modules/@wordpress/block-editor/build-module/store/selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A block selection object. * * @typedef {Object} WPBlockSelection * * @property {string} clientId A block client ID. * @property {string} attributeKey A block attribute key. * @property {number} offset An attribute value offset, based on the rich * text value. See `wp.richText.create`. */ // Module constants. const MILLISECONDS_PER_HOUR = 3600 * 1000; const MILLISECONDS_PER_DAY = 24 * 3600 * 1000; const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000; /** * Shared reference to an empty array for cases where it is important to avoid * returning a new array reference on every invocation, as in a connected or * other pure component which performs `shouldComponentUpdate` check on props. * This should be used as a last resort, since the normalized data should be * maintained by the reducer result in state. * * @type {Array} */ const selectors_EMPTY_ARRAY = []; /** * Shared reference to an empty Set for cases where it is important to avoid * returning a new Set reference on every invocation, as in a connected or * other pure component which performs `shouldComponentUpdate` check on props. * This should be used as a last resort, since the normalized data should be * maintained by the reducer result in state. * * @type {Set} */ const EMPTY_SET = new Set(); const DEFAULT_INSERTER_OPTIONS = { [isFiltered]: true }; /** * Returns a block's name given its client ID, or null if no block exists with * the client ID. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {string} Block name. */ function getBlockName(state, clientId) { const block = state.blocks.byClientId.get(clientId); const socialLinkName = 'core/social-link'; if (external_wp_element_namespaceObject.Platform.OS !== 'web' && block?.name === socialLinkName) { const attributes = state.blocks.attributes.get(clientId); const { service } = attributes !== null && attributes !== void 0 ? attributes : {}; return service ? `${socialLinkName}-${service}` : socialLinkName; } return block ? block.name : null; } /** * Returns whether a block is valid or not. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Is Valid. */ function isBlockValid(state, clientId) { const block = state.blocks.byClientId.get(clientId); return !!block && block.isValid; } /** * Returns a block's attributes given its client ID, or null if no block exists with * the client ID. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {?Object} Block attributes. */ function getBlockAttributes(state, clientId) { const block = state.blocks.byClientId.get(clientId); if (!block) { return null; } return state.blocks.attributes.get(clientId); } /** * Returns a block given its client ID. This is a parsed copy of the block, * containing its `blockName`, `clientId`, and current `attributes` state. This * is not the block's registration settings, which must be retrieved from the * blocks module registration store. * * getBlock recurses through its inner blocks until all its children blocks have * been retrieved. Note that getBlock will not return the child inner blocks of * an inner block controller. This is because an inner block controller syncs * itself with its own entity, and should therefore not be included with the * blocks of a different entity. For example, say you call `getBlocks( TP )` to * get the blocks of a template part. If another template part is a child of TP, * then the nested template part's child blocks will not be returned. This way, * the template block itself is considered part of the parent, but the children * are not. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {Object} Parsed block object. */ function getBlock(state, clientId) { if (!state.blocks.byClientId.has(clientId)) { return null; } return state.blocks.tree.get(clientId); } const __unstableGetBlockWithoutInnerBlocks = (0,external_wp_data_namespaceObject.createSelector)((state, clientId) => { const block = state.blocks.byClientId.get(clientId); if (!block) { return null; } return { ...block, attributes: getBlockAttributes(state, clientId) }; }, (state, clientId) => [state.blocks.byClientId.get(clientId), state.blocks.attributes.get(clientId)]); /** * Returns all block objects for the current post being edited as an array in * the order they appear in the post. Note that this will exclude child blocks * of nested inner block controllers. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {Object[]} Post blocks. */ function getBlocks(state, rootClientId) { const treeKey = !rootClientId || !areInnerBlocksControlled(state, rootClientId) ? rootClientId || '' : 'controlled||' + rootClientId; return state.blocks.tree.get(treeKey)?.innerBlocks || selectors_EMPTY_ARRAY; } /** * Returns a stripped down block object containing only its client ID, * and its inner blocks' client IDs. * * @deprecated * * @param {Object} state Editor state. * @param {string} clientId Client ID of the block to get. * * @return {Object} Client IDs of the post blocks. */ const __unstableGetClientIdWithClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)((state, clientId) => { external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdWithClientIdsTree", { since: '6.3', version: '6.5' }); return { clientId, innerBlocks: __unstableGetClientIdsTree(state, clientId) }; }, state => [state.blocks.order]); /** * Returns the block tree represented in the block-editor store from the * given root, consisting of stripped down block objects containing only * their client IDs, and their inner blocks' client IDs. * * @deprecated * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {Object[]} Client IDs of the post blocks. */ const __unstableGetClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = '') => { external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdsTree", { since: '6.3', version: '6.5' }); return getBlockOrder(state, rootClientId).map(clientId => __unstableGetClientIdWithClientIdsTree(state, clientId)); }, state => [state.blocks.order]); /** * Returns an array containing the clientIds of all descendants of the blocks * given. Returned ids are ordered first by the order of the ids given, then * by the order that they appear in the editor. * * @param {Object} state Global application state. * @param {string|string[]} rootIds Client ID(s) for which descendant blocks are to be returned. * * @return {Array} Client IDs of descendants. */ const getClientIdsOfDescendants = (0,external_wp_data_namespaceObject.createSelector)((state, rootIds) => { rootIds = Array.isArray(rootIds) ? [...rootIds] : [rootIds]; const ids = []; // Add the descendants of the root blocks first. for (const rootId of rootIds) { const order = state.blocks.order.get(rootId); if (order) { ids.push(...order); } } let index = 0; // Add the descendants of the descendants, recursively. while (index < ids.length) { const id = ids[index]; const order = state.blocks.order.get(id); if (order) { ids.splice(index + 1, 0, ...order); } index++; } return ids; }, state => [state.blocks.order]); /** * Returns an array containing the clientIds of the top-level blocks and * their descendants of any depth (for nested blocks). Ids are returned * in the same order that they appear in the editor. * * @param {Object} state Global application state. * * @return {Array} ids of top-level and descendant blocks. */ const getClientIdsWithDescendants = state => getClientIdsOfDescendants(state, ''); /** * Returns the total number of blocks, or the total number of blocks with a specific name in a post. * The number returned includes nested blocks. * * @param {Object} state Global application state. * @param {?string} blockName Optional block name, if specified only blocks of that type will be counted. * * @return {number} Number of blocks in the post, or number of blocks with name equal to blockName. */ const getGlobalBlockCount = (0,external_wp_data_namespaceObject.createSelector)((state, blockName) => { const clientIds = getClientIdsWithDescendants(state); if (!blockName) { return clientIds.length; } let count = 0; for (const clientId of clientIds) { const block = state.blocks.byClientId.get(clientId); if (block.name === blockName) { count++; } } return count; }, state => [state.blocks.order, state.blocks.byClientId]); /** * Returns all blocks that match a blockName. Results include nested blocks. * * @param {Object} state Global application state. * @param {string[]} blockName Block name(s) for which clientIds are to be returned. * * @return {Array} Array of clientIds of blocks with name equal to blockName. */ const getBlocksByName = (0,external_wp_data_namespaceObject.createSelector)((state, blockName) => { if (!blockName) { return selectors_EMPTY_ARRAY; } const blockNames = Array.isArray(blockName) ? blockName : [blockName]; const clientIds = getClientIdsWithDescendants(state); const foundBlocks = clientIds.filter(clientId => { const block = state.blocks.byClientId.get(clientId); return blockNames.includes(block.name); }); return foundBlocks.length > 0 ? foundBlocks : selectors_EMPTY_ARRAY; }, state => [state.blocks.order, state.blocks.byClientId]); /** * Returns all global blocks that match a blockName. Results include nested blocks. * * @deprecated * * @param {Object} state Global application state. * @param {string[]} blockName Block name(s) for which clientIds are to be returned. * * @return {Array} Array of clientIds of blocks with name equal to blockName. */ function __experimentalGetGlobalBlocksByName(state, blockName) { external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__experimentalGetGlobalBlocksByName", { since: '6.5', alternative: `wp.data.select( 'core/block-editor' ).getBlocksByName` }); return getBlocksByName(state, blockName); } /** * Given an array of block client IDs, returns the corresponding array of block * objects. * * @param {Object} state Editor state. * @param {string[]} clientIds Client IDs for which blocks are to be returned. * * @return {WPBlock[]} Block objects. */ const getBlocksByClientId = (0,external_wp_data_namespaceObject.createSelector)((state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(clientId => getBlock(state, clientId)), (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(clientId => state.blocks.tree.get(clientId))); /** * Given an array of block client IDs, returns the corresponding array of block * names. * * @param {Object} state Editor state. * @param {string[]} clientIds Client IDs for which block names are to be returned. * * @return {string[]} Block names. */ const getBlockNamesByClientId = (0,external_wp_data_namespaceObject.createSelector)((state, clientIds) => getBlocksByClientId(state, clientIds).filter(Boolean).map(block => block.name), (state, clientIds) => getBlocksByClientId(state, clientIds)); /** * Returns the number of blocks currently present in the post. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {number} Number of blocks in the post. */ function getBlockCount(state, rootClientId) { return getBlockOrder(state, rootClientId).length; } /** * Returns the current selection start block client ID, attribute key and text * offset. * * @param {Object} state Block editor state. * * @return {WPBlockSelection} Selection start information. */ function getSelectionStart(state) { return state.selection.selectionStart; } /** * Returns the current selection end block client ID, attribute key and text * offset. * * @param {Object} state Block editor state. * * @return {WPBlockSelection} Selection end information. */ function getSelectionEnd(state) { return state.selection.selectionEnd; } /** * Returns the current block selection start. This value may be null, and it * may represent either a singular block selection or multi-selection start. * A selection is singular if its start and end match. * * @param {Object} state Global application state. * * @return {?string} Client ID of block selection start. */ function getBlockSelectionStart(state) { return state.selection.selectionStart.clientId; } /** * Returns the current block selection end. This value may be null, and it * may represent either a singular block selection or multi-selection end. * A selection is singular if its start and end match. * * @param {Object} state Global application state. * * @return {?string} Client ID of block selection end. */ function getBlockSelectionEnd(state) { return state.selection.selectionEnd.clientId; } /** * Returns the number of blocks currently selected in the post. * * @param {Object} state Global application state. * * @return {number} Number of blocks selected in the post. */ function getSelectedBlockCount(state) { const multiSelectedBlockCount = getMultiSelectedBlockClientIds(state).length; if (multiSelectedBlockCount) { return multiSelectedBlockCount; } return state.selection.selectionStart.clientId ? 1 : 0; } /** * Returns true if there is a single selected block, or false otherwise. * * @param {Object} state Editor state. * * @return {boolean} Whether a single block is selected. */ function hasSelectedBlock(state) { const { selectionStart, selectionEnd } = state.selection; return !!selectionStart.clientId && selectionStart.clientId === selectionEnd.clientId; } /** * Returns the currently selected block client ID, or null if there is no * selected block. * * @param {Object} state Editor state. * * @return {?string} Selected block client ID. */ function getSelectedBlockClientId(state) { const { selectionStart, selectionEnd } = state.selection; const { clientId } = selectionStart; if (!clientId || clientId !== selectionEnd.clientId) { return null; } return clientId; } /** * Returns the currently selected block, or null if there is no selected block. * * @param {Object} state Global application state. * * @example * *```js * import { select } from '@wordpress/data' * import { store as blockEditorStore } from '@wordpress/block-editor' * * // Set initial active block client ID * let activeBlockClientId = null * * const getActiveBlockData = () => { * const activeBlock = select(blockEditorStore).getSelectedBlock() * * if (activeBlock && activeBlock.clientId !== activeBlockClientId) { * activeBlockClientId = activeBlock.clientId * * // Get active block name and attributes * const activeBlockName = activeBlock.name * const activeBlockAttributes = activeBlock.attributes * * // Log active block name and attributes * console.log(activeBlockName, activeBlockAttributes) * } * } * * // Subscribe to changes in the editor * // wp.data.subscribe(() => { * // getActiveBlockData() * // }) * * // Update active block data on click * // onclick="getActiveBlockData()" *``` * * @return {?Object} Selected block. */ function getSelectedBlock(state) { const clientId = getSelectedBlockClientId(state); return clientId ? getBlock(state, clientId) : null; } /** * Given a block client ID, returns the root block from which the block is * nested, an empty string for top-level blocks, or null if the block does not * exist. * * @param {Object} state Editor state. * @param {string} clientId Block from which to find root client ID. * * @return {?string} Root client ID, if exists */ function getBlockRootClientId(state, clientId) { var _state$blocks$parents; return (_state$blocks$parents = state.blocks.parents.get(clientId)) !== null && _state$blocks$parents !== void 0 ? _state$blocks$parents : null; } /** * Given a block client ID, returns the list of all its parents from top to bottom. * * @param {Object} state Editor state. * @param {string} clientId Block from which to find root client ID. * @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false). * * @return {Array} ClientIDs of the parent blocks. */ const getBlockParents = (0,external_wp_data_namespaceObject.createSelector)((state, clientId, ascending = false) => { const parents = []; let current = clientId; while (current = state.blocks.parents.get(current)) { parents.push(current); } if (!parents.length) { return selectors_EMPTY_ARRAY; } return ascending ? parents : parents.reverse(); }, state => [state.blocks.parents]); /** * Given a block client ID and a block name, returns the list of all its parents * from top to bottom, filtered by the given name(s). For example, if passed * 'core/group' as the blockName, it will only return parents which are group * blocks. If passed `[ 'core/group', 'core/cover']`, as the blockName, it will * return parents which are group blocks and parents which are cover blocks. * * @param {Object} state Editor state. * @param {string} clientId Block from which to find root client ID. * @param {string|string[]} blockName Block name(s) to filter. * @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false). * * @return {Array} ClientIDs of the parent blocks. */ const getBlockParentsByBlockName = (0,external_wp_data_namespaceObject.createSelector)((state, clientId, blockName, ascending = false) => { const parents = getBlockParents(state, clientId, ascending); const hasName = Array.isArray(blockName) ? name => blockName.includes(name) : name => blockName === name; return parents.filter(id => hasName(getBlockName(state, id))); }, state => [state.blocks.parents]); /** * Given a block client ID, returns the root of the hierarchy from which the block is nested, return the block itself for root level blocks. * * @param {Object} state Editor state. * @param {string} clientId Block from which to find root client ID. * * @return {string} Root client ID */ function getBlockHierarchyRootClientId(state, clientId) { let current = clientId; let parent; do { parent = current; current = state.blocks.parents.get(current); } while (current); return parent; } /** * Given a block client ID, returns the lowest common ancestor with selected client ID. * * @param {Object} state Editor state. * @param {string} clientId Block from which to find common ancestor client ID. * * @return {string} Common ancestor client ID or undefined */ function getLowestCommonAncestorWithSelectedBlock(state, clientId) { const selectedId = getSelectedBlockClientId(state); const clientParents = [...getBlockParents(state, clientId), clientId]; const selectedParents = [...getBlockParents(state, selectedId), selectedId]; let lowestCommonAncestor; const maxDepth = Math.min(clientParents.length, selectedParents.length); for (let index = 0; index < maxDepth; index++) { if (clientParents[index] === selectedParents[index]) { lowestCommonAncestor = clientParents[index]; } else { break; } } return lowestCommonAncestor; } /** * Returns the client ID of the block adjacent one at the given reference * startClientId and modifier directionality. Defaults start startClientId to * the selected block, and direction as next block. Returns null if there is no * adjacent block. * * @param {Object} state Editor state. * @param {?string} startClientId Optional client ID of block from which to * search. * @param {?number} modifier Directionality multiplier (1 next, -1 * previous). * * @return {?string} Return the client ID of the block, or null if none exists. */ function getAdjacentBlockClientId(state, startClientId, modifier = 1) { // Default to selected block. if (startClientId === undefined) { startClientId = getSelectedBlockClientId(state); } // Try multi-selection starting at extent based on modifier. if (startClientId === undefined) { if (modifier < 0) { startClientId = getFirstMultiSelectedBlockClientId(state); } else { startClientId = getLastMultiSelectedBlockClientId(state); } } // Validate working start client ID. if (!startClientId) { return null; } // Retrieve start block root client ID, being careful to allow the falsey // empty string top-level root by explicitly testing against null. const rootClientId = getBlockRootClientId(state, startClientId); if (rootClientId === null) { return null; } const { order } = state.blocks; const orderSet = order.get(rootClientId); const index = orderSet.indexOf(startClientId); const nextIndex = index + 1 * modifier; // Block was first in set and we're attempting to get previous. if (nextIndex < 0) { return null; } // Block was last in set and we're attempting to get next. if (nextIndex === orderSet.length) { return null; } // Assume incremented index is within the set. return orderSet[nextIndex]; } /** * Returns the previous block's client ID from the given reference start ID. * Defaults start to the selected block. Returns null if there is no previous * block. * * @param {Object} state Editor state. * @param {?string} startClientId Optional client ID of block from which to * search. * * @return {?string} Adjacent block's client ID, or null if none exists. */ function getPreviousBlockClientId(state, startClientId) { return getAdjacentBlockClientId(state, startClientId, -1); } /** * Returns the next block's client ID from the given reference start ID. * Defaults start to the selected block. Returns null if there is no next * block. * * @param {Object} state Editor state. * @param {?string} startClientId Optional client ID of block from which to * search. * * @return {?string} Adjacent block's client ID, or null if none exists. */ function getNextBlockClientId(state, startClientId) { return getAdjacentBlockClientId(state, startClientId, 1); } /* eslint-disable jsdoc/valid-types */ /** * Returns the initial caret position for the selected block. * This position is to used to position the caret properly when the selected block changes. * If the current block is not a RichText, having initial position set to 0 means "focus block" * * @param {Object} state Global application state. * * @return {0|-1|null} Initial position. */ function getSelectedBlocksInitialCaretPosition(state) { /* eslint-enable jsdoc/valid-types */ return state.initialPosition; } /** * Returns the current selection set of block client IDs (multiselection or single selection). * * @param {Object} state Editor state. * * @return {Array} Multi-selected block client IDs. */ const getSelectedBlockClientIds = (0,external_wp_data_namespaceObject.createSelector)(state => { const { selectionStart, selectionEnd } = state.selection; if (!selectionStart.clientId || !selectionEnd.clientId) { return selectors_EMPTY_ARRAY; } if (selectionStart.clientId === selectionEnd.clientId) { return [selectionStart.clientId]; } // Retrieve root client ID to aid in retrieving relevant nested block // order, being careful to allow the falsey empty string top-level root // by explicitly testing against null. const rootClientId = getBlockRootClientId(state, selectionStart.clientId); if (rootClientId === null) { return selectors_EMPTY_ARRAY; } const blockOrder = getBlockOrder(state, rootClientId); const startIndex = blockOrder.indexOf(selectionStart.clientId); const endIndex = blockOrder.indexOf(selectionEnd.clientId); if (startIndex > endIndex) { return blockOrder.slice(endIndex, startIndex + 1); } return blockOrder.slice(startIndex, endIndex + 1); }, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]); /** * Returns the current multi-selection set of block client IDs, or an empty * array if there is no multi-selection. * * @param {Object} state Editor state. * * @return {Array} Multi-selected block client IDs. */ function getMultiSelectedBlockClientIds(state) { const { selectionStart, selectionEnd } = state.selection; if (selectionStart.clientId === selectionEnd.clientId) { return selectors_EMPTY_ARRAY; } return getSelectedBlockClientIds(state); } /** * Returns the current multi-selection set of blocks, or an empty array if * there is no multi-selection. * * @param {Object} state Editor state. * * @return {Array} Multi-selected block objects. */ const getMultiSelectedBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => { const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state); if (!multiSelectedBlockClientIds.length) { return selectors_EMPTY_ARRAY; } return multiSelectedBlockClientIds.map(clientId => getBlock(state, clientId)); }, state => [...getSelectedBlockClientIds.getDependants(state), state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); /** * Returns the client ID of the first block in the multi-selection set, or null * if there is no multi-selection. * * @param {Object} state Editor state. * * @return {?string} First block client ID in the multi-selection set. */ function getFirstMultiSelectedBlockClientId(state) { return getMultiSelectedBlockClientIds(state)[0] || null; } /** * Returns the client ID of the last block in the multi-selection set, or null * if there is no multi-selection. * * @param {Object} state Editor state. * * @return {?string} Last block client ID in the multi-selection set. */ function getLastMultiSelectedBlockClientId(state) { const selectedClientIds = getMultiSelectedBlockClientIds(state); return selectedClientIds[selectedClientIds.length - 1] || null; } /** * Returns true if a multi-selection exists, and the block corresponding to the * specified client ID is the first block of the multi-selection set, or false * otherwise. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether block is first in multi-selection. */ function isFirstMultiSelectedBlock(state, clientId) { return getFirstMultiSelectedBlockClientId(state) === clientId; } /** * Returns true if the client ID occurs within the block multi-selection, or * false otherwise. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether block is in multi-selection set. */ function isBlockMultiSelected(state, clientId) { return getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1; } /** * Returns true if an ancestor of the block is multi-selected, or false * otherwise. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether an ancestor of the block is in multi-selection * set. */ const isAncestorMultiSelected = (0,external_wp_data_namespaceObject.createSelector)((state, clientId) => { let ancestorClientId = clientId; let isMultiSelected = false; while (ancestorClientId && !isMultiSelected) { ancestorClientId = getBlockRootClientId(state, ancestorClientId); isMultiSelected = isBlockMultiSelected(state, ancestorClientId); } return isMultiSelected; }, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]); /** * Returns the client ID of the block which begins the multi-selection set, or * null if there is no multi-selection. * * This is not necessarily the first client ID in the selection. * * @see getFirstMultiSelectedBlockClientId * * @param {Object} state Editor state. * * @return {?string} Client ID of block beginning multi-selection. */ function getMultiSelectedBlocksStartClientId(state) { const { selectionStart, selectionEnd } = state.selection; if (selectionStart.clientId === selectionEnd.clientId) { return null; } return selectionStart.clientId || null; } /** * Returns the client ID of the block which ends the multi-selection set, or * null if there is no multi-selection. * * This is not necessarily the last client ID in the selection. * * @see getLastMultiSelectedBlockClientId * * @param {Object} state Editor state. * * @return {?string} Client ID of block ending multi-selection. */ function getMultiSelectedBlocksEndClientId(state) { const { selectionStart, selectionEnd } = state.selection; if (selectionStart.clientId === selectionEnd.clientId) { return null; } return selectionEnd.clientId || null; } /** * Returns true if the selection is not partial. * * @param {Object} state Editor state. * * @return {boolean} Whether the selection is mergeable. */ function __unstableIsFullySelected(state) { const selectionAnchor = getSelectionStart(state); const selectionFocus = getSelectionEnd(state); return !selectionAnchor.attributeKey && !selectionFocus.attributeKey && typeof selectionAnchor.offset === 'undefined' && typeof selectionFocus.offset === 'undefined'; } /** * Returns true if the selection is collapsed. * * @param {Object} state Editor state. * * @return {boolean} Whether the selection is collapsed. */ function __unstableIsSelectionCollapsed(state) { const selectionAnchor = getSelectionStart(state); const selectionFocus = getSelectionEnd(state); return !!selectionAnchor && !!selectionFocus && selectionAnchor.clientId === selectionFocus.clientId && selectionAnchor.attributeKey === selectionFocus.attributeKey && selectionAnchor.offset === selectionFocus.offset; } function __unstableSelectionHasUnmergeableBlock(state) { return getSelectedBlockClientIds(state).some(clientId => { const blockName = getBlockName(state, clientId); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); return !blockType.merge; }); } /** * Check whether the selection is mergeable. * * @param {Object} state Editor state. * @param {boolean} isForward Whether to merge forwards. * * @return {boolean} Whether the selection is mergeable. */ function __unstableIsSelectionMergeable(state, isForward) { const selectionAnchor = getSelectionStart(state); const selectionFocus = getSelectionEnd(state); // It's not mergeable if the start and end are within the same block. if (selectionAnchor.clientId === selectionFocus.clientId) { return false; } // It's not mergeable if there's no rich text selection. if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') { return false; } const anchorRootClientId = getBlockRootClientId(state, selectionAnchor.clientId); const focusRootClientId = getBlockRootClientId(state, selectionFocus.clientId); // It's not mergeable if the selection doesn't start and end in the same // block list. Maybe in the future it should be allowed. if (anchorRootClientId !== focusRootClientId) { return false; } const blockOrder = getBlockOrder(state, anchorRootClientId); const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order. let selectionStart, selectionEnd; if (anchorIndex > focusIndex) { selectionStart = selectionFocus; selectionEnd = selectionAnchor; } else { selectionStart = selectionAnchor; selectionEnd = selectionFocus; } const targetBlockClientId = isForward ? selectionEnd.clientId : selectionStart.clientId; const blockToMergeClientId = isForward ? selectionStart.clientId : selectionEnd.clientId; const targetBlockName = getBlockName(state, targetBlockClientId); const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlockName); if (!targetBlockType.merge) { return false; } const blockToMerge = getBlock(state, blockToMergeClientId); // It's mergeable if the blocks are of the same type. if (blockToMerge.name === targetBlockName) { return true; } // If the blocks are of a different type, try to transform the block being // merged into the same type of block. const blocksToMerge = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blockToMerge, targetBlockName); return blocksToMerge && blocksToMerge.length; } /** * Get partial selected blocks with their content updated * based on the selection. * * @param {Object} state Editor state. * * @return {Object[]} Updated partial selected blocks. */ const __unstableGetSelectedBlocksWithPartialSelection = state => { const selectionAnchor = getSelectionStart(state); const selectionFocus = getSelectionEnd(state); if (selectionAnchor.clientId === selectionFocus.clientId) { return selectors_EMPTY_ARRAY; } // Can't split if the selection is not set. if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') { return selectors_EMPTY_ARRAY; } const anchorRootClientId = getBlockRootClientId(state, selectionAnchor.clientId); const focusRootClientId = getBlockRootClientId(state, selectionFocus.clientId); // It's not splittable if the selection doesn't start and end in the same // block list. Maybe in the future it should be allowed. if (anchorRootClientId !== focusRootClientId) { return selectors_EMPTY_ARRAY; } const blockOrder = getBlockOrder(state, anchorRootClientId); const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order. const [selectionStart, selectionEnd] = anchorIndex > focusIndex ? [selectionFocus, selectionAnchor] : [selectionAnchor, selectionFocus]; const blockA = getBlock(state, selectionStart.clientId); const blockB = getBlock(state, selectionEnd.clientId); const htmlA = blockA.attributes[selectionStart.attributeKey]; const htmlB = blockB.attributes[selectionEnd.attributeKey]; let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB }); valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, 0, selectionStart.offset); valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, selectionEnd.offset, valueB.text.length); return [{ ...blockA, attributes: { ...blockA.attributes, [selectionStart.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA }) } }, { ...blockB, attributes: { ...blockB.attributes, [selectionEnd.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB }) } }]; }; /** * Returns an array containing all block client IDs in the editor in the order * they appear. Optionally accepts a root client ID of the block list for which * the order should be returned, defaulting to the top-level block order. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {Array} Ordered client IDs of editor blocks. */ function getBlockOrder(state, rootClientId) { return state.blocks.order.get(rootClientId || '') || selectors_EMPTY_ARRAY; } /** * Returns the index at which the block corresponding to the specified client * ID occurs within the block order, or `-1` if the block does not exist. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {number} Index at which block exists in order. */ function getBlockIndex(state, clientId) { const rootClientId = getBlockRootClientId(state, clientId); return getBlockOrder(state, rootClientId).indexOf(clientId); } /** * Returns true if the block corresponding to the specified client ID is * currently selected and no multi-selection exists, or false otherwise. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether block is selected and multi-selection exists. */ function isBlockSelected(state, clientId) { const { selectionStart, selectionEnd } = state.selection; if (selectionStart.clientId !== selectionEnd.clientId) { return false; } return selectionStart.clientId === clientId; } /** * Returns true if one of the block's inner blocks is selected. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * @param {boolean} deep Perform a deep check. * * @return {boolean} Whether the block has an inner block selected */ function hasSelectedInnerBlock(state, clientId, deep = false) { const selectedBlockClientIds = getSelectedBlockClientIds(state); if (!selectedBlockClientIds.length) { return false; } if (deep) { return selectedBlockClientIds.some(id => // Pass true because we don't care about order and it's more // performant. getBlockParents(state, id, true).includes(clientId)); } return selectedBlockClientIds.some(id => getBlockRootClientId(state, id) === clientId); } /** * Returns true if one of the block's inner blocks is dragged. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * @param {boolean} deep Perform a deep check. * * @return {boolean} Whether the block has an inner block dragged */ function hasDraggedInnerBlock(state, clientId, deep = false) { return getBlockOrder(state, clientId).some(innerClientId => isBlockBeingDragged(state, innerClientId) || deep && hasDraggedInnerBlock(state, innerClientId, deep)); } /** * Returns true if the block corresponding to the specified client ID is * currently selected but isn't the last of the selected blocks. Here "last" * refers to the block sequence in the document, _not_ the sequence of * multi-selection, which is why `state.selectionEnd` isn't used. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether block is selected and not the last in the * selection. */ function isBlockWithinSelection(state, clientId) { if (!clientId) { return false; } const clientIds = getMultiSelectedBlockClientIds(state); const index = clientIds.indexOf(clientId); return index > -1 && index < clientIds.length - 1; } /** * Returns true if a multi-selection has been made, or false otherwise. * * @param {Object} state Editor state. * * @return {boolean} Whether multi-selection has been made. */ function hasMultiSelection(state) { const { selectionStart, selectionEnd } = state.selection; return selectionStart.clientId !== selectionEnd.clientId; } /** * Whether in the process of multi-selecting or not. This flag is only true * while the multi-selection is being selected (by mouse move), and is false * once the multi-selection has been settled. * * @see hasMultiSelection * * @param {Object} state Global application state. * * @return {boolean} True if multi-selecting, false if not. */ function selectors_isMultiSelecting(state) { return state.isMultiSelecting; } /** * Selector that returns if multi-selection is enabled or not. * * @param {Object} state Global application state. * * @return {boolean} True if it should be possible to multi-select blocks, false if multi-selection is disabled. */ function selectors_isSelectionEnabled(state) { return state.isSelectionEnabled; } /** * Returns the block's editing mode, defaulting to "visual" if not explicitly * assigned. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {Object} Block editing mode. */ function getBlockMode(state, clientId) { return state.blocksMode[clientId] || 'visual'; } /** * Returns true if the user is typing, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether user is typing. */ function selectors_isTyping(state) { return state.isTyping; } /** * Returns true if the user is dragging blocks, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether user is dragging blocks. */ function isDraggingBlocks(state) { return !!state.draggedBlocks.length; } /** * Returns the client ids of any blocks being directly dragged. * * This does not include children of a parent being dragged. * * @param {Object} state Global application state. * * @return {string[]} Array of dragged block client ids. */ function getDraggedBlockClientIds(state) { return state.draggedBlocks; } /** * Returns whether the block is being dragged. * * Only returns true if the block is being directly dragged, * not if the block is a child of a parent being dragged. * See `isAncestorBeingDragged` for child blocks. * * @param {Object} state Global application state. * @param {string} clientId Client id for block to check. * * @return {boolean} Whether the block is being dragged. */ function isBlockBeingDragged(state, clientId) { return state.draggedBlocks.includes(clientId); } /** * Returns whether a parent/ancestor of the block is being dragged. * * @param {Object} state Global application state. * @param {string} clientId Client id for block to check. * * @return {boolean} Whether the block's ancestor is being dragged. */ function isAncestorBeingDragged(state, clientId) { // Return early if no blocks are being dragged rather than // the more expensive check for parents. if (!isDraggingBlocks(state)) { return false; } const parents = getBlockParents(state, clientId); return parents.some(parentClientId => isBlockBeingDragged(state, parentClientId)); } /** * Returns true if the caret is within formatted text, or false otherwise. * * @deprecated * * @return {boolean} Whether the caret is within formatted text. */ function isCaretWithinFormattedText() { external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).isCaretWithinFormattedText', { since: '6.1', version: '6.3' }); return false; } /** * Returns the location of the insertion cue. Defaults to the last index. * * @param {Object} state Editor state. * * @return {Object} Insertion point object with `rootClientId`, `index`. */ const getBlockInsertionPoint = (0,external_wp_data_namespaceObject.createSelector)(state => { let rootClientId, index; const { insertionCue, selection: { selectionEnd } } = state; if (insertionCue !== null) { return insertionCue; } const { clientId } = selectionEnd; if (clientId) { rootClientId = getBlockRootClientId(state, clientId) || undefined; index = getBlockIndex(state, selectionEnd.clientId) + 1; } else { index = getBlockOrder(state).length; } return { rootClientId, index }; }, state => [state.insertionCue, state.selection.selectionEnd.clientId, state.blocks.parents, state.blocks.order]); /** * Returns true if the block insertion point is visible. * * @param {Object} state Global application state. * * @return {?boolean} Whether the insertion point is visible or not. */ function isBlockInsertionPointVisible(state) { return state.insertionCue !== null; } /** * Returns whether the blocks matches the template or not. * * @param {boolean} state * @return {?boolean} Whether the template is valid or not. */ function isValidTemplate(state) { return state.template.isValid; } /** * Returns the defined block template * * @param {boolean} state * * @return {?Array} Block Template. */ function getTemplate(state) { return state.settings.template; } /** * Returns the defined block template lock. Optionally accepts a root block * client ID as context, otherwise defaulting to the global context. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional block root client ID. * * @return {string|false} Block Template Lock */ function getTemplateLock(state, rootClientId) { var _getBlockListSettings; if (!rootClientId) { var _state$settings$templ; return (_state$settings$templ = state.settings.templateLock) !== null && _state$settings$templ !== void 0 ? _state$settings$templ : false; } return (_getBlockListSettings = getBlockListSettings(state, rootClientId)?.templateLock) !== null && _getBlockListSettings !== void 0 ? _getBlockListSettings : false; } /** * Determines if the given block type is visible in the inserter. * Note that this is different than whether a block is allowed to be inserted. * In some cases, the block is not allowed in a given position but * it should still be visible in the inserter to be able to add it * to a different position. * * @param {Object} state Editor state. * @param {string|Object} blockNameOrType The block type object, e.g., the response * from the block directory; or a string name of * an installed block type, e.g.' core/paragraph'. * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Whether the given block type is allowed to be inserted. */ const isBlockVisibleInTheInserter = (state, blockNameOrType, rootClientId = null) => { let blockType; let blockName; if (blockNameOrType && 'object' === typeof blockNameOrType) { blockType = blockNameOrType; blockName = blockNameOrType.name; } else { blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockNameOrType); blockName = blockNameOrType; } if (!blockType) { return false; } const { allowedBlockTypes } = getSettings(state); const isBlockAllowedInEditor = checkAllowList(allowedBlockTypes, blockName, true); if (!isBlockAllowedInEditor) { return false; } // If parent blocks are not visible, child blocks should be hidden too. const parents = (Array.isArray(blockType.parent) ? blockType.parent : []).concat(Array.isArray(blockType.ancestor) ? blockType.ancestor : []); if (parents.length > 0) { // This is an exception to the rule that says that all blocks are visible in the inserter. // Blocks that require a given parent or ancestor are only visible if we're within that parent. if (parents.includes('core/post-content')) { return true; } let current = rootClientId; let hasParent = false; do { if (parents.includes(getBlockName(state, current))) { hasParent = true; break; } current = state.blocks.parents.get(current); } while (current); return hasParent; } return true; }; /** * Determines if the given block type is allowed to be inserted into the block list. * This function is not exported and not memoized because using a memoized selector * inside another memoized selector is just a waste of time. * * @param {Object} state Editor state. * @param {string|Object} blockName The block type object, e.g., the response * from the block directory; or a string name of * an installed block type, e.g.' core/paragraph'. * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Whether the given block type is allowed to be inserted. */ const canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => { if (!isBlockVisibleInTheInserter(state, blockName, rootClientId)) { return false; } let blockType; if (blockName && 'object' === typeof blockName) { blockType = blockName; blockName = blockType.name; } else { blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); } const isLocked = !!getTemplateLock(state, rootClientId); if (isLocked) { return false; } const _isSectionBlock = !!isSectionBlock(state, rootClientId); if (_isSectionBlock) { return false; } if (getBlockEditingMode(state, rootClientId !== null && rootClientId !== void 0 ? rootClientId : '') === 'disabled') { return false; } const parentBlockListSettings = getBlockListSettings(state, rootClientId); // The parent block doesn't have settings indicating it doesn't support // inner blocks, return false. if (rootClientId && parentBlockListSettings === undefined) { return false; } const parentName = getBlockName(state, rootClientId); const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentName); // Look at the `blockType.allowedBlocks` field to determine whether this is an allowed child block. const parentAllowedChildBlocks = parentBlockType?.allowedBlocks; let hasParentAllowedBlock = checkAllowList(parentAllowedChildBlocks, blockName); // The `allowedBlocks` block list setting can further limit which blocks are allowed children. if (hasParentAllowedBlock !== false) { const parentAllowedBlocks = parentBlockListSettings?.allowedBlocks; const hasParentListAllowedBlock = checkAllowList(parentAllowedBlocks, blockName); // Never downgrade the result from `true` to `null` if (hasParentListAllowedBlock !== null) { hasParentAllowedBlock = hasParentListAllowedBlock; } } const blockAllowedParentBlocks = blockType.parent; const hasBlockAllowedParent = checkAllowList(blockAllowedParentBlocks, parentName); let hasBlockAllowedAncestor = true; const blockAllowedAncestorBlocks = blockType.ancestor; if (blockAllowedAncestorBlocks) { const ancestors = [rootClientId, ...getBlockParents(state, rootClientId)]; hasBlockAllowedAncestor = ancestors.some(ancestorClientId => checkAllowList(blockAllowedAncestorBlocks, getBlockName(state, ancestorClientId))); } const canInsert = hasBlockAllowedAncestor && (hasParentAllowedBlock === null && hasBlockAllowedParent === null || hasParentAllowedBlock === true || hasBlockAllowedParent === true); if (!canInsert) { return canInsert; } /** * This filter is an ad-hoc solution to prevent adding template parts inside post content. * Conceptually, having a filter inside a selector is bad pattern so this code will be * replaced by a declarative API that doesn't the following drawbacks: * * Filters are not reactive: Upon switching between "template mode" and non "template mode", * the filter and selector won't necessarily be executed again. For now, it doesn't matter much * because you can't switch between the two modes while the inserter stays open. * * Filters are global: Once they're defined, they will affect all editor instances and all registries. * An ideal API would only affect specific editor instances. */ return (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.__unstableCanInsertBlockType', canInsert, blockType, rootClientId, { // Pass bound selectors of the current registry. If we're in a nested // context, the data will differ from the one selected from the root // registry. getBlock: getBlock.bind(null, state), getBlockParentsByBlockName: getBlockParentsByBlockName.bind(null, state) }); }; /** * Determines if the given block type is allowed to be inserted into the block list. * * @param {Object} state Editor state. * @param {string} blockName The name of the block type, e.g.' core/paragraph'. * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Whether the given block type is allowed to be inserted. */ const canInsertBlockType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => getInsertBlockTypeDependants(select)(state, rootClientId))); /** * Determines if the given blocks are allowed to be inserted into the block * list. * * @param {Object} state Editor state. * @param {string} clientIds The block client IDs to be inserted. * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Whether the given blocks are allowed to be inserted. */ function canInsertBlocks(state, clientIds, rootClientId = null) { return clientIds.every(id => canInsertBlockType(state, getBlockName(state, id), rootClientId)); } /** * Determines if the given block is allowed to be deleted. * * @param {Object} state Editor state. * @param {string} clientId The block client Id. * * @return {boolean} Whether the given block is allowed to be removed. */ function canRemoveBlock(state, clientId) { const attributes = getBlockAttributes(state, clientId); if (attributes === null) { return true; } if (attributes.lock?.remove !== undefined) { return !attributes.lock.remove; } const rootClientId = getBlockRootClientId(state, clientId); if (getTemplateLock(state, rootClientId)) { return false; } const isBlockWithinSection = !!getParentSectionBlock(state, clientId); if (isBlockWithinSection) { return false; } return getBlockEditingMode(state, rootClientId) !== 'disabled'; } /** * Determines if the given blocks are allowed to be removed. * * @param {Object} state Editor state. * @param {string} clientIds The block client IDs to be removed. * * @return {boolean} Whether the given blocks are allowed to be removed. */ function canRemoveBlocks(state, clientIds) { return clientIds.every(clientId => canRemoveBlock(state, clientId)); } /** * Determines if the given block is allowed to be moved. * * @param {Object} state Editor state. * @param {string} clientId The block client Id. * * @return {boolean} Whether the given block is allowed to be moved. */ function canMoveBlock(state, clientId) { const attributes = getBlockAttributes(state, clientId); if (attributes === null) { return true; } if (attributes.lock?.move !== undefined) { return !attributes.lock.move; } const rootClientId = getBlockRootClientId(state, clientId); if (getTemplateLock(state, rootClientId) === 'all') { return false; } return getBlockEditingMode(state, rootClientId) !== 'disabled'; } /** * Determines if the given blocks are allowed to be moved. * * @param {Object} state Editor state. * @param {string} clientIds The block client IDs to be moved. * * @return {boolean} Whether the given blocks are allowed to be moved. */ function canMoveBlocks(state, clientIds) { return clientIds.every(clientId => canMoveBlock(state, clientId)); } /** * Determines if the given block is allowed to be edited. * * @param {Object} state Editor state. * @param {string} clientId The block client Id. * * @return {boolean} Whether the given block is allowed to be edited. */ function canEditBlock(state, clientId) { const attributes = getBlockAttributes(state, clientId); if (attributes === null) { return true; } const { lock } = attributes; // When the edit is true, we cannot edit the block. return !lock?.edit; } /** * Determines if the given block type can be locked/unlocked by a user. * * @param {Object} state Editor state. * @param {(string|Object)} nameOrType Block name or type object. * * @return {boolean} Whether a given block type can be locked/unlocked. */ function canLockBlockType(state, nameOrType) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, 'lock', true)) { return false; } // Use block editor settings as the default value. return !!state.settings?.canLockBlocks; } /** * Returns information about how recently and frequently a block has been inserted. * * @param {Object} state Global application state. * @param {string} id A string which identifies the insert, e.g. 'core/block/12' * * @return {?{ time: number, count: number }} An object containing `time` which is when the last * insert occurred as a UNIX epoch, and `count` which is * the number of inserts that have occurred. */ function getInsertUsage(state, id) { var _state$preferences$in; return (_state$preferences$in = state.preferences.insertUsage?.[id]) !== null && _state$preferences$in !== void 0 ? _state$preferences$in : null; } /** * Returns whether we can show a block type in the inserter * * @param {Object} state Global State * @param {Object} blockType BlockType * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Whether the given block type is allowed to be shown in the inserter. */ const canIncludeBlockTypeInInserter = (state, blockType, rootClientId) => { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'inserter', true)) { return false; } return canInsertBlockTypeUnmemoized(state, blockType.name, rootClientId); }; /** * Return a function to be used to transform a block variation to an inserter item * * @param {Object} state Global State * @param {Object} item Denormalized inserter item * @return {Function} Function to transform a block variation to inserter item */ const getItemFromVariation = (state, item) => variation => { const variationId = `${item.id}/${variation.name}`; const { time, count = 0 } = getInsertUsage(state, variationId) || {}; return { ...item, id: variationId, icon: variation.icon || item.icon, title: variation.title || item.title, description: variation.description || item.description, category: variation.category || item.category, // If `example` is explicitly undefined for the variation, the preview will not be shown. example: variation.hasOwnProperty('example') ? variation.example : item.example, initialAttributes: { ...item.initialAttributes, ...variation.attributes }, innerBlocks: variation.innerBlocks, keywords: variation.keywords || item.keywords, frecency: calculateFrecency(time, count) }; }; /** * Returns the calculated frecency. * * 'frecency' is a heuristic (https://en.wikipedia.org/wiki/Frecency) * that combines block usage frequency and recency. * * @param {number} time When the last insert occurred as a UNIX epoch * @param {number} count The number of inserts that have occurred. * * @return {number} The calculated frecency. */ const calculateFrecency = (time, count) => { if (!time) { return count; } // The selector is cached, which means Date.now() is the last time that the // relevant state changed. This suits our needs. const duration = Date.now() - time; switch (true) { case duration < MILLISECONDS_PER_HOUR: return count * 4; case duration < MILLISECONDS_PER_DAY: return count * 2; case duration < MILLISECONDS_PER_WEEK: return count / 2; default: return count / 4; } }; /** * Returns a function that accepts a block type and builds an item to be shown * in a specific context. It's used for building items for Inserter and available * block Transforms list. * * @param {Object} state Editor state. * @param {Object} options Options object for handling the building of a block type. * @param {string} options.buildScope The scope for which the item is going to be used. * @return {Function} Function returns an item to be shown in a specific context (Inserter|Transforms list). */ const buildBlockTypeItem = (state, { buildScope = 'inserter' }) => blockType => { const id = blockType.name; let isDisabled = false; if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType.name, 'multiple', true)) { isDisabled = getBlocksByClientId(state, getClientIdsWithDescendants(state)).some(({ name }) => name === blockType.name); } const { time, count = 0 } = getInsertUsage(state, id) || {}; const blockItemBase = { id, name: blockType.name, title: blockType.title, icon: blockType.icon, isDisabled, frecency: calculateFrecency(time, count) }; if (buildScope === 'transform') { return blockItemBase; } const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)(blockType.name, 'inserter'); return { ...blockItemBase, initialAttributes: {}, description: blockType.description, category: blockType.category, keywords: blockType.keywords, parent: blockType.parent, ancestor: blockType.ancestor, variations: inserterVariations, example: blockType.example, utility: 1 // Deprecated. }; }; /** * Determines the items that appear in the inserter. Includes both static * items (e.g. a regular block type) and dynamic items (e.g. a reusable block). * * Each item object contains what's necessary to display a button in the * inserter and handle its selection. * * The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency) * that combines block usage frequency and recency. * * Items are returned ordered descendingly by their 'utility' and 'frecency'. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {WPEditorInserterItem[]} Items that appear in inserter. * * @typedef {Object} WPEditorInserterItem * @property {string} id Unique identifier for the item. * @property {string} name The type of block to create. * @property {Object} initialAttributes Attributes to pass to the newly created block. * @property {string} title Title of the item, as it appears in the inserter. * @property {string} icon Dashicon for the item, as it appears in the inserter. * @property {string} category Block category that the item is associated with. * @property {string[]} keywords Keywords that can be searched to find this item. * @property {boolean} isDisabled Whether or not the user should be prevented from inserting * this item. * @property {number} frecency Heuristic that combines frequency and recency. */ const getInserterItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null, options = DEFAULT_INSERTER_OPTIONS) => { const buildReusableBlockInserterItem = reusableBlock => { const icon = !reusableBlock.wp_pattern_sync_status ? { src: library_symbol, foreground: 'var(--wp-block-synced-color)' } : library_symbol; const id = `core/block/${reusableBlock.id}`; const { time, count = 0 } = getInsertUsage(state, id) || {}; const frecency = calculateFrecency(time, count); return { id, name: 'core/block', initialAttributes: { ref: reusableBlock.id }, title: reusableBlock.title?.raw, icon, category: 'reusable', keywords: ['reusable'], isDisabled: false, utility: 1, // Deprecated. frecency, content: reusableBlock.content?.raw, syncStatus: reusableBlock.wp_pattern_sync_status }; }; const syncedPatternInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? unlock(select(STORE_NAME)).getReusableBlocks().map(buildReusableBlockInserterItem) : []; const buildBlockTypeInserterItem = buildBlockTypeItem(state, { buildScope: 'inserter' }); let blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'inserter', true)).map(buildBlockTypeInserterItem); if (options[isFiltered] !== false) { blockTypeInserterItems = blockTypeInserterItems.filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); } else { blockTypeInserterItems = blockTypeInserterItems.filter(blockType => isBlockVisibleInTheInserter(state, blockType, rootClientId)).map(blockType => ({ ...blockType, isAllowedInCurrentRoot: canIncludeBlockTypeInInserter(state, blockType, rootClientId) })); } const items = blockTypeInserterItems.reduce((accumulator, item) => { const { variations = [] } = item; // Exclude any block type item that is to be replaced by a default variation. if (!variations.some(({ isDefault }) => isDefault)) { accumulator.push(item); } if (variations.length) { const variationMapper = getItemFromVariation(state, item); accumulator.push(...variations.map(variationMapper)); } return accumulator; }, []); // Ensure core blocks are prioritized in the returned results, // because third party blocks can be registered earlier than // the core blocks (usually by using the `init` action), // thus affecting the display order. // We don't sort reusable blocks as they are handled differently. const groupByType = (blocks, block) => { const { core, noncore } = blocks; const type = block.name.startsWith('core/') ? core : noncore; type.push(block); return blocks; }; const { core: coreItems, noncore: nonCoreItems } = items.reduce(groupByType, { core: [], noncore: [] }); const sortedBlockTypes = [...coreItems, ...nonCoreItems]; return [...sortedBlockTypes, ...syncedPatternInserterItems]; }, (state, rootClientId) => [(0,external_wp_blocks_namespaceObject.getBlockTypes)(), unlock(select(STORE_NAME)).getReusableBlocks(), state.blocks.order, state.preferences.insertUsage, ...getInsertBlockTypeDependants(select)(state, rootClientId)])); /** * Determines the items that appear in the available block transforms list. * * Each item object contains what's necessary to display a menu item in the * transform list and handle its selection. * * The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency) * that combines block usage frequency and recency. * * Items are returned ordered descendingly by their 'frecency'. * * @param {Object} state Editor state. * @param {Object|Object[]} blocks Block object or array objects. * @param {?string} rootClientId Optional root client ID of block list. * * @return {WPEditorTransformItem[]} Items that appear in inserter. * * @typedef {Object} WPEditorTransformItem * @property {string} id Unique identifier for the item. * @property {string} name The type of block to create. * @property {string} title Title of the item, as it appears in the inserter. * @property {string} icon Dashicon for the item, as it appears in the inserter. * @property {boolean} isDisabled Whether or not the user should be prevented from inserting * this item. * @property {number} frecency Heuristic that combines frequency and recency. */ const getBlockTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blocks, rootClientId = null) => { const normalizedBlocks = Array.isArray(blocks) ? blocks : [blocks]; const buildBlockTypeTransformItem = buildBlockTypeItem(state, { buildScope: 'transform' }); const blockTypeTransformItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem); const itemsByName = Object.fromEntries(Object.entries(blockTypeTransformItems).map(([, value]) => [value.name, value])); const possibleTransforms = (0,external_wp_blocks_namespaceObject.getPossibleBlockTransformations)(normalizedBlocks).reduce((accumulator, block) => { if (itemsByName[block?.name]) { accumulator.push(itemsByName[block.name]); } return accumulator; }, []); return orderBy(possibleTransforms, block => itemsByName[block.name].frecency, 'desc'); }, (state, blocks, rootClientId) => [(0,external_wp_blocks_namespaceObject.getBlockTypes)(), state.preferences.insertUsage, ...getInsertBlockTypeDependants(select)(state, rootClientId)])); /** * Determines whether there are items to show in the inserter. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Items that appear in inserter. */ const hasInserterItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, rootClientId = null) => { const hasBlockType = (0,external_wp_blocks_namespaceObject.getBlockTypes)().some(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); if (hasBlockType) { return true; } const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && unlock(select(STORE_NAME)).getReusableBlocks().length > 0; return hasReusableBlock; }); /** * Returns the list of allowed inserter blocks for inner blocks children. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {Array?} The list of allowed block types. */ const getAllowedBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => { if (!rootClientId) { return; } const blockTypes = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && unlock(select(STORE_NAME)).getReusableBlocks().length > 0; if (hasReusableBlock) { blockTypes.push('core/block'); } return blockTypes; }, (state, rootClientId) => [(0,external_wp_blocks_namespaceObject.getBlockTypes)(), unlock(select(STORE_NAME)).getReusableBlocks(), ...getInsertBlockTypeDependants(select)(state, rootClientId)])); const __experimentalGetAllowedBlocks = (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => { external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetAllowedBlocks', { alternative: 'wp.data.select( "core/block-editor" ).getAllowedBlocks', since: '6.2', version: '6.4' }); return getAllowedBlocks(state, rootClientId); }, (state, rootClientId) => getAllowedBlocks.getDependants(state, rootClientId)); /** * Returns the block to be directly inserted by the block appender. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {WPDirectInsertBlock|undefined} The block type to be directly inserted. * * @typedef {Object} WPDirectInsertBlock * @property {string} name The type of block. * @property {?Object} attributes Attributes to pass to the newly created block. * @property {?Array<string>} attributesToCopy Attributes to be copied from adjacent blocks when inserted. */ function getDirectInsertBlock(state, rootClientId = null) { var _state$blockListSetti; if (!rootClientId) { return; } const { defaultBlock, directInsert } = (_state$blockListSetti = state.blockListSettings[rootClientId]) !== null && _state$blockListSetti !== void 0 ? _state$blockListSetti : {}; if (!defaultBlock || !directInsert) { return; } return defaultBlock; } function __experimentalGetDirectInsertBlock(state, rootClientId = null) { external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock', { alternative: 'wp.data.select( "core/block-editor" ).getDirectInsertBlock', since: '6.3', version: '6.4' }); return getDirectInsertBlock(state, rootClientId); } const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, patternName) => { const pattern = unlock(select(STORE_NAME)).getPatternBySlug(patternName); return pattern ? getParsedPattern(pattern) : null; }); const getAllowedPatternsDependants = select => (state, rootClientId) => [...getAllPatternsDependants(select)(state), ...getInsertBlockTypeDependants(select)(state, rootClientId)]; const patternsWithParsedBlocks = new WeakMap(); function enhancePatternWithParsedBlocks(pattern) { let enhancedPattern = patternsWithParsedBlocks.get(pattern); if (!enhancedPattern) { enhancedPattern = { ...pattern, get blocks() { return getParsedPattern(pattern).blocks; } }; patternsWithParsedBlocks.set(pattern, enhancedPattern); } return enhancedPattern; } /** * Returns the list of allowed patterns for inner blocks children. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional target root client ID. * * @return {Array?} The list of allowed patterns. */ const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => { return (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null, options = DEFAULT_INSERTER_OPTIONS) => { const { getAllPatterns } = unlock(select(STORE_NAME)); const patterns = getAllPatterns(); const { allowedBlockTypes } = getSettings(state); const parsedPatterns = patterns.filter(({ inserter = true }) => !!inserter).map(enhancePatternWithParsedBlocks); const availableParsedPatterns = parsedPatterns.filter(pattern => checkAllowListRecursive(getGrammar(pattern), allowedBlockTypes)); const patternsAllowed = availableParsedPatterns.filter(pattern => getGrammar(pattern).every(({ blockName: name }) => options[isFiltered] !== false ? canInsertBlockType(state, name, rootClientId) : isBlockVisibleInTheInserter(state, name, rootClientId))); return patternsAllowed; }, getAllowedPatternsDependants(select)); }); /** * Returns the list of patterns based on their declared `blockTypes` * and a block's name. * Patterns can use `blockTypes` to integrate in work flows like * suggesting appropriate patterns in a Placeholder state(during insertion) * or blocks transformations. * * @param {Object} state Editor state. * @param {string|string[]} blockNames Block's name or array of block names to find matching patterns. * @param {?string} rootClientId Optional target root client ID. * * @return {Array} The list of matched block patterns based on declared `blockTypes` and block name. */ const getPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blockNames, rootClientId = null) => { if (!blockNames) { return selectors_EMPTY_ARRAY; } const patterns = select(STORE_NAME).__experimentalGetAllowedPatterns(rootClientId); const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; const filteredPatterns = patterns.filter(pattern => pattern?.blockTypes?.some?.(blockName => normalizedBlockNames.includes(blockName))); if (filteredPatterns.length === 0) { return selectors_EMPTY_ARRAY; } return filteredPatterns; }, (state, blockNames, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId))); const __experimentalGetPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => { external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes', { alternative: 'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes', since: '6.2', version: '6.4' }); return select(STORE_NAME).getPatternsByBlockTypes; }); /** * Determines the items that appear in the available pattern transforms list. * * For now we only handle blocks without InnerBlocks and take into account * the `role` property of blocks' attributes for the transformation. * * We return the first set of possible eligible block patterns, * by checking the `blockTypes` property. We still have to recurse through * block pattern's blocks and try to find matches from the selected blocks. * Now this happens in the consumer to avoid heavy operations in the selector. * * @param {Object} state Editor state. * @param {Object[]} blocks The selected blocks. * @param {?string} rootClientId Optional root client ID of block list. * * @return {WPBlockPattern[]} Items that are eligible for a pattern transformation. */ const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blocks, rootClientId = null) => { if (!blocks) { return selectors_EMPTY_ARRAY; } /** * For now we only handle blocks without InnerBlocks and take into account * the `role` property of blocks' attributes for the transformation. * Note that the blocks have been retrieved through `getBlock`, which doesn't * return the inner blocks of an inner block controller, so we still need * to check for this case too. */ if (blocks.some(({ clientId, innerBlocks }) => innerBlocks.length || areInnerBlocksControlled(state, clientId))) { return selectors_EMPTY_ARRAY; } // Create a Set of the selected block names that is used in patterns filtering. const selectedBlockNames = Array.from(new Set(blocks.map(({ name }) => name))); /** * Here we will return first set of possible eligible block patterns, * by checking the `blockTypes` property. We still have to recurse through * block pattern's blocks and try to find matches from the selected blocks. * Now this happens in the consumer to avoid heavy operations in the selector. */ return select(STORE_NAME).getPatternsByBlockTypes(selectedBlockNames, rootClientId); }, (state, blocks, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId))); /** * Returns the Block List settings of a block, if any exist. * * @param {Object} state Editor state. * @param {?string} clientId Block client ID. * * @return {?Object} Block settings of the block if set. */ function getBlockListSettings(state, clientId) { return state.blockListSettings[clientId]; } /** * Returns the editor settings. * * @param {Object} state Editor state. * * @return {Object} The editor settings object. */ function getSettings(state) { return state.settings; } /** * Returns true if the most recent block change is be considered persistent, or * false otherwise. A persistent change is one committed by BlockEditorProvider * via its `onChange` callback, in addition to `onInput`. * * @param {Object} state Block editor state. * * @return {boolean} Whether the most recent block change was persistent. */ function isLastBlockChangePersistent(state) { return state.blocks.isPersistentChange; } /** * Returns the block list settings for an array of blocks, if any exist. * * @param {Object} state Editor state. * @param {Array} clientIds Block client IDs. * * @return {Object} An object where the keys are client ids and the values are * a block list setting object. */ const __experimentalGetBlockListSettingsForBlocks = (0,external_wp_data_namespaceObject.createSelector)((state, clientIds = []) => { return clientIds.reduce((blockListSettingsForBlocks, clientId) => { if (!state.blockListSettings[clientId]) { return blockListSettingsForBlocks; } return { ...blockListSettingsForBlocks, [clientId]: state.blockListSettings[clientId] }; }, {}); }, state => [state.blockListSettings]); /** * Returns the title of a given reusable block * * @param {Object} state Global application state. * @param {number|string} ref The shared block's ID. * * @return {string} The reusable block saved title. */ const __experimentalGetReusableBlockTitle = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, ref) => { external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__experimentalGetReusableBlockTitle", { since: '6.6', version: '6.8' }); const reusableBlock = unlock(select(STORE_NAME)).getReusableBlocks().find(block => block.id === ref); if (!reusableBlock) { return null; } return reusableBlock.title?.raw; }, () => [unlock(select(STORE_NAME)).getReusableBlocks()])); /** * Returns true if the most recent block change is be considered ignored, or * false otherwise. An ignored change is one not to be committed by * BlockEditorProvider, neither via `onChange` nor `onInput`. * * @param {Object} state Block editor state. * * @return {boolean} Whether the most recent block change was ignored. */ function __unstableIsLastBlockChangeIgnored(state) { // TODO: Removal Plan: Changes incurred by RECEIVE_BLOCKS should not be // ignored if in-fact they result in a change in blocks state. The current // need to ignore changes not a result of user interaction should be // accounted for in the refactoring of reusable blocks as occurring within // their own separate block editor / state (#7119). return state.blocks.isIgnoredChange; } /** * Returns the block attributes changed as a result of the last dispatched * action. * * @param {Object} state Block editor state. * * @return {Object<string,Object>} Subsets of block attributes changed, keyed * by block client ID. */ function __experimentalGetLastBlockAttributeChanges(state) { return state.lastBlockAttributesChange; } /** * Returns whether the navigation mode is enabled. * * @param {Object} state Editor state. * * @return {boolean} Is navigation mode enabled. */ function isNavigationMode(state) { return __unstableGetEditorMode(state) === 'navigation'; } /** * Returns the current editor mode. * * @param {Object} state Editor state. * * @return {string} the editor mode. */ const __unstableGetEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { var _state$settings$edito; if (!window?.__experimentalEditorWriteMode) { return 'edit'; } return (_state$settings$edito = state.settings.editorTool) !== null && _state$settings$edito !== void 0 ? _state$settings$edito : select(external_wp_preferences_namespaceObject.store).get('core', 'editorTool'); }); /** * Returns whether block moving mode is enabled. * * @deprecated */ function hasBlockMovingClientId() { external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).hasBlockMovingClientId', { since: '6.7', hint: 'Block moving mode feature has been removed' }); return false; } /** * Returns true if the last change was an automatic change, false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the last change was automatic. */ function didAutomaticChange(state) { return !!state.automaticChangeStatus; } /** * Returns true if the current highlighted block matches the block clientId. * * @param {Object} state Global application state. * @param {string} clientId The block to check. * * @return {boolean} Whether the block is currently highlighted. */ function isBlockHighlighted(state, clientId) { return state.highlightedBlock === clientId; } /** * Checks if a given block has controlled inner blocks. * * @param {Object} state Global application state. * @param {string} clientId The block to check. * * @return {boolean} True if the block has controlled inner blocks. */ function areInnerBlocksControlled(state, clientId) { return !!state.blocks.controlledInnerBlocks[clientId]; } /** * Returns the clientId for the first 'active' block of a given array of block names. * A block is 'active' if it (or a child) is the selected block. * Returns the first match moving up the DOM from the selected block. * * @param {Object} state Global application state. * @param {string[]} validBlocksNames The names of block types to check for. * * @return {string} The matching block's clientId. */ const __experimentalGetActiveBlockIdByBlockNames = (0,external_wp_data_namespaceObject.createSelector)((state, validBlockNames) => { if (!validBlockNames.length) { return null; } // Check if selected block is a valid entity area. const selectedBlockClientId = getSelectedBlockClientId(state); if (validBlockNames.includes(getBlockName(state, selectedBlockClientId))) { return selectedBlockClientId; } // Check if first selected block is a child of a valid entity area. const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state); const entityAreaParents = getBlockParentsByBlockName(state, selectedBlockClientId || multiSelectedBlockClientIds[0], validBlockNames); if (entityAreaParents) { // Last parent closest/most interior. return entityAreaParents[entityAreaParents.length - 1]; } return null; }, (state, validBlockNames) => [state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId, validBlockNames]); /** * Tells if the block with the passed clientId was just inserted. * * @param {Object} state Global application state. * @param {Object} clientId Client Id of the block. * @param {?string} source Optional insertion source of the block. * @return {boolean} True if the block matches the last block inserted from the specified source. */ function wasBlockJustInserted(state, clientId, source) { const { lastBlockInserted } = state; return lastBlockInserted.clientIds?.includes(clientId) && lastBlockInserted.source === source; } /** * Tells if the block is visible on the canvas or not. * * @param {Object} state Global application state. * @param {Object} clientId Client Id of the block. * @return {boolean} True if the block is visible. */ function isBlockVisible(state, clientId) { var _state$blockVisibilit; return (_state$blockVisibilit = state.blockVisibility?.[clientId]) !== null && _state$blockVisibilit !== void 0 ? _state$blockVisibilit : true; } /** * Returns the currently hovered block. * * @param {Object} state Global application state. * @return {Object} Client Id of the hovered block. */ function getHoveredBlockClientId(state) { return state.hoveredBlockClientId; } /** * Returns the list of all hidden blocks. * * @param {Object} state Global application state. * @return {[string]} List of hidden blocks. */ const __unstableGetVisibleBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => { const visibleBlocks = new Set(Object.keys(state.blockVisibility).filter(key => state.blockVisibility[key])); if (visibleBlocks.size === 0) { return EMPTY_SET; } return visibleBlocks; }, state => [state.blockVisibility]); function __unstableHasActiveBlockOverlayActive(state, clientId) { // Prevent overlay on blocks with a non-default editing mode. If the mode is // 'disabled' then the overlay is redundant since the block can't be // selected. If the mode is 'contentOnly' then the overlay is redundant // since there will be no controls to interact with once selected. if (getBlockEditingMode(state, clientId) !== 'default') { return false; } // If the block editing is locked, the block overlay is always active. if (!canEditBlock(state, clientId)) { return true; } // In zoom-out mode, the block overlay is always active for section level blocks. if (isZoomOut(state)) { const sectionRootClientId = getSectionRootClientId(state); if (sectionRootClientId) { const sectionClientIds = getBlockOrder(state, sectionRootClientId); if (sectionClientIds?.includes(clientId)) { return true; } } else if (clientId && !getBlockRootClientId(state, clientId)) { return true; } } // In navigation mode, the block overlay is active when the block is not // selected (and doesn't contain a selected child). The same behavior is // also enabled in all modes for blocks that have controlled children // (reusable block, template part, navigation), unless explicitly disabled // with `supports.__experimentalDisableBlockOverlay`. const blockSupportDisable = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(getBlockName(state, clientId), '__experimentalDisableBlockOverlay', false); const shouldEnableIfUnselected = blockSupportDisable ? false : areInnerBlocksControlled(state, clientId); return shouldEnableIfUnselected && !isBlockSelected(state, clientId) && !hasSelectedInnerBlock(state, clientId, true); } function __unstableIsWithinBlockOverlay(state, clientId) { let parent = state.blocks.parents.get(clientId); while (!!parent) { if (__unstableHasActiveBlockOverlayActive(state, parent)) { return true; } parent = state.blocks.parents.get(parent); } return false; } /** * @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode */ /** * Returns the block editing mode for a given block. * * The mode can be one of three options: * * - `'disabled'`: Prevents editing the block entirely, i.e. it cannot be * selected. * - `'contentOnly'`: Hides all non-content UI, e.g. auxiliary controls in the * toolbar, the block movers, block settings. * - `'default'`: Allows editing the block as normal. * * Blocks can set a mode using the `useBlockEditingMode` hook. * * The mode is inherited by all of the block's inner blocks, unless they have * their own mode. * * A template lock can also set a mode. If the template lock is `'contentOnly'`, * the block's mode is overridden to `'contentOnly'` if the block has a content * role attribute, or `'disabled'` otherwise. * * @see useBlockEditingMode * * @param {Object} state Global application state. * @param {string} clientId The block client ID, or `''` for the root container. * * @return {BlockEditingMode} The block editing mode. One of `'disabled'`, * `'contentOnly'`, or `'default'`. */ const getBlockEditingMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientId = '') => { // Some selectors that call this provide `null` as the default // rootClientId, but the default rootClientId is actually `''`. if (clientId === null) { clientId = ''; } const isNavMode = isNavigationMode(state); // If the editor is currently not in navigation mode, check if the clientId // has an editing mode set in the regular derived map. // There may be an editing mode set here for synced patterns or in zoomed out // mode. if (!isNavMode && state.derivedBlockEditingModes?.has(clientId)) { return state.derivedBlockEditingModes.get(clientId); } // If the editor *is* in navigation mode, the block editing mode states // are stored in the derivedNavModeBlockEditingModes map. if (isNavMode && state.derivedNavModeBlockEditingModes?.has(clientId)) { return state.derivedNavModeBlockEditingModes.get(clientId); } // In normal mode, consider that an explicitly set editing mode takes over. const blockEditingMode = state.blockEditingModes.get(clientId); if (blockEditingMode) { return blockEditingMode; } // In normal mode, top level is default mode. if (clientId === '') { return 'default'; } const rootClientId = getBlockRootClientId(state, clientId); const templateLock = getTemplateLock(state, rootClientId); // If the parent of the block is contentOnly locked, check whether it's a content block. if (templateLock === 'contentOnly') { const name = getBlockName(state, clientId); const { hasContentRoleAttribute } = unlock(select(external_wp_blocks_namespaceObject.store)); const isContent = hasContentRoleAttribute(name); return isContent ? 'contentOnly' : 'disabled'; } return 'default'; }); /** * Indicates if a block is ungroupable. * A block is ungroupable if it is a single grouping block with inner blocks. * If a block has an `ungroup` transform, it is also ungroupable, without the * requirement of being the default grouping block. * Additionally a block can only be ungrouped if it has inner blocks and can * be removed. * * @param {Object} state Global application state. * @param {string} clientId Client Id of the block. If not passed the selected block's client id will be used. * @return {boolean} True if the block is ungroupable. */ const isUngroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientId = '') => { const _clientId = clientId || getSelectedBlockClientId(state); if (!_clientId) { return false; } const { getGroupingBlockName } = select(external_wp_blocks_namespaceObject.store); const block = getBlock(state, _clientId); const groupingBlockName = getGroupingBlockName(); const _isUngroupable = block && (block.name === groupingBlockName || (0,external_wp_blocks_namespaceObject.getBlockType)(block.name)?.transforms?.ungroup) && !!block.innerBlocks.length; return _isUngroupable && canRemoveBlock(state, _clientId); }); /** * Indicates if the provided blocks(by client ids) are groupable. * We need to have at least one block, have a grouping block name set and * be able to remove these blocks. * * @param {Object} state Global application state. * @param {string[]} clientIds Block client ids. If not passed the selected blocks client ids will be used. * @return {boolean} True if the blocks are groupable. */ const isGroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientIds = selectors_EMPTY_ARRAY) => { const { getGroupingBlockName } = select(external_wp_blocks_namespaceObject.store); const groupingBlockName = getGroupingBlockName(); const _clientIds = clientIds?.length ? clientIds : getSelectedBlockClientIds(state); const rootClientId = _clientIds?.length ? getBlockRootClientId(state, _clientIds[0]) : undefined; const groupingBlockAvailable = canInsertBlockType(state, groupingBlockName, rootClientId); const _isGroupable = groupingBlockAvailable && _clientIds.length; return _isGroupable && canRemoveBlocks(state, _clientIds); }); /** * DO-NOT-USE in production. * This selector is created for internal/experimental only usage and may be * removed anytime without any warning, causing breakage on any plugin or theme invoking it. * * @deprecated * * @param {Object} state Global application state. * @param {Object} clientId Client Id of the block. * * @return {?string} Client ID of the ancestor block that is content locking the block. */ const __unstableGetContentLockingParent = (state, clientId) => { external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetContentLockingParent", { since: '6.1', version: '6.7' }); return getContentLockingParent(state, clientId); }; /** * DO-NOT-USE in production. * This selector is created for internal/experimental only usage and may be * removed anytime without any warning, causing breakage on any plugin or theme invoking it. * * @deprecated * * @param {Object} state Global application state. */ function __unstableGetTemporarilyEditingAsBlocks(state) { external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingAsBlocks", { since: '6.1', version: '6.7' }); return getTemporarilyEditingAsBlocks(state); } /** * DO-NOT-USE in production. * This selector is created for internal/experimental only usage and may be * removed anytime without any warning, causing breakage on any plugin or theme invoking it. * * @deprecated * * @param {Object} state Global application state. */ function __unstableGetTemporarilyEditingFocusModeToRevert(state) { external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingFocusModeToRevert", { since: '6.5', version: '6.7' }); return getTemporarilyEditingFocusModeToRevert(state); } ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js /** * WordPress dependencies */ /** * Internal dependencies */ const castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; /** * A list of private/experimental block editor settings that * should not become a part of the WordPress public API. * BlockEditorProvider will remove these settings from the * settings object it receives. * * @see https://github.com/WordPress/gutenberg/pull/46131 */ const privateSettings = ['inserterMediaCategories', 'blockInspectorAnimation', 'mediaSideload']; /** * Action that updates the block editor settings and * conditionally preserves the experimental ones. * * @param {Object} settings Updated settings * @param {Object} options Options object. * @param {boolean} options.stripExperimentalSettings Whether to strip experimental settings. * @param {boolean} options.reset Whether to reset the settings. * @return {Object} Action object */ function __experimentalUpdateSettings(settings, { stripExperimentalSettings = false, reset = false } = {}) { let incomingSettings = settings; if (Object.hasOwn(incomingSettings, '__unstableIsPreviewMode')) { external_wp_deprecated_default()("__unstableIsPreviewMode argument in wp.data.dispatch('core/block-editor').updateSettings", { since: '6.8', alternative: 'isPreviewMode' }); incomingSettings = { ...incomingSettings }; incomingSettings.isPreviewMode = incomingSettings.__unstableIsPreviewMode; delete incomingSettings.__unstableIsPreviewMode; } let cleanSettings = incomingSettings; // There are no plugins in the mobile apps, so there is no // need to strip the experimental settings: if (stripExperimentalSettings && external_wp_element_namespaceObject.Platform.OS === 'web') { cleanSettings = {}; for (const key in incomingSettings) { if (!privateSettings.includes(key)) { cleanSettings[key] = incomingSettings[key]; } } } return { type: 'UPDATE_SETTINGS', settings: cleanSettings, reset }; } /** * Hides the block interface (eg. toolbar, outline, etc.) * * @return {Object} Action object. */ function hideBlockInterface() { return { type: 'HIDE_BLOCK_INTERFACE' }; } /** * Shows the block interface (eg. toolbar, outline, etc.) * * @return {Object} Action object. */ function showBlockInterface() { return { type: 'SHOW_BLOCK_INTERFACE' }; } /** * Yields action objects used in signalling that the blocks corresponding to * the set of specified client IDs are to be removed. * * Compared to `removeBlocks`, this private interface exposes an additional * parameter; see `forceRemove`. * * @param {string|string[]} clientIds Client IDs of blocks to remove. * @param {boolean} selectPrevious True if the previous block * or the immediate parent * (if no previous block exists) * should be selected * when a block is removed. * @param {boolean} forceRemove Whether to force the operation, * bypassing any checks for certain * block types. */ const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemove = false) => ({ select, dispatch, registry }) => { if (!clientIds || !clientIds.length) { return; } clientIds = castArray(clientIds); const canRemoveBlocks = select.canRemoveBlocks(clientIds); if (!canRemoveBlocks) { return; } // In certain editing contexts, we'd like to prevent accidental removal // of important blocks. For example, in the site editor, the Query Loop // block is deemed important. In such cases, we'll ask the user for // confirmation that they intended to remove such block(s). However, // the editor instance is responsible for presenting those confirmation // prompts to the user. Any instance opting into removal prompts must // register using `setBlockRemovalRules()`. // // @see https://github.com/WordPress/gutenberg/pull/51145 const rules = !forceRemove && select.getBlockRemovalRules(); if (rules) { function flattenBlocks(blocks) { const result = []; const stack = [...blocks]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); stack.push(...innerBlocks); result.push(block); } return result; } const blockList = clientIds.map(select.getBlock); const flattenedBlocks = flattenBlocks(blockList); // Find the first message and use it. let message; for (const rule of rules) { message = rule.callback(flattenedBlocks); if (message) { dispatch(displayBlockRemovalPrompt(clientIds, selectPrevious, message)); return; } } } if (selectPrevious) { dispatch.selectPreviousBlock(clientIds[0], selectPrevious); } // We're batching these two actions because an extra `undo/redo` step can // be created, based on whether we insert a default block or not. registry.batch(() => { dispatch({ type: 'REMOVE_BLOCKS', clientIds }); // To avoid a focus loss when removing the last block, assure there is // always a default block if the last of the blocks have been removed. dispatch(ensureDefaultBlock()); }); }; /** * Action which will insert a default block insert action if there * are no other blocks at the root of the editor. This action should be used * in actions which may result in no blocks remaining in the editor (removal, * replacement, etc). */ const ensureDefaultBlock = () => ({ select, dispatch }) => { // To avoid a focus loss when removing the last block, assure there is // always a default block if the last of the blocks have been removed. const count = select.getBlockCount(); if (count > 0) { return; } // If there's an custom appender, don't insert default block. // We have to remember to manually move the focus elsewhere to // prevent it from being lost though. const { __unstableHasCustomAppender } = select.getSettings(); if (__unstableHasCustomAppender) { return; } dispatch.insertDefaultBlock(); }; /** * Returns an action object used in signalling that a block removal prompt must * be displayed. * * Contrast with `setBlockRemovalRules`. * * @param {string|string[]} clientIds Client IDs of blocks to remove. * @param {boolean} selectPrevious True if the previous block or the * immediate parent (if no previous * block exists) should be selected * when a block is removed. * @param {string} message Message to display in the prompt. * * @return {Object} Action object. */ function displayBlockRemovalPrompt(clientIds, selectPrevious, message) { return { type: 'DISPLAY_BLOCK_REMOVAL_PROMPT', clientIds, selectPrevious, message }; } /** * Returns an action object used in signalling that a block removal prompt must * be cleared, either be cause the user has confirmed or canceled the request * for removal. * * @return {Object} Action object. */ function clearBlockRemovalPrompt() { return { type: 'CLEAR_BLOCK_REMOVAL_PROMPT' }; } /** * Returns an action object used to set up any rules that a block editor may * provide in order to prevent a user from accidentally removing certain * blocks. These rules are then used to display a confirmation prompt to the * user. For instance, in the Site Editor, the Query Loop block is important * enough to warrant such confirmation. * * IMPORTANT: Registering rules implicitly signals to the `privateRemoveBlocks` * action that the editor will be responsible for displaying block removal * prompts and confirming deletions. This action is meant to be used by * component `BlockRemovalWarningModal` only. * * The data is a record whose keys are block types (e.g. 'core/query') and * whose values are the explanation to be shown to users (e.g. 'Query Loop * displays a list of posts or pages.'). * * Contrast with `displayBlockRemovalPrompt`. * * @param {Record<string,string>|false} rules Block removal rules. * @return {Object} Action object. */ function setBlockRemovalRules(rules = false) { return { type: 'SET_BLOCK_REMOVAL_RULES', rules }; } /** * Sets the client ID of the block settings menu that is currently open. * * @param {?string} clientId The block client ID. * @return {Object} Action object. */ function setOpenedBlockSettingsMenu(clientId) { return { type: 'SET_OPENED_BLOCK_SETTINGS_MENU', clientId }; } function setStyleOverride(id, style) { return { type: 'SET_STYLE_OVERRIDE', id, style }; } function deleteStyleOverride(id) { return { type: 'DELETE_STYLE_OVERRIDE', id }; } /** * Action that sets the element that had focus when focus leaves the editor canvas. * * @param {Object} lastFocus The last focused element. * * * @return {Object} Action object. */ function setLastFocus(lastFocus = null) { return { type: 'LAST_FOCUS', lastFocus }; } /** * Action that stops temporarily editing as blocks. * * @param {string} clientId The block's clientId. */ function stopEditingAsBlocks(clientId) { return ({ select, dispatch, registry }) => { const focusModeToRevert = unlock(registry.select(store)).getTemporarilyEditingFocusModeToRevert(); dispatch.__unstableMarkNextChangeAsNotPersistent(); dispatch.updateBlockAttributes(clientId, { templateLock: 'contentOnly' }); dispatch.updateBlockListSettings(clientId, { ...select.getBlockListSettings(clientId), templateLock: 'contentOnly' }); dispatch.updateSettings({ focusMode: focusModeToRevert }); dispatch.__unstableSetTemporarilyEditingAsBlocks(); }; } /** * Returns an action object used in signalling that the user has begun to drag. * * @return {Object} Action object. */ function startDragging() { return { type: 'START_DRAGGING' }; } /** * Returns an action object used in signalling that the user has stopped dragging. * * @return {Object} Action object. */ function stopDragging() { return { type: 'STOP_DRAGGING' }; } /** * @param {string|null} clientId The block's clientId, or `null` to clear. * * @return {Object} Action object. */ function expandBlock(clientId) { return { type: 'SET_BLOCK_EXPANDED_IN_LIST_VIEW', clientId }; } /** * @param {Object} value * @param {string} value.rootClientId The root client ID to insert at. * @param {number} value.index The index to insert at. * * @return {Object} Action object. */ function setInsertionPoint(value) { return { type: 'SET_INSERTION_POINT', value }; } /** * Temporarily modify/unlock the content-only block for editions. * * @param {string} clientId The client id of the block. */ const modifyContentLockBlock = clientId => ({ select, dispatch }) => { dispatch.selectBlock(clientId); dispatch.__unstableMarkNextChangeAsNotPersistent(); dispatch.updateBlockAttributes(clientId, { templateLock: undefined }); dispatch.updateBlockListSettings(clientId, { ...select.getBlockListSettings(clientId), templateLock: false }); const focusModeToRevert = select.getSettings().focusMode; dispatch.updateSettings({ focusMode: true }); dispatch.__unstableSetTemporarilyEditingAsBlocks(clientId, focusModeToRevert); }; /** * Sets the zoom level. * * @param {number} zoom the new zoom level * @return {Object} Action object. */ const setZoomLevel = (zoom = 100) => ({ select, dispatch }) => { // When switching to zoom-out mode, we need to select the parent section if (zoom !== 100) { const firstSelectedClientId = select.getBlockSelectionStart(); const sectionRootClientId = select.getSectionRootClientId(); if (firstSelectedClientId) { let sectionClientId; if (sectionRootClientId) { const sectionClientIds = select.getBlockOrder(sectionRootClientId); // If the selected block is a section block, use it. if (sectionClientIds?.includes(firstSelectedClientId)) { sectionClientId = firstSelectedClientId; } else { // If the selected block is not a section block, find // the parent section that contains the selected block. sectionClientId = select.getBlockParents(firstSelectedClientId).find(parent => sectionClientIds.includes(parent)); } } else { sectionClientId = select.getBlockHierarchyRootClientId(firstSelectedClientId); } if (sectionClientId) { dispatch.selectBlock(sectionClientId); } else { dispatch.clearSelectedBlock(); } (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('You are currently in zoom-out mode.')); } } dispatch({ type: 'SET_ZOOM_LEVEL', zoom }); }; /** * Resets the Zoom state. * @return {Object} Action object. */ function resetZoomLevel() { return { type: 'RESET_ZOOM_LEVEL' }; } ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// ./node_modules/@wordpress/block-editor/build-module/utils/selection.js /** * WordPress dependencies */ /** * A robust way to retain selection position through various * transforms is to insert a special character at the position and * then recover it. */ const START_OF_SELECTED_AREA = '\u0086'; /** * Retrieve the block attribute that contains the selection position. * * @param {Object} blockAttributes Block attributes. * @return {string|void} The name of the block attribute that was previously selected. */ function retrieveSelectedAttribute(blockAttributes) { if (!blockAttributes) { return; } return Object.keys(blockAttributes).find(name => { const value = blockAttributes[name]; return (typeof value === 'string' || value instanceof external_wp_richText_namespaceObject.RichTextData) && // To do: refactor this to use rich text's selection instead, so we // no longer have to use on this hack inserting a special character. value.toString().indexOf(START_OF_SELECTED_AREA) !== -1; }); } function findRichTextAttributeKey(blockType) { for (const [key, value] of Object.entries(blockType.attributes)) { if (value.source === 'rich-text' || value.source === 'html') { return key; } } } ;// ./node_modules/@wordpress/block-editor/build-module/store/actions.js /* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */ /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('../components/use-on-block-drop/types').WPDropOperation} WPDropOperation */ const actions_castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; /** * Action that resets blocks state to the specified array of blocks, taking precedence * over any other content reflected as an edit in state. * * @param {Array} blocks Array of blocks. */ const resetBlocks = blocks => ({ dispatch }) => { dispatch({ type: 'RESET_BLOCKS', blocks }); dispatch(validateBlocksToTemplate(blocks)); }; /** * Block validity is a function of blocks state (at the point of a * reset) and the template setting. As a compromise to its placement * across distinct parts of state, it is implemented here as a side * effect of the block reset action. * * @param {Array} blocks Array of blocks. */ const validateBlocksToTemplate = blocks => ({ select, dispatch }) => { const template = select.getTemplate(); const templateLock = select.getTemplateLock(); // Unlocked templates are considered always valid because they act // as default values only. const isBlocksValidToTemplate = !template || templateLock !== 'all' || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template); // Update if validity has changed. const isValidTemplate = select.isValidTemplate(); if (isBlocksValidToTemplate !== isValidTemplate) { dispatch.setTemplateValidity(isBlocksValidToTemplate); return isBlocksValidToTemplate; } }; /** * A block selection object. * * @typedef {Object} WPBlockSelection * * @property {string} clientId A block client ID. * @property {string} attributeKey A block attribute key. * @property {number} offset An attribute value offset, based on the rich * text value. See `wp.richText.create`. */ /** * A selection object. * * @typedef {Object} WPSelection * * @property {WPBlockSelection} start The selection start. * @property {WPBlockSelection} end The selection end. */ /* eslint-disable jsdoc/valid-types */ /** * Returns an action object used in signalling that selection state should be * reset to the specified selection. * * @param {WPBlockSelection} selectionStart The selection start. * @param {WPBlockSelection} selectionEnd The selection end. * @param {0|-1|null} initialPosition Initial block position. * * @return {Object} Action object. */ function resetSelection(selectionStart, selectionEnd, initialPosition) { /* eslint-enable jsdoc/valid-types */ return { type: 'RESET_SELECTION', selectionStart, selectionEnd, initialPosition }; } /** * Returns an action object used in signalling that blocks have been received. * Unlike resetBlocks, these should be appended to the existing known set, not * replacing. * * @deprecated * * @param {Object[]} blocks Array of block objects. * * @return {Object} Action object. */ function receiveBlocks(blocks) { external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).receiveBlocks', { since: '5.9', alternative: 'resetBlocks or insertBlocks' }); return { type: 'RECEIVE_BLOCKS', blocks }; } /** * Action that updates attributes of multiple blocks with the specified client IDs. * * @param {string|string[]} clientIds Block client IDs. * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if * uniqueByBlock is true. * @param {boolean} uniqueByBlock true if each block in clientIds array has a unique set of attributes * @return {Object} Action object. */ function updateBlockAttributes(clientIds, attributes, uniqueByBlock = false) { return { type: 'UPDATE_BLOCK_ATTRIBUTES', clientIds: actions_castArray(clientIds), attributes, uniqueByBlock }; } /** * Action that updates the block with the specified client ID. * * @param {string} clientId Block client ID. * @param {Object} updates Block attributes to be merged. * * @return {Object} Action object. */ function updateBlock(clientId, updates) { return { type: 'UPDATE_BLOCK', clientId, updates }; } /* eslint-disable jsdoc/valid-types */ /** * Returns an action object used in signalling that the block with the * specified client ID has been selected, optionally accepting a position * value reflecting its selection directionality. An initialPosition of -1 * reflects a reverse selection. * * @param {string} clientId Block client ID. * @param {0|-1|null} initialPosition Optional initial position. Pass as -1 to * reflect reverse selection. * * @return {Object} Action object. */ function selectBlock(clientId, initialPosition = 0) { /* eslint-enable jsdoc/valid-types */ return { type: 'SELECT_BLOCK', initialPosition, clientId }; } /** * Returns an action object used in signalling that the block with the * specified client ID has been hovered. * * @param {string} clientId Block client ID. * * @return {Object} Action object. */ function hoverBlock(clientId) { return { type: 'HOVER_BLOCK', clientId }; } /** * Yields action objects used in signalling that the block preceding the given * clientId (or optionally, its first parent from bottom to top) * should be selected. * * @param {string} clientId Block client ID. * @param {boolean} fallbackToParent If true, select the first parent if there is no previous block. */ const selectPreviousBlock = (clientId, fallbackToParent = false) => ({ select, dispatch }) => { const previousBlockClientId = select.getPreviousBlockClientId(clientId); if (previousBlockClientId) { dispatch.selectBlock(previousBlockClientId, -1); } else if (fallbackToParent) { const firstParentClientId = select.getBlockRootClientId(clientId); if (firstParentClientId) { dispatch.selectBlock(firstParentClientId, -1); } } }; /** * Yields action objects used in signalling that the block following the given * clientId should be selected. * * @param {string} clientId Block client ID. */ const selectNextBlock = clientId => ({ select, dispatch }) => { const nextBlockClientId = select.getNextBlockClientId(clientId); if (nextBlockClientId) { dispatch.selectBlock(nextBlockClientId); } }; /** * Action that starts block multi-selection. * * @return {Object} Action object. */ function startMultiSelect() { return { type: 'START_MULTI_SELECT' }; } /** * Action that stops block multi-selection. * * @return {Object} Action object. */ function stopMultiSelect() { return { type: 'STOP_MULTI_SELECT' }; } /** * Action that changes block multi-selection. * * @param {string} start First block of the multi selection. * @param {string} end Last block of the multiselection. * @param {number|null} __experimentalInitialPosition Optional initial position. Pass as null to skip focus within editor canvas. */ const multiSelect = (start, end, __experimentalInitialPosition = 0) => ({ select, dispatch }) => { const startBlockRootClientId = select.getBlockRootClientId(start); const endBlockRootClientId = select.getBlockRootClientId(end); // Only allow block multi-selections at the same level. if (startBlockRootClientId !== endBlockRootClientId) { return; } dispatch({ type: 'MULTI_SELECT', start, end, initialPosition: __experimentalInitialPosition }); const blockCount = select.getSelectedBlockCount(); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: number of selected blocks */ (0,external_wp_i18n_namespaceObject._n)('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive'); }; /** * Action that clears the block selection. * * @return {Object} Action object. */ function clearSelectedBlock() { return { type: 'CLEAR_SELECTED_BLOCK' }; } /** * Action that enables or disables block selection. * * @param {boolean} [isSelectionEnabled=true] Whether block selection should * be enabled. * * @return {Object} Action object. */ function toggleSelection(isSelectionEnabled = true) { return { type: 'TOGGLE_SELECTION', isSelectionEnabled }; } /* eslint-disable jsdoc/valid-types */ /** * Action that replaces given blocks with one or more replacement blocks. * * @param {(string|string[])} clientIds Block client ID(s) to replace. * @param {(Object|Object[])} blocks Replacement block(s). * @param {number} indexToSelect Index of replacement block to select. * @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation. * @param {?Object} meta Optional Meta values to be passed to the action object. * * @return {Object} Action object. */ const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({ select, dispatch, registry }) => { /* eslint-enable jsdoc/valid-types */ clientIds = actions_castArray(clientIds); blocks = actions_castArray(blocks); const rootClientId = select.getBlockRootClientId(clientIds[0]); // Replace is valid if the new blocks can be inserted in the root block. for (let index = 0; index < blocks.length; index++) { const block = blocks[index]; const canInsertBlock = select.canInsertBlockType(block.name, rootClientId); if (!canInsertBlock) { return; } } // We're batching these two actions because an extra `undo/redo` step can // be created, based on whether we insert a default block or not. registry.batch(() => { dispatch({ type: 'REPLACE_BLOCKS', clientIds, blocks, time: Date.now(), indexToSelect, initialPosition, meta }); // To avoid a focus loss when removing the last block, assure there is // always a default block if the last of the blocks have been removed. dispatch.ensureDefaultBlock(); }); }; /** * Action that replaces a single block with one or more replacement blocks. * * @param {(string|string[])} clientId Block client ID to replace. * @param {(Object|Object[])} block Replacement block(s). * * @return {Object} Action object. */ function replaceBlock(clientId, block) { return replaceBlocks(clientId, block); } /** * Higher-order action creator which, given the action type to dispatch creates * an action creator for managing block movement. * * @param {string} type Action type to dispatch. * * @return {Function} Action creator. */ const createOnMove = type => (clientIds, rootClientId) => ({ select, dispatch }) => { // If one of the blocks is locked or the parent is locked, we cannot move any block. const canMoveBlocks = select.canMoveBlocks(clientIds); if (!canMoveBlocks) { return; } dispatch({ type, clientIds: actions_castArray(clientIds), rootClientId }); }; const moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN'); const moveBlocksUp = createOnMove('MOVE_BLOCKS_UP'); /** * Action that moves given blocks to a new position. * * @param {?string} clientIds The client IDs of the blocks. * @param {?string} fromRootClientId Root client ID source. * @param {?string} toRootClientId Root client ID destination. * @param {number} index The index to move the blocks to. */ const moveBlocksToPosition = (clientIds, fromRootClientId = '', toRootClientId = '', index) => ({ select, dispatch }) => { const canMoveBlocks = select.canMoveBlocks(clientIds); // If one of the blocks is locked or the parent is locked, we cannot move any block. if (!canMoveBlocks) { return; } // If moving inside the same root block the move is always possible. if (fromRootClientId !== toRootClientId) { const canRemoveBlocks = select.canRemoveBlocks(clientIds); // If we're moving to another block, it means we're deleting blocks from // the original block, so we need to check if removing is possible. if (!canRemoveBlocks) { return; } const canInsertBlocks = select.canInsertBlocks(clientIds, toRootClientId); // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block. if (!canInsertBlocks) { return; } } dispatch({ type: 'MOVE_BLOCKS_TO_POSITION', fromRootClientId, toRootClientId, clientIds, index }); }; /** * Action that moves given block to a new position. * * @param {?string} clientId The client ID of the block. * @param {?string} fromRootClientId Root client ID source. * @param {?string} toRootClientId Root client ID destination. * @param {number} index The index to move the block to. */ function moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId = '', index) { return moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index); } /** * Action that inserts a single block, optionally at a specific index respective a root block list. * * Only allowed blocks are inserted. The action may fail silently for blocks that are not allowed or if * a templateLock is active on the block list. * * @param {Object} block Block object to insert. * @param {?number} index Index at which block should be inserted. * @param {?string} rootClientId Optional root client ID of block list on which to insert. * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true. * @param {?Object} meta Optional Meta values to be passed to the action object. * * @return {Object} Action object. */ function insertBlock(block, index, rootClientId, updateSelection, meta) { return insertBlocks([block], index, rootClientId, updateSelection, 0, meta); } /* eslint-disable jsdoc/valid-types */ /** * Action that inserts an array of blocks, optionally at a specific index respective a root block list. * * Only allowed blocks are inserted. The action may fail silently for blocks that are not allowed or if * a templateLock is active on the block list. * * @param {Object[]} blocks Block objects to insert. * @param {?number} index Index at which block should be inserted. * @param {?string} rootClientId Optional root client ID of block list on which to insert. * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true. * @param {0|-1|null} initialPosition Initial focus position. Setting it to null prevent focusing the inserted block. * @param {?Object} meta Optional Meta values to be passed to the action object. * * @return {Object} Action object. */ const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) => ({ select, dispatch }) => { /* eslint-enable jsdoc/valid-types */ if (initialPosition !== null && typeof initialPosition === 'object') { meta = initialPosition; initialPosition = 0; external_wp_deprecated_default()("meta argument in wp.data.dispatch('core/block-editor')", { since: '5.8', hint: 'The meta argument is now the 6th argument of the function' }); } blocks = actions_castArray(blocks); const allowedBlocks = []; for (const block of blocks) { const isValid = select.canInsertBlockType(block.name, rootClientId); if (isValid) { allowedBlocks.push(block); } } if (allowedBlocks.length) { dispatch({ type: 'INSERT_BLOCKS', blocks: allowedBlocks, index, rootClientId, time: Date.now(), updateSelection, initialPosition: updateSelection ? initialPosition : null, meta }); } }; /** * Action that shows the insertion point. * * @param {?string} rootClientId Optional root client ID of block list on * which to insert. * @param {?number} index Index at which block should be inserted. * @param {?Object} __unstableOptions Additional options. * @property {boolean} __unstableWithInserter Whether or not to show an inserter button. * @property {WPDropOperation} operation The operation to perform when applied, * either 'insert' or 'replace' for now. * * @return {Object} Action object. */ function showInsertionPoint(rootClientId, index, __unstableOptions = {}) { const { __unstableWithInserter, operation, nearestSide } = __unstableOptions; return { type: 'SHOW_INSERTION_POINT', rootClientId, index, __unstableWithInserter, operation, nearestSide }; } /** * Action that hides the insertion point. */ const hideInsertionPoint = () => ({ select, dispatch }) => { if (!select.isBlockInsertionPointVisible()) { return; } dispatch({ type: 'HIDE_INSERTION_POINT' }); }; /** * Action that resets the template validity. * * @param {boolean} isValid template validity flag. * * @return {Object} Action object. */ function setTemplateValidity(isValid) { return { type: 'SET_TEMPLATE_VALIDITY', isValid }; } /** * Action that synchronizes the template with the list of blocks. * * @return {Object} Action object. */ const synchronizeTemplate = () => ({ select, dispatch }) => { dispatch({ type: 'SYNCHRONIZE_TEMPLATE' }); const blocks = select.getBlocks(); const template = select.getTemplate(); const updatedBlockList = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); dispatch.resetBlocks(updatedBlockList); }; /** * Delete the current selection. * * @param {boolean} isForward */ const __unstableDeleteSelection = isForward => ({ registry, select, dispatch }) => { const selectionAnchor = select.getSelectionStart(); const selectionFocus = select.getSelectionEnd(); if (selectionAnchor.clientId === selectionFocus.clientId) { return; } // It's not mergeable if there's no rich text selection. if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') { return false; } const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId); const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not mergeable if the selection doesn't start and end in the same // block list. Maybe in the future it should be allowed. if (anchorRootClientId !== focusRootClientId) { return; } const blockOrder = select.getBlockOrder(anchorRootClientId); const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order. let selectionStart, selectionEnd; if (anchorIndex > focusIndex) { selectionStart = selectionFocus; selectionEnd = selectionAnchor; } else { selectionStart = selectionAnchor; selectionEnd = selectionFocus; } const targetSelection = isForward ? selectionEnd : selectionStart; const targetBlock = select.getBlock(targetSelection.clientId); const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlock.name); if (!targetBlockType.merge) { return; } const selectionA = selectionStart; const selectionB = selectionEnd; const blockA = select.getBlock(selectionA.clientId); const blockB = select.getBlock(selectionB.clientId); const htmlA = blockA.attributes[selectionA.attributeKey]; const htmlB = blockB.attributes[selectionB.attributeKey]; let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB }); valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length); valueB = (0,external_wp_richText_namespaceObject.insert)(valueB, START_OF_SELECTED_AREA, 0, selectionB.offset); // Clone the blocks so we don't manipulate the original. const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA, { [selectionA.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA }) }); const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB, { [selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB }) }); const followingBlock = isForward ? cloneA : cloneB; // We can only merge blocks with similar types // thus, we transform the block to merge first const blocksWithTheSameType = blockA.name === blockB.name ? [followingBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(followingBlock, targetBlockType.name); // If the block types can not match, do nothing if (!blocksWithTheSameType || !blocksWithTheSameType.length) { return; } let updatedAttributes; if (isForward) { const blockToMerge = blocksWithTheSameType.pop(); updatedAttributes = targetBlockType.merge(blockToMerge.attributes, cloneB.attributes); } else { const blockToMerge = blocksWithTheSameType.shift(); updatedAttributes = targetBlockType.merge(cloneA.attributes, blockToMerge.attributes); } const newAttributeKey = retrieveSelectedAttribute(updatedAttributes); const convertedHtml = updatedAttributes[newAttributeKey]; const convertedValue = (0,external_wp_richText_namespaceObject.create)({ html: convertedHtml }); const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA); const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1); const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: newValue }); updatedAttributes[newAttributeKey] = newHtml; const selectedBlockClientIds = select.getSelectedBlockClientIds(); const replacement = [...(isForward ? blocksWithTheSameType : []), { // Preserve the original client ID. ...targetBlock, attributes: { ...targetBlock.attributes, ...updatedAttributes } }, ...(isForward ? [] : blocksWithTheSameType)]; registry.batch(() => { dispatch.selectionChange(targetBlock.clientId, newAttributeKey, newOffset, newOffset); dispatch.replaceBlocks(selectedBlockClientIds, replacement, 0, // If we don't pass the `indexToSelect` it will default to the last block. select.getSelectedBlocksInitialCaretPosition()); }); }; /** * Split the current selection. * @param {?Array} blocks */ const __unstableSplitSelection = (blocks = []) => ({ registry, select, dispatch }) => { const selectionAnchor = select.getSelectionStart(); const selectionFocus = select.getSelectionEnd(); const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId); const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not splittable if the selection doesn't start and end in the same // block list. Maybe in the future it should be allowed. if (anchorRootClientId !== focusRootClientId) { return; } const blockOrder = select.getBlockOrder(anchorRootClientId); const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order. let selectionStart, selectionEnd; if (anchorIndex > focusIndex) { selectionStart = selectionFocus; selectionEnd = selectionAnchor; } else { selectionStart = selectionAnchor; selectionEnd = selectionFocus; } const selectionA = selectionStart; const selectionB = selectionEnd; const blockA = select.getBlock(selectionA.clientId); const blockB = select.getBlock(selectionB.clientId); const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); const attributeKeyA = typeof selectionA.attributeKey === 'string' ? selectionA.attributeKey : findRichTextAttributeKey(blockAType); const attributeKeyB = typeof selectionB.attributeKey === 'string' ? selectionB.attributeKey : findRichTextAttributeKey(blockBType); const blockAttributes = select.getBlockAttributes(selectionA.clientId); const bindings = blockAttributes?.metadata?.bindings; // If the attribute is bound, don't split the selection and insert a new block instead. if (bindings?.[attributeKeyA]) { // Show warning if user tries to insert a block into another block with bindings. if (blocks.length) { const { createWarningNotice } = registry.dispatch(external_wp_notices_namespaceObject.store); createWarningNotice((0,external_wp_i18n_namespaceObject.__)("Blocks can't be inserted into other blocks with bindings"), { type: 'snackbar' }); return; } dispatch.insertAfterBlock(selectionA.clientId); return; } // Can't split if the selection is not set. if (!attributeKeyA || !attributeKeyB || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') { return; } // We can do some short-circuiting if the selection is collapsed. if (selectionA.clientId === selectionB.clientId && attributeKeyA === attributeKeyB && selectionA.offset === selectionB.offset) { // If an unmodified default block is selected, replace it. We don't // want to be converting into a default block. if (blocks.length) { if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) { dispatch.replaceBlocks([selectionA.clientId], blocks, blocks.length - 1, -1); return; } } // If selection is at the start or end, we can simply insert an // empty block, provided this block has no inner blocks. else if (!select.getBlockOrder(selectionA.clientId).length) { function createEmpty() { const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); return select.canInsertBlockType(defaultBlockName, anchorRootClientId) ? (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName) : (0,external_wp_blocks_namespaceObject.createBlock)(select.getBlockName(selectionA.clientId)); } const length = blockAttributes[attributeKeyA].length; if (selectionA.offset === 0 && length) { dispatch.insertBlocks([createEmpty()], select.getBlockIndex(selectionA.clientId), anchorRootClientId, false); return; } if (selectionA.offset === length) { dispatch.insertBlocks([createEmpty()], select.getBlockIndex(selectionA.clientId) + 1, anchorRootClientId); return; } } } const htmlA = blockA.attributes[attributeKeyA]; const htmlB = blockB.attributes[attributeKeyB]; let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB }); valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length); valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, 0, selectionB.offset); let head = { // Preserve the original client ID. ...blockA, // If both start and end are the same, should only copy innerBlocks // once. innerBlocks: blockA.clientId === blockB.clientId ? [] : blockA.innerBlocks, attributes: { ...blockA.attributes, [attributeKeyA]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA }) } }; let tail = { ...blockB, // Only preserve the original client ID if the end is different. clientId: blockA.clientId === blockB.clientId ? (0,external_wp_blocks_namespaceObject.createBlock)(blockB.name).clientId : blockB.clientId, attributes: { ...blockB.attributes, [attributeKeyB]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB }) } }; // When splitting a block, attempt to convert the tail block to the // default block type. For example, when splitting a heading block, the // tail block will be converted to a paragraph block. Note that for // blocks such as a list item and button, this will be skipped because // the default block type cannot be inserted. const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); if ( // A block is only split when the selection is within the same // block. blockA.clientId === blockB.clientId && defaultBlockName && tail.name !== defaultBlockName && select.canInsertBlockType(defaultBlockName, anchorRootClientId)) { const switched = (0,external_wp_blocks_namespaceObject.switchToBlockType)(tail, defaultBlockName); if (switched?.length === 1) { tail = switched[0]; } } if (!blocks.length) { dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [head, tail]); return; } let selection; const output = []; const clonedBlocks = [...blocks]; const firstBlock = clonedBlocks.shift(); const headType = (0,external_wp_blocks_namespaceObject.getBlockType)(head.name); const firstBlocks = headType.merge && firstBlock.name === headType.name ? [firstBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(firstBlock, headType.name); if (firstBlocks?.length) { const first = firstBlocks.shift(); head = { ...head, attributes: { ...head.attributes, ...headType.merge(head.attributes, first.attributes) } }; output.push(head); selection = { clientId: head.clientId, attributeKey: attributeKeyA, offset: (0,external_wp_richText_namespaceObject.create)({ html: head.attributes[attributeKeyA] }).text.length }; clonedBlocks.unshift(...firstBlocks); } else { if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(head)) { output.push(head); } output.push(firstBlock); } const lastBlock = clonedBlocks.pop(); const tailType = (0,external_wp_blocks_namespaceObject.getBlockType)(tail.name); if (clonedBlocks.length) { output.push(...clonedBlocks); } if (lastBlock) { const lastBlocks = tailType.merge && tailType.name === lastBlock.name ? [lastBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(lastBlock, tailType.name); if (lastBlocks?.length) { const last = lastBlocks.pop(); output.push({ ...tail, attributes: { ...tail.attributes, ...tailType.merge(last.attributes, tail.attributes) } }); output.push(...lastBlocks); selection = { clientId: tail.clientId, attributeKey: attributeKeyB, offset: (0,external_wp_richText_namespaceObject.create)({ html: last.attributes[attributeKeyB] }).text.length }; } else { output.push(lastBlock); if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) { output.push(tail); } } } else if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) { output.push(tail); } registry.batch(() => { dispatch.replaceBlocks(select.getSelectedBlockClientIds(), output, output.length - 1, 0); if (selection) { dispatch.selectionChange(selection.clientId, selection.attributeKey, selection.offset, selection.offset); } }); }; /** * Expand the selection to cover the entire blocks, removing partial selection. */ const __unstableExpandSelection = () => ({ select, dispatch }) => { const selectionAnchor = select.getSelectionStart(); const selectionFocus = select.getSelectionEnd(); dispatch.selectionChange({ start: { clientId: selectionAnchor.clientId }, end: { clientId: selectionFocus.clientId } }); }; /** * Action that merges two blocks. * * @param {string} firstBlockClientId Client ID of the first block to merge. * @param {string} secondBlockClientId Client ID of the second block to merge. */ const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({ registry, select, dispatch }) => { const clientIdA = firstBlockClientId; const clientIdB = secondBlockClientId; const blockA = select.getBlock(clientIdA); const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); if (!blockAType) { return; } const blockB = select.getBlock(clientIdB); if (!blockAType.merge && (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockA.name, '__experimentalOnMerge')) { // If there's no merge function defined, attempt merging inner // blocks. const blocksWithTheSameType = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blockB, blockAType.name); // Only focus the previous block if it's not mergeable. if (blocksWithTheSameType?.length !== 1) { dispatch.selectBlock(blockA.clientId); return; } const [blockWithSameType] = blocksWithTheSameType; if (blockWithSameType.innerBlocks.length < 1) { dispatch.selectBlock(blockA.clientId); return; } registry.batch(() => { dispatch.insertBlocks(blockWithSameType.innerBlocks, undefined, clientIdA); dispatch.removeBlock(clientIdB); dispatch.selectBlock(blockWithSameType.innerBlocks[0].clientId); // Attempt to merge the next block if it's the same type and // same attributes. This is useful when merging a paragraph into // a list, and the next block is also a list. If we don't merge, // it looks like one list, but it's actually two lists. The same // applies to other blocks such as a group with the same // attributes. const nextBlockClientId = select.getNextBlockClientId(clientIdA); if (nextBlockClientId && select.getBlockName(clientIdA) === select.getBlockName(nextBlockClientId)) { const rootAttributes = select.getBlockAttributes(clientIdA); const previousRootAttributes = select.getBlockAttributes(nextBlockClientId); if (Object.keys(rootAttributes).every(key => rootAttributes[key] === previousRootAttributes[key])) { dispatch.moveBlocksToPosition(select.getBlockOrder(nextBlockClientId), nextBlockClientId, clientIdA); dispatch.removeBlock(nextBlockClientId, false); } } }); return; } if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) { dispatch.removeBlock(clientIdA, select.isBlockSelected(clientIdA)); return; } if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockB)) { dispatch.removeBlock(clientIdB, select.isBlockSelected(clientIdB)); return; } if (!blockAType.merge) { dispatch.selectBlock(blockA.clientId); return; } const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); const { clientId, attributeKey, offset } = select.getSelectionStart(); const selectedBlockType = clientId === clientIdA ? blockAType : blockBType; const attributeDefinition = selectedBlockType.attributes[attributeKey]; const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier // is not a defined block attribute key. This can be the case if the // fallback instance ID is used to store selection (and no RichText // identifier is set), or when the identifier is wrong. !!attributeDefinition; if (!attributeDefinition) { if (typeof attributeKey === 'number') { window.console.error(`RichText needs an identifier prop that is the block attribute key of the attribute it controls. Its type is expected to be a string, but was ${typeof attributeKey}`); } else { window.console.error('The RichText identifier prop does not match any attributes defined by the block.'); } } // Clone the blocks so we don't insert the character in a "live" block. const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA); const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB); if (canRestoreTextSelection) { const selectedBlock = clientId === clientIdA ? cloneA : cloneB; const html = selectedBlock.attributes[attributeKey]; const value = (0,external_wp_richText_namespaceObject.insert)((0,external_wp_richText_namespaceObject.create)({ html }), START_OF_SELECTED_AREA, offset, offset); selectedBlock.attributes[attributeKey] = (0,external_wp_richText_namespaceObject.toHTMLString)({ value }); } // We can only merge blocks with similar types // thus, we transform the block to merge first. const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(cloneB, blockA.name); // If the block types can not match, do nothing. if (!blocksWithTheSameType || !blocksWithTheSameType.length) { return; } // Calling the merge to update the attributes and remove the block to be merged. const updatedAttributes = blockAType.merge(cloneA.attributes, blocksWithTheSameType[0].attributes); if (canRestoreTextSelection) { const newAttributeKey = retrieveSelectedAttribute(updatedAttributes); const convertedHtml = updatedAttributes[newAttributeKey]; const convertedValue = (0,external_wp_richText_namespaceObject.create)({ html: convertedHtml }); const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA); const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1); const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: newValue }); updatedAttributes[newAttributeKey] = newHtml; dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset); } dispatch.replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA, attributes: { ...blockA.attributes, ...updatedAttributes } }, ...blocksWithTheSameType.slice(1)], 0 // If we don't pass the `indexToSelect` it will default to the last block. ); }; /** * Yields action objects used in signalling that the blocks corresponding to * the set of specified client IDs are to be removed. * * @param {string|string[]} clientIds Client IDs of blocks to remove. * @param {boolean} selectPrevious True if the previous block * or the immediate parent * (if no previous block exists) * should be selected * when a block is removed. */ const removeBlocks = (clientIds, selectPrevious = true) => privateRemoveBlocks(clientIds, selectPrevious); /** * Returns an action object used in signalling that the block with the * specified client ID is to be removed. * * @param {string} clientId Client ID of block to remove. * @param {boolean} selectPrevious True if the previous block should be * selected when a block is removed. * * @return {Object} Action object. */ function removeBlock(clientId, selectPrevious) { return removeBlocks([clientId], selectPrevious); } /* eslint-disable jsdoc/valid-types */ /** * Returns an action object used in signalling that the inner blocks with the * specified client ID should be replaced. * * @param {string} rootClientId Client ID of the block whose InnerBlocks will re replaced. * @param {Object[]} blocks Block objects to insert as new InnerBlocks * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to false. * @param {0|-1|null} initialPosition Initial block position. * @return {Object} Action object. */ function replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) { /* eslint-enable jsdoc/valid-types */ return { type: 'REPLACE_INNER_BLOCKS', rootClientId, blocks, updateSelection, initialPosition: updateSelection ? initialPosition : null, time: Date.now() }; } /** * Returns an action object used to toggle the block editing mode between * visual and HTML modes. * * @param {string} clientId Block client ID. * * @return {Object} Action object. */ function toggleBlockMode(clientId) { return { type: 'TOGGLE_BLOCK_MODE', clientId }; } /** * Returns an action object used in signalling that the user has begun to type. * * @return {Object} Action object. */ function startTyping() { return { type: 'START_TYPING' }; } /** * Returns an action object used in signalling that the user has stopped typing. * * @return {Object} Action object. */ function stopTyping() { return { type: 'STOP_TYPING' }; } /** * Returns an action object used in signalling that the user has begun to drag blocks. * * @param {string[]} clientIds An array of client ids being dragged * * @return {Object} Action object. */ function startDraggingBlocks(clientIds = []) { return { type: 'START_DRAGGING_BLOCKS', clientIds }; } /** * Returns an action object used in signalling that the user has stopped dragging blocks. * * @return {Object} Action object. */ function stopDraggingBlocks() { return { type: 'STOP_DRAGGING_BLOCKS' }; } /** * Returns an action object used in signalling that the caret has entered formatted text. * * @deprecated * * @return {Object} Action object. */ function enterFormattedText() { external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).enterFormattedText', { since: '6.1', version: '6.3' }); return { type: 'DO_NOTHING' }; } /** * Returns an action object used in signalling that the user caret has exited formatted text. * * @deprecated * * @return {Object} Action object. */ function exitFormattedText() { external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).exitFormattedText', { since: '6.1', version: '6.3' }); return { type: 'DO_NOTHING' }; } /** * Action that changes the position of the user caret. * * @param {string|WPSelection} clientId The selected block client ID. * @param {string} attributeKey The selected block attribute key. * @param {number} startOffset The start offset. * @param {number} endOffset The end offset. * * @return {Object} Action object. */ function selectionChange(clientId, attributeKey, startOffset, endOffset) { if (typeof clientId === 'string') { return { type: 'SELECTION_CHANGE', clientId, attributeKey, startOffset, endOffset }; } return { type: 'SELECTION_CHANGE', ...clientId }; } /** * Action that adds a new block of the default type to the block list. * * @param {?Object} attributes Optional attributes of the block to assign. * @param {?string} rootClientId Optional root client ID of block list on which * to append. * @param {?number} index Optional index where to insert the default block. */ const insertDefaultBlock = (attributes, rootClientId, index) => ({ dispatch }) => { // Abort if there is no default block type (if it has been unregistered). const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); if (!defaultBlockName) { return; } const block = (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName, attributes); return dispatch.insertBlock(block, index, rootClientId); }; /** * @typedef {Object< string, Object >} SettingsByClientId */ /** * Action that changes the nested settings of the given block(s). * * @param {string | SettingsByClientId} clientId Client ID of the block whose * nested setting are being * received, or object of settings * by client ID. * @param {Object} settings Object with the new settings * for the nested block. * * @return {Object} Action object */ function updateBlockListSettings(clientId, settings) { return { type: 'UPDATE_BLOCK_LIST_SETTINGS', clientId, settings }; } /** * Action that updates the block editor settings. * * @param {Object} settings Updated settings * * @return {Object} Action object */ function updateSettings(settings) { return __experimentalUpdateSettings(settings, { stripExperimentalSettings: true }); } /** * Action that signals that a temporary reusable block has been saved * in order to switch its temporary id with the real id. * * @param {string} id Reusable block's id. * @param {string} updatedId Updated block's id. * * @return {Object} Action object. */ function __unstableSaveReusableBlock(id, updatedId) { return { type: 'SAVE_REUSABLE_BLOCK_SUCCESS', id, updatedId }; } /** * Action that marks the last block change explicitly as persistent. * * @return {Object} Action object. */ function __unstableMarkLastChangeAsPersistent() { return { type: 'MARK_LAST_CHANGE_AS_PERSISTENT' }; } /** * Action that signals that the next block change should be marked explicitly as not persistent. * * @return {Object} Action object. */ function __unstableMarkNextChangeAsNotPersistent() { return { type: 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT' }; } /** * Action that marks the last block change as an automatic change, meaning it was not * performed by the user, and can be undone using the `Escape` and `Backspace` keys. * This action must be called after the change was made, and any actions that are a * consequence of it, so it is recommended to be called at the next idle period to ensure all * selection changes have been recorded. */ const __unstableMarkAutomaticChange = () => ({ dispatch }) => { dispatch({ type: 'MARK_AUTOMATIC_CHANGE' }); const { requestIdleCallback = cb => setTimeout(cb, 100) } = window; requestIdleCallback(() => { dispatch({ type: 'MARK_AUTOMATIC_CHANGE_FINAL' }); }); }; /** * Action that enables or disables the navigation mode. * * @param {boolean} isNavigationMode Enable/Disable navigation mode. */ const setNavigationMode = (isNavigationMode = true) => ({ dispatch }) => { dispatch.__unstableSetEditorMode(isNavigationMode ? 'navigation' : 'edit'); }; /** * Action that sets the editor mode * * @param {string} mode Editor mode */ const __unstableSetEditorMode = mode => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'editorTool', mode); if (mode === 'navigation') { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('You are currently in Write mode.')); } else if (mode === 'edit') { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('You are currently in Design mode.')); } }; /** * Set the block moving client ID. * * @deprecated * * @return {Object} Action object. */ function setBlockMovingClientId() { external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).setBlockMovingClientId', { since: '6.7', hint: 'Block moving mode feature has been removed' }); return { type: 'DO_NOTHING' }; } /** * Action that duplicates a list of blocks. * * @param {string[]} clientIds * @param {boolean} updateSelection */ const duplicateBlocks = (clientIds, updateSelection = true) => ({ select, dispatch }) => { if (!clientIds || !clientIds.length) { return; } // Return early if blocks don't exist. const blocks = select.getBlocksByClientId(clientIds); if (blocks.some(block => !block)) { return; } // Return early if blocks don't support multiple usage. const blockNames = blocks.map(block => block.name); if (blockNames.some(blockName => !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'multiple', true))) { return; } const rootClientId = select.getBlockRootClientId(clientIds[0]); const clientIdsArray = actions_castArray(clientIds); const lastSelectedIndex = select.getBlockIndex(clientIdsArray[clientIdsArray.length - 1]); const clonedBlocks = blocks.map(block => (0,external_wp_blocks_namespaceObject.__experimentalCloneSanitizedBlock)(block)); dispatch.insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection); if (clonedBlocks.length > 1 && updateSelection) { dispatch.multiSelect(clonedBlocks[0].clientId, clonedBlocks[clonedBlocks.length - 1].clientId); } return clonedBlocks.map(block => block.clientId); }; /** * Action that inserts a default block before a given block. * * @param {string} clientId */ const insertBeforeBlock = clientId => ({ select, dispatch }) => { if (!clientId) { return; } const rootClientId = select.getBlockRootClientId(clientId); const isLocked = select.getTemplateLock(rootClientId); if (isLocked) { return; } const blockIndex = select.getBlockIndex(clientId); const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null; if (!directInsertBlock) { return dispatch.insertDefaultBlock({}, rootClientId, blockIndex); } const copiedAttributes = {}; if (directInsertBlock.attributesToCopy) { const attributes = select.getBlockAttributes(clientId); directInsertBlock.attributesToCopy.forEach(key => { if (attributes[key]) { copiedAttributes[key] = attributes[key]; } }); } const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { ...directInsertBlock.attributes, ...copiedAttributes }); return dispatch.insertBlock(block, blockIndex, rootClientId); }; /** * Action that inserts a default block after a given block. * * @param {string} clientId */ const insertAfterBlock = clientId => ({ select, dispatch }) => { if (!clientId) { return; } const rootClientId = select.getBlockRootClientId(clientId); const isLocked = select.getTemplateLock(rootClientId); if (isLocked) { return; } const blockIndex = select.getBlockIndex(clientId); const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null; if (!directInsertBlock) { return dispatch.insertDefaultBlock({}, rootClientId, blockIndex + 1); } const copiedAttributes = {}; if (directInsertBlock.attributesToCopy) { const attributes = select.getBlockAttributes(clientId); directInsertBlock.attributesToCopy.forEach(key => { if (attributes[key]) { copiedAttributes[key] = attributes[key]; } }); } const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { ...directInsertBlock.attributes, ...copiedAttributes }); return dispatch.insertBlock(block, blockIndex + 1, rootClientId); }; /** * Action that toggles the highlighted block state. * * @param {string} clientId The block's clientId. * @param {boolean} isHighlighted The highlight state. */ function toggleBlockHighlight(clientId, isHighlighted) { return { type: 'TOGGLE_BLOCK_HIGHLIGHT', clientId, isHighlighted }; } /** * Action that "flashes" the block with a given `clientId` by rhythmically highlighting it. * * @param {string} clientId Target block client ID. */ const flashBlock = clientId => async ({ dispatch }) => { dispatch(toggleBlockHighlight(clientId, true)); await new Promise(resolve => setTimeout(resolve, 150)); dispatch(toggleBlockHighlight(clientId, false)); }; /** * Action that sets whether a block has controlled inner blocks. * * @param {string} clientId The block's clientId. * @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled. */ function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) { return { type: 'SET_HAS_CONTROLLED_INNER_BLOCKS', hasControlledInnerBlocks, clientId }; } /** * Action that sets whether given blocks are visible on the canvas. * * @param {Record<string,boolean>} updates For each block's clientId, its new visibility setting. */ function setBlockVisibility(updates) { return { type: 'SET_BLOCK_VISIBILITY', updates }; } /** * Action that sets whether a block is being temporarily edited as blocks. * * DO-NOT-USE in production. * This action is created for internal/experimental only usage and may be * removed anytime without any warning, causing breakage on any plugin or theme invoking it. * * @param {?string} temporarilyEditingAsBlocks The block's clientId being temporarily edited as blocks. * @param {?string} focusModeToRevert The focus mode to revert after temporarily edit as blocks finishes. */ function __unstableSetTemporarilyEditingAsBlocks(temporarilyEditingAsBlocks, focusModeToRevert) { return { type: 'SET_TEMPORARILY_EDITING_AS_BLOCKS', temporarilyEditingAsBlocks, focusModeToRevert }; } /** * Interface for inserter media requests. * * @typedef {Object} InserterMediaRequest * @property {number} per_page How many items to fetch per page. * @property {string} search The search term to use for filtering the results. */ /** * Interface for inserter media responses. Any media resource should * map their response to this interface, in order to create the core * WordPress media blocks (image, video, audio). * * @typedef {Object} InserterMediaItem * @property {string} title The title of the media item. * @property {string} url The source url of the media item. * @property {string} [previewUrl] The preview source url of the media item to display in the media list. * @property {number} [id] The WordPress id of the media item. * @property {number|string} [sourceId] The id of the media item from external source. * @property {string} [alt] The alt text of the media item. * @property {string} [caption] The caption of the media item. */ /** * Registers a new inserter media category. Once registered, the media category is * available in the inserter's media tab. * * The following interfaces are used: * * _Type Definition_ * * - _InserterMediaRequest_ `Object`: Interface for inserter media requests. * * _Properties_ * * - _per_page_ `number`: How many items to fetch per page. * - _search_ `string`: The search term to use for filtering the results. * * _Type Definition_ * * - _InserterMediaItem_ `Object`: Interface for inserter media responses. Any media resource should * map their response to this interface, in order to create the core * WordPress media blocks (image, video, audio). * * _Properties_ * * - _title_ `string`: The title of the media item. * - _url_ `string: The source url of the media item. * - _previewUrl_ `[string]`: The preview source url of the media item to display in the media list. * - _id_ `[number]`: The WordPress id of the media item. * - _sourceId_ `[number|string]`: The id of the media item from external source. * - _alt_ `[string]`: The alt text of the media item. * - _caption_ `[string]`: The caption of the media item. * * @param {InserterMediaCategory} category The inserter media category to register. * * @example * ```js * * wp.data.dispatch('core/block-editor').registerInserterMediaCategory( { * name: 'openverse', * labels: { * name: 'Openverse', * search_items: 'Search Openverse', * }, * mediaType: 'image', * async fetch( query = {} ) { * const defaultArgs = { * mature: false, * excluded_source: 'flickr,inaturalist,wikimedia', * license: 'pdm,cc0', * }; * const finalQuery = { ...query, ...defaultArgs }; * // Sometimes you might need to map the supported request params according to `InserterMediaRequest`. * // interface. In this example the `search` query param is named `q`. * const mapFromInserterMediaRequest = { * per_page: 'page_size', * search: 'q', * }; * const url = new URL( 'https://api.openverse.org/v1/images/' ); * Object.entries( finalQuery ).forEach( ( [ key, value ] ) => { * const queryKey = mapFromInserterMediaRequest[ key ] || key; * url.searchParams.set( queryKey, value ); * } ); * const response = await window.fetch( url, { * headers: { * 'User-Agent': 'WordPress/inserter-media-fetch', * }, * } ); * const jsonResponse = await response.json(); * const results = jsonResponse.results; * return results.map( ( result ) => ( { * ...result, * // If your response result includes an `id` prop that you want to access later, it should * // be mapped to `InserterMediaItem`'s `sourceId` prop. This can be useful if you provide * // a report URL getter. * // Additionally you should always clear the `id` value of your response results because * // it is used to identify WordPress media items. * sourceId: result.id, * id: undefined, * caption: result.caption, * previewUrl: result.thumbnail, * } ) ); * }, * getReportUrl: ( { sourceId } ) => * `https://wordpress.org/openverse/image/${ sourceId }/report/`, * isExternalResource: true, * } ); * ``` * * @typedef {Object} InserterMediaCategory Interface for inserter media category. * @property {string} name The name of the media category, that should be unique among all media categories. * @property {Object} labels Labels for the media category. * @property {string} labels.name General name of the media category. It's used in the inserter media items list. * @property {string} [labels.search_items='Search'] Label for searching items. Default is ‘Search Posts’ / ‘Search Pages’. * @property {('image'|'audio'|'video')} mediaType The media type of the media category. * @property {(InserterMediaRequest) => Promise<InserterMediaItem[]>} fetch The function to fetch media items for the category. * @property {(InserterMediaItem) => string} [getReportUrl] If the media category supports reporting media items, this function should return * the report url for the media item. It accepts the `InserterMediaItem` as an argument. * @property {boolean} [isExternalResource] If the media category is an external resource, this should be set to true. * This is used to avoid making a request to the external resource when the user */ const registerInserterMediaCategory = category => ({ select, dispatch }) => { if (!category || typeof category !== 'object') { console.error('Category should be an `InserterMediaCategory` object.'); return; } if (!category.name) { console.error('Category should have a `name` that should be unique among all media categories.'); return; } if (!category.labels?.name) { console.error('Category should have a `labels.name`.'); return; } if (!['image', 'audio', 'video'].includes(category.mediaType)) { console.error('Category should have `mediaType` property that is one of `image|audio|video`.'); return; } if (!category.fetch || typeof category.fetch !== 'function') { console.error('Category should have a `fetch` function defined with the following signature `(InserterMediaRequest) => Promise<InserterMediaItem[]>`.'); return; } const registeredInserterMediaCategories = select.getRegisteredInserterMediaCategories(); if (registeredInserterMediaCategories.some(({ name }) => name === category.name)) { console.error(`A category is already registered with the same name: "${category.name}".`); return; } if (registeredInserterMediaCategories.some(({ labels: { name } = {} }) => name === category.labels?.name)) { console.error(`A category is already registered with the same labels.name: "${category.labels.name}".`); return; } // `inserterMediaCategories` is a private block editor setting, which means it cannot // be updated through the public `updateSettings` action. We preserve this setting as // private, so extenders can only add new inserter media categories and don't have any // control over the core media categories. dispatch({ type: 'REGISTER_INSERTER_MEDIA_CATEGORY', category: { ...category, isExternalResource: true } }); }; /** * @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode */ /** * Sets the block editing mode for a given block. * * @see useBlockEditingMode * * @param {string} clientId The block client ID, or `''` for the root container. * @param {BlockEditingMode} mode The block editing mode. One of `'disabled'`, * `'contentOnly'`, or `'default'`. * * @return {Object} Action object. */ function setBlockEditingMode(clientId = '', mode) { return { type: 'SET_BLOCK_EDITING_MODE', clientId, mode }; } /** * Clears the block editing mode for a given block. * * @see useBlockEditingMode * * @param {string} clientId The block client ID, or `''` for the root container. * * @return {Object} Action object. */ function unsetBlockEditingMode(clientId = '') { return { type: 'UNSET_BLOCK_EDITING_MODE', clientId }; } ;// ./node_modules/@wordpress/block-editor/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block editor data store configuration. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore */ const storeConfig = { reducer: reducer, selectors: selectors_namespaceObject, actions: actions_namespaceObject }; /** * Store definition for the block editor namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore */ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig, persist: ['preferences'] }); // We will be able to use the `register` function once we switch // the "preferences" persistence to use the new preferences package. const registeredStore = (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { ...storeConfig, persist: ['preferences'] }); unlock(registeredStore).registerPrivateActions(private_actions_namespaceObject); unlock(registeredStore).registerPrivateSelectors(private_selectors_namespaceObject); // TODO: Remove once we switch to the `register` function (see above). // // Until then, private functions also need to be attached to the original // `store` descriptor in order to avoid unit tests failing, which could happen // when tests create new registries in which they register stores. // // @see https://github.com/WordPress/gutenberg/pull/51145#discussion_r1239999590 unlock(store).registerPrivateActions(private_actions_namespaceObject); unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); ;// ./node_modules/@wordpress/block-editor/build-module/components/use-settings/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Hook that retrieves the given settings for the block instance in use. * * It looks up the settings first in the block instance hierarchy. * If none are found, it'll look them up in the block editor settings. * * @param {string[]} paths The paths to the settings. * @return {any[]} Returns the values defined for the settings. * @example * ```js * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' ); * ``` */ function use_settings_useSettings(...paths) { const { clientId = null } = useBlockEditContext(); return (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getBlockSettings(clientId, ...paths), [clientId, ...paths]); } /** * Hook that retrieves the given setting for the block instance in use. * * It looks up the setting first in the block instance hierarchy. * If none is found, it'll look it up in the block editor settings. * * @deprecated 6.5.0 Use useSettings instead. * * @param {string} path The path to the setting. * @return {any} Returns the value defined for the setting. * @example * ```js * const isEnabled = useSetting( 'typography.dropCap' ); * ``` */ function useSetting(path) { external_wp_deprecated_default()('wp.blockEditor.useSetting', { since: '6.5', alternative: 'wp.blockEditor.useSettings', note: 'The new useSettings function can retrieve multiple settings at once, with better performance.' }); const [value] = use_settings_useSettings(path); return value; } ;// external ["wp","styleEngine"] const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/fluid-utils.js /** * The fluid utilities must match the backend equivalent. * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php * --------------------------------------------------------------- */ // Defaults. const DEFAULT_MAXIMUM_VIEWPORT_WIDTH = '1600px'; const DEFAULT_MINIMUM_VIEWPORT_WIDTH = '320px'; const DEFAULT_SCALE_FACTOR = 1; const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25; const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75; const DEFAULT_MINIMUM_FONT_SIZE_LIMIT = '14px'; /** * Computes a fluid font-size value that uses clamp(). A minimum and maximum * font size OR a single font size can be specified. * * If a single font size is specified, it is scaled up and down using a logarithmic scale. * * @example * ```js * // Calculate fluid font-size value from a minimum and maximum value. * const fontSize = getComputedFluidTypographyValue( { * minimumFontSize: '20px', * maximumFontSize: '45px' * } ); * // Calculate fluid font-size value from a single font size. * const fontSize = getComputedFluidTypographyValue( { * fontSize: '30px', * } ); * ``` * * @param {Object} args * @param {?string} args.minimumViewportWidth Minimum viewport size from which type will have fluidity. Optional if fontSize is specified. * @param {?string} args.maximumViewportWidth Maximum size up to which type will have fluidity. Optional if fontSize is specified. * @param {string|number} [args.fontSize] Size to derive maximumFontSize and minimumFontSize from, if necessary. Optional if minimumFontSize and maximumFontSize are specified. * @param {?string} args.maximumFontSize Maximum font size for any clamp() calculation. Optional. * @param {?string} args.minimumFontSize Minimum font size for any clamp() calculation. Optional. * @param {?number} args.scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional. * @param {?string} args.minimumFontSizeLimit The smallest a calculated font size may be. Optional. * * @return {string|null} A font-size value using clamp(). */ function getComputedFluidTypographyValue({ minimumFontSize, maximumFontSize, fontSize, minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH, maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH, scaleFactor = DEFAULT_SCALE_FACTOR, minimumFontSizeLimit }) { // Validate incoming settings and set defaults. minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT; /* * Calculates missing minimumFontSize and maximumFontSize from * defaultFontSize if provided. */ if (fontSize) { // Parses default font size. const fontSizeParsed = getTypographyValueAndUnit(fontSize); // Protect against invalid units. if (!fontSizeParsed?.unit) { return null; } // Parses the minimum font size limit, so we can perform checks using it. const minimumFontSizeLimitParsed = getTypographyValueAndUnit(minimumFontSizeLimit, { coerceTo: fontSizeParsed.unit }); // Don't enforce minimum font size if a font size has explicitly set a min and max value. if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) { /* * If a minimum size was not passed to this function * and the user-defined font size is lower than $minimum_font_size_limit, * do not calculate a fluid value. */ if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) { return null; } } // If no fluid max font size is available use the incoming value. if (!maximumFontSize) { maximumFontSize = `${fontSizeParsed.value}${fontSizeParsed.unit}`; } /* * If no minimumFontSize is provided, create one using * the given font size multiplied by the min font size scale factor. */ if (!minimumFontSize) { const fontSizeValueInPx = fontSizeParsed.unit === 'px' ? fontSizeParsed.value : fontSizeParsed.value * 16; /* * The scale factor is a multiplier that affects how quickly the curve will move towards the minimum, * that is, how quickly the size factor reaches 0 given increasing font size values. * For a - b * log2(), lower values of b will make the curve move towards the minimum faster. * The scale factor is constrained between min and max values. */ const minimumFontSizeFactor = Math.min(Math.max(1 - 0.075 * Math.log2(fontSizeValueInPx), DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN), DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX); // Calculates the minimum font size. const calculatedMinimumFontSize = roundToPrecision(fontSizeParsed.value * minimumFontSizeFactor, 3); // Only use calculated min font size if it's > $minimum_font_size_limit value. if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) { minimumFontSize = `${minimumFontSizeLimitParsed.value}${minimumFontSizeLimitParsed.unit}`; } else { minimumFontSize = `${calculatedMinimumFontSize}${fontSizeParsed.unit}`; } } } // Grab the minimum font size and normalize it in order to use the value for calculations. const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize); // We get a 'preferred' unit to keep units consistent when calculating, // otherwise the result will not be accurate. const fontSizeUnit = minimumFontSizeParsed?.unit || 'rem'; // Grabs the maximum font size and normalize it in order to use the value for calculations. const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, { coerceTo: fontSizeUnit }); // Checks for mandatory min and max sizes, and protects against unsupported units. if (!minimumFontSizeParsed || !maximumFontSizeParsed) { return null; } // Uses rem for accessible fluid target font scaling. const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, { coerceTo: 'rem' }); // Viewport widths defined for fluid typography. Normalize units const maximumViewportWidthParsed = getTypographyValueAndUnit(maximumViewportWidth, { coerceTo: fontSizeUnit }); const minimumViewportWidthParsed = getTypographyValueAndUnit(minimumViewportWidth, { coerceTo: fontSizeUnit }); // Protect against unsupported units. if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) { return null; } // Calculates the linear factor denominator. If it's 0, we cannot calculate a fluid value. const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value; if (!linearDenominator) { return null; } // Build CSS rule. // Borrowed from https://websemantics.uk/tools/responsive-font-calculator/. const minViewportWidthOffsetValue = roundToPrecision(minimumViewportWidthParsed.value / 100, 3); const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit; const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator); const linearFactorScaled = roundToPrecision((linearFactor || 1) * scaleFactor, 3); const fluidTargetFontSize = `${minimumFontSizeRem.value}${minimumFontSizeRem.unit} + ((1vw - ${viewportWidthOffset}) * ${linearFactorScaled})`; return `clamp(${minimumFontSize}, ${fluidTargetFontSize}, ${maximumFontSize})`; } /** * Internal method that checks a string for a unit and value and returns an array consisting of `'value'` and `'unit'`, e.g., [ '42', 'rem' ]. * A raw font size of `value + unit` is expected. If the value is an integer, it will convert to `value + 'px'`. * * @param {string|number} rawValue Raw size value from theme.json. * @param {Object|undefined} options Calculation options. * * @return {{ unit: string, value: number }|null} An object consisting of `'value'` and `'unit'` properties. */ function getTypographyValueAndUnit(rawValue, options = {}) { if (typeof rawValue !== 'string' && typeof rawValue !== 'number') { return null; } // Converts numeric values to pixel values by default. if (isFinite(rawValue)) { rawValue = `${rawValue}px`; } const { coerceTo, rootSizeValue, acceptableUnits } = { coerceTo: '', // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`. rootSizeValue: 16, acceptableUnits: ['rem', 'px', 'em'], ...options }; const acceptableUnitsGroup = acceptableUnits?.join('|'); const regexUnits = new RegExp(`^(\\d*\\.?\\d+)(${acceptableUnitsGroup}){1,1}$`); const matches = rawValue.match(regexUnits); // We need a number value and a unit. if (!matches || matches.length < 3) { return null; } let [, value, unit] = matches; let returnValue = parseFloat(value); if ('px' === coerceTo && ('em' === unit || 'rem' === unit)) { returnValue = returnValue * rootSizeValue; unit = coerceTo; } if ('px' === unit && ('em' === coerceTo || 'rem' === coerceTo)) { returnValue = returnValue / rootSizeValue; unit = coerceTo; } /* * No calculation is required if swapping between em and rem yet, * since we assume a root size value. Later we might like to differentiate between * :root font size (rem) and parent element font size (em) relativity. */ if (('em' === coerceTo || 'rem' === coerceTo) && ('em' === unit || 'rem' === unit)) { unit = coerceTo; } return { value: roundToPrecision(returnValue, 3), unit }; } /** * Returns a value rounded to defined precision. * Returns `undefined` if the value is not a valid finite number. * * @param {number} value Raw value. * @param {number} digits The number of digits to appear after the decimal point * * @return {number|undefined} Value rounded to standard precision. */ function roundToPrecision(value, digits = 3) { const base = Math.pow(10, digits); return Number.isFinite(value) ? parseFloat(Math.round(value * base) / base) : undefined; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/format-font-style.js /** * WordPress dependencies */ /** * Formats font styles to human readable names. * * @param {string} fontStyle font style string * @return {Object} new object with formatted font style */ function formatFontStyle(fontStyle) { if (!fontStyle) { return {}; } if (typeof fontStyle === 'object') { return fontStyle; } let name; switch (fontStyle) { case 'normal': name = (0,external_wp_i18n_namespaceObject._x)('Regular', 'font style'); break; case 'italic': name = (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style'); break; case 'oblique': name = (0,external_wp_i18n_namespaceObject._x)('Oblique', 'font style'); break; default: name = fontStyle; break; } return { name, value: fontStyle }; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/format-font-weight.js /** * WordPress dependencies */ /** * Formats font weights to human readable names. * * @param {string} fontWeight font weight string * @return {Object} new object with formatted font weight */ function formatFontWeight(fontWeight) { if (!fontWeight) { return {}; } if (typeof fontWeight === 'object') { return fontWeight; } let name; switch (fontWeight) { case 'normal': case '400': name = (0,external_wp_i18n_namespaceObject._x)('Regular', 'font weight'); break; case 'bold': case '700': name = (0,external_wp_i18n_namespaceObject._x)('Bold', 'font weight'); break; case '100': name = (0,external_wp_i18n_namespaceObject._x)('Thin', 'font weight'); break; case '200': name = (0,external_wp_i18n_namespaceObject._x)('Extra Light', 'font weight'); break; case '300': name = (0,external_wp_i18n_namespaceObject._x)('Light', 'font weight'); break; case '500': name = (0,external_wp_i18n_namespaceObject._x)('Medium', 'font weight'); break; case '600': name = (0,external_wp_i18n_namespaceObject._x)('Semi Bold', 'font weight'); break; case '800': name = (0,external_wp_i18n_namespaceObject._x)('Extra Bold', 'font weight'); break; case '900': name = (0,external_wp_i18n_namespaceObject._x)('Black', 'font weight'); break; case '1000': name = (0,external_wp_i18n_namespaceObject._x)('Extra Black', 'font weight'); break; default: name = fontWeight; break; } return { name, value: fontWeight }; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/get-font-styles-and-weights.js /** * WordPress dependencies */ /** * Internal dependencies */ const FONT_STYLES = [{ name: (0,external_wp_i18n_namespaceObject._x)('Regular', 'font style'), value: 'normal' }, { name: (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style'), value: 'italic' }]; const FONT_WEIGHTS = [{ name: (0,external_wp_i18n_namespaceObject._x)('Thin', 'font weight'), value: '100' }, { name: (0,external_wp_i18n_namespaceObject._x)('Extra Light', 'font weight'), value: '200' }, { name: (0,external_wp_i18n_namespaceObject._x)('Light', 'font weight'), value: '300' }, { name: (0,external_wp_i18n_namespaceObject._x)('Regular', 'font weight'), value: '400' }, { name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font weight'), value: '500' }, { name: (0,external_wp_i18n_namespaceObject._x)('Semi Bold', 'font weight'), value: '600' }, { name: (0,external_wp_i18n_namespaceObject._x)('Bold', 'font weight'), value: '700' }, { name: (0,external_wp_i18n_namespaceObject._x)('Extra Bold', 'font weight'), value: '800' }, { name: (0,external_wp_i18n_namespaceObject._x)('Black', 'font weight'), value: '900' }, { name: (0,external_wp_i18n_namespaceObject._x)('Extra Black', 'font weight'), value: '1000' }]; /** * Builds a list of font style and weight options based on font family faces. * Defaults to the standard font styles and weights if no font family faces are provided. * * @param {Array} fontFamilyFaces font family faces array * @return {Object} new object with combined and separated font style and weight properties */ function getFontStylesAndWeights(fontFamilyFaces) { let fontStyles = []; let fontWeights = []; const combinedStyleAndWeightOptions = []; const isSystemFont = !fontFamilyFaces || fontFamilyFaces?.length === 0; let isVariableFont = false; fontFamilyFaces?.forEach(face => { // Check for variable font by looking for a space in the font weight value. e.g. "100 900" if ('string' === typeof face.fontWeight && /\s/.test(face.fontWeight.trim())) { isVariableFont = true; // Find font weight start and end values. let [startValue, endValue] = face.fontWeight.split(' '); startValue = parseInt(startValue.slice(0, 1)); if (endValue === '1000') { endValue = 10; } else { endValue = parseInt(endValue.slice(0, 1)); } // Create font weight options for available variable weights. for (let i = startValue; i <= endValue; i++) { const fontWeightValue = `${i.toString()}00`; if (!fontWeights.some(weight => weight.value === fontWeightValue)) { fontWeights.push(formatFontWeight(fontWeightValue)); } } } // Format font style and weight values. const fontWeight = formatFontWeight('number' === typeof face.fontWeight ? face.fontWeight.toString() : face.fontWeight); const fontStyle = formatFontStyle(face.fontStyle); // Create font style and font weight lists without duplicates. if (fontStyle && Object.keys(fontStyle).length) { if (!fontStyles.some(style => style.value === fontStyle.value)) { fontStyles.push(fontStyle); } } if (fontWeight && Object.keys(fontWeight).length) { if (!fontWeights.some(weight => weight.value === fontWeight.value)) { if (!isVariableFont) { fontWeights.push(fontWeight); } } } }); // If there is no font weight of 600 or above, then include faux bold as an option. if (!fontWeights.some(weight => weight.value >= '600')) { fontWeights.push({ name: (0,external_wp_i18n_namespaceObject._x)('Bold', 'font weight'), value: '700' }); } // If there is no italic font style, then include faux italic as an option. if (!fontStyles.some(style => style.value === 'italic')) { fontStyles.push({ name: (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style'), value: 'italic' }); } // Use default font styles and weights for system fonts. if (isSystemFont) { fontStyles = FONT_STYLES; fontWeights = FONT_WEIGHTS; } // Use default styles and weights if there are no available styles or weights from the provided font faces. fontStyles = fontStyles.length === 0 ? FONT_STYLES : fontStyles; fontWeights = fontWeights.length === 0 ? FONT_WEIGHTS : fontWeights; // Generate combined font style and weight options for available fonts. fontStyles.forEach(({ name: styleName, value: styleValue }) => { fontWeights.forEach(({ name: weightName, value: weightValue }) => { const optionName = styleValue === 'normal' ? weightName : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Font weight name. 2: Font style name. */ (0,external_wp_i18n_namespaceObject._x)('%1$s %2$s', 'font'), weightName, styleName); combinedStyleAndWeightOptions.push({ key: `${styleValue}-${weightValue}`, name: optionName, style: { fontStyle: styleValue, fontWeight: weightValue } }); }); }); return { fontStyles, fontWeights, combinedStyleAndWeightOptions, isSystemFont, isVariableFont }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-utils.js /** * The fluid utilities must match the backend equivalent. * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php * --------------------------------------------------------------- */ /** * Internal dependencies */ /** * @typedef {Object} FluidPreset * @property {string|undefined} max A maximum font size value. * @property {?string|undefined} min A minimum font size value. */ /** * @typedef {Object} Preset * @property {?string|?number} size A default font size. * @property {string} name A font size name, displayed in the UI. * @property {string} slug A font size slug * @property {boolean|FluidPreset|undefined} fluid Specifies the minimum and maximum font size value of a fluid font size. */ /** * @typedef {Object} TypographySettings * @property {?string} minViewportWidth Minimum viewport size from which type will have fluidity. Optional if size is specified. * @property {?string} maxViewportWidth Maximum size up to which type will have fluidity. Optional if size is specified. * @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional. * @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional. * @property {?string} minFontSize The smallest a calculated font size may be. Optional. */ /** * Returns a font-size value based on a given font-size preset. * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values. * * The Core PHP equivalent is wp_get_typography_font_size_value(). * * @param {Preset} preset * @param {Object} settings * @param {boolean|TypographySettings} settings.typography.fluid Whether fluid typography is enabled, and, optionally, fluid font size options. * @param {?Object} settings.typography.layout Layout options. * * @return {string|*} A font-size value or the value of preset.size. */ function getTypographyFontSizeValue(preset, settings) { const { size: defaultSize } = preset; /* * Catch falsy values and 0/'0'. Fluid calculations cannot be performed on `0`. * Also return early when a preset font size explicitly disables fluid typography with `false`. */ if (!defaultSize || '0' === defaultSize || false === preset?.fluid) { return defaultSize; } /* * Return early when fluid typography is disabled in the settings, and there * are no local settings to enable it for the individual preset. * * If this condition isn't met, either the settings or individual preset settings * have enabled fluid typography. */ if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) { return defaultSize; } let fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings); fluidTypographySettings = typeof fluidTypographySettings?.fluid === 'object' ? fluidTypographySettings?.fluid : {}; const fluidFontSizeValue = getComputedFluidTypographyValue({ minimumFontSize: preset?.fluid?.min, maximumFontSize: preset?.fluid?.max, fontSize: defaultSize, minimumFontSizeLimit: fluidTypographySettings?.minFontSize, maximumViewportWidth: fluidTypographySettings?.maxViewportWidth, minimumViewportWidth: fluidTypographySettings?.minViewportWidth }); if (!!fluidFontSizeValue) { return fluidFontSizeValue; } return defaultSize; } function isFluidTypographyEnabled(typographySettings) { const fluidSettings = typographySettings?.fluid; return true === fluidSettings || fluidSettings && typeof fluidSettings === 'object' && Object.keys(fluidSettings).length > 0; } /** * Returns fluid typography settings from theme.json setting object. * * @param {Object} settings Theme.json settings * @param {Object} settings.typography Theme.json typography settings * @param {Object} settings.layout Theme.json layout settings * @return {TypographySettings} Fluid typography settings */ function getFluidTypographyOptionsFromSettings(settings) { const typographySettings = settings?.typography; const layoutSettings = settings?.layout; const defaultMaxViewportWidth = getTypographyValueAndUnit(layoutSettings?.wideSize) ? layoutSettings?.wideSize : null; return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? { fluid: { maxViewportWidth: defaultMaxViewportWidth, ...typographySettings.fluid } } : { fluid: typographySettings?.fluid }; } /** * Returns an object of merged font families and the font faces from the selected font family * based on the theme.json settings object and the currently selected font family. * * @param {Object} settings Theme.json settings. * @param {string} selectedFontFamily Decoded font family string. * @return {Object} Merged font families and font faces from the selected font family. */ function getMergedFontFamiliesAndFontFamilyFaces(settings, selectedFontFamily) { var _fontFamilies$find$fo; const fontFamiliesFromSettings = settings?.typography?.fontFamilies; const fontFamilies = ['default', 'theme', 'custom'].flatMap(key => { var _fontFamiliesFromSett; return (_fontFamiliesFromSett = fontFamiliesFromSettings?.[key]) !== null && _fontFamiliesFromSett !== void 0 ? _fontFamiliesFromSett : []; }); const fontFamilyFaces = (_fontFamilies$find$fo = fontFamilies.find(family => family.fontFamily === selectedFontFamily)?.fontFace) !== null && _fontFamilies$find$fo !== void 0 ? _fontFamilies$find$fo : []; return { fontFamilies, fontFamilyFaces }; } /** * Returns the nearest font weight value from the available font weight list based on the new font weight. * The nearest font weight is the one with the smallest difference from the new font weight. * * @param {Array} availableFontWeights Array of available font weights. * @param {string} newFontWeightValue New font weight value. * @return {string} Nearest font weight. */ function findNearestFontWeight(availableFontWeights, newFontWeightValue) { newFontWeightValue = 'number' === typeof newFontWeightValue ? newFontWeightValue.toString() : newFontWeightValue; if (!newFontWeightValue || typeof newFontWeightValue !== 'string') { return ''; } if (!availableFontWeights || availableFontWeights.length === 0) { return newFontWeightValue; } const nearestFontWeight = availableFontWeights?.reduce((nearest, { value: fw }) => { const currentDiff = Math.abs(parseInt(fw) - parseInt(newFontWeightValue)); const nearestDiff = Math.abs(parseInt(nearest) - parseInt(newFontWeightValue)); return currentDiff < nearestDiff ? fw : nearest; }, availableFontWeights[0]?.value); return nearestFontWeight; } /** * Returns the nearest font style based on the new font style. * Defaults to an empty string if the new font style is not valid or available. * * @param {Array} availableFontStyles Array of available font weights. * @param {string} newFontStyleValue New font style value. * @return {string} Nearest font style or an empty string. */ function findNearestFontStyle(availableFontStyles, newFontStyleValue) { if (typeof newFontStyleValue !== 'string' || !newFontStyleValue) { return ''; } const validStyles = ['normal', 'italic', 'oblique']; if (!validStyles.includes(newFontStyleValue)) { return ''; } if (!availableFontStyles || availableFontStyles.length === 0 || availableFontStyles.find(style => style.value === newFontStyleValue)) { return newFontStyleValue; } if (newFontStyleValue === 'oblique' && !availableFontStyles.find(style => style.value === 'oblique')) { return 'italic'; } return ''; } /** * Returns the nearest font style and weight based on the available font family faces and the new font style and weight. * * @param {Array} fontFamilyFaces Array of available font family faces. * @param {string} fontStyle New font style. Defaults to previous value. * @param {string} fontWeight New font weight. Defaults to previous value. * @return {Object} Nearest font style and font weight. */ function findNearestStyleAndWeight(fontFamilyFaces, fontStyle, fontWeight) { let nearestFontStyle = fontStyle; let nearestFontWeight = fontWeight; const { fontStyles, fontWeights, combinedStyleAndWeightOptions } = getFontStylesAndWeights(fontFamilyFaces); // Check if the new font style and weight are available in the font family faces. const hasFontStyle = fontStyles?.some(({ value: fs }) => fs === fontStyle); const hasFontWeight = fontWeights?.some(({ value: fw }) => fw?.toString() === fontWeight?.toString()); if (!hasFontStyle) { /* * Default to italic if oblique is not available. * Or find the nearest font style based on the nearest font weight. */ nearestFontStyle = fontStyle ? findNearestFontStyle(fontStyles, fontStyle) : combinedStyleAndWeightOptions?.find(option => option.style.fontWeight === findNearestFontWeight(fontWeights, fontWeight))?.style?.fontStyle; } if (!hasFontWeight) { /* * Find the nearest font weight based on available weights. * Or find the nearest font weight based on the nearest font style. */ nearestFontWeight = fontWeight ? findNearestFontWeight(fontWeights, fontWeight) : combinedStyleAndWeightOptions?.find(option => option.style.fontStyle === (nearestFontStyle || fontStyle))?.style?.fontWeight; } return { nearestFontStyle, nearestFontWeight }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/utils.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /* Supporting data. */ const ROOT_BLOCK_SELECTOR = 'body'; const ROOT_CSS_PROPERTIES_SELECTOR = ':root'; const PRESET_METADATA = [{ path: ['color', 'palette'], valueKey: 'color', cssVarInfix: 'color', classes: [{ classSuffix: 'color', propertyName: 'color' }, { classSuffix: 'background-color', propertyName: 'background-color' }, { classSuffix: 'border-color', propertyName: 'border-color' }] }, { path: ['color', 'gradients'], valueKey: 'gradient', cssVarInfix: 'gradient', classes: [{ classSuffix: 'gradient-background', propertyName: 'background' }] }, { path: ['color', 'duotone'], valueKey: 'colors', cssVarInfix: 'duotone', valueFunc: ({ slug }) => `url( '#wp-duotone-${slug}' )`, classes: [] }, { path: ['shadow', 'presets'], valueKey: 'shadow', cssVarInfix: 'shadow', classes: [] }, { path: ['typography', 'fontSizes'], valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings), valueKey: 'size', cssVarInfix: 'font-size', classes: [{ classSuffix: 'font-size', propertyName: 'font-size' }] }, { path: ['typography', 'fontFamilies'], valueKey: 'fontFamily', cssVarInfix: 'font-family', classes: [{ classSuffix: 'font-family', propertyName: 'font-family' }] }, { path: ['spacing', 'spacingSizes'], valueKey: 'size', cssVarInfix: 'spacing', valueFunc: ({ size }) => size, classes: [] }]; const STYLE_PATH_TO_CSS_VAR_INFIX = { 'color.background': 'color', 'color.text': 'color', 'filter.duotone': 'duotone', 'elements.link.color.text': 'color', 'elements.link.:hover.color.text': 'color', 'elements.link.typography.fontFamily': 'font-family', 'elements.link.typography.fontSize': 'font-size', 'elements.button.color.text': 'color', 'elements.button.color.background': 'color', 'elements.caption.color.text': 'color', 'elements.button.typography.fontFamily': 'font-family', 'elements.button.typography.fontSize': 'font-size', 'elements.heading.color': 'color', 'elements.heading.color.background': 'color', 'elements.heading.typography.fontFamily': 'font-family', 'elements.heading.gradient': 'gradient', 'elements.heading.color.gradient': 'gradient', 'elements.h1.color': 'color', 'elements.h1.color.background': 'color', 'elements.h1.typography.fontFamily': 'font-family', 'elements.h1.color.gradient': 'gradient', 'elements.h2.color': 'color', 'elements.h2.color.background': 'color', 'elements.h2.typography.fontFamily': 'font-family', 'elements.h2.color.gradient': 'gradient', 'elements.h3.color': 'color', 'elements.h3.color.background': 'color', 'elements.h3.typography.fontFamily': 'font-family', 'elements.h3.color.gradient': 'gradient', 'elements.h4.color': 'color', 'elements.h4.color.background': 'color', 'elements.h4.typography.fontFamily': 'font-family', 'elements.h4.color.gradient': 'gradient', 'elements.h5.color': 'color', 'elements.h5.color.background': 'color', 'elements.h5.typography.fontFamily': 'font-family', 'elements.h5.color.gradient': 'gradient', 'elements.h6.color': 'color', 'elements.h6.color.background': 'color', 'elements.h6.typography.fontFamily': 'font-family', 'elements.h6.color.gradient': 'gradient', 'color.gradient': 'gradient', shadow: 'shadow', 'typography.fontSize': 'font-size', 'typography.fontFamily': 'font-family' }; // A static list of block attributes that store global style preset slugs. const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 'color.background': 'backgroundColor', 'color.text': 'textColor', 'color.gradient': 'gradient', 'typography.fontSize': 'fontSize', 'typography.fontFamily': 'fontFamily' }; function useToolsPanelDropdownMenuProps() { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); return !isMobile ? { popoverProps: { placement: 'left-start', // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) offset: 259 } } : {}; } function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) { // Block presets take priority above root level presets. const orderedPresetsByOrigin = [getValueFromObjectPath(features, ['blocks', blockName, ...presetPath]), getValueFromObjectPath(features, presetPath)]; for (const presetByOrigin of orderedPresetsByOrigin) { if (presetByOrigin) { // Preset origins ordered by priority. const origins = ['custom', 'theme', 'default']; for (const origin of origins) { const presets = presetByOrigin[origin]; if (presets) { const presetObject = presets.find(preset => preset[presetProperty] === presetValueValue); if (presetObject) { if (presetProperty === 'slug') { return presetObject; } // If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored. const highestPresetObjectWithSameSlug = findInPresetsBy(features, blockName, presetPath, 'slug', presetObject.slug); if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) { return presetObject; } return undefined; } } } } } } function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) { if (!presetPropertyValue) { return presetPropertyValue; } const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath]; const metadata = PRESET_METADATA.find(data => data.cssVarInfix === cssVarInfix); if (!metadata) { // The property doesn't have preset data // so the value should be returned as it is. return presetPropertyValue; } const { valueKey, path } = metadata; const presetObject = findInPresetsBy(features, blockName, path, valueKey, presetPropertyValue); if (!presetObject) { // Value wasn't found in the presets, // so it must be a custom value. return presetPropertyValue; } return `var:preset|${cssVarInfix}|${presetObject.slug}`; } function getValueFromPresetVariable(features, blockName, variable, [presetType, slug]) { const metadata = PRESET_METADATA.find(data => data.cssVarInfix === presetType); if (!metadata) { return variable; } const presetObject = findInPresetsBy(features.settings, blockName, metadata.path, 'slug', slug); if (presetObject) { const { valueKey } = metadata; const result = presetObject[valueKey]; return getValueFromVariable(features, blockName, result); } return variable; } function getValueFromCustomVariable(features, blockName, variable, path) { var _getValueFromObjectPa; const result = (_getValueFromObjectPa = getValueFromObjectPath(features.settings, ['blocks', blockName, 'custom', ...path])) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(features.settings, ['custom', ...path]); if (!result) { return variable; } // A variable may reference another variable so we need recursion until we find the value. return getValueFromVariable(features, blockName, result); } /** * Attempts to fetch the value of a theme.json CSS variable. * * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree. * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks. * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value. * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument. */ function getValueFromVariable(features, blockName, variable) { if (!variable || typeof variable !== 'string') { if (typeof variable?.ref === 'string') { variable = getValueFromObjectPath(features, variable.ref); // Presence of another ref indicates a reference to another dynamic value. // Pointing to another dynamic value is not supported. if (!variable || !!variable?.ref) { return variable; } } else { return variable; } } const USER_VALUE_PREFIX = 'var:'; const THEME_VALUE_PREFIX = 'var(--wp--'; const THEME_VALUE_SUFFIX = ')'; let parsedVar; if (variable.startsWith(USER_VALUE_PREFIX)) { parsedVar = variable.slice(USER_VALUE_PREFIX.length).split('|'); } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) { parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split('--'); } else { // We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )` return variable; } const [type, ...path] = parsedVar; if (type === 'preset') { return getValueFromPresetVariable(features, blockName, variable, path); } if (type === 'custom') { return getValueFromCustomVariable(features, blockName, variable, path); } return variable; } /** * Function that scopes a selector with another one. This works a bit like * SCSS nesting except the `&` operator isn't supported. * * @example * ```js * const scope = '.a, .b .c'; * const selector = '> .x, .y'; * const merged = scopeSelector( scope, selector ); * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y' * ``` * * @param {string} scope Selector to scope to. * @param {string} selector Original selector. * * @return {string} Scoped selector. */ function scopeSelector(scope, selector) { if (!scope || !selector) { return selector; } const scopes = scope.split(','); const selectors = selector.split(','); const selectorsScoped = []; scopes.forEach(outer => { selectors.forEach(inner => { selectorsScoped.push(`${outer.trim()} ${inner.trim()}`); }); }); return selectorsScoped.join(', '); } /** * Scopes a collection of selectors for features and subfeatures. * * @example * ```js * const scope = '.custom-scope'; * const selectors = { * color: '.wp-my-block p', * typography: { fontSize: '.wp-my-block caption' }, * }; * const result = scopeFeatureSelector( scope, selectors ); * // result is { * // color: '.custom-scope .wp-my-block p', * // typography: { fonSize: '.custom-scope .wp-my-block caption' }, * // } * ``` * * @param {string} scope Selector to scope collection of selectors with. * @param {Object} selectors Collection of feature selectors e.g. * * @return {Object|undefined} Scoped collection of feature selectors. */ function scopeFeatureSelectors(scope, selectors) { if (!scope || !selectors) { return; } const featureSelectors = {}; Object.entries(selectors).forEach(([feature, selector]) => { if (typeof selector === 'string') { featureSelectors[feature] = scopeSelector(scope, selector); } if (typeof selector === 'object') { featureSelectors[feature] = {}; Object.entries(selector).forEach(([subfeature, subfeatureSelector]) => { featureSelectors[feature][subfeature] = scopeSelector(scope, subfeatureSelector); }); } }); return featureSelectors; } /** * Appends a sub-selector to an existing one. * * Given the compounded `selector` "h1, h2, h3" * and the `toAppend` selector ".some-class" the result will be * "h1.some-class, h2.some-class, h3.some-class". * * @param {string} selector Original selector. * @param {string} toAppend Selector to append. * * @return {string} The new selector. */ function appendToSelector(selector, toAppend) { if (!selector.includes(',')) { return selector + toAppend; } const selectors = selector.split(','); const newSelectors = selectors.map(sel => sel + toAppend); return newSelectors.join(','); } /** * Compares global style variations according to their styles and settings properties. * * @example * ```js * const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} }; * const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} }; * const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation ); * // false * ``` * * @param {Object} original A global styles object. * @param {Object} variation A global styles object. * * @return {boolean} Whether `original` and `variation` match. */ function areGlobalStyleConfigsEqual(original, variation) { if (typeof original !== 'object' || typeof variation !== 'object') { return original === variation; } return es6_default()(original?.styles, variation?.styles) && es6_default()(original?.settings, variation?.settings); } /** * Generates the selector for a block style variation by creating the * appropriate CSS class and adding it to the ancestor portion of the block's * selector. * * For example, take the Button block which has a compound selector: * `.wp-block-button .wp-block-button__link`. With a variation named 'custom', * the class `.is-style-custom` should be added to the `.wp-block-button` * ancestor only. * * This function will take into account comma separated and complex selectors. * * @param {string} variation Name for the variation. * @param {string} blockSelector CSS selector for the block. * * @return {string} CSS selector for the block style variation. */ function getBlockStyleVariationSelector(variation, blockSelector) { const variationClass = `.is-style-${variation}`; if (!blockSelector) { return variationClass; } const ancestorRegex = /((?::\([^)]+\))?\s*)([^\s:]+)/; const addVariationClass = (_match, group1, group2) => { return group1 + group2 + variationClass; }; const result = blockSelector.split(',').map(part => part.replace(ancestorRegex, addVariationClass)); return result.join(','); } /** * Looks up a theme file URI based on a relative path. * * @param {string} file A relative path. * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths. * @return {string} A resolved theme file URI, if one is found in the themeFileURIs collection. */ function getResolvedThemeFilePath(file, themeFileURIs) { if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) { return file; } const uri = themeFileURIs.find(themeFileUri => themeFileUri?.name === file); if (!uri?.href) { return file; } return uri?.href; } /** * Resolves ref values in theme JSON. * * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value. * @param {Object} tree A theme.json object. * @return {*} The resolved value or incoming ruleValue. */ function getResolvedRefValue(ruleValue, tree) { if (!ruleValue || !tree) { return ruleValue; } /* * Where the rule value is an object with a 'ref' property pointing * to a path, this converts that path into the value at that path. * For example: { "ref": "style.color.background" } => "#fff". */ if (typeof ruleValue !== 'string' && ruleValue?.ref) { const resolvedRuleValue = (0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)(getValueFromObjectPath(tree, ruleValue.ref)); /* * Presence of another ref indicates a reference to another dynamic value. * Pointing to another dynamic value is not supported. */ if (resolvedRuleValue?.ref) { return undefined; } if (resolvedRuleValue === undefined) { return ruleValue; } return resolvedRuleValue; } return ruleValue; } /** * Resolves ref and relative path values in theme JSON. * * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value. * @param {Object} tree A theme.json object. * @return {*} The resolved value or incoming ruleValue. */ function getResolvedValue(ruleValue, tree) { if (!ruleValue || !tree) { return ruleValue; } // Resolve ref values. const resolvedValue = getResolvedRefValue(ruleValue, tree); // Resolve relative paths. if (resolvedValue?.url) { resolvedValue.url = getResolvedThemeFilePath(resolvedValue.url, tree?._links?.['wp:theme-file']); } return resolvedValue; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/context.js /** * WordPress dependencies */ const DEFAULT_GLOBAL_STYLES_CONTEXT = { user: {}, base: {}, merged: {}, setUserConfig: () => {} }; const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_GLOBAL_STYLES_CONTEXT); ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/hooks.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const EMPTY_CONFIG = { settings: {}, styles: {} }; const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'background.backgroundImage', 'background.backgroundRepeat', 'background.backgroundSize', 'background.backgroundPosition', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.button', 'color.caption', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.heading', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'lightbox.enabled', 'lightbox.allowEditing', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.defaultSpacingSizes', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.defaultFontSizes', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textAlign', 'typography.textColumns', 'typography.textDecoration', 'typography.textTransform', 'typography.writingMode']; const useGlobalStylesReset = () => { const { user, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const config = { settings: user.settings, styles: user.styles }; const canReset = !!config && !es6_default()(config, EMPTY_CONFIG); return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(EMPTY_CONFIG), [setUserConfig])]; }; function useGlobalSetting(propertyPath, blockName, source = 'all') { const { setUserConfig, ...configs } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const appendedBlockPath = blockName ? '.blocks.' + blockName : ''; const appendedPropertyPath = propertyPath ? '.' + propertyPath : ''; const contextualPath = `settings${appendedBlockPath}${appendedPropertyPath}`; const globalPath = `settings${appendedPropertyPath}`; const sourceKey = source === 'all' ? 'merged' : source; const settingValue = (0,external_wp_element_namespaceObject.useMemo)(() => { const configToUse = configs[sourceKey]; if (!configToUse) { throw 'Unsupported source'; } if (propertyPath) { var _getValueFromObjectPa; return (_getValueFromObjectPa = getValueFromObjectPath(configToUse, contextualPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(configToUse, globalPath); } let result = {}; VALID_SETTINGS.forEach(setting => { var _getValueFromObjectPa2; const value = (_getValueFromObjectPa2 = getValueFromObjectPath(configToUse, `settings${appendedBlockPath}.${setting}`)) !== null && _getValueFromObjectPa2 !== void 0 ? _getValueFromObjectPa2 : getValueFromObjectPath(configToUse, `settings.${setting}`); if (value !== undefined) { result = setImmutably(result, setting.split('.'), value); } }); return result; }, [configs, sourceKey, propertyPath, contextualPath, globalPath, appendedBlockPath]); const setSetting = newValue => { setUserConfig(currentConfig => setImmutably(currentConfig, contextualPath.split('.'), newValue)); }; return [settingValue, setSetting]; } function useGlobalStyle(path, blockName, source = 'all', { shouldDecodeEncode = true } = {}) { const { merged: mergedConfig, base: baseConfig, user: userConfig, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const appendedPath = path ? '.' + path : ''; const finalPath = !blockName ? `styles${appendedPath}` : `styles.blocks.${blockName}${appendedPath}`; const setStyle = newValue => { setUserConfig(currentConfig => setImmutably(currentConfig, finalPath.split('.'), shouldDecodeEncode ? getPresetVariableFromValue(mergedConfig.settings, blockName, path, newValue) : newValue)); }; let rawResult, result; switch (source) { case 'all': rawResult = getValueFromObjectPath(mergedConfig, finalPath); result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult; break; case 'user': rawResult = getValueFromObjectPath(userConfig, finalPath); result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult; break; case 'base': rawResult = getValueFromObjectPath(baseConfig, finalPath); result = shouldDecodeEncode ? getValueFromVariable(baseConfig, blockName, rawResult) : rawResult; break; default: throw 'Unsupported source'; } return [result, setStyle]; } /** * React hook that overrides a global settings object with block and element specific settings. * * @param {Object} parentSettings Settings object. * @param {blockName?} blockName Block name. * @param {element?} element Element name. * * @return {Object} Merge of settings and supports. */ function useSettingsForBlockElement(parentSettings, blockName, element) { const { supportedStyles, supports } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { supportedStyles: unlock(select(external_wp_blocks_namespaceObject.store)).getSupportedStyles(blockName, element), supports: select(external_wp_blocks_namespaceObject.store).getBlockType(blockName)?.supports }; }, [blockName, element]); return (0,external_wp_element_namespaceObject.useMemo)(() => { const updatedSettings = { ...parentSettings }; if (!supportedStyles.includes('fontSize')) { updatedSettings.typography = { ...updatedSettings.typography, fontSizes: {}, customFontSize: false, defaultFontSizes: false }; } if (!supportedStyles.includes('fontFamily')) { updatedSettings.typography = { ...updatedSettings.typography, fontFamilies: {} }; } updatedSettings.color = { ...updatedSettings.color, text: updatedSettings.color?.text && supportedStyles.includes('color'), background: updatedSettings.color?.background && (supportedStyles.includes('background') || supportedStyles.includes('backgroundColor')), button: updatedSettings.color?.button && supportedStyles.includes('buttonColor'), heading: updatedSettings.color?.heading && supportedStyles.includes('headingColor'), link: updatedSettings.color?.link && supportedStyles.includes('linkColor'), caption: updatedSettings.color?.caption && supportedStyles.includes('captionColor') }; // Some blocks can enable background colors but disable gradients. if (!supportedStyles.includes('background')) { updatedSettings.color.gradients = []; updatedSettings.color.customGradient = false; } // If filters are not supported by the block/element, disable duotone. if (!supportedStyles.includes('filter')) { updatedSettings.color.defaultDuotone = false; updatedSettings.color.customDuotone = false; } ['lineHeight', 'fontStyle', 'fontWeight', 'letterSpacing', 'textAlign', 'textTransform', 'textDecoration', 'writingMode'].forEach(key => { if (!supportedStyles.includes(key)) { updatedSettings.typography = { ...updatedSettings.typography, [key]: false }; } }); // The column-count style is named text column to reduce confusion with // the columns block and manage expectations from the support. // See: https://github.com/WordPress/gutenberg/pull/33587 if (!supportedStyles.includes('columnCount')) { updatedSettings.typography = { ...updatedSettings.typography, textColumns: false }; } ['contentSize', 'wideSize'].forEach(key => { if (!supportedStyles.includes(key)) { updatedSettings.layout = { ...updatedSettings.layout, [key]: false }; } }); ['padding', 'margin', 'blockGap'].forEach(key => { if (!supportedStyles.includes(key)) { updatedSettings.spacing = { ...updatedSettings.spacing, [key]: false }; } const sides = Array.isArray(supports?.spacing?.[key]) ? supports?.spacing?.[key] : supports?.spacing?.[key]?.sides; // Check if spacing type is supported before adding sides. if (sides?.length && updatedSettings.spacing?.[key]) { updatedSettings.spacing = { ...updatedSettings.spacing, [key]: { ...updatedSettings.spacing?.[key], sides } }; } }); ['aspectRatio', 'minHeight'].forEach(key => { if (!supportedStyles.includes(key)) { updatedSettings.dimensions = { ...updatedSettings.dimensions, [key]: false }; } }); ['radius', 'color', 'style', 'width'].forEach(key => { if (!supportedStyles.includes('border' + key.charAt(0).toUpperCase() + key.slice(1))) { updatedSettings.border = { ...updatedSettings.border, [key]: false }; } }); ['backgroundImage', 'backgroundSize'].forEach(key => { if (!supportedStyles.includes(key)) { updatedSettings.background = { ...updatedSettings.background, [key]: false }; } }); updatedSettings.shadow = supportedStyles.includes('shadow') ? updatedSettings.shadow : false; // Text alignment is only available for blocks. if (element) { updatedSettings.typography.textAlign = false; } return updatedSettings; }, [parentSettings, supportedStyles, supports, element]); } function useColorsPerOrigin(settings) { const customColors = settings?.color?.palette?.custom; const themeColors = settings?.color?.palette?.theme; const defaultColors = settings?.color?.palette?.default; const shouldDisplayDefaultColors = settings?.color?.defaultPalette; return (0,external_wp_element_namespaceObject.useMemo)(() => { const result = []; if (themeColors && themeColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), colors: themeColors }); } if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), colors: defaultColors }); } if (customColors && customColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), colors: customColors }); } return result; }, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]); } function useGradientsPerOrigin(settings) { const customGradients = settings?.color?.gradients?.custom; const themeGradients = settings?.color?.gradients?.theme; const defaultGradients = settings?.color?.gradients?.default; const shouldDisplayDefaultGradients = settings?.color?.defaultGradients; return (0,external_wp_element_namespaceObject.useMemo)(() => { const result = []; if (themeGradients && themeGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), gradients: themeGradients }); } if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), gradients: defaultGradients }); } if (customGradients && customGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), gradients: customGradients }); } return result; }, [customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients]); } ;// ./node_modules/clsx/dist/clsx.mjs function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * External dependencies */ /** * Removed falsy values from nested object. * * @param {*} object * @return {*} Object cleaned from falsy values */ const utils_cleanEmptyObject = object => { if (object === null || typeof object !== 'object' || Array.isArray(object)) { return object; } const cleanedNestedObjects = Object.entries(object).map(([key, value]) => [key, utils_cleanEmptyObject(value)]).filter(([, value]) => value !== undefined); return !cleanedNestedObjects.length ? undefined : Object.fromEntries(cleanedNestedObjects); }; function transformStyles(activeSupports, migrationPaths, result, source, index, results) { // If there are no active supports return early. if (Object.values(activeSupports !== null && activeSupports !== void 0 ? activeSupports : {}).every(isActive => !isActive)) { return result; } // If the condition verifies we are probably in the presence of a wrapping transform // e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed. if (results.length === 1 && result.innerBlocks.length === source.length) { return result; } // For cases where we have a transform from one block to multiple blocks // or multiple blocks to one block we apply the styles of the first source block // to the result(s). let referenceBlockAttributes = source[0]?.attributes; // If we are in presence of transform between more than one block in the source // that has more than one block in the result // we apply the styles on source N to the result N, // if source N does not exists we do nothing. if (results.length > 1 && source.length > 1) { if (source[index]) { referenceBlockAttributes = source[index]?.attributes; } else { return result; } } let returnBlock = result; Object.entries(activeSupports).forEach(([support, isActive]) => { if (isActive) { migrationPaths[support].forEach(path => { const styleValue = getValueFromObjectPath(referenceBlockAttributes, path); if (styleValue) { returnBlock = { ...returnBlock, attributes: setImmutably(returnBlock.attributes, path, styleValue) }; } }); } }); return returnBlock; } /** * Check whether serialization of specific block support feature or set should * be skipped. * * @param {string|Object} blockNameOrType Block name or block type object. * @param {string} featureSet Name of block support feature set. * @param {string} feature Name of the individual feature to check. * * @return {boolean} Whether serialization should occur. */ function shouldSkipSerialization(blockNameOrType, featureSet, feature) { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, featureSet); const skipSerialization = support?.__experimentalSkipSerialization; if (Array.isArray(skipSerialization)) { return skipSerialization.includes(feature); } return skipSerialization; } const pendingStyleOverrides = new WeakMap(); /** * Override a block editor settings style. Leave the ID blank to create a new * style. * * @param {Object} override Override object. * @param {?string} override.id Id of the style override, leave blank to create * a new style. * @param {string} override.css CSS to apply. */ function useStyleOverride({ id, css }) { return usePrivateStyleOverride({ id, css }); } function usePrivateStyleOverride({ id, css, assets, __unstableType, variation, clientId } = {}) { const { setStyleOverride, deleteStyleOverride } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const fallbackId = (0,external_wp_element_namespaceObject.useId)(); (0,external_wp_element_namespaceObject.useEffect)(() => { // Unmount if there is CSS and assets are empty. if (!css && !assets) { return; } const _id = id || fallbackId; const override = { id, css, assets, __unstableType, variation, clientId }; // Batch updates to style overrides to avoid triggering cascading renders // for each style override block included in a tree and optimize initial render. if (!pendingStyleOverrides.get(registry)) { pendingStyleOverrides.set(registry, []); } pendingStyleOverrides.get(registry).push([_id, override]); window.queueMicrotask(() => { if (pendingStyleOverrides.get(registry)?.length) { registry.batch(() => { pendingStyleOverrides.get(registry).forEach(args => { setStyleOverride(...args); }); pendingStyleOverrides.set(registry, []); }); } }); return () => { const isPending = pendingStyleOverrides.get(registry)?.find(([currentId]) => currentId === _id); if (isPending) { pendingStyleOverrides.set(registry, pendingStyleOverrides.get(registry).filter(([currentId]) => currentId !== _id)); } else { deleteStyleOverride(_id); } }; }, [id, css, clientId, assets, __unstableType, fallbackId, setStyleOverride, deleteStyleOverride, registry]); } /** * Based on the block and its context, returns an object of all the block settings. * This object can be passed as a prop to all the Styles UI components * (TypographyPanel, DimensionsPanel...). * * @param {string} name Block name. * @param {*} parentLayout Parent layout. * * @return {Object} Settings object. */ function useBlockSettings(name, parentLayout) { const [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, defaultFontSizesEnabled, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, defaultSpacingSizesEnabled, customSpacingSize, userSpacingSizes, defaultSpacingSizes, themeSpacingSizes, units, aspectRatio, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow] = use_settings_useSettings('background.backgroundImage', 'background.backgroundSize', 'typography.fontFamilies.custom', 'typography.fontFamilies.default', 'typography.fontFamilies.theme', 'typography.defaultFontSizes', 'typography.fontSizes.custom', 'typography.fontSizes.default', 'typography.fontSizes.theme', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', 'typography.lineHeight', 'typography.textAlign', 'typography.textColumns', 'typography.textDecoration', 'typography.writingMode', 'typography.textTransform', 'typography.letterSpacing', 'spacing.padding', 'spacing.margin', 'spacing.blockGap', 'spacing.defaultSpacingSizes', 'spacing.customSpacingSize', 'spacing.spacingSizes.custom', 'spacing.spacingSizes.default', 'spacing.spacingSizes.theme', 'spacing.units', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout', 'border.color', 'border.radius', 'border.style', 'border.width', 'color.custom', 'color.palette.custom', 'color.customDuotone', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients', 'color.customGradient', 'color.background', 'color.link', 'color.text', 'color.heading', 'color.button', 'shadow'); const rawSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { return { background: { backgroundImage, backgroundSize }, color: { palette: { custom: customColors, theme: themeColors, default: defaultColors }, gradients: { custom: userGradientPalette, theme: themeGradientPalette, default: defaultGradientPalette }, duotone: { custom: userDuotonePalette, theme: themeDuotonePalette, default: defaultDuotonePalette }, defaultGradients, defaultPalette, defaultDuotone, custom: customColorsEnabled, customGradient: areCustomGradientsEnabled, customDuotone, background: isBackgroundEnabled, link: isLinkEnabled, heading: isHeadingEnabled, button: isButtonEnabled, text: isTextEnabled }, typography: { fontFamilies: { custom: customFontFamilies, default: defaultFontFamilies, theme: themeFontFamilies }, fontSizes: { custom: customFontSizes, default: defaultFontSizes, theme: themeFontSizes }, customFontSize, defaultFontSizes: defaultFontSizesEnabled, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, textTransform, letterSpacing, writingMode }, spacing: { spacingSizes: { custom: userSpacingSizes, default: defaultSpacingSizes, theme: themeSpacingSizes }, customSpacingSize, defaultSpacingSizes: defaultSpacingSizesEnabled, padding, margin, blockGap, units }, border: { color: borderColor, radius: borderRadius, style: borderStyle, width: borderWidth }, dimensions: { aspectRatio, minHeight }, layout, parentLayout, shadow }; }, [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, defaultFontSizesEnabled, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, defaultSpacingSizesEnabled, customSpacingSize, userSpacingSizes, defaultSpacingSizes, themeSpacingSizes, units, aspectRatio, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow]); return useSettingsForBlockElement(rawSettings, name); } function createBlockEditFilter(features) { // We don't want block controls to re-render when typing inside a block. // `memo` will prevent re-renders unless props change, so only pass the // needed props and not the whole attributes object. features = features.map(settings => { return { ...settings, Edit: (0,external_wp_element_namespaceObject.memo)(settings.edit) }; }); const withBlockEditHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalBlockEdit => props => { const context = useBlockEditContext(); // CAUTION: code added before this line will be executed for all // blocks, not just those that support the feature! Code added // above this line should be carefully evaluated for its impact on // performance. return [...features.map((feature, i) => { const { Edit, hasSupport, attributeKeys = [], shareWithChildBlocks } = feature; const shouldDisplayControls = context[mayDisplayControlsKey] || context[mayDisplayParentControlsKey] && shareWithChildBlocks; if (!shouldDisplayControls || !hasSupport(props.name)) { return null; } const neededProps = {}; for (const key of attributeKeys) { if (props.attributes[key]) { neededProps[key] = props.attributes[key]; } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Edit // We can use the index because the array length // is fixed per page load right now. , { name: props.name, isSelected: props.isSelected, clientId: props.clientId, setAttributes: props.setAttributes, __unstableParentLayout: props.__unstableParentLayout // This component is pure, so only pass needed // props!!! , ...neededProps }, i); }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalBlockEdit, { ...props }, "edit")]; }, 'withBlockEditHooks'); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks); } function BlockProps({ index, useBlockProps: hook, setAllWrapperProps, ...props }) { const wrapperProps = hook(props); const setWrapperProps = next => setAllWrapperProps(prev => { const nextAll = [...prev]; nextAll[index] = next; return nextAll; }); // Setting state after every render is fine because this component is // pure and will only re-render when needed props change. (0,external_wp_element_namespaceObject.useEffect)(() => { // We could shallow compare the props, but since this component only // changes when needed attributes change, the benefit is probably small. setWrapperProps(wrapperProps); return () => { setWrapperProps(undefined); }; }); return null; } const BlockPropsPure = (0,external_wp_element_namespaceObject.memo)(BlockProps); function createBlockListBlockFilter(features) { const withBlockListBlockHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { const [allWrapperProps, setAllWrapperProps] = (0,external_wp_element_namespaceObject.useState)(Array(features.length).fill(undefined)); return [...features.map((feature, i) => { const { hasSupport, attributeKeys = [], useBlockProps, isMatch } = feature; const neededProps = {}; for (const key of attributeKeys) { if (props.attributes[key]) { neededProps[key] = props.attributes[key]; } } if ( // Skip rendering if none of the needed attributes are // set. !Object.keys(neededProps).length || !hasSupport(props.name) || isMatch && !isMatch(neededProps)) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPropsPure // We can use the index because the array length // is fixed per page load right now. , { index: i, useBlockProps: useBlockProps // This component is pure, so we must pass a stable // function reference. , setAllWrapperProps: setAllWrapperProps, name: props.name, clientId: props.clientId // This component is pure, so only pass needed // props!!! , ...neededProps }, i); }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListBlock, { ...props, wrapperProps: allWrapperProps.filter(Boolean).reduce((acc, wrapperProps) => { return { ...acc, ...wrapperProps, className: dist_clsx(acc.className, wrapperProps.className), style: { ...acc.style, ...wrapperProps.style } }; }, props.wrapperProps || {}) }, "edit")]; }, 'withBlockListBlockHooks'); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/hooks', withBlockListBlockHooks); } function createBlockSaveFilter(features) { function extraPropsFromHooks(props, name, attributes) { return features.reduce((accu, feature) => { const { hasSupport, attributeKeys = [], addSaveProps } = feature; const neededAttributes = {}; for (const key of attributeKeys) { if (attributes[key]) { neededAttributes[key] = attributes[key]; } } if ( // Skip rendering if none of the needed attributes are // set. !Object.keys(neededAttributes).length || !hasSupport(name)) { return accu; } return addSaveProps(accu, name, neededAttributes); }, props); } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/editor/hooks', extraPropsFromHooks, 0); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/editor/hooks', props => { // Previously we had a filter deleting the className if it was an empty // string. That filter is no longer running, so now we need to delete it // here. if (props.hasOwnProperty('className') && !props.className) { delete props.className; } return props; }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/compat.js /** * WordPress dependencies */ function migrateLightBlockWrapper(settings) { const { apiVersion = 1 } = settings; if (apiVersion < 2 && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'lightBlockWrapper', false)) { settings.apiVersion = 2; } return settings; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/compat/migrateLightBlockWrapper', migrateLightBlockWrapper); ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/groups.js /** * WordPress dependencies */ const BlockControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControls'); const BlockControlsBlock = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControlsBlock'); const BlockControlsInline = (0,external_wp_components_namespaceObject.createSlotFill)('BlockFormatControls'); const BlockControlsOther = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControlsOther'); const BlockControlsParent = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControlsParent'); const groups = { default: BlockControlsDefault, block: BlockControlsBlock, inline: BlockControlsInline, other: BlockControlsOther, parent: BlockControlsParent }; /* harmony default export */ const block_controls_groups = (groups); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBlockControlsFill(group, shareWithChildBlocks) { const context = useBlockEditContext(); if (context[mayDisplayControlsKey]) { return block_controls_groups[group]?.Fill; } if (context[mayDisplayParentControlsKey] && shareWithChildBlocks) { return block_controls_groups.parent.Fill; } return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/fill.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockControlsFill({ group = 'default', controls, children, __experimentalShareWithChildBlocks = false }) { const Fill = useBlockControlsFill(group, __experimentalShareWithChildBlocks); if (!Fill) { return null; } const innerMarkup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [group === 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { controls: controls }), children] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document: document, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: fillProps => { // `fillProps.forwardedContext` is an array of context provider entries, provided by slot, // that should wrap the fill markup. const { forwardedContext = [] } = fillProps; return forwardedContext.reduce((inner, [Provider, props]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { ...props, children: inner }), innerMarkup); } }) }); } ;// external ["wp","warning"] const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/slot.js /** * WordPress dependencies */ /** * Internal dependencies */ const { ComponentsContext } = unlock(external_wp_components_namespaceObject.privateApis); function BlockControlsSlot({ group = 'default', ...props }) { const toolbarState = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolbarContext); const contextState = (0,external_wp_element_namespaceObject.useContext)(ComponentsContext); const fillProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ forwardedContext: [[external_wp_components_namespaceObject.__experimentalToolbarContext.Provider, { value: toolbarState }], [ComponentsContext.Provider, { value: contextState }]] }), [toolbarState, contextState]); const slotFill = block_controls_groups[group]; const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotFill.name); if (!slotFill) { true ? external_wp_warning_default()(`Unknown BlockControls group "${group}" provided.`) : 0; return null; } if (!fills?.length) { return null; } const { Slot } = slotFill; const slot = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, bubblesVirtually: true, fillProps: fillProps }); if (group === 'default') { return slot; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: slot }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js /** * Internal dependencies */ const BlockControls = BlockControlsFill; BlockControls.Slot = BlockControlsSlot; // This is just here for backward compatibility. const BlockFormatControls = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsFill, { group: "inline", ...props }); }; BlockFormatControls.Slot = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsSlot, { group: "inline", ...props }); }; /* harmony default export */ const block_controls = (BlockControls); ;// ./node_modules/@wordpress/icons/build-module/library/justify-left.js /** * WordPress dependencies */ const justifyLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 9v6h11V9H9zM4 20h1.5V4H4v16z" }) }); /* harmony default export */ const justify_left = (justifyLeft); ;// ./node_modules/@wordpress/icons/build-module/library/justify-center.js /** * WordPress dependencies */ const justifyCenter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z" }) }); /* harmony default export */ const justify_center = (justifyCenter); ;// ./node_modules/@wordpress/icons/build-module/library/justify-right.js /** * WordPress dependencies */ const justifyRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z" }) }); /* harmony default export */ const justify_right = (justifyRight); ;// ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js /** * WordPress dependencies */ const justifySpaceBetween = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z" }) }); /* harmony default export */ const justify_space_between = (justifySpaceBetween); ;// ./node_modules/@wordpress/icons/build-module/library/justify-stretch.js /** * WordPress dependencies */ const justifyStretch = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 4H5.5V20H4V4ZM7 10L17 10V14L7 14V10ZM20 4H18.5V20H20V4Z" }) }); /* harmony default export */ const justify_stretch = (justifyStretch); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js /** * WordPress dependencies */ const arrowRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); /* harmony default export */ const arrow_right = (arrowRight); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js /** * WordPress dependencies */ const arrowDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) }); /* harmony default export */ const arrow_down = (arrowDown); ;// ./node_modules/@wordpress/block-editor/build-module/layouts/definitions.js // Layout definitions keyed by layout type. // Provides a common definition of slugs, classnames, base styles, and spacing styles for each layout type. // If making changes or additions to layout definitions, be sure to update the corresponding PHP definitions in // `block-supports/layout.php` so that the server-side and client-side definitions match. const LAYOUT_DEFINITIONS = { default: { name: 'default', slug: 'flow', className: 'is-layout-flow', baseStyles: [{ selector: ' > .alignleft', rules: { float: 'left', 'margin-inline-start': '0', 'margin-inline-end': '2em' } }, { selector: ' > .alignright', rules: { float: 'right', 'margin-inline-start': '2em', 'margin-inline-end': '0' } }, { selector: ' > .aligncenter', rules: { 'margin-left': 'auto !important', 'margin-right': 'auto !important' } }], spacingStyles: [{ selector: ' > :first-child', rules: { 'margin-block-start': '0' } }, { selector: ' > :last-child', rules: { 'margin-block-end': '0' } }, { selector: ' > *', rules: { 'margin-block-start': null, 'margin-block-end': '0' } }] }, constrained: { name: 'constrained', slug: 'constrained', className: 'is-layout-constrained', baseStyles: [{ selector: ' > .alignleft', rules: { float: 'left', 'margin-inline-start': '0', 'margin-inline-end': '2em' } }, { selector: ' > .alignright', rules: { float: 'right', 'margin-inline-start': '2em', 'margin-inline-end': '0' } }, { selector: ' > .aligncenter', rules: { 'margin-left': 'auto !important', 'margin-right': 'auto !important' } }, { selector: ' > :where(:not(.alignleft):not(.alignright):not(.alignfull))', rules: { 'max-width': 'var(--wp--style--global--content-size)', 'margin-left': 'auto !important', 'margin-right': 'auto !important' } }, { selector: ' > .alignwide', rules: { 'max-width': 'var(--wp--style--global--wide-size)' } }], spacingStyles: [{ selector: ' > :first-child', rules: { 'margin-block-start': '0' } }, { selector: ' > :last-child', rules: { 'margin-block-end': '0' } }, { selector: ' > *', rules: { 'margin-block-start': null, 'margin-block-end': '0' } }] }, flex: { name: 'flex', slug: 'flex', className: 'is-layout-flex', displayMode: 'flex', baseStyles: [{ selector: '', rules: { 'flex-wrap': 'wrap', 'align-items': 'center' } }, { selector: ' > :is(*, div)', // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: '0' } }], spacingStyles: [{ selector: '', rules: { gap: null } }] }, grid: { name: 'grid', slug: 'grid', className: 'is-layout-grid', displayMode: 'grid', baseStyles: [{ selector: ' > :is(*, div)', // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: '0' } }], spacingStyles: [{ selector: '', rules: { gap: null } }] } }; ;// ./node_modules/@wordpress/block-editor/build-module/layouts/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Utility to generate the proper CSS selector for layout styles. * * @param {string} selectors CSS selector, also supports multiple comma-separated selectors. * @param {string} append The string to append. * * @return {string} - CSS selector. */ function appendSelectors(selectors, append = '') { return selectors.split(',').map(subselector => `${subselector}${append ? ` ${append}` : ''}`).join(','); } /** * Get generated blockGap CSS rules based on layout definitions provided in theme.json * Falsy values in the layout definition's spacingStyles rules will be swapped out * with the provided `blockGapValue`. * * @param {string} selector The CSS selector to target for the generated rules. * @param {Object} layoutDefinitions Layout definitions object. * @param {string} layoutType The layout type (e.g. `default` or `flex`). * @param {string} blockGapValue The current blockGap value to be applied. * @return {string} The generated CSS rules. */ function getBlockGapCSS(selector, layoutDefinitions = LAYOUT_DEFINITIONS, layoutType, blockGapValue) { let output = ''; if (layoutDefinitions?.[layoutType]?.spacingStyles?.length && blockGapValue) { layoutDefinitions[layoutType].spacingStyles.forEach(gapStyle => { output += `${appendSelectors(selector, gapStyle.selector.trim())} { `; output += Object.entries(gapStyle.rules).map(([cssProperty, value]) => `${cssProperty}: ${value ? value : blockGapValue}`).join('; '); output += '; }'; }); } return output; } /** * Helper method to assign contextual info to clarify * alignment settings. * * Besides checking if `contentSize` and `wideSize` have a * value, we now show this information only if their values * are not a `css var`. This needs to change when parsing * css variables land. * * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752 * * @param {Object} layout The layout object. * @return {Object} An object with contextual info per alignment. */ function getAlignmentsInfo(layout) { const { contentSize, wideSize, type = 'default' } = layout; const alignmentInfo = {}; const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i; if (sizeRegex.test(contentSize) && type === 'constrained') { // translators: %s: container size (i.e. 600px etc) alignmentInfo.none = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Max %s wide'), contentSize); } if (sizeRegex.test(wideSize)) { // translators: %s: container size (i.e. 600px etc) alignmentInfo.wide = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Max %s wide'), wideSize); } return alignmentInfo; } ;// ./node_modules/@wordpress/icons/build-module/library/sides-all.js /** * WordPress dependencies */ const sidesAll = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z" }) }); /* harmony default export */ const sides_all = (sidesAll); ;// ./node_modules/@wordpress/icons/build-module/library/sides-horizontal.js /** * WordPress dependencies */ const sidesHorizontal = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m4.5 7.5v9h1.5v-9z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18 7.5v9h1.5v-9z" })] }); /* harmony default export */ const sides_horizontal = (sidesHorizontal); ;// ./node_modules/@wordpress/icons/build-module/library/sides-vertical.js /** * WordPress dependencies */ const sidesVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 19.5h9v-1.5h-9z" })] }); /* harmony default export */ const sides_vertical = (sidesVertical); ;// ./node_modules/@wordpress/icons/build-module/library/sides-top.js /** * WordPress dependencies */ const sidesTop = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 6h-9v-1.5h9z" })] }); /* harmony default export */ const sides_top = (sidesTop); ;// ./node_modules/@wordpress/icons/build-module/library/sides-right.js /** * WordPress dependencies */ const sidesRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18 16.5v-9h1.5v9z" })] }); /* harmony default export */ const sides_right = (sidesRight); ;// ./node_modules/@wordpress/icons/build-module/library/sides-bottom.js /** * WordPress dependencies */ const sidesBottom = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 19.5h-9v-1.5h9z" })] }); /* harmony default export */ const sides_bottom = (sidesBottom); ;// ./node_modules/@wordpress/icons/build-module/library/sides-left.js /** * WordPress dependencies */ const sidesLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m4.5 16.5v-9h1.5v9z" })] }); /* harmony default export */ const sides_left = (sidesLeft); ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/utils.js /** * WordPress dependencies */ const RANGE_CONTROL_MAX_SIZE = 8; const ALL_SIDES = ['top', 'right', 'bottom', 'left']; const DEFAULT_VALUES = { top: undefined, right: undefined, bottom: undefined, left: undefined }; const ICONS = { custom: sides_all, axial: sides_all, horizontal: sides_horizontal, vertical: sides_vertical, top: sides_top, right: sides_right, bottom: sides_bottom, left: sides_left }; const LABELS = { default: (0,external_wp_i18n_namespaceObject.__)('Spacing control'), top: (0,external_wp_i18n_namespaceObject.__)('Top'), bottom: (0,external_wp_i18n_namespaceObject.__)('Bottom'), left: (0,external_wp_i18n_namespaceObject.__)('Left'), right: (0,external_wp_i18n_namespaceObject.__)('Right'), mixed: (0,external_wp_i18n_namespaceObject.__)('Mixed'), vertical: (0,external_wp_i18n_namespaceObject.__)('Vertical'), horizontal: (0,external_wp_i18n_namespaceObject.__)('Horizontal'), axial: (0,external_wp_i18n_namespaceObject.__)('Horizontal & vertical'), custom: (0,external_wp_i18n_namespaceObject.__)('Custom') }; const VIEWS = { axial: 'axial', top: 'top', right: 'right', bottom: 'bottom', left: 'left', custom: 'custom' }; /** * Checks is given value is a spacing preset. * * @param {string} value Value to check * * @return {boolean} Return true if value is string in format var:preset|spacing|. */ function isValueSpacingPreset(value) { if (!value?.includes) { return false; } return value === '0' || value.includes('var:preset|spacing|'); } /** * Converts a spacing preset into a custom value. * * @param {string} value Value to convert * @param {Array} spacingSizes Array of the current spacing preset objects * * @return {string} Mapping of the spacing preset to its equivalent custom value. */ function getCustomValueFromPreset(value, spacingSizes) { if (!isValueSpacingPreset(value)) { return value; } const slug = getSpacingPresetSlug(value); const spacingSize = spacingSizes.find(size => String(size.slug) === slug); return spacingSize?.size; } /** * Converts a custom value to preset value if one can be found. * * Returns value as-is if no match is found. * * @param {string} value Value to convert * @param {Array} spacingSizes Array of the current spacing preset objects * * @return {string} The preset value if it can be found. */ function getPresetValueFromCustomValue(value, spacingSizes) { // Return value as-is if it is undefined or is already a preset, or '0'; if (!value || isValueSpacingPreset(value) || value === '0') { return value; } const spacingMatch = spacingSizes.find(size => String(size.size) === String(value)); if (spacingMatch?.slug) { return `var:preset|spacing|${spacingMatch.slug}`; } return value; } /** * Converts a spacing preset into a custom value. * * @param {string} value Value to convert. * * @return {string | undefined} CSS var string for given spacing preset value. */ function getSpacingPresetCssVar(value) { if (!value) { return; } const slug = value.match(/var:preset\|spacing\|(.+)/); if (!slug) { return value; } return `var(--wp--preset--spacing--${slug[1]})`; } /** * Returns the slug section of the given spacing preset string. * * @param {string} value Value to extract slug from. * * @return {string|undefined} The int value of the slug from given spacing preset. */ function getSpacingPresetSlug(value) { if (!value) { return; } if (value === '0' || value === 'default') { return value; } const slug = value.match(/var:preset\|spacing\|(.+)/); return slug ? slug[1] : undefined; } /** * Converts spacing preset value into a Range component value . * * @param {string} presetValue Value to convert to Range value. * @param {Array} spacingSizes Array of current spacing preset value objects. * * @return {number} The int value for use in Range control. */ function getSliderValueFromPreset(presetValue, spacingSizes) { if (presetValue === undefined) { return 0; } const slug = parseFloat(presetValue, 10) === 0 ? '0' : getSpacingPresetSlug(presetValue); const sliderValue = spacingSizes.findIndex(spacingSize => { return String(spacingSize.slug) === slug; }); // Returning NaN rather than undefined as undefined makes range control thumb sit in center return sliderValue !== -1 ? sliderValue : NaN; } /** * Determines whether a particular axis has support. If no axis is * specified, this function checks if either axis is supported. * * @param {Array} sides Supported sides. * @param {string} axis Which axis to check. * * @return {boolean} Whether there is support for the specified axis or both axes. */ function hasAxisSupport(sides, axis) { if (!sides || !sides.length) { return false; } const hasHorizontalSupport = sides.includes('horizontal') || sides.includes('left') && sides.includes('right'); const hasVerticalSupport = sides.includes('vertical') || sides.includes('top') && sides.includes('bottom'); if (axis === 'horizontal') { return hasHorizontalSupport; } if (axis === 'vertical') { return hasVerticalSupport; } return hasHorizontalSupport || hasVerticalSupport; } /** * Checks if the supported sides are balanced for each axis. * - Horizontal - both left and right sides are supported. * - Vertical - both top and bottom are supported. * * @param {Array} sides The supported sides which may be axes as well. * * @return {boolean} Whether or not the supported sides are balanced. */ function hasBalancedSidesSupport(sides = []) { const counts = { top: 0, right: 0, bottom: 0, left: 0 }; sides.forEach(side => counts[side] += 1); return (counts.top + counts.bottom) % 2 === 0 && (counts.left + counts.right) % 2 === 0; } /** * Determines which view the SpacingSizesControl should default to on its * first render; Axial, Custom, or Single side. * * @param {Object} values Current side values. * @param {Array} sides Supported sides. * * @return {string} View to display. */ function getInitialView(values = {}, sides) { const { top, right, bottom, left } = values; const sideValues = [top, right, bottom, left].filter(Boolean); // Axial ( Horizontal & vertical ). // - Has axial side support // - Has axial side values which match // - Has no values and the supported sides are balanced const hasMatchingAxialValues = top === bottom && left === right && (!!top || !!left); const hasNoValuesAndBalancedSides = !sideValues.length && hasBalancedSidesSupport(sides); const hasOnlyAxialSides = sides?.includes('horizontal') && sides?.includes('vertical') && sides?.length === 2; if (hasAxisSupport(sides) && (hasMatchingAxialValues || hasNoValuesAndBalancedSides)) { return VIEWS.axial; } // Only axial sides are supported and single value defined. // - Ensure the side returned is the first side that has a value. if (hasOnlyAxialSides && sideValues.length === 1) { let side; Object.entries(values).some(([key, value]) => { side = key; return value !== undefined; }); return side; } // Only single side supported and no value defined. if (sides?.length === 1 && !sideValues.length) { return sides[0]; } // Default to the Custom (separated sides) view. return VIEWS.custom; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/gap.js /** * Internal dependencies */ /** * Returns a BoxControl object value from a given blockGap style value. * The string check is for backwards compatibility before Gutenberg supported * split gap values (row and column) and the value was a string n + unit. * * @param {?string | ?Object} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}. * @return {Object|null} A value to pass to the BoxControl component. */ function getGapBoxControlValueFromStyle(blockGapValue) { if (!blockGapValue) { return null; } const isValueString = typeof blockGapValue === 'string'; return { top: isValueString ? blockGapValue : blockGapValue?.top, left: isValueString ? blockGapValue : blockGapValue?.left }; } /** * Returns a CSS value for the `gap` property from a given blockGap style. * * @param {?string | ?Object} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}. * @param {?string} defaultValue A default gap value. * @return {string|null} The concatenated gap value (row and column). */ function getGapCSSValue(blockGapValue, defaultValue = '0') { const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); if (!blockGapBoxControlValue) { return null; } const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue; const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue; return row === column ? row : `${row} ${column}`; } ;// ./node_modules/@wordpress/icons/build-module/library/justify-top.js /** * WordPress dependencies */ const justifyTop = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z" }) }); /* harmony default export */ const justify_top = (justifyTop); ;// ./node_modules/@wordpress/icons/build-module/library/justify-center-vertical.js /** * WordPress dependencies */ const justifyCenterVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z" }) }); /* harmony default export */ const justify_center_vertical = (justifyCenterVertical); ;// ./node_modules/@wordpress/icons/build-module/library/justify-bottom.js /** * WordPress dependencies */ const justifyBottom = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z" }) }); /* harmony default export */ const justify_bottom = (justifyBottom); ;// ./node_modules/@wordpress/icons/build-module/library/justify-stretch-vertical.js /** * WordPress dependencies */ const justifyStretchVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z" }) }); /* harmony default export */ const justify_stretch_vertical = (justifyStretchVertical); ;// ./node_modules/@wordpress/icons/build-module/library/justify-space-between-vertical.js /** * WordPress dependencies */ const justifySpaceBetweenVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z" }) }); /* harmony default export */ const justify_space_between_vertical = (justifySpaceBetweenVertical); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js /** * WordPress dependencies */ const BLOCK_ALIGNMENTS_CONTROLS = { top: { icon: justify_top, title: (0,external_wp_i18n_namespaceObject._x)('Align top', 'Block vertical alignment setting') }, center: { icon: justify_center_vertical, title: (0,external_wp_i18n_namespaceObject._x)('Align middle', 'Block vertical alignment setting') }, bottom: { icon: justify_bottom, title: (0,external_wp_i18n_namespaceObject._x)('Align bottom', 'Block vertical alignment setting') }, stretch: { icon: justify_stretch_vertical, title: (0,external_wp_i18n_namespaceObject._x)('Stretch to fill', 'Block vertical alignment setting') }, 'space-between': { icon: justify_space_between_vertical, title: (0,external_wp_i18n_namespaceObject._x)('Space between', 'Block vertical alignment setting') } }; const DEFAULT_CONTROLS = ['top', 'center', 'bottom']; const DEFAULT_CONTROL = 'top'; function BlockVerticalAlignmentUI({ value, onChange, controls = DEFAULT_CONTROLS, isCollapsed = true, isToolbar }) { function applyOrUnset(align) { return () => onChange(value === align ? undefined : align); } const activeAlignment = BLOCK_ALIGNMENTS_CONTROLS[value]; const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL]; const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; const extraProps = isToolbar ? { isCollapsed } : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { icon: activeAlignment ? activeAlignment.icon : defaultAlignmentControl.icon, label: (0,external_wp_i18n_namespaceObject._x)('Change vertical alignment', 'Block vertical alignment setting label'), controls: controls.map(control => { return { ...BLOCK_ALIGNMENTS_CONTROLS[control], isActive: value === control, role: isCollapsed ? 'menuitemradio' : undefined, onClick: applyOrUnset(control) }; }), ...extraProps }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-vertical-alignment-toolbar/README.md */ /* harmony default export */ const ui = (BlockVerticalAlignmentUI); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/index.js /** * Internal dependencies */ const BlockVerticalAlignmentControl = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ui, { ...props, isToolbar: false }); }; const BlockVerticalAlignmentToolbar = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ui, { ...props, isToolbar: true }); }; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-vertical-alignment-control/README.md */ ;// ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/ui.js /** * WordPress dependencies */ const icons = { left: justify_left, center: justify_center, right: justify_right, 'space-between': justify_space_between, stretch: justify_stretch }; function JustifyContentUI({ allowedControls = ['left', 'center', 'right', 'space-between'], isCollapsed = true, onChange, value, popoverProps, isToolbar }) { // If the control is already selected we want a click // again on the control to deselect the item, so we // call onChange( undefined ) const handleClick = next => { if (next === value) { onChange(undefined); } else { onChange(next); } }; const icon = value ? icons[value] : icons.left; const allControls = [{ name: 'left', icon: justify_left, title: (0,external_wp_i18n_namespaceObject.__)('Justify items left'), isActive: 'left' === value, onClick: () => handleClick('left') }, { name: 'center', icon: justify_center, title: (0,external_wp_i18n_namespaceObject.__)('Justify items center'), isActive: 'center' === value, onClick: () => handleClick('center') }, { name: 'right', icon: justify_right, title: (0,external_wp_i18n_namespaceObject.__)('Justify items right'), isActive: 'right' === value, onClick: () => handleClick('right') }, { name: 'space-between', icon: justify_space_between, title: (0,external_wp_i18n_namespaceObject.__)('Space between items'), isActive: 'space-between' === value, onClick: () => handleClick('space-between') }, { name: 'stretch', icon: justify_stretch, title: (0,external_wp_i18n_namespaceObject.__)('Stretch items'), isActive: 'stretch' === value, onClick: () => handleClick('stretch') }]; const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; const extraProps = isToolbar ? { isCollapsed } : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { icon: icon, popoverProps: popoverProps, label: (0,external_wp_i18n_namespaceObject.__)('Change items justification'), controls: allControls.filter(elem => allowedControls.includes(elem.name)), ...extraProps }); } /* harmony default export */ const justify_content_control_ui = (JustifyContentUI); ;// ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js /** * Internal dependencies */ const JustifyContentControl = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(justify_content_control_ui, { ...props, isToolbar: false }); }; const JustifyToolbar = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(justify_content_control_ui, { ...props, isToolbar: true }); }; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/justify-content-control/README.md */ ;// ./node_modules/@wordpress/block-editor/build-module/layouts/flex.js /** * WordPress dependencies */ /** * Internal dependencies */ // Used with the default, horizontal flex orientation. const justifyContentMap = { left: 'flex-start', right: 'flex-end', center: 'center', 'space-between': 'space-between' }; // Used with the vertical (column) flex orientation. const alignItemsMap = { left: 'flex-start', right: 'flex-end', center: 'center', stretch: 'stretch' }; const verticalAlignmentMap = { top: 'flex-start', center: 'center', bottom: 'flex-end', stretch: 'stretch', 'space-between': 'space-between' }; const flexWrapOptions = ['wrap', 'nowrap']; /* harmony default export */ const flex = ({ name: 'flex', label: (0,external_wp_i18n_namespaceObject.__)('Flex'), inspectorControls: function FlexLayoutInspectorControls({ layout = {}, onChange, layoutBlockSupport = {} }) { const { allowOrientation = true, allowJustification = true } = layoutBlockSupport; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [allowJustification && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexLayoutJustifyContentControl, { layout: layout, onChange: onChange }) }), allowOrientation && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OrientationControl, { layout: layout, onChange: onChange }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexWrapControl, { layout: layout, onChange: onChange })] }); }, toolBarControls: function FlexLayoutToolbarControls({ layout = {}, onChange, layoutBlockSupport }) { const { allowVerticalAlignment = true, allowJustification = true } = layoutBlockSupport; if (!allowJustification && !allowVerticalAlignment) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls, { group: "block", __experimentalShareWithChildBlocks: true, children: [allowJustification && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexLayoutJustifyContentControl, { layout: layout, onChange: onChange, isToolbar: true }), allowVerticalAlignment && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexLayoutVerticalAlignmentControl, { layout: layout, onChange: onChange })] }); }, getLayoutStyle: function getLayoutStyle({ selector, layout, style, blockName, hasBlockGapSupport, layoutDefinitions = LAYOUT_DEFINITIONS }) { const { orientation = 'horizontal' } = layout; // If a block's block.json skips serialization for spacing or spacing.blockGap, // don't apply the user-defined value to the styles. const blockGapValue = style?.spacing?.blockGap && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? getGapCSSValue(style?.spacing?.blockGap, '0.5em') : undefined; const justifyContent = justifyContentMap[layout.justifyContent]; const flexWrap = flexWrapOptions.includes(layout.flexWrap) ? layout.flexWrap : 'wrap'; const verticalAlignment = verticalAlignmentMap[layout.verticalAlignment]; const alignItems = alignItemsMap[layout.justifyContent] || alignItemsMap.left; let output = ''; const rules = []; if (flexWrap && flexWrap !== 'wrap') { rules.push(`flex-wrap: ${flexWrap}`); } if (orientation === 'horizontal') { if (verticalAlignment) { rules.push(`align-items: ${verticalAlignment}`); } if (justifyContent) { rules.push(`justify-content: ${justifyContent}`); } } else { if (verticalAlignment) { rules.push(`justify-content: ${verticalAlignment}`); } rules.push('flex-direction: column'); rules.push(`align-items: ${alignItems}`); } if (rules.length) { output = `${appendSelectors(selector)} { ${rules.join('; ')}; }`; } // Output blockGap styles based on rules contained in layout definitions in theme.json. if (hasBlockGapSupport && blockGapValue) { output += getBlockGapCSS(selector, layoutDefinitions, 'flex', blockGapValue); } return output; }, getOrientation(layout) { const { orientation = 'horizontal' } = layout; return orientation; }, getAlignments() { return []; } }); function FlexLayoutVerticalAlignmentControl({ layout, onChange }) { const { orientation = 'horizontal' } = layout; const defaultVerticalAlignment = orientation === 'horizontal' ? verticalAlignmentMap.center : verticalAlignmentMap.top; const { verticalAlignment = defaultVerticalAlignment } = layout; const onVerticalAlignmentChange = value => { onChange({ ...layout, verticalAlignment: value }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockVerticalAlignmentControl, { onChange: onVerticalAlignmentChange, value: verticalAlignment, controls: orientation === 'horizontal' ? ['top', 'center', 'bottom', 'stretch'] : ['top', 'center', 'bottom', 'space-between'] }); } const POPOVER_PROPS = { placement: 'bottom-start' }; function FlexLayoutJustifyContentControl({ layout, onChange, isToolbar = false }) { const { justifyContent = 'left', orientation = 'horizontal' } = layout; const onJustificationChange = value => { onChange({ ...layout, justifyContent: value }); }; const allowedControls = ['left', 'center', 'right']; if (orientation === 'horizontal') { allowedControls.push('space-between'); } else { allowedControls.push('stretch'); } if (isToolbar) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(JustifyContentControl, { allowedControls: allowedControls, value: justifyContent, onChange: onJustificationChange, popoverProps: POPOVER_PROPS }); } const justificationOptions = [{ value: 'left', icon: justify_left, label: (0,external_wp_i18n_namespaceObject.__)('Justify items left') }, { value: 'center', icon: justify_center, label: (0,external_wp_i18n_namespaceObject.__)('Justify items center') }, { value: 'right', icon: justify_right, label: (0,external_wp_i18n_namespaceObject.__)('Justify items right') }]; if (orientation === 'horizontal') { justificationOptions.push({ value: 'space-between', icon: justify_space_between, label: (0,external_wp_i18n_namespaceObject.__)('Space between items') }); } else { justificationOptions.push({ value: 'stretch', icon: justify_stretch, label: (0,external_wp_i18n_namespaceObject.__)('Stretch items') }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Justification'), value: justifyContent, onChange: onJustificationChange, className: "block-editor-hooks__flex-layout-justification-controls", children: justificationOptions.map(({ value, icon, label }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: value, icon: icon, label: label }, value); }) }); } function FlexWrapControl({ layout, onChange }) { const { flexWrap = 'wrap' } = layout; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Allow to wrap to multiple lines'), onChange: value => { onChange({ ...layout, flexWrap: value ? 'wrap' : 'nowrap' }); }, checked: flexWrap === 'wrap' }); } function OrientationControl({ layout, onChange }) { const { orientation = 'horizontal', verticalAlignment, justifyContent } = layout; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, className: "block-editor-hooks__flex-layout-orientation-controls", label: (0,external_wp_i18n_namespaceObject.__)('Orientation'), value: orientation, onChange: value => { // Make sure the vertical alignment and justification are compatible with the new orientation. let newVerticalAlignment = verticalAlignment; let newJustification = justifyContent; if (value === 'horizontal') { if (verticalAlignment === 'space-between') { newVerticalAlignment = 'center'; } if (justifyContent === 'stretch') { newJustification = 'left'; } } else { if (verticalAlignment === 'stretch') { newVerticalAlignment = 'top'; } if (justifyContent === 'space-between') { newJustification = 'left'; } } return onChange({ ...layout, orientation: value, verticalAlignment: newVerticalAlignment, justifyContent: newJustification }); }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { icon: arrow_right, value: "horizontal", label: (0,external_wp_i18n_namespaceObject.__)('Horizontal') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { icon: arrow_down, value: "vertical", label: (0,external_wp_i18n_namespaceObject.__)('Vertical') })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/layouts/flow.js /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ const flow = ({ name: 'default', label: (0,external_wp_i18n_namespaceObject.__)('Flow'), inspectorControls: function DefaultLayoutInspectorControls() { return null; }, toolBarControls: function DefaultLayoutToolbarControls() { return null; }, getLayoutStyle: function getLayoutStyle({ selector, style, blockName, hasBlockGapSupport, layoutDefinitions = LAYOUT_DEFINITIONS }) { const blockGapStyleValue = getGapCSSValue(style?.spacing?.blockGap); // If a block's block.json skips serialization for spacing or // spacing.blockGap, don't apply the user-defined value to the styles. let blockGapValue = ''; if (!shouldSkipSerialization(blockName, 'spacing', 'blockGap')) { // If an object is provided only use the 'top' value for this kind of gap. if (blockGapStyleValue?.top) { blockGapValue = getGapCSSValue(blockGapStyleValue?.top); } else if (typeof blockGapStyleValue === 'string') { blockGapValue = getGapCSSValue(blockGapStyleValue); } } let output = ''; // Output blockGap styles based on rules contained in layout definitions in theme.json. if (hasBlockGapSupport && blockGapValue) { output += getBlockGapCSS(selector, layoutDefinitions, 'default', blockGapValue); } return output; }, getOrientation() { return 'vertical'; }, getAlignments(layout, isBlockBasedTheme) { const alignmentInfo = getAlignmentsInfo(layout); if (layout.alignments !== undefined) { if (!layout.alignments.includes('none')) { layout.alignments.unshift('none'); } return layout.alignments.map(alignment => ({ name: alignment, info: alignmentInfo[alignment] })); } const alignments = [{ name: 'left' }, { name: 'center' }, { name: 'right' }]; // This is for backwards compatibility with hybrid themes. if (!isBlockBasedTheme) { const { contentSize, wideSize } = layout; if (contentSize) { alignments.unshift({ name: 'full' }); } if (wideSize) { alignments.unshift({ name: 'wide', info: alignmentInfo.wide }); } } alignments.unshift({ name: 'none', info: alignmentInfo.none }); return alignments; } }); ;// ./node_modules/@wordpress/icons/build-module/icon/index.js /** * WordPress dependencies */ /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ /** * Return an SVG icon. * * @param {IconProps} props icon is the SVG component to render * size is a number specifying the icon size in pixels * Other props will be passed to wrapped SVG component * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. * * @return {JSX.Element} Icon component */ function Icon({ icon, size = 24, ...props }, ref) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } /* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); ;// ./node_modules/@wordpress/icons/build-module/library/align-none.js /** * WordPress dependencies */ const alignNone = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z" }) }); /* harmony default export */ const align_none = (alignNone); ;// ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js /** * WordPress dependencies */ const stretchWide = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16 5.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z" }) }); /* harmony default export */ const stretch_wide = (stretchWide); ;// ./node_modules/@wordpress/block-editor/build-module/layouts/constrained.js /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ const constrained = ({ name: 'constrained', label: (0,external_wp_i18n_namespaceObject.__)('Constrained'), inspectorControls: function DefaultLayoutInspectorControls({ layout, onChange, layoutBlockSupport = {} }) { const { wideSize, contentSize, justifyContent = 'center' } = layout; const { allowJustification = true, allowCustomContentAndWideSize = true } = layoutBlockSupport; const onJustificationChange = value => { onChange({ ...layout, justifyContent: value }); }; const justificationOptions = [{ value: 'left', icon: justify_left, label: (0,external_wp_i18n_namespaceObject.__)('Justify items left') }, { value: 'center', icon: justify_center, label: (0,external_wp_i18n_namespaceObject.__)('Justify items center') }, { value: 'right', icon: justify_right, label: (0,external_wp_i18n_namespaceObject.__)('Justify items right') }]; const [availableUnits] = use_settings_useSettings('spacing.units'); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vw'] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, className: "block-editor-hooks__layout-constrained", children: [allowCustomContentAndWideSize && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Content width'), labelPosition: "top", value: contentSize || wideSize || '', onChange: nextWidth => { nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; onChange({ ...layout, contentSize: nextWidth }); }, units: units, prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: align_none }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Wide width'), labelPosition: "top", value: wideSize || contentSize || '', onChange: nextWidth => { nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; onChange({ ...layout, wideSize: nextWidth }); }, units: units, prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: stretch_wide }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-hooks__layout-constrained-helptext", children: (0,external_wp_i18n_namespaceObject.__)('Customize the width for all elements that are assigned to the center or wide columns.') })] }), allowJustification && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Justification'), value: justifyContent, onChange: onJustificationChange, children: justificationOptions.map(({ value, icon, label }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: value, icon: icon, label: label }, value); }) })] }); }, toolBarControls: function DefaultLayoutToolbarControls({ layout = {}, onChange, layoutBlockSupport }) { const { allowJustification = true } = layoutBlockSupport; if (!allowJustification) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { group: "block", __experimentalShareWithChildBlocks: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultLayoutJustifyContentControl, { layout: layout, onChange: onChange }) }); }, getLayoutStyle: function getLayoutStyle({ selector, layout = {}, style, blockName, hasBlockGapSupport, layoutDefinitions = LAYOUT_DEFINITIONS }) { const { contentSize, wideSize, justifyContent } = layout; const blockGapStyleValue = getGapCSSValue(style?.spacing?.blockGap); // If a block's block.json skips serialization for spacing or // spacing.blockGap, don't apply the user-defined value to the styles. let blockGapValue = ''; if (!shouldSkipSerialization(blockName, 'spacing', 'blockGap')) { // If an object is provided only use the 'top' value for this kind of gap. if (blockGapStyleValue?.top) { blockGapValue = getGapCSSValue(blockGapStyleValue?.top); } else if (typeof blockGapStyleValue === 'string') { blockGapValue = getGapCSSValue(blockGapStyleValue); } } const marginLeft = justifyContent === 'left' ? '0 !important' : 'auto !important'; const marginRight = justifyContent === 'right' ? '0 !important' : 'auto !important'; let output = !!contentSize || !!wideSize ? ` ${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')} { max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize}; margin-left: ${marginLeft}; margin-right: ${marginRight}; } ${appendSelectors(selector, '> .alignwide')} { max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize}; } ${appendSelectors(selector, '> .alignfull')} { max-width: none; } ` : ''; if (justifyContent === 'left') { output += `${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')} { margin-left: ${marginLeft}; }`; } else if (justifyContent === 'right') { output += `${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')} { margin-right: ${marginRight}; }`; } // If there is custom padding, add negative margins for alignfull blocks. if (style?.spacing?.padding) { // The style object might be storing a preset so we need to make sure we get a usable value. const paddingValues = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(style); paddingValues.forEach(rule => { if (rule.key === 'paddingRight') { // Add unit if 0, to avoid calc(0 * -1) which is invalid. const paddingRightValue = rule.value === '0' ? '0px' : rule.value; output += ` ${appendSelectors(selector, '> .alignfull')} { margin-right: calc(${paddingRightValue} * -1); } `; } else if (rule.key === 'paddingLeft') { // Add unit if 0, to avoid calc(0 * -1) which is invalid. const paddingLeftValue = rule.value === '0' ? '0px' : rule.value; output += ` ${appendSelectors(selector, '> .alignfull')} { margin-left: calc(${paddingLeftValue} * -1); } `; } }); } // Output blockGap styles based on rules contained in layout definitions in theme.json. if (hasBlockGapSupport && blockGapValue) { output += getBlockGapCSS(selector, layoutDefinitions, 'constrained', blockGapValue); } return output; }, getOrientation() { return 'vertical'; }, getAlignments(layout) { const alignmentInfo = getAlignmentsInfo(layout); if (layout.alignments !== undefined) { if (!layout.alignments.includes('none')) { layout.alignments.unshift('none'); } return layout.alignments.map(alignment => ({ name: alignment, info: alignmentInfo[alignment] })); } const { contentSize, wideSize } = layout; const alignments = [{ name: 'left' }, { name: 'center' }, { name: 'right' }]; if (contentSize) { alignments.unshift({ name: 'full' }); } if (wideSize) { alignments.unshift({ name: 'wide', info: alignmentInfo.wide }); } alignments.unshift({ name: 'none', info: alignmentInfo.none }); return alignments; } }); const constrained_POPOVER_PROPS = { placement: 'bottom-start' }; function DefaultLayoutJustifyContentControl({ layout, onChange }) { const { justifyContent = 'center' } = layout; const onJustificationChange = value => { onChange({ ...layout, justifyContent: value }); }; const allowedControls = ['left', 'center', 'right']; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(JustifyContentControl, { allowedControls: allowedControls, value: justifyContent, onChange: onJustificationChange, popoverProps: constrained_POPOVER_PROPS }); } ;// ./node_modules/@wordpress/block-editor/build-module/layouts/grid.js /** * WordPress dependencies */ /** * Internal dependencies */ const RANGE_CONTROL_MAX_VALUES = { px: 600, '%': 100, vw: 100, vh: 100, em: 38, rem: 38, svw: 100, lvw: 100, dvw: 100, svh: 100, lvh: 100, dvh: 100, vi: 100, svi: 100, lvi: 100, dvi: 100, vb: 100, svb: 100, lvb: 100, dvb: 100, vmin: 100, svmin: 100, lvmin: 100, dvmin: 100, vmax: 100, svmax: 100, lvmax: 100, dvmax: 100 }; const units = [{ value: 'px', label: 'px', default: 0 }, { value: 'rem', label: 'rem', default: 0 }, { value: 'em', label: 'em', default: 0 }]; /* harmony default export */ const grid = ({ name: 'grid', label: (0,external_wp_i18n_namespaceObject.__)('Grid'), inspectorControls: function GridLayoutInspectorControls({ layout = {}, onChange, layoutBlockSupport = {} }) { const { allowSizingOnChildren = false } = layoutBlockSupport; // In the experiment we want to also show column control in Auto mode, and // the minimum width control in Manual mode. const showColumnsControl = window.__experimentalEnableGridInteractivity || !!layout?.columnCount; const showMinWidthControl = window.__experimentalEnableGridInteractivity || !layout?.columnCount; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutTypeControl, { layout: layout, onChange: onChange }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [showColumnsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutColumnsAndRowsControl, { layout: layout, onChange: onChange, allowSizingOnChildren: allowSizingOnChildren }), showMinWidthControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutMinimumWidthControl, { layout: layout, onChange: onChange })] })] }); }, toolBarControls: function GridLayoutToolbarControls() { return null; }, getLayoutStyle: function getLayoutStyle({ selector, layout, style, blockName, hasBlockGapSupport, layoutDefinitions = LAYOUT_DEFINITIONS }) { const { minimumColumnWidth = null, columnCount = null, rowCount = null } = layout; // Check that the grid layout attributes are of the correct type, so that we don't accidentally // write code that stores a string attribute instead of a number. if (false) {} // If a block's block.json skips serialization for spacing or spacing.blockGap, // don't apply the user-defined value to the styles. const blockGapValue = style?.spacing?.blockGap && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? getGapCSSValue(style?.spacing?.blockGap, '0.5em') : undefined; let output = ''; const rules = []; if (minimumColumnWidth && columnCount > 0) { const maxValue = `max(${minimumColumnWidth}, ( 100% - (${blockGapValue || '1.2rem'}*${columnCount - 1}) ) / ${columnCount})`; rules.push(`grid-template-columns: repeat(auto-fill, minmax(${maxValue}, 1fr))`, `container-type: inline-size`); if (rowCount) { rules.push(`grid-template-rows: repeat(${rowCount}, minmax(1rem, auto))`); } } else if (columnCount) { rules.push(`grid-template-columns: repeat(${columnCount}, minmax(0, 1fr))`); if (rowCount) { rules.push(`grid-template-rows: repeat(${rowCount}, minmax(1rem, auto))`); } } else { rules.push(`grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth || '12rem'}, 100%), 1fr))`, 'container-type: inline-size'); } if (rules.length) { // Reason to disable: the extra line breaks added by prettier mess with the unit tests. // eslint-disable-next-line prettier/prettier output = `${appendSelectors(selector)} { ${rules.join('; ')}; }`; } // Output blockGap styles based on rules contained in layout definitions in theme.json. if (hasBlockGapSupport && blockGapValue) { output += getBlockGapCSS(selector, layoutDefinitions, 'grid', blockGapValue); } return output; }, getOrientation() { return 'horizontal'; }, getAlignments() { return []; } }); // Enables setting minimum width of grid items. function GridLayoutMinimumWidthControl({ layout, onChange }) { const { minimumColumnWidth, columnCount, isManualPlacement } = layout; const defaultValue = isManualPlacement || columnCount ? null : '12rem'; const value = minimumColumnWidth || defaultValue; const [quantity, unit = 'rem'] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value); const handleSliderChange = next => { onChange({ ...layout, minimumColumnWidth: [next, unit].join('') }); }; // Mostly copied from HeightControl. const handleUnitChange = newUnit => { // Attempt to smooth over differences between currentUnit and newUnit. // This should slightly improve the experience of switching between unit types. let newValue; if (['em', 'rem'].includes(newUnit) && unit === 'px') { // Convert pixel value to an approximate of the new unit, assuming a root size of 16px. newValue = (quantity / 16).toFixed(2) + newUnit; } else if (['em', 'rem'].includes(unit) && newUnit === 'px') { // Convert to pixel value assuming a root size of 16px. newValue = Math.round(quantity * 16) + newUnit; } onChange({ ...layout, minimumColumnWidth: newValue }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Minimum column width') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { gap: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { size: "__unstable-large", onChange: newValue => { onChange({ ...layout, minimumColumnWidth: newValue === '' ? undefined : newValue }); }, onUnitChange: handleUnitChange, value: value, units: units, min: 0, label: (0,external_wp_i18n_namespaceObject.__)('Minimum column width'), hideLabelFromVision: true }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, onChange: handleSliderChange, value: quantity || 0, min: 0, max: RANGE_CONTROL_MAX_VALUES[unit] || 600, withInputField: false, label: (0,external_wp_i18n_namespaceObject.__)('Minimum column width'), hideLabelFromVision: true }) })] })] }); } // Enables setting number of grid columns function GridLayoutColumnsAndRowsControl({ layout, onChange, allowSizingOnChildren }) { // If the grid interactivity experiment is enabled, allow unsetting the column count. const defaultColumnCount = window.__experimentalEnableGridInteractivity ? undefined : 3; const { columnCount = defaultColumnCount, rowCount, isManualPlacement } = layout; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { children: [(!window.__experimentalEnableGridInteractivity || !isManualPlacement) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Columns') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { gap: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { size: "__unstable-large", onChange: value => { if (window.__experimentalEnableGridInteractivity) { // Allow unsetting the column count when in auto mode. const defaultNewColumnCount = isManualPlacement ? 1 : undefined; const newColumnCount = value === '' || value === '0' ? defaultNewColumnCount : parseInt(value, 10); onChange({ ...layout, columnCount: newColumnCount }); } else { // Don't allow unsetting the column count. const newColumnCount = value === '' || value === '0' ? 1 : parseInt(value, 10); onChange({ ...layout, columnCount: newColumnCount }); } }, value: columnCount, min: 1, label: (0,external_wp_i18n_namespaceObject.__)('Columns'), hideLabelFromVision: !window.__experimentalEnableGridInteractivity || !isManualPlacement }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: window.__experimentalEnableGridInteractivity && allowSizingOnChildren && isManualPlacement ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { size: "__unstable-large", onChange: value => { // Don't allow unsetting the row count. const newRowCount = value === '' || value === '0' ? 1 : parseInt(value, 10); onChange({ ...layout, rowCount: newRowCount }); }, value: rowCount, min: 1, label: (0,external_wp_i18n_namespaceObject.__)('Rows') }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, value: columnCount !== null && columnCount !== void 0 ? columnCount : 1, onChange: value => onChange({ ...layout, columnCount: value === '' || value === '0' ? 1 : value }), min: 1, max: 16, withInputField: false, label: (0,external_wp_i18n_namespaceObject.__)('Columns'), hideLabelFromVision: true }) })] })] }) }); } // Enables switching between grid types function GridLayoutTypeControl({ layout, onChange }) { const { columnCount, rowCount, minimumColumnWidth, isManualPlacement } = layout; /** * When switching, temporarily save any custom values set on the * previous type so we can switch back without loss. */ const [tempColumnCount, setTempColumnCount] = (0,external_wp_element_namespaceObject.useState)(columnCount || 3); const [tempRowCount, setTempRowCount] = (0,external_wp_element_namespaceObject.useState)(rowCount); const [tempMinimumColumnWidth, setTempMinimumColumnWidth] = (0,external_wp_element_namespaceObject.useState)(minimumColumnWidth || '12rem'); const gridPlacement = isManualPlacement || !!columnCount && !window.__experimentalEnableGridInteractivity ? 'manual' : 'auto'; const onChangeType = value => { if (value === 'manual') { setTempMinimumColumnWidth(minimumColumnWidth || '12rem'); } else { setTempColumnCount(columnCount || 3); setTempRowCount(rowCount); } onChange({ ...layout, columnCount: value === 'manual' ? tempColumnCount : null, rowCount: value === 'manual' && window.__experimentalEnableGridInteractivity ? tempRowCount : undefined, isManualPlacement: value === 'manual' && window.__experimentalEnableGridInteractivity ? true : undefined, minimumColumnWidth: value === 'auto' ? tempMinimumColumnWidth : null }); }; const helpText = gridPlacement === 'manual' ? (0,external_wp_i18n_namespaceObject.__)('Grid items can be manually placed in any position on the grid.') : (0,external_wp_i18n_namespaceObject.__)('Grid items are placed automatically depending on their order.'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Grid item position'), value: gridPlacement, onChange: onChangeType, isBlock: true, help: window.__experimentalEnableGridInteractivity ? helpText : undefined, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "auto", label: (0,external_wp_i18n_namespaceObject.__)('Auto') }, "auto"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "manual", label: (0,external_wp_i18n_namespaceObject.__)('Manual') }, "manual")] }); } ;// ./node_modules/@wordpress/block-editor/build-module/layouts/index.js /** * Internal dependencies */ const layoutTypes = [flow, flex, constrained, grid]; /** * Retrieves a layout type by name. * * @param {string} name - The name of the layout type. * @return {Object} Layout type. */ function getLayoutType(name = 'default') { return layoutTypes.find(layoutType => layoutType.name === name); } /** * Retrieves the available layout types. * * @return {Array} Layout types. */ function getLayoutTypes() { return layoutTypes; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/layout.js /** * WordPress dependencies */ /** * Internal dependencies */ const defaultLayout = { type: 'default' }; const Layout = (0,external_wp_element_namespaceObject.createContext)(defaultLayout); /** * Allows to define the layout. */ const LayoutProvider = Layout.Provider; /** * React hook used to retrieve the layout config. */ function useLayout() { return (0,external_wp_element_namespaceObject.useContext)(Layout); } function LayoutStyle({ layout = {}, css, ...props }) { const layoutType = getLayoutType(layout.type); const [blockGapSupport] = use_settings_useSettings('spacing.blockGap'); const hasBlockGapSupport = blockGapSupport !== null; if (layoutType) { if (css) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: css }); } const layoutStyle = layoutType.getLayoutStyle?.({ hasBlockGapSupport, layout, ...props }); if (layoutStyle) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: layoutStyle }); } } return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/use-available-alignments.js /** * WordPress dependencies */ /** * Internal dependencies */ const use_available_alignments_EMPTY_ARRAY = []; const use_available_alignments_DEFAULT_CONTROLS = ['none', 'left', 'center', 'right', 'wide', 'full']; const WIDE_CONTROLS = ['wide', 'full']; function useAvailableAlignments(controls = use_available_alignments_DEFAULT_CONTROLS) { // Always add the `none` option if not exists. if (!controls.includes('none')) { controls = ['none', ...controls]; } const isNoneOnly = controls.length === 1 && controls[0] === 'none'; const [wideControlsEnabled, themeSupportsLayout, isBlockBasedTheme] = (0,external_wp_data_namespaceObject.useSelect)(select => { var _settings$alignWide; // If `isNoneOnly` is true, we'll be returning early because there is // nothing to filter on an empty array. We won't need the info from // the `useSelect` but we must call it anyway because Rules of Hooks. // So the callback returns early to avoid block editor subscription. if (isNoneOnly) { return [false, false, false]; } const settings = select(store).getSettings(); return [(_settings$alignWide = settings.alignWide) !== null && _settings$alignWide !== void 0 ? _settings$alignWide : false, settings.supportsLayout, settings.__unstableIsBlockBasedTheme]; }, [isNoneOnly]); const layout = useLayout(); if (isNoneOnly) { return use_available_alignments_EMPTY_ARRAY; } const layoutType = getLayoutType(layout?.type); if (themeSupportsLayout) { const layoutAlignments = layoutType.getAlignments(layout, isBlockBasedTheme); const alignments = layoutAlignments.filter(alignment => controls.includes(alignment.name)); // While we treat `none` as an alignment, we shouldn't return it if no // other alignments exist. if (alignments.length === 1 && alignments[0].name === 'none') { return use_available_alignments_EMPTY_ARRAY; } return alignments; } // Starting here, it's the fallback for themes not supporting the layout config. if (layoutType.name !== 'default' && layoutType.name !== 'constrained') { return use_available_alignments_EMPTY_ARRAY; } const alignments = controls.filter(control => { if (layout.alignments) { return layout.alignments.includes(control); } if (!wideControlsEnabled && WIDE_CONTROLS.includes(control)) { return false; } return use_available_alignments_DEFAULT_CONTROLS.includes(control); }).map(name => ({ name })); // While we treat `none` as an alignment, we shouldn't return it if no // other alignments exist. if (alignments.length === 1 && alignments[0].name === 'none') { return use_available_alignments_EMPTY_ARRAY; } return alignments; } ;// ./node_modules/@wordpress/icons/build-module/library/position-left.js /** * WordPress dependencies */ const positionLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z" }) }); /* harmony default export */ const position_left = (positionLeft); ;// ./node_modules/@wordpress/icons/build-module/library/position-center.js /** * WordPress dependencies */ const positionCenter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z" }) }); /* harmony default export */ const position_center = (positionCenter); ;// ./node_modules/@wordpress/icons/build-module/library/position-right.js /** * WordPress dependencies */ const positionRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z" }) }); /* harmony default export */ const position_right = (positionRight); ;// ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js /** * WordPress dependencies */ const stretchFullWidth = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 4h14v11H5V4Zm11 16H8v-1.5h8V20Z" }) }); /* harmony default export */ const stretch_full_width = (stretchFullWidth); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/constants.js /** * WordPress dependencies */ const constants_BLOCK_ALIGNMENTS_CONTROLS = { none: { icon: align_none, title: (0,external_wp_i18n_namespaceObject._x)('None', 'Alignment option') }, left: { icon: position_left, title: (0,external_wp_i18n_namespaceObject.__)('Align left') }, center: { icon: position_center, title: (0,external_wp_i18n_namespaceObject.__)('Align center') }, right: { icon: position_right, title: (0,external_wp_i18n_namespaceObject.__)('Align right') }, wide: { icon: stretch_wide, title: (0,external_wp_i18n_namespaceObject.__)('Wide width') }, full: { icon: stretch_full_width, title: (0,external_wp_i18n_namespaceObject.__)('Full width') } }; const constants_DEFAULT_CONTROL = 'none'; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/ui.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockAlignmentUI({ value, onChange, controls, isToolbar, isCollapsed = true }) { const enabledControls = useAvailableAlignments(controls); const hasEnabledControls = !!enabledControls.length; if (!hasEnabledControls) { return null; } function onChangeAlignment(align) { onChange([value, 'none'].includes(align) ? undefined : align); } const activeAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[value]; const defaultAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[constants_DEFAULT_CONTROL]; const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; const commonProps = { icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon, label: (0,external_wp_i18n_namespaceObject.__)('Align') }; const extraProps = isToolbar ? { isCollapsed, controls: enabledControls.map(({ name: controlName }) => { return { ...constants_BLOCK_ALIGNMENTS_CONTROLS[controlName], isActive: value === controlName || !value && controlName === 'none', role: isCollapsed ? 'menuitemradio' : undefined, onClick: () => onChangeAlignment(controlName) }; }) } : { toggleProps: { description: (0,external_wp_i18n_namespaceObject.__)('Change alignment') }, children: ({ onClose }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { className: "block-editor-block-alignment-control__menu-group", children: enabledControls.map(({ name: controlName, info }) => { const { icon, title } = constants_BLOCK_ALIGNMENTS_CONTROLS[controlName]; // If no value is provided, mark as selected the `none` option. const isSelected = controlName === value || !value && controlName === 'none'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: icon, iconPosition: "left", className: dist_clsx('components-dropdown-menu__menu-item', { 'is-active': isSelected }), isSelected: isSelected, onClick: () => { onChangeAlignment(controlName); onClose(); }, role: "menuitemradio", info: info, children: title }, controlName); }) }) }); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { ...commonProps, ...extraProps }); } /* harmony default export */ const block_alignment_control_ui = (BlockAlignmentUI); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/index.js /** * Internal dependencies */ const BlockAlignmentControl = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui, { ...props, isToolbar: false }); }; const BlockAlignmentToolbar = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui, { ...props, isToolbar: true }); }; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-alignment-control/README.md */ ;// ./node_modules/@wordpress/block-editor/build-module/components/block-editing-mode/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @typedef {'disabled'|'contentOnly'|'default'} BlockEditingMode */ /** * Allows a block to restrict the user interface that is displayed for editing * that block and its inner blocks. * * @example * ```js * function MyBlock( { attributes, setAttributes } ) { * useBlockEditingMode( 'disabled' ); * return <div { ...useBlockProps() }></div>; * } * ``` * * `mode` can be one of three options: * * - `'disabled'`: Prevents editing the block entirely, i.e. it cannot be * selected. * - `'contentOnly'`: Hides all non-content UI, e.g. auxiliary controls in the * toolbar, the block movers, block settings. * - `'default'`: Allows editing the block as normal. * * The mode is inherited by all of the block's inner blocks, unless they have * their own mode. * * If called outside of a block context, the mode is applied to all blocks. * * @param {?BlockEditingMode} mode The editing mode to apply. If undefined, the * current editing mode is not changed. * * @return {BlockEditingMode} The current editing mode. */ function useBlockEditingMode(mode) { const context = useBlockEditContext(); const { clientId = '' } = context; const { setBlockEditingMode, unsetBlockEditingMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); const globalBlockEditingMode = (0,external_wp_data_namespaceObject.useSelect)(select => // Avoid adding the subscription if not needed! clientId ? null : select(store).getBlockEditingMode(), [clientId]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (mode) { setBlockEditingMode(clientId, mode); } return () => { if (mode) { unsetBlockEditingMode(clientId); } }; }, [clientId, mode, setBlockEditingMode, unsetBlockEditingMode]); return clientId ? context[blockEditingModeKey] : globalBlockEditingMode; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/align.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * An array which includes all possible valid alignments, * used to validate if an alignment is valid or not. * * @constant * @type {string[]} */ const ALL_ALIGNMENTS = ['left', 'center', 'right', 'wide', 'full']; /** * An array which includes all wide alignments. * In order for this alignments to be valid they need to be supported by the block, * and by the theme. * * @constant * @type {string[]} */ const WIDE_ALIGNMENTS = ['wide', 'full']; /** * Returns the valid alignments. * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not. * Exported just for testing purposes, not exported outside the module. * * @param {?boolean|string[]} blockAlign Aligns supported by the block. * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise. * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise. * * @return {string[]} Valid alignments. */ function getValidAlignments(blockAlign, hasWideBlockSupport = true, hasWideEnabled = true) { let validAlignments; if (Array.isArray(blockAlign)) { validAlignments = ALL_ALIGNMENTS.filter(value => blockAlign.includes(value)); } else if (blockAlign === true) { // `true` includes all alignments... validAlignments = [...ALL_ALIGNMENTS]; } else { validAlignments = []; } if (!hasWideEnabled || blockAlign === true && !hasWideBlockSupport) { return validAlignments.filter(alignment => !WIDE_ALIGNMENTS.includes(alignment)); } return validAlignments; } /** * Filters registered block settings, extending attributes to include `align`. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function addAttribute(settings) { var _settings$attributes$; // Allow blocks to specify their own attribute definition with default values if needed. if ('type' in ((_settings$attributes$ = settings.attributes?.align) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) { return settings; } if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'align')) { // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, align: { type: 'string', // Allow for '' since it is used by the `updateAlignment` function // in toolbar controls for special cases with defined default values. enum: [...ALL_ALIGNMENTS, ''] } }; } return settings; } function BlockEditAlignmentToolbarControlsPure({ name: blockName, align, setAttributes }) { // Compute the block valid alignments by taking into account, // if the theme supports wide alignments or not and the layout's // available alignments. We do that for conditionally rendering // Slot. const blockAllowedAlignments = getValidAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'align'), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'alignWide', true)); const validAlignments = useAvailableAlignments(blockAllowedAlignments).map(({ name }) => name); const blockEditingMode = useBlockEditingMode(); if (!validAlignments.length || blockEditingMode !== 'default') { return null; } const updateAlignment = nextAlign => { if (!nextAlign) { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); const blockDefaultAlign = blockType?.attributes?.align?.default; if (blockDefaultAlign) { nextAlign = ''; } } setAttributes({ align: nextAlign }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { group: "block", __experimentalShareWithChildBlocks: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockAlignmentControl, { value: align, onChange: updateAlignment, controls: validAlignments }) }); } /* harmony default export */ const align = ({ shareWithChildBlocks: true, edit: BlockEditAlignmentToolbarControlsPure, useBlockProps, addSaveProps: addAssignedAlign, attributeKeys: ['align'], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'align', false); } }); function useBlockProps({ name, align }) { const blockAllowedAlignments = getValidAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(name, 'align'), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'alignWide', true)); const validAlignments = useAvailableAlignments(blockAllowedAlignments); if (validAlignments.some(alignment => alignment.name === align)) { return { 'data-align': align }; } return {}; } /** * Override props assigned to save component to inject alignment class name if * block supports it. * * @param {Object} props Additional props applied to save element. * @param {Object} blockType Block type. * @param {Object} attributes Block attributes. * * @return {Object} Filtered props applied to save element. */ function addAssignedAlign(props, blockType, attributes) { const { align } = attributes; const blockAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'align'); const hasWideBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'alignWide', true); // Compute valid alignments without taking into account if // the theme supports wide alignments or not. // This way changing themes does not impact the block save. const isAlignValid = getValidAlignments(blockAlign, hasWideBlockSupport).includes(align); if (isAlignValid) { props.className = dist_clsx(`align${align}`, props.className); } return props; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/align/addAttribute', addAttribute); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/groups.js /** * WordPress dependencies */ const InspectorControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControls'); const InspectorControlsAdvanced = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorAdvancedControls'); const InspectorControlsBindings = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsBindings'); const InspectorControlsBackground = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsBackground'); const InspectorControlsBorder = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsBorder'); const InspectorControlsColor = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsColor'); const InspectorControlsFilter = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsFilter'); const InspectorControlsDimensions = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsDimensions'); const InspectorControlsPosition = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsPosition'); const InspectorControlsTypography = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsTypography'); const InspectorControlsListView = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsListView'); const InspectorControlsStyles = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsStyles'); const InspectorControlsEffects = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsEffects'); const groups_groups = { default: InspectorControlsDefault, advanced: InspectorControlsAdvanced, background: InspectorControlsBackground, bindings: InspectorControlsBindings, border: InspectorControlsBorder, color: InspectorControlsColor, dimensions: InspectorControlsDimensions, effects: InspectorControlsEffects, filter: InspectorControlsFilter, list: InspectorControlsListView, position: InspectorControlsPosition, settings: InspectorControlsDefault, // Alias for default. styles: InspectorControlsStyles, typography: InspectorControlsTypography }; /* harmony default export */ const inspector_controls_groups = (groups_groups); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/fill.js /** * WordPress dependencies */ /** * Internal dependencies */ function InspectorControlsFill({ children, group = 'default', __experimentalGroup, resetAllFilter }) { if (__experimentalGroup) { external_wp_deprecated_default()('`__experimentalGroup` property in `InspectorControlsFill`', { since: '6.2', version: '6.4', alternative: '`group`' }); group = __experimentalGroup; } const context = useBlockEditContext(); const Fill = inspector_controls_groups[group]?.Fill; if (!Fill) { true ? external_wp_warning_default()(`Unknown InspectorControls group "${group}" provided.`) : 0; return null; } if (!context[mayDisplayControlsKey]) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document: document, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: fillProps => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ToolsPanelInspectorControl, { fillProps: fillProps, children: children, resetAllFilter: resetAllFilter }); } }) }); } function RegisterResetAll({ resetAllFilter, children }) { const { registerResetAllFilter, deregisterResetAllFilter } = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext); (0,external_wp_element_namespaceObject.useEffect)(() => { if (resetAllFilter && registerResetAllFilter && deregisterResetAllFilter) { registerResetAllFilter(resetAllFilter); return () => { deregisterResetAllFilter(resetAllFilter); }; } }, [resetAllFilter, registerResetAllFilter, deregisterResetAllFilter]); return children; } function ToolsPanelInspectorControl({ children, resetAllFilter, fillProps }) { // `fillProps.forwardedContext` is an array of context provider entries, provided by slot, // that should wrap the fill markup. const { forwardedContext = [] } = fillProps; // Children passed to InspectorControlsFill will not have // access to any React Context whose Provider is part of // the InspectorControlsSlot tree. So we re-create the // Provider in this subtree. const innerMarkup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RegisterResetAll, { resetAllFilter: resetAllFilter, children: children }); return forwardedContext.reduce((inner, [Provider, props]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { ...props, children: inner }), innerMarkup); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-tools-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockSupportToolsPanel({ children, group, label }) { const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getBlockAttributes, getMultiSelectedBlockClientIds, getSelectedBlockClientId, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store); const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const panelId = getSelectedBlockClientId(); const resetAll = (0,external_wp_element_namespaceObject.useCallback)((resetFilters = []) => { const newAttributes = {}; const clientIds = hasMultiSelection() ? getMultiSelectedBlockClientIds() : [panelId]; clientIds.forEach(clientId => { const { style } = getBlockAttributes(clientId); let newBlockAttributes = { style }; resetFilters.forEach(resetFilter => { newBlockAttributes = { ...newBlockAttributes, ...resetFilter(newBlockAttributes) }; }); // Enforce a cleaned style object. newBlockAttributes = { ...newBlockAttributes, style: utils_cleanEmptyObject(newBlockAttributes.style) }; newAttributes[clientId] = newBlockAttributes; }); updateBlockAttributes(clientIds, newAttributes, true); }, [getBlockAttributes, getMultiSelectedBlockClientIds, hasMultiSelection, panelId, updateBlockAttributes]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { className: `${group}-block-support-panel`, label: label, resetAll: resetAll, panelId: panelId, hasInnerWrapper: true, shouldRenderPlaceholderItems: true // Required to maintain fills ordering. , __experimentalFirstVisibleItemClass: "first", __experimentalLastVisibleItemClass: "last", dropdownMenuProps: dropdownMenuProps, children: children }, panelId); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-slot-container.js /** * WordPress dependencies */ function BlockSupportSlotContainer({ Slot, fillProps, ...props }) { // Add the toolspanel context provider and value to existing fill props const toolsPanelContext = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext); const computedFillProps = (0,external_wp_element_namespaceObject.useMemo)(() => { var _fillProps$forwardedC; return { ...(fillProps !== null && fillProps !== void 0 ? fillProps : {}), forwardedContext: [...((_fillProps$forwardedC = fillProps?.forwardedContext) !== null && _fillProps$forwardedC !== void 0 ? _fillProps$forwardedC : []), [external_wp_components_namespaceObject.__experimentalToolsPanelContext.Provider, { value: toolsPanelContext }]] }; }, [toolsPanelContext, fillProps]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps: computedFillProps, bubblesVirtually: true }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/slot.js /** * WordPress dependencies */ /** * Internal dependencies */ function InspectorControlsSlot({ __experimentalGroup, group = 'default', label, fillProps, ...props }) { if (__experimentalGroup) { external_wp_deprecated_default()('`__experimentalGroup` property in `InspectorControlsSlot`', { since: '6.2', version: '6.4', alternative: '`group`' }); group = __experimentalGroup; } const slotFill = inspector_controls_groups[group]; const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotFill?.name); if (!slotFill) { true ? external_wp_warning_default()(`Unknown InspectorControls group "${group}" provided.`) : 0; return null; } if (!fills?.length) { return null; } const { Slot } = slotFill; if (label) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSupportToolsPanel, { group: group, label: label, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSupportSlotContainer, { ...props, fillProps: fillProps, Slot: Slot }) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps: fillProps, bubblesVirtually: true }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/index.js /** * Internal dependencies */ const InspectorControls = InspectorControlsFill; InspectorControls.Slot = InspectorControlsSlot; // This is just here for backward compatibility. const InspectorAdvancedControls = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsFill, { ...props, group: "advanced" }); }; InspectorAdvancedControls.Slot = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsSlot, { ...props, group: "advanced" }); }; InspectorAdvancedControls.slotName = 'InspectorAdvancedControls'; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-controls/README.md */ /* harmony default export */ const inspector_controls = (InspectorControls); ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// external ["wp","blob"] const external_wp_blob_namespaceObject = window["wp"]["blob"]; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/icons/build-module/library/media.js /** * WordPress dependencies */ const media = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7 6.5 4 2.5-4 2.5z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z" })] }); /* harmony default export */ const library_media = (media); ;// ./node_modules/@wordpress/icons/build-module/library/upload.js /** * WordPress dependencies */ const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) }); /* harmony default export */ const library_upload = (upload); ;// ./node_modules/@wordpress/icons/build-module/library/post-featured-image.js /** * WordPress dependencies */ const postFeaturedImage = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z" }) }); /* harmony default export */ const post_featured_image = (postFeaturedImage); ;// ./node_modules/@wordpress/block-editor/build-module/components/media-upload/index.js /** * WordPress dependencies */ /** * This is a placeholder for the media upload component necessary to make it possible to provide * an integration with the core blocks that handle media files. By default it renders nothing but * it provides a way to have it overridden with the `editor.MediaUpload` filter. * * @return {Component} The component to be rendered. */ const MediaUpload = () => null; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-upload/README.md */ /* harmony default export */ const media_upload = ((0,external_wp_components_namespaceObject.withFilters)('editor.MediaUpload')(MediaUpload)); ;// ./node_modules/@wordpress/block-editor/build-module/components/media-upload/check.js /** * WordPress dependencies */ /** * Internal dependencies */ function MediaUploadCheck({ fallback = null, children }) { const hasUploadPermissions = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(store); return !!getSettings().mediaUpload; }, []); return hasUploadPermissions ? children : fallback; } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-upload/README.md */ /* harmony default export */ const check = (MediaUploadCheck); ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js /** * WordPress dependencies */ const keyboardReturn = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m6.734 16.106 2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.158 1.093-1.028-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734Z" }) }); /* harmony default export */ const keyboard_return = (keyboardReturn); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js /** * WordPress dependencies */ const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); /* harmony default export */ const chevron_left_small = (chevronLeftSmall); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js /** * WordPress dependencies */ const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); /* harmony default export */ const chevron_right_small = (chevronRightSmall); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js /** * WordPress dependencies */ function LinkSettingsDrawer({ children, settingsOpen, setSettingsOpen }) { const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const MaybeAnimatePresence = prefersReducedMotion ? external_wp_element_namespaceObject.Fragment : external_wp_components_namespaceObject.__unstableAnimatePresence; const MaybeMotionDiv = prefersReducedMotion ? 'div' : external_wp_components_namespaceObject.__unstableMotion.div; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkSettingsDrawer); const settingsDrawerId = `link-control-settings-drawer-${id}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-link-control__drawer-toggle", "aria-expanded": settingsOpen, onClick: () => setSettingsOpen(!settingsOpen), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small, "aria-controls": settingsDrawerId, children: (0,external_wp_i18n_namespaceObject._x)('Advanced', 'Additional link settings') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeAnimatePresence, { children: settingsOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeMotionDiv, { className: "block-editor-link-control__drawer", hidden: !settingsOpen, id: settingsDrawerId, initial: "collapsed", animate: "open", exit: "collapsed", variants: { open: { opacity: 1, height: 'auto' }, collapsed: { opacity: 0, height: 0 } }, transition: { duration: 0.1 }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__drawer-inner", children: children }) }) })] }); } /* harmony default export */ const settings_drawer = (LinkSettingsDrawer); // EXTERNAL MODULE: external "React" var external_React_ = __webpack_require__(1609); ;// ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Whether the argument is a function. * * @param {*} maybeFunc The argument to check. * @return {boolean} True if the argument is a function, false otherwise. */ function isFunction(maybeFunc) { return typeof maybeFunc === 'function'; } class URLInput extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.onChange = this.onChange.bind(this); this.onFocus = this.onFocus.bind(this); this.onKeyDown = this.onKeyDown.bind(this); this.selectLink = this.selectLink.bind(this); this.handleOnClick = this.handleOnClick.bind(this); this.bindSuggestionNode = this.bindSuggestionNode.bind(this); this.autocompleteRef = props.autocompleteRef || (0,external_wp_element_namespaceObject.createRef)(); this.inputRef = (0,external_wp_element_namespaceObject.createRef)(); this.updateSuggestions = (0,external_wp_compose_namespaceObject.debounce)(this.updateSuggestions.bind(this), 200); this.suggestionNodes = []; this.suggestionsRequest = null; this.state = { suggestions: [], showSuggestions: false, suggestionsValue: null, selectedSuggestion: null, suggestionsListboxId: '', suggestionOptionIdPrefix: '' }; } componentDidUpdate(prevProps) { const { showSuggestions, selectedSuggestion } = this.state; const { value, __experimentalShowInitialSuggestions = false } = this.props; // Only have to worry about scrolling selected suggestion into view // when already expanded. if (showSuggestions && selectedSuggestion !== null && this.suggestionNodes[selectedSuggestion]) { this.suggestionNodes[selectedSuggestion].scrollIntoView({ behavior: 'instant', block: 'nearest', inline: 'nearest' }); } // Update suggestions when the value changes. if (prevProps.value !== value && !this.props.disableSuggestions) { if (value?.length) { // If the new value is not empty we need to update with suggestions for it. this.updateSuggestions(value); } else if (__experimentalShowInitialSuggestions) { // If the new value is empty and we can show initial suggestions, then show initial suggestions. this.updateSuggestions(); } } } componentDidMount() { if (this.shouldShowInitialSuggestions()) { this.updateSuggestions(); } } componentWillUnmount() { this.suggestionsRequest?.cancel?.(); this.suggestionsRequest = null; } bindSuggestionNode(index) { return ref => { this.suggestionNodes[index] = ref; }; } shouldShowInitialSuggestions() { const { __experimentalShowInitialSuggestions = false, value } = this.props; return __experimentalShowInitialSuggestions && !(value && value.length); } updateSuggestions(value = '') { const { __experimentalFetchLinkSuggestions: fetchLinkSuggestions, __experimentalHandleURLSuggestions: handleURLSuggestions } = this.props; if (!fetchLinkSuggestions) { return; } // Initial suggestions may only show if there is no value // (note: this includes whitespace). const isInitialSuggestions = !value?.length; // Trim only now we've determined whether or not it originally had a "length" // (even if that value was all whitespace). value = value.trim(); // Allow a suggestions request if: // - there are at least 2 characters in the search input (except manual searches where // search input length is not required to trigger a fetch) // - this is a direct entry (eg: a URL) if (!isInitialSuggestions && (value.length < 2 || !handleURLSuggestions && (0,external_wp_url_namespaceObject.isURL)(value))) { this.suggestionsRequest?.cancel?.(); this.suggestionsRequest = null; this.setState({ suggestions: [], showSuggestions: false, suggestionsValue: value, selectedSuggestion: null, loading: false }); return; } this.setState({ selectedSuggestion: null, loading: true }); const request = fetchLinkSuggestions(value, { isInitialSuggestions }); request.then(suggestions => { // A fetch Promise doesn't have an abort option. It's mimicked by // comparing the request reference in on the instance, which is // reset or deleted on subsequent requests or unmounting. if (this.suggestionsRequest !== request) { return; } this.setState({ suggestions, suggestionsValue: value, loading: false, showSuggestions: !!suggestions.length }); if (!!suggestions.length) { this.props.debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', suggestions.length), suggestions.length), 'assertive'); } else { this.props.debouncedSpeak((0,external_wp_i18n_namespaceObject.__)('No results.'), 'assertive'); } }).catch(() => { if (this.suggestionsRequest !== request) { return; } this.setState({ loading: false }); }).finally(() => { // If this is the current promise then reset the reference // to allow for checking if a new request is made. if (this.suggestionsRequest === request) { this.suggestionsRequest = null; } }); // Note that this assignment is handled *before* the async search request // as a Promise always resolves on the next tick of the event loop. this.suggestionsRequest = request; } onChange(newValue) { this.props.onChange(newValue); } onFocus() { const { suggestions } = this.state; const { disableSuggestions, value } = this.props; // When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value // Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons) // or there is already a request in progress. if (value && !disableSuggestions && !(suggestions && suggestions.length) && this.suggestionsRequest === null) { // Ensure the suggestions are updated with the current input value. this.updateSuggestions(value); } } onKeyDown(event) { this.props.onKeyDown?.(event); const { showSuggestions, selectedSuggestion, suggestions, loading } = this.state; // If the suggestions are not shown or loading, we shouldn't handle the arrow keys // We shouldn't preventDefault to allow block arrow keys navigation. if (!showSuggestions || !suggestions.length || loading) { // In the Windows version of Firefox the up and down arrows don't move the caret // within an input field like they do for Mac Firefox/Chrome/Safari. This causes // a form of focus trapping that is disruptive to the user experience. This disruption // only happens if the caret is not in the first or last position in the text input. // See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747 switch (event.keyCode) { // When UP is pressed, if the caret is at the start of the text, move it to the 0 // position. case external_wp_keycodes_namespaceObject.UP: { if (0 !== event.target.selectionStart) { event.preventDefault(); // Set the input caret to position 0. event.target.setSelectionRange(0, 0); } break; } // When DOWN is pressed, if the caret is not at the end of the text, move it to the // last position. case external_wp_keycodes_namespaceObject.DOWN: { if (this.props.value.length !== event.target.selectionStart) { event.preventDefault(); // Set the input caret to the last position. event.target.setSelectionRange(this.props.value.length, this.props.value.length); } break; } // Submitting while loading should trigger onSubmit. case external_wp_keycodes_namespaceObject.ENTER: { if (this.props.onSubmit) { event.preventDefault(); this.props.onSubmit(null, event); } break; } } return; } const suggestion = this.state.suggestions[this.state.selectedSuggestion]; switch (event.keyCode) { case external_wp_keycodes_namespaceObject.UP: { event.preventDefault(); const previousIndex = !selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1; this.setState({ selectedSuggestion: previousIndex }); break; } case external_wp_keycodes_namespaceObject.DOWN: { event.preventDefault(); const nextIndex = selectedSuggestion === null || selectedSuggestion === suggestions.length - 1 ? 0 : selectedSuggestion + 1; this.setState({ selectedSuggestion: nextIndex }); break; } case external_wp_keycodes_namespaceObject.TAB: { if (this.state.selectedSuggestion !== null) { this.selectLink(suggestion); // Announce a link has been selected when tabbing away from the input field. this.props.speak((0,external_wp_i18n_namespaceObject.__)('Link selected.')); } break; } case external_wp_keycodes_namespaceObject.ENTER: { event.preventDefault(); if (this.state.selectedSuggestion !== null) { this.selectLink(suggestion); if (this.props.onSubmit) { this.props.onSubmit(suggestion, event); } } else if (this.props.onSubmit) { this.props.onSubmit(null, event); } break; } } } selectLink(suggestion) { this.props.onChange(suggestion.url, suggestion); this.setState({ selectedSuggestion: null, showSuggestions: false }); } handleOnClick(suggestion) { this.selectLink(suggestion); // Move focus to the input field when a link suggestion is clicked. this.inputRef.current.focus(); } static getDerivedStateFromProps({ value, instanceId, disableSuggestions, __experimentalShowInitialSuggestions = false }, { showSuggestions }) { let shouldShowSuggestions = showSuggestions; const hasValue = value && value.length; if (!__experimentalShowInitialSuggestions && !hasValue) { shouldShowSuggestions = false; } if (disableSuggestions === true) { shouldShowSuggestions = false; } return { showSuggestions: shouldShowSuggestions, suggestionsListboxId: `block-editor-url-input-suggestions-${instanceId}`, suggestionOptionIdPrefix: `block-editor-url-input-suggestion-${instanceId}` }; } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [this.renderControl(), this.renderSuggestions()] }); } renderControl() { const { label = null, className, isFullWidth, instanceId, placeholder = (0,external_wp_i18n_namespaceObject.__)('Paste URL or type to search'), __experimentalRenderControl: renderControl, value = '', hideLabelFromVision = false } = this.props; const { loading, showSuggestions, selectedSuggestion, suggestionsListboxId, suggestionOptionIdPrefix } = this.state; const inputId = `url-input-control-${instanceId}`; const controlProps = { id: inputId, // Passes attribute to label for the for attribute label, className: dist_clsx('block-editor-url-input', className, { 'is-full-width': isFullWidth }), hideLabelFromVision }; const inputProps = { id: inputId, value, required: true, type: 'text', onChange: this.onChange, onFocus: this.onFocus, placeholder, onKeyDown: this.onKeyDown, role: 'combobox', 'aria-label': label ? undefined : (0,external_wp_i18n_namespaceObject.__)('URL'), // Ensure input always has an accessible label 'aria-expanded': showSuggestions, 'aria-autocomplete': 'list', 'aria-owns': suggestionsListboxId, 'aria-activedescendant': selectedSuggestion !== null ? `${suggestionOptionIdPrefix}-${selectedSuggestion}` : undefined, ref: this.inputRef, suffix: this.props.suffix }; if (renderControl) { return renderControl(controlProps, inputProps, loading); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, ...controlProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { ...inputProps, __next40pxDefaultSize: true }), loading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})] }); } renderSuggestions() { const { className, __experimentalRenderSuggestions: renderSuggestions } = this.props; const { showSuggestions, suggestions, suggestionsValue, selectedSuggestion, suggestionsListboxId, suggestionOptionIdPrefix, loading } = this.state; if (!showSuggestions || suggestions.length === 0) { return null; } const suggestionsListProps = { id: suggestionsListboxId, ref: this.autocompleteRef, role: 'listbox' }; const buildSuggestionItemProps = (suggestion, index) => { return { role: 'option', tabIndex: '-1', id: `${suggestionOptionIdPrefix}-${index}`, ref: this.bindSuggestionNode(index), 'aria-selected': index === selectedSuggestion ? true : undefined }; }; if (isFunction(renderSuggestions)) { return renderSuggestions({ suggestions, selectedSuggestion, suggestionsListProps, buildSuggestionItemProps, isLoading: loading, handleSuggestionClick: this.handleOnClick, isInitialSuggestions: !suggestionsValue?.length, currentInputValue: suggestionsValue }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { placement: "bottom", focusOnMount: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...suggestionsListProps, className: dist_clsx('block-editor-url-input__suggestions', { [`${className}__suggestions`]: className }), children: suggestions.map((suggestion, index) => /*#__PURE__*/(0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...buildSuggestionItemProps(suggestion, index), key: suggestion.id, className: dist_clsx('block-editor-url-input__suggestion', { 'is-selected': index === selectedSuggestion }), onClick: () => this.handleOnClick(suggestion) }, suggestion.title)) }) }); } } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md */ /* harmony default export */ const url_input = ((0,external_wp_compose_namespaceObject.compose)(external_wp_compose_namespaceObject.withSafeTimeout, external_wp_components_namespaceObject.withSpokenMessages, external_wp_compose_namespaceObject.withInstanceId, (0,external_wp_data_namespaceObject.withSelect)((select, props) => { // If a link suggestions handler is already provided then // bail. if (isFunction(props.__experimentalFetchLinkSuggestions)) { return; } const { getSettings } = select(store); return { __experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions }; }))(URLInput)); ;// ./node_modules/@wordpress/icons/build-module/library/plus.js /** * WordPress dependencies */ const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); /* harmony default export */ const library_plus = (plus); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js /** * WordPress dependencies */ const LinkControlSearchCreate = ({ searchTerm, onClick, itemProps, buttonText }) => { if (!searchTerm) { return null; } let text; if (buttonText) { text = typeof buttonText === 'function' ? buttonText(searchTerm) : buttonText; } else { text = (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: search term. */ (0,external_wp_i18n_namespaceObject.__)('Create: <mark>%s</mark>'), searchTerm), { mark: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("mark", {}) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...itemProps, iconPosition: "left", icon: library_plus, className: "block-editor-link-control__search-item", onClick: onClick, children: text }); }; /* harmony default export */ const search_create_button = (LinkControlSearchCreate); ;// ./node_modules/@wordpress/icons/build-module/library/post-list.js /** * WordPress dependencies */ const postList = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z" }) }); /* harmony default export */ const post_list = (postList); ;// ./node_modules/@wordpress/icons/build-module/library/page.js /** * WordPress dependencies */ const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" })] }); /* harmony default export */ const library_page = (page); ;// ./node_modules/@wordpress/icons/build-module/library/tag.js /** * WordPress dependencies */ const tag = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" }) }); /* harmony default export */ const library_tag = (tag); ;// ./node_modules/@wordpress/icons/build-module/library/category.js /** * WordPress dependencies */ const category = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z", fillRule: "evenodd", clipRule: "evenodd" }) }); /* harmony default export */ const library_category = (category); ;// ./node_modules/@wordpress/icons/build-module/library/file.js /** * WordPress dependencies */ const file = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z" }) }); /* harmony default export */ const library_file = (file); ;// ./node_modules/@wordpress/icons/build-module/library/globe.js /** * WordPress dependencies */ const globe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z" }) }); /* harmony default export */ const library_globe = (globe); ;// ./node_modules/@wordpress/icons/build-module/library/home.js /** * WordPress dependencies */ const home = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) }); /* harmony default export */ const library_home = (home); ;// ./node_modules/@wordpress/icons/build-module/library/verse.js /** * WordPress dependencies */ const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) }); /* harmony default export */ const library_verse = (verse); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js /** * WordPress dependencies */ const ICONS_MAP = { post: post_list, page: library_page, post_tag: library_tag, category: library_category, attachment: library_file }; function SearchItemIcon({ isURL, suggestion }) { let icon = null; if (isURL) { icon = library_globe; } else if (suggestion.type in ICONS_MAP) { icon = ICONS_MAP[suggestion.type]; if (suggestion.type === 'page') { if (suggestion.isFrontPage) { icon = library_home; } if (suggestion.isBlogHome) { icon = library_verse; } } } if (icon) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { className: "block-editor-link-control__search-item-icon", icon: icon }); } return null; } /** * Adds a leading slash to a url if it doesn't already have one. * @param {string} url the url to add a leading slash to. * @return {string} the url with a leading slash. */ function addLeadingSlash(url) { const trimmedURL = url?.trim(); if (!trimmedURL?.length) { return url; } return url?.replace(/^\/?/, '/'); } function removeTrailingSlash(url) { const trimmedURL = url?.trim(); if (!trimmedURL?.length) { return url; } return url?.replace(/\/$/, ''); } const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs); const defaultTo = d => v => { return v === null || v === undefined || v !== v ? d : v; }; /** * Prepares a URL for display in the UI. * - decodes the URL. * - filters it (removes protocol, www, etc.). * - truncates it if necessary. * - adds a leading slash. * @param {string} url the url. * @return {string} the processed url to display. */ function getURLForDisplay(url) { if (!url) { return url; } return (0,external_wp_compose_namespaceObject.pipe)(external_wp_url_namespaceObject.safeDecodeURI, external_wp_url_namespaceObject.getPath, defaultTo(''), partialRight(external_wp_url_namespaceObject.filterURLForDisplay, 24), removeTrailingSlash, addLeadingSlash)(url); } const LinkControlSearchItem = ({ itemProps, suggestion, searchTerm, onClick, isURL = false, shouldShowType = false }) => { const info = isURL ? (0,external_wp_i18n_namespaceObject.__)('Press ENTER to add this link') : getURLForDisplay(suggestion.url); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...itemProps, info: info, iconPosition: "left", icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchItemIcon, { suggestion: suggestion, isURL: isURL }), onClick: onClick, shortcut: shouldShowType && getVisualTypeName(suggestion), className: "block-editor-link-control__search-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextHighlight // The component expects a plain text string. , { text: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(suggestion.title), highlight: searchTerm }) }); }; function getVisualTypeName(suggestion) { if (suggestion.isFrontPage) { return 'front page'; } if (suggestion.isBlogHome) { return 'blog home'; } // Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label. return suggestion.type === 'post_tag' ? 'tag' : suggestion.type; } /* harmony default export */ const search_item = (LinkControlSearchItem); const __experimentalLinkControlSearchItem = props => { external_wp_deprecated_default()('wp.blockEditor.__experimentalLinkControlSearchItem', { since: '6.8' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchItem, { ...props }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/constants.js /** * WordPress dependencies */ // Used as a unique identifier for the "Create" option within search results. // Used to help distinguish the "Create" suggestion within the search results in // order to handle it as a unique case. const CREATE_TYPE = '__CREATE__'; const TEL_TYPE = 'tel'; const URL_TYPE = 'link'; const MAILTO_TYPE = 'mailto'; const INTERNAL_TYPE = 'internal'; const LINK_ENTRY_TYPES = [URL_TYPE, MAILTO_TYPE, TEL_TYPE, INTERNAL_TYPE]; const DEFAULT_LINK_SETTINGS = [{ id: 'opensInNewTab', title: (0,external_wp_i18n_namespaceObject.__)('Open in new tab') }]; ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js /** * WordPress dependencies */ /** * External dependencies */ /** * Internal dependencies */ function LinkControlSearchResults({ withCreateSuggestion, currentInputValue, handleSuggestionClick, suggestionsListProps, buildSuggestionItemProps, suggestions, selectedSuggestion, isLoading, isInitialSuggestions, createSuggestionButtonText, suggestionsQuery }) { const resultsListClasses = dist_clsx('block-editor-link-control__search-results', { 'is-loading': isLoading }); const isSingleDirectEntryResult = suggestions.length === 1 && LINK_ENTRY_TYPES.includes(suggestions[0].type); const shouldShowCreateSuggestion = withCreateSuggestion && !isSingleDirectEntryResult && !isInitialSuggestions; // If the query has a specified type, then we can skip showing them in the result. See #24839. const shouldShowSuggestionsTypes = !suggestionsQuery?.type; const labelText = isInitialSuggestions ? (0,external_wp_i18n_namespaceObject.__)('Suggestions') : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: search term. */ (0,external_wp_i18n_namespaceObject.__)('Search results for "%s"'), currentInputValue); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__search-results-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...suggestionsListProps, className: resultsListClasses, "aria-label": labelText, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: suggestions.map((suggestion, index) => { if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_create_button, { searchTerm: currentInputValue, buttonText: createSuggestionButtonText, onClick: () => handleSuggestionClick(suggestion) // Intentionally only using `type` here as // the constant is enough to uniquely // identify the single "CREATE" suggestion. , itemProps: buildSuggestionItemProps(suggestion, index), isSelected: index === selectedSuggestion }, suggestion.type); } // If we're not handling "Create" suggestions above then // we don't want them in the main results so exit early. if (CREATE_TYPE === suggestion.type) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_item, { itemProps: buildSuggestionItemProps(suggestion, index), suggestion: suggestion, index: index, onClick: () => { handleSuggestionClick(suggestion); }, isSelected: index === selectedSuggestion, isURL: LINK_ENTRY_TYPES.includes(suggestion.type), searchTerm: currentInputValue, shouldShowType: shouldShowSuggestionsTypes, isFrontPage: suggestion?.isFrontPage, isBlogHome: suggestion?.isBlogHome }, `${suggestion.id}-${suggestion.type}`); }) }) }) }); } /* harmony default export */ const search_results = (LinkControlSearchResults); const __experimentalLinkControlSearchResults = props => { external_wp_deprecated_default()('wp.blockEditor.__experimentalLinkControlSearchResults', { since: '6.8' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchResults, { ...props }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js /** * WordPress dependencies */ /** * Determines whether a given value could be a URL. Note this does not * guarantee the value is a URL only that it looks like it might be one. For * example, just because a string has `www.` in it doesn't make it a URL, * but it does make it highly likely that it will be so in the context of * creating a link it makes sense to treat it like one. * * @param {string} val the candidate for being URL-like (or not). * * @return {boolean} whether or not the value is potentially a URL. */ function isURLLike(val) { const hasSpaces = val.includes(' '); if (hasSpaces) { return false; } const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val); const protocolIsValid = (0,external_wp_url_namespaceObject.isValidProtocol)(protocol); const mayBeTLD = hasPossibleTLD(val); const isWWW = val?.startsWith('www.'); const isInternal = val?.startsWith('#') && (0,external_wp_url_namespaceObject.isValidFragment)(val); return protocolIsValid || isWWW || isInternal || mayBeTLD; } /** * Checks if a given URL has a valid Top-Level Domain (TLD). * * @param {string} url - The URL to check. * @param {number} maxLength - The maximum length of the TLD. * @return {boolean} Returns true if the URL has a valid TLD, false otherwise. */ function hasPossibleTLD(url, maxLength = 6) { // Clean the URL by removing anything after the first occurrence of "?" or "#". const cleanedURL = url.split(/[?#]/)[0]; // Regular expression explanation: // - (?<=\S) : Positive lookbehind assertion to ensure there is at least one non-whitespace character before the TLD // - \. : Matches a literal dot (.) // - [a-zA-Z_]{2,maxLength} : Matches 2 to maxLength letters or underscores, representing the TLD // - (?:\/|$) : Non-capturing group that matches either a forward slash (/) or the end of the string const regex = new RegExp(`(?<=\\S)\\.(?:[a-zA-Z_]{2,${maxLength}})(?:\\/|$)`); return regex.test(cleanedURL); } ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js /** * WordPress dependencies */ /** * Internal dependencies */ const handleNoop = () => Promise.resolve([]); const handleDirectEntry = val => { let type = URL_TYPE; const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val) || ''; if (protocol.includes('mailto')) { type = MAILTO_TYPE; } if (protocol.includes('tel')) { type = TEL_TYPE; } if (val?.startsWith('#')) { type = INTERNAL_TYPE; } return Promise.resolve([{ id: val, title: val, url: type === 'URL' ? (0,external_wp_url_namespaceObject.prependHTTP)(val) : val, type }]); }; const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, withCreateSuggestion, pageOnFront, pageForPosts) => { const { isInitialSuggestions } = suggestionsQuery; const results = await fetchSearchSuggestions(val, suggestionsQuery); // Identify front page and update type to match. results.map(result => { if (Number(result.id) === pageOnFront) { result.isFrontPage = true; return result; } else if (Number(result.id) === pageForPosts) { result.isBlogHome = true; return result; } return result; }); // If displaying initial suggestions just return plain results. if (isInitialSuggestions) { return results; } // Here we append a faux suggestion to represent a "CREATE" option. This // is detected in the rendering of the search results and handled as a // special case. This is currently necessary because the suggestions // dropdown will only appear if there are valid suggestions and // therefore unless the create option is a suggestion it will not // display in scenarios where there are no results returned from the // API. In addition promoting CREATE to a first class suggestion affords // the a11y benefits afforded by `URLInput` to all suggestions (eg: // keyboard handling, ARIA roles...etc). // // Note also that the value of the `title` and `url` properties must correspond // to the text value of the `<input>`. This is because `title` is used // when creating the suggestion. Similarly `url` is used when using keyboard to select // the suggestion (the <form> `onSubmit` handler falls-back to `url`). return isURLLike(val) || !withCreateSuggestion ? results : results.concat({ // the `id` prop is intentionally omitted here because it // is never exposed as part of the component's public API. // see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316. title: val, // Must match the existing `<input>`s text value. url: val, // Must match the existing `<input>`s text value. type: CREATE_TYPE }); }; function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion) { const { fetchSearchSuggestions, pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(store); return { pageOnFront: getSettings().pageOnFront, pageForPosts: getSettings().pageForPosts, fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions }; }, []); const directEntryHandler = allowDirectEntry ? handleDirectEntry : handleNoop; return (0,external_wp_element_namespaceObject.useCallback)((val, { isInitialSuggestions }) => { return isURLLike(val) ? directEntryHandler(val, { isInitialSuggestions }) : handleEntitySearch(val, { ...suggestionsQuery, isInitialSuggestions }, fetchSearchSuggestions, withCreateSuggestion, pageOnFront, pageForPosts); }, [directEntryHandler, fetchSearchSuggestions, pageOnFront, pageForPosts, suggestionsQuery, withCreateSuggestion]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js /** * WordPress dependencies */ /** * Internal dependencies */ // Must be a function as otherwise URLInput will default // to the fetchLinkSuggestions passed in block editor settings // which will cause an unintended http request. const noopSearchHandler = () => Promise.resolve([]); const noop = () => {}; const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef)(({ value, children, currentLink = {}, className = null, placeholder = null, withCreateSuggestion = false, onCreateSuggestion = noop, onChange = noop, onSelect = noop, showSuggestions = true, renderSuggestions = props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_results, { ...props }), fetchSuggestions = null, allowDirectEntry = true, showInitialSuggestions = false, suggestionsQuery = {}, withURLSuggestion = true, createSuggestionButtonText, hideLabelFromVision = false, suffix }, ref) => { const genericSearchHandler = useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion); const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler; const [focusedSuggestion, setFocusedSuggestion] = (0,external_wp_element_namespaceObject.useState)(); /** * Handles the user moving between different suggestions. Does not handle * choosing an individual item. * * @param {string} selection the url of the selected suggestion. * @param {Object} suggestion the suggestion object. */ const onInputChange = (selection, suggestion) => { onChange(selection); setFocusedSuggestion(suggestion); }; const handleRenderSuggestions = props => renderSuggestions({ ...props, withCreateSuggestion, createSuggestionButtonText, suggestionsQuery, handleSuggestionClick: suggestion => { if (props.handleSuggestionClick) { props.handleSuggestionClick(suggestion); } onSuggestionSelected(suggestion); } }); const onSuggestionSelected = async selectedSuggestion => { let suggestion = selectedSuggestion; if (CREATE_TYPE === selectedSuggestion.type) { // Create a new page and call onSelect with the output from the onCreateSuggestion callback. try { suggestion = await onCreateSuggestion(selectedSuggestion.title); if (suggestion?.url) { onSelect(suggestion); } } catch (e) {} return; } if (allowDirectEntry || suggestion && Object.keys(suggestion).length >= 1) { const { id, url, ...restLinkProps } = currentLink !== null && currentLink !== void 0 ? currentLink : {}; onSelect( // Some direct entries don't have types or IDs, and we still need to clear the previous ones. { ...restLinkProps, ...suggestion }, suggestion); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__search-input-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_input, { disableSuggestions: currentLink?.url === value, label: (0,external_wp_i18n_namespaceObject.__)('Link'), hideLabelFromVision: hideLabelFromVision, className: className, value: value, onChange: onInputChange, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0,external_wp_i18n_namespaceObject.__)('Search or type URL'), __experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null, __experimentalFetchLinkSuggestions: searchHandler, __experimentalHandleURLSuggestions: true, __experimentalShowInitialSuggestions: showInitialSuggestions, onSubmit: (suggestion, event) => { const hasSuggestion = suggestion || focusedSuggestion; // If there is no suggestion and the value (ie: any manually entered URL) is empty // then don't allow submission otherwise we get empty links. if (!hasSuggestion && !value?.trim()?.length) { event.preventDefault(); } else { onSuggestionSelected(hasSuggestion || { url: value }); } }, ref: ref, suffix: suffix }), children] }); }); /* harmony default export */ const search_input = (LinkControlSearchInput); const __experimentalLinkControlSearchInput = props => { external_wp_deprecated_default()('wp.blockEditor.__experimentalLinkControlSearchInput', { since: '6.8' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchInput, { ...props }); }; ;// ./node_modules/@wordpress/icons/build-module/library/info.js /** * WordPress dependencies */ const info = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" }) }); /* harmony default export */ const library_info = (info); ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js /** * WordPress dependencies */ const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); /* harmony default export */ const library_pencil = (pencil); ;// ./node_modules/@wordpress/icons/build-module/library/edit.js /** * Internal dependencies */ /* harmony default export */ const edit = (library_pencil); ;// ./node_modules/@wordpress/icons/build-module/library/link-off.js /** * WordPress dependencies */ const linkOff = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z" }) }); /* harmony default export */ const link_off = (linkOff); ;// ./node_modules/@wordpress/icons/build-module/library/copy-small.js /** * WordPress dependencies */ const copySmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" }) }); /* harmony default export */ const copy_small = (copySmall); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/viewer-slot.js /** * WordPress dependencies */ const { Slot: ViewerSlot, Fill: ViewerFill } = (0,external_wp_components_namespaceObject.createSlotFill)('BlockEditorLinkControlViewer'); /* harmony default export */ const viewer_slot = ((/* unused pure expression or super */ null && (ViewerSlot))); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-rich-url-data.js /** * Internal dependencies */ /** * WordPress dependencies */ function use_rich_url_data_reducer(state, action) { switch (action.type) { case 'RESOLVED': return { ...state, isFetching: false, richData: action.richData }; case 'ERROR': return { ...state, isFetching: false, richData: null }; case 'LOADING': return { ...state, isFetching: true }; default: throw new Error(`Unexpected action type ${action.type}`); } } function useRemoteUrlData(url) { const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(use_rich_url_data_reducer, { richData: null, isFetching: false }); const { fetchRichUrlData } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(store); return { fetchRichUrlData: getSettings().__experimentalFetchRichUrlData }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { // Only make the request if we have an actual URL // and the fetching util is available. In some editors // there may not be such a util. if (url?.length && fetchRichUrlData && typeof AbortController !== 'undefined') { dispatch({ type: 'LOADING' }); const controller = new window.AbortController(); const signal = controller.signal; fetchRichUrlData(url, { signal }).then(urlData => { dispatch({ type: 'RESOLVED', richData: urlData }); }).catch(() => { // Avoid setting state on unmounted component if (!signal.aborted) { dispatch({ type: 'ERROR' }); } }); // Cleanup: when the URL changes the abort the current request. return () => { controller.abort(); }; } }, [url]); return state; } /* harmony default export */ const use_rich_url_data = (useRemoteUrlData); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/link-preview.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Filters the title for display. Removes the protocol and www prefix. * * @param {string} title The title to be filtered. * * @return {string} The filtered title. */ function filterTitleForDisplay(title) { // Derived from `filterURLForDisplay` in `@wordpress/url`. return title.replace(/^[a-z\-.\+]+[0-9]*:(\/\/)?/i, '').replace(/^www\./i, ''); } function LinkPreview({ value, onEditClick, hasRichPreviews = false, hasUnlinkControl = false, onRemove }) { const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'), []); // Avoid fetching if rich previews are not desired. const showRichPreviews = hasRichPreviews ? value?.url : null; const { richData, isFetching } = use_rich_url_data(showRichPreviews); // Rich data may be an empty object so test for that. const hasRichData = richData && Object.keys(richData).length; const displayURL = value && (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(value.url), 24) || ''; // url can be undefined if the href attribute is unset const isEmptyURL = !value?.url?.length; const displayTitle = !isEmptyURL && (0,external_wp_dom_namespaceObject.__unstableStripHTML)(richData?.title || value?.title || displayURL); const isUrlRedundant = !value?.url || filterTitleForDisplay(displayTitle) === displayURL; let icon; if (richData?.icon) { icon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: richData?.icon, alt: "" }); } else if (isEmptyURL) { icon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_info, size: 32 }); } else { icon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_globe }); } const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(value.url, () => { createNotice('info', (0,external_wp_i18n_namespaceObject.__)('Link copied to clipboard.'), { isDismissible: true, type: 'snackbar' }); }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "group", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Manage link'), className: dist_clsx('block-editor-link-control__search-item', { 'is-current': true, 'is-rich': hasRichData, 'is-fetching': !!isFetching, 'is-preview': true, 'is-error': isEmptyURL, 'is-url-title': displayTitle === displayURL }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__search-item-top", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "block-editor-link-control__search-item-header", role: "figure", "aria-label": /* translators: Accessibility text for the link preview when editing a link. */ (0,external_wp_i18n_namespaceObject.__)('Link information'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: dist_clsx('block-editor-link-control__search-item-icon', { 'is-image': richData?.icon }), children: icon }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-link-control__search-item-details", children: !isEmptyURL ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { className: "block-editor-link-control__search-item-title", href: value.url, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, children: displayTitle }) }), !isUrlRedundant && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-link-control__search-item-info", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, children: displayURL }) })] }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-link-control__search-item-error-notice", children: (0,external_wp_i18n_namespaceObject.__)('Link is empty') }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: edit, label: (0,external_wp_i18n_namespaceObject.__)('Edit link'), onClick: onEditClick, size: "compact", showTooltip: !showIconLabels }), hasUnlinkControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: link_off, label: (0,external_wp_i18n_namespaceObject.__)('Remove link'), onClick: onRemove, size: "compact", showTooltip: !showIconLabels }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: copy_small, label: (0,external_wp_i18n_namespaceObject.__)('Copy link'), ref: ref, accessibleWhenDisabled: true, disabled: isEmptyURL, size: "compact", showTooltip: !showIconLabels }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewerSlot, { fillProps: value })] }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings.js /** * WordPress dependencies */ const settings_noop = () => {}; const LinkControlSettings = ({ value, onChange = settings_noop, settings }) => { if (!settings || !settings.length) { return null; } const handleSettingChange = setting => newValue => { onChange({ ...value, [setting.id]: newValue }); }; const theSettings = settings.map(setting => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, className: "block-editor-link-control__setting", label: setting.title, onChange: handleSettingChange(setting), checked: value ? !!value[setting.id] : false, help: setting?.help }, setting.id)); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-link-control__settings", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Currently selected link settings') }), theSettings] }); }; /* harmony default export */ const link_control_settings = (LinkControlSettings); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-create-page.js /** * WordPress dependencies */ function useCreatePage(handleCreatePage) { const cancelableCreateSuggestion = (0,external_wp_element_namespaceObject.useRef)(); const [isCreatingPage, setIsCreatingPage] = (0,external_wp_element_namespaceObject.useState)(false); const [errorMessage, setErrorMessage] = (0,external_wp_element_namespaceObject.useState)(null); const createPage = async function (suggestionTitle) { setIsCreatingPage(true); setErrorMessage(null); try { // Make cancellable in order that we can avoid setting State // if the component unmounts during the call to `createSuggestion` cancelableCreateSuggestion.current = makeCancelable( // Using Promise.resolve to allow createSuggestion to return a // non-Promise based value. Promise.resolve(handleCreatePage(suggestionTitle))); return await cancelableCreateSuggestion.current.promise; } catch (error) { if (error && error.isCanceled) { return; // bail if canceled to avoid setting state } setErrorMessage(error.message || (0,external_wp_i18n_namespaceObject.__)('An unknown error occurred during creation. Please try again.')); throw error; } finally { setIsCreatingPage(false); } }; /** * Handles cancelling any pending Promises that have been made cancelable. */ (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { // componentDidUnmount if (cancelableCreateSuggestion.current) { cancelableCreateSuggestion.current.cancel(); } }; }, []); return { createPage, isCreatingPage, errorMessage }; } /** * Creates a wrapper around a promise which allows it to be programmatically * cancelled. * See: https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html * * @param {Promise} promise the Promise to make cancelable */ const makeCancelable = promise => { let hasCanceled_ = false; const wrappedPromise = new Promise((resolve, reject) => { promise.then(val => hasCanceled_ ? reject({ isCanceled: true }) : resolve(val), error => hasCanceled_ ? reject({ isCanceled: true }) : reject(error)); }); return { promise: wrappedPromise, cancel() { hasCanceled_ = true; } }; }; // EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js var fast_deep_equal = __webpack_require__(5215); var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-internal-value.js /** * WordPress dependencies */ /** * External dependencies */ function useInternalValue(value) { const [internalValue, setInternalValue] = (0,external_wp_element_namespaceObject.useState)(value || {}); const [previousValue, setPreviousValue] = (0,external_wp_element_namespaceObject.useState)(value); // If the value prop changes, update the internal state. // See: // - https://github.com/WordPress/gutenberg/pull/51387#issuecomment-1722927384. // - https://react.dev/reference/react/useState#storing-information-from-previous-renders. if (!fast_deep_equal_default()(value, previousValue)) { setPreviousValue(value); setInternalValue(value); } const setInternalURLInputValue = nextValue => { setInternalValue({ ...internalValue, url: nextValue }); }; const setInternalTextInputValue = nextValue => { setInternalValue({ ...internalValue, title: nextValue }); }; const createSetInternalSettingValueHandler = settingsKeys => nextValue => { // Only apply settings values which are defined in the settings prop. const settingsUpdates = Object.keys(nextValue).reduce((acc, key) => { if (settingsKeys.includes(key)) { acc[key] = nextValue[key]; } return acc; }, {}); setInternalValue({ ...internalValue, ...settingsUpdates }); }; return [internalValue, setInternalValue, setInternalURLInputValue, setInternalTextInputValue, createSetInternalSettingValueHandler]; } ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Default properties associated with a link control value. * * @typedef WPLinkControlDefaultValue * * @property {string} url Link URL. * @property {string=} title Link title. * @property {boolean=} opensInNewTab Whether link should open in a new browser * tab. This value is only assigned if not * providing a custom `settings` prop. */ /* eslint-disable jsdoc/valid-types */ /** * Custom settings values associated with a link. * * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue */ /* eslint-enable */ /** * Custom settings values associated with a link. * * @typedef WPLinkControlSetting * * @property {string} id Identifier to use as property for setting value. * @property {string} title Human-readable label to show in user interface. */ /** * Properties associated with a link control value, composed as a union of the * default properties and any custom settings values. * * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue */ /** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */ /** * Properties associated with a search suggestion used within the LinkControl. * * @typedef WPLinkControlSuggestion * * @property {string} id Identifier to use to uniquely identify the suggestion. * @property {string} type Identifies the type of the suggestion (eg: `post`, * `page`, `url`...etc) * @property {string} title Human-readable label to show in user interface. * @property {string} url A URL for the suggestion. */ /** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */ /** * @typedef WPLinkControlProps * * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to * render a `ToggleControl` for that setting. * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the * internal editing state of the component to respective * show or not show the URL input field. * @property {WPLinkControlValue=} value Current link value. * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if * the user selects a new link or updates settings. * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link. * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL. * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately. * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion. * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions. * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL. * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title. * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion. * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component. */ const link_control_noop = () => {}; const PREFERENCE_SCOPE = 'core/block-editor'; const PREFERENCE_KEY = 'linkControlSettingsDrawer'; /** * Renders a link control. A link control is a controlled input which maintains * a value associated with a link (HTML anchor element) and relevant settings * for how that link is expected to behave. * * @param {WPLinkControlProps} props Component props. */ function LinkControl({ searchInputPlaceholder, value, settings = DEFAULT_LINK_SETTINGS, onChange = link_control_noop, onRemove, onCancel, noDirectEntry = false, showSuggestions = true, showInitialSuggestions, forceIsEditingLink, createSuggestion, withCreateSuggestion, inputValue: propInputValue = '', suggestionsQuery = {}, noURLSuggestion = false, createSuggestionButtonText, hasRichPreviews = false, hasTextControl = false, renderControlBottom = null }) { if (withCreateSuggestion === undefined && createSuggestion) { withCreateSuggestion = true; } const [settingsOpen, setSettingsOpen] = (0,external_wp_element_namespaceObject.useState)(false); const { advancedSettingsPreference } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _prefsStore$get; const prefsStore = select(external_wp_preferences_namespaceObject.store); return { advancedSettingsPreference: (_prefsStore$get = prefsStore.get(PREFERENCE_SCOPE, PREFERENCE_KEY)) !== null && _prefsStore$get !== void 0 ? _prefsStore$get : false }; }, []); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); /** * Sets the open/closed state of the Advanced Settings Drawer, * optionlly persisting the state to the user's preferences. * * Note that Block Editor components can be consumed by non-WordPress * environments which may not have preferences setup. * Therefore a local state is also used as a fallback. * * @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer. */ const setSettingsOpenWithPreference = prefVal => { if (setPreference) { setPreference(PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal); } setSettingsOpen(prefVal); }; // Block Editor components can be consumed by non-WordPress environments // which may not have these preferences setup. // Therefore a local state is used as a fallback. const isSettingsOpen = advancedSettingsPreference || settingsOpen; const isMountingRef = (0,external_wp_element_namespaceObject.useRef)(true); const wrapperNode = (0,external_wp_element_namespaceObject.useRef)(); const textInputRef = (0,external_wp_element_namespaceObject.useRef)(); const isEndingEditWithFocusRef = (0,external_wp_element_namespaceObject.useRef)(false); const settingsKeys = settings.map(({ id }) => id); const [internalControlValue, setInternalControlValue, setInternalURLInputValue, setInternalTextInputValue, createSetInternalSettingValueHandler] = useInternalValue(value); const valueHasChanges = value && !(0,external_wp_isShallowEqual_namespaceObject.isShallowEqualObjects)(internalControlValue, value); const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(forceIsEditingLink !== undefined ? forceIsEditingLink : !value || !value.url); const { createPage, isCreatingPage, errorMessage } = useCreatePage(createSuggestion); (0,external_wp_element_namespaceObject.useEffect)(() => { if (forceIsEditingLink === undefined) { return; } setIsEditingLink(forceIsEditingLink); }, [forceIsEditingLink]); (0,external_wp_element_namespaceObject.useEffect)(() => { // We don't auto focus into the Link UI on mount // because otherwise using the keyboard to select text // *within* the link format is not possible. if (isMountingRef.current) { return; } // Scenario - when: // - switching between editable and non editable LinkControl // - clicking on a link // ...then move focus to the *first* element to avoid focus loss // and to ensure focus is *within* the Link UI. const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperNode.current)[0] || wrapperNode.current; nextFocusTarget.focus(); isEndingEditWithFocusRef.current = false; }, [isEditingLink, isCreatingPage]); // The component mounting reference is maintained separately // to correctly reset values in `StrictMode`. (0,external_wp_element_namespaceObject.useEffect)(() => { isMountingRef.current = false; return () => { isMountingRef.current = true; }; }, []); const hasLinkValue = value?.url?.trim()?.length > 0; /** * Cancels editing state and marks that focus may need to be restored after * the next render, if focus was within the wrapper when editing finished. */ const stopEditing = () => { isEndingEditWithFocusRef.current = !!wrapperNode.current?.contains(wrapperNode.current.ownerDocument.activeElement); setIsEditingLink(false); }; const handleSelectSuggestion = updatedValue => { // Suggestions may contains "settings" values (e.g. `opensInNewTab`) // which should not override any existing settings values set by the // user. This filters out any settings values from the suggestion. const nonSettingsChanges = Object.keys(updatedValue).reduce((acc, key) => { if (!settingsKeys.includes(key)) { acc[key] = updatedValue[key]; } return acc; }, {}); onChange({ ...internalControlValue, ...nonSettingsChanges, // As title is not a setting, it must be manually applied // in such a way as to preserve the users changes over // any "title" value provided by the "suggestion". title: internalControlValue?.title || updatedValue?.title }); stopEditing(); }; const handleSubmit = () => { if (valueHasChanges) { // Submit the original value with new stored values applied // on top. URL is a special case as it may also be a prop. onChange({ ...value, ...internalControlValue, url: currentUrlInputValue }); } stopEditing(); }; const handleSubmitWithEnter = event => { const { keyCode } = event; if (keyCode === external_wp_keycodes_namespaceObject.ENTER && !currentInputIsEmpty // Disallow submitting empty values. ) { event.preventDefault(); handleSubmit(); } }; const resetInternalValues = () => { setInternalControlValue(value); }; const handleCancel = event => { event.preventDefault(); event.stopPropagation(); // Ensure that any unsubmitted input changes are reset. resetInternalValues(); if (hasLinkValue) { // If there is a link then exist editing mode and show preview. stopEditing(); } else { // If there is no link value, then remove the link entirely. onRemove?.(); } onCancel?.(); }; const currentUrlInputValue = propInputValue || internalControlValue?.url || ''; const currentInputIsEmpty = !currentUrlInputValue?.trim()?.length; const shownUnlinkControl = onRemove && value && !isEditingLink && !isCreatingPage; const showActions = isEditingLink && hasLinkValue; // Only show text control once a URL value has been committed // and it isn't just empty whitespace. // See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927. const showTextControl = hasLinkValue && hasTextControl; const isEditing = (isEditingLink || !value) && !isCreatingPage; const isDisabled = !valueHasChanges || currentInputIsEmpty; const showSettings = !!settings?.length && isEditingLink && hasLinkValue; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { tabIndex: -1, ref: wrapperNode, className: "block-editor-link-control", children: [isCreatingPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__loading", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), " ", (0,external_wp_i18n_namespaceObject.__)('Creating'), "\u2026"] }), isEditing && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx({ 'block-editor-link-control__search-input-wrapper': true, 'has-text-control': showTextControl, 'has-actions': showActions }), children: [showTextControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, ref: textInputRef, className: "block-editor-link-control__field block-editor-link-control__text-content", label: (0,external_wp_i18n_namespaceObject.__)('Text'), value: internalControlValue?.title, onChange: setInternalTextInputValue, onKeyDown: handleSubmitWithEnter, __next40pxDefaultSize: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_input, { currentLink: value, className: "block-editor-link-control__field block-editor-link-control__search-input", placeholder: searchInputPlaceholder, value: currentUrlInputValue, withCreateSuggestion: withCreateSuggestion, onCreateSuggestion: createPage, onChange: setInternalURLInputValue, onSelect: handleSelectSuggestion, showInitialSuggestions: showInitialSuggestions, allowDirectEntry: !noDirectEntry, showSuggestions: showSuggestions, suggestionsQuery: suggestionsQuery, withURLSuggestion: !noURLSuggestion, createSuggestionButtonText: createSuggestionButtonText, hideLabelFromVision: !showTextControl, suffix: showActions ? undefined : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: isDisabled ? link_control_noop : handleSubmit, label: (0,external_wp_i18n_namespaceObject.__)('Submit'), icon: keyboard_return, className: "block-editor-link-control__search-submit", "aria-disabled": isDisabled, size: "small" }) }) })] }), errorMessage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { className: "block-editor-link-control__search-error", status: "error", isDismissible: false, children: errorMessage })] }), value && !isEditingLink && !isCreatingPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkPreview, { // force remount when URL changes to avoid race conditions for rich previews value: value, onEditClick: () => setIsEditingLink(true), hasRichPreviews: hasRichPreviews, hasUnlinkControl: shownUnlinkControl, onRemove: () => { onRemove(); setIsEditingLink(true); } }, value?.url), showSettings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__tools", children: !currentInputIsEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(settings_drawer, { settingsOpen: isSettingsOpen, setSettingsOpen: setSettingsOpenWithPreference, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(link_control_settings, { value: internalControlValue, settings: settings, onChange: createSetInternalSettingValueHandler(settingsKeys) }) }) }), showActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", className: "block-editor-link-control__search-actions", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: handleCancel, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: isDisabled ? link_control_noop : handleSubmit, className: "block-editor-link-control__search-submit", "aria-disabled": isDisabled, children: (0,external_wp_i18n_namespaceObject.__)('Save') })] }), !isCreatingPage && renderControlBottom && renderControlBottom()] }); } LinkControl.ViewerFill = ViewerFill; LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS; const DeprecatedExperimentalLinkControl = props => { external_wp_deprecated_default()('wp.blockEditor.__experimentalLinkControl', { since: '6.8', alternative: 'wp.blockEditor.LinkControl' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControl, { ...props }); }; DeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill; DeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS = LinkControl.DEFAULT_LINK_SETTINGS; /* harmony default export */ const link_control = (LinkControl); ;// ./node_modules/@wordpress/block-editor/build-module/components/media-replace-flow/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const media_replace_flow_noop = () => {}; let uniqueId = 0; const MediaReplaceFlow = ({ mediaURL, mediaId, mediaIds, allowedTypes, accept, onError, onSelect, onSelectURL, onReset, onToggleFeaturedImage, useFeaturedImage, onFilesUpload = media_replace_flow_noop, name = (0,external_wp_i18n_namespaceObject.__)('Replace'), createNotice, removeNotice, children, multiple = false, addToGallery, handleUpload = true, popoverProps, renderToggle }) => { const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(store); const errorNoticeID = `block-editor/media-replace-flow/error-notice/${++uniqueId}`; const onUploadError = message => { const safeMessage = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(message); if (onError) { onError(safeMessage); return; } // We need to set a timeout for showing the notice // so that VoiceOver and possibly other screen readers // can announce the error after the toolbar button // regains focus once the upload dialog closes. // Otherwise VO simply skips over the notice and announces // the focused element and the open menu. setTimeout(() => { createNotice('error', safeMessage, { speak: true, id: errorNoticeID, isDismissible: true }); }, 1000); }; const selectMedia = (media, closeMenu) => { if (useFeaturedImage && onToggleFeaturedImage) { onToggleFeaturedImage(); } closeMenu(); // Calling `onSelect` after the state update since it might unmount the component. onSelect(media); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('The media file has been replaced')); removeNotice(errorNoticeID); }; const uploadFiles = (event, closeMenu) => { const files = event.target.files; if (!handleUpload) { closeMenu(); return onSelect(files); } onFilesUpload(files); getSettings().mediaUpload({ allowedTypes, filesList: files, onFileChange: ([media]) => { selectMedia(media, closeMenu); }, onError: onUploadError }); }; const openOnArrowDown = event => { if (event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); event.target.click(); } }; const onlyAllowsImages = () => { if (!allowedTypes || allowedTypes.length === 0) { return false; } return allowedTypes.every(allowedType => allowedType === 'image' || allowedType.startsWith('image/')); }; const gallery = multiple && onlyAllowsImages(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, contentClassName: "block-editor-media-replace-flow__options", renderToggle: ({ isOpen, onToggle }) => { if (renderToggle) { return renderToggle({ 'aria-expanded': isOpen, 'aria-haspopup': 'true', onClick: onToggle, onKeyDown: openOnArrowDown, children: name }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { "aria-expanded": isOpen, "aria-haspopup": "true", onClick: onToggle, onKeyDown: openOnArrowDown, children: name }); }, renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { className: "block-editor-media-replace-flow__media-upload-menu", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(check, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_upload, { gallery: gallery, addToGallery: addToGallery, multiple: multiple, value: multiple ? mediaIds : mediaId, onSelect: media => selectMedia(media, onClose), allowedTypes: allowedTypes, render: ({ open }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: library_media, onClick: open, children: (0,external_wp_i18n_namespaceObject.__)('Open Media Library') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { onChange: event => { uploadFiles(event, onClose); }, accept: accept, multiple: !!multiple, render: ({ openFileDialog }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: library_upload, onClick: () => { openFileDialog(); }, children: (0,external_wp_i18n_namespaceObject._x)('Upload', 'verb') }); } })] }), onToggleFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: post_featured_image, onClick: onToggleFeaturedImage, isPressed: useFeaturedImage, children: (0,external_wp_i18n_namespaceObject.__)('Use featured image') }), mediaURL && onReset && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { onReset(); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Reset') }), typeof children === 'function' ? children({ onClose }) : children] }), onSelectURL && /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions (0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { className: "block-editor-media-flow__url-input", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-media-replace-flow__image-url-label", children: (0,external_wp_i18n_namespaceObject.__)('Current media URL:') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(link_control, { value: { url: mediaURL }, settings: [], showSuggestions: false, onChange: ({ url }) => { onSelectURL(url); } })] })] }) }); }; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-replace-flow/README.md */ /* harmony default export */ const media_replace_flow = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withDispatch)(dispatch => { const { createNotice, removeNotice } = dispatch(external_wp_notices_namespaceObject.store); return { createNotice, removeNotice }; }), (0,external_wp_components_namespaceObject.withFilters)('editor.MediaReplaceFlow')])(MediaReplaceFlow)); ;// ./node_modules/@wordpress/block-editor/build-module/components/background-image-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const IMAGE_BACKGROUND_TYPE = 'image'; const BACKGROUND_POPOVER_PROPS = { placement: 'left-start', offset: 36, shift: true, className: 'block-editor-global-styles-background-panel__popover' }; const background_image_control_noop = () => {}; /** * Get the help text for the background size control. * * @param {string} value backgroundSize value. * @return {string} Translated help text. */ function backgroundSizeHelpText(value) { if (value === 'cover' || value === undefined) { return (0,external_wp_i18n_namespaceObject.__)('Image covers the space evenly.'); } if (value === 'contain') { return (0,external_wp_i18n_namespaceObject.__)('Image is contained without distortion.'); } return (0,external_wp_i18n_namespaceObject.__)('Image has a fixed width.'); } /** * Converts decimal x and y coords from FocalPointPicker to percentage-based values * to use as backgroundPosition value. * * @param {{x?:number, y?:number}} value FocalPointPicker coords. * @return {string} backgroundPosition value. */ const coordsToBackgroundPosition = value => { if (!value || isNaN(value.x) && isNaN(value.y)) { return undefined; } const x = isNaN(value.x) ? 0.5 : value.x; const y = isNaN(value.y) ? 0.5 : value.y; return `${x * 100}% ${y * 100}%`; }; /** * Converts backgroundPosition value to x and y coords for FocalPointPicker. * * @param {string} value backgroundPosition value. * @return {{x?:number, y?:number}} FocalPointPicker coords. */ const backgroundPositionToCoords = value => { if (!value) { return { x: undefined, y: undefined }; } let [x, y] = value.split(' ').map(v => parseFloat(v) / 100); x = isNaN(x) ? undefined : x; y = isNaN(y) ? x : y; return { x, y }; }; function InspectorImagePreviewItem({ as = 'span', imgUrl, toggleProps = {}, filename, label, className, onToggleCallback = background_image_control_noop }) { (0,external_wp_element_namespaceObject.useEffect)(() => { if (typeof toggleProps?.isOpen !== 'undefined') { onToggleCallback(toggleProps?.isOpen); } }, [toggleProps?.isOpen, onToggleCallback]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { as: as, className: className, ...toggleProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", as: "span", className: "block-editor-global-styles-background-panel__inspector-preview-inner", children: [imgUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-global-styles-background-panel__inspector-image-indicator-wrapper", "aria-hidden": true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-global-styles-background-panel__inspector-image-indicator", style: { backgroundImage: `url(${imgUrl})` } }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { as: "span", style: imgUrl ? {} : { flexGrow: 1 }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, className: "block-editor-global-styles-background-panel__inspector-media-replace-title", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: imgUrl ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: file name */ (0,external_wp_i18n_namespaceObject.__)('Background image: %s'), filename || label) : (0,external_wp_i18n_namespaceObject.__)('No background image selected') })] })] }) }); } function BackgroundControlsPanel({ label, filename, url: imgUrl, children, onToggle: onToggleCallback = background_image_control_noop, hasImageValue }) { if (!hasImageValue) { return; } const imgLabel = label || (0,external_wp_url_namespaceObject.getFilename)(imgUrl) || (0,external_wp_i18n_namespaceObject.__)('Add background image'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: BACKGROUND_POPOVER_PROPS, renderToggle: ({ onToggle, isOpen }) => { const toggleProps = { onClick: onToggle, className: 'block-editor-global-styles-background-panel__dropdown-toggle', 'aria-expanded': isOpen, 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Background size, position and repeat options.'), isOpen }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorImagePreviewItem, { imgUrl: imgUrl, filename: filename, label: imgLabel, toggleProps: toggleProps, as: "button", onToggleCallback: onToggleCallback }); }, renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { className: "block-editor-global-styles-background-panel__dropdown-content-wrapper", paddingSize: "medium", children: children }) }); } function LoadingSpinner() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { className: "block-editor-global-styles-background-panel__loading", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }); } function BackgroundImageControls({ onChange, style, inheritedValue, onRemoveImage = background_image_control_noop, onResetImage = background_image_control_noop, displayInPanel, defaultValues }) { const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(store); const { id, title, url } = style?.background?.backgroundImage || { ...inheritedValue?.background?.backgroundImage }; const replaceContainerRef = (0,external_wp_element_namespaceObject.useRef)(); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const onUploadError = message => { createErrorNotice(message, { type: 'snackbar' }); setIsUploading(false); }; const resetBackgroundImage = () => onChange(setImmutably(style, ['background', 'backgroundImage'], undefined)); const onSelectMedia = media => { if (!media || !media.url) { resetBackgroundImage(); setIsUploading(false); return; } if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { setIsUploading(true); return; } // For media selections originated from a file upload. if (media.media_type && media.media_type !== IMAGE_BACKGROUND_TYPE || !media.media_type && media.type && media.type !== IMAGE_BACKGROUND_TYPE) { onUploadError((0,external_wp_i18n_namespaceObject.__)('Only images can be used as a background image.')); return; } const sizeValue = style?.background?.backgroundSize || defaultValues?.backgroundSize; const positionValue = style?.background?.backgroundPosition; onChange(setImmutably(style, ['background'], { ...style?.background, backgroundImage: { url: media.url, id: media.id, source: 'file', title: media.title || undefined }, backgroundPosition: /* * A background image uploaded and set in the editor receives a default background position of '50% 0', * when the background image size is the equivalent of "Tile". * This is to increase the chance that the image's focus point is visible. * This is in-editor only to assist with the user experience. */ !positionValue && ('auto' === sizeValue || !sizeValue) ? '50% 0' : positionValue, backgroundSize: sizeValue })); setIsUploading(false); }; // Drag and drop callback, restricting image to one. const onFilesDrop = filesList => { getSettings().mediaUpload({ allowedTypes: [IMAGE_BACKGROUND_TYPE], filesList, onFileChange([image]) { onSelectMedia(image); }, onError: onUploadError, multiple: false }); }; const hasValue = hasBackgroundImageValue(style); const closeAndFocus = () => { const [toggleButton] = external_wp_dom_namespaceObject.focus.tabbable.find(replaceContainerRef.current); // Focus the toggle button and close the dropdown menu. // This ensures similar behaviour as to selecting an image, where the dropdown is // closed and focus is redirected to the dropdown toggle button. toggleButton?.focus(); toggleButton?.click(); }; const onRemove = () => onChange(setImmutably(style, ['background'], { backgroundImage: 'none' })); const canRemove = !hasValue && hasBackgroundImageValue(inheritedValue); const imgLabel = title || (0,external_wp_url_namespaceObject.getFilename)(url) || (0,external_wp_i18n_namespaceObject.__)('Add background image'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: replaceContainerRef, className: "block-editor-global-styles-background-panel__image-tools-panel-item", children: [isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LoadingSpinner, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_replace_flow, { mediaId: id, mediaURL: url, allowedTypes: [IMAGE_BACKGROUND_TYPE], accept: "image/*", onSelect: onSelectMedia, popoverProps: { className: dist_clsx({ 'block-editor-global-styles-background-panel__media-replace-popover': displayInPanel }) }, name: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorImagePreviewItem, { className: "block-editor-global-styles-background-panel__image-preview", imgUrl: url, filename: title, label: imgLabel }), renderToggle: props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, __next40pxDefaultSize: true }), onError: onUploadError, onReset: () => { closeAndFocus(); onResetImage(); }, children: canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { closeAndFocus(); onRemove(); onRemoveImage(); }, children: (0,external_wp_i18n_namespaceObject.__)('Remove') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: onFilesDrop, label: (0,external_wp_i18n_namespaceObject.__)('Drop to upload') })] }); } function BackgroundSizeControls({ onChange, style, inheritedValue, defaultValues }) { const sizeValue = style?.background?.backgroundSize || inheritedValue?.background?.backgroundSize; const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat; const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url; const isUploadedImage = style?.background?.backgroundImage?.id; const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition; const attachmentValue = style?.background?.backgroundAttachment || inheritedValue?.background?.backgroundAttachment; /* * Set default values for uploaded images. * The default values are passed by the consumer. * Block-level controls may have different defaults to root-level controls. * A falsy value is treated by default as `auto` (Tile). */ let currentValueForToggle = !sizeValue && isUploadedImage ? defaultValues?.backgroundSize : sizeValue || 'auto'; /* * The incoming value could be a value + unit, e.g. '20px'. * In this case set the value to 'tile'. */ currentValueForToggle = !['cover', 'contain', 'auto'].includes(currentValueForToggle) ? 'auto' : currentValueForToggle; /* * If the current value is `cover` and the repeat value is `undefined`, then * the toggle should be unchecked as the default state. Otherwise, the toggle * should reflect the current repeat value. */ const repeatCheckedValue = !(repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined); const updateBackgroundSize = next => { // When switching to 'contain' toggle the repeat off. let nextRepeat = repeatValue; let nextPosition = positionValue; if (next === 'contain') { nextRepeat = 'no-repeat'; nextPosition = undefined; } if (next === 'cover') { nextRepeat = undefined; nextPosition = undefined; } if ((currentValueForToggle === 'cover' || currentValueForToggle === 'contain') && next === 'auto') { nextRepeat = undefined; /* * A background image uploaded and set in the editor (an image with a record id), * receives a default background position of '50% 0', * when the toggle switches to "Tile". This is to increase the chance that * the image's focus point is visible. * This is in-editor only to assist with the user experience. */ if (!!style?.background?.backgroundImage?.id) { nextPosition = '50% 0'; } } /* * Next will be null when the input is cleared, * in which case the value should be 'auto'. */ if (!next && currentValueForToggle === 'auto') { next = 'auto'; } onChange(setImmutably(style, ['background'], { ...style?.background, backgroundPosition: nextPosition, backgroundRepeat: nextRepeat, backgroundSize: next })); }; const updateBackgroundPosition = next => { onChange(setImmutably(style, ['background', 'backgroundPosition'], coordsToBackgroundPosition(next))); }; const toggleIsRepeated = () => onChange(setImmutably(style, ['background', 'backgroundRepeat'], repeatCheckedValue === true ? 'no-repeat' : 'repeat')); const toggleScrollWithPage = () => onChange(setImmutably(style, ['background', 'backgroundAttachment'], attachmentValue === 'fixed' ? 'scroll' : 'fixed')); // Set a default background position for non-site-wide, uploaded images with a size of 'contain'. const backgroundPositionValue = !positionValue && isUploadedImage && 'contain' === sizeValue ? defaultValues?.backgroundPosition : positionValue; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, className: "single-column", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FocalPointPicker, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Focal point'), url: imageValue, value: backgroundPositionToCoords(backgroundPositionValue), onChange: updateBackgroundPosition }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Fixed background'), checked: attachmentValue === 'fixed', onChange: toggleScrollWithPage }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)('Size'), value: currentValueForToggle, onChange: updateBackgroundSize, isBlock: true, help: backgroundSizeHelpText(sizeValue || defaultValues?.backgroundSize), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "cover", label: (0,external_wp_i18n_namespaceObject._x)('Cover', 'Size option for background image control') }, "cover"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "contain", label: (0,external_wp_i18n_namespaceObject._x)('Contain', 'Size option for background image control') }, "contain"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "auto", label: (0,external_wp_i18n_namespaceObject._x)('Tile', 'Size option for background image control') }, "tile")] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: 2, as: "span", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { "aria-label": (0,external_wp_i18n_namespaceObject.__)('Background image width'), onChange: updateBackgroundSize, value: sizeValue, size: "__unstable-large", __unstableInputWidth: "100px", min: 0, placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto'), disabled: currentValueForToggle !== 'auto' || currentValueForToggle === undefined }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Repeat'), checked: repeatCheckedValue, onChange: toggleIsRepeated, disabled: currentValueForToggle === 'cover' })] })] }); } function BackgroundImagePanel({ value, onChange, inheritedValue = value, settings, defaultValues = {} }) { /* * Resolve any inherited "ref" pointers. * Should the block editor need resolved, inherited values * across all controls, this could be abstracted into a hook, * e.g., useResolveGlobalStyle */ const { globalStyles, _links } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(store); const _settings = getSettings(); return { globalStyles: _settings[globalStylesDataKey], _links: _settings[globalStylesLinksDataKey] }; }, []); const resolvedInheritedValue = (0,external_wp_element_namespaceObject.useMemo)(() => { const resolvedValues = { background: {} }; if (!inheritedValue?.background) { return inheritedValue; } Object.entries(inheritedValue?.background).forEach(([key, backgroundValue]) => { resolvedValues.background[key] = getResolvedValue(backgroundValue, { styles: globalStyles, _links }); }); return resolvedValues; }, [globalStyles, _links, inheritedValue]); const resetBackground = () => onChange(setImmutably(value, ['background'], {})); const { title, url } = value?.background?.backgroundImage || { ...resolvedInheritedValue?.background?.backgroundImage }; const hasImageValue = hasBackgroundImageValue(value) || hasBackgroundImageValue(resolvedInheritedValue); const imageValue = value?.background?.backgroundImage || inheritedValue?.background?.backgroundImage; const shouldShowBackgroundImageControls = hasImageValue && 'none' !== imageValue && (settings?.background?.backgroundSize || settings?.background?.backgroundPosition || settings?.background?.backgroundRepeat); const [isDropDownOpen, setIsDropDownOpen] = (0,external_wp_element_namespaceObject.useState)(false); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('block-editor-global-styles-background-panel__inspector-media-replace-container', { 'is-open': isDropDownOpen }), children: shouldShowBackgroundImageControls ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundControlsPanel, { label: title, filename: title, url: url, onToggle: setIsDropDownOpen, hasImageValue: hasImageValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, className: "single-column", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundImageControls, { onChange: onChange, style: value, inheritedValue: resolvedInheritedValue, displayInPanel: true, onResetImage: () => { setIsDropDownOpen(false); resetBackground(); }, onRemoveImage: () => setIsDropDownOpen(false), defaultValues: defaultValues }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundSizeControls, { onChange: onChange, style: value, defaultValues: defaultValues, inheritedValue: resolvedInheritedValue })] }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundImageControls, { onChange: onChange, style: value, inheritedValue: resolvedInheritedValue, defaultValues: defaultValues, onResetImage: () => { setIsDropDownOpen(false); resetBackground(); }, onRemoveImage: () => setIsDropDownOpen(false) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/background-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const background_panel_DEFAULT_CONTROLS = { backgroundImage: true }; /** * Checks site settings to see if the background panel may be used. * `settings.background.backgroundSize` exists also, * but can only be used if settings?.background?.backgroundImage is `true`. * * @param {Object} settings Site settings * @return {boolean} Whether site settings has activated background panel. */ function useHasBackgroundPanel(settings) { return external_wp_element_namespaceObject.Platform.OS === 'web' && settings?.background?.backgroundImage; } /** * Checks if there is a current value in the background size block support * attributes. Background size values include background size as well * as background position. * * @param {Object} style Style attribute. * @return {boolean} Whether the block has a background size value set. */ function hasBackgroundSizeValue(style) { return style?.background?.backgroundPosition !== undefined || style?.background?.backgroundSize !== undefined; } /** * Checks if there is a current value in the background image block support * attributes. * * @param {Object} style Style attribute. * @return {boolean} Whether the block has a background image value set. */ function hasBackgroundImageValue(style) { return !!style?.background?.backgroundImage?.id || // Supports url() string values in theme.json. 'string' === typeof style?.background?.backgroundImage || !!style?.background?.backgroundImage?.url; } function BackgroundToolsPanel({ resetAllFilter, onChange, value, panelId, children, headerLabel }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: headerLabel, resetAll: resetAll, panelId: panelId, dropdownMenuProps: dropdownMenuProps, children: children }); } function background_panel_BackgroundImagePanel({ as: Wrapper = BackgroundToolsPanel, value, onChange, inheritedValue, settings, panelId, defaultControls = background_panel_DEFAULT_CONTROLS, defaultValues = {}, headerLabel = (0,external_wp_i18n_namespaceObject.__)('Background image') }) { const showBackgroundImageControl = useHasBackgroundPanel(settings); const resetBackground = () => onChange(setImmutably(value, ['background'], {})); const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { return { ...previousValue, background: {} }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, panelId: panelId, headerLabel: headerLabel, children: showBackgroundImageControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => !!value?.background, label: (0,external_wp_i18n_namespaceObject.__)('Image'), onDeselect: resetBackground, isShownByDefault: defaultControls.backgroundImage, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundImagePanel, { value: value, onChange: onChange, settings: settings, inheritedValue: inheritedValue, defaultControls: defaultControls, defaultValues: defaultValues }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/background.js /** * WordPress dependencies */ /** * Internal dependencies */ const BACKGROUND_SUPPORT_KEY = 'background'; // Initial control values. const BACKGROUND_BLOCK_DEFAULT_VALUES = { backgroundSize: 'cover', backgroundPosition: '50% 50%' // used only when backgroundSize is 'contain'. }; /** * Determine whether there is block support for background. * * @param {string} blockName Block name. * @param {string} feature Background image feature to check for. * * @return {boolean} Whether there is support. */ function hasBackgroundSupport(blockName, feature = 'any') { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BACKGROUND_SUPPORT_KEY); if (support === true) { return true; } if (feature === 'any') { return !!support?.backgroundImage || !!support?.backgroundSize || !!support?.backgroundRepeat; } return !!support?.[feature]; } function setBackgroundStyleDefaults(backgroundStyle) { if (!backgroundStyle || !backgroundStyle?.backgroundImage?.url) { return; } let backgroundStylesWithDefaults; // Set block background defaults. if (!backgroundStyle?.backgroundSize) { backgroundStylesWithDefaults = { backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize }; } if ('contain' === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) { backgroundStylesWithDefaults = { backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition }; } return backgroundStylesWithDefaults; } function background_useBlockProps({ name, style }) { if (!hasBackgroundSupport(name) || !style?.background?.backgroundImage) { return; } const backgroundStyles = setBackgroundStyleDefaults(style?.background); if (!backgroundStyles) { return; } return { style: { ...backgroundStyles } }; } /** * Generates a CSS class name if an background image is set. * * @param {Object} style A block's style attribute. * * @return {string} CSS class name. */ function getBackgroundImageClasses(style) { return hasBackgroundImageValue(style) ? 'has-background' : ''; } function BackgroundInspectorControl({ children }) { const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => { return { ...attributes, style: { ...attributes.style, background: undefined } }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "background", resetAllFilter: resetAllFilter, children: children }); } function background_BackgroundImagePanel({ clientId, name, setAttributes, settings }) { const { style, inheritedValue } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockAttributes, getSettings } = select(store); const _settings = getSettings(); return { style: getBlockAttributes(clientId)?.style, /* * To ensure we pass down the right inherited values: * @TODO 1. Pass inherited value down to all block style controls, * See: packages/block-editor/src/hooks/style.js * @TODO 2. Add support for block style variations, * See implementation: packages/block-editor/src/hooks/block-style-variation.js */ inheritedValue: _settings[globalStylesDataKey]?.blocks?.[name] }; }, [clientId, name]); if (!useHasBackgroundPanel(settings) || !hasBackgroundSupport(name, 'backgroundImage')) { return null; } const onChange = newStyle => { setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }; const updatedSettings = { ...settings, background: { ...settings.background, backgroundSize: settings?.background?.backgroundSize && hasBackgroundSupport(name, 'backgroundSize') } }; const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [BACKGROUND_SUPPORT_KEY, 'defaultControls']); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(background_panel_BackgroundImagePanel, { inheritedValue: inheritedValue, as: BackgroundInspectorControl, panelId: clientId, defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES, settings: updatedSettings, onChange: onChange, defaultControls: defaultControls, value: style }); } /* harmony default export */ const background = ({ useBlockProps: background_useBlockProps, attributeKeys: ['style'], hasSupport: hasBackgroundSupport }); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/lock.js /** * WordPress dependencies */ /** * Filters registered block settings, extending attributes to include `lock`. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function lock_addAttribute(settings) { var _settings$attributes$; // Allow blocks to specify their own attribute definition with default values if needed. if ('type' in ((_settings$attributes$ = settings.attributes?.lock) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) { return settings; } // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, lock: { type: 'object' } }; return settings; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/lock/addAttribute', lock_addAttribute); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Regular expression matching invalid anchor characters for replacement. * * @type {RegExp} */ const ANCHOR_REGEX = /[\s#]/g; const ANCHOR_SCHEMA = { type: 'string', source: 'attribute', attribute: 'id', selector: '*' }; /** * Filters registered block settings, extending attributes with anchor using ID * of the first node. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function anchor_addAttribute(settings) { var _settings$attributes$; // Allow blocks to specify their own attribute definition with default values if needed. if ('type' in ((_settings$attributes$ = settings.attributes?.anchor) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) { return settings; } if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'anchor')) { // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, anchor: ANCHOR_SCHEMA }; } return settings; } function BlockEditAnchorControlPure({ anchor, setAttributes }) { const blockEditingMode = useBlockEditingMode(); if (blockEditingMode !== 'default') { return null; } const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "advanced", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, className: "html-anchor-control", label: (0,external_wp_i18n_namespaceObject.__)('HTML anchor'), help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [(0,external_wp_i18n_namespaceObject.__)('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor”. Then, you’ll be able to link directly to this section of your page.'), isWeb && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-jumps/'), children: (0,external_wp_i18n_namespaceObject.__)('Learn more about anchors') })] })] }), value: anchor || '', placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)('Add an anchor') : null, onChange: nextValue => { nextValue = nextValue.replace(ANCHOR_REGEX, '-'); setAttributes({ anchor: nextValue }); }, autoCapitalize: "none", autoComplete: "off" }) }); } /* harmony default export */ const hooks_anchor = ({ addSaveProps, edit: BlockEditAnchorControlPure, attributeKeys: ['anchor'], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'anchor'); } }); /** * Override props assigned to save component to inject anchor ID, if block * supports anchor. This is only applied if the block's save result is an * element and not a markup string. * * @param {Object} extraProps Additional props applied to save element. * @param {Object} blockType Block type. * @param {Object} attributes Current block attributes. * * @return {Object} Filtered props applied to save element. */ function addSaveProps(extraProps, blockType, attributes) { if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'anchor')) { extraProps.id = attributes.anchor === '' ? null : attributes.anchor; } return extraProps; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/anchor/attribute', anchor_addAttribute); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/aria-label.js /** * WordPress dependencies */ /** * Filters registered block settings, extending attributes with ariaLabel using aria-label * of the first node. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function aria_label_addAttribute(settings) { // Allow blocks to specify their own attribute definition with default values if needed. if (settings?.attributes?.ariaLabel?.type) { return settings; } if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'ariaLabel')) { // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, ariaLabel: { type: 'string' } }; } return settings; } /** * Override props assigned to save component to inject aria-label, if block * supports ariaLabel. This is only applied if the block's save result is an * element and not a markup string. * * @param {Object} extraProps Additional props applied to save element. * @param {Object} blockType Block type. * @param {Object} attributes Current block attributes. * * @return {Object} Filtered props applied to save element. */ function aria_label_addSaveProps(extraProps, blockType, attributes) { if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'ariaLabel')) { extraProps['aria-label'] = attributes.ariaLabel === '' ? null : attributes.ariaLabel; } return extraProps; } /* harmony default export */ const aria_label = ({ addSaveProps: aria_label_addSaveProps, attributeKeys: ['ariaLabel'], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'ariaLabel'); } }); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/ariaLabel/attribute', aria_label_addAttribute); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Filters registered block settings, extending attributes to include `className`. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function custom_class_name_addAttribute(settings) { if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'customClassName', true)) { // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, className: { type: 'string' } }; } return settings; } function CustomClassNameControlsPure({ className, setAttributes }) { const blockEditingMode = useBlockEditingMode(); if (blockEditingMode !== 'default') { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "advanced", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, autoComplete: "off", label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS class(es)'), value: className || '', onChange: nextValue => { setAttributes({ className: nextValue !== '' ? nextValue : undefined }); }, help: (0,external_wp_i18n_namespaceObject.__)('Separate multiple classes with spaces.') }) }); } /* harmony default export */ const custom_class_name = ({ edit: CustomClassNameControlsPure, addSaveProps: custom_class_name_addSaveProps, attributeKeys: ['className'], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'customClassName', true); } }); /** * Override props assigned to save component to inject the className, if block * supports customClassName. This is only applied if the block's save result is an * element and not a markup string. * * @param {Object} extraProps Additional props applied to save element. * @param {Object} blockType Block type. * @param {Object} attributes Current block attributes. * * @return {Object} Filtered props applied to save element. */ function custom_class_name_addSaveProps(extraProps, blockType, attributes) { if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'customClassName', true) && attributes.className) { extraProps.className = dist_clsx(extraProps.className, attributes.className); } return extraProps; } function addTransforms(result, source, index, results) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, 'customClassName', true)) { return result; } // If the condition verifies we are probably in the presence of a wrapping transform // e.g: nesting paragraphs in a group or columns and in that case the class should not be kept. if (results.length === 1 && result.innerBlocks.length === source.length) { return result; } // If we are transforming one block to multiple blocks or multiple blocks to one block, // we ignore the class during the transform. if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) { return result; } // If we are in presence of transform between one or more block in the source // that have one or more blocks in the result // we apply the class on source N to the result N, // if source N does not exists we do nothing. if (source[index]) { const originClassName = source[index]?.attributes.className; // Avoid overriding classes if the transformed block already includes them. if (originClassName && result.attributes.className === undefined) { return { ...result, attributes: { ...result.attributes, className: originClassName } }; } } return result; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-class-name/attribute', custom_class_name_addAttribute); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/color/addTransforms', addTransforms); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/generated-class-name.js /** * WordPress dependencies */ /** * Override props assigned to save component to inject generated className if * block supports it. This is only applied if the block's save result is an * element and not a markup string. * * @param {Object} extraProps Additional props applied to save element. * @param {Object} blockType Block type. * * @return {Object} Filtered props applied to save element. */ function addGeneratedClassName(extraProps, blockType) { // Adding the generated className. if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'className', true)) { if (typeof extraProps.className === 'string') { // We have some extra classes and want to add the default classname // We use uniq to prevent duplicate classnames. extraProps.className = [...new Set([(0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name), ...extraProps.className.split(' ')])].join(' ').trim(); } else { // There is no string in the className variable, // so we just dump the default name in there. extraProps.className = (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name); } } return extraProps; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName); ;// ./node_modules/colord/index.mjs var colord_r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(colord_r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},colord_j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; ;// ./node_modules/colord/plugins/names.mjs /* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])} ;// ./node_modules/colord/plugins/a11y.mjs var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} ;// ./node_modules/@wordpress/block-editor/build-module/components/colors/utils.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ k([names, a11y]); const { kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); /** * Provided an array of color objects as set by the theme or by the editor defaults, * and the values of the defined color or custom color returns a color object describing the color. * * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. * @param {?string} definedColor A string containing the color slug. * @param {?string} customColor A string containing the customColor value. * * @return {?Object} If definedColor is passed and the name is found in colors, * the color object exactly as set by the theme or editor defaults is returned. * Otherwise, an object that just sets the color is defined. */ const getColorObjectByAttributeValues = (colors, definedColor, customColor) => { if (definedColor) { const colorObj = colors?.find(color => color.slug === definedColor); if (colorObj) { return colorObj; } } return { color: customColor }; }; /** * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined. * * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. * @param {?string} colorValue A string containing the color value. * * @return {?Object} Color object included in the colors array whose color property equals colorValue. * Returns undefined if no color object matches this requirement. */ const getColorObjectByColorValue = (colors, colorValue) => { return colors?.find(color => color.color === colorValue); }; /** * Returns a class based on the context a color is being used and its slug. * * @param {string} colorContextName Context/place where color is being used e.g: background, text etc... * @param {string} colorSlug Slug of the color. * * @return {?string} String with the class corresponding to the color in the provided context. * Returns undefined if either colorContextName or colorSlug are not provided. */ function getColorClassName(colorContextName, colorSlug) { if (!colorContextName || !colorSlug) { return undefined; } return `has-${kebabCase(colorSlug)}-${colorContextName}`; } /** * Given an array of color objects and a color value returns the color value of the most readable color in the array. * * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. * @param {?string} colorValue A string containing the color value. * * @return {string} String with the color value of the most readable color. */ function getMostReadableColor(colors, colorValue) { const colordColor = w(colorValue); const getColorContrast = ({ color }) => colordColor.contrast(color); const maxContrast = Math.max(...colors.map(getColorContrast)); return colors.find(color => getColorContrast(color) === maxContrast).color; } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Retrieves color and gradient related settings. * * The arrays for colors and gradients are made up of color palettes from each * origin i.e. "Core", "Theme", and "User". * * @return {Object} Color and gradient related settings. */ function useMultipleOriginColorsAndGradients() { const [enableCustomColors, customColors, themeColors, defaultColors, shouldDisplayDefaultColors, enableCustomGradients, customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients] = use_settings_useSettings('color.custom', 'color.palette.custom', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.customGradient', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients'); const colorGradientSettings = { disableCustomColors: !enableCustomColors, disableCustomGradients: !enableCustomGradients }; colorGradientSettings.colors = (0,external_wp_element_namespaceObject.useMemo)(() => { const result = []; if (themeColors && themeColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), slug: 'theme', colors: themeColors }); } if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), slug: 'default', colors: defaultColors }); } if (customColors && customColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), slug: 'custom', colors: customColors }); } return result; }, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]); colorGradientSettings.gradients = (0,external_wp_element_namespaceObject.useMemo)(() => { const result = []; if (themeGradients && themeGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), slug: 'theme', gradients: themeGradients }); } if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), slug: 'default', gradients: defaultGradients }); } if (customGradients && customGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), slug: 'custom', gradients: customGradients }); } return result; }, [customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients]); colorGradientSettings.hasColorsOrGradients = !!colorGradientSettings.colors.length || !!colorGradientSettings.gradients.length; return colorGradientSettings; } ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/utils.js /** * WordPress dependencies */ /** * Gets the (non-undefined) item with the highest occurrence within an array * Based in part on: https://stackoverflow.com/a/20762713 * * Undefined values are always sorted to the end by `sort`, so this function * returns the first element, to always prioritize real values over undefined * values. * * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description * * @param {Array<any>} inputArray Array of items to check. * @return {any} The item with the most occurrences. */ function mode(inputArray) { const arr = [...inputArray]; return arr.sort((a, b) => inputArray.filter(v => v === b).length - inputArray.filter(v => v === a).length).shift(); } /** * Returns the most common CSS unit from the current CSS unit selections. * * - If a single flat border radius is set, its unit will be used * - If individual corner selections, the most common of those will be used * - Failing any unit selections a default of 'px' is returned. * * @param {Object} selectedUnits Unit selections for flat radius & each corner. * @return {string} Most common CSS unit from current selections. Default: `px`. */ function getAllUnit(selectedUnits = {}) { const { flat, ...cornerUnits } = selectedUnits; return flat || mode(Object.values(cornerUnits).filter(Boolean)) || 'px'; } /** * Gets the 'all' input value and unit from values data. * * @param {Object|string} values Radius values. * @return {string} A value + unit for the 'all' input. */ function getAllValue(values = {}) { /** * Border radius support was originally a single pixel value. * * To maintain backwards compatibility treat this case as the all value. */ if (typeof values === 'string') { return values; } const parsedQuantitiesAndUnits = Object.values(values).map(value => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value)); const allValues = parsedQuantitiesAndUnits.map(value => { var _value$; return (_value$ = value[0]) !== null && _value$ !== void 0 ? _value$ : ''; }); const allUnits = parsedQuantitiesAndUnits.map(value => value[1]); const value = allValues.every(v => v === allValues[0]) ? allValues[0] : ''; const unit = mode(allUnits); const allValue = value === 0 || value ? `${value}${unit}` : undefined; return allValue; } /** * Checks to determine if values are mixed. * * @param {Object} values Radius values. * @return {boolean} Whether values are mixed. */ function hasMixedValues(values = {}) { const allValue = getAllValue(values); const isMixed = typeof values === 'string' ? false : isNaN(parseFloat(allValue)); return isMixed; } /** * Checks to determine if values are defined. * * @param {Object} values Radius values. * @return {boolean} Whether values are mixed. */ function hasDefinedValues(values) { if (!values) { return false; } // A string value represents a shorthand value. if (typeof values === 'string') { return true; } // An object represents longhand border radius values, if any are set // flag values as being defined. const filteredValues = Object.values(values).filter(value => { return !!value || value === 0; }); return !!filteredValues.length; } ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/all-input-control.js /** * WordPress dependencies */ /** * Internal dependencies */ function AllInputControl({ onChange, selectedUnits, setSelectedUnits, values, ...props }) { let allValue = getAllValue(values); if (allValue === undefined) { // If we don't have any value set the unit to any current selection // or the most common unit from the individual radii values. allValue = getAllUnit(selectedUnits); } const hasValues = hasDefinedValues(values); const isMixed = hasValues && hasMixedValues(values); const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : null; // Filter out CSS-unit-only values to prevent invalid styles. const handleOnChange = next => { const isNumeric = !isNaN(parseFloat(next)); const nextValue = isNumeric ? next : undefined; onChange(nextValue); }; // Store current unit selection for use as fallback for individual // radii controls. const handleOnUnitChange = unit => { setSelectedUnits({ topLeft: unit, topRight: unit, bottomLeft: unit, bottomRight: unit }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { ...props, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Border radius'), disableUnits: isMixed, isOnly: true, value: allValue, onChange: handleOnChange, onUnitChange: handleOnUnitChange, placeholder: allPlaceholder, size: "__unstable-large" }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/input-controls.js /** * WordPress dependencies */ const CORNERS = { topLeft: (0,external_wp_i18n_namespaceObject.__)('Top left'), topRight: (0,external_wp_i18n_namespaceObject.__)('Top right'), bottomLeft: (0,external_wp_i18n_namespaceObject.__)('Bottom left'), bottomRight: (0,external_wp_i18n_namespaceObject.__)('Bottom right') }; function BoxInputControls({ onChange, selectedUnits, setSelectedUnits, values: valuesProp, ...props }) { const createHandleOnChange = corner => next => { if (!onChange) { return; } // Filter out CSS-unit-only values to prevent invalid styles. const isNumeric = !isNaN(parseFloat(next)); const nextValue = isNumeric ? next : undefined; onChange({ ...values, [corner]: nextValue }); }; const createHandleOnUnitChange = side => next => { const newUnits = { ...selectedUnits }; newUnits[side] = next; setSelectedUnits(newUnits); }; // For shorthand style & backwards compatibility, handle flat string value. const values = typeof valuesProp !== 'string' ? valuesProp : { topLeft: valuesProp, topRight: valuesProp, bottomLeft: valuesProp, bottomRight: valuesProp }; // Controls are wrapped in tooltips as visible labels aren't desired here. // Tooltip rendering also requires the UnitControl to be wrapped. See: // https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-border-radius-control__input-controls-wrapper", children: Object.entries(CORNERS).map(([corner, label]) => { const [parsedQuantity, parsedUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values[corner]); const computedUnit = values[corner] ? parsedUnit : selectedUnits[corner] || selectedUnits.flat; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: label, placement: "top", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-border-radius-control__tooltip-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { ...props, "aria-label": label, value: [parsedQuantity, computedUnit].join(''), onChange: createHandleOnChange(corner), onUnitChange: createHandleOnUnitChange(corner), size: "__unstable-large" }) }) }, corner); }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/link.js /** * WordPress dependencies */ const link_link = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); /* harmony default export */ const library_link = (link_link); ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/linked-button.js /** * WordPress dependencies */ function LinkedButton({ isLinked, ...props }) { const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink radii') : (0,external_wp_i18n_namespaceObject.__)('Link radii'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, className: "component-border-radius-control__linked-button", size: "small", icon: isLinked ? library_link : link_off, iconSize: 24, label: label }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const border_radius_control_DEFAULT_VALUES = { topLeft: undefined, topRight: undefined, bottomLeft: undefined, bottomRight: undefined }; const MIN_BORDER_RADIUS_VALUE = 0; const MAX_BORDER_RADIUS_VALUES = { px: 100, em: 20, rem: 20 }; /** * Control to display border radius options. * * @param {Object} props Component props. * @param {Function} props.onChange Callback to handle onChange. * @param {Object} props.values Border radius values. * * @return {Element} Custom border radius control. */ function BorderRadiusControl({ onChange, values }) { const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!hasDefinedValues(values) || !hasMixedValues(values)); // Tracking selected units via internal state allows filtering of CSS unit // only values from being saved while maintaining preexisting unit selection // behaviour. Filtering CSS unit only values prevents invalid style values. const [selectedUnits, setSelectedUnits] = (0,external_wp_element_namespaceObject.useState)({ flat: typeof values === 'string' ? (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values)[1] : undefined, topLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topLeft)[1], topRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topRight)[1], bottomLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.bottomLeft)[1], bottomRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.bottomRight)[1] }); const [availableUnits] = use_settings_useSettings('spacing.units'); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ['px', 'em', 'rem'] }); const unit = getAllUnit(selectedUnits); const unitConfig = units && units.find(item => item.value === unit); const step = unitConfig?.step || 1; const [allValue] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(getAllValue(values)); const toggleLinked = () => setIsLinked(!isLinked); const handleSliderChange = next => { onChange(next !== undefined ? `${next}${unit}` : undefined); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "components-border-radius-control", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Radius') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-border-radius-control__wrapper", children: [isLinked ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AllInputControl, { className: "components-border-radius-control__unit-control", values: values, min: MIN_BORDER_RADIUS_VALUE, onChange: onChange, selectedUnits: selectedUnits, setSelectedUnits: setSelectedUnits, units: units }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Border radius'), hideLabelFromVision: true, className: "components-border-radius-control__range-control", value: allValue !== null && allValue !== void 0 ? allValue : '', min: MIN_BORDER_RADIUS_VALUE, max: MAX_BORDER_RADIUS_VALUES[unit], initialPosition: 0, withInputField: false, onChange: handleSliderChange, step: step, __nextHasNoMarginBottom: true })] }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BoxInputControls, { min: MIN_BORDER_RADIUS_VALUE, onChange: onChange, selectedUnits: selectedUnits, setSelectedUnits: setSelectedUnits, values: values || border_radius_control_DEFAULT_VALUES, units: units }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkedButton, { onClick: toggleLinked, isLinked: isLinked })] })] }); } ;// ./node_modules/@wordpress/icons/build-module/library/check.js /** * WordPress dependencies */ const check_check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" }) }); /* harmony default export */ const library_check = (check_check); ;// ./node_modules/@wordpress/icons/build-module/library/shadow.js /** * WordPress dependencies */ const shadow = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" }) }); /* harmony default export */ const library_shadow = (shadow); ;// ./node_modules/@wordpress/icons/build-module/library/reset.js /** * WordPress dependencies */ const reset_reset = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 11.5h10V13H7z" }) }); /* harmony default export */ const library_reset = (reset_reset); ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/shadow-panel-components.js /** * WordPress dependencies */ /** * External dependencies */ /** * Shared reference to an empty array for cases where it is important to avoid * returning a new array reference on every invocation. * * @type {Array} */ const shadow_panel_components_EMPTY_ARRAY = []; function ShadowPopoverContainer({ shadow, onShadowChange, settings }) { const shadows = useShadowPresets(settings); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-global-styles__shadow-popover-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 5, children: (0,external_wp_i18n_namespaceObject.__)('Drop shadow') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPresets, { presets: shadows, activeShadow: shadow, onSelect: onShadowChange }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-global-styles__clear-shadow", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => onShadowChange(undefined), disabled: !shadow, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)('Clear') }) })] }) }); } function ShadowPresets({ presets, activeShadow, onSelect }) { return !presets ? null : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { role: "listbox", className: "block-editor-global-styles__shadow__list", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drop shadows'), children: presets.map(({ name, slug, shadow }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowIndicator, { label: name, isActive: shadow === activeShadow, type: slug === 'unset' ? 'unset' : 'preset', onSelect: () => onSelect(shadow === activeShadow ? undefined : shadow), shadow: shadow }, slug)) }); } function ShadowIndicator({ type, label, isActive, onSelect, shadow }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: label, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { role: "option", "aria-label": label, "aria-selected": isActive, className: dist_clsx('block-editor-global-styles__shadow__item', { 'is-active': isActive }), render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { className: dist_clsx('block-editor-global-styles__shadow-indicator', { unset: type === 'unset' }), onClick: onSelect, style: { boxShadow: shadow }, "aria-label": label, children: isActive && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_check }) }) }) }); } function ShadowPopover({ shadow, onShadowChange, settings }) { const popoverProps = { placement: 'left-start', offset: 36, shift: true }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, className: "block-editor-global-styles__shadow-dropdown", renderToggle: renderShadowToggle(shadow, onShadowChange), renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPopoverContainer, { shadow: shadow, onShadowChange: onShadowChange, settings: settings }) }) }); } function renderShadowToggle(shadow, onShadowChange) { return ({ onToggle, isOpen }) => { const shadowButtonRef = (0,external_wp_element_namespaceObject.useRef)(undefined); const toggleProps = { onClick: onToggle, className: dist_clsx({ 'is-open': isOpen }), 'aria-expanded': isOpen, ref: shadowButtonRef }; const removeButtonProps = { onClick: () => { if (isOpen) { onToggle(); } onShadowChange(undefined); // Return focus to parent button. shadowButtonRef.current?.focus(); }, className: dist_clsx('block-editor-global-styles__shadow-editor__remove-button', { 'is-open': isOpen }), label: (0,external_wp_i18n_namespaceObject.__)('Remove') }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { className: "block-editor-global-styles__toggle-icon", icon: library_shadow, size: 24 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)('Drop shadow') })] }) }), !!shadow && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, size: "small", icon: library_reset, ...removeButtonProps })] }); }; } function useShadowPresets(settings) { return (0,external_wp_element_namespaceObject.useMemo)(() => { var _settings$shadow$pres; if (!settings?.shadow) { return shadow_panel_components_EMPTY_ARRAY; } const defaultPresetsEnabled = settings?.shadow?.defaultPresets; const { default: defaultShadows, theme: themeShadows, custom: customShadows } = (_settings$shadow$pres = settings?.shadow?.presets) !== null && _settings$shadow$pres !== void 0 ? _settings$shadow$pres : {}; const unsetShadow = { name: (0,external_wp_i18n_namespaceObject.__)('Unset'), slug: 'unset', shadow: 'none' }; const shadowPresets = [...(defaultPresetsEnabled && defaultShadows || shadow_panel_components_EMPTY_ARRAY), ...(themeShadows || shadow_panel_components_EMPTY_ARRAY), ...(customShadows || shadow_panel_components_EMPTY_ARRAY)]; if (shadowPresets.length) { shadowPresets.unshift(unsetShadow); } return shadowPresets; }, [settings]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/border-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function useHasBorderPanel(settings) { const controls = Object.values(useHasBorderPanelControls(settings)); return controls.some(Boolean); } function useHasBorderPanelControls(settings) { const controls = { hasBorderColor: useHasBorderColorControl(settings), hasBorderRadius: useHasBorderRadiusControl(settings), hasBorderStyle: useHasBorderStyleControl(settings), hasBorderWidth: useHasBorderWidthControl(settings), hasShadow: useHasShadowControl(settings) }; return controls; } function useHasBorderColorControl(settings) { return settings?.border?.color; } function useHasBorderRadiusControl(settings) { return settings?.border?.radius; } function useHasBorderStyleControl(settings) { return settings?.border?.style; } function useHasBorderWidthControl(settings) { return settings?.border?.width; } function useHasShadowControl(settings) { const shadows = useShadowPresets(settings); return !!settings?.shadow && shadows.length > 0; } function BorderToolsPanel({ resetAllFilter, onChange, value, panelId, children, label }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: label, resetAll: resetAll, panelId: panelId, dropdownMenuProps: dropdownMenuProps, children: children }); } const border_panel_DEFAULT_CONTROLS = { radius: true, color: true, width: true, shadow: true }; function BorderPanel({ as: Wrapper = BorderToolsPanel, value, onChange, inheritedValue = value, settings, panelId, name, defaultControls = border_panel_DEFAULT_CONTROLS }) { var _settings$shadow$pres, _ref, _ref2, _shadowPresets$custom; const colors = useColorsPerOrigin(settings); const decodeValue = (0,external_wp_element_namespaceObject.useCallback)(rawValue => getValueFromVariable({ settings }, '', rawValue), [settings]); const encodeColorValue = colorValue => { const allColors = colors.flatMap(({ colors: originColors }) => originColors); const colorObject = allColors.find(({ color }) => color === colorValue); return colorObject ? 'var:preset|color|' + colorObject.slug : colorValue; }; const border = (0,external_wp_element_namespaceObject.useMemo)(() => { if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(inheritedValue?.border)) { const borderValue = { ...inheritedValue?.border }; ['top', 'right', 'bottom', 'left'].forEach(side => { borderValue[side] = { ...borderValue[side], color: decodeValue(borderValue[side]?.color) }; }); return borderValue; } return { ...inheritedValue?.border, color: inheritedValue?.border?.color ? decodeValue(inheritedValue?.border?.color) : undefined }; }, [inheritedValue?.border, decodeValue]); const setBorder = newBorder => onChange({ ...value, border: newBorder }); const showBorderColor = useHasBorderColorControl(settings); const showBorderStyle = useHasBorderStyleControl(settings); const showBorderWidth = useHasBorderWidthControl(settings); // Border radius. const showBorderRadius = useHasBorderRadiusControl(settings); const borderRadiusValues = decodeValue(border?.radius); const setBorderRadius = newBorderRadius => setBorder({ ...border, radius: newBorderRadius }); const hasBorderRadius = () => { const borderValues = value?.border?.radius; if (typeof borderValues === 'object') { return Object.entries(borderValues).some(Boolean); } return !!borderValues; }; const hasShadowControl = useHasShadowControl(settings); // Shadow const shadow = decodeValue(inheritedValue?.shadow); const shadowPresets = (_settings$shadow$pres = settings?.shadow?.presets) !== null && _settings$shadow$pres !== void 0 ? _settings$shadow$pres : {}; const mergedShadowPresets = (_ref = (_ref2 = (_shadowPresets$custom = shadowPresets.custom) !== null && _shadowPresets$custom !== void 0 ? _shadowPresets$custom : shadowPresets.theme) !== null && _ref2 !== void 0 ? _ref2 : shadowPresets.default) !== null && _ref !== void 0 ? _ref : []; const setShadow = newValue => { const slug = mergedShadowPresets?.find(({ shadow: shadowName }) => shadowName === newValue)?.slug; onChange(setImmutably(value, ['shadow'], slug ? `var:preset|shadow|${slug}` : newValue || undefined)); }; const hasShadow = () => !!value?.shadow; const resetShadow = () => setShadow(undefined); const resetBorder = () => { if (hasBorderRadius()) { return setBorder({ radius: value?.border?.radius }); } setBorder(undefined); }; const onBorderChange = newBorder => { // Ensure we have a visible border style when a border width or // color is being selected. const updatedBorder = { ...newBorder }; if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(updatedBorder)) { ['top', 'right', 'bottom', 'left'].forEach(side => { if (updatedBorder[side]) { updatedBorder[side] = { ...updatedBorder[side], color: encodeColorValue(updatedBorder[side]?.color) }; } }); } else if (updatedBorder) { updatedBorder.color = encodeColorValue(updatedBorder.color); } // As radius is maintained separately to color, style, and width // maintain its value. Undefined values here will be cleaned when // global styles are saved. setBorder({ radius: border?.radius, ...updatedBorder }); }; const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { return { ...previousValue, border: undefined, shadow: undefined }; }, []); const showBorderByDefault = defaultControls?.color || defaultControls?.width; const hasBorderControl = showBorderColor || showBorderStyle || showBorderWidth || showBorderRadius; const label = useBorderPanelLabel({ blockName: name, hasShadowControl, hasBorderControl }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, panelId: panelId, label: label, children: [(showBorderWidth || showBorderColor) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => (0,external_wp_components_namespaceObject.__experimentalIsDefinedBorder)(value?.border), label: (0,external_wp_i18n_namespaceObject.__)('Border'), onDeselect: () => resetBorder(), isShownByDefault: showBorderByDefault, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BorderBoxControl, { colors: colors, enableAlpha: true, enableStyle: showBorderStyle, onChange: onBorderChange, popoverOffset: 40, popoverPlacement: "left-start", value: border, __experimentalIsRenderedInSidebar: true, size: "__unstable-large", hideLabelFromVision: !hasShadowControl, label: (0,external_wp_i18n_namespaceObject.__)('Border') }) }), showBorderRadius && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasBorderRadius, label: (0,external_wp_i18n_namespaceObject.__)('Radius'), onDeselect: () => setBorderRadius(undefined), isShownByDefault: defaultControls.radius, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BorderRadiusControl, { values: borderRadiusValues, onChange: newValue => { setBorderRadius(newValue || undefined); } }) }), hasShadowControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Shadow'), hasValue: hasShadow, onDeselect: resetShadow, isShownByDefault: defaultControls.shadow, panelId: panelId, children: [hasBorderControl ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Shadow') }) : null, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPopover, { shadow: shadow, onShadowChange: setShadow, settings: settings }) })] })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/border.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const BORDER_SUPPORT_KEY = '__experimentalBorder'; const SHADOW_SUPPORT_KEY = 'shadow'; const getColorByProperty = (colors, property, value) => { let matchedColor; colors.some(origin => origin.colors.some(color => { if (color[property] === value) { matchedColor = color; return true; } return false; })); return matchedColor; }; const getMultiOriginColor = ({ colors, namedColor, customColor }) => { // Search each origin (default, theme, or user) for matching color by name. if (namedColor) { const colorObject = getColorByProperty(colors, 'slug', namedColor); if (colorObject) { return colorObject; } } // Skip if no custom color or matching named color. if (!customColor) { return { color: undefined }; } // Attempt to find color via custom color value or build new object. const colorObject = getColorByProperty(colors, 'color', customColor); return colorObject ? colorObject : { color: customColor }; }; function getColorSlugFromVariable(value) { const namedColor = /var:preset\|color\|(.+)/.exec(value); if (namedColor && namedColor[1]) { return namedColor[1]; } return null; } function styleToAttributes(style) { if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(style?.border)) { return { style, borderColor: undefined }; } const borderColorValue = style?.border?.color; const borderColorSlug = borderColorValue?.startsWith('var:preset|color|') ? borderColorValue.substring('var:preset|color|'.length) : undefined; const updatedStyle = { ...style }; updatedStyle.border = { ...updatedStyle.border, color: borderColorSlug ? undefined : borderColorValue }; return { style: utils_cleanEmptyObject(updatedStyle), borderColor: borderColorSlug }; } function attributesToStyle(attributes) { if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(attributes.style?.border)) { return attributes.style; } return { ...attributes.style, border: { ...attributes.style?.border, color: attributes.borderColor ? 'var:preset|color|' + attributes.borderColor : attributes.style?.border?.color } }; } function BordersInspectorControl({ label, children, resetAllFilter }) { const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => { const existingStyle = attributesToStyle(attributes); const updatedStyle = resetAllFilter(existingStyle); return { ...attributes, ...styleToAttributes(updatedStyle) }; }, [resetAllFilter]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "border", resetAllFilter: attributesResetAllFilter, label: label, children: children }); } function border_BorderPanel({ clientId, name, setAttributes, settings }) { const isEnabled = useHasBorderPanel(settings); function selector(select) { const { style, borderColor } = select(store).getBlockAttributes(clientId) || {}; return { style, borderColor }; } const { style, borderColor } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]); const value = (0,external_wp_element_namespaceObject.useMemo)(() => { return attributesToStyle({ style, borderColor }); }, [style, borderColor]); const onChange = newStyle => { setAttributes(styleToAttributes(newStyle)); }; if (!isEnabled) { return null; } const defaultControls = { ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [BORDER_SUPPORT_KEY, '__experimentalDefaultControls']), ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [SHADOW_SUPPORT_KEY, '__experimentalDefaultControls']) }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BorderPanel, { as: BordersInspectorControl, panelId: clientId, settings: settings, value: value, onChange: onChange, defaultControls: defaultControls }); } /** * Determine whether there is block support for border properties. * * @param {string} blockName Block name. * @param {string} feature Border feature to check support for. * * @return {boolean} Whether there is support. */ function hasBorderSupport(blockName, feature = 'any') { if (external_wp_element_namespaceObject.Platform.OS !== 'web') { return false; } const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BORDER_SUPPORT_KEY); if (support === true) { return true; } if (feature === 'any') { return !!(support?.color || support?.radius || support?.width || support?.style); } return !!support?.[feature]; } /** * Determine whether there is block support for shadow properties. * * @param {string} blockName Block name. * * @return {boolean} Whether there is support. */ function hasShadowSupport(blockName) { return hasBlockSupport(blockName, SHADOW_SUPPORT_KEY); } function useBorderPanelLabel({ blockName, hasBorderControl, hasShadowControl } = {}) { const settings = useBlockSettings(blockName); const controls = useHasBorderPanelControls(settings); if (!hasBorderControl && !hasShadowControl && blockName) { hasBorderControl = controls?.hasBorderColor || controls?.hasBorderStyle || controls?.hasBorderWidth || controls?.hasBorderRadius; hasShadowControl = controls?.hasShadow; } if (hasBorderControl && hasShadowControl) { return (0,external_wp_i18n_namespaceObject.__)('Border & Shadow'); } if (hasShadowControl) { return (0,external_wp_i18n_namespaceObject.__)('Shadow'); } return (0,external_wp_i18n_namespaceObject.__)('Border'); } /** * Returns a new style object where the specified border attribute has been * removed. * * @param {Object} style Styles from block attributes. * @param {string} attribute The border style attribute to clear. * * @return {Object} Style object with the specified attribute removed. */ function removeBorderAttribute(style, attribute) { return cleanEmptyObject({ ...style, border: { ...style?.border, [attribute]: undefined } }); } /** * Filters registered block settings, extending attributes to include * `borderColor` if needed. * * @param {Object} settings Original block settings. * * @return {Object} Updated block settings. */ function addAttributes(settings) { if (!hasBorderSupport(settings, 'color')) { return settings; } // Allow blocks to specify default value if needed. if (settings.attributes.borderColor) { return settings; } // Add new borderColor attribute to block settings. return { ...settings, attributes: { ...settings.attributes, borderColor: { type: 'string' } } }; } /** * Override props assigned to save component to inject border color. * * @param {Object} props Additional props applied to save element. * @param {Object|string} blockNameOrType Block type definition. * @param {Object} attributes Block's attributes. * * @return {Object} Filtered props to apply to save element. */ function border_addSaveProps(props, blockNameOrType, attributes) { if (!hasBorderSupport(blockNameOrType, 'color') || shouldSkipSerialization(blockNameOrType, BORDER_SUPPORT_KEY, 'color')) { return props; } const borderClasses = getBorderClasses(attributes); const newClassName = dist_clsx(props.className, borderClasses); // If we are clearing the last of the previous classes in `className` // set it to `undefined` to avoid rendering empty DOM attributes. props.className = newClassName ? newClassName : undefined; return props; } /** * Generates a CSS class name consisting of all the applicable border color * classes given the current block attributes. * * @param {Object} attributes Block's attributes. * * @return {string} CSS class name. */ function getBorderClasses(attributes) { const { borderColor, style } = attributes; const borderColorClass = getColorClassName('border-color', borderColor); return dist_clsx({ 'has-border-color': borderColor || style?.border?.color, [borderColorClass]: !!borderColorClass }); } function border_useBlockProps({ name, borderColor, style }) { const { colors } = useMultipleOriginColorsAndGradients(); if (!hasBorderSupport(name, 'color') || shouldSkipSerialization(name, BORDER_SUPPORT_KEY, 'color')) { return {}; } const { color: borderColorValue } = getMultiOriginColor({ colors, namedColor: borderColor }); const { color: borderTopColor } = getMultiOriginColor({ colors, namedColor: getColorSlugFromVariable(style?.border?.top?.color) }); const { color: borderRightColor } = getMultiOriginColor({ colors, namedColor: getColorSlugFromVariable(style?.border?.right?.color) }); const { color: borderBottomColor } = getMultiOriginColor({ colors, namedColor: getColorSlugFromVariable(style?.border?.bottom?.color) }); const { color: borderLeftColor } = getMultiOriginColor({ colors, namedColor: getColorSlugFromVariable(style?.border?.left?.color) }); const extraStyles = { borderTopColor: borderTopColor || borderColorValue, borderRightColor: borderRightColor || borderColorValue, borderBottomColor: borderBottomColor || borderColorValue, borderLeftColor: borderLeftColor || borderColorValue }; return border_addSaveProps({ style: utils_cleanEmptyObject(extraStyles) || {} }, name, { borderColor, style }); } /* harmony default export */ const border = ({ useBlockProps: border_useBlockProps, addSaveProps: border_addSaveProps, attributeKeys: ['borderColor', 'style'], hasSupport(name) { return hasBorderSupport(name, 'color'); } }); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/border/addAttributes', addAttributes); ;// ./node_modules/@wordpress/block-editor/build-module/components/gradients/use-gradient.js /** * WordPress dependencies */ /** * Internal dependencies */ function __experimentalGetGradientClass(gradientSlug) { if (!gradientSlug) { return undefined; } return `has-${gradientSlug}-gradient-background`; } /** * Retrieves the gradient value per slug. * * @param {Array} gradients Gradient Palette * @param {string} slug Gradient slug * * @return {string} Gradient value. */ function getGradientValueBySlug(gradients, slug) { const gradient = gradients?.find(g => g.slug === slug); return gradient && gradient.gradient; } function __experimentalGetGradientObjectByGradientValue(gradients, value) { const gradient = gradients?.find(g => g.gradient === value); return gradient; } /** * Retrieves the gradient slug per slug. * * @param {Array} gradients Gradient Palette * @param {string} value Gradient value * @return {string} Gradient slug. */ function getGradientSlugByValue(gradients, value) { const gradient = __experimentalGetGradientObjectByGradientValue(gradients, value); return gradient && gradient.slug; } function __experimentalUseGradient({ gradientAttribute = 'gradient', customGradientAttribute = 'customGradient' } = {}) { const { clientId } = useBlockEditContext(); const [userGradientPalette, themeGradientPalette, defaultGradientPalette] = use_settings_useSettings('color.gradients.custom', 'color.gradients.theme', 'color.gradients.default'); const allGradients = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userGradientPalette || []), ...(themeGradientPalette || []), ...(defaultGradientPalette || [])], [userGradientPalette, themeGradientPalette, defaultGradientPalette]); const { gradient, customGradient } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockAttributes } = select(store); const attributes = getBlockAttributes(clientId) || {}; return { customGradient: attributes[customGradientAttribute], gradient: attributes[gradientAttribute] }; }, [clientId, gradientAttribute, customGradientAttribute]); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const setGradient = (0,external_wp_element_namespaceObject.useCallback)(newGradientValue => { const slug = getGradientSlugByValue(allGradients, newGradientValue); if (slug) { updateBlockAttributes(clientId, { [gradientAttribute]: slug, [customGradientAttribute]: undefined }); return; } updateBlockAttributes(clientId, { [gradientAttribute]: undefined, [customGradientAttribute]: newGradientValue }); }, [allGradients, clientId, updateBlockAttributes]); const gradientClass = __experimentalGetGradientClass(gradient); let gradientValue; if (gradient) { gradientValue = getGradientValueBySlug(allGradients, gradient); } else { gradientValue = customGradient; } return { gradientClass, gradientValue, setGradient }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/control.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; const TAB_IDS = { color: 'color', gradient: 'gradient' }; function ColorGradientControlInner({ colors, gradients, disableCustomColors, disableCustomGradients, __experimentalIsRenderedInSidebar, className, label, onColorChange, onGradientChange, colorValue, gradientValue, clearable, showTitle = true, enableAlpha, headingLevel }) { const canChooseAColor = onColorChange && (colors && colors.length > 0 || !disableCustomColors); const canChooseAGradient = onGradientChange && (gradients && gradients.length > 0 || !disableCustomGradients); if (!canChooseAColor && !canChooseAGradient) { return null; } const tabPanels = { [TAB_IDS.color]: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorPalette, { value: colorValue, onChange: canChooseAGradient ? newColor => { onColorChange(newColor); onGradientChange(); } : onColorChange, colors, disableCustomColors, __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, clearable: clearable, enableAlpha: enableAlpha, headingLevel: headingLevel }), [TAB_IDS.gradient]: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.GradientPicker, { value: gradientValue, onChange: canChooseAColor ? newGradient => { onGradientChange(newGradient); onColorChange(); } : onGradientChange, gradients, disableCustomGradients, __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, clearable: clearable, headingLevel: headingLevel }) }; const renderPanelType = type => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-color-gradient-control__panel", children: tabPanels[type] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, className: dist_clsx('block-editor-color-gradient-control', className), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { className: "block-editor-color-gradient-control__fieldset", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [showTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-color-gradient-control__color-indicator", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: label }) }) }), canChooseAColor && canChooseAGradient && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { defaultTabId: gradientValue ? TAB_IDS.gradient : !!canChooseAColor && TAB_IDS.color, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: TAB_IDS.color, children: (0,external_wp_i18n_namespaceObject.__)('Color') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: TAB_IDS.gradient, children: (0,external_wp_i18n_namespaceObject.__)('Gradient') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { tabId: TAB_IDS.color, className: "block-editor-color-gradient-control__panel", focusable: false, children: tabPanels.color }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { tabId: TAB_IDS.gradient, className: "block-editor-color-gradient-control__panel", focusable: false, children: tabPanels.gradient })] }) }), !canChooseAGradient && renderPanelType(TAB_IDS.color), !canChooseAColor && renderPanelType(TAB_IDS.gradient)] }) }) }); } function ColorGradientControlSelect(props) { const [colors, gradients, customColors, customGradients] = use_settings_useSettings('color.palette', 'color.gradients', 'color.custom', 'color.customGradient'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlInner, { colors: colors, gradients: gradients, disableCustomColors: !customColors, disableCustomGradients: !customGradients, ...props }); } function ColorGradientControl(props) { if (colorsAndGradientKeys.every(key => props.hasOwnProperty(key))) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlInner, { ...props }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlSelect, { ...props }); } /* harmony default export */ const control = (ColorGradientControl); ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/color-panel.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function useHasColorPanel(settings) { const hasTextPanel = useHasTextPanel(settings); const hasBackgroundPanel = useHasBackgroundColorPanel(settings); const hasLinkPanel = useHasLinkPanel(settings); const hasHeadingPanel = useHasHeadingPanel(settings); const hasButtonPanel = useHasButtonPanel(settings); const hasCaptionPanel = useHasCaptionPanel(settings); return hasTextPanel || hasBackgroundPanel || hasLinkPanel || hasHeadingPanel || hasButtonPanel || hasCaptionPanel; } function useHasTextPanel(settings) { const colors = useColorsPerOrigin(settings); return settings?.color?.text && (colors?.length > 0 || settings?.color?.custom); } function useHasLinkPanel(settings) { const colors = useColorsPerOrigin(settings); return settings?.color?.link && (colors?.length > 0 || settings?.color?.custom); } function useHasCaptionPanel(settings) { const colors = useColorsPerOrigin(settings); return settings?.color?.caption && (colors?.length > 0 || settings?.color?.custom); } function useHasHeadingPanel(settings) { const colors = useColorsPerOrigin(settings); const gradients = useGradientsPerOrigin(settings); return settings?.color?.heading && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); } function useHasButtonPanel(settings) { const colors = useColorsPerOrigin(settings); const gradients = useGradientsPerOrigin(settings); return settings?.color?.button && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); } function useHasBackgroundColorPanel(settings) { const colors = useColorsPerOrigin(settings); const gradients = useGradientsPerOrigin(settings); return settings?.color?.background && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); } function ColorToolsPanel({ resetAllFilter, onChange, value, panelId, children }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)('Elements'), resetAll: resetAll, panelId: panelId, hasInnerWrapper: true, headingLevel: 3, className: "color-block-support-panel", __experimentalFirstVisibleItemClass: "first", __experimentalLastVisibleItemClass: "last", dropdownMenuProps: dropdownMenuProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "color-block-support-panel__inner-wrapper", children: children }) }); } const color_panel_DEFAULT_CONTROLS = { text: true, background: true, link: true, heading: true, button: true, caption: true }; const popoverProps = { placement: 'left-start', offset: 36, shift: true }; const { Tabs: color_panel_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const LabeledColorIndicators = ({ indicators, label }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: indicators.map((indicator, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { expanded: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { colorValue: indicator }) }, index)) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "block-editor-panel-color-gradient-settings__color-name", children: label })] }); function ColorPanelTab({ isGradient, inheritedValue, userValue, setValue, colorGradientControlSettings }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(control, { ...colorGradientControlSettings, showTitle: false, enableAlpha: true, __experimentalIsRenderedInSidebar: true, colorValue: isGradient ? undefined : inheritedValue, gradientValue: isGradient ? inheritedValue : undefined, onColorChange: isGradient ? undefined : setValue, onGradientChange: isGradient ? setValue : undefined, clearable: inheritedValue === userValue, headingLevel: 3 }); } function ColorPanelDropdown({ label, hasValue, resetValue, isShownByDefault, indicators, tabs, colorGradientControlSettings, panelId }) { var _tabs$; const currentTab = tabs.find(tab => tab.userValue !== undefined); const { key: firstTabKey, ...firstTab } = (_tabs$ = tabs[0]) !== null && _tabs$ !== void 0 ? _tabs$ : {}; const colorGradientDropdownButtonRef = (0,external_wp_element_namespaceObject.useRef)(undefined); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "block-editor-tools-panel-color-gradient-settings__item", hasValue: hasValue, label: label, onDeselect: resetValue, isShownByDefault: isShownByDefault, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, className: "block-editor-tools-panel-color-gradient-settings__dropdown", renderToggle: ({ onToggle, isOpen }) => { const toggleProps = { onClick: onToggle, className: dist_clsx('block-editor-panel-color-gradient-settings__dropdown', { 'is-open': isOpen }), 'aria-expanded': isOpen, ref: colorGradientDropdownButtonRef }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...toggleProps, __next40pxDefaultSize: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LabeledColorIndicators, { indicators: indicators, label: label }) }), hasValue() && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Reset'), className: "block-editor-panel-color-gradient-settings__reset", size: "small", icon: library_reset, onClick: () => { resetValue(); if (isOpen) { onToggle(); } // Return focus to parent button colorGradientDropdownButtonRef.current?.focus(); } })] }); }, renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-panel-color-gradient-settings__dropdown-content", children: [tabs.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanelTab, { ...firstTab, colorGradientControlSettings: colorGradientControlSettings }, firstTabKey), tabs.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(color_panel_Tabs, { defaultTabId: currentTab?.key, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.TabList, { children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.Tab, { tabId: tab.key, children: tab.label }, tab.key)) }), tabs.map(tab => { const { key: tabKey, ...restTabProps } = tab; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.TabPanel, { tabId: tabKey, focusable: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanelTab, { ...restTabProps, colorGradientControlSettings: colorGradientControlSettings }, tabKey) }, tabKey); })] })] }) }) }) }); } function ColorPanel({ as: Wrapper = ColorToolsPanel, value, onChange, inheritedValue = value, settings, panelId, defaultControls = color_panel_DEFAULT_CONTROLS, children }) { const colors = useColorsPerOrigin(settings); const gradients = useGradientsPerOrigin(settings); const areCustomSolidsEnabled = settings?.color?.custom; const areCustomGradientsEnabled = settings?.color?.customGradient; const hasSolidColors = colors.length > 0 || areCustomSolidsEnabled; const hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled; const decodeValue = rawValue => getValueFromVariable({ settings }, '', rawValue); const encodeColorValue = colorValue => { const allColors = colors.flatMap(({ colors: originColors }) => originColors); const colorObject = allColors.find(({ color }) => color === colorValue); return colorObject ? 'var:preset|color|' + colorObject.slug : colorValue; }; const encodeGradientValue = gradientValue => { const allGradients = gradients.flatMap(({ gradients: originGradients }) => originGradients); const gradientObject = allGradients.find(({ gradient }) => gradient === gradientValue); return gradientObject ? 'var:preset|gradient|' + gradientObject.slug : gradientValue; }; // BackgroundColor const showBackgroundPanel = useHasBackgroundColorPanel(settings); const backgroundColor = decodeValue(inheritedValue?.color?.background); const userBackgroundColor = decodeValue(value?.color?.background); const gradient = decodeValue(inheritedValue?.color?.gradient); const userGradient = decodeValue(value?.color?.gradient); const hasBackground = () => !!userBackgroundColor || !!userGradient; const setBackgroundColor = newColor => { const newValue = setImmutably(value, ['color', 'background'], encodeColorValue(newColor)); newValue.color.gradient = undefined; onChange(newValue); }; const setGradient = newGradient => { const newValue = setImmutably(value, ['color', 'gradient'], encodeGradientValue(newGradient)); newValue.color.background = undefined; onChange(newValue); }; const resetBackground = () => { const newValue = setImmutably(value, ['color', 'background'], undefined); newValue.color.gradient = undefined; onChange(newValue); }; // Links const showLinkPanel = useHasLinkPanel(settings); const linkColor = decodeValue(inheritedValue?.elements?.link?.color?.text); const userLinkColor = decodeValue(value?.elements?.link?.color?.text); const setLinkColor = newColor => { onChange(setImmutably(value, ['elements', 'link', 'color', 'text'], encodeColorValue(newColor))); }; const hoverLinkColor = decodeValue(inheritedValue?.elements?.link?.[':hover']?.color?.text); const userHoverLinkColor = decodeValue(value?.elements?.link?.[':hover']?.color?.text); const setHoverLinkColor = newColor => { onChange(setImmutably(value, ['elements', 'link', ':hover', 'color', 'text'], encodeColorValue(newColor))); }; const hasLink = () => !!userLinkColor || !!userHoverLinkColor; const resetLink = () => { let newValue = setImmutably(value, ['elements', 'link', ':hover', 'color', 'text'], undefined); newValue = setImmutably(newValue, ['elements', 'link', 'color', 'text'], undefined); onChange(newValue); }; // Text Color const showTextPanel = useHasTextPanel(settings); const textColor = decodeValue(inheritedValue?.color?.text); const userTextColor = decodeValue(value?.color?.text); const hasTextColor = () => !!userTextColor; const setTextColor = newColor => { let changedObject = setImmutably(value, ['color', 'text'], encodeColorValue(newColor)); if (textColor === linkColor) { changedObject = setImmutably(changedObject, ['elements', 'link', 'color', 'text'], encodeColorValue(newColor)); } onChange(changedObject); }; const resetTextColor = () => setTextColor(undefined); // Elements const elements = [{ name: 'caption', label: (0,external_wp_i18n_namespaceObject.__)('Captions'), showPanel: useHasCaptionPanel(settings) }, { name: 'button', label: (0,external_wp_i18n_namespaceObject.__)('Button'), showPanel: useHasButtonPanel(settings) }, { name: 'heading', label: (0,external_wp_i18n_namespaceObject.__)('Heading'), showPanel: useHasHeadingPanel(settings) }, { name: 'h1', label: (0,external_wp_i18n_namespaceObject.__)('H1'), showPanel: useHasHeadingPanel(settings) }, { name: 'h2', label: (0,external_wp_i18n_namespaceObject.__)('H2'), showPanel: useHasHeadingPanel(settings) }, { name: 'h3', label: (0,external_wp_i18n_namespaceObject.__)('H3'), showPanel: useHasHeadingPanel(settings) }, { name: 'h4', label: (0,external_wp_i18n_namespaceObject.__)('H4'), showPanel: useHasHeadingPanel(settings) }, { name: 'h5', label: (0,external_wp_i18n_namespaceObject.__)('H5'), showPanel: useHasHeadingPanel(settings) }, { name: 'h6', label: (0,external_wp_i18n_namespaceObject.__)('H6'), showPanel: useHasHeadingPanel(settings) }]; const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { return { ...previousValue, color: undefined, elements: { ...previousValue?.elements, link: { ...previousValue?.elements?.link, color: undefined, ':hover': { color: undefined } }, ...elements.reduce((acc, element) => { return { ...acc, [element.name]: { ...previousValue?.elements?.[element.name], color: undefined } }; }, {}) } }; }, []); const items = [showTextPanel && { key: 'text', label: (0,external_wp_i18n_namespaceObject.__)('Text'), hasValue: hasTextColor, resetValue: resetTextColor, isShownByDefault: defaultControls.text, indicators: [textColor], tabs: [{ key: 'text', label: (0,external_wp_i18n_namespaceObject.__)('Text'), inheritedValue: textColor, setValue: setTextColor, userValue: userTextColor }] }, showBackgroundPanel && { key: 'background', label: (0,external_wp_i18n_namespaceObject.__)('Background'), hasValue: hasBackground, resetValue: resetBackground, isShownByDefault: defaultControls.background, indicators: [gradient !== null && gradient !== void 0 ? gradient : backgroundColor], tabs: [hasSolidColors && { key: 'background', label: (0,external_wp_i18n_namespaceObject.__)('Color'), inheritedValue: backgroundColor, setValue: setBackgroundColor, userValue: userBackgroundColor }, hasGradientColors && { key: 'gradient', label: (0,external_wp_i18n_namespaceObject.__)('Gradient'), inheritedValue: gradient, setValue: setGradient, userValue: userGradient, isGradient: true }].filter(Boolean) }, showLinkPanel && { key: 'link', label: (0,external_wp_i18n_namespaceObject.__)('Link'), hasValue: hasLink, resetValue: resetLink, isShownByDefault: defaultControls.link, indicators: [linkColor, hoverLinkColor], tabs: [{ key: 'link', label: (0,external_wp_i18n_namespaceObject.__)('Default'), inheritedValue: linkColor, setValue: setLinkColor, userValue: userLinkColor }, { key: 'hover', label: (0,external_wp_i18n_namespaceObject.__)('Hover'), inheritedValue: hoverLinkColor, setValue: setHoverLinkColor, userValue: userHoverLinkColor }] }].filter(Boolean); elements.forEach(({ name, label, showPanel }) => { if (!showPanel) { return; } const elementBackgroundColor = decodeValue(inheritedValue?.elements?.[name]?.color?.background); const elementGradient = decodeValue(inheritedValue?.elements?.[name]?.color?.gradient); const elementTextColor = decodeValue(inheritedValue?.elements?.[name]?.color?.text); const elementBackgroundUserColor = decodeValue(value?.elements?.[name]?.color?.background); const elementGradientUserColor = decodeValue(value?.elements?.[name]?.color?.gradient); const elementTextUserColor = decodeValue(value?.elements?.[name]?.color?.text); const hasElement = () => !!(elementTextUserColor || elementBackgroundUserColor || elementGradientUserColor); const resetElement = () => { const newValue = setImmutably(value, ['elements', name, 'color', 'background'], undefined); newValue.elements[name].color.gradient = undefined; newValue.elements[name].color.text = undefined; onChange(newValue); }; const setElementTextColor = newTextColor => { onChange(setImmutably(value, ['elements', name, 'color', 'text'], encodeColorValue(newTextColor))); }; const setElementBackgroundColor = newBackgroundColor => { const newValue = setImmutably(value, ['elements', name, 'color', 'background'], encodeColorValue(newBackgroundColor)); newValue.elements[name].color.gradient = undefined; onChange(newValue); }; const setElementGradient = newGradient => { const newValue = setImmutably(value, ['elements', name, 'color', 'gradient'], encodeGradientValue(newGradient)); newValue.elements[name].color.background = undefined; onChange(newValue); }; const supportsTextColor = true; // Background color is not supported for `caption` // as there isn't yet a way to set padding for the element. const supportsBackground = name !== 'caption'; items.push({ key: name, label, hasValue: hasElement, resetValue: resetElement, isShownByDefault: defaultControls[name], indicators: supportsTextColor && supportsBackground ? [elementTextColor, elementGradient !== null && elementGradient !== void 0 ? elementGradient : elementBackgroundColor] : [supportsTextColor ? elementTextColor : elementGradient !== null && elementGradient !== void 0 ? elementGradient : elementBackgroundColor], tabs: [hasSolidColors && supportsTextColor && { key: 'text', label: (0,external_wp_i18n_namespaceObject.__)('Text'), inheritedValue: elementTextColor, setValue: setElementTextColor, userValue: elementTextUserColor }, hasSolidColors && supportsBackground && { key: 'background', label: (0,external_wp_i18n_namespaceObject.__)('Background'), inheritedValue: elementBackgroundColor, setValue: setElementBackgroundColor, userValue: elementBackgroundUserColor }, hasGradientColors && supportsBackground && { key: 'gradient', label: (0,external_wp_i18n_namespaceObject.__)('Gradient'), inheritedValue: elementGradient, setValue: setElementGradient, userValue: elementGradientUserColor, isGradient: true }].filter(Boolean) }); }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, panelId: panelId, children: [items.map(item => { const { key, ...restItem } = item; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanelDropdown, { ...restItem, colorGradientControlSettings: { colors, disableCustomColors: !areCustomSolidsEnabled, gradients, disableCustomGradients: !areCustomGradientsEnabled }, panelId: panelId }, key); }), children] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js /** * External dependencies */ /** * WordPress dependencies */ k([names, a11y]); function ContrastChecker({ backgroundColor, fallbackBackgroundColor, fallbackTextColor, fallbackLinkColor, fontSize, // Font size value in pixels. isLargeText, textColor, linkColor, enableAlphaChecker = false }) { const currentBackgroundColor = backgroundColor || fallbackBackgroundColor; // Must have a background color. if (!currentBackgroundColor) { return null; } const currentTextColor = textColor || fallbackTextColor; const currentLinkColor = linkColor || fallbackLinkColor; // Must have at least one text color. if (!currentTextColor && !currentLinkColor) { return null; } const textColors = [{ color: currentTextColor, description: (0,external_wp_i18n_namespaceObject.__)('text color') }, { color: currentLinkColor, description: (0,external_wp_i18n_namespaceObject.__)('link color') }]; const colordBackgroundColor = w(currentBackgroundColor); const backgroundColorHasTransparency = colordBackgroundColor.alpha() < 1; const backgroundColorBrightness = colordBackgroundColor.brightness(); const isReadableOptions = { level: 'AA', size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small' }; let message = ''; let speakMessage = ''; for (const item of textColors) { // If there is no color, go no further. if (!item.color) { continue; } const colordTextColor = w(item.color); const isColordTextReadable = colordTextColor.isReadable(colordBackgroundColor, isReadableOptions); const textHasTransparency = colordTextColor.alpha() < 1; // If the contrast is not readable. if (!isColordTextReadable) { // Don't show the message if the background or text is transparent. if (backgroundColorHasTransparency || textHasTransparency) { continue; } message = backgroundColorBrightness < colordTextColor.brightness() ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is a type of text color, e.g., "text color" or "link color". (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s.'), item.description) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is a type of text color, e.g., "text color" or "link color". (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s.'), item.description); speakMessage = (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read.'); // Break from the loop when we have a contrast warning. // These messages take priority over the transparency warning. break; } // If there is no contrast warning and the text is transparent, // show the transparent warning if alpha check is enabled. if (textHasTransparency && enableAlphaChecker) { message = (0,external_wp_i18n_namespaceObject.__)('Transparent text may be hard for people to read.'); speakMessage = (0,external_wp_i18n_namespaceObject.__)('Transparent text may be hard for people to read.'); } } if (!message) { return null; } // Note: The `Notice` component can speak messages via its `spokenMessage` // prop, but the contrast checker requires granular control over when the // announcements are made. Notably, the message will be re-announced if a // new color combination is selected and the contrast is still insufficient. (0,external_wp_a11y_namespaceObject.speak)(speakMessage); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-contrast-checker", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { spokenMessage: null, status: "warning", isDismissible: false, children: message }) }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/contrast-checker/README.md */ /* harmony default export */ const contrast_checker = (ContrastChecker); ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js /** * WordPress dependencies */ const BlockRefs = (0,external_wp_element_namespaceObject.createContext)({ refsMap: (0,external_wp_compose_namespaceObject.observableMap)() }); function BlockRefsProvider({ children }) { const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({ refsMap: (0,external_wp_compose_namespaceObject.observableMap)() }), []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefs.Provider, { value: value, children: children }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/element').RefCallback} RefCallback */ /** @typedef {import('@wordpress/element').Ref} Ref */ /** * Provides a ref to the BlockRefs context. * * @param {string} clientId The client ID of the element ref. * * @return {RefCallback} Ref callback. */ function useBlockRefProvider(clientId) { const { refsMap } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { refsMap.set(clientId, element); return () => refsMap.delete(clientId); }, [clientId]); } function assignRef(ref, value) { if (typeof ref === 'function') { ref(value); } else if (ref) { ref.current = value; } } /** * Tracks the DOM element for the block identified by `clientId` and assigns it to the `ref` * whenever it changes. * * @param {string} clientId The client ID to track. * @param {Ref} ref The ref object/callback to assign to. */ function useBlockElementRef(clientId, ref) { const { refsMap } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { assignRef(ref, refsMap.get(clientId)); const unsubscribe = refsMap.subscribe(clientId, () => assignRef(ref, refsMap.get(clientId))); return () => { unsubscribe(); assignRef(ref, null); }; }, [refsMap, clientId, ref]); } /** * Return the element for a given client ID. Updates whenever the element * changes, becomes available, or disappears. * * @param {string} clientId The client ID to an element for. * * @return {Element|null} The block's wrapper element. */ function useBlockElement(clientId) { const [blockElement, setBlockElement] = (0,external_wp_element_namespaceObject.useState)(null); useBlockElementRef(clientId, setBlockElement); return blockElement; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/contrast-checker.js /** * WordPress dependencies */ /** * Internal dependencies */ function getComputedValue(node, property) { return node.ownerDocument.defaultView.getComputedStyle(node).getPropertyValue(property); } function getBlockElementColors(blockEl) { if (!blockEl) { return {}; } const firstLinkElement = blockEl.querySelector('a'); const linkColor = !!firstLinkElement?.innerText ? getComputedValue(firstLinkElement, 'color') : undefined; const textColor = getComputedValue(blockEl, 'color'); let backgroundColorNode = blockEl; let backgroundColor = getComputedValue(backgroundColorNode, 'background-color'); while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { backgroundColorNode = backgroundColorNode.parentNode; backgroundColor = getComputedValue(backgroundColorNode, 'background-color'); } return { textColor, backgroundColor, linkColor }; } function contrast_checker_reducer(prevColors, newColors) { const hasChanged = Object.keys(newColors).some(key => prevColors[key] !== newColors[key]); // Do not re-render if the colors have not changed. return hasChanged ? newColors : prevColors; } function BlockColorContrastChecker({ clientId }) { const blockEl = useBlockElement(clientId); const [colors, setColors] = (0,external_wp_element_namespaceObject.useReducer)(contrast_checker_reducer, {}); // There are so many things that can change the color of a block // So we perform this check on every render. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!blockEl) { return; } function updateColors() { setColors(getBlockElementColors(blockEl)); } // Combine `useLayoutEffect` and two rAF calls to ensure that values are read // after the current paint but before the next paint. window.requestAnimationFrame(() => window.requestAnimationFrame(updateColors)); }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(contrast_checker, { backgroundColor: colors.backgroundColor, textColor: colors.textColor, linkColor: colors.linkColor, enableAlphaChecker: true }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/color.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const COLOR_SUPPORT_KEY = 'color'; const hasColorSupport = blockNameOrType => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY); return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false); }; const hasLinkColorSupport = blockType => { if (external_wp_element_namespaceObject.Platform.OS !== 'web') { return false; } const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.link; }; const hasGradientSupport = blockNameOrType => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY); return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.gradients; }; const hasBackgroundColorSupport = blockType => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); return colorSupport && colorSupport.background !== false; }; const hasTextColorSupport = blockType => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); return colorSupport && colorSupport.text !== false; }; /** * Filters registered block settings, extending attributes to include * `backgroundColor` and `textColor` attribute. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function color_addAttributes(settings) { if (!hasColorSupport(settings)) { return settings; } // Allow blocks to specify their own attribute definition with default values if needed. if (!settings.attributes.backgroundColor) { Object.assign(settings.attributes, { backgroundColor: { type: 'string' } }); } if (!settings.attributes.textColor) { Object.assign(settings.attributes, { textColor: { type: 'string' } }); } if (hasGradientSupport(settings) && !settings.attributes.gradient) { Object.assign(settings.attributes, { gradient: { type: 'string' } }); } return settings; } /** * Override props assigned to save component to inject colors classnames. * * @param {Object} props Additional props applied to save element. * @param {Object|string} blockNameOrType Block type. * @param {Object} attributes Block attributes. * * @return {Object} Filtered props applied to save element. */ function color_addSaveProps(props, blockNameOrType, attributes) { if (!hasColorSupport(blockNameOrType) || shouldSkipSerialization(blockNameOrType, COLOR_SUPPORT_KEY)) { return props; } const hasGradient = hasGradientSupport(blockNameOrType); // I'd have preferred to avoid the "style" attribute usage here const { backgroundColor, textColor, gradient, style } = attributes; const shouldSerialize = feature => !shouldSkipSerialization(blockNameOrType, COLOR_SUPPORT_KEY, feature); // Primary color classes must come before the `has-text-color`, // `has-background` and `has-link-color` classes to maintain backwards // compatibility and avoid block invalidations. const textClass = shouldSerialize('text') ? getColorClassName('color', textColor) : undefined; const gradientClass = shouldSerialize('gradients') ? __experimentalGetGradientClass(gradient) : undefined; const backgroundClass = shouldSerialize('background') ? getColorClassName('background-color', backgroundColor) : undefined; const serializeHasBackground = shouldSerialize('background') || shouldSerialize('gradients'); const hasBackground = backgroundColor || style?.color?.background || hasGradient && (gradient || style?.color?.gradient); const newClassName = dist_clsx(props.className, textClass, gradientClass, { // Don't apply the background class if there's a custom gradient. [backgroundClass]: (!hasGradient || !style?.color?.gradient) && !!backgroundClass, 'has-text-color': shouldSerialize('text') && (textColor || style?.color?.text), 'has-background': serializeHasBackground && hasBackground, 'has-link-color': shouldSerialize('link') && style?.elements?.link?.color }); props.className = newClassName ? newClassName : undefined; return props; } function color_styleToAttributes(style) { const textColorValue = style?.color?.text; const textColorSlug = textColorValue?.startsWith('var:preset|color|') ? textColorValue.substring('var:preset|color|'.length) : undefined; const backgroundColorValue = style?.color?.background; const backgroundColorSlug = backgroundColorValue?.startsWith('var:preset|color|') ? backgroundColorValue.substring('var:preset|color|'.length) : undefined; const gradientValue = style?.color?.gradient; const gradientSlug = gradientValue?.startsWith('var:preset|gradient|') ? gradientValue.substring('var:preset|gradient|'.length) : undefined; const updatedStyle = { ...style }; updatedStyle.color = { ...updatedStyle.color, text: textColorSlug ? undefined : textColorValue, background: backgroundColorSlug ? undefined : backgroundColorValue, gradient: gradientSlug ? undefined : gradientValue }; return { style: utils_cleanEmptyObject(updatedStyle), textColor: textColorSlug, backgroundColor: backgroundColorSlug, gradient: gradientSlug }; } function color_attributesToStyle(attributes) { return { ...attributes.style, color: { ...attributes.style?.color, text: attributes.textColor ? 'var:preset|color|' + attributes.textColor : attributes.style?.color?.text, background: attributes.backgroundColor ? 'var:preset|color|' + attributes.backgroundColor : attributes.style?.color?.background, gradient: attributes.gradient ? 'var:preset|gradient|' + attributes.gradient : attributes.style?.color?.gradient } }; } function ColorInspectorControl({ children, resetAllFilter }) { const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => { const existingStyle = color_attributesToStyle(attributes); const updatedStyle = resetAllFilter(existingStyle); return { ...attributes, ...color_styleToAttributes(updatedStyle) }; }, [resetAllFilter]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "color", resetAllFilter: attributesResetAllFilter, children: children }); } function ColorEdit({ clientId, name, setAttributes, settings }) { const isEnabled = useHasColorPanel(settings); function selector(select) { const { style, textColor, backgroundColor, gradient } = select(store).getBlockAttributes(clientId) || {}; return { style, textColor, backgroundColor, gradient }; } const { style, textColor, backgroundColor, gradient } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]); const value = (0,external_wp_element_namespaceObject.useMemo)(() => { return color_attributesToStyle({ style, textColor, backgroundColor, gradient }); }, [style, textColor, backgroundColor, gradient]); const onChange = newStyle => { setAttributes(color_styleToAttributes(newStyle)); }; if (!isEnabled) { return null; } const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, '__experimentalDefaultControls']); const enableContrastChecking = external_wp_element_namespaceObject.Platform.OS === 'web' && !value?.color?.gradient && (settings?.color?.text || settings?.color?.link) && // Contrast checking is enabled by default. // Deactivating it requires `enableContrastChecker` to have // an explicit value of `false`. false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'enableContrastChecker']); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanel, { as: ColorInspectorControl, panelId: clientId, settings: settings, value: value, onChange: onChange, defaultControls: defaultControls, enableContrastChecker: false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'enableContrastChecker']), children: enableContrastChecking && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockColorContrastChecker, { clientId: clientId }) }); } function color_useBlockProps({ name, backgroundColor, textColor, gradient, style }) { const [userPalette, themePalette, defaultPalette] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', 'color.palette.default'); const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]); if (!hasColorSupport(name) || shouldSkipSerialization(name, COLOR_SUPPORT_KEY)) { return {}; } const extraStyles = {}; if (textColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, 'text')) { extraStyles.color = getColorObjectByAttributeValues(colors, textColor)?.color; } if (backgroundColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, 'background')) { extraStyles.backgroundColor = getColorObjectByAttributeValues(colors, backgroundColor)?.color; } const saveProps = color_addSaveProps({ style: extraStyles }, name, { textColor, backgroundColor, gradient, style }); const hasBackgroundValue = backgroundColor || style?.color?.background || gradient || style?.color?.gradient; return { ...saveProps, className: dist_clsx(saveProps.className, // Add background image classes in the editor, if not already handled by background color values. !hasBackgroundValue && getBackgroundImageClasses(style)) }; } /* harmony default export */ const color = ({ useBlockProps: color_useBlockProps, addSaveProps: color_addSaveProps, attributeKeys: ['backgroundColor', 'textColor', 'gradient', 'style'], hasSupport: hasColorSupport }); const MIGRATION_PATHS = { linkColor: [['style', 'elements', 'link', 'color', 'text']], textColor: [['textColor'], ['style', 'color', 'text']], backgroundColor: [['backgroundColor'], ['style', 'color', 'background']], gradient: [['gradient'], ['style', 'color', 'gradient']] }; function color_addTransforms(result, source, index, results) { const destinationBlockType = result.name; const activeSupports = { linkColor: hasLinkColorSupport(destinationBlockType), textColor: hasTextColorSupport(destinationBlockType), backgroundColor: hasBackgroundColorSupport(destinationBlockType), gradient: hasGradientSupport(destinationBlockType) }; return transformStyles(activeSupports, MIGRATION_PATHS, result, source, index, results); } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/color/addAttribute', color_addAttributes); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/color/addTransforms', color_addTransforms); ;// ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function FontFamilyControl({ /** Start opting into the larger default height that will become the default size in a future version. */ __next40pxDefaultSize = false, /** Start opting into the new margin-free styles that will become the default in a future version. */ __nextHasNoMarginBottom = false, value = '', onChange, fontFamilies, className, ...props }) { var _options$find; const [blockLevelFontFamilies] = use_settings_useSettings('typography.fontFamilies'); if (!fontFamilies) { fontFamilies = blockLevelFontFamilies; } if (!fontFamilies || fontFamilies.length === 0) { return null; } const options = [{ key: '', name: (0,external_wp_i18n_namespaceObject.__)('Default') }, ...fontFamilies.map(({ fontFamily, name }) => ({ key: fontFamily, name: name || fontFamily, style: { fontFamily } }))]; if (!__nextHasNoMarginBottom) { external_wp_deprecated_default()('Bottom margin styles for wp.blockEditor.FontFamilyControl', { since: '6.7', version: '7.0', hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version' }); } if (!__next40pxDefaultSize && (props.size === undefined || props.size === 'default')) { external_wp_deprecated_default()(`36px default size for wp.blockEditor.__experimentalFontFamilyControl`, { since: '6.8', version: '7.1', hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.' }); } const selectedValue = (_options$find = options.find(option => option.key === value)) !== null && _options$find !== void 0 ? _options$find : ''; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CustomSelectControl, { __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Font'), value: selectedValue, onChange: ({ selectedItem }) => onChange(selectedItem.key), options: options, className: dist_clsx('block-editor-font-family-control', className, { 'is-next-has-no-margin-bottom': __nextHasNoMarginBottom }), ...props }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Adjusts font appearance field label in case either font styles or weights * are disabled. * * @param {boolean} hasFontStyles Whether font styles are enabled and present. * @param {boolean} hasFontWeights Whether font weights are enabled and present. * @return {string} A label representing what font appearance is being edited. */ const getFontAppearanceLabel = (hasFontStyles, hasFontWeights) => { if (!hasFontStyles) { return (0,external_wp_i18n_namespaceObject.__)('Font weight'); } if (!hasFontWeights) { return (0,external_wp_i18n_namespaceObject.__)('Font style'); } return (0,external_wp_i18n_namespaceObject.__)('Appearance'); }; /** * Control to display font style and weight options of the active font. * * @param {Object} props Component props. * * @return {Element} Font appearance control. */ function FontAppearanceControl(props) { const { /** Start opting into the larger default height that will become the default size in a future version. */ __next40pxDefaultSize = false, onChange, hasFontStyles = true, hasFontWeights = true, fontFamilyFaces, value: { fontStyle, fontWeight }, ...otherProps } = props; const hasStylesOrWeights = hasFontStyles || hasFontWeights; const label = getFontAppearanceLabel(hasFontStyles, hasFontWeights); const defaultOption = { key: 'default', name: (0,external_wp_i18n_namespaceObject.__)('Default'), style: { fontStyle: undefined, fontWeight: undefined } }; const { fontStyles, fontWeights, combinedStyleAndWeightOptions } = getFontStylesAndWeights(fontFamilyFaces); // Generates select options for combined font styles and weights. const combineOptions = () => { const combinedOptions = [defaultOption]; if (combinedStyleAndWeightOptions) { combinedOptions.push(...combinedStyleAndWeightOptions); } return combinedOptions; }; // Generates select options for font styles only. const styleOptions = () => { const combinedOptions = [defaultOption]; fontStyles.forEach(({ name, value }) => { combinedOptions.push({ key: value, name, style: { fontStyle: value, fontWeight: undefined } }); }); return combinedOptions; }; // Generates select options for font weights only. const weightOptions = () => { const combinedOptions = [defaultOption]; fontWeights.forEach(({ name, value }) => { combinedOptions.push({ key: value, name, style: { fontStyle: undefined, fontWeight: value } }); }); return combinedOptions; }; // Map font styles and weights to select options. const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { // Display combined available font style and weight options. if (hasFontStyles && hasFontWeights) { return combineOptions(); } // Display only font style options or font weight options. return hasFontStyles ? styleOptions() : weightOptions(); }, [props.options, fontStyles, fontWeights, combinedStyleAndWeightOptions]); // Find current selection by comparing font style & weight against options, // and fall back to the Default option if there is no matching option. const currentSelection = selectOptions.find(option => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight) || selectOptions[0]; // Adjusts screen reader description based on styles or weights. const getDescribedBy = () => { if (!currentSelection) { return (0,external_wp_i18n_namespaceObject.__)('No selected font appearance'); } if (!hasFontStyles) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font weight. (0,external_wp_i18n_namespaceObject.__)('Currently selected font weight: %s'), currentSelection.name); } if (!hasFontWeights) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font style. (0,external_wp_i18n_namespaceObject.__)('Currently selected font style: %s'), currentSelection.name); } return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font appearance. (0,external_wp_i18n_namespaceObject.__)('Currently selected font appearance: %s'), currentSelection.name); }; if (!__next40pxDefaultSize && (otherProps.size === undefined || otherProps.size === 'default')) { external_wp_deprecated_default()(`36px default size for wp.blockEditor.__experimentalFontAppearanceControl`, { since: '6.8', version: '7.1', hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.' }); } return hasStylesOrWeights && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CustomSelectControl, { ...otherProps, className: "components-font-appearance-control", __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, label: label, describedBy: getDescribedBy(), options: selectOptions, value: currentSelection, onChange: ({ selectedItem }) => onChange(selectedItem.style) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/utils.js const BASE_DEFAULT_VALUE = 1.5; const STEP = 0.01; /** * A spin factor of 10 allows the spin controls to increment/decrement by 0.1. * e.g. A line-height value of 1.55 will increment to 1.65. */ const SPIN_FACTOR = 10; /** * There are varying value types within LineHeightControl: * * {undefined} Initial value. No changes from the user. * {string} Input value. Value consumed/outputted by the input. Empty would be ''. * {number} Block attribute type. Input value needs to be converted for attribute setting. * * Note: If the value is undefined, the input requires it to be an empty string ('') * in order to be considered "controlled" by props (rather than internal state). */ const RESET_VALUE = ''; /** * Determines if the lineHeight attribute has been properly defined. * * @param {any} lineHeight The value to check. * * @return {boolean} Whether the lineHeight attribute is valid. */ function isLineHeightDefined(lineHeight) { return lineHeight !== undefined && lineHeight !== RESET_VALUE; } ;// ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const line_height_control_LineHeightControl = ({ /** Start opting into the larger default height that will become the default size in a future version. */ __next40pxDefaultSize = false, value: lineHeight, onChange, __unstableInputWidth = '60px', ...otherProps }) => { const isDefined = isLineHeightDefined(lineHeight); const adjustNextValue = (nextValue, wasTypedOrPasted) => { // Set the next value without modification if lineHeight has been defined. if (isDefined) { return nextValue; } /** * The following logic handles the initial spin up/down action * (from an undefined value state) so that the next values are better suited for * line-height rendering. For example, the first spin up should immediately * go to 1.6, rather than the normally expected 0.1. * * Spin up/down actions can be triggered by keydowns of the up/down arrow keys, * dragging the input or by clicking the spin buttons. */ const spin = STEP * SPIN_FACTOR; switch (`${nextValue}`) { case `${spin}`: // Increment by spin value. return BASE_DEFAULT_VALUE + spin; case '0': { // This means the user explicitly input '0', rather than using the // spin down action from an undefined value state. if (wasTypedOrPasted) { return nextValue; } // Decrement by spin value. return BASE_DEFAULT_VALUE - spin; } case '': return BASE_DEFAULT_VALUE; default: return nextValue; } }; const stateReducer = (state, action) => { // Be careful when changing this — cross-browser behavior of the // `inputType` field in `input` events are inconsistent. // For example, Firefox emits an input event with inputType="insertReplacementText" // on spin button clicks, while other browsers do not even emit an input event. const wasTypedOrPasted = ['insertText', 'insertFromPaste'].includes(action.payload.event.nativeEvent?.inputType); const value = adjustNextValue(state.value, wasTypedOrPasted); return { ...state, value }; }; const value = isDefined ? lineHeight : RESET_VALUE; const handleOnChange = (nextValue, { event }) => { if (nextValue === '') { onChange(); return; } if (event.type === 'click') { onChange(adjustNextValue(`${nextValue}`, false)); return; } onChange(`${nextValue}`); }; if (!__next40pxDefaultSize && (otherProps.size === undefined || otherProps.size === 'default')) { external_wp_deprecated_default()(`36px default size for wp.blockEditor.LineHeightControl`, { since: '6.8', version: '7.1', hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.' }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-line-height-control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { ...otherProps, __shouldNotWarnDeprecated36pxSize: true, __next40pxDefaultSize: __next40pxDefaultSize, __unstableInputWidth: __unstableInputWidth, __unstableStateReducer: stateReducer, onChange: handleOnChange, label: (0,external_wp_i18n_namespaceObject.__)('Line height'), placeholder: BASE_DEFAULT_VALUE, step: STEP, spinFactor: SPIN_FACTOR, value: value, min: 0, spinControls: "custom" }) }); }; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md */ /* harmony default export */ const line_height_control = (line_height_control_LineHeightControl); ;// ./node_modules/@wordpress/block-editor/build-module/components/letter-spacing-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Control for letter-spacing. * * @param {Object} props Component props. * @param {boolean} props.__next40pxDefaultSize Start opting into the larger default height that will become the default size in a future version. * @param {string} props.value Currently selected letter-spacing. * @param {Function} props.onChange Handles change in letter-spacing selection. * @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value. * * @return {Element} Letter-spacing control. */ function LetterSpacingControl({ __next40pxDefaultSize = false, value, onChange, __unstableInputWidth = '60px', ...otherProps }) { const [availableUnits] = use_settings_useSettings('spacing.units'); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ['px', 'em', 'rem'], defaultValues: { px: 2, em: 0.2, rem: 0.2 } }); if (!__next40pxDefaultSize && (otherProps.size === undefined || otherProps.size === 'default')) { external_wp_deprecated_default()(`36px default size for wp.blockEditor.__experimentalLetterSpacingControl`, { since: '6.8', version: '7.1', hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.' }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, ...otherProps, label: (0,external_wp_i18n_namespaceObject.__)('Letter spacing'), value: value, __unstableInputWidth: __unstableInputWidth, units: units, onChange: onChange }); } ;// ./node_modules/@wordpress/icons/build-module/library/align-left.js /** * WordPress dependencies */ const alignLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z" }) }); /* harmony default export */ const align_left = (alignLeft); ;// ./node_modules/@wordpress/icons/build-module/library/align-center.js /** * WordPress dependencies */ const alignCenter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z" }) }); /* harmony default export */ const align_center = (alignCenter); ;// ./node_modules/@wordpress/icons/build-module/library/align-right.js /** * WordPress dependencies */ const alignRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z" }) }); /* harmony default export */ const align_right = (alignRight); ;// ./node_modules/@wordpress/icons/build-module/library/align-justify.js /** * WordPress dependencies */ const alignJustify = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 12.8h16v-1.5H4v1.5zm0 7h12.4v-1.5H4v1.5zM4 4.3v1.5h16V4.3H4z" }) }); /* harmony default export */ const align_justify = (alignJustify); ;// ./node_modules/@wordpress/block-editor/build-module/components/text-alignment-control/index.js /** * External dependencies */ /** * WordPress dependencies */ const TEXT_ALIGNMENT_OPTIONS = [{ label: (0,external_wp_i18n_namespaceObject.__)('Align text left'), value: 'left', icon: align_left }, { label: (0,external_wp_i18n_namespaceObject.__)('Align text center'), value: 'center', icon: align_center }, { label: (0,external_wp_i18n_namespaceObject.__)('Align text right'), value: 'right', icon: align_right }, { label: (0,external_wp_i18n_namespaceObject.__)('Justify text'), value: 'justify', icon: align_justify }]; const DEFAULT_OPTIONS = ['left', 'center', 'right']; /** * Control to facilitate text alignment selections. * * @param {Object} props Component props. * @param {string} props.className Class name to add to the control. * @param {string} props.value Currently selected text alignment. * @param {Function} props.onChange Handles change in text alignment selection. * @param {string[]} props.options Array of text alignment options to display. * * @return {Element} Text alignment control. */ function TextAlignmentControl({ className, value, onChange, options = DEFAULT_OPTIONS }) { const validOptions = (0,external_wp_element_namespaceObject.useMemo)(() => TEXT_ALIGNMENT_OPTIONS.filter(option => options.includes(option.value)), [options]); if (!validOptions.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { isDeselectable: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Text alignment'), className: dist_clsx('block-editor-text-alignment-control', className), value: value, onChange: newValue => { onChange(newValue === value ? undefined : newValue); }, children: validOptions.map(option => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: option.value, icon: option.icon, label: option.label }, option.value); }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js /** * WordPress dependencies */ const formatUppercase = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z" }) }); /* harmony default export */ const format_uppercase = (formatUppercase); ;// ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js /** * WordPress dependencies */ const formatLowercase = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z" }) }); /* harmony default export */ const format_lowercase = (formatLowercase); ;// ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js /** * WordPress dependencies */ const formatCapitalize = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z" }) }); /* harmony default export */ const format_capitalize = (formatCapitalize); ;// ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js /** * External dependencies */ /** * WordPress dependencies */ const TEXT_TRANSFORMS = [{ label: (0,external_wp_i18n_namespaceObject.__)('None'), value: 'none', icon: library_reset }, { label: (0,external_wp_i18n_namespaceObject.__)('Uppercase'), value: 'uppercase', icon: format_uppercase }, { label: (0,external_wp_i18n_namespaceObject.__)('Lowercase'), value: 'lowercase', icon: format_lowercase }, { label: (0,external_wp_i18n_namespaceObject.__)('Capitalize'), value: 'capitalize', icon: format_capitalize }]; /** * Control to facilitate text transform selections. * * @param {Object} props Component props. * @param {string} props.className Class name to add to the control. * @param {string} props.value Currently selected text transform. * @param {Function} props.onChange Handles change in text transform selection. * * @return {Element} Text transform control. */ function TextTransformControl({ className, value, onChange }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { isDeselectable: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Letter case'), className: dist_clsx('block-editor-text-transform-control', className), value: value, onChange: newValue => { onChange(newValue === value ? undefined : newValue); }, children: TEXT_TRANSFORMS.map(option => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: option.value, icon: option.icon, label: option.label }, option.value); }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/format-underline.js /** * WordPress dependencies */ const formatUnderline = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z" }) }); /* harmony default export */ const format_underline = (formatUnderline); ;// ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js /** * WordPress dependencies */ const formatStrikethrough = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" }) }); /* harmony default export */ const format_strikethrough = (formatStrikethrough); ;// ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js /** * External dependencies */ /** * WordPress dependencies */ const TEXT_DECORATIONS = [{ label: (0,external_wp_i18n_namespaceObject.__)('None'), value: 'none', icon: library_reset }, { label: (0,external_wp_i18n_namespaceObject.__)('Underline'), value: 'underline', icon: format_underline }, { label: (0,external_wp_i18n_namespaceObject.__)('Strikethrough'), value: 'line-through', icon: format_strikethrough }]; /** * Control to facilitate text decoration selections. * * @param {Object} props Component props. * @param {string} props.value Currently selected text decoration. * @param {Function} props.onChange Handles change in text decoration selection. * @param {string} props.className Additional class name to apply. * * @return {Element} Text decoration control. */ function TextDecorationControl({ value, onChange, className }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { isDeselectable: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Decoration'), className: dist_clsx('block-editor-text-decoration-control', className), value: value, onChange: newValue => { onChange(newValue === value ? undefined : newValue); }, children: TEXT_DECORATIONS.map(option => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: option.value, icon: option.icon, label: option.label }, option.value); }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/text-horizontal.js /** * WordPress dependencies */ const textHorizontal = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M8.2 14.4h3.9L13 17h1.7L11 6.5H9.3L5.6 17h1.7l.9-2.6zm2-5.5 1.4 4H8.8l1.4-4zm7.4 7.5-1.3.8.8 1.4H5.5V20h14.3l-2.2-3.6z" }) }); /* harmony default export */ const text_horizontal = (textHorizontal); ;// ./node_modules/@wordpress/icons/build-module/library/text-vertical.js /** * WordPress dependencies */ const textVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 5.6v1.7l2.6.9v3.9L7 13v1.7L17.5 11V9.3L7 5.6zm4.2 6V8.8l4 1.4-4 1.4zm-5.7 5.6V5.5H4v14.3l3.6-2.2-.8-1.3-1.3.9z" }) }); /* harmony default export */ const text_vertical = (textVertical); ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-mode-control/index.js /** * External dependencies */ /** * WordPress dependencies */ const WRITING_MODES = [{ label: (0,external_wp_i18n_namespaceObject.__)('Horizontal'), value: 'horizontal-tb', icon: text_horizontal }, { label: (0,external_wp_i18n_namespaceObject.__)('Vertical'), value: (0,external_wp_i18n_namespaceObject.isRTL)() ? 'vertical-lr' : 'vertical-rl', icon: text_vertical }]; /** * Control to facilitate writing mode selections. * * @param {Object} props Component props. * @param {string} props.className Class name to add to the control. * @param {string} props.value Currently selected writing mode. * @param {Function} props.onChange Handles change in the writing mode selection. * * @return {Element} Writing Mode control. */ function WritingModeControl({ className, value, onChange }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { isDeselectable: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Orientation'), className: dist_clsx('block-editor-writing-mode-control', className), value: value, onChange: newValue => { onChange(newValue === value ? undefined : newValue); }, children: WRITING_MODES.map(option => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: option.value, icon: option.icon, label: option.label }, option.value); }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const MIN_TEXT_COLUMNS = 1; const MAX_TEXT_COLUMNS = 6; function useHasTypographyPanel(settings) { const hasFontFamily = useHasFontFamilyControl(settings); const hasLineHeight = useHasLineHeightControl(settings); const hasFontAppearance = useHasAppearanceControl(settings); const hasLetterSpacing = useHasLetterSpacingControl(settings); const hasTextAlign = useHasTextAlignmentControl(settings); const hasTextTransform = useHasTextTransformControl(settings); const hasTextDecoration = useHasTextDecorationControl(settings); const hasWritingMode = useHasWritingModeControl(settings); const hasTextColumns = useHasTextColumnsControl(settings); const hasFontSize = useHasFontSizeControl(settings); return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextAlign || hasTextTransform || hasFontSize || hasTextDecoration || hasWritingMode || hasTextColumns; } function useHasFontSizeControl(settings) { return settings?.typography?.defaultFontSizes !== false && settings?.typography?.fontSizes?.default?.length || settings?.typography?.fontSizes?.theme?.length || settings?.typography?.fontSizes?.custom?.length || settings?.typography?.customFontSize; } function useHasFontFamilyControl(settings) { return ['default', 'theme', 'custom'].some(key => settings?.typography?.fontFamilies?.[key]?.length); } function useHasLineHeightControl(settings) { return settings?.typography?.lineHeight; } function useHasAppearanceControl(settings) { return settings?.typography?.fontStyle || settings?.typography?.fontWeight; } function useAppearanceControlLabel(settings) { if (!settings?.typography?.fontStyle) { return (0,external_wp_i18n_namespaceObject.__)('Font weight'); } if (!settings?.typography?.fontWeight) { return (0,external_wp_i18n_namespaceObject.__)('Font style'); } return (0,external_wp_i18n_namespaceObject.__)('Appearance'); } function useHasLetterSpacingControl(settings) { return settings?.typography?.letterSpacing; } function useHasTextTransformControl(settings) { return settings?.typography?.textTransform; } function useHasTextAlignmentControl(settings) { return settings?.typography?.textAlign; } function useHasTextDecorationControl(settings) { return settings?.typography?.textDecoration; } function useHasWritingModeControl(settings) { return settings?.typography?.writingMode; } function useHasTextColumnsControl(settings) { return settings?.typography?.textColumns; } /** * Concatenate all the font sizes into a single list for the font size picker. * * @param {Object} settings The global styles settings. * * @return {Array} The merged font sizes. */ function getMergedFontSizes(settings) { var _fontSizes$custom, _fontSizes$theme, _fontSizes$default; const fontSizes = settings?.typography?.fontSizes; const defaultFontSizesEnabled = !!settings?.typography?.defaultFontSizes; return [...((_fontSizes$custom = fontSizes?.custom) !== null && _fontSizes$custom !== void 0 ? _fontSizes$custom : []), ...((_fontSizes$theme = fontSizes?.theme) !== null && _fontSizes$theme !== void 0 ? _fontSizes$theme : []), ...(defaultFontSizesEnabled ? (_fontSizes$default = fontSizes?.default) !== null && _fontSizes$default !== void 0 ? _fontSizes$default : [] : [])]; } function TypographyToolsPanel({ resetAllFilter, onChange, value, panelId, children }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)('Typography'), resetAll: resetAll, panelId: panelId, dropdownMenuProps: dropdownMenuProps, children: children }); } const typography_panel_DEFAULT_CONTROLS = { fontFamily: true, fontSize: true, fontAppearance: true, lineHeight: true, letterSpacing: true, textAlign: true, textTransform: true, textDecoration: true, writingMode: true, textColumns: true }; function TypographyPanel({ as: Wrapper = TypographyToolsPanel, value, onChange, inheritedValue = value, settings, panelId, defaultControls = typography_panel_DEFAULT_CONTROLS }) { const decodeValue = rawValue => getValueFromVariable({ settings }, '', rawValue); // Font Family const hasFontFamilyEnabled = useHasFontFamilyControl(settings); const fontFamily = decodeValue(inheritedValue?.typography?.fontFamily); const { fontFamilies, fontFamilyFaces } = (0,external_wp_element_namespaceObject.useMemo)(() => { return getMergedFontFamiliesAndFontFamilyFaces(settings, fontFamily); }, [settings, fontFamily]); const setFontFamily = newValue => { const slug = fontFamilies?.find(({ fontFamily: f }) => f === newValue)?.slug; onChange(setImmutably(value, ['typography', 'fontFamily'], slug ? `var:preset|font-family|${slug}` : newValue || undefined)); }; const hasFontFamily = () => !!value?.typography?.fontFamily; const resetFontFamily = () => setFontFamily(undefined); // Font Size const hasFontSizeEnabled = useHasFontSizeControl(settings); const disableCustomFontSizes = !settings?.typography?.customFontSize; const mergedFontSizes = getMergedFontSizes(settings); const fontSize = decodeValue(inheritedValue?.typography?.fontSize); const setFontSize = (newValue, metadata) => { const actualValue = !!metadata?.slug ? `var:preset|font-size|${metadata?.slug}` : newValue; onChange(setImmutably(value, ['typography', 'fontSize'], actualValue || undefined)); }; const hasFontSize = () => !!value?.typography?.fontSize; const resetFontSize = () => setFontSize(undefined); // Appearance const hasAppearanceControl = useHasAppearanceControl(settings); const appearanceControlLabel = useAppearanceControlLabel(settings); const hasFontStyles = settings?.typography?.fontStyle; const hasFontWeights = settings?.typography?.fontWeight; const fontStyle = decodeValue(inheritedValue?.typography?.fontStyle); const fontWeight = decodeValue(inheritedValue?.typography?.fontWeight); const { nearestFontStyle, nearestFontWeight } = findNearestStyleAndWeight(fontFamilyFaces, fontStyle, fontWeight); const setFontAppearance = (0,external_wp_element_namespaceObject.useCallback)(({ fontStyle: newFontStyle, fontWeight: newFontWeight }) => { // Only update the font style and weight if they have changed. if (newFontStyle !== fontStyle || newFontWeight !== fontWeight) { onChange({ ...value, typography: { ...value?.typography, fontStyle: newFontStyle || undefined, fontWeight: newFontWeight || undefined } }); } }, [fontStyle, fontWeight, onChange, value]); const hasFontAppearance = () => !!value?.typography?.fontStyle || !!value?.typography?.fontWeight; const resetFontAppearance = (0,external_wp_element_namespaceObject.useCallback)(() => { setFontAppearance({}); }, [setFontAppearance]); // Check if previous font style and weight values are available in the new font family. (0,external_wp_element_namespaceObject.useEffect)(() => { if (nearestFontStyle && nearestFontWeight) { setFontAppearance({ fontStyle: nearestFontStyle, fontWeight: nearestFontWeight }); } else { // Reset font appearance if there are no available styles or weights. resetFontAppearance(); } }, [nearestFontStyle, nearestFontWeight, resetFontAppearance, setFontAppearance]); // Line Height const hasLineHeightEnabled = useHasLineHeightControl(settings); const lineHeight = decodeValue(inheritedValue?.typography?.lineHeight); const setLineHeight = newValue => { onChange(setImmutably(value, ['typography', 'lineHeight'], newValue || undefined)); }; const hasLineHeight = () => value?.typography?.lineHeight !== undefined; const resetLineHeight = () => setLineHeight(undefined); // Letter Spacing const hasLetterSpacingControl = useHasLetterSpacingControl(settings); const letterSpacing = decodeValue(inheritedValue?.typography?.letterSpacing); const setLetterSpacing = newValue => { onChange(setImmutably(value, ['typography', 'letterSpacing'], newValue || undefined)); }; const hasLetterSpacing = () => !!value?.typography?.letterSpacing; const resetLetterSpacing = () => setLetterSpacing(undefined); // Text Columns const hasTextColumnsControl = useHasTextColumnsControl(settings); const textColumns = decodeValue(inheritedValue?.typography?.textColumns); const setTextColumns = newValue => { onChange(setImmutably(value, ['typography', 'textColumns'], newValue || undefined)); }; const hasTextColumns = () => !!value?.typography?.textColumns; const resetTextColumns = () => setTextColumns(undefined); // Text Transform const hasTextTransformControl = useHasTextTransformControl(settings); const textTransform = decodeValue(inheritedValue?.typography?.textTransform); const setTextTransform = newValue => { onChange(setImmutably(value, ['typography', 'textTransform'], newValue || undefined)); }; const hasTextTransform = () => !!value?.typography?.textTransform; const resetTextTransform = () => setTextTransform(undefined); // Text Decoration const hasTextDecorationControl = useHasTextDecorationControl(settings); const textDecoration = decodeValue(inheritedValue?.typography?.textDecoration); const setTextDecoration = newValue => { onChange(setImmutably(value, ['typography', 'textDecoration'], newValue || undefined)); }; const hasTextDecoration = () => !!value?.typography?.textDecoration; const resetTextDecoration = () => setTextDecoration(undefined); // Text Orientation const hasWritingModeControl = useHasWritingModeControl(settings); const writingMode = decodeValue(inheritedValue?.typography?.writingMode); const setWritingMode = newValue => { onChange(setImmutably(value, ['typography', 'writingMode'], newValue || undefined)); }; const hasWritingMode = () => !!value?.typography?.writingMode; const resetWritingMode = () => setWritingMode(undefined); // Text Alignment const hasTextAlignmentControl = useHasTextAlignmentControl(settings); const textAlign = decodeValue(inheritedValue?.typography?.textAlign); const setTextAlign = newValue => { onChange(setImmutably(value, ['typography', 'textAlign'], newValue || undefined)); }; const hasTextAlign = () => !!value?.typography?.textAlign; const resetTextAlign = () => setTextAlign(undefined); const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { return { ...previousValue, typography: {} }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, panelId: panelId, children: [hasFontFamilyEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Font'), hasValue: hasFontFamily, onDeselect: resetFontFamily, isShownByDefault: defaultControls.fontFamily, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilyControl, { fontFamilies: fontFamilies, value: fontFamily, onChange: setFontFamily, size: "__unstable-large", __nextHasNoMarginBottom: true }) }), hasFontSizeEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Size'), hasValue: hasFontSize, onDeselect: resetFontSize, isShownByDefault: defaultControls.fontSize, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FontSizePicker, { value: fontSize, onChange: setFontSize, fontSizes: mergedFontSizes, disableCustomFontSizes: disableCustomFontSizes, withReset: false, withSlider: true, size: "__unstable-large" }) }), hasAppearanceControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: appearanceControlLabel, hasValue: hasFontAppearance, onDeselect: resetFontAppearance, isShownByDefault: defaultControls.fontAppearance, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontAppearanceControl, { value: { fontStyle, fontWeight }, onChange: setFontAppearance, hasFontStyles: hasFontStyles, hasFontWeights: hasFontWeights, fontFamilyFaces: fontFamilyFaces, size: "__unstable-large" }) }), hasLineHeightEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)('Line height'), hasValue: hasLineHeight, onDeselect: resetLineHeight, isShownByDefault: defaultControls.lineHeight, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(line_height_control, { __unstableInputWidth: "auto", value: lineHeight, onChange: setLineHeight, size: "__unstable-large" }) }), hasLetterSpacingControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)('Letter spacing'), hasValue: hasLetterSpacing, onDeselect: resetLetterSpacing, isShownByDefault: defaultControls.letterSpacing, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LetterSpacingControl, { value: letterSpacing, onChange: setLetterSpacing, size: "__unstable-large", __unstableInputWidth: "auto" }) }), hasTextColumnsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)('Columns'), hasValue: hasTextColumns, onDeselect: resetTextColumns, isShownByDefault: defaultControls.textColumns, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { label: (0,external_wp_i18n_namespaceObject.__)('Columns'), max: MAX_TEXT_COLUMNS, min: MIN_TEXT_COLUMNS, onChange: setTextColumns, size: "__unstable-large", spinControls: "custom", value: textColumns, initialPosition: 1 }) }), hasTextDecorationControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)('Decoration'), hasValue: hasTextDecoration, onDeselect: resetTextDecoration, isShownByDefault: defaultControls.textDecoration, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextDecorationControl, { value: textDecoration, onChange: setTextDecoration, size: "__unstable-large", __unstableInputWidth: "auto" }) }), hasWritingModeControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)('Orientation'), hasValue: hasWritingMode, onDeselect: resetWritingMode, isShownByDefault: defaultControls.writingMode, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WritingModeControl, { value: writingMode, onChange: setWritingMode, size: "__unstable-large", __nextHasNoMarginBottom: true }) }), hasTextTransformControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Letter case'), hasValue: hasTextTransform, onDeselect: resetTextTransform, isShownByDefault: defaultControls.textTransform, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextTransformControl, { value: textTransform, onChange: setTextTransform, showNone: true, isBlock: true, size: "__unstable-large", __nextHasNoMarginBottom: true }) }), hasTextAlignmentControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Text alignment'), hasValue: hasTextAlign, onDeselect: resetTextAlign, isShownByDefault: defaultControls.textAlign, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextAlignmentControl, { value: textAlign, onChange: setTextAlign, size: "__unstable-large", __nextHasNoMarginBottom: true }) })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/line-height.js /** * WordPress dependencies */ /** * Internal dependencies */ const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight'; /** * Inspector control panel containing the line height related configuration * * @param {Object} props * * @return {Element} Line height edit element. */ function LineHeightEdit(props) { const { attributes: { style }, setAttributes } = props; const onChange = newLineHeightValue => { const newStyle = { ...style, typography: { ...style?.typography, lineHeight: newLineHeightValue } }; setAttributes({ style: cleanEmptyObject(newStyle) }); }; return /*#__PURE__*/_jsx(LineHeightControl, { __unstableInputWidth: "100%", value: style?.typography?.lineHeight, onChange: onChange, size: "__unstable-large" }); } /** * Custom hook that checks if line-height settings have been disabled. * * @param {string} name The name of the block. * @return {boolean} Whether setting is disabled. */ function useIsLineHeightDisabled({ name: blockName } = {}) { const [isEnabled] = useSettings('typography.lineHeight'); return !isEnabled || !hasBlockSupport(blockName, LINE_HEIGHT_SUPPORT_KEY); } ;// external ["wp","tokenList"] const external_wp_tokenList_namespaceObject = window["wp"]["tokenList"]; var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_wp_tokenList_namespaceObject); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/font-family.js /** * WordPress dependencies */ /** * Internal dependencies */ const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily'; const { kebabCase: font_family_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); /** * Filters registered block settings, extending attributes to include * the `fontFamily` attribute. * * @param {Object} settings Original block settings * @return {Object} Filtered block settings */ function font_family_addAttributes(settings) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_FAMILY_SUPPORT_KEY)) { return settings; } // Allow blocks to specify a default value if needed. if (!settings.attributes.fontFamily) { Object.assign(settings.attributes, { fontFamily: { type: 'string' } }); } return settings; } /** * Override props assigned to save component to inject font family. * * @param {Object} props Additional props applied to save element * @param {Object} blockType Block type * @param {Object} attributes Block attributes * @return {Object} Filtered props applied to save element */ function font_family_addSaveProps(props, blockType, attributes) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FONT_FAMILY_SUPPORT_KEY)) { return props; } if (shouldSkipSerialization(blockType, TYPOGRAPHY_SUPPORT_KEY, 'fontFamily')) { return props; } if (!attributes?.fontFamily) { return props; } // Use TokenList to dedupe classes. const classes = new (external_wp_tokenList_default())(props.className); classes.add(`has-${font_family_kebabCase(attributes?.fontFamily)}-font-family`); const newClassName = classes.value; props.className = newClassName ? newClassName : undefined; return props; } function font_family_useBlockProps({ name, fontFamily }) { return font_family_addSaveProps({}, name, { fontFamily }); } /* harmony default export */ const font_family = ({ useBlockProps: font_family_useBlockProps, addSaveProps: font_family_addSaveProps, attributeKeys: ['fontFamily'], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY); } }); /** * Resets the font family block support attribute. This can be used when * disabling the font family support controls for a block via a progressive * discovery panel. * * @param {Object} props Block props. * @param {Object} props.setAttributes Function to set block's attributes. */ function resetFontFamily({ setAttributes }) { setAttributes({ fontFamily: undefined }); } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/fontFamily/addAttribute', font_family_addAttributes); ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ const { kebabCase: utils_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); /** * Returns the font size object based on an array of named font sizes and the namedFontSize and customFontSize values. * If namedFontSize is undefined or not found in fontSizes an object with just the size value based on customFontSize is returned. * * @param {Array} fontSizes Array of font size objects containing at least the "name" and "size" values as properties. * @param {?string} fontSizeAttribute Content of the font size attribute (slug). * @param {?number} customFontSizeAttribute Contents of the custom font size attribute (value). * * @return {?Object} If fontSizeAttribute is set and an equal slug is found in fontSizes it returns the font size object for that slug. * Otherwise, an object with just the size value based on customFontSize is returned. */ const utils_getFontSize = (fontSizes, fontSizeAttribute, customFontSizeAttribute) => { if (fontSizeAttribute) { const fontSizeObject = fontSizes?.find(({ slug }) => slug === fontSizeAttribute); if (fontSizeObject) { return fontSizeObject; } } return { size: customFontSizeAttribute }; }; /** * Returns the corresponding font size object for a given value. * * @param {Array} fontSizes Array of font size objects. * @param {number} value Font size value. * * @return {Object} Font size object. */ function utils_getFontSizeObjectByValue(fontSizes, value) { const fontSizeObject = fontSizes?.find(({ size }) => size === value); if (fontSizeObject) { return fontSizeObject; } return { size: value }; } /** * Returns a class based on fontSizeName. * * @param {string} fontSizeSlug Slug of the fontSize. * * @return {string | undefined} String with the class corresponding to the fontSize passed. * The class is generated by appending 'has-' followed by fontSizeSlug in kebabCase and ending with '-font-size'. */ function getFontSizeClass(fontSizeSlug) { if (!fontSizeSlug) { return; } return `has-${utils_kebabCase(fontSizeSlug)}-font-size`; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/font-size.js /** * WordPress dependencies */ /** * Internal dependencies */ const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize'; /** * Filters registered block settings, extending attributes to include * `fontSize` and `fontWeight` attributes. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function font_size_addAttributes(settings) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_SIZE_SUPPORT_KEY)) { return settings; } // Allow blocks to specify a default value if needed. if (!settings.attributes.fontSize) { Object.assign(settings.attributes, { fontSize: { type: 'string' } }); } return settings; } /** * Override props assigned to save component to inject font size. * * @param {Object} props Additional props applied to save element. * @param {Object} blockNameOrType Block type. * @param {Object} attributes Block attributes. * * @return {Object} Filtered props applied to save element. */ function font_size_addSaveProps(props, blockNameOrType, attributes) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockNameOrType, FONT_SIZE_SUPPORT_KEY)) { return props; } if (shouldSkipSerialization(blockNameOrType, TYPOGRAPHY_SUPPORT_KEY, 'fontSize')) { return props; } // Use TokenList to dedupe classes. const classes = new (external_wp_tokenList_default())(props.className); classes.add(getFontSizeClass(attributes.fontSize)); const newClassName = classes.value; props.className = newClassName ? newClassName : undefined; return props; } /** * Inspector control panel containing the font size related configuration * * @param {Object} props * * @return {Element} Font size edit element. */ function FontSizeEdit(props) { const { attributes: { fontSize, style }, setAttributes } = props; const [fontSizes] = useSettings('typography.fontSizes'); const onChange = value => { const fontSizeSlug = getFontSizeObjectByValue(fontSizes, value).slug; setAttributes({ style: cleanEmptyObject({ ...style, typography: { ...style?.typography, fontSize: fontSizeSlug ? undefined : value } }), fontSize: fontSizeSlug }); }; const fontSizeObject = getFontSize(fontSizes, fontSize, style?.typography?.fontSize); const fontSizeValue = fontSizeObject?.size || style?.typography?.fontSize || fontSize; return /*#__PURE__*/_jsx(FontSizePicker, { onChange: onChange, value: fontSizeValue, withReset: false, withSlider: true, size: "__unstable-large" }); } /** * Custom hook that checks if font-size settings have been disabled. * * @param {string} name The name of the block. * @return {boolean} Whether setting is disabled. */ function useIsFontSizeDisabled({ name: blockName } = {}) { const [fontSizes] = useSettings('typography.fontSizes'); const hasFontSizes = !!fontSizes?.length; return !hasBlockSupport(blockName, FONT_SIZE_SUPPORT_KEY) || !hasFontSizes; } function font_size_useBlockProps({ name, fontSize, style }) { const [fontSizes, fluidTypographySettings, layoutSettings] = use_settings_useSettings('typography.fontSizes', 'typography.fluid', 'layout'); /* * Only add inline styles if the block supports font sizes, * doesn't skip serialization of font sizes, * and has either a custom font size or a preset font size. */ if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY) || shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, 'fontSize') || !fontSize && !style?.typography?.fontSize) { return; } let props; if (style?.typography?.fontSize) { props = { style: { fontSize: getTypographyFontSizeValue({ size: style.typography.fontSize }, { typography: { fluid: fluidTypographySettings }, layout: layoutSettings }) } }; } if (fontSize) { props = { style: { fontSize: utils_getFontSize(fontSizes, fontSize, style?.typography?.fontSize).size } }; } if (!props) { return; } return font_size_addSaveProps(props, name, { fontSize }); } /* harmony default export */ const font_size = ({ useBlockProps: font_size_useBlockProps, addSaveProps: font_size_addSaveProps, attributeKeys: ['fontSize', 'style'], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY); } }); const font_size_MIGRATION_PATHS = { fontSize: [['fontSize'], ['style', 'typography', 'fontSize']] }; function font_size_addTransforms(result, source, index, results) { const destinationBlockType = result.name; const activeSupports = { fontSize: (0,external_wp_blocks_namespaceObject.hasBlockSupport)(destinationBlockType, FONT_SIZE_SUPPORT_KEY) }; return transformStyles(activeSupports, font_size_MIGRATION_PATHS, result, source, index, results); } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/font/addAttribute', font_size_addAttributes); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/font-size/addTransforms', font_size_addTransforms); ;// ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js /** * WordPress dependencies */ const DEFAULT_ALIGNMENT_CONTROLS = [{ icon: align_left, title: (0,external_wp_i18n_namespaceObject.__)('Align text left'), align: 'left' }, { icon: align_center, title: (0,external_wp_i18n_namespaceObject.__)('Align text center'), align: 'center' }, { icon: align_right, title: (0,external_wp_i18n_namespaceObject.__)('Align text right'), align: 'right' }]; const ui_POPOVER_PROPS = { placement: 'bottom-start' }; function AlignmentUI({ value, onChange, alignmentControls = DEFAULT_ALIGNMENT_CONTROLS, label = (0,external_wp_i18n_namespaceObject.__)('Align text'), description = (0,external_wp_i18n_namespaceObject.__)('Change text alignment'), isCollapsed = true, isToolbar }) { function applyOrUnset(align) { return () => onChange(value === align ? undefined : align); } const activeAlignment = alignmentControls.find(control => control.align === value); function setIcon() { if (activeAlignment) { return activeAlignment.icon; } return (0,external_wp_i18n_namespaceObject.isRTL)() ? align_right : align_left; } const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; const extraProps = isToolbar ? { isCollapsed } : { toggleProps: { description }, popoverProps: ui_POPOVER_PROPS }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { icon: setIcon(), label: label, controls: alignmentControls.map(control => { const { align } = control; const isActive = value === align; return { ...control, isActive, role: isCollapsed ? 'menuitemradio' : undefined, onClick: applyOrUnset(align) }; }), ...extraProps }); } /* harmony default export */ const alignment_control_ui = (AlignmentUI); ;// ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js /** * Internal dependencies */ const AlignmentControl = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui, { ...props, isToolbar: false }); }; const AlignmentToolbar = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui, { ...props, isToolbar: true }); }; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/alignment-control/README.md */ ;// ./node_modules/@wordpress/block-editor/build-module/hooks/text-align.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const TEXT_ALIGN_SUPPORT_KEY = 'typography.textAlign'; const text_align_TEXT_ALIGNMENT_OPTIONS = [{ icon: align_left, title: (0,external_wp_i18n_namespaceObject.__)('Align text left'), align: 'left' }, { icon: align_center, title: (0,external_wp_i18n_namespaceObject.__)('Align text center'), align: 'center' }, { icon: align_right, title: (0,external_wp_i18n_namespaceObject.__)('Align text right'), align: 'right' }]; const VALID_TEXT_ALIGNMENTS = ['left', 'center', 'right']; const NO_TEXT_ALIGNMENTS = []; /** * Returns the valid text alignments. * Takes into consideration the text aligns supported by a block. * Exported just for testing purposes, not exported outside the module. * * @param {?boolean|string[]} blockTextAlign Text aligns supported by the block. * * @return {string[]} Valid text alignments. */ function getValidTextAlignments(blockTextAlign) { if (Array.isArray(blockTextAlign)) { return VALID_TEXT_ALIGNMENTS.filter(textAlign => blockTextAlign.includes(textAlign)); } return blockTextAlign === true ? VALID_TEXT_ALIGNMENTS : NO_TEXT_ALIGNMENTS; } function BlockEditTextAlignmentToolbarControlsPure({ style, name: blockName, setAttributes }) { const settings = useBlockSettings(blockName); const hasTextAlignControl = settings?.typography?.textAlign; const blockEditingMode = useBlockEditingMode(); if (!hasTextAlignControl || blockEditingMode !== 'default') { return null; } const validTextAlignments = getValidTextAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, TEXT_ALIGN_SUPPORT_KEY)); if (!validTextAlignments.length) { return null; } const textAlignmentControls = text_align_TEXT_ALIGNMENT_OPTIONS.filter(control => validTextAlignments.includes(control.align)); const onChange = newTextAlignValue => { const newStyle = { ...style, typography: { ...style?.typography, textAlign: newTextAlignValue } }; setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { group: "block", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AlignmentControl, { value: style?.typography?.textAlign, onChange: onChange, alignmentControls: textAlignmentControls }) }); } /* harmony default export */ const text_align = ({ edit: BlockEditTextAlignmentToolbarControlsPure, useBlockProps: text_align_useBlockProps, addSaveProps: addAssignedTextAlign, attributeKeys: ['style'], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY, false); } }); function text_align_useBlockProps({ name, style }) { if (!style?.typography?.textAlign) { return null; } const validTextAlignments = getValidTextAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY)); if (!validTextAlignments.length) { return null; } if (shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, 'textAlign')) { return null; } const textAlign = style.typography.textAlign; const className = dist_clsx({ [`has-text-align-${textAlign}`]: textAlign }); return { className }; } /** * Override props assigned to save component to inject text alignment class * name if block supports it. * * @param {Object} props Additional props applied to save element. * @param {Object} blockType Block type. * @param {Object} attributes Block attributes. * * @return {Object} Filtered props applied to save element. */ function addAssignedTextAlign(props, blockType, attributes) { if (!attributes?.style?.typography?.textAlign) { return props; } const { textAlign } = attributes.style.typography; const blockTextAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, TEXT_ALIGN_SUPPORT_KEY); const isTextAlignValid = getValidTextAlignments(blockTextAlign).includes(textAlign); if (isTextAlignValid && !shouldSkipSerialization(blockType, TYPOGRAPHY_SUPPORT_KEY, 'textAlign')) { props.className = dist_clsx(`has-text-align-${textAlign}`, props.className); } return props; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js /** * WordPress dependencies */ /** * Internal dependencies */ function omit(object, keys) { return Object.fromEntries(Object.entries(object).filter(([key]) => !keys.includes(key))); } const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing'; const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform'; const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration'; const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns'; const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle'; const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight'; const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode'; const TYPOGRAPHY_SUPPORT_KEY = 'typography'; const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_ALIGN_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, WRITING_MODE_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY]; function typography_styleToAttributes(style) { const updatedStyle = { ...omit(style, ['fontFamily']) }; const fontSizeValue = style?.typography?.fontSize; const fontFamilyValue = style?.typography?.fontFamily; const fontSizeSlug = fontSizeValue?.startsWith('var:preset|font-size|') ? fontSizeValue.substring('var:preset|font-size|'.length) : undefined; const fontFamilySlug = fontFamilyValue?.startsWith('var:preset|font-family|') ? fontFamilyValue.substring('var:preset|font-family|'.length) : undefined; updatedStyle.typography = { ...omit(updatedStyle.typography, ['fontFamily']), fontSize: fontSizeSlug ? undefined : fontSizeValue }; return { style: utils_cleanEmptyObject(updatedStyle), fontFamily: fontFamilySlug, fontSize: fontSizeSlug }; } function typography_attributesToStyle(attributes) { return { ...attributes.style, typography: { ...attributes.style?.typography, fontFamily: attributes.fontFamily ? 'var:preset|font-family|' + attributes.fontFamily : undefined, fontSize: attributes.fontSize ? 'var:preset|font-size|' + attributes.fontSize : attributes.style?.typography?.fontSize } }; } function TypographyInspectorControl({ children, resetAllFilter }) { const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => { const existingStyle = typography_attributesToStyle(attributes); const updatedStyle = resetAllFilter(existingStyle); return { ...attributes, ...typography_styleToAttributes(updatedStyle) }; }, [resetAllFilter]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "typography", resetAllFilter: attributesResetAllFilter, children: children }); } function typography_TypographyPanel({ clientId, name, setAttributes, settings }) { function selector(select) { const { style, fontFamily, fontSize } = select(store).getBlockAttributes(clientId) || {}; return { style, fontFamily, fontSize }; } const { style, fontFamily, fontSize } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]); const isEnabled = useHasTypographyPanel(settings); const value = (0,external_wp_element_namespaceObject.useMemo)(() => typography_attributesToStyle({ style, fontFamily, fontSize }), [style, fontSize, fontFamily]); const onChange = newStyle => { setAttributes(typography_styleToAttributes(newStyle)); }; if (!isEnabled) { return null; } const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPanel, { as: TypographyInspectorControl, panelId: clientId, settings: settings, value: value, onChange: onChange, defaultControls: defaultControls }); } const hasTypographySupport = blockName => { return TYPOGRAPHY_SUPPORT_KEYS.some(key => hasBlockSupport(blockName, key)); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js /** * WordPress dependencies */ /** * Internal dependencies */ const use_spacing_sizes_EMPTY_ARRAY = []; const compare = new Intl.Collator('und', { numeric: true }).compare; function useSpacingSizes() { const [customSpacingSizes, themeSpacingSizes, defaultSpacingSizes, defaultSpacingSizesEnabled] = use_settings_useSettings('spacing.spacingSizes.custom', 'spacing.spacingSizes.theme', 'spacing.spacingSizes.default', 'spacing.defaultSpacingSizes'); const customSizes = customSpacingSizes !== null && customSpacingSizes !== void 0 ? customSpacingSizes : use_spacing_sizes_EMPTY_ARRAY; const themeSizes = themeSpacingSizes !== null && themeSpacingSizes !== void 0 ? themeSpacingSizes : use_spacing_sizes_EMPTY_ARRAY; const defaultSizes = defaultSpacingSizes && defaultSpacingSizesEnabled !== false ? defaultSpacingSizes : use_spacing_sizes_EMPTY_ARRAY; return (0,external_wp_element_namespaceObject.useMemo)(() => { const sizes = [{ name: (0,external_wp_i18n_namespaceObject.__)('None'), slug: '0', size: 0 }, ...customSizes, ...themeSizes, ...defaultSizes]; // Using numeric slugs opts-in to sorting by slug. if (sizes.every(({ slug }) => /^[0-9]/.test(slug))) { sizes.sort((a, b) => compare(a.slug, b.slug)); } return sizes.length > RANGE_CONTROL_MAX_SIZE ? [{ name: (0,external_wp_i18n_namespaceObject.__)('Default'), slug: 'default', size: undefined }, ...sizes] : sizes; }, [customSizes, themeSizes, defaultSizes]); } ;// ./node_modules/@wordpress/icons/build-module/library/settings.js /** * WordPress dependencies */ const settings_settings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" })] }); /* harmony default export */ const library_settings = (settings_settings); ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js /** * WordPress dependencies */ /** * Internal dependencies */ const CUSTOM_VALUE_SETTINGS = { px: { max: 300, steps: 1 }, '%': { max: 100, steps: 1 }, vw: { max: 100, steps: 1 }, vh: { max: 100, steps: 1 }, em: { max: 10, steps: 0.1 }, rm: { max: 10, steps: 0.1 }, svw: { max: 100, steps: 1 }, lvw: { max: 100, steps: 1 }, dvw: { max: 100, steps: 1 }, svh: { max: 100, steps: 1 }, lvh: { max: 100, steps: 1 }, dvh: { max: 100, steps: 1 }, vi: { max: 100, steps: 1 }, svi: { max: 100, steps: 1 }, lvi: { max: 100, steps: 1 }, dvi: { max: 100, steps: 1 }, vb: { max: 100, steps: 1 }, svb: { max: 100, steps: 1 }, lvb: { max: 100, steps: 1 }, dvb: { max: 100, steps: 1 }, vmin: { max: 100, steps: 1 }, svmin: { max: 100, steps: 1 }, lvmin: { max: 100, steps: 1 }, dvmin: { max: 100, steps: 1 }, vmax: { max: 100, steps: 1 }, svmax: { max: 100, steps: 1 }, lvmax: { max: 100, steps: 1 }, dvmax: { max: 100, steps: 1 } }; function SpacingInputControl({ icon, isMixed = false, minimumCustomValue, onChange, onMouseOut, onMouseOver, showSideInLabel = true, side, spacingSizes, type, value }) { var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2; // Treat value as a preset value if the passed in value matches the value of one of the spacingSizes. value = getPresetValueFromCustomValue(value, spacingSizes); let selectListSizes = spacingSizes; const showRangeControl = spacingSizes.length <= RANGE_CONTROL_MAX_SIZE; const disableCustomSpacingSizes = (0,external_wp_data_namespaceObject.useSelect)(select => { const editorSettings = select(store).getSettings(); return editorSettings?.disableCustomSpacingSizes; }); const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(!disableCustomSpacingSizes && value !== undefined && !isValueSpacingPreset(value)); const [minValue, setMinValue] = (0,external_wp_element_namespaceObject.useState)(minimumCustomValue); const previousValue = (0,external_wp_compose_namespaceObject.usePrevious)(value); if (!!value && previousValue !== value && !isValueSpacingPreset(value) && showCustomValueControl !== true) { setShowCustomValueControl(true); } const [availableUnits] = use_settings_useSettings('spacing.units'); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ['px', 'em', 'rem'] }); let currentValue = null; const showCustomValueInSelectList = !showRangeControl && !showCustomValueControl && value !== undefined && (!isValueSpacingPreset(value) || isValueSpacingPreset(value) && isMixed); if (showCustomValueInSelectList) { selectListSizes = [...spacingSizes, { name: !isMixed ? // translators: %s: A custom measurement, e.g. a number followed by a unit like 12px. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Custom (%s)'), value) : (0,external_wp_i18n_namespaceObject.__)('Mixed'), slug: 'custom', size: value }]; currentValue = selectListSizes.length - 1; } else if (!isMixed) { currentValue = !showCustomValueControl ? getSliderValueFromPreset(value, spacingSizes) : getCustomValueFromPreset(value, spacingSizes); } const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(currentValue), [currentValue])[1] || units[0]?.value; const setInitialValue = () => { if (value === undefined) { onChange('0'); } }; const customTooltipContent = newValue => value === undefined ? undefined : spacingSizes[newValue]?.name; const customRangeValue = parseFloat(currentValue, 10); const getNewCustomValue = newSize => { const isNumeric = !isNaN(parseFloat(newSize)); const nextValue = isNumeric ? newSize : undefined; return nextValue; }; const getNewPresetValue = (newSize, controlType) => { const size = parseInt(newSize, 10); if (controlType === 'selectList') { if (size === 0) { return undefined; } if (size === 1) { return '0'; } } else if (size === 0) { return '0'; } return `var:preset|spacing|${spacingSizes[newSize]?.slug}`; }; const handleCustomValueSliderChange = next => { onChange([next, selectedUnit].join('')); }; const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : null; const options = selectListSizes.map((size, index) => ({ key: index, name: size.name })); const marks = spacingSizes.slice(1, spacingSizes.length - 1).map((_newValue, index) => ({ value: index + 1, label: undefined })); const sideLabel = ALL_SIDES.includes(side) && showSideInLabel ? LABELS[side] : ''; const typeLabel = showSideInLabel ? type?.toLowerCase() : type; const ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc). (0,external_wp_i18n_namespaceObject._x)('%1$s %2$s', 'spacing'), sideLabel, typeLabel).trim(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "spacing-sizes-control__wrapper", children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "spacing-sizes-control__icon", icon: icon, size: 24 }), showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { onMouseOver: onMouseOver, onMouseOut: onMouseOut, onFocus: onMouseOver, onBlur: onMouseOut, onChange: newSize => onChange(getNewCustomValue(newSize)), value: currentValue, units: units, min: minValue, placeholder: allPlaceholder, disableUnits: isMixed, label: ariaLabel, hideLabelFromVision: true, className: "spacing-sizes-control__custom-value-input", size: "__unstable-large", onDragStart: () => { if (value?.charAt(0) === '-') { setMinValue(0); } }, onDrag: () => { if (value?.charAt(0) === '-') { setMinValue(0); } }, onDragEnd: () => { setMinValue(minimumCustomValue); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, onMouseOver: onMouseOver, onMouseOut: onMouseOut, onFocus: onMouseOver, onBlur: onMouseOut, value: customRangeValue, min: 0, max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[selectedUnit]?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10, step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[selectedUnit]?.steps) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1, withInputField: false, onChange: handleCustomValueSliderChange, className: "spacing-sizes-control__custom-value-range", __nextHasNoMarginBottom: true, label: ariaLabel, hideLabelFromVision: true })] }), showRangeControl && !showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, onMouseOver: onMouseOver, onMouseOut: onMouseOut, className: "spacing-sizes-control__range-control", value: currentValue, onChange: newSize => onChange(getNewPresetValue(newSize)), onMouseDown: event => { // If mouse down is near start of range set initial value to 0, which // prevents the user have to drag right then left to get 0 setting. if (event?.nativeEvent?.offsetX < 35) { setInitialValue(); } }, withInputField: false, "aria-valuenow": currentValue, "aria-valuetext": spacingSizes[currentValue]?.name, renderTooltipContent: customTooltipContent, min: 0, max: spacingSizes.length - 1, marks: marks, label: ariaLabel, hideLabelFromVision: true, __nextHasNoMarginBottom: true, onFocus: onMouseOver, onBlur: onMouseOut }), !showRangeControl && !showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CustomSelectControl, { className: "spacing-sizes-control__custom-select-control", value: // passing empty string as a fallback to continue using the // component in controlled mode options.find(option => option.key === currentValue) || '', onChange: selection => { onChange(getNewPresetValue(selection.selectedItem.key, 'selectList')); }, options: options, label: ariaLabel, hideLabelFromVision: true, size: "__unstable-large", onMouseOver: onMouseOver, onMouseOut: onMouseOut, onFocus: onMouseOver, onBlur: onMouseOut }), !disableCustomSpacingSizes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'), icon: library_settings, onClick: () => { setShowCustomValueControl(!showCustomValueControl); }, isPressed: showCustomValueControl, size: "small", className: "spacing-sizes-control__custom-toggle", iconSize: 24 })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/axial.js /** * Internal dependencies */ const groupedSides = ['vertical', 'horizontal']; function AxialInputControls({ minimumCustomValue, onChange, onMouseOut, onMouseOver, sides, spacingSizes, type, values }) { const createHandleOnChange = side => next => { if (!onChange) { return; } // Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes. const nextValues = { ...Object.keys(values).reduce((acc, key) => { acc[key] = getPresetValueFromCustomValue(values[key], spacingSizes); return acc; }, {}) }; if (side === 'vertical') { nextValues.top = next; nextValues.bottom = next; } if (side === 'horizontal') { nextValues.left = next; nextValues.right = next; } onChange(nextValues); }; // Filter sides if custom configuration provided, maintaining default order. const filteredSides = sides?.length ? groupedSides.filter(side => hasAxisSupport(sides, side)) : groupedSides; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: filteredSides.map(side => { const axisValue = side === 'vertical' ? values.top : values.left; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingInputControl, { icon: ICONS[side], label: LABELS[side], minimumCustomValue: minimumCustomValue, onChange: createHandleOnChange(side), onMouseOut: onMouseOut, onMouseOver: onMouseOver, side: side, spacingSizes: spacingSizes, type: type, value: axisValue, withInputField: false }, `spacing-sizes-control-${side}`); }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/separated.js /** * Internal dependencies */ function SeparatedInputControls({ minimumCustomValue, onChange, onMouseOut, onMouseOver, sides, spacingSizes, type, values }) { // Filter sides if custom configuration provided, maintaining default order. const filteredSides = sides?.length ? ALL_SIDES.filter(side => sides.includes(side)) : ALL_SIDES; const createHandleOnChange = side => next => { // Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes. const nextValues = { ...Object.keys(values).reduce((acc, key) => { acc[key] = getPresetValueFromCustomValue(values[key], spacingSizes); return acc; }, {}) }; nextValues[side] = next; onChange(nextValues); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: filteredSides.map(side => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingInputControl, { icon: ICONS[side], label: LABELS[side], minimumCustomValue: minimumCustomValue, onChange: createHandleOnChange(side), onMouseOut: onMouseOut, onMouseOver: onMouseOver, side: side, spacingSizes: spacingSizes, type: type, value: values[side], withInputField: false }, `spacing-sizes-control-${side}`); }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/single.js /** * Internal dependencies */ function SingleInputControl({ minimumCustomValue, onChange, onMouseOut, onMouseOver, showSideInLabel, side, spacingSizes, type, values }) { const createHandleOnChange = currentSide => next => { // Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes. const nextValues = { ...Object.keys(values).reduce((acc, key) => { acc[key] = getPresetValueFromCustomValue(values[key], spacingSizes); return acc; }, {}) }; nextValues[currentSide] = next; onChange(nextValues); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingInputControl, { label: LABELS[side], minimumCustomValue: minimumCustomValue, onChange: createHandleOnChange(side), onMouseOut: onMouseOut, onMouseOver: onMouseOver, showSideInLabel: showSideInLabel, side: side, spacingSizes: spacingSizes, type: type, value: values[side], withInputField: false }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/linked-button.js /** * WordPress dependencies */ function linked_button_LinkedButton({ isLinked, ...props }) { const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink sides') : (0,external_wp_i18n_namespaceObject.__)('Link sides'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, size: "small", icon: isLinked ? library_link : link_off, iconSize: 24, label: label }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A flexible control for managing spacing values in the block editor. Supports single, axial, * and separated input controls for different spacing configurations with automatic view selection * based on current values and available sides. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/spacing-sizes-control/README.md * * @example * ```jsx * import { __experimentalSpacingSizesControl as SpacingSizesControl } from '@wordpress/block-editor'; * import { useState } from '@wordpress/element'; * * function Example() { * const [ sides, setSides ] = useState( { * top: '0px', * right: '0px', * bottom: '0px', * left: '0px', * } ); * * return ( * <SpacingSizesControl * values={ sides } * onChange={ setSides } * label="Sides" * /> * ); * } * ``` * * @param {Object} props Component props. * @param {Object} props.inputProps Additional props for input controls. * @param {string} props.label Label for the control. * @param {number} props.minimumCustomValue Minimum value for custom input. * @param {Function} props.onChange Called when spacing values change. * @param {Function} props.onMouseOut Called when mouse leaves the control. * @param {Function} props.onMouseOver Called when mouse enters the control. * @param {boolean} props.showSideInLabel Show side in control label. * @param {Array} props.sides Available sides for control. * @param {boolean} props.useSelect Use select control for predefined values. * @param {Object} props.values Current spacing values. * @return {Element} Spacing sizes control component. */ function SpacingSizesControl({ inputProps, label: labelProp, minimumCustomValue = 0, onChange, onMouseOut, onMouseOver, showSideInLabel = true, sides = ALL_SIDES, useSelect, values }) { const spacingSizes = useSpacingSizes(); const inputValues = values || DEFAULT_VALUES; const hasOneSide = sides?.length === 1; const hasOnlyAxialSides = sides?.includes('horizontal') && sides?.includes('vertical') && sides?.length === 2; const [view, setView] = (0,external_wp_element_namespaceObject.useState)(getInitialView(inputValues, sides)); const toggleLinked = () => { setView(view === VIEWS.axial ? VIEWS.custom : VIEWS.axial); }; const handleOnChange = nextValue => { const newValues = { ...values, ...nextValue }; onChange(newValues); }; const inputControlProps = { ...inputProps, minimumCustomValue, onChange: handleOnChange, onMouseOut, onMouseOver, sides, spacingSizes, type: labelProp, useSelect, values: inputValues }; const renderControls = () => { if (view === VIEWS.axial) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AxialInputControls, { ...inputControlProps }); } if (view === VIEWS.custom) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SeparatedInputControls, { ...inputControlProps }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleInputControl, { side: view, ...inputControlProps, showSideInLabel: showSideInLabel }); }; const sideLabel = ALL_SIDES.includes(view) && showSideInLabel ? LABELS[view] : ''; const label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc). (0,external_wp_i18n_namespaceObject._x)('%1$s %2$s', 'spacing'), labelProp, sideLabel).trim(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "spacing-sizes-control", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "spacing-sizes-control__header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", className: "spacing-sizes-control__label", children: label }), !hasOneSide && !hasOnlyAxialSides && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(linked_button_LinkedButton, { label: labelProp, onClick: toggleLinked, isLinked: view === VIEWS.axial })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0.5, children: renderControls() })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/height-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const RANGE_CONTROL_CUSTOM_SETTINGS = { px: { max: 1000, step: 1 }, '%': { max: 100, step: 1 }, vw: { max: 100, step: 1 }, vh: { max: 100, step: 1 }, em: { max: 50, step: 0.1 }, rem: { max: 50, step: 0.1 }, svw: { max: 100, step: 1 }, lvw: { max: 100, step: 1 }, dvw: { max: 100, step: 1 }, svh: { max: 100, step: 1 }, lvh: { max: 100, step: 1 }, dvh: { max: 100, step: 1 }, vi: { max: 100, step: 1 }, svi: { max: 100, step: 1 }, lvi: { max: 100, step: 1 }, dvi: { max: 100, step: 1 }, vb: { max: 100, step: 1 }, svb: { max: 100, step: 1 }, lvb: { max: 100, step: 1 }, dvb: { max: 100, step: 1 }, vmin: { max: 100, step: 1 }, svmin: { max: 100, step: 1 }, lvmin: { max: 100, step: 1 }, dvmin: { max: 100, step: 1 }, vmax: { max: 100, step: 1 }, svmax: { max: 100, step: 1 }, lvmax: { max: 100, step: 1 }, dvmax: { max: 100, step: 1 } }; /** * HeightControl renders a linked unit control and range control for adjusting the height of a block. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/height-control/README.md * * @param {Object} props * @param {?string} props.label A label for the control. * @param {( value: string ) => void } props.onChange Called when the height changes. * @param {string} props.value The current height value. * * @return {Component} The component to be rendered. */ function HeightControl({ label = (0,external_wp_i18n_namespaceObject.__)('Height'), onChange, value }) { var _RANGE_CONTROL_CUSTOM, _RANGE_CONTROL_CUSTOM2; const customRangeValue = parseFloat(value); const [availableUnits] = use_settings_useSettings('spacing.units'); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vh', 'vw'] }); const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value), [value])[1] || units[0]?.value || 'px'; const handleSliderChange = next => { onChange([next, selectedUnit].join('')); }; const handleUnitChange = newUnit => { // Attempt to smooth over differences between currentUnit and newUnit. // This should slightly improve the experience of switching between unit types. const [currentValue, currentUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value); if (['em', 'rem'].includes(newUnit) && currentUnit === 'px') { // Convert pixel value to an approximate of the new unit, assuming a root size of 16px. onChange((currentValue / 16).toFixed(2) + newUnit); } else if (['em', 'rem'].includes(currentUnit) && newUnit === 'px') { // Convert to pixel value assuming a root size of 16px. onChange(Math.round(currentValue * 16) + newUnit); } else if (['%', 'vw', 'svw', 'lvw', 'dvw', 'vh', 'svh', 'lvh', 'dvh', 'vi', 'svi', 'lvi', 'dvi', 'vb', 'svb', 'lvb', 'dvb', 'vmin', 'svmin', 'lvmin', 'dvmin', 'vmax', 'svmax', 'lvmax', 'dvmax'].includes(newUnit) && currentValue > 100) { // When converting to `%` or viewport-relative units, cap the new value at 100. onChange(100 + newUnit); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-height-control", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { value: value, units: units, onChange: onChange, onUnitChange: handleUnitChange, min: 0, size: "__unstable-large", label: label, hideLabelFromVision: true }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 2, marginBottom: 0, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, value: customRangeValue, min: 0, max: (_RANGE_CONTROL_CUSTOM = RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.max) !== null && _RANGE_CONTROL_CUSTOM !== void 0 ? _RANGE_CONTROL_CUSTOM : 100, step: (_RANGE_CONTROL_CUSTOM2 = RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.step) !== null && _RANGE_CONTROL_CUSTOM2 !== void 0 ? _RANGE_CONTROL_CUSTOM2 : 0.1, withInputField: false, onChange: handleSliderChange, __nextHasNoMarginBottom: true, label: label, hideLabelFromVision: true }) }) })] })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/use-get-number-of-blocks-before-cell.js /** * WordPress dependencies */ /** * Internal dependencies */ function useGetNumberOfBlocksBeforeCell(gridClientId, numColumns) { const { getBlockOrder, getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(store); const getNumberOfBlocksBeforeCell = (column, row) => { const targetIndex = (row - 1) * numColumns + column - 1; let count = 0; for (const clientId of getBlockOrder(gridClientId)) { var _getBlockAttributes$s; const { columnStart, rowStart } = (_getBlockAttributes$s = getBlockAttributes(clientId).style?.layout) !== null && _getBlockAttributes$s !== void 0 ? _getBlockAttributes$s : {}; const cellIndex = (rowStart - 1) * numColumns + columnStart - 1; if (cellIndex < targetIndex) { count++; } } return count; }; return getNumberOfBlocksBeforeCell; } ;// ./node_modules/@wordpress/block-editor/build-module/components/child-layout-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function helpText(selfStretch, parentLayout) { const { orientation = 'horizontal' } = parentLayout; if (selfStretch === 'fill') { return (0,external_wp_i18n_namespaceObject.__)('Stretch to fill available space.'); } if (selfStretch === 'fixed' && orientation === 'horizontal') { return (0,external_wp_i18n_namespaceObject.__)('Specify a fixed width.'); } else if (selfStretch === 'fixed') { return (0,external_wp_i18n_namespaceObject.__)('Specify a fixed height.'); } return (0,external_wp_i18n_namespaceObject.__)('Fit contents.'); } /** * Form to edit the child layout value. * * @param {Object} props Props. * @param {Object} props.value The child layout value. * @param {Function} props.onChange Function to update the child layout value. * @param {Object} props.parentLayout The parent layout value. * * @param {boolean} props.isShownByDefault * @param {string} props.panelId * @return {Element} child layout edit element. */ function ChildLayoutControl({ value: childLayout = {}, onChange, parentLayout, isShownByDefault, panelId }) { const { type: parentType, default: { type: defaultParentType = 'default' } = {} } = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {}; const parentLayoutType = parentType || defaultParentType; if (parentLayoutType === 'flex') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexControls, { childLayout: childLayout, onChange: onChange, parentLayout: parentLayout, isShownByDefault: isShownByDefault, panelId: panelId }); } else if (parentLayoutType === 'grid') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridControls, { childLayout: childLayout, onChange: onChange, parentLayout: parentLayout, isShownByDefault: isShownByDefault, panelId: panelId }); } return null; } function FlexControls({ childLayout, onChange, parentLayout, isShownByDefault, panelId }) { const { selfStretch, flexSize } = childLayout; const { orientation = 'horizontal' } = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {}; const hasFlexValue = () => !!selfStretch; const flexResetLabel = orientation === 'horizontal' ? (0,external_wp_i18n_namespaceObject.__)('Width') : (0,external_wp_i18n_namespaceObject.__)('Height'); const [availableUnits] = use_settings_useSettings('spacing.units'); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vh', 'vw'] }); const resetFlex = () => { onChange({ selfStretch: undefined, flexSize: undefined }); }; (0,external_wp_element_namespaceObject.useEffect)(() => { if (selfStretch === 'fixed' && !flexSize) { onChange({ ...childLayout, selfStretch: 'fit' }); } }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, spacing: 2, hasValue: hasFlexValue, label: flexResetLabel, onDeselect: resetFlex, isShownByDefault: isShownByDefault, panelId: panelId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, size: "__unstable-large", label: childLayoutOrientation(parentLayout), value: selfStretch || 'fit', help: helpText(selfStretch, parentLayout), onChange: value => { const newFlexSize = value !== 'fixed' ? null : flexSize; onChange({ selfStretch: value, flexSize: newFlexSize }); }, isBlock: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "fit", label: (0,external_wp_i18n_namespaceObject._x)('Fit', 'Intrinsic block width in flex layout') }, "fit"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "fill", label: (0,external_wp_i18n_namespaceObject._x)('Grow', 'Block with expanding width in flex layout') }, "fill"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "fixed", label: (0,external_wp_i18n_namespaceObject._x)('Fixed', 'Block with fixed width in flex layout') }, "fixed")] }), selfStretch === 'fixed' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { size: "__unstable-large", units: units, onChange: value => { onChange({ selfStretch, flexSize: value }); }, value: flexSize, label: flexResetLabel, hideLabelFromVision: true })] }); } function childLayoutOrientation(parentLayout) { const { orientation = 'horizontal' } = parentLayout; return orientation === 'horizontal' ? (0,external_wp_i18n_namespaceObject.__)('Width') : (0,external_wp_i18n_namespaceObject.__)('Height'); } function GridControls({ childLayout, onChange, parentLayout, isShownByDefault, panelId }) { const { columnStart, rowStart, columnSpan, rowSpan } = childLayout; const { columnCount = 3, rowCount } = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {}; const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlockRootClientId(panelId)); const { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(rootClientId, columnCount); const hasStartValue = () => !!columnStart || !!rowStart; const hasSpanValue = () => !!columnSpan || !!rowSpan; const resetGridStarts = () => { onChange({ columnStart: undefined, rowStart: undefined }); }; const resetGridSpans = () => { onChange({ columnSpan: undefined, rowSpan: undefined }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, hasValue: hasSpanValue, label: (0,external_wp_i18n_namespaceObject.__)('Grid span'), onDeselect: resetGridSpans, isShownByDefault: isShownByDefault, panelId: panelId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)('Column span'), type: "number", onChange: value => { // Don't allow unsetting. const newColumnSpan = value === '' ? 1 : parseInt(value, 10); onChange({ columnStart, rowStart, rowSpan, columnSpan: newColumnSpan }); }, value: columnSpan !== null && columnSpan !== void 0 ? columnSpan : 1, min: 1 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)('Row span'), type: "number", onChange: value => { // Don't allow unsetting. const newRowSpan = value === '' ? 1 : parseInt(value, 10); onChange({ columnStart, rowStart, columnSpan, rowSpan: newRowSpan }); }, value: rowSpan !== null && rowSpan !== void 0 ? rowSpan : 1, min: 1 })] }), window.__experimentalEnableGridInteractivity && columnCount && /*#__PURE__*/ // Use Flex with an explicit width on the FlexItem instead of HStack to // work around an issue in webkit where inputs with a max attribute are // sized incorrectly. (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, hasValue: hasStartValue, label: (0,external_wp_i18n_namespaceObject.__)('Grid placement'), onDeselect: resetGridStarts, isShownByDefault: false, panelId: panelId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: '50%' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)('Column'), type: "number", onChange: value => { // Don't allow unsetting. const newColumnStart = value === '' ? 1 : parseInt(value, 10); onChange({ columnStart: newColumnStart, rowStart, columnSpan, rowSpan }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition([panelId], rootClientId, rootClientId, getNumberOfBlocksBeforeCell(newColumnStart, rowStart)); }, value: columnStart !== null && columnStart !== void 0 ? columnStart : 1, min: 1, max: columnCount ? columnCount - (columnSpan !== null && columnSpan !== void 0 ? columnSpan : 1) + 1 : undefined }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: '50%' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)('Row'), type: "number", onChange: value => { // Don't allow unsetting. const newRowStart = value === '' ? 1 : parseInt(value, 10); onChange({ columnStart, rowStart: newRowStart, columnSpan, rowSpan }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition([panelId], rootClientId, rootClientId, getNumberOfBlocksBeforeCell(columnStart, newRowStart)); }, value: rowStart !== null && rowStart !== void 0 ? rowStart : 1, min: 1, max: rowCount ? rowCount - (rowSpan !== null && rowSpan !== void 0 ? rowSpan : 1) + 1 : undefined }) })] })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/aspect-ratio-tool.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps */ /** * @callback AspectRatioToolPropsOnChange * @param {string} [value] New aspect ratio value. * @return {void} No return. */ /** * @typedef {Object} AspectRatioToolProps * @property {string} [panelId] ID of the panel this tool is associated with. * @property {string} [value] Current aspect ratio value. * @property {AspectRatioToolPropsOnChange} [onChange] Callback to update the aspect ratio value. * @property {SelectControlProps[]} [options] Aspect ratio options. * @property {string} [defaultValue] Default aspect ratio value. * @property {boolean} [isShownByDefault] Whether the tool is shown by default. */ function AspectRatioTool({ panelId, value, onChange = () => {}, options, defaultValue = 'auto', hasValue, isShownByDefault = true }) { // Match the CSS default so if the value is used directly in CSS it will look correct in the control. const displayValue = value !== null && value !== void 0 ? value : 'auto'; const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings('dimensions.aspectRatios.default', 'dimensions.aspectRatios.theme', 'dimensions.defaultAspectRatios'); const themeOptions = themeRatios?.map(({ name, ratio }) => ({ label: name, value: ratio })); const defaultOptions = defaultRatios?.map(({ name, ratio }) => ({ label: name, value: ratio })); const aspectRatioOptions = [{ label: (0,external_wp_i18n_namespaceObject._x)('Original', 'Aspect ratio option for dimensions control'), value: 'auto' }, ...(showDefaultRatios ? defaultOptions : []), ...(themeOptions ? themeOptions : []), { label: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Aspect ratio option for dimensions control'), value: 'custom', disabled: true, hidden: true }]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasValue ? hasValue : () => displayValue !== defaultValue, label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'), onDeselect: () => onChange(undefined), isShownByDefault: isShownByDefault, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'), value: displayValue, options: options !== null && options !== void 0 ? options : aspectRatioOptions, onChange: onChange, size: "__unstable-large", __nextHasNoMarginBottom: true }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/dimensions-panel.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const AXIAL_SIDES = ['horizontal', 'vertical']; function useHasDimensionsPanel(settings) { const hasContentSize = useHasContentSize(settings); const hasWideSize = useHasWideSize(settings); const hasPadding = useHasPadding(settings); const hasMargin = useHasMargin(settings); const hasGap = useHasGap(settings); const hasMinHeight = useHasMinHeight(settings); const hasAspectRatio = useHasAspectRatio(settings); const hasChildLayout = useHasChildLayout(settings); return external_wp_element_namespaceObject.Platform.OS === 'web' && (hasContentSize || hasWideSize || hasPadding || hasMargin || hasGap || hasMinHeight || hasAspectRatio || hasChildLayout); } function useHasContentSize(settings) { return settings?.layout?.contentSize; } function useHasWideSize(settings) { return settings?.layout?.wideSize; } function useHasPadding(settings) { return settings?.spacing?.padding; } function useHasMargin(settings) { return settings?.spacing?.margin; } function useHasGap(settings) { return settings?.spacing?.blockGap; } function useHasMinHeight(settings) { return settings?.dimensions?.minHeight; } function useHasAspectRatio(settings) { return settings?.dimensions?.aspectRatio; } function useHasChildLayout(settings) { var _settings$parentLayou; const { type: parentLayoutType = 'default', default: { type: defaultParentLayoutType = 'default' } = {}, allowSizingOnChildren = false } = (_settings$parentLayou = settings?.parentLayout) !== null && _settings$parentLayou !== void 0 ? _settings$parentLayou : {}; const support = (defaultParentLayoutType === 'flex' || parentLayoutType === 'flex' || defaultParentLayoutType === 'grid' || parentLayoutType === 'grid') && allowSizingOnChildren; return !!settings?.layout && support; } function useHasSpacingPresets(settings) { const { defaultSpacingSizes, spacingSizes } = settings?.spacing || {}; return defaultSpacingSizes !== false && spacingSizes?.default?.length > 0 || spacingSizes?.theme?.length > 0 || spacingSizes?.custom?.length > 0; } function filterValuesBySides(values, sides) { // If no custom side configuration, all sides are opted into by default. // Without any values, we have nothing to filter either. if (!sides || !values) { return values; } // Only include sides opted into within filtered values. const filteredValues = {}; sides.forEach(side => { if (side === 'vertical') { filteredValues.top = values.top; filteredValues.bottom = values.bottom; } if (side === 'horizontal') { filteredValues.left = values.left; filteredValues.right = values.right; } filteredValues[side] = values?.[side]; }); return filteredValues; } function splitStyleValue(value) { // Check for shorthand value (a string value). if (value && typeof value === 'string') { // Convert to value for individual sides for BoxControl. return { top: value, right: value, bottom: value, left: value }; } return value; } function splitGapValue(value, isAxialGap) { if (!value) { return value; } // Check for shorthand value (a string value). if (typeof value === 'string') { /* * Map the string value to appropriate sides for the spacing control depending * on whether the current block has axial gap support or not. * * Note: The axial value pairs must match for the spacing control to display * the appropriate horizontal/vertical sliders. */ return isAxialGap ? { top: value, right: value, bottom: value, left: value } : { top: value }; } return { ...value, right: value?.left, bottom: value?.top }; } function DimensionsToolsPanel({ resetAllFilter, onChange, value, panelId, children }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)('Dimensions'), resetAll: resetAll, panelId: panelId, dropdownMenuProps: dropdownMenuProps, children: children }); } const dimensions_panel_DEFAULT_CONTROLS = { contentSize: true, wideSize: true, padding: true, margin: true, blockGap: true, minHeight: true, aspectRatio: true, childLayout: true }; function DimensionsPanel({ as: Wrapper = DimensionsToolsPanel, value, onChange, inheritedValue = value, settings, panelId, defaultControls = dimensions_panel_DEFAULT_CONTROLS, onVisualize = () => {}, // Special case because the layout controls are not part of the dimensions panel // in global styles but not in block inspector. includeLayoutControls = false }) { var _defaultControls$cont, _defaultControls$wide, _defaultControls$padd, _defaultControls$marg, _defaultControls$bloc, _defaultControls$chil, _defaultControls$minH, _defaultControls$aspe; const { dimensions, spacing } = settings; const decodeValue = rawValue => { if (rawValue && typeof rawValue === 'object') { return Object.keys(rawValue).reduce((acc, key) => { acc[key] = getValueFromVariable({ settings: { dimensions, spacing } }, '', rawValue[key]); return acc; }, {}); } return getValueFromVariable({ settings: { dimensions, spacing } }, '', rawValue); }; const showSpacingPresetsControl = useHasSpacingPresets(settings); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: settings?.spacing?.units || ['%', 'px', 'em', 'rem', 'vw'] }); //Minimum Margin Value const minimumMargin = -Infinity; const [minMarginValue, setMinMarginValue] = (0,external_wp_element_namespaceObject.useState)(minimumMargin); // Content Width const showContentSizeControl = useHasContentSize(settings) && includeLayoutControls; const contentSizeValue = decodeValue(inheritedValue?.layout?.contentSize); const setContentSizeValue = newValue => { onChange(setImmutably(value, ['layout', 'contentSize'], newValue || undefined)); }; const hasUserSetContentSizeValue = () => !!value?.layout?.contentSize; const resetContentSizeValue = () => setContentSizeValue(undefined); // Wide Width const showWideSizeControl = useHasWideSize(settings) && includeLayoutControls; const wideSizeValue = decodeValue(inheritedValue?.layout?.wideSize); const setWideSizeValue = newValue => { onChange(setImmutably(value, ['layout', 'wideSize'], newValue || undefined)); }; const hasUserSetWideSizeValue = () => !!value?.layout?.wideSize; const resetWideSizeValue = () => setWideSizeValue(undefined); // Padding const showPaddingControl = useHasPadding(settings); const rawPadding = decodeValue(inheritedValue?.spacing?.padding); const paddingValues = splitStyleValue(rawPadding); const paddingSides = Array.isArray(settings?.spacing?.padding) ? settings?.spacing?.padding : settings?.spacing?.padding?.sides; const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side)); const setPaddingValues = newPaddingValues => { const padding = filterValuesBySides(newPaddingValues, paddingSides); onChange(setImmutably(value, ['spacing', 'padding'], padding)); }; const hasPaddingValue = () => !!value?.spacing?.padding && Object.keys(value?.spacing?.padding).length; const resetPaddingValue = () => setPaddingValues(undefined); const onMouseOverPadding = () => onVisualize('padding'); // Margin const showMarginControl = useHasMargin(settings); const rawMargin = decodeValue(inheritedValue?.spacing?.margin); const marginValues = splitStyleValue(rawMargin); const marginSides = Array.isArray(settings?.spacing?.margin) ? settings?.spacing?.margin : settings?.spacing?.margin?.sides; const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side)); const setMarginValues = newMarginValues => { const margin = filterValuesBySides(newMarginValues, marginSides); onChange(setImmutably(value, ['spacing', 'margin'], margin)); }; const hasMarginValue = () => !!value?.spacing?.margin && Object.keys(value?.spacing?.margin).length; const resetMarginValue = () => setMarginValues(undefined); const onMouseOverMargin = () => onVisualize('margin'); // Block Gap const showGapControl = useHasGap(settings); const gapSides = Array.isArray(settings?.spacing?.blockGap) ? settings?.spacing?.blockGap : settings?.spacing?.blockGap?.sides; const isAxialGap = gapSides && gapSides.some(side => AXIAL_SIDES.includes(side)); const gapValue = decodeValue(inheritedValue?.spacing?.blockGap); const gapValues = splitGapValue(gapValue, isAxialGap); const setGapValue = newGapValue => { onChange(setImmutably(value, ['spacing', 'blockGap'], newGapValue)); }; const setGapValues = nextBoxGapValue => { if (!nextBoxGapValue) { setGapValue(null); } // If axial gap is not enabled, treat the 'top' value as the shorthand gap value. if (!isAxialGap && nextBoxGapValue?.hasOwnProperty('top')) { setGapValue(nextBoxGapValue.top); } else { setGapValue({ top: nextBoxGapValue?.top, left: nextBoxGapValue?.left }); } }; const resetGapValue = () => setGapValue(undefined); const hasGapValue = () => !!value?.spacing?.blockGap; // Min Height const showMinHeightControl = useHasMinHeight(settings); const minHeightValue = decodeValue(inheritedValue?.dimensions?.minHeight); const setMinHeightValue = newValue => { const tempValue = setImmutably(value, ['dimensions', 'minHeight'], newValue); // Apply min-height, while removing any applied aspect ratio. onChange(setImmutably(tempValue, ['dimensions', 'aspectRatio'], undefined)); }; const resetMinHeightValue = () => { setMinHeightValue(undefined); }; const hasMinHeightValue = () => !!value?.dimensions?.minHeight; // Aspect Ratio const showAspectRatioControl = useHasAspectRatio(settings); const aspectRatioValue = decodeValue(inheritedValue?.dimensions?.aspectRatio); const setAspectRatioValue = newValue => { const tempValue = setImmutably(value, ['dimensions', 'aspectRatio'], newValue); // Apply aspect-ratio, while removing any applied min-height. onChange(setImmutably(tempValue, ['dimensions', 'minHeight'], undefined)); }; const hasAspectRatioValue = () => !!value?.dimensions?.aspectRatio; // Child Layout const showChildLayoutControl = useHasChildLayout(settings); const childLayout = inheritedValue?.layout; const setChildLayout = newChildLayout => { onChange({ ...value, layout: { ...newChildLayout } }); }; const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { return { ...previousValue, layout: utils_cleanEmptyObject({ ...previousValue?.layout, contentSize: undefined, wideSize: undefined, selfStretch: undefined, flexSize: undefined, columnStart: undefined, rowStart: undefined, columnSpan: undefined, rowSpan: undefined }), spacing: { ...previousValue?.spacing, padding: undefined, margin: undefined, blockGap: undefined }, dimensions: { ...previousValue?.dimensions, minHeight: undefined, aspectRatio: undefined } }; }, []); const onMouseLeaveControls = () => onVisualize(false); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, panelId: panelId, children: [(showContentSizeControl || showWideSizeControl) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "span-columns", children: (0,external_wp_i18n_namespaceObject.__)('Set the width of the main content area.') }), showContentSizeControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Content width'), hasValue: hasUserSetContentSizeValue, onDeselect: resetContentSizeValue, isShownByDefault: (_defaultControls$cont = defaultControls.contentSize) !== null && _defaultControls$cont !== void 0 ? _defaultControls$cont : dimensions_panel_DEFAULT_CONTROLS.contentSize, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Content width'), labelPosition: "top", value: contentSizeValue || '', onChange: nextContentSize => { setContentSizeValue(nextContentSize); }, units: units, prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: align_none }) }) }) }), showWideSizeControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Wide width'), hasValue: hasUserSetWideSizeValue, onDeselect: resetWideSizeValue, isShownByDefault: (_defaultControls$wide = defaultControls.wideSize) !== null && _defaultControls$wide !== void 0 ? _defaultControls$wide : dimensions_panel_DEFAULT_CONTROLS.wideSize, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Wide width'), labelPosition: "top", value: wideSizeValue || '', onChange: nextWideSize => { setWideSizeValue(nextWideSize); }, units: units, prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: stretch_wide }) }) }) }), showPaddingControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasPaddingValue, label: (0,external_wp_i18n_namespaceObject.__)('Padding'), onDeselect: resetPaddingValue, isShownByDefault: (_defaultControls$padd = defaultControls.padding) !== null && _defaultControls$padd !== void 0 ? _defaultControls$padd : dimensions_panel_DEFAULT_CONTROLS.padding, className: dist_clsx({ 'tools-panel-item-spacing': showSpacingPresetsControl }), panelId: panelId, children: [!showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BoxControl, { __next40pxDefaultSize: true, values: paddingValues, onChange: setPaddingValues, label: (0,external_wp_i18n_namespaceObject.__)('Padding'), sides: paddingSides, units: units, allowReset: false, splitOnAxis: isAxialPadding, inputProps: { onMouseOver: onMouseOverPadding, onMouseOut: onMouseLeaveControls } }), showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingSizesControl, { values: paddingValues, onChange: setPaddingValues, label: (0,external_wp_i18n_namespaceObject.__)('Padding'), sides: paddingSides, units: units, allowReset: false, onMouseOver: onMouseOverPadding, onMouseOut: onMouseLeaveControls })] }), showMarginControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasMarginValue, label: (0,external_wp_i18n_namespaceObject.__)('Margin'), onDeselect: resetMarginValue, isShownByDefault: (_defaultControls$marg = defaultControls.margin) !== null && _defaultControls$marg !== void 0 ? _defaultControls$marg : dimensions_panel_DEFAULT_CONTROLS.margin, className: dist_clsx({ 'tools-panel-item-spacing': showSpacingPresetsControl }), panelId: panelId, children: [!showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BoxControl, { __next40pxDefaultSize: true, values: marginValues, onChange: setMarginValues, inputProps: { min: minMarginValue, onDragStart: () => { // Reset to 0 in case the value was negative. setMinMarginValue(0); }, onDragEnd: () => { setMinMarginValue(minimumMargin); }, onMouseOver: onMouseOverMargin, onMouseOut: onMouseLeaveControls }, label: (0,external_wp_i18n_namespaceObject.__)('Margin'), sides: marginSides, units: units, allowReset: false, splitOnAxis: isAxialMargin }), showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingSizesControl, { values: marginValues, onChange: setMarginValues, minimumCustomValue: -Infinity, label: (0,external_wp_i18n_namespaceObject.__)('Margin'), sides: marginSides, units: units, allowReset: false, onMouseOver: onMouseOverMargin, onMouseOut: onMouseLeaveControls })] }), showGapControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasGapValue, label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), onDeselect: resetGapValue, isShownByDefault: (_defaultControls$bloc = defaultControls.blockGap) !== null && _defaultControls$bloc !== void 0 ? _defaultControls$bloc : dimensions_panel_DEFAULT_CONTROLS.blockGap, className: dist_clsx({ 'tools-panel-item-spacing': showSpacingPresetsControl, 'single-column': // If UnitControl is used, should be single-column. !showSpacingPresetsControl && !isAxialGap }), panelId: panelId, children: [!showSpacingPresetsControl && (isAxialGap ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BoxControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), min: 0, onChange: setGapValues, units: units, sides: gapSides, values: gapValues, allowReset: false, splitOnAxis: isAxialGap }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), min: 0, onChange: setGapValue, units: units, value: gapValue })), showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingSizesControl, { label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), min: 0, onChange: setGapValues, showSideInLabel: false, sides: isAxialGap ? gapSides : ['top'] // Use 'top' as the shorthand property in non-axial configurations. , values: gapValues, allowReset: false })] }), showChildLayoutControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ChildLayoutControl, { value: childLayout, onChange: setChildLayout, parentLayout: settings?.parentLayout, panelId: panelId, isShownByDefault: (_defaultControls$chil = defaultControls.childLayout) !== null && _defaultControls$chil !== void 0 ? _defaultControls$chil : dimensions_panel_DEFAULT_CONTROLS.childLayout }), showMinHeightControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasMinHeightValue, label: (0,external_wp_i18n_namespaceObject.__)('Minimum height'), onDeselect: resetMinHeightValue, isShownByDefault: (_defaultControls$minH = defaultControls.minHeight) !== null && _defaultControls$minH !== void 0 ? _defaultControls$minH : dimensions_panel_DEFAULT_CONTROLS.minHeight, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HeightControl, { label: (0,external_wp_i18n_namespaceObject.__)('Minimum height'), value: minHeightValue, onChange: setMinHeightValue }) }), showAspectRatioControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioTool, { hasValue: hasAspectRatioValue, value: aspectRatioValue, onChange: setAspectRatioValue, panelId: panelId, isShownByDefault: (_defaultControls$aspe = defaultControls.aspectRatio) !== null && _defaultControls$aspe !== void 0 ? _defaultControls$aspe : dimensions_panel_DEFAULT_CONTROLS.aspectRatio })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/use-popover-scroll.js /** * WordPress dependencies */ const scrollContainerCache = new WeakMap(); /** * Allow scrolling "through" popovers over the canvas. This is only called for * as long as the pointer is over a popover. Do not use React events because it * will bubble through portals. * * @param {Object} contentRef */ function usePopoverScroll(contentRef) { const effect = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onWheel(event) { const { deltaX, deltaY } = event; const contentEl = contentRef.current; let scrollContainer = scrollContainerCache.get(contentEl); if (!scrollContainer) { scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(contentEl); scrollContainerCache.set(contentEl, scrollContainer); } scrollContainer.scrollBy(deltaX, deltaY); } // Tell the browser that we do not call event.preventDefault // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners const options = { passive: true }; node.addEventListener('wheel', onWheel, options); return () => { node.removeEventListener('wheel', onWheel, options); }; }, [contentRef]); return contentRef ? effect : null; } /* harmony default export */ const use_popover_scroll = (usePopoverScroll); ;// ./node_modules/@wordpress/block-editor/build-module/utils/dom.js const BLOCK_SELECTOR = '.block-editor-block-list__block'; const APPENDER_SELECTOR = '.block-list-appender'; const BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender'; /** * Returns true if two elements are contained within the same block. * * @param {Element} a First element. * @param {Element} b Second element. * * @return {boolean} Whether elements are in the same block. */ function isInSameBlock(a, b) { return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR); } /** * Returns true if an element is considered part of the block and not its inner * blocks or appender. * * @param {Element} blockElement Block container element. * @param {Element} element Element. * * @return {boolean} Whether an element is considered part of the block and not * its inner blocks or appender. */ function isInsideRootBlock(blockElement, element) { const parentBlock = element.closest([BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS].join(',')); return parentBlock === blockElement; } /** * Finds the block client ID given any DOM node inside the block. * * @param {Node?} node DOM node. * * @return {string|undefined} Client ID or undefined if the node is not part of * a block. */ function getBlockClientId(node) { while (node && node.nodeType !== node.ELEMENT_NODE) { node = node.parentNode; } if (!node) { return; } const elementNode = /** @type {Element} */node; const blockNode = elementNode.closest(BLOCK_SELECTOR); if (!blockNode) { return; } return blockNode.id.slice('block-'.length); } /** * Calculates the union of two rectangles. * * @param {DOMRect} rect1 First rectangle. * @param {DOMRect} rect2 Second rectangle. * @return {DOMRect} Union of the two rectangles. */ function rectUnion(rect1, rect2) { const left = Math.min(rect1.left, rect2.left); const right = Math.max(rect1.right, rect2.right); const bottom = Math.max(rect1.bottom, rect2.bottom); const top = Math.min(rect1.top, rect2.top); return new window.DOMRectReadOnly(left, top, right - left, bottom - top); } /** * Returns whether an element is visible. * * @param {Element} element Element. * @return {boolean} Whether the element is visible. */ function isElementVisible(element) { const viewport = element.ownerDocument.defaultView; if (!viewport) { return false; } // Check for <VisuallyHidden> component. if (element.classList.contains('components-visually-hidden')) { return false; } const bounds = element.getBoundingClientRect(); if (bounds.width === 0 || bounds.height === 0) { return false; } // Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method. if (element.checkVisibility) { return element.checkVisibility?.({ opacityProperty: true, contentVisibilityAuto: true, visibilityProperty: true }); } const style = viewport.getComputedStyle(element); if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0') { return false; } return true; } /** * Checks if the element is scrollable. * * @param {Element} element Element. * @return {boolean} True if the element is scrollable. */ function isScrollable(element) { const style = window.getComputedStyle(element); return style.overflowX === 'auto' || style.overflowX === 'scroll' || style.overflowY === 'auto' || style.overflowY === 'scroll'; } const WITH_OVERFLOW_ELEMENT_BLOCKS = ['core/navigation']; /** * Returns the bounding rectangle of an element, with special handling for blocks * that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS). * * For blocks like Navigation that can have overflowing elements (e.g. submenus), * this function calculates the combined bounds of both the parent and its visible * children. The returned rect may extend beyond the viewport. * The returned rect represents the full extent of the element and its visible * children, which may extend beyond the viewport. * * @param {Element} element Element. * @return {DOMRect} Bounding client rect of the element and its visible children. */ function getElementBounds(element) { const viewport = element.ownerDocument.defaultView; if (!viewport) { return new window.DOMRectReadOnly(); } let bounds = element.getBoundingClientRect(); const dataType = element.getAttribute('data-type'); /* * For blocks with overflowing elements (like Navigation), include the bounds * of visible children that extend beyond the parent container. */ if (dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes(dataType)) { const stack = [element]; let currentElement; while (currentElement = stack.pop()) { // Children won’t affect bounds unless the element is not scrollable. if (!isScrollable(currentElement)) { for (const child of currentElement.children) { if (isElementVisible(child)) { const childBounds = child.getBoundingClientRect(); bounds = rectUnion(bounds, childBounds); stack.push(child); } } } } } /* * Take into account the outer horizontal limits of the container in which * an element is supposed to be "visible". For example, if an element is * positioned -10px to the left of the window x value (0), this function * discounts the negative overhang because it's not visible and therefore * not to be counted in the visibility calculations. Top and bottom values * are not accounted for to accommodate vertical scroll. */ const left = Math.max(bounds.left, 0); const right = Math.min(bounds.right, viewport.innerWidth); bounds = new window.DOMRectReadOnly(left, bounds.top, right - left, bounds.height); return bounds; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER; function BlockPopover({ clientId, bottomClientId, children, __unstablePopoverSlot, __unstableContentRef, shift = true, ...props }, ref) { const selectedElement = useBlockElement(clientId); const lastSelectedElement = useBlockElement(bottomClientId !== null && bottomClientId !== void 0 ? bottomClientId : clientId); const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, use_popover_scroll(__unstableContentRef)]); const [popoverDimensionsRecomputeCounter, forceRecomputePopoverDimensions] = (0,external_wp_element_namespaceObject.useReducer)( // Module is there to make sure that the counter doesn't overflow. s => (s + 1) % MAX_POPOVER_RECOMPUTE_COUNTER, 0); // When blocks are moved up/down, they are animated to their new position by // updating the `transform` property manually (i.e. without using CSS // transitions or animations). The animation, which can also scroll the block // editor, can sometimes cause the position of the Popover to get out of sync. // A MutationObserver is therefore used to make sure that changes to the // selectedElement's attribute (i.e. `transform`) can be tracked and used to // trigger the Popover to rerender. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!selectedElement) { return; } const observer = new window.MutationObserver(forceRecomputePopoverDimensions); observer.observe(selectedElement, { attributes: true }); return () => { observer.disconnect(); }; }, [selectedElement]); const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { if ( // popoverDimensionsRecomputeCounter is by definition always equal or greater // than 0. This check is only there to satisfy the correctness of the // exhaustive-deps rule for the `useMemo` hook. popoverDimensionsRecomputeCounter < 0 || !selectedElement || bottomClientId && !lastSelectedElement) { return undefined; } return { getBoundingClientRect() { return lastSelectedElement ? rectUnion(getElementBounds(selectedElement), getElementBounds(lastSelectedElement)) : getElementBounds(selectedElement); }, contextElement: selectedElement }; }, [popoverDimensionsRecomputeCounter, selectedElement, bottomClientId, lastSelectedElement]); if (!selectedElement || bottomClientId && !lastSelectedElement) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { ref: mergedRefs, animate: false, focusOnMount: false, anchor: popoverAnchor // Render in the old slot if needed for backward compatibility, // otherwise render in place (not in the default popover slot). , __unstableSlotName: __unstablePopoverSlot, inline: !__unstablePopoverSlot, placement: "top-start", resize: false, flip: false, shift: shift, ...props, className: dist_clsx('block-editor-block-popover', props.className), variant: "unstyled", children: children }); } const PrivateBlockPopover = (0,external_wp_element_namespaceObject.forwardRef)(BlockPopover); const PublicBlockPopover = ({ clientId, bottomClientId, children, ...props }, ref) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockPopover, { ...props, bottomClientId: bottomClientId, clientId: clientId, __unstableContentRef: undefined, __unstablePopoverSlot: undefined, ref: ref, children: children }); /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-popover/README.md */ /* harmony default export */ const block_popover = ((0,external_wp_element_namespaceObject.forwardRef)(PublicBlockPopover)); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/cover.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockPopoverCover({ clientId, bottomClientId, children, shift = false, additionalStyles, ...props }, ref) { var _bottomClientId; (_bottomClientId = bottomClientId) !== null && _bottomClientId !== void 0 ? _bottomClientId : bottomClientId = clientId; const selectedElement = useBlockElement(clientId); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockPopover, { ref: ref, clientId: clientId, bottomClientId: bottomClientId, shift: shift, ...props, children: selectedElement && clientId === bottomClientId ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CoverContainer, { selectedElement: selectedElement, additionalStyles: additionalStyles, children: children }) : children }); } function CoverContainer({ selectedElement, additionalStyles = {}, children }) { const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetWidth); const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetHeight); (0,external_wp_element_namespaceObject.useEffect)(() => { const observer = new window.ResizeObserver(() => { setWidth(selectedElement.offsetWidth); setHeight(selectedElement.offsetHeight); }); observer.observe(selectedElement, { box: 'border-box' }); return () => observer.disconnect(); }, [selectedElement]); const style = (0,external_wp_element_namespaceObject.useMemo)(() => { return { position: 'absolute', width, height, ...additionalStyles }; }, [width, height, additionalStyles]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: style, children: children }); } /* harmony default export */ const cover = ((0,external_wp_element_namespaceObject.forwardRef)(BlockPopoverCover)); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/spacing-visualizer.js /** * WordPress dependencies */ /** * Internal dependencies */ function SpacingVisualizer({ clientId, value, computeStyle, forceShow }) { const blockElement = useBlockElement(clientId); const [style, updateStyle] = (0,external_wp_element_namespaceObject.useReducer)(() => computeStyle(blockElement)); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!blockElement) { return; } // It's not sufficient to read the computed spacing value when value.spacing changes as // useEffect may run before the browser recomputes CSS. We therefore combine // useLayoutEffect and two rAF calls to ensure that we read the spacing after the current // paint but before the next paint. // See https://github.com/WordPress/gutenberg/pull/59227. window.requestAnimationFrame(() => window.requestAnimationFrame(updateStyle)); }, [blockElement, value]); const previousValueRef = (0,external_wp_element_namespaceObject.useRef)(value); const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (external_wp_isShallowEqual_default()(value, previousValueRef.current) || forceShow) { return; } setIsActive(true); previousValueRef.current = value; const timeout = setTimeout(() => { setIsActive(false); }, 400); return () => { setIsActive(false); clearTimeout(timeout); }; }, [value, forceShow]); if (!isActive && !forceShow) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { clientId: clientId, __unstablePopoverSlot: "block-toolbar", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor__spacing-visualizer", style: style }) }); } function getComputedCSS(element, property) { return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); } function MarginVisualizer({ clientId, value, forceShow }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingVisualizer, { clientId: clientId, value: value?.spacing?.margin, computeStyle: blockElement => { const top = getComputedCSS(blockElement, 'margin-top'); const right = getComputedCSS(blockElement, 'margin-right'); const bottom = getComputedCSS(blockElement, 'margin-bottom'); const left = getComputedCSS(blockElement, 'margin-left'); return { borderTopWidth: top, borderRightWidth: right, borderBottomWidth: bottom, borderLeftWidth: left, top: top ? `-${top}` : 0, right: right ? `-${right}` : 0, bottom: bottom ? `-${bottom}` : 0, left: left ? `-${left}` : 0 }; }, forceShow: forceShow }); } function PaddingVisualizer({ clientId, value, forceShow }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingVisualizer, { clientId: clientId, value: value?.spacing?.padding, computeStyle: blockElement => ({ borderTopWidth: getComputedCSS(blockElement, 'padding-top'), borderRightWidth: getComputedCSS(blockElement, 'padding-right'), borderBottomWidth: getComputedCSS(blockElement, 'padding-bottom'), borderLeftWidth: getComputedCSS(blockElement, 'padding-left') }), forceShow: forceShow }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/dimensions.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const DIMENSIONS_SUPPORT_KEY = 'dimensions'; const SPACING_SUPPORT_KEY = 'spacing'; const dimensions_ALL_SIDES = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left'])); const dimensions_AXIAL_SIDES = (/* unused pure expression or super */ null && (['vertical', 'horizontal'])); function useVisualizer() { const [property, setProperty] = (0,external_wp_element_namespaceObject.useState)(false); const { hideBlockInterface, showBlockInterface } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!property) { showBlockInterface(); } else { hideBlockInterface(); } }, [property, showBlockInterface, hideBlockInterface]); return [property, setProperty]; } function DimensionsInspectorControl({ children, resetAllFilter }) { const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => { const existingStyle = attributes.style; const updatedStyle = resetAllFilter(existingStyle); return { ...attributes, style: updatedStyle }; }, [resetAllFilter]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "dimensions", resetAllFilter: attributesResetAllFilter, children: children }); } function dimensions_DimensionsPanel({ clientId, name, setAttributes, settings }) { const isEnabled = useHasDimensionsPanel(settings); const value = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlockAttributes(clientId)?.style, [clientId]); const [visualizedProperty, setVisualizedProperty] = useVisualizer(); const onChange = newStyle => { setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }; if (!isEnabled) { return null; } const defaultDimensionsControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [DIMENSIONS_SUPPORT_KEY, '__experimentalDefaultControls']); const defaultSpacingControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [SPACING_SUPPORT_KEY, '__experimentalDefaultControls']); const defaultControls = { ...defaultDimensionsControls, ...defaultSpacingControls }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, { as: DimensionsInspectorControl, panelId: clientId, settings: settings, value: value, onChange: onChange, defaultControls: defaultControls, onVisualize: setVisualizedProperty }), !!settings?.spacing?.padding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PaddingVisualizer, { forceShow: visualizedProperty === 'padding', clientId: clientId, value: value }), !!settings?.spacing?.margin && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MarginVisualizer, { forceShow: visualizedProperty === 'margin', clientId: clientId, value: value })] }); } /** * Determine whether there is block support for dimensions. * * @param {string} blockName Block name. * @param {string} feature Background image feature to check for. * * @return {boolean} Whether there is support. */ function hasDimensionsSupport(blockName, feature = 'any') { if (external_wp_element_namespaceObject.Platform.OS !== 'web') { return false; } const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, DIMENSIONS_SUPPORT_KEY); if (support === true) { return true; } if (feature === 'any') { return !!(support?.aspectRatio || !!support?.minHeight); } return !!support?.[feature]; } /* harmony default export */ const dimensions = ({ useBlockProps: dimensions_useBlockProps, attributeKeys: ['minHeight', 'style'], hasSupport(name) { return hasDimensionsSupport(name, 'aspectRatio'); } }); function dimensions_useBlockProps({ name, minHeight, style }) { if (!hasDimensionsSupport(name, 'aspectRatio') || shouldSkipSerialization(name, DIMENSIONS_SUPPORT_KEY, 'aspectRatio')) { return {}; } const className = dist_clsx({ 'has-aspect-ratio': !!style?.dimensions?.aspectRatio }); // Allow dimensions-based inline style overrides to override any global styles rules that // might be set for the block, and therefore affect the display of the aspect ratio. const inlineStyleOverrides = {}; // Apply rules to unset incompatible styles. // Note that a set `aspectRatio` will win out if both an aspect ratio and a minHeight are set. // This is because the aspect ratio is a newer block support, so (in theory) any aspect ratio // that is set should be intentional and should override any existing minHeight. The Cover block // and dimensions controls have logic that will manually clear the aspect ratio if a minHeight // is set. if (style?.dimensions?.aspectRatio) { // To ensure the aspect ratio does not get overridden by `minHeight` unset any existing rule. inlineStyleOverrides.minHeight = 'unset'; } else if (minHeight || style?.dimensions?.minHeight) { // To ensure the minHeight does not get overridden by `aspectRatio` unset any existing rule. inlineStyleOverrides.aspectRatio = 'unset'; } return { className, style: inlineStyleOverrides }; } /** * @deprecated */ function useCustomSides() { external_wp_deprecated_default()('wp.blockEditor.__experimentalUseCustomSides', { since: '6.3', version: '6.4' }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/style.js /** * WordPress dependencies */ /** * Internal dependencies */ const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, DIMENSIONS_SUPPORT_KEY, BACKGROUND_SUPPORT_KEY, SPACING_SUPPORT_KEY, SHADOW_SUPPORT_KEY]; const hasStyleSupport = nameOrType => styleSupportKeys.some(key => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key)); /** * Returns the inline styles to add depending on the style object * * @param {Object} styles Styles configuration. * * @return {Object} Flattened CSS variables declaration. */ function getInlineStyles(styles = {}) { const output = {}; // The goal is to move everything to server side generated engine styles // This is temporary as we absorb more and more styles into the engine. (0,external_wp_styleEngine_namespaceObject.getCSSRules)(styles).forEach(rule => { output[rule.key] = rule.value; }); return output; } /** * Filters registered block settings, extending attributes to include `style` attribute. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function style_addAttribute(settings) { if (!hasStyleSupport(settings)) { return settings; } // Allow blocks to specify their own attribute definition with default values if needed. if (!settings.attributes.style) { Object.assign(settings.attributes, { style: { type: 'object' } }); } return settings; } /** * A dictionary of paths to flag skipping block support serialization as the key, * with values providing the style paths to be omitted from serialization. * * @constant * @type {Record<string, string[]>} */ const skipSerializationPathsEdit = { [`${BORDER_SUPPORT_KEY}.__experimentalSkipSerialization`]: ['border'], [`${COLOR_SUPPORT_KEY}.__experimentalSkipSerialization`]: [COLOR_SUPPORT_KEY], [`${TYPOGRAPHY_SUPPORT_KEY}.__experimentalSkipSerialization`]: [TYPOGRAPHY_SUPPORT_KEY], [`${DIMENSIONS_SUPPORT_KEY}.__experimentalSkipSerialization`]: [DIMENSIONS_SUPPORT_KEY], [`${SPACING_SUPPORT_KEY}.__experimentalSkipSerialization`]: [SPACING_SUPPORT_KEY], [`${SHADOW_SUPPORT_KEY}.__experimentalSkipSerialization`]: [SHADOW_SUPPORT_KEY] }; /** * A dictionary of paths to flag skipping block support serialization as the key, * with values providing the style paths to be omitted from serialization. * * Extends the Edit skip paths to enable skipping additional paths in just * the Save component. This allows a block support to be serialized within the * editor, while using an alternate approach, such as server-side rendering, when * the support is saved. * * @constant * @type {Record<string, string[]>} */ const skipSerializationPathsSave = { ...skipSerializationPathsEdit, [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`], // Skip serialization of aspect ratio in save mode. [`${BACKGROUND_SUPPORT_KEY}`]: [BACKGROUND_SUPPORT_KEY] // Skip serialization of background support in save mode. }; const skipSerializationPathsSaveChecks = { [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: true, [`${BACKGROUND_SUPPORT_KEY}`]: true }; /** * A dictionary used to normalize feature names between support flags, style * object properties and __experimentSkipSerialization configuration arrays. * * This allows not having to provide a migration for a support flag and possible * backwards compatibility bridges, while still achieving consistency between * the support flag and the skip serialization array. * * @constant * @type {Record<string, string>} */ const renamedFeatures = { gradients: 'gradient' }; /** * A utility function used to remove one or more paths from a style object. * Works in a way similar to Lodash's `omit()`. See unit tests and examples below. * * It supports a single string path: * * ``` * omitStyle( { color: 'red' }, 'color' ); // {} * ``` * * or an array of paths: * * ``` * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {} * ``` * * It also allows you to specify paths at multiple levels in a string. * * ``` * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {} * ``` * * You can remove multiple paths at the same time: * * ``` * omitStyle( * { * typography: { * textDecoration: 'underline', * textTransform: 'uppercase', * } * }, * [ * 'typography.textDecoration', * 'typography.textTransform', * ] * ); * // {} * ``` * * You can also specify nested paths as arrays: * * ``` * omitStyle( * { * typography: { * textDecoration: 'underline', * textTransform: 'uppercase', * } * }, * [ * [ 'typography', 'textDecoration' ], * [ 'typography', 'textTransform' ], * ] * ); * // {} * ``` * * With regards to nesting of styles, infinite depth is supported: * * ``` * omitStyle( * { * border: { * radius: { * topLeft: '10px', * topRight: '0.5rem', * } * } * }, * [ * [ 'border', 'radius', 'topRight' ], * ] * ); * // { border: { radius: { topLeft: '10px' } } } * ``` * * The third argument, `preserveReference`, defines how to treat the input style object. * It is mostly necessary to properly handle mutation when recursively handling the style object. * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`. * However, when recursing, we change that value to `true` in order to work with a single copy * of the original style object. * * @see https://lodash.com/docs/4.17.15#omit * * @param {Object} style Styles object. * @param {Array|string} paths Paths to remove. * @param {boolean} preserveReference True to mutate the `style` object, false otherwise. * @return {Object} Styles object with the specified paths removed. */ function omitStyle(style, paths, preserveReference = false) { if (!style) { return style; } let newStyle = style; if (!preserveReference) { newStyle = JSON.parse(JSON.stringify(style)); } if (!Array.isArray(paths)) { paths = [paths]; } paths.forEach(path => { if (!Array.isArray(path)) { path = path.split('.'); } if (path.length > 1) { const [firstSubpath, ...restPath] = path; omitStyle(newStyle[firstSubpath], [restPath], true); } else if (path.length === 1) { delete newStyle[path[0]]; } }); return newStyle; } /** * Override props assigned to save component to inject the CSS variables definition. * * @param {Object} props Additional props applied to save element. * @param {Object|string} blockNameOrType Block type. * @param {Object} attributes Block attributes. * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization. * * @return {Object} Filtered props applied to save element. */ function style_addSaveProps(props, blockNameOrType, attributes, skipPaths = skipSerializationPathsSave) { if (!hasStyleSupport(blockNameOrType)) { return props; } let { style } = attributes; Object.entries(skipPaths).forEach(([indicator, path]) => { const skipSerialization = skipSerializationPathsSaveChecks[indicator] || (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, indicator); if (skipSerialization === true) { style = omitStyle(style, path); } if (Array.isArray(skipSerialization)) { skipSerialization.forEach(featureName => { const feature = renamedFeatures[featureName] || featureName; style = omitStyle(style, [[...path, feature]]); }); } }); props.style = { ...getInlineStyles(style), ...props.style }; return props; } function BlockStyleControls({ clientId, name, setAttributes, __unstableParentLayout }) { const settings = useBlockSettings(name, __unstableParentLayout); const blockEditingMode = useBlockEditingMode(); const passedProps = { clientId, name, setAttributes, settings: { ...settings, typography: { ...settings.typography, // The text alignment UI for individual blocks is rendered in // the block toolbar, so disable it here. textAlign: false } } }; if (blockEditingMode !== 'default') { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorEdit, { ...passedProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(background_BackgroundImagePanel, { ...passedProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_TypographyPanel, { ...passedProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_BorderPanel, { ...passedProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_DimensionsPanel, { ...passedProps })] }); } /* harmony default export */ const style = ({ edit: BlockStyleControls, hasSupport: hasStyleSupport, addSaveProps: style_addSaveProps, attributeKeys: ['style'], useBlockProps: style_useBlockProps }); // Defines which element types are supported, including their hover styles or // any other elements that have been included under a single element type // e.g. heading and h1-h6. const elementTypes = [{ elementType: 'button' }, { elementType: 'link', pseudo: [':hover'] }, { elementType: 'heading', elements: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] }]; // Used for generating the instance ID const STYLE_BLOCK_PROPS_REFERENCE = {}; function style_useBlockProps({ name, style }) { const blockElementsContainerIdentifier = (0,external_wp_compose_namespaceObject.useInstanceId)(STYLE_BLOCK_PROPS_REFERENCE, 'wp-elements'); const baseElementSelector = `.${blockElementsContainerIdentifier}`; const blockElementStyles = style?.elements; const styles = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!blockElementStyles) { return; } const elementCSSRules = []; elementTypes.forEach(({ elementType, pseudo, elements }) => { const skipSerialization = shouldSkipSerialization(name, COLOR_SUPPORT_KEY, elementType); if (skipSerialization) { return; } const elementStyles = blockElementStyles?.[elementType]; // Process primary element type styles. if (elementStyles) { const selector = scopeSelector(baseElementSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType]); elementCSSRules.push((0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles, { selector })); // Process any interactive states for the element type. if (pseudo) { pseudo.forEach(pseudoSelector => { if (elementStyles[pseudoSelector]) { elementCSSRules.push((0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles[pseudoSelector], { selector: scopeSelector(baseElementSelector, `${external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType]}${pseudoSelector}`) })); } }); } } // Process related elements e.g. h1-h6 for headings if (elements) { elements.forEach(element => { if (blockElementStyles[element]) { elementCSSRules.push((0,external_wp_styleEngine_namespaceObject.compileCSS)(blockElementStyles[element], { selector: scopeSelector(baseElementSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]) })); } }); } }); return elementCSSRules.length > 0 ? elementCSSRules.join('') : undefined; }, [baseElementSelector, blockElementStyles, name]); useStyleOverride({ css: styles }); return style_addSaveProps({ className: blockElementsContainerIdentifier }, name, { style }, skipSerializationPathsEdit); } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/style/addAttribute', style_addAttribute); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/settings.js /** * WordPress dependencies */ const hasSettingsSupport = blockType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalSettings', false); function settings_addAttribute(settings) { if (!hasSettingsSupport(settings)) { return settings; } // Allow blocks to specify their own attribute definition with default values if needed. if (!settings?.attributes?.settings) { settings.attributes = { ...settings.attributes, settings: { type: 'object' } }; } return settings; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/settings/addAttribute', settings_addAttribute); ;// ./node_modules/@wordpress/icons/build-module/library/filter.js /** * WordPress dependencies */ const filter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4 4 19h16L12 4zm0 3.2 5.5 10.3H12V7.2z" }) }); /* harmony default export */ const library_filter = (filter); ;// ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js /** * WordPress dependencies */ function DuotoneControl({ id: idProp, colorPalette, duotonePalette, disableCustomColors, disableCustomDuotone, value, onChange }) { let toolbarIcon; if (value === 'unset') { toolbarIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-duotone-control__unset-indicator" }); } else if (value) { toolbarIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, { values: value }); } else { toolbarIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_filter }); } const actionLabel = (0,external_wp_i18n_namespaceObject.__)('Apply duotone filter'); const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DuotoneControl, 'duotone-control', idProp); const descriptionId = `${id}__description`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { className: 'block-editor-duotone-control__popover', headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone') }, renderToggle: ({ isOpen, onToggle }) => { const openOnArrowDown = event => { if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); onToggle(); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { showTooltip: true, onClick: onToggle, "aria-haspopup": "true", "aria-expanded": isOpen, onKeyDown: openOnArrowDown, label: actionLabel, icon: toolbarIcon }); }, renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Duotone'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, { "aria-label": actionLabel, "aria-describedby": descriptionId, colorPalette: colorPalette, duotonePalette: duotonePalette, disableCustomColors: disableCustomColors, disableCustomDuotone: disableCustomDuotone, value: value, onChange: onChange })] }) }); } /* harmony default export */ const duotone_control = (DuotoneControl); ;// ./node_modules/@wordpress/block-editor/build-module/components/duotone/utils.js /** * External dependencies */ /** * Convert a list of colors to an object of R, G, and B values. * * @param {string[]} colors Array of RBG color strings. * * @return {Object} R, G, and B values. */ function getValuesFromColors(colors = []) { const values = { r: [], g: [], b: [], a: [] }; colors.forEach(color => { const rgbColor = w(color).toRgb(); values.r.push(rgbColor.r / 255); values.g.push(rgbColor.g / 255); values.b.push(rgbColor.b / 255); values.a.push(rgbColor.a); }); return values; } /** * Stylesheet for disabling a global styles duotone filter. * * @param {string} selector Selector to disable the filter for. * * @return {string} Filter none style. */ function getDuotoneUnsetStylesheet(selector) { return `${selector}{filter:none}`; } /** * SVG and stylesheet needed for rendering the duotone filter. * * @param {string} selector Selector to apply the filter to. * @param {string} id Unique id for this duotone filter. * * @return {string} Duotone filter style. */ function getDuotoneStylesheet(selector, id) { return `${selector}{filter:url(#${id})}`; } /** * The SVG part of the duotone filter. * * @param {string} id Unique id for this duotone filter. * @param {string[]} colors Color strings from dark to light. * * @return {string} Duotone SVG. */ function getDuotoneFilter(id, colors) { const values = getValuesFromColors(colors); return ` <svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 0 0" width="0" height="0" focusable="false" role="none" aria-hidden="true" style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;" > <defs> <filter id="${id}"> <!-- Use sRGB instead of linearRGB so transparency looks correct. Use perceptual brightness to convert to grayscale. --> <feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix> <!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. --> <feComponentTransfer color-interpolation-filters="sRGB"> <feFuncR type="table" tableValues="${values.r.join(' ')}"></feFuncR> <feFuncG type="table" tableValues="${values.g.join(' ')}"></feFuncG> <feFuncB type="table" tableValues="${values.b.join(' ')}"></feFuncB> <feFuncA type="table" tableValues="${values.a.join(' ')}"></feFuncA> </feComponentTransfer> <!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. --> <feComposite in2="SourceGraphic" operator="in"></feComposite> </filter> </defs> </svg>`; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-block-css-selector.js /** * Internal dependencies */ /** * Determine the CSS selector for the block type and target provided, returning * it if available. * * @param {import('@wordpress/blocks').Block} blockType The block's type. * @param {string|string[]} target The desired selector's target e.g. `root`, delimited string, or array path. * @param {Object} options Options object. * @param {boolean} options.fallback Whether or not to fallback to broader selector. * * @return {?string} The CSS selector or `null` if no selector available. */ function getBlockCSSSelector(blockType, target = 'root', options = {}) { if (!target) { return null; } const { fallback = false } = options; const { name, selectors, supports } = blockType; const hasSelectors = selectors && Object.keys(selectors).length > 0; const path = Array.isArray(target) ? target.join('.') : target; // Root selector. // Calculated before returning as it can be used as a fallback for feature // selectors later on. let rootSelector = null; if (hasSelectors && selectors.root) { // Use the selectors API if available. rootSelector = selectors?.root; } else if (supports?.__experimentalSelector) { // Use the old experimental selector supports property if set. rootSelector = supports.__experimentalSelector; } else { // If no root selector found, generate default block class selector. rootSelector = '.wp-block-' + name.replace('core/', '').replace('/', '-'); } // Return selector if it's the root target we are looking for. if (path === 'root') { return rootSelector; } // If target is not `root` or `duotone` we have a feature or subfeature // as the target. If the target is a string convert to an array. const pathArray = Array.isArray(target) ? target : target.split('.'); // Feature selectors ( may fallback to root selector ); if (pathArray.length === 1) { const fallbackSelector = fallback ? rootSelector : null; // Prefer the selectors API if available. if (hasSelectors) { // Get selector from either `feature.root` or shorthand path. const featureSelector = getValueFromObjectPath(selectors, `${path}.root`, null) || getValueFromObjectPath(selectors, path, null); // Return feature selector if found or any available fallback. return featureSelector || fallbackSelector; } // Try getting old experimental supports selector value. const featureSelector = getValueFromObjectPath(supports, `${path}.__experimentalSelector`, null); // If nothing to work with, provide fallback selector if available. if (!featureSelector) { return fallbackSelector; } // Scope the feature selector by the block's root selector. return scopeSelector(rootSelector, featureSelector); } // Subfeature selector. // This may fallback either to parent feature or root selector. let subfeatureSelector; // Use selectors API if available. if (hasSelectors) { subfeatureSelector = getValueFromObjectPath(selectors, path, null); } // Only return if we have a subfeature selector. if (subfeatureSelector) { return subfeatureSelector; } // To this point we don't have a subfeature selector. If a fallback has been // requested, remove subfeature from target path and return results of a // call for the parent feature's selector. if (fallback) { return getBlockCSSSelector(blockType, pathArray[0], options); } // We tried. return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/filters-panel.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const filters_panel_EMPTY_ARRAY = []; function useMultiOriginColorPresets(settings, { presetSetting, defaultSetting }) { const disableDefault = !settings?.color?.[defaultSetting]; const userPresets = settings?.color?.[presetSetting]?.custom || filters_panel_EMPTY_ARRAY; const themePresets = settings?.color?.[presetSetting]?.theme || filters_panel_EMPTY_ARRAY; const defaultPresets = settings?.color?.[presetSetting]?.default || filters_panel_EMPTY_ARRAY; return (0,external_wp_element_namespaceObject.useMemo)(() => [...userPresets, ...themePresets, ...(disableDefault ? filters_panel_EMPTY_ARRAY : defaultPresets)], [disableDefault, userPresets, themePresets, defaultPresets]); } function useHasFiltersPanel(settings) { return useHasDuotoneControl(settings); } function useHasDuotoneControl(settings) { return settings.color.customDuotone || settings.color.defaultDuotone || settings.color.duotone.length > 0; } function FiltersToolsPanel({ resetAllFilter, onChange, value, panelId, children }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject._x)('Filters', 'Name for applying graphical effects'), resetAll: resetAll, panelId: panelId, dropdownMenuProps: dropdownMenuProps, children: children }); } const filters_panel_DEFAULT_CONTROLS = { duotone: true }; const filters_panel_popoverProps = { placement: 'left-start', offset: 36, shift: true, className: 'block-editor-duotone-control__popover', headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone') }; const LabeledColorIndicator = ({ indicator, label }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { expanded: false, children: indicator === 'unset' || !indicator ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-duotone-control__unset-indicator" }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, { values: indicator }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { title: label, children: label })] }); const renderToggle = (duotone, resetDuotone) => ({ onToggle, isOpen }) => { const duotoneButtonRef = (0,external_wp_element_namespaceObject.useRef)(undefined); const toggleProps = { onClick: onToggle, className: dist_clsx({ 'is-open': isOpen }), 'aria-expanded': isOpen, ref: duotoneButtonRef }; const removeButtonProps = { onClick: () => { if (isOpen) { onToggle(); } resetDuotone(); // Return focus to parent button. duotoneButtonRef.current?.focus(); }, className: 'block-editor-panel-duotone-settings__reset', label: (0,external_wp_i18n_namespaceObject.__)('Reset') }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LabeledColorIndicator, { indicator: duotone, label: (0,external_wp_i18n_namespaceObject.__)('Duotone') }) }), duotone && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: library_reset, ...removeButtonProps })] }); }; function FiltersPanel({ as: Wrapper = FiltersToolsPanel, value, onChange, inheritedValue = value, settings, panelId, defaultControls = filters_panel_DEFAULT_CONTROLS }) { const decodeValue = rawValue => getValueFromVariable({ settings }, '', rawValue); // Duotone const hasDuotoneEnabled = useHasDuotoneControl(settings); const duotonePalette = useMultiOriginColorPresets(settings, { presetSetting: 'duotone', defaultSetting: 'defaultDuotone' }); const colorPalette = useMultiOriginColorPresets(settings, { presetSetting: 'palette', defaultSetting: 'defaultPalette' }); const duotone = decodeValue(inheritedValue?.filter?.duotone); const setDuotone = newValue => { const duotonePreset = duotonePalette.find(({ colors }) => { return colors === newValue; }); const duotoneValue = duotonePreset ? `var:preset|duotone|${duotonePreset.slug}` : newValue; onChange(setImmutably(value, ['filter', 'duotone'], duotoneValue)); }; const hasDuotone = () => !!value?.filter?.duotone; const resetDuotone = () => setDuotone(undefined); const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { return { ...previousValue, filter: { ...previousValue.filter, duotone: undefined } }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, panelId: panelId, children: hasDuotoneEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Duotone'), hasValue: hasDuotone, onDeselect: resetDuotone, isShownByDefault: defaultControls.duotone, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: filters_panel_popoverProps, className: "block-editor-global-styles-filters-panel__dropdown", renderToggle: renderToggle(duotone, resetDuotone), renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Duotone'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, { colorPalette: colorPalette, duotonePalette: duotonePalette // TODO: Re-enable both when custom colors are supported for block-level styles. , disableCustomColors: true, disableCustomDuotone: true, value: duotone, onChange: setDuotone })] }) }) }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const duotone_EMPTY_ARRAY = []; // Safari does not always update the duotone filter when the duotone colors // are changed. This browser check is later used to force a re-render of the block // element to ensure the duotone filter is updated. The check is included at the // root of this file as it only needs to be run once per page load. const isSafari = window?.navigator.userAgent && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome') && !window.navigator.userAgent.includes('Chromium'); k([names]); function useMultiOriginPresets({ presetSetting, defaultSetting }) { const [enableDefault, userPresets, themePresets, defaultPresets] = use_settings_useSettings(defaultSetting, `${presetSetting}.custom`, `${presetSetting}.theme`, `${presetSetting}.default`); return (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPresets || duotone_EMPTY_ARRAY), ...(themePresets || duotone_EMPTY_ARRAY), ...(enableDefault && defaultPresets || duotone_EMPTY_ARRAY)], [enableDefault, userPresets, themePresets, defaultPresets]); } function getColorsFromDuotonePreset(duotone, duotonePalette) { if (!duotone) { return; } const preset = duotonePalette?.find(({ slug }) => { return duotone === `var:preset|duotone|${slug}`; }); return preset ? preset.colors : undefined; } function getDuotonePresetFromColors(colors, duotonePalette) { if (!colors || !Array.isArray(colors)) { return; } const preset = duotonePalette?.find(duotonePreset => { return duotonePreset?.colors?.every((val, index) => val === colors[index]); }); return preset ? `var:preset|duotone|${preset.slug}` : undefined; } function DuotonePanelPure({ style, setAttributes, name }) { const duotoneStyle = style?.color?.duotone; const settings = useBlockSettings(name); const blockEditingMode = useBlockEditingMode(); const duotonePalette = useMultiOriginPresets({ presetSetting: 'color.duotone', defaultSetting: 'color.defaultDuotone' }); const colorPalette = useMultiOriginPresets({ presetSetting: 'color.palette', defaultSetting: 'color.defaultPalette' }); const [enableCustomColors, enableCustomDuotone] = use_settings_useSettings('color.custom', 'color.customDuotone'); const disableCustomColors = !enableCustomColors; const disableCustomDuotone = !enableCustomDuotone || colorPalette?.length === 0 && disableCustomColors; if (duotonePalette?.length === 0 && disableCustomDuotone) { return null; } if (blockEditingMode !== 'default') { return null; } const duotonePresetOrColors = !Array.isArray(duotoneStyle) ? getColorsFromDuotonePreset(duotoneStyle, duotonePalette) : duotoneStyle; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "filter", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FiltersPanel, { value: { filter: { duotone: duotonePresetOrColors } }, onChange: newDuotone => { const newStyle = { ...style, color: { ...newDuotone?.filter } }; setAttributes({ style: newStyle }); }, settings: settings }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { group: "block", __experimentalShareWithChildBlocks: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(duotone_control, { duotonePalette: duotonePalette, colorPalette: colorPalette, disableCustomDuotone: disableCustomDuotone, disableCustomColors: disableCustomColors, value: duotonePresetOrColors, onChange: newDuotone => { const maybePreset = getDuotonePresetFromColors(newDuotone, duotonePalette); const newStyle = { ...style, color: { ...style?.color, duotone: maybePreset !== null && maybePreset !== void 0 ? maybePreset : newDuotone // use preset or fallback to custom colors. } }; setAttributes({ style: newStyle }); }, settings: settings }) })] }); } /* harmony default export */ const duotone = ({ shareWithChildBlocks: true, edit: DuotonePanelPure, useBlockProps: duotone_useBlockProps, attributeKeys: ['style'], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'filter.duotone'); } }); /** * Filters registered block settings, extending attributes to include * the `duotone` attribute. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function addDuotoneAttributes(settings) { // Previous `color.__experimentalDuotone` support flag is migrated via // block_type_metadata_settings filter in `lib/block-supports/duotone.php`. if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'filter.duotone')) { return settings; } // Allow blocks to specify their own attribute definition with default // values if needed. if (!settings.attributes.style) { Object.assign(settings.attributes, { style: { type: 'object' } }); } return settings; } function useDuotoneStyles({ clientId, id: filterId, selector: duotoneSelector, attribute: duotoneAttr }) { const duotonePalette = useMultiOriginPresets({ presetSetting: 'color.duotone', defaultSetting: 'color.defaultDuotone' }); // Possible values for duotone attribute: // 1. Array of colors - e.g. ['#000000', '#ffffff']. // 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)'' // 3. A CSS string - e.g. 'unset' to remove globally applied duotone. const isCustom = Array.isArray(duotoneAttr); const duotonePreset = isCustom ? undefined : getColorsFromDuotonePreset(duotoneAttr, duotonePalette); const isPreset = typeof duotoneAttr === 'string' && duotonePreset; const isCSS = typeof duotoneAttr === 'string' && !isPreset; // Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP. let colors = null; if (isPreset) { // Array of colors. colors = duotonePreset; } else if (isCSS) { // CSS filter property string (e.g. 'unset'). colors = duotoneAttr; } else if (isCustom) { // Array of colors. colors = duotoneAttr; } // Build the CSS selectors to which the filter will be applied. const selectors = duotoneSelector.split(','); const selectorsScoped = selectors.map(selectorPart => { // Assuming the selector part is a subclass selector (not a tag name) // so we can prepend the filter id class. If we want to support elements // such as `img` or namespaces, we'll need to add a case for that here. return `.${filterId}${selectorPart.trim()}`; }); const selector = selectorsScoped.join(', '); const isValidFilter = Array.isArray(colors) || colors === 'unset'; usePrivateStyleOverride(isValidFilter ? { css: colors !== 'unset' ? getDuotoneStylesheet(selector, filterId) : getDuotoneUnsetStylesheet(selector), __unstableType: 'presets' } : undefined); usePrivateStyleOverride(isValidFilter ? { assets: colors !== 'unset' ? getDuotoneFilter(filterId, colors) : '', __unstableType: 'svgs' } : undefined); const blockElement = useBlockElement(clientId); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isValidFilter) { return; } // Safari does not always update the duotone filter when the duotone // colors are changed. When using Safari, force the block element to be // repainted by the browser to ensure any changes are reflected // visually. This logic matches that used on the site frontend in // `block-supports/duotone.php`. if (blockElement && isSafari) { const display = blockElement.style.display; // Switch to `inline-block` to force a repaint. In the editor, // `inline-block` is used instead of `none` to ensure that scroll // position is not affected, as `none` results in the editor // scrolling to the top of the block. blockElement.style.setProperty('display', 'inline-block'); // Simply accessing el.offsetHeight flushes layout and style changes // in WebKit without having to wait for setTimeout. // eslint-disable-next-line no-unused-expressions blockElement.offsetHeight; blockElement.style.setProperty('display', display); } // `colors` must be a dependency so this effect runs when the colors // change in Safari. }, [isValidFilter, blockElement, colors]); } // Used for generating the instance ID const DUOTONE_BLOCK_PROPS_REFERENCE = {}; function duotone_useBlockProps({ clientId, name, style }) { const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DUOTONE_BLOCK_PROPS_REFERENCE); const selector = (0,external_wp_element_namespaceObject.useMemo)(() => { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); if (blockType) { // Backwards compatibility for `supports.color.__experimentalDuotone` // is provided via the `block_type_metadata_settings` filter. If // `supports.filter.duotone` has not been set and the // experimental property has been, the experimental property // value is copied into `supports.filter.duotone`. const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'filter.duotone', false); if (!duotoneSupport) { return null; } // If the experimental duotone support was set, that value is // to be treated as a selector and requires scoping. const experimentalDuotone = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'color.__experimentalDuotone', false); if (experimentalDuotone) { const rootSelector = getBlockCSSSelector(blockType); return typeof experimentalDuotone === 'string' ? scopeSelector(rootSelector, experimentalDuotone) : rootSelector; } // Regular filter.duotone support uses filter.duotone selectors with fallbacks. return getBlockCSSSelector(blockType, 'filter.duotone', { fallback: true }); } }, [name]); const attribute = style?.color?.duotone; const filterClass = `wp-duotone-${id}`; const shouldRender = selector && attribute; useDuotoneStyles({ clientId, id: filterClass, selector, attribute }); return { className: shouldRender ? filterClass : '' }; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/duotone/add-attributes', addDuotoneAttributes); ;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */ /** * Contains basic block's information for display reasons. * * @typedef {Object} WPBlockDisplayInformation * * @property {boolean} isSynced True if is a reusable block or template part * @property {string} title Human-readable block type label. * @property {WPIcon} icon Block type icon. * @property {string} description A detailed block type description. * @property {string} anchor HTML anchor. * @property {name} name A custom, human readable name for the block. */ /** * Get the display label for a block's position type. * * @param {Object} attributes Block attributes. * @return {string} The position type label. */ function getPositionTypeLabel(attributes) { const positionType = attributes?.style?.position?.type; if (positionType === 'sticky') { return (0,external_wp_i18n_namespaceObject.__)('Sticky'); } if (positionType === 'fixed') { return (0,external_wp_i18n_namespaceObject.__)('Fixed'); } return null; } /** * Hook used to try to find a matching block variation and return * the appropriate information for display reasons. In order to * to try to find a match we need to things: * 1. Block's client id to extract it's current attributes. * 2. A block variation should have set `isActive` prop to a proper function. * * If for any reason a block variation match cannot be found, * the returned information come from the Block Type. * If no blockType is found with the provided clientId, returns null. * * @param {string} clientId Block's client id. * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found. */ function useBlockDisplayInformation(clientId) { return (0,external_wp_data_namespaceObject.useSelect)(select => { if (!clientId) { return null; } const { getBlockName, getBlockAttributes } = select(store); const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const blockName = getBlockName(clientId); const blockType = getBlockType(blockName); if (!blockType) { return null; } const attributes = getBlockAttributes(clientId); const match = getActiveBlockVariation(blockName, attributes); const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType); const syncedTitle = isSynced ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes) : undefined; const title = syncedTitle || blockType.title; const positionLabel = getPositionTypeLabel(attributes); const blockTypeInfo = { isSynced, title, icon: blockType.icon, description: blockType.description, anchor: attributes?.anchor, positionLabel, positionType: attributes?.style?.position?.type, name: attributes?.metadata?.name }; if (!match) { return blockTypeInfo; } return { isSynced, title: match.title || blockType.title, icon: match.icon || blockType.icon, description: match.description || blockType.description, anchor: attributes?.anchor, positionLabel, positionType: attributes?.style?.position?.type, name: attributes?.metadata?.name }; }, [clientId]); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/position.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const POSITION_SUPPORT_KEY = 'position'; const DEFAULT_OPTION = { key: 'default', value: '', name: (0,external_wp_i18n_namespaceObject.__)('Default') }; const STICKY_OPTION = { key: 'sticky', value: 'sticky', name: (0,external_wp_i18n_namespaceObject._x)('Sticky', 'Name for the value of the CSS position property'), hint: (0,external_wp_i18n_namespaceObject.__)('The block will stick to the top of the window instead of scrolling.') }; const FIXED_OPTION = { key: 'fixed', value: 'fixed', name: (0,external_wp_i18n_namespaceObject._x)('Fixed', 'Name for the value of the CSS position property'), hint: (0,external_wp_i18n_namespaceObject.__)('The block will not move when the page is scrolled.') }; const POSITION_SIDES = ['top', 'right', 'bottom', 'left']; const VALID_POSITION_TYPES = ['sticky', 'fixed']; /** * Get calculated position CSS. * * @param {Object} props Component props. * @param {string} props.selector Selector to use. * @param {Object} props.style Style object. * @return {string} The generated CSS rules. */ function getPositionCSS({ selector, style }) { let output = ''; const { type: positionType } = style?.position || {}; if (!VALID_POSITION_TYPES.includes(positionType)) { return output; } output += `${selector} {`; output += `position: ${positionType};`; POSITION_SIDES.forEach(side => { if (style?.position?.[side] !== undefined) { output += `${side}: ${style.position[side]};`; } }); if (positionType === 'sticky' || positionType === 'fixed') { // TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json. output += `z-index: 10`; } output += `}`; return output; } /** * Determines if there is sticky position support. * * @param {string|Object} blockType Block name or Block Type object. * * @return {boolean} Whether there is support. */ function hasStickyPositionSupport(blockType) { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); return !!(true === support || support?.sticky); } /** * Determines if there is fixed position support. * * @param {string|Object} blockType Block name or Block Type object. * * @return {boolean} Whether there is support. */ function hasFixedPositionSupport(blockType) { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); return !!(true === support || support?.fixed); } /** * Determines if there is position support. * * @param {string|Object} blockType Block name or Block Type object. * * @return {boolean} Whether there is support. */ function hasPositionSupport(blockType) { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); return !!support; } /** * Checks if there is a current value in the position block support attributes. * * @param {Object} props Block props. * @return {boolean} Whether or not the block has a position value set. */ function hasPositionValue(props) { return props.attributes.style?.position?.type !== undefined; } /** * Checks if the block is currently set to a sticky or fixed position. * This check is helpful for determining how to position block toolbars or other elements. * * @param {Object} attributes Block attributes. * @return {boolean} Whether or not the block is set to a sticky or fixed position. */ function hasStickyOrFixedPositionValue(attributes) { const positionType = attributes?.style?.position?.type; return positionType === 'sticky' || positionType === 'fixed'; } /** * Resets the position block support attributes. This can be used when disabling * the position support controls for a block via a `ToolsPanel`. * * @param {Object} props Block props. * @param {Object} props.attributes Block's attributes. * @param {Object} props.setAttributes Function to set block's attributes. */ function resetPosition({ attributes = {}, setAttributes }) { const { style = {} } = attributes; setAttributes({ style: cleanEmptyObject({ ...style, position: { ...style?.position, type: undefined, top: undefined, right: undefined, bottom: undefined, left: undefined } }) }); } /** * Custom hook that checks if position settings have been disabled. * * @param {string} name The name of the block. * * @return {boolean} Whether padding setting is disabled. */ function useIsPositionDisabled({ name: blockName } = {}) { const [allowFixed, allowSticky] = use_settings_useSettings('position.fixed', 'position.sticky'); const isDisabled = !allowFixed && !allowSticky; return !hasPositionSupport(blockName) || isDisabled; } /* * Position controls rendered in an inspector control panel. * * @param {Object} props * * @return {Element} Position panel. */ function PositionPanelPure({ style = {}, clientId, name: blockName, setAttributes }) { const allowFixed = hasFixedPositionSupport(blockName); const allowSticky = hasStickyPositionSupport(blockName); const value = style?.position?.type; const { firstParentClientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockParents } = select(store); const parents = getBlockParents(clientId); return { firstParentClientId: parents[parents.length - 1] }; }, [clientId]); const blockInformation = useBlockDisplayInformation(firstParentClientId); const stickyHelpText = allowSticky && value === STICKY_OPTION.value && blockInformation ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: the name of the parent block. */ (0,external_wp_i18n_namespaceObject.__)('The block will stick to the scrollable area of the parent %s block.'), blockInformation.title) : null; const options = (0,external_wp_element_namespaceObject.useMemo)(() => { const availableOptions = [DEFAULT_OPTION]; // Display options if they are allowed, or if a block already has a valid value set. // This allows for a block to be switched off from a position type that is not allowed. if (allowSticky || value === STICKY_OPTION.value) { availableOptions.push(STICKY_OPTION); } if (allowFixed || value === FIXED_OPTION.value) { availableOptions.push(FIXED_OPTION); } return availableOptions; }, [allowFixed, allowSticky, value]); const onChangeType = next => { // For now, use a hard-coded `0px` value for the position. // `0px` is preferred over `0` as it can be used in `calc()` functions. // In the future, it could be useful to allow for an offset value. const placementValue = '0px'; const newStyle = { ...style, position: { ...style?.position, type: next, top: next === 'sticky' || next === 'fixed' ? placementValue : undefined } }; setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }; const selectedOption = value ? options.find(option => option.value === value) || DEFAULT_OPTION : DEFAULT_OPTION; // Only display position controls if there is at least one option to choose from. return external_wp_element_namespaceObject.Platform.select({ web: options.length > 1 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "position", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, help: stickyHelpText, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CustomSelectControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Position'), hideLabelFromVision: true, describedBy: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected position. (0,external_wp_i18n_namespaceObject.__)('Currently selected position: %s'), selectedOption.name), options: options, value: selectedOption, onChange: ({ selectedItem }) => { onChangeType(selectedItem.value); }, size: "__unstable-large" }) }) }) : null, native: null }); } /* harmony default export */ const position = ({ edit: function Edit(props) { const isPositionDisabled = useIsPositionDisabled(props); if (isPositionDisabled) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionPanelPure, { ...props }); }, useBlockProps: position_useBlockProps, attributeKeys: ['style'], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY); } }); // Used for generating the instance ID const POSITION_BLOCK_PROPS_REFERENCE = {}; function position_useBlockProps({ name, style }) { const hasPositionBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY); const isPositionDisabled = useIsPositionDisabled({ name }); const allowPositionStyles = hasPositionBlockSupport && !isPositionDisabled; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(POSITION_BLOCK_PROPS_REFERENCE); // Higher specificity to override defaults in editor UI. const positionSelector = `.wp-container-${id}.wp-container-${id}`; // Get CSS string for the current position values. let css; if (allowPositionStyles) { css = getPositionCSS({ selector: positionSelector, style }) || ''; } // Attach a `wp-container-` id-based class name. const className = dist_clsx({ [`wp-container-${id}`]: allowPositionStyles && !!css, // Only attach a container class if there is generated CSS to be attached. [`is-position-${style?.position?.type}`]: allowPositionStyles && !!css && !!style?.position?.type }); useStyleOverride({ css }); return { className }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/use-global-styles-output.js /** * WordPress dependencies */ /** * Internal dependencies */ // Elements that rely on class names in their selectors. const ELEMENT_CLASS_NAMES = { button: 'wp-element-button', caption: 'wp-element-caption' }; // List of block support features that can have their related styles // generated under their own feature level selector rather than the block's. const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = { __experimentalBorder: 'border', color: 'color', spacing: 'spacing', typography: 'typography' }; const { kebabCase: use_global_styles_output_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); /** * Transform given preset tree into a set of style declarations. * * @param {Object} blockPresets * @param {Object} mergedSettings Merged theme.json settings. * * @return {Array<Object>} An array of style declarations. */ function getPresetsDeclarations(blockPresets = {}, mergedSettings) { return PRESET_METADATA.reduce((declarations, { path, valueKey, valueFunc, cssVarInfix }) => { const presetByOrigin = getValueFromObjectPath(blockPresets, path, []); ['default', 'theme', 'custom'].forEach(origin => { if (presetByOrigin[origin]) { presetByOrigin[origin].forEach(value => { if (valueKey && !valueFunc) { declarations.push(`--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase(value.slug)}: ${value[valueKey]}`); } else if (valueFunc && typeof valueFunc === 'function') { declarations.push(`--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase(value.slug)}: ${valueFunc(value, mergedSettings)}`); } }); } }); return declarations; }, []); } /** * Transform given preset tree into a set of preset class declarations. * * @param {?string} blockSelector * @param {Object} blockPresets * @return {string} CSS declarations for the preset classes. */ function getPresetsClasses(blockSelector = '*', blockPresets = {}) { return PRESET_METADATA.reduce((declarations, { path, cssVarInfix, classes }) => { if (!classes) { return declarations; } const presetByOrigin = getValueFromObjectPath(blockPresets, path, []); ['default', 'theme', 'custom'].forEach(origin => { if (presetByOrigin[origin]) { presetByOrigin[origin].forEach(({ slug }) => { classes.forEach(({ classSuffix, propertyName }) => { const classSelectorToUse = `.has-${use_global_styles_output_kebabCase(slug)}-${classSuffix}`; const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3" .map(selector => `${selector}${classSelectorToUse}`).join(','); const value = `var(--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase(slug)})`; declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`; }); }); } }); return declarations; }, ''); } function getPresetsSvgFilters(blockPresets = {}) { return PRESET_METADATA.filter( // Duotone are the only type of filters for now. metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => { const presetByOrigin = getValueFromObjectPath(blockPresets, metadata.path, {}); return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => getDuotoneFilter(`wp-duotone-${preset.slug}`, preset.colors))).join(''); }); } function flattenTree(input = {}, prefix, token) { let result = []; Object.keys(input).forEach(key => { const newKey = prefix + use_global_styles_output_kebabCase(key.replace('/', '-')); const newLeaf = input[key]; if (newLeaf instanceof Object) { const newPrefix = newKey + token; result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; } else { result.push(`${newKey}: ${newLeaf}`); } }); return result; } /** * Gets variation selector string from feature selector. * * @param {string} featureSelector The feature selector. * * @param {string} styleVariationSelector The style variation selector. * @return {string} Combined selector string. */ function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) { const featureSelectors = featureSelector.split(','); const combinedSelectors = []; featureSelectors.forEach(selector => { combinedSelectors.push(`${styleVariationSelector.trim()}${selector.trim()}`); }); return combinedSelectors.join(', '); } /** * Generate style declarations for a block's custom feature and subfeature * selectors. * * NOTE: The passed `styles` object will be mutated by this function. * * @param {Object} selectors Custom selectors object for a block. * @param {Object} styles A block's styles object. * * @return {Object} Style declarations. */ const getFeatureDeclarations = (selectors, styles) => { const declarations = {}; Object.entries(selectors).forEach(([feature, selector]) => { // We're only processing features/subfeatures that have styles. if (feature === 'root' || !styles?.[feature]) { return; } const isShorthand = typeof selector === 'string'; // If we have a selector object instead of shorthand process it. if (!isShorthand) { Object.entries(selector).forEach(([subfeature, subfeatureSelector]) => { // Don't process root feature selector yet or any // subfeature that doesn't have a style. if (subfeature === 'root' || !styles?.[feature][subfeature]) { return; } // Create a temporary styles object and build // declarations for subfeature. const subfeatureStyles = { [feature]: { [subfeature]: styles[feature][subfeature] } }; const newDeclarations = getStylesDeclarations(subfeatureStyles); // Merge new declarations in with any others that // share the same selector. declarations[subfeatureSelector] = [...(declarations[subfeatureSelector] || []), ...newDeclarations]; // Remove the subfeature's style now it will be // included under its own selector not the block's. delete styles[feature][subfeature]; }); } // Now subfeatures have been processed and removed, we can // process root, or shorthand, feature selectors. if (isShorthand || selector.root) { const featureSelector = isShorthand ? selector : selector.root; // Create temporary style object and build declarations for feature. const featureStyles = { [feature]: styles[feature] }; const newDeclarations = getStylesDeclarations(featureStyles); // Merge new declarations with any others that share the selector. declarations[featureSelector] = [...(declarations[featureSelector] || []), ...newDeclarations]; // Remove the feature from the block's styles now as it will be // included under its own selector not the block's. delete styles[feature]; } }); return declarations; }; /** * Transform given style tree into a set of style declarations. * * @param {Object} blockStyles Block styles. * * @param {string} selector The selector these declarations should attach to. * * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector. * * @param {Object} tree A theme.json tree containing layout definitions. * * @param {boolean} disableRootPadding Whether to force disable the root padding styles. * @return {Array} An array of style declarations. */ function getStylesDeclarations(blockStyles = {}, selector = '', useRootPaddingAlign, tree = {}, disableRootPadding = false) { const isRoot = ROOT_BLOCK_SELECTOR === selector; const output = Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).reduce((declarations, [key, { value, properties, useEngine, rootOnly }]) => { if (rootOnly && !isRoot) { return declarations; } const pathToValue = value; if (pathToValue[0] === 'elements' || useEngine) { return declarations; } const styleValue = getValueFromObjectPath(blockStyles, pathToValue); // Root-level padding styles don't currently support strings with CSS shorthand values. // This may change: https://github.com/WordPress/gutenberg/issues/40132. if (key === '--wp--style--root--padding' && (typeof styleValue === 'string' || !useRootPaddingAlign)) { return declarations; } if (properties && typeof styleValue !== 'string') { Object.entries(properties).forEach(entry => { const [name, prop] = entry; if (!getValueFromObjectPath(styleValue, [prop], false)) { // Do not create a declaration // for sub-properties that don't have any value. return; } const cssProperty = name.startsWith('--') ? name : use_global_styles_output_kebabCase(name); declarations.push(`${cssProperty}: ${(0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)(getValueFromObjectPath(styleValue, [prop]))}`); }); } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) { const cssProperty = key.startsWith('--') ? key : use_global_styles_output_kebabCase(key); declarations.push(`${cssProperty}: ${(0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)(getValueFromObjectPath(blockStyles, pathToValue))}`); } return declarations; }, []); /* * Preprocess background image values. * * Note: As we absorb more and more styles into the engine, we could simplify this function. * A refactor is for the style engine to handle ref resolution (and possibly defaults) * via a public util used internally and externally. Theme.json tree and defaults could be passed * as options. */ if (!!blockStyles.background) { /* * Resolve dynamic values before they are compiled by the style engine, * which doesn't (yet) resolve dynamic values. */ if (blockStyles.background?.backgroundImage) { blockStyles.background.backgroundImage = getResolvedValue(blockStyles.background.backgroundImage, tree); } /* * Set default values for block background styles. * Top-level styles are an exception as they are applied to the body. */ if (!isRoot && !!blockStyles.background?.backgroundImage?.id) { blockStyles = { ...blockStyles, background: { ...blockStyles.background, ...setBackgroundStyleDefaults(blockStyles.background) } }; } } const extraRules = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(blockStyles); extraRules.forEach(rule => { // Don't output padding properties if padding variables are set or if we're not editing a full template. if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith('padding')) { return; } const cssProperty = rule.key.startsWith('--') ? rule.key : use_global_styles_output_kebabCase(rule.key); let ruleValue = getResolvedValue(rule.value, tree, null); // Calculate fluid typography rules where available. if (cssProperty === 'font-size') { /* * getTypographyFontSizeValue() will check * if fluid typography has been activated and also * whether the incoming value can be converted to a fluid value. * Values that already have a "clamp()" function will not pass the test, * and therefore the original $value will be returned. */ ruleValue = getTypographyFontSizeValue({ size: ruleValue }, tree?.settings); } // For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset. // This ensures that a fixed height does not override the aspect ratio. if (cssProperty === 'aspect-ratio') { output.push('min-height: unset'); } output.push(`${cssProperty}: ${ruleValue}`); }); return output; } /** * Get generated CSS for layout styles by looking up layout definitions provided * in theme.json, and outputting common layout styles, and specific blockGap values. * * @param {Object} props * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type. * @param {Object} props.style A style object containing spacing values. * @param {string} props.selector Selector used to group together layout styling rules. * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support. * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles. * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available. * @return {string} Generated CSS rules for the layout styles. */ function getLayoutStyles({ layoutDefinitions = LAYOUT_DEFINITIONS, style, selector, hasBlockGapSupport, hasFallbackGapSupport, fallbackGapValue }) { let ruleset = ''; let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : ''; // Ensure a fallback gap value for the root layout definitions, // and use a fallback value if one is provided for the current block. if (hasFallbackGapSupport) { if (selector === ROOT_BLOCK_SELECTOR) { gapValue = !gapValue ? '0.5em' : gapValue; } else if (!hasBlockGapSupport && fallbackGapValue) { gapValue = fallbackGapValue; } } if (gapValue && layoutDefinitions) { Object.values(layoutDefinitions).forEach(({ className, name, spacingStyles }) => { // Allow outputting fallback gap styles for flex layout type when block gap support isn't available. if (!hasBlockGapSupport && 'flex' !== name && 'grid' !== name) { return; } if (spacingStyles?.length) { spacingStyles.forEach(spacingStyle => { const declarations = []; if (spacingStyle.rules) { Object.entries(spacingStyle.rules).forEach(([cssProperty, cssValue]) => { declarations.push(`${cssProperty}: ${cssValue ? cssValue : gapValue}`); }); } if (declarations.length) { let combinedSelector = ''; if (!hasBlockGapSupport) { // For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles. combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ''})` : `:where(${selector}.${className}${spacingStyle?.selector || ''})`; } else { combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.${className})${spacingStyle?.selector || ''}` : `:root :where(${selector}-${className})${spacingStyle?.selector || ''}`; } ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`; } }); } }); // For backwards compatibility, ensure the legacy block gap CSS variable is still available. if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: ${gapValue}; }`; } } // Output base styles if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) { const validDisplayModes = ['block', 'flex', 'grid']; Object.values(layoutDefinitions).forEach(({ className, displayMode, baseStyles }) => { if (displayMode && validDisplayModes.includes(displayMode)) { ruleset += `${selector} .${className} { display:${displayMode}; }`; } if (baseStyles?.length) { baseStyles.forEach(baseStyle => { const declarations = []; if (baseStyle.rules) { Object.entries(baseStyle.rules).forEach(([cssProperty, cssValue]) => { declarations.push(`${cssProperty}: ${cssValue}`); }); } if (declarations.length) { const combinedSelector = `.${className}${baseStyle?.selector || ''}`; ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`; } }); } }); } return ruleset; } const STYLE_KEYS = ['border', 'color', 'dimensions', 'spacing', 'typography', 'filter', 'outline', 'shadow', 'background']; function pickStyleKeys(treeToPickFrom) { if (!treeToPickFrom) { return {}; } const entries = Object.entries(treeToPickFrom); const pickedEntries = entries.filter(([key]) => STYLE_KEYS.includes(key)); // clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it const clonedEntries = pickedEntries.map(([key, style]) => [key, JSON.parse(JSON.stringify(style))]); return Object.fromEntries(clonedEntries); } const getNodesWithStyles = (tree, blockSelectors) => { var _tree$styles$blocks; const nodes = []; if (!tree?.styles) { return nodes; } // Top-level. const styles = pickStyleKeys(tree.styles); if (styles) { nodes.push({ styles, selector: ROOT_BLOCK_SELECTOR, // Root selector (body) styles should not be wrapped in `:root where()` to keep // specificity at (0,0,1) and maintain backwards compatibility. skipSelectorWrapper: true }); } Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => { if (tree.styles?.elements?.[name]) { nodes.push({ styles: tree.styles?.elements?.[name], selector, // Top level elements that don't use a class name should not receive the // `:root :where()` wrapper to maintain backwards compatibility. skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name] }); } }); // Iterate over blocks: they can have styles & elements. Object.entries((_tree$styles$blocks = tree.styles?.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(([blockName, node]) => { var _node$elements; const blockStyles = pickStyleKeys(node); if (node?.variations) { const variations = {}; Object.entries(node.variations).forEach(([variationName, variation]) => { var _variation$elements, _variation$blocks; variations[variationName] = pickStyleKeys(variation); if (variation?.css) { variations[variationName].css = variation.css; } const variationSelector = blockSelectors[blockName]?.styleVariationSelectors?.[variationName]; // Process the variation's inner element styles. // This comes before the inner block styles so the // element styles within the block type styles take // precedence over these. Object.entries((_variation$elements = variation?.elements) !== null && _variation$elements !== void 0 ? _variation$elements : {}).forEach(([element, elementStyles]) => { if (elementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]) { nodes.push({ styles: elementStyles, selector: scopeSelector(variationSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]) }); } }); // Process the variations inner block type styles. Object.entries((_variation$blocks = variation?.blocks) !== null && _variation$blocks !== void 0 ? _variation$blocks : {}).forEach(([variationBlockName, variationBlockStyles]) => { var _variationBlockStyles; const variationBlockSelector = scopeSelector(variationSelector, blockSelectors[variationBlockName]?.selector); const variationDuotoneSelector = scopeSelector(variationSelector, blockSelectors[variationBlockName]?.duotoneSelector); const variationFeatureSelectors = scopeFeatureSelectors(variationSelector, blockSelectors[variationBlockName]?.featureSelectors); const variationBlockStyleNodes = pickStyleKeys(variationBlockStyles); if (variationBlockStyles?.css) { variationBlockStyleNodes.css = variationBlockStyles.css; } nodes.push({ selector: variationBlockSelector, duotoneSelector: variationDuotoneSelector, featureSelectors: variationFeatureSelectors, fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue, hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport, styles: variationBlockStyleNodes }); // Process element styles for the inner blocks // of the variation. Object.entries((_variationBlockStyles = variationBlockStyles.elements) !== null && _variationBlockStyles !== void 0 ? _variationBlockStyles : {}).forEach(([variationBlockElement, variationBlockElementStyles]) => { if (variationBlockElementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) { nodes.push({ styles: variationBlockElementStyles, selector: scopeSelector(variationBlockSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) }); } }); }); }); blockStyles.variations = variations; } if (blockSelectors?.[blockName]?.selector) { nodes.push({ duotoneSelector: blockSelectors[blockName].duotoneSelector, fallbackGapValue: blockSelectors[blockName].fallbackGapValue, hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport, selector: blockSelectors[blockName].selector, styles: blockStyles, featureSelectors: blockSelectors[blockName].featureSelectors, styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors }); } Object.entries((_node$elements = node?.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(([elementName, value]) => { if (value && blockSelectors?.[blockName] && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]) { nodes.push({ styles: value, selector: blockSelectors[blockName]?.selector.split(',').map(sel => { const elementSelectors = external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName].split(','); return elementSelectors.map(elementSelector => sel + ' ' + elementSelector); }).join(',') }); } }); }); return nodes; }; const getNodesWithSettings = (tree, blockSelectors) => { var _tree$settings$blocks; const nodes = []; if (!tree?.settings) { return nodes; } const pickPresets = treeToPickFrom => { let presets = {}; PRESET_METADATA.forEach(({ path }) => { const value = getValueFromObjectPath(treeToPickFrom, path, false); if (value !== false) { presets = setImmutably(presets, path, value); } }); return presets; }; // Top-level. const presets = pickPresets(tree.settings); const custom = tree.settings?.custom; if (Object.keys(presets).length > 0 || custom) { nodes.push({ presets, custom, selector: ROOT_CSS_PROPERTIES_SELECTOR }); } // Blocks. Object.entries((_tree$settings$blocks = tree.settings?.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(([blockName, node]) => { const blockPresets = pickPresets(node); const blockCustom = node.custom; if (Object.keys(blockPresets).length > 0 || blockCustom) { nodes.push({ presets: blockPresets, custom: blockCustom, selector: blockSelectors[blockName]?.selector }); } }); return nodes; }; const toCustomProperties = (tree, blockSelectors) => { const settings = getNodesWithSettings(tree, blockSelectors); let ruleset = ''; settings.forEach(({ presets, custom, selector }) => { const declarations = getPresetsDeclarations(presets, tree?.settings); const customProps = flattenTree(custom, '--wp--custom--', '--'); if (customProps.length > 0) { declarations.push(...customProps); } if (declarations.length > 0) { ruleset += `${selector}{${declarations.join(';')};}`; } }); return ruleset; }; const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = undefined) => { // These allow opting out of certain sets of styles. const options = { blockGap: true, blockStyles: true, layoutStyles: true, marginReset: true, presets: true, rootPadding: true, variationStyles: false, ...styleOptions }; const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments; const { contentSize, wideSize } = tree?.settings?.layout || {}; const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles; let ruleset = ''; if (options.presets && (contentSize || wideSize)) { ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} {`; ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: ${contentSize};` : ruleset; ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: ${wideSize};` : ruleset; ruleset += '}'; } if (hasBodyStyles) { /* * Reset default browser margin on the body element. * This is set on the body selector **before** generating the ruleset * from the `theme.json`. This is to ensure that if the `theme.json` declares * `margin` in its `spacing` declaration for the `body` element then these * user-generated values take precedence in the CSS cascade. * @link https://github.com/WordPress/gutenberg/issues/36147. */ ruleset += ':where(body) {margin: 0;'; // Root padding styles should be output for full templates, patterns and template parts. if (options.rootPadding && useRootPaddingAlign) { /* * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508 * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors. */ ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; } .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0; `; } ruleset += '}'; } if (options.blockStyles) { nodesWithStyles.forEach(({ selector, duotoneSelector, styles, fallbackGapValue, hasLayoutSupport, featureSelectors, styleVariationSelectors, skipSelectorWrapper }) => { // Process styles for block support features with custom feature level // CSS selectors set. if (featureSelectors) { const featureDeclarations = getFeatureDeclarations(featureSelectors, styles); Object.entries(featureDeclarations).forEach(([cssSelector, declarations]) => { if (declarations.length) { const rules = declarations.join(';'); ruleset += `:root :where(${cssSelector}){${rules};}`; } }); } // Process duotone styles. if (duotoneSelector) { const duotoneStyles = {}; if (styles?.filter) { duotoneStyles.filter = styles.filter; delete styles.filter; } const duotoneDeclarations = getStylesDeclarations(duotoneStyles); if (duotoneDeclarations.length) { ruleset += `${duotoneSelector}{${duotoneDeclarations.join(';')};}`; } } // Process blockGap and layout styles. if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) { ruleset += getLayoutStyles({ style: styles, selector, hasBlockGapSupport, hasFallbackGapSupport, fallbackGapValue }); } // Process the remaining block styles (they use either normal block class or __experimentalSelector). const styleDeclarations = getStylesDeclarations(styles, selector, useRootPaddingAlign, tree, disableRootPadding); if (styleDeclarations?.length) { const generalSelector = skipSelectorWrapper ? selector : `:root :where(${selector})`; ruleset += `${generalSelector}{${styleDeclarations.join(';')};}`; } if (styles?.css) { ruleset += processCSSNesting(styles.css, `:root :where(${selector})`); } if (options.variationStyles && styleVariationSelectors) { Object.entries(styleVariationSelectors).forEach(([styleVariationName, styleVariationSelector]) => { const styleVariations = styles?.variations?.[styleVariationName]; if (styleVariations) { // If the block uses any custom selectors for block support, add those first. if (featureSelectors) { const featureDeclarations = getFeatureDeclarations(featureSelectors, styleVariations); Object.entries(featureDeclarations).forEach(([baseSelector, declarations]) => { if (declarations.length) { const cssSelector = concatFeatureVariationSelectorString(baseSelector, styleVariationSelector); const rules = declarations.join(';'); ruleset += `:root :where(${cssSelector}){${rules};}`; } }); } // Otherwise add regular selectors. const styleVariationDeclarations = getStylesDeclarations(styleVariations, styleVariationSelector, useRootPaddingAlign, tree); if (styleVariationDeclarations.length) { ruleset += `:root :where(${styleVariationSelector}){${styleVariationDeclarations.join(';')};}`; } if (styleVariations?.css) { ruleset += processCSSNesting(styleVariations.css, `:root :where(${styleVariationSelector})`); } } }); } // Check for pseudo selector in `styles` and handle separately. const pseudoSelectorStyles = Object.entries(styles).filter(([key]) => key.startsWith(':')); if (pseudoSelectorStyles?.length) { pseudoSelectorStyles.forEach(([pseudoKey, pseudoStyle]) => { const pseudoDeclarations = getStylesDeclarations(pseudoStyle); if (!pseudoDeclarations?.length) { return; } // `selector` may be provided in a form // where block level selectors have sub element // selectors appended to them as a comma separated // string. // e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`; // Split and append pseudo selector to create // the proper rules to target the elements. const _selector = selector.split(',').map(sel => sel + pseudoKey).join(','); // As pseudo classes such as :hover, :focus etc. have class-level // specificity, they must use the `:root :where()` wrapper. This. // caps the specificity at `0-1-0` to allow proper nesting of variations // and block type element styles. const pseudoRule = `:root :where(${_selector}){${pseudoDeclarations.join(';')};}`; ruleset += pseudoRule; }); } }); } if (options.layoutStyles) { /* Add alignment / layout styles */ ruleset = ruleset + '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }'; ruleset = ruleset + '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }'; ruleset = ruleset + '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'; } if (options.blockGap && hasBlockGapSupport) { // Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value. const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || '0.5em'; ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: ${gapValue}; margin-block-end: 0; }`; ruleset = ruleset + ':root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }'; ruleset = ruleset + ':root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }'; } if (options.presets) { nodesWithSettings.forEach(({ selector, presets }) => { if (ROOT_BLOCK_SELECTOR === selector || ROOT_CSS_PROPERTIES_SELECTOR === selector) { // Do not add extra specificity for top-level classes. selector = ''; } const classes = getPresetsClasses(selector, presets); if (classes.length > 0) { ruleset += classes; } }); } return ruleset; }; function toSvgFilters(tree, blockSelectors) { const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); return nodesWithSettings.flatMap(({ presets }) => { return getPresetsSvgFilters(presets); }); } const getSelectorsConfig = (blockType, rootSelector) => { if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) { return blockType.selectors; } const config = { root: rootSelector }; Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(([featureKey, featureName]) => { const featureSelector = getBlockCSSSelector(blockType, featureKey); if (featureSelector) { config[featureName] = featureSelector; } }); return config; }; const getBlockSelectors = (blockTypes, getBlockStyles, variationInstanceId) => { const result = {}; blockTypes.forEach(blockType => { const name = blockType.name; const selector = getBlockCSSSelector(blockType); let duotoneSelector = getBlockCSSSelector(blockType, 'filter.duotone'); // Keep backwards compatibility for support.color.__experimentalDuotone. if (!duotoneSelector) { const rootSelector = getBlockCSSSelector(blockType); const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'color.__experimentalDuotone', false); duotoneSelector = duotoneSupport && scopeSelector(rootSelector, duotoneSupport); } const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout; const fallbackGapValue = blockType?.supports?.spacing?.blockGap?.__experimentalDefault; const blockStyleVariations = getBlockStyles(name); const styleVariationSelectors = {}; blockStyleVariations?.forEach(variation => { const variationSuffix = variationInstanceId ? `-${variationInstanceId}` : ''; const variationName = `${variation.name}${variationSuffix}`; const styleVariationSelector = getBlockStyleVariationSelector(variationName, selector); styleVariationSelectors[variationName] = styleVariationSelector; }); // For each block support feature add any custom selectors. const featureSelectors = getSelectorsConfig(blockType, selector); result[name] = { duotoneSelector, fallbackGapValue, featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : undefined, hasLayoutSupport, name, selector, styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : undefined }; }); return result; }; /** * If there is a separator block whose color is defined in theme.json via background, * update the separator color to the same value by using border color. * * @param {Object} config Theme.json configuration file object. * @return {Object} configTheme.json configuration file object updated. */ function updateConfigWithSeparator(config) { const needsSeparatorStyleUpdate = config.styles?.blocks?.['core/separator'] && config.styles?.blocks?.['core/separator'].color?.background && !config.styles?.blocks?.['core/separator'].color?.text && !config.styles?.blocks?.['core/separator'].border?.color; if (needsSeparatorStyleUpdate) { return { ...config, styles: { ...config.styles, blocks: { ...config.styles.blocks, 'core/separator': { ...config.styles.blocks['core/separator'], color: { ...config.styles.blocks['core/separator'].color, text: config.styles?.blocks['core/separator'].color.background } } } } }; } return config; } function processCSSNesting(css, blockSelector) { let processedCSS = ''; if (!css || css.trim() === '') { return processedCSS; } // Split CSS nested rules. const parts = css.split('&'); parts.forEach(part => { if (!part || part.trim() === '') { return; } const isRootCss = !part.includes('{'); if (isRootCss) { // If the part doesn't contain braces, it applies to the root level. processedCSS += `:root :where(${blockSelector}){${part.trim()}}`; } else { // If the part contains braces, it's a nested CSS rule. const splitPart = part.replace('}', '').split('{'); if (splitPart.length !== 2) { return; } const [nestedSelector, cssValue] = splitPart; // Handle pseudo elements such as ::before, ::after, etc. Regex will also // capture any leading combinator such as >, +, or ~, as well as spaces. // This allows pseudo elements as descendants e.g. `.parent ::before`. const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/); const pseudoPart = matches ? matches[1] : ''; const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, '').trim() : nestedSelector.trim(); let combinedSelector; if (withoutPseudoElement === '') { // Only contained a pseudo element to use the block selector to form // the final `:root :where()` selector. combinedSelector = blockSelector; } else { // If the nested selector is a descendant of the block scope it with the // block selector. Otherwise append it to the block selector. combinedSelector = nestedSelector.startsWith(' ') ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement); } // Build final rule, re-adding any pseudo element outside the `:where()` // to maintain valid CSS selector. processedCSS += `:root :where(${combinedSelector})${pseudoPart}{${cssValue.trim()}}`; } }); return processedCSS; } /** * Returns the global styles output using a global styles configuration. * If wishing to generate global styles and settings based on the * global styles config loaded in the editor context, use `useGlobalStylesOutput()`. * The use case for a custom config is to generate bespoke styles * and settings for previews, or other out-of-editor experiences. * * @param {Object} mergedConfig Global styles configuration. * @param {boolean} disableRootPadding Disable root padding styles. * * @return {Array} Array of stylesheets and settings. */ function useGlobalStylesOutputWithConfig(mergedConfig = {}, disableRootPadding) { const [blockGap] = useGlobalSetting('spacing.blockGap'); const hasBlockGapSupport = blockGap !== null; const hasFallbackGapSupport = !hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support. const disableLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(store); return !!getSettings().disableLayoutStyles; }); const { getBlockStyles } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); return (0,external_wp_element_namespaceObject.useMemo)(() => { var _updatedConfig$styles; if (!mergedConfig?.styles || !mergedConfig?.settings) { return []; } const updatedConfig = updateConfigWithSeparator(mergedConfig); const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles); const customProperties = toCustomProperties(updatedConfig, blockSelectors); const globalStyles = toStyles(updatedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding); const svgs = toSvgFilters(updatedConfig, blockSelectors); const styles = [{ css: customProperties, isGlobalStyles: true }, { css: globalStyles, isGlobalStyles: true }, // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor. { css: (_updatedConfig$styles = updatedConfig.styles.css) !== null && _updatedConfig$styles !== void 0 ? _updatedConfig$styles : '', isGlobalStyles: true }, { assets: svgs, __unstableType: 'svg', isGlobalStyles: true }]; // Loop through the blocks to check if there are custom CSS values. // If there are, get the block selector and push the selector together with // the CSS value to the 'stylesheets' array. (0,external_wp_blocks_namespaceObject.getBlockTypes)().forEach(blockType => { if (updatedConfig.styles.blocks[blockType.name]?.css) { const selector = blockSelectors[blockType.name].selector; styles.push({ css: processCSSNesting(updatedConfig.styles.blocks[blockType.name]?.css, selector), isGlobalStyles: true }); } }); return [styles, updatedConfig.settings]; }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles, disableRootPadding, getBlockStyles]); } /** * Returns the global styles output based on the current state of global styles config loaded in the editor context. * * @param {boolean} disableRootPadding Disable root padding styles. * * @return {Array} Array of stylesheets and settings. */ function useGlobalStylesOutput(disableRootPadding = false) { const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); return useGlobalStylesOutputWithConfig(mergedConfig, disableRootPadding); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-style-variation.js /** * WordPress dependencies */ /** * Internal dependencies */ const VARIATION_PREFIX = 'is-style-'; function getVariationMatches(className) { if (!className) { return []; } return className.split(/\s+/).reduce((matches, name) => { if (name.startsWith(VARIATION_PREFIX)) { const match = name.slice(VARIATION_PREFIX.length); if (match !== 'default') { matches.push(match); } } return matches; }, []); } /** * Get the first block style variation that has been registered from the class string. * * @param {string} className CSS class string for a block. * @param {Array} registeredStyles Currently registered block styles. * * @return {string|null} The name of the first registered variation. */ function getVariationNameFromClass(className, registeredStyles = []) { // The global flag affects how capturing groups work in JS. So the regex // below will only return full CSS classes not just the variation name. const matches = getVariationMatches(className); if (!matches) { return null; } for (const variation of matches) { if (registeredStyles.some(style => style.name === variation)) { return variation; } } return null; } // A helper component to apply a style override using the useStyleOverride hook. function OverrideStyles({ override }) { usePrivateStyleOverride(override); } /** * This component is used to generate new block style variation overrides * based on an incoming theme config. If a matching style is found in the config, * a new override is created and returned. The overrides can be used in conjunction with * useStyleOverride to apply the new styles to the editor. Its use is * subject to change. * * @param {Object} props Props. * @param {Object} props.config A global styles object, containing settings and styles. * @return {JSX.Element|undefined} An array of new block variation overrides. */ function __unstableBlockStyleVariationOverridesWithConfig({ config }) { const { getBlockStyles, overrides } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ getBlockStyles: select(external_wp_blocks_namespaceObject.store).getBlockStyles, overrides: unlock(select(store)).getStyleOverrides() }), []); const { getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); const overridesWithConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!overrides?.length) { return; } const newOverrides = []; const overriddenClientIds = []; for (const [, override] of overrides) { if (override?.variation && override?.clientId && /* * Because this component overwrites existing style overrides, * filter out any overrides that are already present in the store. */ !overriddenClientIds.includes(override.clientId)) { const blockName = getBlockName(override.clientId); const configStyles = config?.styles?.blocks?.[blockName]?.variations?.[override.variation]; if (configStyles) { const variationConfig = { settings: config?.settings, // The variation style data is all that is needed to generate // the styles for the current application to a block. The variation // name is updated to match the instance specific class name. styles: { blocks: { [blockName]: { variations: { [`${override.variation}-${override.clientId}`]: configStyles } } } } }; const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles, override.clientId); const hasBlockGapSupport = false; const hasFallbackGapSupport = true; const disableLayoutStyles = true; const disableRootPadding = true; const variationStyles = toStyles(variationConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding, { blockGap: false, blockStyles: true, layoutStyles: false, marginReset: false, presets: false, rootPadding: false, variationStyles: true }); newOverrides.push({ id: `${override.variation}-${override.clientId}`, css: variationStyles, __unstableType: 'variation', variation: override.variation, // The clientId will be stored with the override and used to ensure // the order of overrides matches the order of blocks so that the // correct CSS cascade is maintained. clientId: override.clientId }); overriddenClientIds.push(override.clientId); } } } return newOverrides; }, [config, overrides, getBlockStyles, getBlockName]); if (!overridesWithConfig || !overridesWithConfig.length) { return; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: overridesWithConfig.map(override => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverrideStyles, { override: override }, override.id)) }); } /** * Retrieves any variation styles data and resolves any referenced values. * * @param {Object} globalStyles A complete global styles object, containing settings and styles. * @param {string} name The name of the desired block type. * @param {variation} variation The of the block style variation to retrieve data for. * * @return {Object|undefined} The global styles data for the specified variation. */ function getVariationStylesWithRefValues(globalStyles, name, variation) { if (!globalStyles?.styles?.blocks?.[name]?.variations?.[variation]) { return; } // Helper to recursively look for `ref` values to resolve. const replaceRefs = variationStyles => { Object.keys(variationStyles).forEach(key => { const value = variationStyles[key]; // Only process objects. if (typeof value === 'object' && value !== null) { // Process `ref` value if present. if (value.ref !== undefined) { if (typeof value.ref !== 'string' || value.ref.trim() === '') { // Remove invalid ref. delete variationStyles[key]; } else { // Resolve `ref` value. const refValue = getValueFromObjectPath(globalStyles, value.ref); if (refValue) { variationStyles[key] = refValue; } else { delete variationStyles[key]; } } } else { // Recursively resolve `ref` values in nested objects. replaceRefs(value); // After recursion, if value is empty due to explicitly // `undefined` ref value, remove it. if (Object.keys(value).length === 0) { delete variationStyles[key]; } } } }); }; // Deep clone variation node to avoid mutating it within global styles and losing refs. const styles = JSON.parse(JSON.stringify(globalStyles.styles.blocks[name].variations[variation])); replaceRefs(styles); return styles; } function useBlockStyleVariation(name, variation, clientId) { // Prefer global styles data in GlobalStylesContext, which are available // if in the site editor. Otherwise fall back to whatever is in the // editor settings and available in the post editor. const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const { globalSettings, globalStyles } = (0,external_wp_data_namespaceObject.useSelect)(select => { const settings = select(store).getSettings(); return { globalSettings: settings.__experimentalFeatures, globalStyles: settings[globalStylesDataKey] }; }, []); return (0,external_wp_element_namespaceObject.useMemo)(() => { var _mergedConfig$setting, _mergedConfig$styles, _mergedConfig$setting2; const variationStyles = getVariationStylesWithRefValues({ settings: (_mergedConfig$setting = mergedConfig?.settings) !== null && _mergedConfig$setting !== void 0 ? _mergedConfig$setting : globalSettings, styles: (_mergedConfig$styles = mergedConfig?.styles) !== null && _mergedConfig$styles !== void 0 ? _mergedConfig$styles : globalStyles }, name, variation); return { settings: (_mergedConfig$setting2 = mergedConfig?.settings) !== null && _mergedConfig$setting2 !== void 0 ? _mergedConfig$setting2 : globalSettings, // The variation style data is all that is needed to generate // the styles for the current application to a block. The variation // name is updated to match the instance specific class name. styles: { blocks: { [name]: { variations: { [`${variation}-${clientId}`]: variationStyles } } } } }; }, [mergedConfig, globalSettings, globalStyles, variation, clientId, name]); } // Rather than leveraging `useInstanceId` here, the `clientId` is used. // This is so that the variation style override's ID is predictable // when the order of applied style variations changes. function block_style_variation_useBlockProps({ name, className, clientId }) { const { getBlockStyles } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const registeredStyles = getBlockStyles(name); const variation = getVariationNameFromClass(className, registeredStyles); const variationClass = `${VARIATION_PREFIX}${variation}-${clientId}`; const { settings, styles } = useBlockStyleVariation(name, variation, clientId); const variationStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!variation) { return; } const variationConfig = { settings, styles }; const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles, clientId); const hasBlockGapSupport = false; const hasFallbackGapSupport = true; const disableLayoutStyles = true; const disableRootPadding = true; return toStyles(variationConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding, { blockGap: false, blockStyles: true, layoutStyles: false, marginReset: false, presets: false, rootPadding: false, variationStyles: true }); }, [variation, settings, styles, getBlockStyles, clientId]); usePrivateStyleOverride({ id: `variation-${clientId}`, css: variationStyles, __unstableType: 'variation', variation, // The clientId will be stored with the override and used to ensure // the order of overrides matches the order of blocks so that the // correct CSS cascade is maintained. clientId }); return variation ? { className: variationClass } : {}; } /* harmony default export */ const block_style_variation = ({ hasSupport: () => true, attributeKeys: ['className'], isMatch: ({ className }) => getVariationMatches(className).length > 0, useBlockProps: block_style_variation_useBlockProps }); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/layout.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const layoutBlockSupportKey = 'layout'; const { kebabCase: layout_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function hasLayoutBlockSupport(blockName) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'layout') || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, '__experimentalLayout'); } /** * Generates the utility classnames for the given block's layout attributes. * * @param { Object } blockAttributes Block attributes. * @param { string } blockName Block name. * * @return { Array } Array of CSS classname strings. */ function useLayoutClasses(blockAttributes = {}, blockName = '') { const { layout } = blockAttributes; const { default: defaultBlockLayout } = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, layoutBlockSupportKey) || {}; const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: 'constrained' } : layout || defaultBlockLayout || {}; const layoutClassnames = []; if (LAYOUT_DEFINITIONS[usedLayout?.type || 'default']?.className) { const baseClassName = LAYOUT_DEFINITIONS[usedLayout?.type || 'default']?.className; const splitBlockName = blockName.split('/'); const fullBlockName = splitBlockName[0] === 'core' ? splitBlockName.pop() : splitBlockName.join('-'); const compoundClassName = `wp-block-${fullBlockName}-${baseClassName}`; layoutClassnames.push(baseClassName, compoundClassName); } const hasGlobalPadding = (0,external_wp_data_namespaceObject.useSelect)(select => { return (usedLayout?.inherit || usedLayout?.contentSize || usedLayout?.type === 'constrained') && select(store).getSettings().__experimentalFeatures?.useRootPaddingAwareAlignments; }, [usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type]); if (hasGlobalPadding) { layoutClassnames.push('has-global-padding'); } if (usedLayout?.orientation) { layoutClassnames.push(`is-${layout_kebabCase(usedLayout.orientation)}`); } if (usedLayout?.justifyContent) { layoutClassnames.push(`is-content-justification-${layout_kebabCase(usedLayout.justifyContent)}`); } if (usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap') { layoutClassnames.push('is-nowrap'); } return layoutClassnames; } /** * Generates a CSS rule with the given block's layout styles. * * @param { Object } blockAttributes Block attributes. * @param { string } blockName Block name. * @param { string } selector A selector to use in generating the CSS rule. * * @return { string } CSS rule. */ function useLayoutStyles(blockAttributes = {}, blockName, selector) { const { layout = {}, style = {} } = blockAttributes; // Update type for blocks using legacy layouts. const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: 'constrained' } : layout || {}; const fullLayoutType = getLayoutType(usedLayout?.type || 'default'); const [blockGapSupport] = use_settings_useSettings('spacing.blockGap'); const hasBlockGapSupport = blockGapSupport !== null; return fullLayoutType?.getLayoutStyle?.({ blockName, selector, layout, style, hasBlockGapSupport }); } function LayoutPanelPure({ layout, setAttributes, name: blockName, clientId }) { const settings = useBlockSettings(blockName); // Block settings come from theme.json under settings.[blockName]. const { layout: layoutSettings } = settings; const { themeSupportsLayout } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(store); return { themeSupportsLayout: getSettings().supportsLayout }; }, []); const blockEditingMode = useBlockEditingMode(); if (blockEditingMode !== 'default') { return null; } // Layout block support comes from the block's block.json. const layoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, layoutBlockSupportKey, {}); const blockSupportAndThemeSettings = { ...layoutSettings, ...layoutBlockSupport }; const { allowSwitching, allowEditing = true, allowInheriting = true, default: defaultBlockLayout } = blockSupportAndThemeSettings; if (!allowEditing) { return null; } /* * Try to find the layout type from either the * block's layout settings or any saved layout config. */ const blockSupportAndLayout = { ...layoutBlockSupport, ...layout }; const { type, default: { type: defaultType = 'default' } = {} } = blockSupportAndLayout; const blockLayoutType = type || defaultType; // Only show the inherit toggle if it's supported, // and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other. const showInheritToggle = !!(allowInheriting && (!blockLayoutType || blockLayoutType === 'default' || blockLayoutType === 'constrained' || blockSupportAndLayout.inherit)); const usedLayout = layout || defaultBlockLayout || {}; const { inherit = false, contentSize = null } = usedLayout; /** * `themeSupportsLayout` is only relevant to the `default/flow` or * `constrained` layouts and it should not be taken into account when other * `layout` types are used. */ if ((blockLayoutType === 'default' || blockLayoutType === 'constrained') && !themeSupportsLayout) { return null; } const layoutType = getLayoutType(blockLayoutType); const constrainedType = getLayoutType('constrained'); const displayControlsForLegacyLayouts = !usedLayout.type && (contentSize || inherit); const hasContentSizeOrLegacySettings = !!inherit || !!contentSize; const onChangeType = newType => setAttributes({ layout: { type: newType } }); const onChangeLayout = newLayout => setAttributes({ layout: newLayout }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Layout'), children: [showInheritToggle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Inner blocks use content width'), checked: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings, onChange: () => setAttributes({ layout: { type: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? 'default' : 'constrained' } }), help: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? (0,external_wp_i18n_namespaceObject.__)('Nested blocks use content width with options for full and wide widths.') : (0,external_wp_i18n_namespaceObject.__)('Nested blocks will fill the width of this container.') }) }), !inherit && allowSwitching && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutTypeSwitcher, { type: blockLayoutType, onChange: onChangeType }), layoutType && layoutType.name !== 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layoutType.inspectorControls, { layout: usedLayout, onChange: onChangeLayout, layoutBlockSupport: blockSupportAndThemeSettings, name: blockName, clientId: clientId }), constrainedType && displayControlsForLegacyLayouts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(constrainedType.inspectorControls, { layout: usedLayout, onChange: onChangeLayout, layoutBlockSupport: blockSupportAndThemeSettings, name: blockName, clientId: clientId })] }) }), !inherit && layoutType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layoutType.toolBarControls, { layout: usedLayout, onChange: onChangeLayout, layoutBlockSupport: layoutBlockSupport, name: blockName, clientId: clientId })] }); } /* harmony default export */ const layout = ({ shareWithChildBlocks: true, edit: LayoutPanelPure, attributeKeys: ['layout'], hasSupport(name) { return hasLayoutBlockSupport(name); } }); function LayoutTypeSwitcher({ type, onChange }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, isBlock: true, label: (0,external_wp_i18n_namespaceObject.__)('Layout type'), __nextHasNoMarginBottom: true, hideLabelFromVision: true, isAdaptiveWidth: true, value: type, onChange: onChange, children: getLayoutTypes().map(({ name, label }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: name, label: label }, name); }) }); } /** * Filters registered block settings, extending attributes to include `layout`. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function layout_addAttribute(settings) { var _settings$attributes$; if ('type' in ((_settings$attributes$ = settings.attributes?.layout) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) { return settings; } if (hasLayoutBlockSupport(settings)) { settings.attributes = { ...settings.attributes, layout: { type: 'object' } }; } return settings; } function BlockWithLayoutStyles({ block: BlockListBlock, props, blockGapSupport, layoutClasses }) { const { name, attributes } = props; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock); const { layout } = attributes; const { default: defaultBlockLayout } = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, layoutBlockSupportKey) || {}; const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: 'constrained' } : layout || defaultBlockLayout || {}; const selectorPrefix = `wp-container-${layout_kebabCase(name)}-is-layout-`; // Higher specificity to override defaults from theme.json. const selector = `.${selectorPrefix}${id}`; const hasBlockGapSupport = blockGapSupport !== null; // Get CSS string for the current layout type. // The CSS and `style` element is only output if it is not empty. const fullLayoutType = getLayoutType(usedLayout?.type || 'default'); const css = fullLayoutType?.getLayoutStyle?.({ blockName: name, selector, layout: usedLayout, style: attributes?.style, hasBlockGapSupport }); // Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`. const layoutClassNames = dist_clsx({ [`${selectorPrefix}${id}`]: !!css // Only attach a container class if there is generated CSS to be attached. }, layoutClasses); useStyleOverride({ css }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListBlock, { ...props, __unstableLayoutClassNames: layoutClassNames }); } /** * Override the default block element to add the layout styles. * * @param {Function} BlockListBlock Original component. * * @return {Function} Wrapped component. */ const withLayoutStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { const { clientId, name, attributes } = props; const blockSupportsLayout = hasLayoutBlockSupport(name); const layoutClasses = useLayoutClasses(attributes, name); const extraProps = (0,external_wp_data_namespaceObject.useSelect)(select => { // The callback returns early to avoid block editor subscription. if (!blockSupportsLayout) { return; } const { getSettings, getBlockSettings } = unlock(select(store)); const { disableLayoutStyles } = getSettings(); if (disableLayoutStyles) { return; } const [blockGapSupport] = getBlockSettings(clientId, 'spacing.blockGap'); return { blockGapSupport }; }, [blockSupportsLayout, clientId]); if (!extraProps) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListBlock, { ...props, __unstableLayoutClassNames: blockSupportsLayout ? layoutClasses : undefined }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockWithLayoutStyles, { block: BlockListBlock, props: props, layoutClasses: layoutClasses, ...extraProps }); }, 'withLayoutStyles'); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/layout/addAttribute', layout_addAttribute); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/layout/with-layout-styles', withLayoutStyles); ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/utils.js function range(start, length) { return Array.from({ length }, (_, i) => start + i); } class GridRect { constructor({ columnStart, rowStart, columnEnd, rowEnd, columnSpan, rowSpan } = {}) { this.columnStart = columnStart !== null && columnStart !== void 0 ? columnStart : 1; this.rowStart = rowStart !== null && rowStart !== void 0 ? rowStart : 1; if (columnSpan !== undefined) { this.columnEnd = this.columnStart + columnSpan - 1; } else { this.columnEnd = columnEnd !== null && columnEnd !== void 0 ? columnEnd : this.columnStart; } if (rowSpan !== undefined) { this.rowEnd = this.rowStart + rowSpan - 1; } else { this.rowEnd = rowEnd !== null && rowEnd !== void 0 ? rowEnd : this.rowStart; } } get columnSpan() { return this.columnEnd - this.columnStart + 1; } get rowSpan() { return this.rowEnd - this.rowStart + 1; } contains(column, row) { return column >= this.columnStart && column <= this.columnEnd && row >= this.rowStart && row <= this.rowEnd; } containsRect(rect) { return this.contains(rect.columnStart, rect.rowStart) && this.contains(rect.columnEnd, rect.rowEnd); } intersectsRect(rect) { return this.columnStart <= rect.columnEnd && this.columnEnd >= rect.columnStart && this.rowStart <= rect.rowEnd && this.rowEnd >= rect.rowStart; } } function utils_getComputedCSS(element, property) { return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); } /** * Given a grid-template-columns or grid-template-rows CSS property value, gets the start and end * position in pixels of each grid track. * * https://css-tricks.com/snippets/css/complete-guide-grid/#aa-grid-track * * @param {string} template The grid-template-columns or grid-template-rows CSS property value. * Only supports fixed sizes in pixels. * @param {number} gap The gap between grid tracks in pixels. * * @return {Array<{start: number, end: number}>} An array of objects with the start and end * position in pixels of each grid track. */ function getGridTracks(template, gap) { const tracks = []; for (const size of template.split(' ')) { const previousTrack = tracks[tracks.length - 1]; const start = previousTrack ? previousTrack.end + gap : 0; const end = start + parseFloat(size); tracks.push({ start, end }); } return tracks; } /** * Given an array of grid tracks and a position in pixels, gets the index of the closest track to * that position. * * https://css-tricks.com/snippets/css/complete-guide-grid/#aa-grid-track * * @param {Array<{start: number, end: number}>} tracks An array of objects with the start and end * position in pixels of each grid track. * @param {number} position The position in pixels. * @param {string} edge The edge of the track to compare the * position to. Either 'start' or 'end'. * * @return {number} The index of the closest track to the position. 0-based, unlike CSS grid which * is 1-based. */ function getClosestTrack(tracks, position, edge = 'start') { return tracks.reduce((closest, track, index) => Math.abs(track[edge] - position) < Math.abs(tracks[closest][edge] - position) ? index : closest, 0); } function getGridRect(gridElement, rect) { const columnGap = parseFloat(utils_getComputedCSS(gridElement, 'column-gap')); const rowGap = parseFloat(utils_getComputedCSS(gridElement, 'row-gap')); const gridColumnTracks = getGridTracks(utils_getComputedCSS(gridElement, 'grid-template-columns'), columnGap); const gridRowTracks = getGridTracks(utils_getComputedCSS(gridElement, 'grid-template-rows'), rowGap); const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1; const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1; const columnEnd = getClosestTrack(gridColumnTracks, rect.right, 'end') + 1; const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, 'end') + 1; return new GridRect({ columnStart, columnEnd, rowStart, rowEnd }); } function getGridItemRect(gridItemElement) { return getGridRect(gridItemElement.parentElement, new window.DOMRect(gridItemElement.offsetLeft, gridItemElement.offsetTop, gridItemElement.offsetWidth, gridItemElement.offsetHeight)); } function getGridInfo(gridElement) { const gridTemplateColumns = utils_getComputedCSS(gridElement, 'grid-template-columns'); const gridTemplateRows = utils_getComputedCSS(gridElement, 'grid-template-rows'); const borderTopWidth = utils_getComputedCSS(gridElement, 'border-top-width'); const borderRightWidth = utils_getComputedCSS(gridElement, 'border-right-width'); const borderBottomWidth = utils_getComputedCSS(gridElement, 'border-bottom-width'); const borderLeftWidth = utils_getComputedCSS(gridElement, 'border-left-width'); const paddingTop = utils_getComputedCSS(gridElement, 'padding-top'); const paddingRight = utils_getComputedCSS(gridElement, 'padding-right'); const paddingBottom = utils_getComputedCSS(gridElement, 'padding-bottom'); const paddingLeft = utils_getComputedCSS(gridElement, 'padding-left'); const numColumns = gridTemplateColumns.split(' ').length; const numRows = gridTemplateRows.split(' ').length; const numItems = numColumns * numRows; return { numColumns, numRows, numItems, currentColor: utils_getComputedCSS(gridElement, 'color'), style: { gridTemplateColumns, gridTemplateRows, gap: utils_getComputedCSS(gridElement, 'gap'), inset: ` calc(${paddingTop} + ${borderTopWidth}) calc(${paddingRight} + ${borderRightWidth}) calc(${paddingBottom} + ${borderBottomWidth}) calc(${paddingLeft} + ${borderLeftWidth}) ` } }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/tips.js /** * WordPress dependencies */ const globalTips = [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('While writing, you can press <kbd>/</kbd> to quickly insert new blocks.'), { kbd: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) }), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Indent a list by pressing <kbd>space</kbd> at the beginning of a line.'), { kbd: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) }), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line.'), { kbd: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) }), (0,external_wp_i18n_namespaceObject.__)('Drag files into the editor to automatically insert media blocks.'), (0,external_wp_i18n_namespaceObject.__)("Change a block's type by pressing the block icon on the toolbar.")]; function Tips() { const [randomIndex] = (0,external_wp_element_namespaceObject.useState)( // Disable Reason: I'm not generating an HTML id. // eslint-disable-next-line no-restricted-syntax Math.floor(Math.random() * globalTips.length)); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tip, { children: globalTips[randomIndex] }); } /* harmony default export */ const tips = (Tips); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js /** * WordPress dependencies */ const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); /* harmony default export */ const chevron_right = (chevronRight); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js /** * WordPress dependencies */ const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); /* harmony default export */ const chevron_left = (chevronLeft); ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js /** * WordPress dependencies */ const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) }); /* harmony default export */ const block_default = (blockDefault); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js /** * External dependencies */ /** * WordPress dependencies */ function BlockIcon({ icon, showColors = false, className, context }) { if (icon?.src === 'block-default') { icon = { src: block_default }; } const renderedIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon && icon.src ? icon.src : icon, context: context }); const style = showColors ? { backgroundColor: icon && icon.background, color: icon && icon.foreground } : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: style, className: dist_clsx('block-editor-block-icon', className, { 'has-colors': showColors }), children: renderedIcon }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-icon/README.md */ /* harmony default export */ const block_icon = ((0,external_wp_element_namespaceObject.memo)(BlockIcon)); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-card/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Badge } = unlock(external_wp_components_namespaceObject.privateApis); /** * A card component that displays block information including title, icon, and description. * Can be used to show block metadata and navigation controls for parent blocks. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-card/README.md * * @example * ```jsx * function Example() { * return ( * <BlockCard * title="My Block" * icon="smiley" * description="A simple block example" * name="Custom Block" * /> * ); * } * ``` * * @param {Object} props Component props. * @param {string} props.title The title of the block. * @param {string|Object} props.icon The icon of the block. This can be any of [WordPress' Dashicons](https://developer.wordpress.org/resource/dashicons/), or a custom `svg` element. * @param {string} props.description The description of the block. * @param {Object} [props.blockType] Deprecated: Object containing block type data. * @param {string} [props.className] Additional classes to apply to the card. * @param {string} [props.name] Custom block name to display before the title. * @return {Element} Block card component. */ function BlockCard({ title, icon, description, blockType, className, name }) { if (blockType) { external_wp_deprecated_default()('`blockType` property in `BlockCard component`', { since: '5.7', alternative: '`title, icon and description` properties' }); ({ title, icon, description } = blockType); } const { parentNavBlockClientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlockClientId, getBlockParentsByBlockName } = select(store); const _selectedBlockClientId = getSelectedBlockClientId(); return { parentNavBlockClientId: getBlockParentsByBlockName(_selectedBlockClientId, 'core/navigation', true)[0] }; }, []); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('block-editor-block-card', className), children: [parentNavBlockClientId && /*#__PURE__*/ // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here. (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: () => selectBlock(parentNavBlockClientId), label: (0,external_wp_i18n_namespaceObject.__)('Go to parent Navigation block'), style: // TODO: This style override is also used in ToolsPanelHeader. // It should be supported out-of-the-box by Button. { minWidth: 24, padding: 0 }, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, size: "small" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: icon, showColors: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("h2", { className: "block-editor-block-card__title", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-card__name", children: !!name?.length ? name : title }), !!name?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { children: title })] }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "block-editor-block-card__description", children: description })] })] }); } /* harmony default export */ const block_card = (BlockCard); ;// ./node_modules/@wordpress/upload-media/build-module/store/types.js let Type = /*#__PURE__*/function (Type) { Type["Unknown"] = "REDUX_UNKNOWN"; Type["Add"] = "ADD_ITEM"; Type["Prepare"] = "PREPARE_ITEM"; Type["Cancel"] = "CANCEL_ITEM"; Type["Remove"] = "REMOVE_ITEM"; Type["PauseItem"] = "PAUSE_ITEM"; Type["ResumeItem"] = "RESUME_ITEM"; Type["PauseQueue"] = "PAUSE_QUEUE"; Type["ResumeQueue"] = "RESUME_QUEUE"; Type["OperationStart"] = "OPERATION_START"; Type["OperationFinish"] = "OPERATION_FINISH"; Type["AddOperations"] = "ADD_OPERATIONS"; Type["CacheBlobUrl"] = "CACHE_BLOB_URL"; Type["RevokeBlobUrls"] = "REVOKE_BLOB_URLS"; Type["UpdateSettings"] = "UPDATE_SETTINGS"; return Type; }({}); // Must match the Attachment type from the media-utils package. let ItemStatus = /*#__PURE__*/function (ItemStatus) { ItemStatus["Processing"] = "PROCESSING"; ItemStatus["Paused"] = "PAUSED"; return ItemStatus; }({}); let OperationType = /*#__PURE__*/function (OperationType) { OperationType["Prepare"] = "PREPARE"; OperationType["Upload"] = "UPLOAD"; return OperationType; }({}); ;// ./node_modules/@wordpress/upload-media/build-module/store/reducer.js /** * Internal dependencies */ const reducer_noop = () => {}; const DEFAULT_STATE = { queue: [], queueStatus: 'active', blobUrls: {}, settings: { mediaUpload: reducer_noop } }; function reducer_reducer(state = DEFAULT_STATE, action = { type: Type.Unknown }) { switch (action.type) { case Type.PauseQueue: { return { ...state, queueStatus: 'paused' }; } case Type.ResumeQueue: { return { ...state, queueStatus: 'active' }; } case Type.Add: return { ...state, queue: [...state.queue, action.item] }; case Type.Cancel: return { ...state, queue: state.queue.map(item => item.id === action.id ? { ...item, error: action.error } : item) }; case Type.Remove: return { ...state, queue: state.queue.filter(item => item.id !== action.id) }; case Type.OperationStart: { return { ...state, queue: state.queue.map(item => item.id === action.id ? { ...item, currentOperation: action.operation } : item) }; } case Type.AddOperations: return { ...state, queue: state.queue.map(item => { if (item.id !== action.id) { return item; } return { ...item, operations: [...(item.operations || []), ...action.operations] }; }) }; case Type.OperationFinish: return { ...state, queue: state.queue.map(item => { if (item.id !== action.id) { return item; } const operations = item.operations ? item.operations.slice(1) : []; // Prevent an empty object if there's no attachment data. const attachment = item.attachment || action.item.attachment ? { ...item.attachment, ...action.item.attachment } : undefined; return { ...item, currentOperation: undefined, operations, ...action.item, attachment, additionalData: { ...item.additionalData, ...action.item.additionalData } }; }) }; case Type.CacheBlobUrl: { const blobUrls = state.blobUrls[action.id] || []; return { ...state, blobUrls: { ...state.blobUrls, [action.id]: [...blobUrls, action.blobUrl] } }; } case Type.RevokeBlobUrls: { const newBlobUrls = { ...state.blobUrls }; delete newBlobUrls[action.id]; return { ...state, blobUrls: newBlobUrls }; } case Type.UpdateSettings: { return { ...state, settings: { ...state.settings, ...action.settings } }; } } return state; } /* harmony default export */ const store_reducer = (reducer_reducer); ;// ./node_modules/@wordpress/upload-media/build-module/store/selectors.js /** * Internal dependencies */ /** * Returns all items currently being uploaded. * * @param state Upload state. * * @return Queue items. */ function getItems(state) { return state.queue; } /** * Determines whether any upload is currently in progress. * * @param state Upload state. * * @return Whether any upload is currently in progress. */ function isUploading(state) { return state.queue.length >= 1; } /** * Determines whether an upload is currently in progress given an attachment URL. * * @param state Upload state. * @param url Attachment URL. * * @return Whether upload is currently in progress for the given attachment. */ function isUploadingByUrl(state, url) { return state.queue.some(item => item.attachment?.url === url || item.sourceUrl === url); } /** * Determines whether an upload is currently in progress given an attachment ID. * * @param state Upload state. * @param attachmentId Attachment ID. * * @return Whether upload is currently in progress for the given attachment. */ function isUploadingById(state, attachmentId) { return state.queue.some(item => item.attachment?.id === attachmentId || item.sourceAttachmentId === attachmentId); } /** * Returns the media upload settings. * * @param state Upload state. * * @return Settings */ function selectors_getSettings(state) { return state.settings; } ;// ./node_modules/@wordpress/upload-media/build-module/store/private-selectors.js /** * Internal dependencies */ /** * Returns all items currently being uploaded. * * @param state Upload state. * * @return Queue items. */ function getAllItems(state) { return state.queue; } /** * Returns a specific item given its unique ID. * * @param state Upload state. * @param id Item ID. * * @return Queue item. */ function getItem(state, id) { return state.queue.find(item => item.id === id); } /** * Determines whether a batch has been successfully uploaded, given its unique ID. * * @param state Upload state. * @param batchId Batch ID. * * @return Whether a batch has been uploaded. */ function isBatchUploaded(state, batchId) { const batchItems = state.queue.filter(item => batchId === item.batchId); return batchItems.length === 0; } /** * Determines whether an upload is currently in progress given a post or attachment ID. * * @param state Upload state. * @param postOrAttachmentId Post ID or attachment ID. * * @return Whether upload is currently in progress for the given post or attachment. */ function isUploadingToPost(state, postOrAttachmentId) { return state.queue.some(item => item.currentOperation === OperationType.Upload && item.additionalData.post === postOrAttachmentId); } /** * Returns the next paused upload for a given post or attachment ID. * * @param state Upload state. * @param postOrAttachmentId Post ID or attachment ID. * * @return Paused item. */ function getPausedUploadForPost(state, postOrAttachmentId) { return state.queue.find(item => item.status === ItemStatus.Paused && item.additionalData.post === postOrAttachmentId); } /** * Determines whether uploading is currently paused. * * @param state Upload state. * * @return Whether uploading is currently paused. */ function isPaused(state) { return state.queueStatus === 'paused'; } /** * Returns all cached blob URLs for a given item ID. * * @param state Upload state. * @param id Item ID * * @return List of blob URLs. */ function getBlobUrls(state, id) { return state.blobUrls[id] || []; } ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } function stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// ./node_modules/@wordpress/upload-media/build-module/upload-error.js /** * MediaError class. * * Small wrapper around the `Error` class * to hold an error code and a reference to a file object. */ class UploadError extends Error { constructor({ code, message, file, cause }) { super(message, { cause }); Object.setPrototypeOf(this, new.target.prototype); this.code = code; this.file = file; } } ;// ./node_modules/@wordpress/upload-media/build-module/validate-mime-type.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Verifies if the caller (e.g. a block) supports this mime type. * * @param file File object. * @param allowedTypes List of allowed mime types. */ function validateMimeType(file, allowedTypes) { if (!allowedTypes) { return; } // Allowed type specified by consumer. const isAllowedType = allowedTypes.some(allowedType => { // If a complete mimetype is specified verify if it matches exactly the mime type of the file. if (allowedType.includes('/')) { return allowedType === file.type; } // Otherwise a general mime type is used, and we should verify if the file mimetype starts with it. return file.type.startsWith(`${allowedType}/`); }); if (file.type && !isAllowedType) { throw new UploadError({ code: 'MIME_TYPE_NOT_SUPPORTED', message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)('%s: Sorry, this file type is not supported here.'), file.name), file }); } } ;// ./node_modules/@wordpress/upload-media/build-module/get-mime-types-array.js /** * Browsers may use unexpected mime types, and they differ from browser to browser. * This function computes a flexible array of mime types from the mime type structured provided by the server. * Converts { jpg|jpeg|jpe: "image/jpeg" } into [ "image/jpeg", "image/jpg", "image/jpeg", "image/jpe" ] * * @param {?Object} wpMimeTypesObject Mime type object received from the server. * Extensions are keys separated by '|' and values are mime types associated with an extension. * * @return An array of mime types or null */ function getMimeTypesArray(wpMimeTypesObject) { if (!wpMimeTypesObject) { return null; } return Object.entries(wpMimeTypesObject).flatMap(([extensionsString, mime]) => { const [type] = mime.split('/'); const extensions = extensionsString.split('|'); return [mime, ...extensions.map(extension => `${type}/${extension}`)]; }); } ;// ./node_modules/@wordpress/upload-media/build-module/validate-mime-type-for-user.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Verifies if the user is allowed to upload this mime type. * * @param file File object. * @param wpAllowedMimeTypes List of allowed mime types and file extensions. */ function validateMimeTypeForUser(file, wpAllowedMimeTypes) { // Allowed types for the current WP_User. const allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes); if (!allowedMimeTypesForUser) { return; } const isAllowedMimeTypeForUser = allowedMimeTypesForUser.includes(file.type); if (file.type && !isAllowedMimeTypeForUser) { throw new UploadError({ code: 'MIME_TYPE_NOT_ALLOWED_FOR_USER', message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)('%s: Sorry, you are not allowed to upload this file type.'), file.name), file }); } } ;// ./node_modules/@wordpress/upload-media/build-module/validate-file-size.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Verifies whether the file is within the file upload size limits for the site. * * @param file File object. * @param maxUploadFileSize Maximum upload size in bytes allowed for the site. */ function validateFileSize(file, maxUploadFileSize) { // Don't allow empty files to be uploaded. if (file.size <= 0) { throw new UploadError({ code: 'EMPTY_FILE', message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)('%s: This file is empty.'), file.name), file }); } if (maxUploadFileSize && file.size > maxUploadFileSize) { throw new UploadError({ code: 'SIZE_ABOVE_LIMIT', message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)('%s: This file exceeds the maximum upload size for this site.'), file.name), file }); } } ;// ./node_modules/@wordpress/upload-media/build-module/store/actions.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Adds a new item to the upload queue. * * @param $0 * @param $0.files Files * @param [$0.onChange] Function called each time a file or a temporary representation of the file is available. * @param [$0.onSuccess] Function called after the file is uploaded. * @param [$0.onBatchSuccess] Function called after a batch of files is uploaded. * @param [$0.onError] Function called when an error happens. * @param [$0.additionalData] Additional data to include in the request. * @param [$0.allowedTypes] Array with the types of media that can be uploaded, if unset all types are allowed. */ function addItems({ files, onChange, onSuccess, onError, onBatchSuccess, additionalData, allowedTypes }) { return async ({ select, dispatch }) => { const batchId = esm_browser_v4(); for (const file of files) { /* Check if the caller (e.g. a block) supports this mime type. Special case for file types such as HEIC which will be converted before upload anyway. Another check will be done before upload. */ try { validateMimeType(file, allowedTypes); validateMimeTypeForUser(file, select.getSettings().allowedMimeTypes); } catch (error) { onError?.(error); continue; } try { validateFileSize(file, select.getSettings().maxUploadFileSize); } catch (error) { onError?.(error); continue; } dispatch.addItem({ file, batchId, onChange, onSuccess, onBatchSuccess, onError, additionalData }); } }; } /** * Cancels an item in the queue based on an error. * * @param id Item ID. * @param error Error instance. * @param silent Whether to cancel the item silently, * without invoking its `onError` callback. */ function cancelItem(id, error, silent = false) { return async ({ select, dispatch }) => { const item = select.getItem(id); if (!item) { /* * Do nothing if item has already been removed. * This can happen if an upload is cancelled manually * while transcoding with vips is still in progress. * Then, cancelItem() is once invoked manually and once * by the error handler in optimizeImageItem(). */ return; } item.abortController?.abort(); if (!silent) { const { onError } = item; onError?.(error !== null && error !== void 0 ? error : new Error('Upload cancelled')); if (!onError && error) { // TODO: Find better way to surface errors with sideloads etc. // eslint-disable-next-line no-console -- Deliberately log errors here. console.error('Upload cancelled', error); } } dispatch({ type: Type.Cancel, id, error }); dispatch.removeItem(id); dispatch.revokeBlobUrls(id); // All items of this batch were cancelled or finished. if (item.batchId && select.isBatchUploaded(item.batchId)) { item.onBatchSuccess?.(); } }; } ;// ./node_modules/@wordpress/upload-media/build-module/utils.js /** * WordPress dependencies */ /** * Converts a Blob to a File with a default name like "image.png". * * If it is already a File object, it is returned unchanged. * * @param fileOrBlob Blob object. * @return File object. */ function convertBlobToFile(fileOrBlob) { if (fileOrBlob instanceof File) { return fileOrBlob; } // Extension is only an approximation. // The server will override it if incorrect. const ext = fileOrBlob.type.split('/')[1]; const mediaType = 'application/pdf' === fileOrBlob.type ? 'document' : fileOrBlob.type.split('/')[0]; return new File([fileOrBlob], `${mediaType}.${ext}`, { type: fileOrBlob.type }); } /** * Renames a given file and returns a new file. * * Copies over the last modified time. * * @param file File object. * @param name File name. * @return Renamed file object. */ function renameFile(file, name) { return new File([file], name, { type: file.type, lastModified: file.lastModified }); } /** * Clones a given file object. * * @param file File object. * @return New file object. */ function cloneFile(file) { return renameFile(file, file.name); } /** * Returns the file extension from a given file name or URL. * * @param file File URL. * @return File extension or null if it does not have one. */ function getFileExtension(file) { return file.includes('.') ? file.split('.').pop() || null : null; } /** * Returns file basename without extension. * * For example, turns "my-awesome-file.jpeg" into "my-awesome-file". * * @param name File name. * @return File basename. */ function getFileBasename(name) { return name.includes('.') ? name.split('.').slice(0, -1).join('.') : name; } /** * Returns the file name including extension from a URL. * * @param url File URL. * @return File name. */ function getFileNameFromUrl(url) { return getFilename(url) || _x('unnamed', 'file name'); } ;// ./node_modules/@wordpress/upload-media/build-module/stub-file.js class StubFile extends File { constructor(fileName = 'stub-file') { super([], fileName); } } ;// ./node_modules/@wordpress/upload-media/build-module/store/private-actions.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Adds a new item to the upload queue. * * @param $0 * @param $0.file File * @param [$0.batchId] Batch ID. * @param [$0.onChange] Function called each time a file or a temporary representation of the file is available. * @param [$0.onSuccess] Function called after the file is uploaded. * @param [$0.onBatchSuccess] Function called after a batch of files is uploaded. * @param [$0.onError] Function called when an error happens. * @param [$0.additionalData] Additional data to include in the request. * @param [$0.sourceUrl] Source URL. Used when importing a file from a URL or optimizing an existing file. * @param [$0.sourceAttachmentId] Source attachment ID. Used when optimizing an existing file for example. * @param [$0.abortController] Abort controller for upload cancellation. * @param [$0.operations] List of operations to perform. Defaults to automatically determined list, based on the file. */ function addItem({ file: fileOrBlob, batchId, onChange, onSuccess, onBatchSuccess, onError, additionalData = {}, sourceUrl, sourceAttachmentId, abortController, operations }) { return async ({ dispatch }) => { const itemId = esm_browser_v4(); // Hardening in case a Blob is passed instead of a File. // See https://github.com/WordPress/gutenberg/pull/65693 for an example. const file = convertBlobToFile(fileOrBlob); let blobUrl; // StubFile could be coming from addItemFromUrl(). if (!(file instanceof StubFile)) { blobUrl = (0,external_wp_blob_namespaceObject.createBlobURL)(file); dispatch({ type: Type.CacheBlobUrl, id: itemId, blobUrl }); } dispatch({ type: Type.Add, item: { id: itemId, batchId, status: ItemStatus.Processing, sourceFile: cloneFile(file), file, attachment: { url: blobUrl }, additionalData: { convert_format: false, ...additionalData }, onChange, onSuccess, onBatchSuccess, onError, sourceUrl, sourceAttachmentId, abortController: abortController || new AbortController(), operations: Array.isArray(operations) ? operations : [OperationType.Prepare] } }); dispatch.processItem(itemId); }; } /** * Processes a single item in the queue. * * Runs the next operation in line and invokes any callbacks. * * @param id Item ID. */ function processItem(id) { return async ({ select, dispatch }) => { if (select.isPaused()) { return; } const item = select.getItem(id); const { attachment, onChange, onSuccess, onBatchSuccess, batchId } = item; const operation = Array.isArray(item.operations?.[0]) ? item.operations[0][0] : item.operations?.[0]; if (attachment) { onChange?.([attachment]); } /* If there are no more operations, the item can be removed from the queue, but only if there are no thumbnails still being side-loaded, or if itself is a side-loaded item. */ if (!operation) { if (attachment) { onSuccess?.([attachment]); } // dispatch.removeItem( id ); dispatch.revokeBlobUrls(id); if (batchId && select.isBatchUploaded(batchId)) { onBatchSuccess?.(); } /* At this point we are dealing with a parent whose children haven't fully uploaded yet. Do nothing and let the removal happen once the last side-loaded item finishes. */ return; } if (!operation) { // This shouldn't really happen. return; } dispatch({ type: Type.OperationStart, id, operation }); switch (operation) { case OperationType.Prepare: dispatch.prepareItem(item.id); break; case OperationType.Upload: dispatch.uploadItem(id); break; } }; } /** * Returns an action object that pauses all processing in the queue. * * Useful for testing purposes. * * @return Action object. */ function pauseQueue() { return { type: Type.PauseQueue }; } /** * Resumes all processing in the queue. * * Dispatches an action object for resuming the queue itself, * and triggers processing for each remaining item in the queue individually. */ function resumeQueue() { return async ({ select, dispatch }) => { dispatch({ type: Type.ResumeQueue }); for (const item of select.getAllItems()) { dispatch.processItem(item.id); } }; } /** * Removes a specific item from the queue. * * @param id Item ID. */ function removeItem(id) { return async ({ select, dispatch }) => { const item = select.getItem(id); if (!item) { return; } dispatch({ type: Type.Remove, id }); }; } /** * Finishes an operation for a given item ID and immediately triggers processing the next one. * * @param id Item ID. * @param updates Updated item data. */ function finishOperation(id, updates) { return async ({ dispatch }) => { dispatch({ type: Type.OperationFinish, id, item: updates }); dispatch.processItem(id); }; } /** * Prepares an item for initial processing. * * Determines the list of operations to perform for a given image, * depending on its media type. * * For example, HEIF images first need to be converted, resized, * compressed, and then uploaded. * * Or videos need to be compressed, and then need poster generation * before upload. * * @param id Item ID. */ function prepareItem(id) { return async ({ dispatch }) => { const operations = [OperationType.Upload]; dispatch({ type: Type.AddOperations, id, operations }); dispatch.finishOperation(id, {}); }; } /** * Uploads an item to the server. * * @param id Item ID. */ function uploadItem(id) { return async ({ select, dispatch }) => { const item = select.getItem(id); select.getSettings().mediaUpload({ filesList: [item.file], additionalData: item.additionalData, signal: item.abortController?.signal, onFileChange: ([attachment]) => { if (!(0,external_wp_blob_namespaceObject.isBlobURL)(attachment.url)) { dispatch.finishOperation(id, { attachment }); } }, onSuccess: ([attachment]) => { dispatch.finishOperation(id, { attachment }); }, onError: error => { dispatch.cancelItem(id, error); } }); }; } /** * Revokes all blob URLs for a given item, freeing up memory. * * @param id Item ID. */ function revokeBlobUrls(id) { return async ({ select, dispatch }) => { const blobUrls = select.getBlobUrls(id); for (const blobUrl of blobUrls) { (0,external_wp_blob_namespaceObject.revokeBlobURL)(blobUrl); } dispatch({ type: Type.RevokeBlobUrls, id }); }; } /** * Returns an action object that pauses all processing in the queue. * * Useful for testing purposes. * * @param settings * @return Action object. */ function private_actions_updateSettings(settings) { return { type: Type.UpdateSettings, settings }; } ;// ./node_modules/@wordpress/upload-media/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/upload-media'); ;// ./node_modules/@wordpress/upload-media/build-module/store/constants.js const constants_STORE_NAME = 'core/upload-media'; ;// ./node_modules/@wordpress/upload-media/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Media upload data store configuration. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore */ const store_storeConfig = { reducer: store_reducer, selectors: store_selectors_namespaceObject, actions: store_actions_namespaceObject }; /** * Store definition for the media upload namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore */ const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { reducer: store_reducer, selectors: store_selectors_namespaceObject, actions: store_actions_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store_store); // @ts-ignore lock_unlock_unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject); // @ts-ignore lock_unlock_unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject); ;// ./node_modules/@wordpress/upload-media/build-module/components/provider/with-registry-provider.js /** * WordPress dependencies */ /** * Internal dependencies */ function getSubRegistry(subRegistries, registry, useSubRegistry) { if (!useSubRegistry) { return registry; } let subRegistry = subRegistries.get(registry); if (!subRegistry) { subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry); subRegistry.registerStore(constants_STORE_NAME, store_storeConfig); subRegistries.set(registry, subRegistry); } return subRegistry; } const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => ({ useSubRegistry = true, ...props }) => { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => new WeakMap()); const subRegistry = getSubRegistry(subRegistries, registry, useSubRegistry); if (subRegistry === registry) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: registry, ...props }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); }, 'withRegistryProvider'); /* harmony default export */ const with_registry_provider = (withRegistryProvider); ;// ./node_modules/@wordpress/upload-media/build-module/components/provider/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const MediaUploadProvider = with_registry_provider(props => { const { children, settings } = props; const { updateSettings } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); (0,external_wp_element_namespaceObject.useEffect)(() => { updateSettings(settings); }, [settings, updateSettings]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: children }); }); /* harmony default export */ const provider = (MediaUploadProvider); ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/with-registry-provider.js /** * WordPress dependencies */ /** * Internal dependencies */ function with_registry_provider_getSubRegistry(subRegistries, registry, useSubRegistry) { if (!useSubRegistry) { return registry; } let subRegistry = subRegistries.get(registry); if (!subRegistry) { subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry); subRegistry.registerStore(STORE_NAME, storeConfig); subRegistries.set(registry, subRegistry); } return subRegistry; } const with_registry_provider_withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => ({ useSubRegistry = true, ...props }) => { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => new WeakMap()); const subRegistry = with_registry_provider_getSubRegistry(subRegistries, registry, useSubRegistry); if (subRegistry === registry) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: registry, ...props }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); }, 'withRegistryProvider'); /* harmony default export */ const provider_with_registry_provider = (with_registry_provider_withRegistryProvider); ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/use-block-sync.js /** * WordPress dependencies */ /** * Internal dependencies */ const use_block_sync_noop = () => {}; /** * A function to call when the block value has been updated in the block-editor * store. * * @callback onBlockUpdate * @param {Object[]} blocks The updated blocks. * @param {Object} options The updated block options, such as selectionStart * and selectionEnd. */ /** * useBlockSync is a side effect which handles bidirectional sync between the * block-editor store and a controlling data source which provides blocks. This * is most commonly used by the BlockEditorProvider to synchronize the contents * of the block-editor store with the root entity, like a post. * * Another example would be the template part block, which provides blocks from * a separate entity data source than a root entity. This hook syncs edits to * the template part in the block editor back to the entity and vice-versa. * * Here are some of its basic functions: * - Initializes the block-editor store for the given clientID to the blocks * given via props. * - Adds incoming changes (like undo) to the block-editor store. * - Adds outgoing changes (like editing content) to the controlling entity, * determining if a change should be considered persistent or not. * - Handles edge cases and race conditions which occur in those operations. * - Ignores changes which happen to other entities (like nested inner block * controllers. * - Passes selection state from the block-editor store to the controlling entity. * * @param {Object} props Props for the block sync hook * @param {string} props.clientId The client ID of the inner block controller. * If none is passed, then it is assumed to be a * root controller rather than an inner block * controller. * @param {Object[]} props.value The control value for the blocks. This value * is used to initialize the block-editor store * and for resetting the blocks to incoming * changes like undo. * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo. * @param {onBlockUpdate} props.onChange Function to call when a persistent * change has been made in the block-editor blocks * for the given clientId. For example, after * this function is called, an entity is marked * dirty because it has changes to save. * @param {onBlockUpdate} props.onInput Function to call when a non-persistent * change has been made in the block-editor blocks * for the given clientId. When this is called, * controlling sources do not become dirty. */ function useBlockSync({ clientId = null, value: controlledBlocks, selection: controlledSelection, onChange = use_block_sync_noop, onInput = use_block_sync_noop }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { resetBlocks, resetSelection, replaceInnerBlocks, setHasControlledInnerBlocks, __unstableMarkNextChangeAsNotPersistent } = registry.dispatch(store); const { getBlockName, getBlocks, getSelectionStart, getSelectionEnd } = registry.select(store); const isControlled = (0,external_wp_data_namespaceObject.useSelect)(select => { return !clientId || select(store).areInnerBlocksControlled(clientId); }, [clientId]); const pendingChangesRef = (0,external_wp_element_namespaceObject.useRef)({ incoming: null, outgoing: [] }); const subscribedRef = (0,external_wp_element_namespaceObject.useRef)(false); const setControlledBlocks = () => { if (!controlledBlocks) { return; } // We don't need to persist this change because we only replace // controlled inner blocks when the change was caused by an entity, // and so it would already be persisted. __unstableMarkNextChangeAsNotPersistent(); if (clientId) { // It is important to batch here because otherwise, // as soon as `setHasControlledInnerBlocks` is called // the effect to restore might be triggered // before the actual blocks get set properly in state. registry.batch(() => { setHasControlledInnerBlocks(clientId, true); const storeBlocks = controlledBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); if (subscribedRef.current) { pendingChangesRef.current.incoming = storeBlocks; } __unstableMarkNextChangeAsNotPersistent(); replaceInnerBlocks(clientId, storeBlocks); }); } else { if (subscribedRef.current) { pendingChangesRef.current.incoming = controlledBlocks; } resetBlocks(controlledBlocks); } }; // Clean up the changes made by setControlledBlocks() when the component // containing useBlockSync() unmounts. const unsetControlledBlocks = () => { __unstableMarkNextChangeAsNotPersistent(); if (clientId) { setHasControlledInnerBlocks(clientId, false); __unstableMarkNextChangeAsNotPersistent(); replaceInnerBlocks(clientId, []); } else { resetBlocks([]); } }; // Add a subscription to the block-editor registry to detect when changes // have been made. This lets us inform the data source of changes. This // is an effect so that the subscriber can run synchronously without // waiting for React renders for changes. const onInputRef = (0,external_wp_element_namespaceObject.useRef)(onInput); const onChangeRef = (0,external_wp_element_namespaceObject.useRef)(onChange); (0,external_wp_element_namespaceObject.useEffect)(() => { onInputRef.current = onInput; onChangeRef.current = onChange; }, [onInput, onChange]); // Determine if blocks need to be reset when they change. (0,external_wp_element_namespaceObject.useEffect)(() => { if (pendingChangesRef.current.outgoing.includes(controlledBlocks)) { // Skip block reset if the value matches expected outbound sync // triggered by this component by a preceding change detection. // Only skip if the value matches expectation, since a reset should // still occur if the value is modified (not equal by reference), // to allow that the consumer may apply modifications to reflect // back on the editor. if (pendingChangesRef.current.outgoing[pendingChangesRef.current.outgoing.length - 1] === controlledBlocks) { pendingChangesRef.current.outgoing = []; } } else if (getBlocks(clientId) !== controlledBlocks) { // Reset changing value in all other cases than the sync described // above. Since this can be reached in an update following an out- // bound sync, unset the outbound value to avoid considering it in // subsequent renders. pendingChangesRef.current.outgoing = []; setControlledBlocks(); if (controlledSelection) { resetSelection(controlledSelection.selectionStart, controlledSelection.selectionEnd, controlledSelection.initialPosition); } } }, [controlledBlocks, clientId]); const isMountedRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { // On mount, controlled blocks are already set in the effect above. if (!isMountedRef.current) { isMountedRef.current = true; return; } // When the block becomes uncontrolled, it means its inner state has been reset // we need to take the blocks again from the external value property. if (!isControlled) { pendingChangesRef.current.outgoing = []; setControlledBlocks(); } }, [isControlled]); (0,external_wp_element_namespaceObject.useEffect)(() => { const { getSelectedBlocksInitialCaretPosition, isLastBlockChangePersistent, __unstableIsLastBlockChangeIgnored, areInnerBlocksControlled } = registry.select(store); let blocks = getBlocks(clientId); let isPersistent = isLastBlockChangePersistent(); let previousAreBlocksDifferent = false; subscribedRef.current = true; const unsubscribe = registry.subscribe(() => { // Sometimes, when changing block lists, lingering subscriptions // might trigger before they are cleaned up. If the block for which // the subscription runs is no longer in the store, this would clear // its parent entity's block list. To avoid this, we bail out if // the subscription is triggering for a block (`clientId !== null`) // and its block name can't be found because it's not on the list. // (`getBlockName( clientId ) === null`). if (clientId !== null && getBlockName(clientId) === null) { return; } // When RESET_BLOCKS on parent blocks get called, the controlled blocks // can reset to uncontrolled, in these situations, it means we need to populate // the blocks again from the external blocks (the value property here) // and we should stop triggering onChange const isStillControlled = !clientId || areInnerBlocksControlled(clientId); if (!isStillControlled) { return; } const newIsPersistent = isLastBlockChangePersistent(); const newBlocks = getBlocks(clientId); const areBlocksDifferent = newBlocks !== blocks; blocks = newBlocks; if (areBlocksDifferent && (pendingChangesRef.current.incoming || __unstableIsLastBlockChangeIgnored())) { pendingChangesRef.current.incoming = null; isPersistent = newIsPersistent; return; } // Since we often dispatch an action to mark the previous action as // persistent, we need to make sure that the blocks changed on the // previous action before committing the change. const didPersistenceChange = previousAreBlocksDifferent && !areBlocksDifferent && newIsPersistent && !isPersistent; if (areBlocksDifferent || didPersistenceChange) { isPersistent = newIsPersistent; // We know that onChange/onInput will update controlledBlocks. // We need to be aware that it was caused by an outgoing change // so that we do not treat it as an incoming change later on, // which would cause a block reset. pendingChangesRef.current.outgoing.push(blocks); // Inform the controlling entity that changes have been made to // the block-editor store they should be aware about. const updateParent = isPersistent ? onChangeRef.current : onInputRef.current; updateParent(blocks, { selection: { selectionStart: getSelectionStart(), selectionEnd: getSelectionEnd(), initialPosition: getSelectedBlocksInitialCaretPosition() } }); } previousAreBlocksDifferent = areBlocksDifferent; }, store); return () => { subscribedRef.current = false; unsubscribe(); }; }, [registry, clientId]); (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { unsetControlledBlocks(); }; }, []); } ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/keyboard-shortcuts/index.js /** * WordPress dependencies */ function KeyboardShortcuts() { return null; } function KeyboardShortcutsRegister() { // Registering the shortcuts. const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: 'core/block-editor/copy', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Copy the selected block(s).'), keyCombination: { modifier: 'primary', character: 'c' } }); registerShortcut({ name: 'core/block-editor/cut', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Cut the selected block(s).'), keyCombination: { modifier: 'primary', character: 'x' } }); registerShortcut({ name: 'core/block-editor/paste', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Paste the selected block(s).'), keyCombination: { modifier: 'primary', character: 'v' } }); registerShortcut({ name: 'core/block-editor/duplicate', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Duplicate the selected block(s).'), keyCombination: { modifier: 'primaryShift', character: 'd' } }); registerShortcut({ name: 'core/block-editor/remove', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Remove the selected block(s).'), keyCombination: { modifier: 'access', character: 'z' } }); registerShortcut({ name: 'core/block-editor/insert-before', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Insert a new block before the selected block(s).'), keyCombination: { modifier: 'primaryAlt', character: 't' } }); registerShortcut({ name: 'core/block-editor/insert-after', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Insert a new block after the selected block(s).'), keyCombination: { modifier: 'primaryAlt', character: 'y' } }); registerShortcut({ name: 'core/block-editor/delete-multi-selection', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Delete selection.'), keyCombination: { character: 'del' }, aliases: [{ character: 'backspace' }] }); registerShortcut({ name: 'core/block-editor/select-all', category: 'selection', description: (0,external_wp_i18n_namespaceObject.__)('Select all text when typing. Press again to select all blocks.'), keyCombination: { modifier: 'primary', character: 'a' } }); registerShortcut({ name: 'core/block-editor/unselect', category: 'selection', description: (0,external_wp_i18n_namespaceObject.__)('Clear selection.'), keyCombination: { character: 'escape' } }); registerShortcut({ name: 'core/block-editor/multi-text-selection', category: 'selection', description: (0,external_wp_i18n_namespaceObject.__)('Select text across multiple blocks.'), keyCombination: { modifier: 'shift', character: 'arrow' } }); registerShortcut({ name: 'core/block-editor/focus-toolbar', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the nearest toolbar.'), keyCombination: { modifier: 'alt', character: 'F10' } }); registerShortcut({ name: 'core/block-editor/move-up', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Move the selected block(s) up.'), keyCombination: { modifier: 'secondary', character: 't' } }); registerShortcut({ name: 'core/block-editor/move-down', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Move the selected block(s) down.'), keyCombination: { modifier: 'secondary', character: 'y' } }); // List view shortcuts. registerShortcut({ name: 'core/block-editor/collapse-list-view', category: 'list-view', description: (0,external_wp_i18n_namespaceObject.__)('Collapse all other items.'), keyCombination: { modifier: 'alt', character: 'l' } }); registerShortcut({ name: 'core/block-editor/group', category: 'block', description: (0,external_wp_i18n_namespaceObject.__)('Create a group block from the selected multiple blocks.'), keyCombination: { modifier: 'primary', character: 'g' } }); }, [registerShortcut]); return null; } KeyboardShortcuts.Register = KeyboardShortcutsRegister; /* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/use-media-upload-settings.js /** * WordPress dependencies */ /** * React hook used to compute the media upload settings to use in the post editor. * * @param {Object} settings Media upload settings prop. * * @return {Object} Media upload settings. */ function useMediaUploadSettings(settings = {}) { return (0,external_wp_element_namespaceObject.useMemo)(() => ({ mediaUpload: settings.mediaUpload, mediaSideload: settings.mediaSideload, maxUploadFileSize: settings.maxUploadFileSize, allowedMimeTypes: settings.allowedMimeTypes }), [settings]); } /* harmony default export */ const use_media_upload_settings = (useMediaUploadSettings); ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */ const provider_noop = () => {}; /** * Upload a media file when the file upload button is activated * or when adding a file to the editor via drag & drop. * * @param {WPDataRegistry} registry * @param {Object} $3 Parameters object passed to the function. * @param {Array} $3.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. * @param {Object} $3.additionalData Additional data to include in the request. * @param {Array<File>} $3.filesList List of files. * @param {Function} $3.onError Function called when an error happens. * @param {Function} $3.onFileChange Function called each time a file or a temporary representation of the file is available. * @param {Function} $3.onSuccess Function called once a file has completely finished uploading, including thumbnails. * @param {Function} $3.onBatchSuccess Function called once all files in a group have completely finished uploading, including thumbnails. */ function mediaUpload(registry, { allowedTypes, additionalData = {}, filesList, onError = provider_noop, onFileChange, onSuccess, onBatchSuccess }) { void registry.dispatch(store_store).addItems({ files: filesList, onChange: onFileChange, onSuccess, onBatchSuccess, onError: ({ message }) => onError(message), additionalData, allowedTypes }); } const ExperimentalBlockEditorProvider = provider_with_registry_provider(props => { const { settings: _settings, registry, stripExperimentalSettings = false } = props; const mediaUploadSettings = use_media_upload_settings(_settings); let settings = _settings; if (window.__experimentalMediaProcessing && _settings.mediaUpload) { // Create a new variable so that the original props.settings.mediaUpload is not modified. settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ..._settings, mediaUpload: mediaUpload.bind(null, registry) }), [_settings, registry]); } const { __experimentalUpdateSettings } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); (0,external_wp_element_namespaceObject.useEffect)(() => { __experimentalUpdateSettings({ ...settings, __internalIsInitialized: true }, { stripExperimentalSettings, reset: true }); }, [settings, stripExperimentalSettings, __experimentalUpdateSettings]); // Syncs the entity provider with changes in the block-editor store. useBlockSync(props); const children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SlotFillProvider, { passthrough: true, children: [!settings?.isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts.Register, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefsProvider, { children: props.children })] }); if (window.__experimentalMediaProcessing) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(provider, { settings: mediaUploadSettings, useSubRegistry: false, children: children }); } return children; }); const BlockEditorProvider = props => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { ...props, stripExperimentalSettings: true, children: props.children }); }; /* harmony default export */ const components_provider = (BlockEditorProvider); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js /** * WordPress dependencies */ /** @typedef {import('react').ReactNode} ReactNode */ /** * @typedef BlockContextProviderProps * * @property {Record<string,*>} value Context value to merge with current * value. * @property {ReactNode} children Component children. */ /** @type {import('react').Context<Record<string,*>>} */ const block_context_Context = (0,external_wp_element_namespaceObject.createContext)({}); /** * Component which merges passed value with current consumed block context. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-context/README.md * * @param {BlockContextProviderProps} props */ function BlockContextProvider({ value, children }) { const context = (0,external_wp_element_namespaceObject.useContext)(block_context_Context); const nextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...context, ...value }), [context, value]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_context_Context.Provider, { value: nextValue, children: children }); } /* harmony default export */ const block_context = (block_context_Context); ;// ./node_modules/@wordpress/block-editor/build-module/utils/block-bindings.js /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_ATTRIBUTE = '__default'; const PATTERN_OVERRIDES_SOURCE = 'core/pattern-overrides'; const BLOCK_BINDINGS_ALLOWED_BLOCKS = { 'core/paragraph': ['content'], 'core/heading': ['content'], 'core/image': ['id', 'url', 'title', 'alt'], 'core/button': ['url', 'text', 'linkTarget', 'rel'] }; /** * Checks if the given object is empty. * * @param {?Object} object The object to check. * * @return {boolean} Whether the object is empty. */ function isObjectEmpty(object) { return !object || Object.keys(object).length === 0; } /** * Based on the given block name, checks if it is possible to bind the block. * * @param {string} blockName The name of the block. * * @return {boolean} Whether it is possible to bind the block to sources. */ function canBindBlock(blockName) { return blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS; } /** * Based on the given block name and attribute name, checks if it is possible to bind the block attribute. * * @param {string} blockName The name of the block. * @param {string} attributeName The name of attribute. * * @return {boolean} Whether it is possible to bind the block attribute. */ function canBindAttribute(blockName, attributeName) { return canBindBlock(blockName) && BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName].includes(attributeName); } /** * Gets the bindable attributes for a given block. * * @param {string} blockName The name of the block. * * @return {string[]} The bindable attributes for the block. */ function getBindableAttributes(blockName) { return BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName]; } /** * Checks if the block has the `__default` binding for pattern overrides. * * @param {?Record<string, object>} bindings A block's bindings from the metadata attribute. * * @return {boolean} Whether the block has the `__default` binding for pattern overrides. */ function hasPatternOverridesDefaultBinding(bindings) { return bindings?.[DEFAULT_ATTRIBUTE]?.source === PATTERN_OVERRIDES_SOURCE; } /** * Returns the bindings with the `__default` binding for pattern overrides * replaced with the full-set of supported attributes. e.g.: * * - bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }` * - bindings returned: `{ content: { source: 'core/pattern-overrides' } }` * * @param {string} blockName The block name (e.g. 'core/paragraph'). * @param {?Record<string, object>} bindings A block's bindings from the metadata attribute. * * @return {Object} The bindings with default replaced for pattern overrides. */ function replacePatternOverridesDefaultBinding(blockName, bindings) { // The `__default` binding currently only works for pattern overrides. if (hasPatternOverridesDefaultBinding(bindings)) { const supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName]; const bindingsWithDefaults = {}; for (const attributeName of supportedAttributes) { // If the block has mixed binding sources, retain any non pattern override bindings. const bindingSource = bindings[attributeName] ? bindings[attributeName] : { source: PATTERN_OVERRIDES_SOURCE }; bindingsWithDefaults[attributeName] = bindingSource; } return bindingsWithDefaults; } return bindings; } /** * Contains utils to update the block `bindings` metadata. * * @typedef {Object} WPBlockBindingsUtils * * @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes. * @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute. */ /** * Retrieves the existing utils needed to update the block `bindings` metadata. * They can be used to create, modify, or remove connections from the existing block attributes. * * It contains the following utils: * - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`. * - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute. * * @since 6.7.0 Introduced in WordPress core. * * @param {?string} clientId Optional block client ID. If not set, it will use the current block client ID from the context. * * @return {?WPBlockBindingsUtils} Object containing the block bindings utils. * * @example * ```js * import { useBlockBindingsUtils } from '@wordpress/block-editor' * const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils(); * * // Update url and alt attributes. * updateBlockBindings( { * url: { * source: 'core/post-meta', * args: { * key: 'url_custom_field', * }, * }, * alt: { * source: 'core/post-meta', * args: { * key: 'text_custom_field', * }, * }, * } ); * * // Remove binding from url attribute. * updateBlockBindings( { url: undefined } ); * * // Remove bindings from all attributes. * removeAllBlockBindings(); * ``` */ function useBlockBindingsUtils(clientId) { const { clientId: contextClientId } = useBlockEditContext(); const blockClientId = clientId || contextClientId; const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getBlockAttributes } = (0,external_wp_data_namespaceObject.useRegistry)().select(store); /** * Updates the value of the bindings connected to block attributes. * It removes the binding when the new value is `undefined`. * * @param {Object} bindings Bindings including the attributes to update and the new object. * @param {string} bindings.source The source name to connect to. * @param {Object} [bindings.args] Object containing the arguments needed by the source. * * @example * ```js * import { useBlockBindingsUtils } from '@wordpress/block-editor' * * const { updateBlockBindings } = useBlockBindingsUtils(); * updateBlockBindings( { * url: { * source: 'core/post-meta', * args: { * key: 'url_custom_field', * }, * }, * alt: { * source: 'core/post-meta', * args: { * key: 'text_custom_field', * }, * } * } ); * ``` */ const updateBlockBindings = bindings => { const { metadata: { bindings: currentBindings, ...metadata } = {} } = getBlockAttributes(blockClientId); const newBindings = { ...currentBindings }; Object.entries(bindings).forEach(([attribute, binding]) => { if (!binding && newBindings[attribute]) { delete newBindings[attribute]; return; } newBindings[attribute] = binding; }); const newMetadata = { ...metadata, bindings: newBindings }; if (isObjectEmpty(newMetadata.bindings)) { delete newMetadata.bindings; } updateBlockAttributes(blockClientId, { metadata: isObjectEmpty(newMetadata) ? undefined : newMetadata }); }; /** * Removes the bindings property of the `metadata` attribute. * * @example * ```js * import { useBlockBindingsUtils } from '@wordpress/block-editor' * * const { removeAllBlockBindings } = useBlockBindingsUtils(); * removeAllBlockBindings(); * ``` */ const removeAllBlockBindings = () => { const { metadata: { bindings, ...metadata } = {} } = getBlockAttributes(blockClientId); updateBlockAttributes(blockClientId, { metadata: isObjectEmpty(metadata) ? undefined : metadata }); }; return { updateBlockBindings, removeAllBlockBindings }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Default value used for blocks which do not define their own context needs, * used to guarantee that a block's `context` prop will always be an object. It * is assigned as a constant since it is always expected to be an empty object, * and in order to avoid unnecessary React reconciliations of a changing object. * * @type {{}} */ const DEFAULT_BLOCK_CONTEXT = {}; const Edit = props => { const { name } = props; const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); if (!blockType) { return null; } // `edit` and `save` are functions or components describing the markup // with which a block is displayed. If `blockType` is valid, assign // them preferentially as the render value for the block. const Component = blockType.edit || blockType.save; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props }); }; const EditWithFilters = (0,external_wp_components_namespaceObject.withFilters)('editor.BlockEdit')(Edit); const EditWithGeneratedProps = props => { const { name, clientId, attributes, setAttributes } = props; const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context); const registeredSources = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources(), []); const { blockBindings, context, hasPatternOverrides } = (0,external_wp_element_namespaceObject.useMemo)(() => { // Assign context values using the block type's declared context needs. const computedContext = blockType?.usesContext ? Object.fromEntries(Object.entries(blockContext).filter(([key]) => blockType.usesContext.includes(key))) : DEFAULT_BLOCK_CONTEXT; // Add context requested by Block Bindings sources. if (attributes?.metadata?.bindings) { Object.values(attributes?.metadata?.bindings || {}).forEach(binding => { registeredSources[binding?.source]?.usesContext?.forEach(key => { computedContext[key] = blockContext[key]; }); }); } return { blockBindings: replacePatternOverridesDefaultBinding(name, attributes?.metadata?.bindings), context: computedContext, hasPatternOverrides: hasPatternOverridesDefaultBinding(attributes?.metadata?.bindings) }; }, [name, blockType?.usesContext, blockContext, attributes?.metadata?.bindings, registeredSources]); const computedAttributes = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!blockBindings) { return attributes; } const attributesFromSources = {}; const blockBindingsBySource = new Map(); for (const [attributeName, binding] of Object.entries(blockBindings)) { const { source: sourceName, args: sourceArgs } = binding; const source = registeredSources[sourceName]; if (!source || !canBindAttribute(name, attributeName)) { continue; } blockBindingsBySource.set(source, { ...blockBindingsBySource.get(source), [attributeName]: { args: sourceArgs } }); } if (blockBindingsBySource.size) { for (const [source, bindings] of blockBindingsBySource) { // Get values in batch if the source supports it. let values = {}; if (!source.getValues) { Object.keys(bindings).forEach(attr => { // Default to the the source label when `getValues` doesn't exist. values[attr] = source.label; }); } else { values = source.getValues({ select, context, clientId, bindings }); } for (const [attributeName, value] of Object.entries(values)) { if (attributeName === 'url' && (!value || !isURLLike(value))) { // Return null if value is not a valid URL. attributesFromSources[attributeName] = null; } else { attributesFromSources[attributeName] = value; } } } } return { ...attributes, ...attributesFromSources }; }, [attributes, blockBindings, clientId, context, name, registeredSources]); const setBoundAttributes = (0,external_wp_element_namespaceObject.useCallback)(nextAttributes => { if (!blockBindings) { setAttributes(nextAttributes); return; } registry.batch(() => { const keptAttributes = { ...nextAttributes }; const blockBindingsBySource = new Map(); // Loop only over the updated attributes to avoid modifying the bound ones that haven't changed. for (const [attributeName, newValue] of Object.entries(keptAttributes)) { if (!blockBindings[attributeName] || !canBindAttribute(name, attributeName)) { continue; } const binding = blockBindings[attributeName]; const source = registeredSources[binding?.source]; if (!source?.setValues) { continue; } blockBindingsBySource.set(source, { ...blockBindingsBySource.get(source), [attributeName]: { args: binding.args, newValue } }); delete keptAttributes[attributeName]; } if (blockBindingsBySource.size) { for (const [source, bindings] of blockBindingsBySource) { source.setValues({ select: registry.select, dispatch: registry.dispatch, context, clientId, bindings }); } } const hasParentPattern = !!context['pattern/overrides']; if ( // Don't update non-connected attributes if the block is using pattern overrides // and the editing is happening while overriding the pattern (not editing the original). !(hasPatternOverrides && hasParentPattern) && Object.keys(keptAttributes).length) { // Don't update caption and href until they are supported. if (hasPatternOverrides) { delete keptAttributes.caption; delete keptAttributes.href; } setAttributes(keptAttributes); } }); }, [blockBindings, clientId, context, hasPatternOverrides, setAttributes, registeredSources, name, registry]); if (!blockType) { return null; } if (blockType.apiVersion > 1) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditWithFilters, { ...props, attributes: computedAttributes, context: context, setAttributes: setBoundAttributes }); } // Generate a class name for the block's editable form. const generatedClassName = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'className', true) ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name) : null; const className = dist_clsx(generatedClassName, attributes?.className, props.className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditWithFilters, { ...props, attributes: computedAttributes, className: className, context: context, setAttributes: setBoundAttributes }); }; /* harmony default export */ const block_edit_edit = (EditWithGeneratedProps); ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js /** * WordPress dependencies */ const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); /* harmony default export */ const more_vertical = (moreVertical); ;// ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js /** * External dependencies */ /** * WordPress dependencies */ function Warning({ className, actions, children, secondaryActions }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { display: 'contents', all: 'initial' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, 'block-editor-warning'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-warning__contents", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-warning__message", children: children }), (actions?.length > 0 || secondaryActions) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-warning__actions", children: [actions?.length > 0 && actions.map((action, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-warning__action", children: action }, i)), secondaryActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { className: "block-editor-warning__secondary", icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('More options'), popoverProps: { position: 'bottom left', className: 'block-editor-warning__dropdown' }, noIcons: true, children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: secondaryActions.map((item, pos) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: item.onClick, children: item.title }, pos)) }) })] })] }) }) }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md */ /* harmony default export */ const warning = (Warning); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/multiple-usage-warning.js /** * WordPress dependencies */ /** * Internal dependencies */ function MultipleUsageWarning({ originalBlockClientId, name, onReplace }) { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(warning, { actions: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: () => selectBlock(originalBlockClientId), children: (0,external_wp_i18n_namespaceObject.__)('Find original') }, "find-original"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: () => onReplace([]), children: (0,external_wp_i18n_namespaceObject.__)('Remove') }, "remove")], children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("strong", { children: [blockType?.title, ": "] }), (0,external_wp_i18n_namespaceObject.__)('This block can only be used once.')] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/private-block-context.js /** * WordPress dependencies */ const PrivateBlockContext = (0,external_wp_element_namespaceObject.createContext)({}); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * The `useBlockEditContext` hook provides information about the block this hook is being used in. * It returns an object with the `name`, `isSelected` state, and the `clientId` of the block. * It is useful if you want to create custom hooks that need access to the current blocks clientId * but don't want to rely on the data getting passed in as a parameter. * * @return {Object} Block edit context */ function BlockEdit({ mayDisplayControls, mayDisplayParentControls, blockEditingMode, isPreviewMode, // The remaining props are passed through the BlockEdit filters and are thus // public API! ...props }) { const { name, isSelected, clientId, attributes = {}, __unstableLayoutClassNames } = props; const { layout = null, metadata = {} } = attributes; const { bindings } = metadata; const layoutSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'layout', false) || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, '__experimentalLayout', false); const { originalBlockClientId } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Provider // It is important to return the same object if props haven't // changed to avoid unnecessary rerenders. // See https://reactjs.org/docs/context.html#caveats. , { value: (0,external_wp_element_namespaceObject.useMemo)(() => ({ name, isSelected, clientId, layout: layoutSupport ? layout : null, __unstableLayoutClassNames, // We use symbols in favour of an __unstable prefix to avoid // usage outside of the package (this context is exposed). [mayDisplayControlsKey]: mayDisplayControls, [mayDisplayParentControlsKey]: mayDisplayParentControls, [blockEditingModeKey]: blockEditingMode, [blockBindingsKey]: bindings, [isPreviewModeKey]: isPreviewMode }), [name, isSelected, clientId, layoutSupport, layout, __unstableLayoutClassNames, mayDisplayControls, mayDisplayParentControls, blockEditingMode, bindings, isPreviewMode]), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_edit_edit, { ...props }), originalBlockClientId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MultipleUsageWarning, { originalBlockClientId: originalBlockClientId, name: name, onReplace: props.onReplace })] }); } // EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js var character = __webpack_require__(8021); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-compare/block-view.js /** * WordPress dependencies */ function BlockView({ title, rawContent, renderedContent, action, actionText, className }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-compare__content", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "block-editor-block-compare__heading", children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__html", children: rawContent }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__preview edit-post-visual-editor", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: (0,external_wp_dom_namespaceObject.safeHTML)(renderedContent) }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__action", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", tabIndex: "0", onClick: action, children: actionText }) })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-compare/index.js /** * External dependencies */ // diff doesn't tree-shake correctly, so we import from the individual // module here, to avoid including too much of the library /** * WordPress dependencies */ /** * Internal dependencies */ function BlockCompare({ block, onKeep, onConvert, convertor, convertButtonText }) { function getDifference(originalContent, newContent) { const difference = (0,character/* diffChars */.JJ)(originalContent, newContent); return difference.map((item, pos) => { const classes = dist_clsx({ 'block-editor-block-compare__added': item.added, 'block-editor-block-compare__removed': item.removed }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: classes, children: item.value }, pos); }); } function getConvertedContent(convertedBlock) { // The convertor may return an array of items or a single item. const newBlocks = Array.isArray(convertedBlock) ? convertedBlock : [convertedBlock]; // Get converted block details. const newContent = newBlocks.map(item => (0,external_wp_blocks_namespaceObject.getSaveContent)(item.name, item.attributes, item.innerBlocks)); return newContent.join(''); } const converted = getConvertedContent(convertor(block)); const difference = getDifference(block.originalContent, converted); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-compare__wrapper", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockView, { title: (0,external_wp_i18n_namespaceObject.__)('Current'), className: "block-editor-block-compare__current", action: onKeep, actionText: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'), rawContent: block.originalContent, renderedContent: block.originalContent }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockView, { title: (0,external_wp_i18n_namespaceObject.__)('After Conversion'), className: "block-editor-block-compare__converted", action: onConvert, actionText: convertButtonText, rawContent: difference, renderedContent: converted })] }); } /* harmony default export */ const block_compare = (BlockCompare); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-invalid-warning.js /** * WordPress dependencies */ /** * Internal dependencies */ const blockToBlocks = block => (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: block.originalContent }); function BlockInvalidWarning({ clientId }) { const { block, canInsertHTMLBlock, canInsertClassicBlock } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canInsertBlockType, getBlock, getBlockRootClientId } = select(store); const rootClientId = getBlockRootClientId(clientId); return { block: getBlock(clientId), canInsertHTMLBlock: canInsertBlockType('core/html', rootClientId), canInsertClassicBlock: canInsertBlockType('core/freeform', rootClientId) }; }, [clientId]); const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const [compare, setCompare] = (0,external_wp_element_namespaceObject.useState)(false); const onCompareClose = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(false), []); const convert = (0,external_wp_element_namespaceObject.useMemo)(() => ({ toClassic() { const classicBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/freeform', { content: block.originalContent }); return replaceBlock(block.clientId, classicBlock); }, toHTML() { const htmlBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/html', { content: block.originalContent }); return replaceBlock(block.clientId, htmlBlock); }, toBlocks() { const newBlocks = blockToBlocks(block); return replaceBlock(block.clientId, newBlocks); }, toRecoveredBlock() { const recoveredBlock = (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks); return replaceBlock(block.clientId, recoveredBlock); } }), [block, replaceBlock]); const secondaryActions = (0,external_wp_element_namespaceObject.useMemo)(() => [{ // translators: Button to fix block content title: (0,external_wp_i18n_namespaceObject._x)('Resolve', 'imperative verb'), onClick: () => setCompare(true) }, canInsertHTMLBlock && { title: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'), onClick: convert.toHTML }, canInsertClassicBlock && { title: (0,external_wp_i18n_namespaceObject.__)('Convert to Classic Block'), onClick: convert.toClassic }].filter(Boolean), [canInsertHTMLBlock, canInsertClassicBlock, convert]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(warning, { actions: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: convert.toRecoveredBlock, variant: "primary", children: (0,external_wp_i18n_namespaceObject.__)('Attempt recovery') }, "recover")], secondaryActions: secondaryActions, children: (0,external_wp_i18n_namespaceObject.__)('Block contains unexpected or invalid content.') }), compare && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: // translators: Dialog title to fix block content (0,external_wp_i18n_namespaceObject.__)('Resolve Block'), onRequestClose: onCompareClose, className: "block-editor-block-compare", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_compare, { block: block, onKeep: convert.toHTML, onConvert: convert.toBlocks, convertor: blockToBlocks, convertButtonText: (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks') }) })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-warning.js /** * WordPress dependencies */ /** * Internal dependencies */ const block_crash_warning_warning = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(warning, { className: "block-editor-block-list__block-crash-warning", children: (0,external_wp_i18n_namespaceObject.__)('This block has encountered an error and cannot be previewed.') }); /* harmony default export */ const block_crash_warning = (() => block_crash_warning_warning); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-boundary.js /** * WordPress dependencies */ class BlockCrashBoundary extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.state = { hasError: false }; } componentDidCatch() { this.setState({ hasError: true }); } render() { if (this.state.hasError) { return this.props.fallback; } return this.props.children; } } /* harmony default export */ const block_crash_boundary = (BlockCrashBoundary); // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js var lib = __webpack_require__(4132); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-html.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockHTML({ clientId }) { const [html, setHtml] = (0,external_wp_element_namespaceObject.useState)(''); const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlock(clientId), [clientId]); const { updateBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onChange = () => { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); if (!blockType) { return; } const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)(blockType, html, block.attributes); // If html is empty we reset the block to the default HTML and mark it as valid to avoid triggering an error const content = html ? html : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes); const [isValid] = html ? (0,external_wp_blocks_namespaceObject.validateBlock)({ ...block, attributes, originalContent: content }) : [true]; updateBlock(clientId, { attributes, originalContent: content, isValid }); // Ensure the state is updated if we reset so it displays the default content. if (!html) { setHtml(content); } }; (0,external_wp_element_namespaceObject.useEffect)(() => { setHtml((0,external_wp_blocks_namespaceObject.getBlockContent)(block)); }, [block]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(lib/* default */.A, { className: "block-editor-block-list__block-html-textarea", value: html, onBlur: onChange, onChange: event => setHtml(event.target.value) }); } /* harmony default export */ const block_html = (BlockHTML); ;// ./node_modules/@react-spring/rafz/dist/esm/index.js var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}}; ;// ./node_modules/@react-spring/shared/dist/esm/index.js var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`${n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba(${r}, ${n}, ${f}, ${o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`(${O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba(${Math.round(t)}, ${Math.round(r)}, ${Math.round(n)}, ${f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`(${Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`${f[s++](o)}${i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`${Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`${Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`${Z}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll${f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e}; ;// ./node_modules/@react-spring/animated/dist/esm/index.js var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated(${m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null; ;// ./node_modules/@react-spring/core/dist/esm/index.js function dist_esm_I(t,...e){return dist_esm_l.fun(t)?t(...e):t}var esm_te=(t,e)=>t===!0||!!(e&&t&&(dist_esm_l.fun(t)?t(e):ht(t).includes(e))),et=(t,e)=>dist_esm_l.obj(t)?e&&t[e]:t;var esm_ke=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,nn=t=>t,dist_esm_ne=(t,e=nn)=>{let n=rn;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));let r={};for(let o of n){let s=e(t[o],o);dist_esm_l.und(s)||(r[o]=s)}return r},rn=["config","onProps","onStart","onChange","onPause","onResume","onRest"],on={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function sn(t){let e={},n=0;if(xt(t,(r,o)=>{on[o]||(e[o]=r,n++)}),n)return e}function esm_de(t){let e=sn(t);if(e){let n={to:e};return xt(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function esm_me(t){return t=ve(t),dist_esm_l.arr(t)?t.map(esm_me):esm_or(t)?dist_esm_p.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function esm_Ue(t){for(let e in t)return!0;return!1}function esm_Ee(t){return dist_esm_l.fun(t)||dist_esm_l.arr(t)&&dist_esm_l.obj(t[0])}function esm_xe(t,e){t.ref?.delete(t),e?.delete(t)}function esm_he(t,e){e&&t.ref!==e&&(t.ref?.delete(t),e.add(t),t.ref=e)}function wr(t,e,n=1e3){an(()=>{if(e){let r=0;ge(t,(o,s)=>{let a=o.current;if(a.length){let i=n*e[s];isNaN(i)?i=r:r=i,ge(a,u=>{ge(u.queue,p=>{let f=p.delay;p.delay=d=>i+dist_esm_I(f||0,d)})}),o.start()}})}else{let r=Promise.resolve();ge(t,o=>{let s=o.current;if(s.length){let a=s.map(i=>{let u=i.queue;return i.queue=[],u});r=r.then(()=>(ge(s,(i,u)=>ge(a[u]||[],p=>i.queue.push(p))),Promise.all(o.start())))}})}})}var esm_mt={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};var tt={...esm_mt.default,mass:1,damping:1,easing:Lt.linear,clamp:!1},esm_we=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,tt)}};function gt(t,e,n){n&&(n={...n},esm_ht(n,e),e={...n,...e}),esm_ht(t,e),Object.assign(t,e);for(let a in tt)t[a]==null&&(t[a]=tt[a]);let{mass:r,frequency:o,damping:s}=t;return dist_esm_l.und(o)||(o<.01&&(o=.01),s<0&&(s=0),t.tension=Math.pow(2*Math.PI/o,2)*r,t.friction=4*Math.PI*s*r/o),t}function esm_ht(t,e){if(!dist_esm_l.und(e.decay))t.duration=void 0;else{let n=!dist_esm_l.und(e.tension)||!dist_esm_l.und(e.friction);(n||!dist_esm_l.und(e.frequency)||!dist_esm_l.und(e.damping)||!dist_esm_l.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var esm_yt=[],dist_esm_Le=class{changed=!1;values=esm_yt;toValues=null;fromValues=esm_yt;to;from;config=new esm_we;immediate=!1};function esm_Me(t,{key:e,props:n,defaultProps:r,state:o,actions:s}){return new Promise((a,i)=>{let u,p,f=esm_te(n.cancel??r?.cancel,e);if(f)b();else{dist_esm_l.und(n.pause)||(o.paused=esm_te(n.pause,e));let c=r?.pause;c!==!0&&(c=o.paused||esm_te(c,e)),u=dist_esm_I(n.delay||0,e),c?(o.resumeQueue.add(m),s.pause()):(s.resume(),m())}function d(){o.resumeQueue.add(m),o.timeouts.delete(p),p.cancel(),u=p.time-esm_n.now()}function m(){u>0&&!dist_esm_p.skipAnimation?(o.delayed=!0,p=esm_n.setTimeout(b,u),o.pauseQueue.add(d),o.timeouts.add(p)):b()}function b(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(d),o.timeouts.delete(p),t<=(o.cancelId||0)&&(f=!0);try{s.start({...n,callId:t,cancel:f},a)}catch(c){i(c)}}})}var esm_be=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?esm_q(t.get()):e.every(n=>n.noop)?nt(t.get()):dist_esm_E(t.get(),e.every(n=>n.finished)),nt=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),dist_esm_E=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),esm_q=t=>({value:t,cancelled:!0,finished:!1});function esm_De(t,e,n,r){let{callId:o,parentId:s,onRest:a}=e,{asyncTo:i,promise:u}=n;return!s&&t===i&&!e.reset?u:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;let p=dist_esm_ne(e,(l,h)=>h==="onRest"?void 0:l),f,d,m=new Promise((l,h)=>(f=l,d=h)),b=l=>{let h=o<=(n.cancelId||0)&&esm_q(r)||o!==n.asyncId&&dist_esm_E(r,!1);if(h)throw l.result=h,d(l),l},c=(l,h)=>{let g=new esm_Ae,x=new esm_Ne;return(async()=>{if(dist_esm_p.skipAnimation)throw esm_oe(n),x.result=dist_esm_E(r,!1),d(x),x;b(g);let S=dist_esm_l.obj(l)?{...l}:{...h,to:l};S.parentId=o,xt(p,(V,_)=>{dist_esm_l.und(S[_])&&(S[_]=V)});let A=await r.start(S);return b(g),n.paused&&await new Promise(V=>{n.resumeQueue.add(V)}),A})()},P;if(dist_esm_p.skipAnimation)return esm_oe(n),dist_esm_E(r,!1);try{let l;dist_esm_l.arr(t)?l=(async h=>{for(let g of h)await c(g)})(t):l=Promise.resolve(t(c,r.stop.bind(r))),await Promise.all([l.then(f),m]),P=dist_esm_E(r.get(),!0,!1)}catch(l){if(l instanceof esm_Ae)P=l.result;else if(l instanceof esm_Ne)P=l.result;else throw l}finally{o==n.asyncId&&(n.asyncId=s,n.asyncTo=s?i:void 0,n.promise=s?u:void 0)}return dist_esm_l.fun(a)&&esm_n.batchedUpdates(()=>{a(P,r,r.item)}),P})()}function esm_oe(t,e){Pe(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var esm_Ae=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},esm_Ne=class extends Error{result;constructor(){super("SkipAnimationSignal")}};var esm_Re=t=>t instanceof esm_X,Sn=1,esm_X=class extends esm_ge{id=Sn++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=dist_esm_k(this);return e&&e.getValue()}to(...e){return dist_esm_p.to(this,e)}interpolate(...e){return Jt(),dist_esm_p.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,n=!1){$t(this,{type:"change",parent:this,value:e,idle:n})}_onPriorityChange(e){this.idle||qe.sort(this),$t(this,{type:"priority",parent:this,priority:e})}};var esm_se=Symbol.for("SpringPhase"),esm_bt=1,rt=2,ot=4,esm_qe=t=>(t[esm_se]&esm_bt)>0,dist_esm_Q=t=>(t[esm_se]&rt)>0,esm_ye=t=>(t[esm_se]&ot)>0,st=(t,e)=>e?t[esm_se]|=rt|esm_bt:t[esm_se]&=~rt,esm_it=(t,e)=>e?t[esm_se]|=ot:t[esm_se]&=~ot;var esm_ue=class extends esm_X{key;animation=new dist_esm_Le;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,n){if(super(),!dist_esm_l.und(e)||!dist_esm_l.und(n)){let r=dist_esm_l.obj(e)?{...e}:{...n,from:e};dist_esm_l.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(dist_esm_Q(this)||this._state.asyncTo)||esm_ye(this)}get goal(){return ve(this.animation.to)}get velocity(){let e=dist_esm_k(this);return e instanceof animated_dist_esm_l?e.lastVelocity||0:e.getPayload().map(n=>n.lastVelocity||0)}get hasAnimated(){return esm_qe(this)}get isAnimating(){return dist_esm_Q(this)}get isPaused(){return esm_ye(this)}get isDelayed(){return this._state.delayed}advance(e){let n=!0,r=!1,o=this.animation,{config:s,toValues:a}=o,i=F(o.to);!i&&Pt(o.to)&&(a=ht(ve(o.to))),o.values.forEach((f,d)=>{if(f.done)return;let m=f.constructor==animated_dist_esm_d?1:i?i[d].lastPosition:a[d],b=o.immediate,c=m;if(!b){if(c=f.lastPosition,s.tension<=0){f.done=!0;return}let P=f.elapsedTime+=e,l=o.fromValues[d],h=f.v0!=null?f.v0:f.v0=dist_esm_l.arr(s.velocity)?s.velocity[d]:s.velocity,g,x=s.precision||(l==m?.005:Math.min(1,Math.abs(m-l)*.001));if(dist_esm_l.und(s.duration))if(s.decay){let S=s.decay===!0?.998:s.decay,A=Math.exp(-(1-S)*P);c=l+h/(1-S)*(1-A),b=Math.abs(f.lastPosition-c)<=x,g=h*A}else{g=f.lastVelocity==null?h:f.lastVelocity;let S=s.restVelocity||x/10,A=s.clamp?0:s.bounce,V=!dist_esm_l.und(A),_=l==m?f.v0>0:l<m,v,w=!1,C=1,$=Math.ceil(e/C);for(let L=0;L<$&&(v=Math.abs(g)>S,!(!v&&(b=Math.abs(m-c)<=x,b)));++L){V&&(w=c==m||c>m==_,w&&(g=-g*A,c=m));let N=-s.tension*1e-6*(c-m),y=-s.friction*.001*g,T=(N+y)/s.mass;g=g+T*C,c=c+g*C}}else{let S=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,f.durationProgress>0&&(f.elapsedTime=s.duration*f.durationProgress,P=f.elapsedTime+=e)),S=(s.progress||0)+P/this._memoizedDuration,S=S>1?1:S<0?0:S,f.durationProgress=S),c=l+s.easing(S)*(m-l),g=(c-f.lastPosition)/e,b=S==1}f.lastVelocity=g,Number.isNaN(c)&&(console.warn("Got NaN while animating:",this),b=!0)}i&&!i[d].done&&(b=!1),b?f.done=!0:n=!1,f.setValue(c,s.round)&&(r=!0)});let u=dist_esm_k(this),p=u.getValue();if(n){let f=ve(o.to);(p!==f||r)&&!s.decay?(u.setValue(f),this._onChange(f)):r&&s.decay&&this._onChange(p),this._stop()}else r&&this._onChange(p)}set(e){return esm_n.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(dist_esm_Q(this)){let{to:e,config:n}=this.animation;esm_n.batchedUpdates(()=>{this._onStart(),n.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,n){let r;return dist_esm_l.und(e)?(r=this.queue||[],this.queue=[]):r=[dist_esm_l.obj(e)?e:{...n,to:e}],Promise.all(r.map(o=>this._update(o))).then(o=>esm_be(this,o))}stop(e){let{to:n}=this.animation;return this._focus(this.get()),esm_oe(this._state,e&&this._lastCallId),esm_n.batchedUpdates(()=>this._stop(n,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){let n=this.key||"",{to:r,from:o}=e;r=dist_esm_l.obj(r)?r[n]:r,(r==null||esm_Ee(r))&&(r=void 0),o=dist_esm_l.obj(o)?o[n]:o,o==null&&(o=void 0);let s={to:r,from:o};return esm_qe(this)||(e.reverse&&([r,o]=[o,r]),o=ve(o),dist_esm_l.und(o)?dist_esm_k(this)||this._set(r):this._set(o)),s}_update({...e},n){let{key:r,defaultProps:o}=this;e.default&&Object.assign(o,dist_esm_ne(e,(i,u)=>/^on/.test(u)?et(i,r):i)),_t(this,e,"onProps"),esm_Ie(this,"onProps",e,this);let s=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return esm_Me(++this._lastCallId,{key:r,props:e,defaultProps:o,state:a,actions:{pause:()=>{esm_ye(this)||(esm_it(this,!0),yt(a.pauseQueue),esm_Ie(this,"onPause",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},resume:()=>{esm_ye(this)&&(esm_it(this,!1),dist_esm_Q(this)&&this._resume(),yt(a.resumeQueue),esm_Ie(this,"onResume",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(i=>{if(e.loop&&i.finished&&!(n&&i.noop)){let u=at(e);if(u)return this._update(u,!0)}return i})}_merge(e,n,r){if(n.cancel)return this.stop(!0),r(esm_q(this));let o=!dist_esm_l.und(e.to),s=!dist_esm_l.und(e.from);if(o||s)if(n.callId>this._lastToId)this._lastToId=n.callId;else return r(esm_q(this));let{key:a,defaultProps:i,animation:u}=this,{to:p,from:f}=u,{to:d=p,from:m=f}=e;s&&!o&&(!n.default||dist_esm_l.und(d))&&(d=m),n.reverse&&([d,m]=[m,d]);let b=!bt(m,f);b&&(u.from=m),m=ve(m);let c=!bt(d,p);c&&this._focus(d);let P=esm_Ee(n.to),{config:l}=u,{decay:h,velocity:g}=l;(o||s)&&(l.velocity=0),n.config&&!P&>(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between ${x.constructor.name} and ${L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var _n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var esm_ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance; ;// external "ReactDOM" const external_ReactDOM_namespaceObject = window["ReactDOM"]; ;// ./node_modules/@react-spring/web/dist/esm/index.js var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d(${a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d(${m},${o},${p},${web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`${n}(${m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated; ;// ./node_modules/@wordpress/block-editor/build-module/components/use-moving-animation/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * If the block count exceeds the threshold, we disable the reordering animation * to avoid laginess. */ const BLOCK_ANIMATION_THRESHOLD = 200; function getAbsolutePosition(element) { return { top: element.offsetTop, left: element.offsetLeft }; } /** * Hook used to compute the styles required to move a div into a new position. * * The way this animation works is the following: * - It first renders the element as if there was no animation. * - It takes a snapshot of the position of the block to use it * as a destination point for the animation. * - It restores the element to the previous position using a CSS transform * - It uses the "resetAnimation" flag to reset the animation * from the beginning in order to animate to the new destination point. * * @param {Object} $1 Options * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes. * @param {string} $1.clientId */ function useMovingAnimation({ triggerAnimationOnChange, clientId }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const { isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected, isDraggingBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); // Whenever the trigger changes, we need to take a snapshot of the current // position of the block to use it as a destination point for the animation. const { previous, prevRect } = (0,external_wp_element_namespaceObject.useMemo)(() => ({ previous: ref.current && getAbsolutePosition(ref.current), prevRect: ref.current && ref.current.getBoundingClientRect() }), [triggerAnimationOnChange]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!previous || !ref.current) { return; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(ref.current); const isSelected = isBlockSelected(clientId); const adjustScrolling = isSelected || isFirstMultiSelectedBlock(clientId); const isDragging = isDraggingBlocks(); function preserveScrollPosition() { // The user already scrolled when dragging blocks. if (isDragging) { return; } if (adjustScrolling && prevRect) { const blockRect = ref.current.getBoundingClientRect(); const diff = blockRect.top - prevRect.top; if (diff) { scrollContainer.scrollTop += diff; } } } // We disable the animation if the user has a preference for reduced // motion, if the user is typing (insertion by Enter), or if the block // count exceeds the threshold (insertion caused all the blocks that // follow to animate). // To do: consider enabling the _moving_ animation even for large // posts, while only disabling the _insertion_ animation? const disableAnimation = window.matchMedia('(prefers-reduced-motion: reduce)').matches || isTyping() || getGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD; if (disableAnimation) { // If the animation is disabled and the scroll needs to be adjusted, // just move directly to the final scroll position. preserveScrollPosition(); return; } const isPartOfSelection = isSelected || isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId); // The user already dragged the blocks to the new position, so don't // animate the dragged blocks. if (isPartOfSelection && isDragging) { return; } // Make sure the other blocks move under the selected block(s). const zIndex = isPartOfSelection ? '1' : ''; const controller = new esm_le({ x: 0, y: 0, config: { mass: 5, tension: 2000, friction: 200 }, onChange({ value }) { if (!ref.current) { return; } let { x, y } = value; x = Math.round(x); y = Math.round(y); const finishedMoving = x === 0 && y === 0; ref.current.style.transformOrigin = 'center center'; ref.current.style.transform = finishedMoving ? null // Set to `null` to explicitly remove the transform. : `translate3d(${x}px,${y}px,0)`; ref.current.style.zIndex = zIndex; preserveScrollPosition(); } }); ref.current.style.transform = undefined; const destination = getAbsolutePosition(ref.current); const x = Math.round(previous.left - destination.left); const y = Math.round(previous.top - destination.top); controller.start({ x: 0, y: 0, from: { x, y } }); return () => { controller.stop(); controller.set({ x: 0, y: 0 }); }; }, [previous, prevRect, clientId, isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected, isDraggingBlocks]); return ref; } /* harmony default export */ const use_moving_animation = (useMovingAnimation); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-first-element.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/element').RefObject} RefObject */ /** * Transitions focus to the block or inner tabbable when the block becomes * selected and an initial position is set. * * @param {string} clientId Block client ID. * * @return {RefObject} React ref with the block element. */ function useFocusFirstElement({ clientId, initialPosition }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const { isBlockSelected, isMultiSelecting, isZoomOut } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); (0,external_wp_element_namespaceObject.useEffect)(() => { // Check if the block is still selected at the time this effect runs. if (!isBlockSelected(clientId) || isMultiSelecting() || isZoomOut()) { return; } if (initialPosition === undefined || initialPosition === null) { return; } if (!ref.current) { return; } const { ownerDocument } = ref.current; // Do not focus the block if it already contains the active element. if (isInsideRootBlock(ref.current, ownerDocument.activeElement)) { return; } // Find all tabbables within node. const textInputs = external_wp_dom_namespaceObject.focus.tabbable.find(ref.current).filter(node => (0,external_wp_dom_namespaceObject.isTextField)(node)); // If reversed (e.g. merge via backspace), use the last in the set of // tabbables. const isReverse = -1 === initialPosition; const target = textInputs[isReverse ? textInputs.length - 1 : 0] || ref.current; if (!isInsideRootBlock(ref.current, target)) { ref.current.focus(); return; } // Check to see if element is focussable before a generic caret insert. if (!ref.current.getAttribute('contenteditable')) { const focusElement = external_wp_dom_namespaceObject.focus.tabbable.findNext(ref.current); // Make sure focusElement is valid, contained in the same block, and a form field. if (focusElement && isInsideRootBlock(ref.current, focusElement) && (0,external_wp_dom_namespaceObject.isFormElement)(focusElement)) { focusElement.focus(); return; } } (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(target, isReverse); }, [initialPosition, clientId]); return ref; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-is-hovered.js /** * WordPress dependencies */ /** * Internal dependencies */ /* * Adds `is-hovered` class when the block is hovered and in navigation or * outline mode. */ function useIsHovered({ clientId }) { const { hoverBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); function listener(event) { if (event.defaultPrevented) { return; } const action = event.type === 'mouseover' ? 'add' : 'remove'; event.preventDefault(); event.currentTarget.classList[action]('is-hovered'); if (action === 'add') { hoverBlock(clientId); } else { hoverBlock(null); } } return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { node.addEventListener('mouseout', listener); node.addEventListener('mouseover', listener); return () => { node.removeEventListener('mouseout', listener); node.removeEventListener('mouseover', listener); // Remove class in case it lingers. node.classList.remove('is-hovered'); hoverBlock(null); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Selects the block if it receives focus. * * @param {string} clientId Block client ID. */ function useFocusHandler(clientId) { const { isBlockSelected } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectBlock, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { /** * Marks the block as selected when focused and not already * selected. This specifically handles the case where block does not * set focus on its own (via `setFocus`), typically if there is no * focusable input in the block. * * @param {FocusEvent} event Focus event. */ function onFocus(event) { // When the whole editor is editable, let writing flow handle // selection. if (node.parentElement.closest('[contenteditable="true"]')) { return; } // Check synchronously because a non-selected block might be // getting data through `useSelect` asynchronously. if (isBlockSelected(clientId)) { // Potentially change selection away from rich text. if (!event.target.isContentEditable) { selectionChange(clientId); } return; } // If an inner block is focussed, that block is responsible for // setting the selected block. if (!isInsideRootBlock(node, event.target)) { return; } selectBlock(clientId); } node.addEventListener('focusin', onFocus); return () => { node.removeEventListener('focusin', onFocus); }; }, [isBlockSelected, selectBlock]); } ;// ./node_modules/@wordpress/icons/build-module/library/drag-handle.js /** * WordPress dependencies */ const dragHandle = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z" }) }); /* harmony default export */ const drag_handle = (dragHandle); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/draggable-chip.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockDraggableChip({ count, icon, isPattern, fadeWhenDisabled }) { const patternLabel = isPattern && (0,external_wp_i18n_namespaceObject.__)('Pattern'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-draggable-chip-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-draggable-chip", "data-testid": "block-draggable-chip", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "center", className: "block-editor-block-draggable-chip__content", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: icon ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: icon }) : patternLabel || (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of blocks. */ (0,external_wp_i18n_namespaceObject._n)('%d block', '%d blocks', count), count) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: drag_handle }) }), fadeWhenDisabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "block-editor-block-draggable-chip__disabled", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-draggable-chip__disabled-icon" }) })] }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Adds block behaviour: * - Removes the block on BACKSPACE. * - Inserts a default block on ENTER. * - Disables dragging of block contents. * * @param {string} clientId Block client ID. */ function useEventHandlers({ clientId, isSelected }) { const { getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const { getBlockRootClientId, isZoomOut, hasMultiSelection, getBlockName } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { insertAfterBlock, removeBlock, resetZoomLevel, startDraggingBlocks, stopDraggingBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!isSelected) { return; } /** * Interprets keydown event intent to remove or insert after block if * key event occurs on wrapper node. This can occur when the block has * no text fields of its own, particularly after initial insertion, to * allow for easy deletion and continuous writing flow to add additional * content. * * @param {KeyboardEvent} event Keydown event. */ function onKeyDown(event) { const { keyCode, target } = event; if (keyCode !== external_wp_keycodes_namespaceObject.ENTER && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.DELETE) { return; } if (target !== node || (0,external_wp_dom_namespaceObject.isTextField)(target)) { return; } event.preventDefault(); if (keyCode === external_wp_keycodes_namespaceObject.ENTER && isZoomOut()) { resetZoomLevel(); } else if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { insertAfterBlock(clientId); } else { removeBlock(clientId); } } /** * Prevents default dragging behavior within a block. To do: we must * handle this in the future and clean up the drag target. * * @param {DragEvent} event Drag event. */ function onDragStart(event) { if (node !== event.target || node.isContentEditable || node.ownerDocument.activeElement !== node || hasMultiSelection()) { event.preventDefault(); return; } const data = JSON.stringify({ type: 'block', srcClientIds: [clientId], srcRootClientId: getBlockRootClientId(clientId) }); event.dataTransfer.effectAllowed = 'move'; // remove "+" cursor event.dataTransfer.clearData(); event.dataTransfer.setData('wp-blocks', data); const { ownerDocument } = node; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); selection.removeAllRanges(); const domNode = document.createElement('div'); const root = (0,external_wp_element_namespaceObject.createRoot)(domNode); root.render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockDraggableChip, { icon: getBlockType(getBlockName(clientId)).icon })); document.body.appendChild(domNode); domNode.style.position = 'absolute'; domNode.style.top = '0'; domNode.style.left = '0'; domNode.style.zIndex = '1000'; domNode.style.pointerEvents = 'none'; // Setting the drag chip as the drag image actually works, but // the behaviour is slightly different in every browser. In // Safari, it animates, in Firefox it's slightly transparent... // So we set a fake drag image and have to reposition it // ourselves. const dragElement = ownerDocument.createElement('div'); // Chrome will show a globe icon if the drag element does not // have dimensions. dragElement.style.width = '1px'; dragElement.style.height = '1px'; dragElement.style.position = 'fixed'; dragElement.style.visibility = 'hidden'; ownerDocument.body.appendChild(dragElement); event.dataTransfer.setDragImage(dragElement, 0, 0); let offset = { x: 0, y: 0 }; if (document !== ownerDocument) { const frame = defaultView.frameElement; if (frame) { const rect = frame.getBoundingClientRect(); offset = { x: rect.left, y: rect.top }; } } // chip handle offset offset.x -= 58; function over(e) { domNode.style.transform = `translate( ${e.clientX + offset.x}px, ${e.clientY + offset.y}px )`; } over(event); function end() { ownerDocument.removeEventListener('dragover', over); ownerDocument.removeEventListener('dragend', end); domNode.remove(); dragElement.remove(); stopDraggingBlocks(); document.body.classList.remove('is-dragging-components-draggable'); ownerDocument.documentElement.classList.remove('is-dragging'); } ownerDocument.addEventListener('dragover', over); ownerDocument.addEventListener('dragend', end); ownerDocument.addEventListener('drop', end); startDraggingBlocks([clientId]); // Important because it hides the block toolbar. document.body.classList.add('is-dragging-components-draggable'); ownerDocument.documentElement.classList.add('is-dragging'); } node.addEventListener('keydown', onKeyDown); node.addEventListener('dragstart', onDragStart); return () => { node.removeEventListener('keydown', onKeyDown); node.removeEventListener('dragstart', onDragStart); }; }, [clientId, isSelected, getBlockRootClientId, insertAfterBlock, removeBlock, isZoomOut, resetZoomLevel, hasMultiSelection, startDraggingBlocks, stopDraggingBlocks]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-intersection-observer.js /** * WordPress dependencies */ /** * Internal dependencies */ function useIntersectionObserver() { const observer = (0,external_wp_element_namespaceObject.useContext)(block_list_IntersectionObserver); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (observer) { observer.observe(node); return () => { observer.unobserve(node); }; } }, [observer]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-scroll-into-view.js /** * WordPress dependencies */ function useScrollIntoView({ isSelected }) { const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (isSelected) { const { ownerDocument } = node; const { defaultView } = ownerDocument; if (!defaultView.IntersectionObserver) { return; } const observer = new defaultView.IntersectionObserver(entries => { // Once observing starts, we always get an initial // entry with the intersecting state. if (!entries[0].isIntersecting) { node.scrollIntoView({ behavior: prefersReducedMotion ? 'instant' : 'smooth' }); } observer.disconnect(); }); observer.observe(node); return () => { observer.disconnect(); }; } }, [isSelected]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/use-flash-editable-blocks/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function useFlashEditableBlocks({ clientId = '', isEnabled = true } = {}) { const { getEnabledClientIdsTree } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { if (!isEnabled) { return; } const flashEditableBlocks = () => { getEnabledClientIdsTree(clientId).forEach(({ clientId: id }) => { const block = element.querySelector(`[data-block="${id}"]`); if (!block) { return; } block.classList.remove('has-editable-outline'); // Force reflow to trigger the animation. // eslint-disable-next-line no-unused-expressions block.offsetWidth; block.classList.add('has-editable-outline'); }); }; const handleClick = event => { const shouldFlash = event.target === element || event.target.classList.contains('is-root-container'); if (!shouldFlash) { return; } if (event.defaultPrevented) { return; } event.preventDefault(); flashEditableBlocks(); }; element.addEventListener('click', handleClick); return () => element.removeEventListener('click', handleClick); }, [isEnabled]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js /** * WordPress dependencies */ const nodesByDocument = new Map(); function add(doc, node) { let set = nodesByDocument.get(doc); if (!set) { set = new Set(); nodesByDocument.set(doc, set); doc.addEventListener('pointerdown', down); } set.add(node); } function remove(doc, node) { const set = nodesByDocument.get(doc); if (set) { set.delete(node); restore(node); if (set.size === 0) { nodesByDocument.delete(doc); doc.removeEventListener('pointerdown', down); } } } function restore(node) { const prevDraggable = node.getAttribute('data-draggable'); if (prevDraggable) { node.removeAttribute('data-draggable'); // Only restore if `draggable` is still removed. It could have been // changed by React in the meantime. if (prevDraggable === 'true' && !node.getAttribute('draggable')) { node.setAttribute('draggable', 'true'); } } } function down(event) { const { target } = event; const { ownerDocument, isContentEditable, tagName } = target; const isInputOrTextArea = ['INPUT', 'TEXTAREA'].includes(tagName); const nodes = nodesByDocument.get(ownerDocument); if (isContentEditable || isInputOrTextArea) { // Whenever an editable element or an input or textarea is clicked, // check which draggable blocks contain this element, and temporarily // disable draggability. for (const node of nodes) { if (node.getAttribute('draggable') === 'true' && node.contains(target)) { node.removeAttribute('draggable'); node.setAttribute('data-draggable', 'true'); } } } else { // Whenever a non-editable element or an input or textarea is clicked, // re-enable draggability for any blocks that were previously disabled. for (const node of nodes) { restore(node); } } } /** * In Firefox, the `draggable` and `contenteditable` or `input` or `textarea` * elements don't play well together. When these elements are within a * `draggable` element, selection doesn't get set in the right place. The only * solution is to temporarily remove the `draggable` attribute clicking inside * these elements. * @return {Function} Cleanup function. */ function useFirefoxDraggableCompatibility() { return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { add(node.ownerDocument, node); return () => { remove(node.ownerDocument, node); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * This hook is used to lightly mark an element as a block element. The element * should be the outermost element of a block. Call this hook and pass the * returned props to the element to mark as a block. If you define a ref for the * element, it is important to pass the ref to this hook, which the hook in turn * will pass to the component through the props it returns. Optionally, you can * also pass any other props through this hook, and they will be merged and * returned. * * Use of this hook on the outermost element of a block is required if using API >= v2. * * @example * ```js * import { useBlockProps } from '@wordpress/block-editor'; * * export default function Edit() { * * const blockProps = useBlockProps( { * className: 'my-custom-class', * style: { * color: '#222222', * backgroundColor: '#eeeeee' * } * } ) * * return ( * <div { ...blockProps }> * * </div> * ) * } * * ``` * * * @param {Object} props Optional. Props to pass to the element. Must contain * the ref if one is defined. * @param {Object} options Options for internal use only. * @param {boolean} options.__unstableIsHtml * * @return {Object} Props to pass to the element to mark as a block. */ function use_block_props_useBlockProps(props = {}, { __unstableIsHtml } = {}) { const { clientId, className, wrapperProps = {}, isAligned, index, mode, name, blockApiVersion, blockTitle, isSelected, isSubtreeDisabled, hasOverlay, initialPosition, blockEditingMode, isHighlighted, isMultiSelected, isPartiallySelected, isReusable, isDragging, hasChildSelected, isEditingDisabled, hasEditableOutline, isTemporarilyEditingAsBlocks, defaultClassName, isSectionBlock, canMove } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); // translators: %s: Type of block (i.e. Text, Image etc) const blockLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Block: %s'), blockTitle); const htmlSuffix = mode === 'html' && !__unstableIsHtml ? '-visual' : ''; const ffDragRef = useFirefoxDraggableCompatibility(); const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, useFocusFirstElement({ clientId, initialPosition }), useBlockRefProvider(clientId), useFocusHandler(clientId), useEventHandlers({ clientId, isSelected }), useIsHovered({ clientId }), useIntersectionObserver(), use_moving_animation({ triggerAnimationOnChange: index, clientId }), (0,external_wp_compose_namespaceObject.useDisabled)({ isDisabled: !hasOverlay }), useFlashEditableBlocks({ clientId, isEnabled: isSectionBlock }), useScrollIntoView({ isSelected }), canMove ? ffDragRef : undefined]); const blockEditContext = useBlockEditContext(); const hasBlockBindings = !!blockEditContext[blockBindingsKey]; const bindingsStyle = hasBlockBindings && canBindBlock(name) ? { '--wp-admin-theme-color': 'var(--wp-block-synced-color)', '--wp-admin-theme-color--rgb': 'var(--wp-block-synced-color--rgb)' } : {}; // Ensures it warns only inside the `edit` implementation for the block. if (blockApiVersion < 2 && clientId === blockEditContext.clientId) { true ? external_wp_warning_default()(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : 0; } let hasNegativeMargin = false; if (wrapperProps?.style?.marginTop?.charAt(0) === '-' || wrapperProps?.style?.marginBottom?.charAt(0) === '-' || wrapperProps?.style?.marginLeft?.charAt(0) === '-' || wrapperProps?.style?.marginRight?.charAt(0) === '-') { hasNegativeMargin = true; } return { tabIndex: blockEditingMode === 'disabled' ? -1 : 0, draggable: canMove && !hasChildSelected ? true : undefined, ...wrapperProps, ...props, ref: mergedRefs, id: `block-${clientId}${htmlSuffix}`, role: 'document', 'aria-label': blockLabel, 'data-block': clientId, 'data-type': name, 'data-title': blockTitle, inert: isSubtreeDisabled ? 'true' : undefined, className: dist_clsx('block-editor-block-list__block', { // The wp-block className is important for editor styles. 'wp-block': !isAligned, 'has-block-overlay': hasOverlay, 'is-selected': isSelected, 'is-highlighted': isHighlighted, 'is-multi-selected': isMultiSelected, 'is-partially-selected': isPartiallySelected, 'is-reusable': isReusable, 'is-dragging': isDragging, 'has-child-selected': hasChildSelected, 'is-editing-disabled': isEditingDisabled, 'has-editable-outline': hasEditableOutline, 'has-negative-margin': hasNegativeMargin, 'is-content-locked-temporarily-editing-as-blocks': isTemporarilyEditingAsBlocks }, className, props.className, wrapperProps.className, defaultClassName), style: { ...wrapperProps.style, ...props.style, ...bindingsStyle } }; } /** * Call within a save function to get the props for the block wrapper. * * @param {Object} props Optional. Props to pass to the element. */ use_block_props_useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Merges wrapper props with special handling for classNames and styles. * * @param {Object} propsA * @param {Object} propsB * * @return {Object} Merged props. */ function mergeWrapperProps(propsA, propsB) { const newProps = { ...propsA, ...propsB }; // May be set to undefined, so check if the property is set! if (propsA?.hasOwnProperty('className') && propsB?.hasOwnProperty('className')) { newProps.className = dist_clsx(propsA.className, propsB.className); } if (propsA?.hasOwnProperty('style') && propsB?.hasOwnProperty('style')) { newProps.style = { ...propsA.style, ...propsB.style }; } return newProps; } function Block({ children, isHtml, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...use_block_props_useBlockProps(props, { __unstableIsHtml: isHtml }), children: children }); } function BlockListBlock({ block: { __unstableBlockSource }, mode, isLocked, canRemove, clientId, isSelected, isSelectionEnabled, className, __unstableLayoutClassNames: layoutClassNames, name, isValid, attributes, wrapperProps, setAttributes, onReplace, onRemove, onInsertBlocksAfter, onMerge, toggleSelection }) { var _wrapperProps; const { mayDisplayControls, mayDisplayParentControls, themeSupportsLayout, ...context } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); const parentLayout = useLayout() || {}; // We wrap the BlockEdit component in a div that hides it when editing in // HTML mode. This allows us to render all of the ancillary pieces // (InspectorControls, etc.) which are inside `BlockEdit` but not // `BlockHTML`, even in HTML mode. let blockEdit = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { name: name, isSelected: isSelected, attributes: attributes, setAttributes: setAttributes, insertBlocksAfter: isLocked ? undefined : onInsertBlocksAfter, onReplace: canRemove ? onReplace : undefined, onRemove: canRemove ? onRemove : undefined, mergeBlocks: canRemove ? onMerge : undefined, clientId: clientId, isSelectionEnabled: isSelectionEnabled, toggleSelection: toggleSelection, __unstableLayoutClassNames: layoutClassNames, __unstableParentLayout: Object.keys(parentLayout).length ? parentLayout : undefined, mayDisplayControls: mayDisplayControls, mayDisplayParentControls: mayDisplayParentControls, blockEditingMode: context.blockEditingMode, isPreviewMode: context.isPreviewMode }); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); // Determine whether the block has props to apply to the wrapper. if (blockType?.getEditWrapperProps) { wrapperProps = mergeWrapperProps(wrapperProps, blockType.getEditWrapperProps(attributes)); } const isAligned = wrapperProps && !!wrapperProps['data-align'] && !themeSupportsLayout; // Support for sticky position in classic themes with alignment wrappers. const isSticky = className?.includes('is-position-sticky'); // For aligned blocks, provide a wrapper element so the block can be // positioned relative to the block column. // This is only kept for classic themes that don't support layout // Historically we used to rely on extra divs and data-align to // provide the alignments styles in the editor. // Due to the differences between frontend and backend, we migrated // to the layout feature, and we're now aligning the markup of frontend // and backend. if (isAligned) { blockEdit = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('wp-block', isSticky && className), "data-align": wrapperProps['data-align'], children: blockEdit }); } let block; if (!isValid) { const saveContent = __unstableBlockSource ? (0,external_wp_blocks_namespaceObject.serializeRawBlock)(__unstableBlockSource) : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes); block = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Block, { className: "has-warning", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInvalidWarning, { clientId: clientId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: (0,external_wp_dom_namespaceObject.safeHTML)(saveContent) })] }); } else if (mode === 'html') { // Render blockEdit so the inspector controls don't disappear. // See #8969. block = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { display: 'none' }, children: blockEdit }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { isHtml: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_html, { clientId: clientId }) })] }); } else if (blockType?.apiVersion > 1) { block = blockEdit; } else { block = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { children: blockEdit }); } const { 'data-align': dataAlign, ...restWrapperProps } = (_wrapperProps = wrapperProps) !== null && _wrapperProps !== void 0 ? _wrapperProps : {}; const updatedWrapperProps = { ...restWrapperProps, className: dist_clsx(restWrapperProps.className, dataAlign && themeSupportsLayout && `align${dataAlign}`, !(dataAlign && isSticky) && className) }; // We set a new context with the adjusted and filtered wrapperProps (through // `editor.BlockListBlock`), which the `BlockListBlockProvider` did not have // access to. // Note that the context value doesn't have to be memoized in this case // because when it changes, this component will be re-rendered anyway, and // none of the consumers (BlockListBlock and useBlockProps) are memoized or // "pure". This is different from the public BlockEditContext, where // consumers might be memoized or "pure". return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockContext.Provider, { value: { wrapperProps: updatedWrapperProps, isAligned, ...context }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_crash_boundary, { fallback: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { className: "has-warning", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_crash_warning, {}) }), children: block }) }); } const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, registry) => { const { updateBlockAttributes, insertBlocks, mergeBlocks, replaceBlocks, toggleSelection, __unstableMarkLastChangeAsPersistent, moveBlocksToPosition, removeBlock, selectBlock } = dispatch(store); // Do not add new properties here, use `useDispatch` instead to avoid // leaking new props to the public API (editor.BlockListBlock filter). return { setAttributes(newAttributes) { const { getMultiSelectedBlockClientIds } = registry.select(store); const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(); const { clientId } = ownProps; const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId]; updateBlockAttributes(clientIds, newAttributes); }, onInsertBlocks(blocks, index) { const { rootClientId } = ownProps; insertBlocks(blocks, index, rootClientId); }, onInsertBlocksAfter(blocks) { const { clientId, rootClientId } = ownProps; const { getBlockIndex } = registry.select(store); const index = getBlockIndex(clientId); insertBlocks(blocks, index + 1, rootClientId); }, onMerge(forward) { const { clientId, rootClientId } = ownProps; const { getPreviousBlockClientId, getNextBlockClientId, getBlock, getBlockAttributes, getBlockName, getBlockOrder, getBlockIndex, getBlockRootClientId, canInsertBlockType } = registry.select(store); function switchToDefaultOrRemove() { const block = getBlock(clientId); const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); const defaultBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(defaultBlockName); if (getBlockName(clientId) !== defaultBlockName) { const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, defaultBlockName); if (replacement && replacement.length) { replaceBlocks(clientId, replacement); } } else if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block)) { const nextBlockClientId = getNextBlockClientId(clientId); if (nextBlockClientId) { registry.batch(() => { removeBlock(clientId); selectBlock(nextBlockClientId); }); } } else if (defaultBlockType.merge) { const attributes = defaultBlockType.merge({}, block.attributes); replaceBlocks([clientId], [(0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName, attributes)]); } } /** * Moves the block with clientId up one level. If the block type * cannot be inserted at the new location, it will be attempted to * convert to the default block type. * * @param {string} _clientId The block to move. * @param {boolean} changeSelection Whether to change the selection * to the moved block. */ function moveFirstItemUp(_clientId, changeSelection = true) { const wrapperBlockName = getBlockName(_clientId); const wrapperBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(wrapperBlockName); const isTextualWrapper = wrapperBlockType.category === 'text'; const targetRootClientId = getBlockRootClientId(_clientId); const blockOrder = getBlockOrder(_clientId); const [firstClientId] = blockOrder; if (blockOrder.length === 1 && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(firstClientId))) { removeBlock(_clientId); } else if (isTextualWrapper) { registry.batch(() => { if (canInsertBlockType(getBlockName(firstClientId), targetRootClientId)) { moveBlocksToPosition([firstClientId], _clientId, targetRootClientId, getBlockIndex(_clientId)); } else { const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)(getBlock(firstClientId), (0,external_wp_blocks_namespaceObject.getDefaultBlockName)()); if (replacement && replacement.length && replacement.every(block => canInsertBlockType(block.name, targetRootClientId))) { insertBlocks(replacement, getBlockIndex(_clientId), targetRootClientId, changeSelection); removeBlock(firstClientId, false); } else { switchToDefaultOrRemove(); } } if (!getBlockOrder(_clientId).length && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(_clientId))) { removeBlock(_clientId, false); } }); } else { switchToDefaultOrRemove(); } } // For `Delete` or forward merge, we should do the exact same thing // as `Backspace`, but from the other block. if (forward) { if (rootClientId) { const nextRootClientId = getNextBlockClientId(rootClientId); if (nextRootClientId) { // If there is a block that follows with the same parent // block name and the same attributes, merge the inner // blocks. if (getBlockName(rootClientId) === getBlockName(nextRootClientId)) { const rootAttributes = getBlockAttributes(rootClientId); const previousRootAttributes = getBlockAttributes(nextRootClientId); if (Object.keys(rootAttributes).every(key => rootAttributes[key] === previousRootAttributes[key])) { registry.batch(() => { moveBlocksToPosition(getBlockOrder(nextRootClientId), nextRootClientId, rootClientId); removeBlock(nextRootClientId, false); }); return; } } else { mergeBlocks(rootClientId, nextRootClientId); return; } } } const nextBlockClientId = getNextBlockClientId(clientId); if (!nextBlockClientId) { return; } if (getBlockOrder(nextBlockClientId).length) { moveFirstItemUp(nextBlockClientId, false); } else { mergeBlocks(clientId, nextBlockClientId); } } else { const previousBlockClientId = getPreviousBlockClientId(clientId); if (previousBlockClientId) { mergeBlocks(previousBlockClientId, clientId); } else if (rootClientId) { const previousRootClientId = getPreviousBlockClientId(rootClientId); // If there is a preceding block with the same parent block // name and the same attributes, merge the inner blocks. if (previousRootClientId && getBlockName(rootClientId) === getBlockName(previousRootClientId)) { const rootAttributes = getBlockAttributes(rootClientId); const previousRootAttributes = getBlockAttributes(previousRootClientId); if (Object.keys(rootAttributes).every(key => rootAttributes[key] === previousRootAttributes[key])) { registry.batch(() => { moveBlocksToPosition(getBlockOrder(rootClientId), rootClientId, previousRootClientId); removeBlock(rootClientId, false); }); return; } } moveFirstItemUp(rootClientId); } else { switchToDefaultOrRemove(); } } }, onReplace(blocks, indexToSelect, initialPosition) { if (blocks.length && !(0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blocks[blocks.length - 1])) { __unstableMarkLastChangeAsPersistent(); } //Unsynced patterns are nested in an array so we need to flatten them. const replacementBlocks = blocks?.length === 1 && Array.isArray(blocks[0]) ? blocks[0] : blocks; replaceBlocks([ownProps.clientId], replacementBlocks, indexToSelect, initialPosition); }, onRemove() { removeBlock(ownProps.clientId); }, toggleSelection(selectionEnabled) { toggleSelection(selectionEnabled); } }; }); // This component is used by the BlockListBlockProvider component below. It will // add the props necessary for the `editor.BlockListBlock` filters. BlockListBlock = (0,external_wp_compose_namespaceObject.compose)(applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.BlockListBlock'))(BlockListBlock); // This component provides all the information we need through a single store // subscription (useSelect mapping). Only the necessary props are passed down // to the BlockListBlock component, which is a filtered component, so these // props are public API. To avoid adding to the public API, we use a private // context to pass the rest of the information to the filtered BlockListBlock // component, and useBlockProps. function BlockListBlockProvider(props) { const { clientId, rootClientId } = props; const selectedProps = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isBlockSelected, getBlockMode, isSelectionEnabled, getTemplateLock, isSectionBlock: _isSectionBlock, getBlockWithoutAttributes, getBlockAttributes, canRemoveBlock, canMoveBlock, getSettings, getTemporarilyEditingAsBlocks, getBlockEditingMode, getBlockName, isFirstMultiSelectedBlock, getMultiSelectedBlockClientIds, hasSelectedInnerBlock, getBlocksByName, getBlockIndex, isBlockMultiSelected, isBlockSubtreeDisabled, isBlockHighlighted, __unstableIsFullySelected, __unstableSelectionHasUnmergeableBlock, isBlockBeingDragged, isDragging, __unstableHasActiveBlockOverlayActive, getSelectedBlocksInitialCaretPosition } = unlock(select(store)); const blockWithoutAttributes = getBlockWithoutAttributes(clientId); // This is a temporary fix. // This function should never be called when a block is not // present in the state. It happens now because the order in // withSelect rendering is not correct. if (!blockWithoutAttributes) { return; } const { hasBlockSupport: _hasBlockSupport, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const attributes = getBlockAttributes(clientId); const { name: blockName, isValid } = blockWithoutAttributes; const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); const { supportsLayout, isPreviewMode } = getSettings(); const hasLightBlockWrapper = blockType?.apiVersion > 1; const previewContext = { isPreviewMode, blockWithoutAttributes, name: blockName, attributes, isValid, themeSupportsLayout: supportsLayout, index: getBlockIndex(clientId), isReusable: (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType), className: hasLightBlockWrapper ? attributes.className : undefined, defaultClassName: hasLightBlockWrapper ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockName) : undefined, blockTitle: blockType?.title }; // When in preview mode, we can avoid a lot of selection and // editing related selectors. if (isPreviewMode) { return previewContext; } const _isSelected = isBlockSelected(clientId); const canRemove = canRemoveBlock(clientId); const canMove = canMoveBlock(clientId); const match = getActiveBlockVariation(blockName, attributes); const isMultiSelected = isBlockMultiSelected(clientId); const checkDeep = true; const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep); const blockEditingMode = getBlockEditingMode(clientId); const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'multiple', true); // For block types with `multiple` support, there is no "original // block" to be found in the content, as the block itself is valid. const blocksWithSameName = multiple ? [] : getBlocksByName(blockName); const isInvalid = blocksWithSameName.length && blocksWithSameName[0] !== clientId; return { ...previewContext, mode: getBlockMode(clientId), isSelectionEnabled: isSelectionEnabled(), isLocked: !!getTemplateLock(rootClientId), isSectionBlock: _isSectionBlock(clientId), canRemove, canMove, isSelected: _isSelected, isTemporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId, blockEditingMode, mayDisplayControls: _isSelected || isFirstMultiSelectedBlock(clientId) && getMultiSelectedBlockClientIds().every(id => getBlockName(id) === blockName), mayDisplayParentControls: _hasBlockSupport(getBlockName(clientId), '__experimentalExposeControlsToChildren', false) && hasSelectedInnerBlock(clientId), blockApiVersion: blockType?.apiVersion || 1, blockTitle: match?.title || blockType?.title, isSubtreeDisabled: blockEditingMode === 'disabled' && isBlockSubtreeDisabled(clientId), hasOverlay: __unstableHasActiveBlockOverlayActive(clientId) && !isDragging(), initialPosition: _isSelected ? getSelectedBlocksInitialCaretPosition() : undefined, isHighlighted: isBlockHighlighted(clientId), isMultiSelected, isPartiallySelected: isMultiSelected && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(), isDragging: isBlockBeingDragged(clientId), hasChildSelected: isAncestorOfSelectedBlock, isEditingDisabled: blockEditingMode === 'disabled', hasEditableOutline: blockEditingMode !== 'disabled' && getBlockEditingMode(rootClientId) === 'disabled', originalBlockClientId: isInvalid ? blocksWithSameName[0] : false }; }, [clientId, rootClientId]); const { isPreviewMode, // Fill values that end up as a public API and may not be defined in // preview mode. mode = 'visual', isSelectionEnabled = false, isLocked = false, canRemove = false, canMove = false, blockWithoutAttributes, name, attributes, isValid, isSelected = false, themeSupportsLayout, isTemporarilyEditingAsBlocks, blockEditingMode, mayDisplayControls, mayDisplayParentControls, index, blockApiVersion, blockTitle, isSubtreeDisabled, hasOverlay, initialPosition, isHighlighted, isMultiSelected, isPartiallySelected, isReusable, isDragging, hasChildSelected, isSectionBlock, isEditingDisabled, hasEditableOutline, className, defaultClassName, originalBlockClientId } = selectedProps; // Users of the editor.BlockListBlock filter used to be able to // access the block prop. // Ideally these blocks would rely on the clientId prop only. // This is kept for backward compatibility reasons. const block = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...blockWithoutAttributes, attributes }), [blockWithoutAttributes, attributes]); // Block is sometimes not mounted at the right time, causing it be // undefined see issue for more info // https://github.com/WordPress/gutenberg/issues/17013 if (!selectedProps) { return null; } const privateContext = { isPreviewMode, clientId, className, index, mode, name, blockApiVersion, blockTitle, isSelected, isSubtreeDisabled, hasOverlay, initialPosition, blockEditingMode, isHighlighted, isMultiSelected, isPartiallySelected, isReusable, isDragging, hasChildSelected, isSectionBlock, isEditingDisabled, hasEditableOutline, isTemporarilyEditingAsBlocks, defaultClassName, mayDisplayControls, mayDisplayParentControls, originalBlockClientId, themeSupportsLayout, canMove }; // Here we separate between the props passed to BlockListBlock and any other // information we selected for internal use. BlockListBlock is a filtered // component and thus ALL the props are PUBLIC API. // Note that the context value doesn't have to be memoized in this case // because when it changes, this component will be re-rendered anyway, and // none of the consumers (BlockListBlock and useBlockProps) are memoized or // "pure". This is different from the public BlockEditContext, where // consumers might be memoized or "pure". return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockContext.Provider, { value: privateContext, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListBlock, { ...props, mode, isSelectionEnabled, isLocked, canRemove, canMove, // Users of the editor.BlockListBlock filter used to be able // to access the block prop. Ideally these blocks would rely // on the clientId prop only. This is kept for backward // compatibility reasons. block, name, attributes, isValid, isSelected }) }); } /* harmony default export */ const block = ((0,external_wp_element_namespaceObject.memo)(BlockListBlockProvider)); ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/default-block-appender/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Zero width non-breaking space, used as padding for the paragraph when it is * empty. */ const ZWNBSP = '\ufeff'; function DefaultBlockAppender({ rootClientId }) { const { showPrompt, isLocked, placeholder, isManualGrid } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockCount, getSettings, getTemplateLock, getBlockAttributes } = select(store); const isEmpty = !getBlockCount(rootClientId); const { bodyPlaceholder } = getSettings(); return { showPrompt: isEmpty, isLocked: !!getTemplateLock(rootClientId), placeholder: bodyPlaceholder, isManualGrid: getBlockAttributes(rootClientId)?.layout?.isManualPlacement }; }, [rootClientId]); const { insertDefaultBlock, startTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (isLocked || isManualGrid) { return null; } const value = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Type / to choose a block'); const onAppend = () => { insertDefaultBlock(undefined, rootClientId); startTyping(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { "data-root-client-id": rootClientId || '', className: dist_clsx('block-editor-default-block-appender', { 'has-visible-prompt': showPrompt }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { tabIndex: "0" // We want this element to be styled as a paragraph by themes. // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role , role: "button", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Add default block') // A wrapping container for this one already has the wp-block className. , className: "block-editor-default-block-appender__content", onKeyDown: event => { if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) { onAppend(); } }, onClick: () => onAppend(), onFocus: () => { if (showPrompt) { onAppend(); } }, children: showPrompt ? value : ZWNBSP }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { rootClientId: rootClientId, position: "bottom right", isAppender: true, __experimentalIsQuick: true })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list-appender/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function DefaultAppender({ rootClientId }) { const canInsertDefaultBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).canInsertBlockType((0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), rootClientId)); if (canInsertDefaultBlock) { // Render the default block appender if the context supports use // of the default appender. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId: rootClientId }); } // Fallback in case the default block can't be inserted. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(button_block_appender, { rootClientId: rootClientId, className: "block-list-appender__toggle" }); } function BlockListAppender({ rootClientId, CustomAppender, className, tagName: TagName = 'div' }) { const isDragOver = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockInsertionPoint, isBlockInsertionPointVisible, getBlockCount } = select(store); const insertionPoint = getBlockInsertionPoint(); // Ideally we should also check for `isDragging` but currently it // requires a lot more setup. We can revisit this once we refactor // the DnD utility hooks. return isBlockInsertionPointVisible() && rootClientId === insertionPoint?.rootClientId && getBlockCount(rootClientId) === 0; }, [rootClientId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName // A `tabIndex` is used on the wrapping `div` element in order to // force a focus event to occur when an appender `button` element // is clicked. In some browsers (Firefox, Safari), button clicks do // not emit a focus event, which could cause this event to propagate // unexpectedly. The `tabIndex` ensures that the interaction is // captured as a focus, without also adding an extra tab stop. // // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus , { tabIndex: -1, className: dist_clsx('block-list-appender wp-block', className, { 'is-drag-over': isDragOver }) // Needed in case the whole editor is content editable (for multi // selection). It fixes an edge case where ArrowDown and ArrowRight // should collapse the selection to the end of that selection and // not into the appender. , contentEditable: false // The appender exists to let you add the first Paragraph before // any is inserted. To that end, this appender should visually be // presented as a block. That means theme CSS should style it as if // it were an empty paragraph block. That means a `wp-block` class to // ensure the width is correct, and a [data-block] attribute to ensure // the correct margin is applied, especially for classic themes which // have commonly targeted that attribute for margins. , "data-block": true, children: CustomAppender ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomAppender, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultAppender, { rootClientId: rootClientId }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/inbetween.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const inbetween_MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER; const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)(); function BlockPopoverInbetween({ previousClientId, nextClientId, children, __unstablePopoverSlot, __unstableContentRef, operation = 'insert', nearestSide = 'right', ...props }) { // This is a temporary hack to get the inbetween inserter to recompute properly. const [popoverRecomputeCounter, forcePopoverRecompute] = (0,external_wp_element_namespaceObject.useReducer)( // Module is there to make sure that the counter doesn't overflow. s => (s + 1) % inbetween_MAX_POPOVER_RECOMPUTE_COUNTER, 0); const { orientation, rootClientId, isVisible } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockListSettings, getBlockRootClientId, isBlockVisible } = select(store); const _rootClientId = getBlockRootClientId(previousClientId !== null && previousClientId !== void 0 ? previousClientId : nextClientId); return { orientation: getBlockListSettings(_rootClientId)?.orientation || 'vertical', rootClientId: _rootClientId, isVisible: isBlockVisible(previousClientId) && isBlockVisible(nextClientId) }; }, [previousClientId, nextClientId]); const previousElement = useBlockElement(previousClientId); const nextElement = useBlockElement(nextClientId); const isVertical = orientation === 'vertical'; const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { if ( // popoverRecomputeCounter is by definition always equal or greater than 0. // This check is only there to satisfy the correctness of the // exhaustive-deps rule for the `useMemo` hook. popoverRecomputeCounter < 0 || !previousElement && !nextElement || !isVisible) { return undefined; } const contextElement = operation === 'group' ? nextElement || previousElement : previousElement || nextElement; return { contextElement, getBoundingClientRect() { const previousRect = previousElement ? previousElement.getBoundingClientRect() : null; const nextRect = nextElement ? nextElement.getBoundingClientRect() : null; let left = 0; let top = 0; let width = 0; let height = 0; if (operation === 'group') { const targetRect = nextRect || previousRect; top = targetRect.top; // No spacing is likely around blocks in this operation. // So width of the inserter containing rect is set to 0. width = 0; height = targetRect.bottom - targetRect.top; // Popover calculates its distance from mid-block so some // adjustments are needed to make it appear in the right place. left = nearestSide === 'left' ? targetRect.left - 2 : targetRect.right - 2; } else if (isVertical) { // vertical top = previousRect ? previousRect.bottom : nextRect.top; width = previousRect ? previousRect.width : nextRect.width; height = nextRect && previousRect ? nextRect.top - previousRect.bottom : 0; left = previousRect ? previousRect.left : nextRect.left; } else { top = previousRect ? previousRect.top : nextRect.top; height = previousRect ? previousRect.height : nextRect.height; if ((0,external_wp_i18n_namespaceObject.isRTL)()) { // non vertical, rtl left = nextRect ? nextRect.right : previousRect.left; width = previousRect && nextRect ? previousRect.left - nextRect.right : 0; } else { // non vertical, ltr left = previousRect ? previousRect.right : nextRect.left; width = previousRect && nextRect ? nextRect.left - previousRect.right : 0; } // Avoid a negative width which happens when the next rect // is on the next line. width = Math.max(width, 0); } return new window.DOMRect(left, top, width, height); } }; }, [previousElement, nextElement, popoverRecomputeCounter, isVertical, isVisible, operation, nearestSide]); const popoverScrollRef = use_popover_scroll(__unstableContentRef); // This is only needed for a smooth transition when moving blocks. // When blocks are moved up/down, their position can be set by // updating the `transform` property manually (i.e. without using CSS // transitions or animations). The animation, which can also scroll the block // editor, can sometimes cause the position of the Popover to get out of sync. // A MutationObserver is therefore used to make sure that changes to the // selectedElement's attribute (i.e. `transform`) can be tracked and used to // trigger the Popover to rerender. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!previousElement) { return; } const observer = new window.MutationObserver(forcePopoverRecompute); observer.observe(previousElement, { attributes: true }); return () => { observer.disconnect(); }; }, [previousElement]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!nextElement) { return; } const observer = new window.MutationObserver(forcePopoverRecompute); observer.observe(nextElement, { attributes: true }); return () => { observer.disconnect(); }; }, [nextElement]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!previousElement) { return; } previousElement.ownerDocument.defaultView.addEventListener('resize', forcePopoverRecompute); return () => { previousElement.ownerDocument.defaultView?.removeEventListener('resize', forcePopoverRecompute); }; }, [previousElement]); // If there's either a previous or a next element, show the inbetween popover. // Note that drag and drop uses the inbetween popover to show the drop indicator // before the first block and after the last block. if (!previousElement && !nextElement || !isVisible) { return null; } /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ // While ideally it would be enough to capture the // bubbling focus event from the Inserter, due to the // characteristics of click focusing of `button`s in // Firefox and Safari, it is not reliable. // // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { ref: popoverScrollRef, animate: false, anchor: popoverAnchor, focusOnMount: false // Render in the old slot if needed for backward compatibility, // otherwise render in place (not in the default popover slot). , __unstableSlotName: __unstablePopoverSlot, inline: !__unstablePopoverSlot // Forces a remount of the popover when its position changes // This makes sure the popover doesn't animate from its previous position. , ...props, className: dist_clsx('block-editor-block-popover', 'block-editor-block-popover__inbetween', props.className), resize: false, flip: false, placement: "overlay", variant: "unstyled", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-popover__inbetween-container", children: children }) }, nextClientId + '--' + rootClientId); /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ } /* harmony default export */ const inbetween = (BlockPopoverInbetween); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/drop-zone.js /** * WordPress dependencies */ /** * Internal dependencies */ const animateVariants = { hide: { opacity: 0, scaleY: 0.75 }, show: { opacity: 1, scaleY: 1 }, exit: { opacity: 0, scaleY: 0.9 } }; function BlockDropZonePopover({ __unstablePopoverSlot, __unstableContentRef }) { const { clientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockOrder, getBlockInsertionPoint } = select(store); const insertionPoint = getBlockInsertionPoint(); const order = getBlockOrder(insertionPoint.rootClientId); if (!order.length) { return {}; } return { clientId: order[insertionPoint.index] }; }, []); const reducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { clientId: clientId, __unstablePopoverSlot: __unstablePopoverSlot, __unstableContentRef: __unstableContentRef, className: "block-editor-block-popover__drop-zone", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { "data-testid": "block-popover-drop-zone", initial: reducedMotion ? animateVariants.show : animateVariants.hide, animate: animateVariants.show, exit: reducedMotion ? animateVariants.show : animateVariants.exit, className: "block-editor-block-popover__drop-zone-foreground" }) }); } /* harmony default export */ const drop_zone = (BlockDropZonePopover); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/insertion-point.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const insertion_point_InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)(); function InbetweenInsertionPointPopover({ __unstablePopoverSlot, __unstableContentRef, operation = 'insert', nearestSide = 'right' }) { const { selectBlock, hideInsertionPoint } = (0,external_wp_data_namespaceObject.useDispatch)(store); const openRef = (0,external_wp_element_namespaceObject.useContext)(insertion_point_InsertionPointOpenRef); const ref = (0,external_wp_element_namespaceObject.useRef)(); const { orientation, previousClientId, nextClientId, rootClientId, isInserterShown, isDistractionFree, isZoomOutMode } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockOrder, getBlockListSettings, getBlockInsertionPoint, isBlockBeingDragged, getPreviousBlockClientId, getNextBlockClientId, getSettings, isZoomOut } = unlock(select(store)); const insertionPoint = getBlockInsertionPoint(); const order = getBlockOrder(insertionPoint.rootClientId); if (!order.length) { return {}; } let _previousClientId = order[insertionPoint.index - 1]; let _nextClientId = order[insertionPoint.index]; while (isBlockBeingDragged(_previousClientId)) { _previousClientId = getPreviousBlockClientId(_previousClientId); } while (isBlockBeingDragged(_nextClientId)) { _nextClientId = getNextBlockClientId(_nextClientId); } const settings = getSettings(); return { previousClientId: _previousClientId, nextClientId: _nextClientId, orientation: getBlockListSettings(insertionPoint.rootClientId)?.orientation || 'vertical', rootClientId: insertionPoint.rootClientId, isDistractionFree: settings.isDistractionFree, isInserterShown: insertionPoint?.__unstableWithInserter, isZoomOutMode: isZoomOut() }; }, []); const { getBlockEditingMode } = (0,external_wp_data_namespaceObject.useSelect)(store); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); function onClick(event) { if (event.target === ref.current && nextClientId && getBlockEditingMode(nextClientId) !== 'disabled') { selectBlock(nextClientId, -1); } } function maybeHideInserterPoint(event) { // Only hide the inserter if it's triggered on the wrapper, // and the inserter is not open. if (event.target === ref.current && !openRef.current) { hideInsertionPoint(); } } function onFocus(event) { // Only handle click on the wrapper specifically, and not an event // bubbled from the inserter itself. if (event.target !== ref.current) { openRef.current = true; } } const lineVariants = { // Initial position starts from the center and invisible. start: { opacity: 0, scale: 0 }, // The line expands to fill the container. If the inserter is visible it // is delayed so it appears orchestrated. rest: { opacity: 1, scale: 1, transition: { delay: isInserterShown ? 0.5 : 0, type: 'tween' } }, hover: { opacity: 1, scale: 1, transition: { delay: 0.5, type: 'tween' } } }; const inserterVariants = { start: { scale: disableMotion ? 1 : 0 }, rest: { scale: 1, transition: { delay: 0.4, type: 'tween' } } }; if (isDistractionFree) { return null; } // Zoom out mode should only show the insertion point for the insert operation. // Other operations such as "group" are when the editor tries to create a row // block by grouping the block being dragged with the block it's being dropped // onto. if (isZoomOutMode && operation !== 'insert') { return null; } const orientationClassname = orientation === 'horizontal' || operation === 'group' ? 'is-horizontal' : 'is-vertical'; const className = dist_clsx('block-editor-block-list__insertion-point', orientationClassname); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inbetween, { previousClientId: previousClientId, nextClientId: nextClientId, __unstablePopoverSlot: __unstablePopoverSlot, __unstableContentRef: __unstableContentRef, operation: operation, nearestSide: nearestSide, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { layout: !disableMotion, initial: disableMotion ? 'rest' : 'start', animate: "rest", whileHover: "hover", whileTap: "pressed", exit: "start", ref: ref, tabIndex: -1, onClick: onClick, onFocus: onFocus, className: dist_clsx(className, { 'is-with-inserter': isInserterShown }), onHoverEnd: maybeHideInserterPoint, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: lineVariants, className: "block-editor-block-list__insertion-point-indicator", "data-testid": "block-list-insertion-point-indicator" }), isInserterShown && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: inserterVariants, className: dist_clsx('block-editor-block-list__insertion-point-inserter'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { position: "bottom center", clientId: nextClientId, rootClientId: rootClientId, __experimentalIsQuick: true, onToggle: isOpen => { openRef.current = isOpen; }, onSelectOrClose: () => { openRef.current = false; } }) })] }) }); } function InsertionPoint(props) { const { insertionPoint, isVisible, isBlockListEmpty } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockInsertionPoint, isBlockInsertionPointVisible, getBlockCount } = select(store); const blockInsertionPoint = getBlockInsertionPoint(); return { insertionPoint: blockInsertionPoint, isVisible: isBlockInsertionPointVisible(), isBlockListEmpty: getBlockCount(blockInsertionPoint?.rootClientId) === 0 }; }, []); if (!isVisible || // Don't render the insertion point if the block list is empty. // The insertion point will be represented by the appender instead. isBlockListEmpty) { return null; } /** * Render a popover that overlays the block when the desired operation is to replace it. * Otherwise, render a popover in between blocks for the indication of inserting between them. */ return insertionPoint.operation === 'replace' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(drop_zone // Force remount to trigger the animation. , { ...props }, `${insertionPoint.rootClientId}-${insertionPoint.index}`) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InbetweenInsertionPointPopover, { operation: insertionPoint.operation, nearestSide: insertionPoint.nearestSide, ...props }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-in-between-inserter.js /** * WordPress dependencies */ /** * Internal dependencies */ function useInBetweenInserter() { const openRef = (0,external_wp_element_namespaceObject.useContext)(insertion_point_InsertionPointOpenRef); const isInBetweenInserterDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().isDistractionFree || unlock(select(store)).isZoomOut(), []); const { getBlockListSettings, getBlockIndex, isMultiSelecting, getSelectedBlockClientIds, getSettings, getTemplateLock, __unstableIsWithinBlockOverlay, getBlockEditingMode, getBlockName, getBlockAttributes, getParentSectionBlock } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { showInsertionPoint, hideInsertionPoint } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (isInBetweenInserterDisabled) { return; } function onMouseMove(event) { // openRef is the reference to the insertion point between blocks. // If the reference is not set or the insertion point is already open, return. if (openRef === undefined || openRef.current) { return; } // Ignore text nodes sometimes detected in FireFox. if (event.target.nodeType === event.target.TEXT_NODE) { return; } if (isMultiSelecting()) { return; } if (!event.target.classList.contains('block-editor-block-list__layout')) { hideInsertionPoint(); return; } let rootClientId; if (!event.target.classList.contains('is-root-container')) { const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]'); rootClientId = blockElement.getAttribute('data-block'); } if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled' || getBlockName(rootClientId) === 'core/block' || rootClientId && getBlockAttributes(rootClientId).layout?.isManualPlacement) { return; } const blockListSettings = getBlockListSettings(rootClientId); const orientation = blockListSettings?.orientation || 'vertical'; const captureToolbars = !!blockListSettings?.__experimentalCaptureToolbars; const offsetTop = event.clientY; const offsetLeft = event.clientX; const children = Array.from(event.target.children); let element = children.find(blockEl => { const blockElRect = blockEl.getBoundingClientRect(); return blockEl.classList.contains('wp-block') && orientation === 'vertical' && blockElRect.top > offsetTop || blockEl.classList.contains('wp-block') && orientation === 'horizontal' && ((0,external_wp_i18n_namespaceObject.isRTL)() ? blockElRect.right < offsetLeft : blockElRect.left > offsetLeft); }); if (!element) { hideInsertionPoint(); return; } // The block may be in an alignment wrapper, so check the first direct // child if the element has no ID. if (!element.id) { element = element.firstElementChild; if (!element) { hideInsertionPoint(); return; } } // Don't show the insertion point if a parent block has an "overlay" // See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337 const clientId = element.id.slice('block-'.length); if (!clientId || __unstableIsWithinBlockOverlay(clientId) || !!getParentSectionBlock(clientId)) { return; } // Don't show the inserter if the following conditions are met, // as it conflicts with the block toolbar: // 1. when hovering above or inside selected block(s) // 2. when the orientation is vertical // 3. when the __experimentalCaptureToolbars is not enabled // 4. when the Top Toolbar is not disabled if (getSelectedBlockClientIds().includes(clientId) && orientation === 'vertical' && !captureToolbars && !getSettings().hasFixedToolbar) { return; } const elementRect = element.getBoundingClientRect(); if (orientation === 'horizontal' && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === 'vertical' && (event.clientX > elementRect.right || event.clientX < elementRect.left)) { hideInsertionPoint(); return; } const index = getBlockIndex(clientId); // Don't show the in-between inserter before the first block in // the list (preserves the original behaviour). if (index === 0) { hideInsertionPoint(); return; } showInsertionPoint(rootClientId, index, { __unstableWithInserter: true }); } node.addEventListener('mousemove', onMouseMove); return () => { node.removeEventListener('mousemove', onMouseMove); }; }, [openRef, getBlockListSettings, getBlockIndex, isMultiSelecting, showInsertionPoint, hideInsertionPoint, getSelectedBlockClientIds, isInBetweenInserterDisabled]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Pass the returned ref callback to an element that should clear block * selection. Selection will only be cleared if the element is clicked directly, * not if a child element is clicked. * * @return {import('react').RefCallback} Ref callback. */ function useBlockSelectionClearer() { const { getSettings, hasSelectedBlock, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store); const { clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { clearBlockSelection: isEnabled } = getSettings(); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!isEnabled) { return; } function onMouseDown(event) { if (!hasSelectedBlock() && !hasMultiSelection()) { return; } // Only handle clicks on the element, not the children. if (event.target !== node) { return; } clearSelectedBlock(); } node.addEventListener('mousedown', onMouseDown); return () => { node.removeEventListener('mousedown', onMouseDown); }; }, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock, isEnabled]); } function BlockSelectionClearer(props) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useBlockSelectionClearer(), ...props }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/button-block-appender.js /** * External dependencies */ /** * Internal dependencies */ function ButtonBlockAppender({ showSeparator, isFloating, onAddBlock, isToggle }) { const { clientId } = useBlockEditContext(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(button_block_appender, { className: dist_clsx({ 'block-list-appender__toggle': isToggle }), rootClientId: clientId, showSeparator: showSeparator, isFloating: isFloating, onAddBlock: onAddBlock }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/default-block-appender.js /** * Internal dependencies */ function default_block_appender_DefaultBlockAppender() { const { clientId } = useBlockEditContext(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId: clientId }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-nested-settings-update.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */ const pendingSettingsUpdates = new WeakMap(); // Creates a memoizing caching function that remembers the last value and keeps returning it // as long as the new values are shallowly equal. Helps keep dependencies stable. function createShallowMemo() { let value; return newValue => { if (value === undefined || !external_wp_isShallowEqual_default()(value, newValue)) { value = newValue; } return value; }; } function useShallowMemo(value) { const [memo] = (0,external_wp_element_namespaceObject.useState)(createShallowMemo); return memo(value); } /** * This hook is a side effect which updates the block-editor store when changes * happen to inner block settings. The given props are transformed into a * settings object, and if that is different from the current settings object in * the block-editor store, then the store is updated with the new settings which * came from props. * * @param {string} clientId The client ID of the block to update. * @param {string} parentLock * @param {string[]} allowedBlocks An array of block names which are permitted * in inner blocks. * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}. * @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ]. * @param {?boolean} directInsert If a default block should be inserted directly by the appender. * * @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead. * * @param {?boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead. * * @param {string} [templateLock] The template lock specified for the inner * blocks component. (e.g. "all") * @param {boolean} captureToolbars Whether or children toolbars should be shown * in the inner blocks component rather than on * the child block. * @param {string} orientation The direction in which the block * should face. * @param {Object} layout The layout object for the block container. */ function useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) { // Instead of adding a useSelect mapping here, please add to the useSelect // mapping in InnerBlocks! Every subscription impacts performance. const registry = (0,external_wp_data_namespaceObject.useRegistry)(); // Implementors often pass a new array on every render, // and the contents of the arrays are just strings, so the entire array // can be passed as dependencies but We need to include the length of the array, // otherwise if the arrays change length but the first elements are equal the comparison, // does not works as expected. const _allowedBlocks = useShallowMemo(allowedBlocks); const _prioritizedInserterBlocks = useShallowMemo(prioritizedInserterBlocks); const _templateLock = templateLock === undefined || parentLock === 'contentOnly' ? parentLock : templateLock; (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const newSettings = { allowedBlocks: _allowedBlocks, prioritizedInserterBlocks: _prioritizedInserterBlocks, templateLock: _templateLock }; // These values are not defined for RN, so only include them if they // are defined. if (captureToolbars !== undefined) { newSettings.__experimentalCaptureToolbars = captureToolbars; } // Orientation depends on layout, // ideally the separate orientation prop should be deprecated. if (orientation !== undefined) { newSettings.orientation = orientation; } else { const layoutType = getLayoutType(layout?.type); newSettings.orientation = layoutType.getOrientation(layout); } if (__experimentalDefaultBlock !== undefined) { external_wp_deprecated_default()('__experimentalDefaultBlock', { alternative: 'defaultBlock', since: '6.3', version: '6.4' }); newSettings.defaultBlock = __experimentalDefaultBlock; } if (defaultBlock !== undefined) { newSettings.defaultBlock = defaultBlock; } if (__experimentalDirectInsert !== undefined) { external_wp_deprecated_default()('__experimentalDirectInsert', { alternative: 'directInsert', since: '6.3', version: '6.4' }); newSettings.directInsert = __experimentalDirectInsert; } if (directInsert !== undefined) { newSettings.directInsert = directInsert; } if (newSettings.directInsert !== undefined && typeof newSettings.directInsert !== 'boolean') { external_wp_deprecated_default()('Using `Function` as a `directInsert` argument', { alternative: '`boolean` values', since: '6.5' }); } // Batch updates to block list settings to avoid triggering cascading renders // for each container block included in a tree and optimize initial render. // To avoid triggering updateBlockListSettings for each container block // causing X re-renderings for X container blocks, // we batch all the updatedBlockListSettings in a single "data" batch // which results in a single re-render. if (!pendingSettingsUpdates.get(registry)) { pendingSettingsUpdates.set(registry, {}); } pendingSettingsUpdates.get(registry)[clientId] = newSettings; window.queueMicrotask(() => { const settings = pendingSettingsUpdates.get(registry); if (Object.keys(settings).length) { const { updateBlockListSettings } = registry.dispatch(store); updateBlockListSettings(settings); pendingSettingsUpdates.set(registry, {}); } }); }, [clientId, _allowedBlocks, _prioritizedInserterBlocks, _templateLock, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, captureToolbars, orientation, layout, registry]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * This hook makes sure that a block's inner blocks stay in sync with the given * block "template". The template is a block hierarchy to which inner blocks must * conform. If the blocks get "out of sync" with the template and the template * is meant to be locked (e.g. templateLock = "all" or templateLock = "contentOnly"), * then we replace the inner blocks with the correct value after synchronizing it with the template. * * @param {string} clientId The block client ID. * @param {Object} template The template to match. * @param {string} templateLock The template lock state for the inner blocks. For * example, if the template lock is set to "all", * then the inner blocks will stay in sync with the * template. If not defined or set to false, then * the inner blocks will not be synchronized with * the given template. * @param {boolean} templateInsertUpdatesSelection Whether or not to update the * block-editor selection state when inner blocks * are replaced after template synchronization. */ function useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection) { // Instead of adding a useSelect mapping here, please add to the useSelect // mapping in InnerBlocks! Every subscription impacts performance. const registry = (0,external_wp_data_namespaceObject.useRegistry)(); // Maintain a reference to the previous value so we can do a deep equality check. const existingTemplateRef = (0,external_wp_element_namespaceObject.useRef)(null); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { let isCancelled = false; const { getBlocks, getSelectedBlocksInitialCaretPosition, isBlockSelected } = registry.select(store); const { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } = registry.dispatch(store); // There's an implicit dependency between useInnerBlockTemplateSync and useNestedSettingsUpdate // The former needs to happen after the latter and since the latter is using microtasks to batch updates (performance optimization), // we need to schedule this one in a microtask as well. // Example: If you remove queueMicrotask here, ctrl + click to insert quote block won't close the inserter. window.queueMicrotask(() => { if (isCancelled) { return; } // Only synchronize innerBlocks with template if innerBlocks are empty // or a locking "all" or "contentOnly" exists directly on the block. const currentInnerBlocks = getBlocks(clientId); const shouldApplyTemplate = currentInnerBlocks.length === 0 || templateLock === 'all' || templateLock === 'contentOnly'; const hasTemplateChanged = !es6_default()(template, existingTemplateRef.current); if (!shouldApplyTemplate || !hasTemplateChanged) { return; } existingTemplateRef.current = template; const nextBlocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(currentInnerBlocks, template); if (!es6_default()(nextBlocks, currentInnerBlocks)) { __unstableMarkNextChangeAsNotPersistent(); replaceInnerBlocks(clientId, nextBlocks, currentInnerBlocks.length === 0 && templateInsertUpdatesSelection && nextBlocks.length !== 0 && isBlockSelected(clientId), // This ensures the "initialPosition" doesn't change when applying the template // If we're supposed to focus the block, we'll focus the first inner block // otherwise, we won't apply any auto-focus. // This ensures for instance that the focus stays in the inserter when inserting the "buttons" block. getSelectedBlocksInitialCaretPosition()); } }); return () => { isCancelled = true; }; }, [template, templateLock, clientId, registry, templateInsertUpdatesSelection]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-block-context.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns a context object for a given block. * * @param {string} clientId The block client ID. * * @return {Record<string,*>} Context value. */ function useBlockContext(clientId) { return (0,external_wp_data_namespaceObject.useSelect)(select => { const block = select(store).getBlock(clientId); if (!block) { return undefined; } const blockType = select(external_wp_blocks_namespaceObject.store).getBlockType(block.name); if (!blockType) { return undefined; } if (Object.keys(blockType.providesContext).length === 0) { return undefined; } return Object.fromEntries(Object.entries(blockType.providesContext).map(([contextName, attributeName]) => [contextName, block.attributes[attributeName]])); }, [clientId]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/use-on-block-drop/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('react').SyntheticEvent} SyntheticEvent */ /** @typedef {import('./types').WPDropOperation} WPDropOperation */ /** * Retrieve the data for a block drop event. * * @param {SyntheticEvent} event The drop event. * * @return {Object} An object with block drag and drop data. */ function parseDropEvent(event) { let result = { srcRootClientId: null, srcClientIds: null, srcIndex: null, type: null, blocks: null }; if (!event.dataTransfer) { return result; } try { result = Object.assign(result, JSON.parse(event.dataTransfer.getData('wp-blocks'))); } catch (err) { return result; } return result; } /** * A function that returns an event handler function for block drop events. * * @param {string} targetRootClientId The root client id where the block(s) will be inserted. * @param {number} targetBlockIndex The index where the block(s) will be inserted. * @param {Function} getBlockIndex A function that gets the index of a block. * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks. * @param {Function} moveBlocks A function that moves blocks. * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks. * @param {Function} clearSelectedBlock A function that clears block selection. * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`. * @param {Function} getBlock A function that returns a block given its client id. * @return {Function} The event handler for a block drop event. */ function onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocks, insertOrReplaceBlocks, clearSelectedBlock, operation, getBlock) { return event => { const { srcRootClientId: sourceRootClientId, srcClientIds: sourceClientIds, type: dropType, blocks } = parseDropEvent(event); // If the user is inserting a block. if (dropType === 'inserter') { clearSelectedBlock(); const blocksToInsert = blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); insertOrReplaceBlocks(blocksToInsert, true, null); } // If the user is moving a block. if (dropType === 'block') { const sourceBlockIndex = getBlockIndex(sourceClientIds[0]); // If the user is dropping to the same position, return early. if (sourceRootClientId === targetRootClientId && sourceBlockIndex === targetBlockIndex) { return; } // If the user is attempting to drop a block within its own // nested blocks, return early as this would create infinite // recursion. if (sourceClientIds.includes(targetRootClientId) || getClientIdsOfDescendants(sourceClientIds).some(id => id === targetRootClientId)) { return; } // If the user is dropping a block over another block, replace both blocks // with a group block containing them if (operation === 'group') { const blocksToInsert = sourceClientIds.map(clientId => getBlock(clientId)); insertOrReplaceBlocks(blocksToInsert, true, null, sourceClientIds); return; } const isAtSameLevel = sourceRootClientId === targetRootClientId; const draggedBlockCount = sourceClientIds.length; // If the block is kept at the same level and moved downwards, // subtract to take into account that the blocks being dragged // were removed from the block list above the insertion point. const insertIndex = isAtSameLevel && sourceBlockIndex < targetBlockIndex ? targetBlockIndex - draggedBlockCount : targetBlockIndex; moveBlocks(sourceClientIds, sourceRootClientId, insertIndex); } }; } /** * A function that returns an event handler function for block-related file drop events. * * @param {string} targetRootClientId The root client id where the block(s) will be inserted. * @param {Function} getSettings A function that gets the block editor settings. * @param {Function} updateBlockAttributes A function that updates a block's attributes. * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted. * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks. * * @return {Function} The event handler for a block-related file drop event. */ function onFilesDrop(targetRootClientId, getSettings, updateBlockAttributes, canInsertBlockType, insertOrReplaceBlocks) { return files => { if (!getSettings().mediaUpload) { return; } const transformation = (0,external_wp_blocks_namespaceObject.findTransform)((0,external_wp_blocks_namespaceObject.getBlockTransforms)('from'), transform => transform.type === 'files' && canInsertBlockType(transform.blockName, targetRootClientId) && transform.isMatch(files)); if (transformation) { const blocks = transformation.transform(files, updateBlockAttributes); insertOrReplaceBlocks(blocks); } }; } /** * A function that returns an event handler function for block-related HTML drop events. * * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks. * * @return {Function} The event handler for a block-related HTML drop event. */ function onHTMLDrop(insertOrReplaceBlocks) { return HTML => { const blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML, mode: 'BLOCKS' }); if (blocks.length) { insertOrReplaceBlocks(blocks); } }; } /** * A React hook for handling block drop events. * * @param {string} targetRootClientId The root client id where the block(s) will be inserted. * @param {number} targetBlockIndex The index where the block(s) will be inserted. * @param {Object} options The optional options. * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now. * * @return {Function} A function to be passed to the onDrop handler. */ function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) { const { operation = 'insert', nearestSide = 'right' } = options; const { canInsertBlockType, getBlockIndex, getClientIdsOfDescendants, getBlockOrder, getBlocksByClientId, getSettings, getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const { insertBlocks, moveBlocksToPosition, updateBlockAttributes, clearSelectedBlock, replaceBlocks, removeBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const insertOrReplaceBlocks = (0,external_wp_element_namespaceObject.useCallback)((blocks, updateSelection = true, initialPosition = 0, clientIdsToReplace = []) => { if (!Array.isArray(blocks)) { blocks = [blocks]; } const clientIds = getBlockOrder(targetRootClientId); const clientId = clientIds[targetBlockIndex]; if (operation === 'replace') { replaceBlocks(clientId, blocks, undefined, initialPosition); } else if (operation === 'group') { const targetBlock = getBlock(clientId); if (nearestSide === 'left') { blocks.push(targetBlock); } else { blocks.unshift(targetBlock); } const groupInnerBlocks = blocks.map(block => { return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks); }); const areAllImages = blocks.every(block => { return block.name === 'core/image'; }); const galleryBlock = canInsertBlockType('core/gallery', targetRootClientId); const wrappedBlocks = (0,external_wp_blocks_namespaceObject.createBlock)(areAllImages && galleryBlock ? 'core/gallery' : getGroupingBlockName(), { layout: { type: 'flex', flexWrap: areAllImages && galleryBlock ? null : 'nowrap' } }, groupInnerBlocks); // Need to make sure both the target block and the block being dragged are replaced // otherwise the dragged block will be duplicated. replaceBlocks([clientId, ...clientIdsToReplace], wrappedBlocks, undefined, initialPosition); } else { insertBlocks(blocks, targetBlockIndex, targetRootClientId, updateSelection, initialPosition); } }, [getBlockOrder, targetRootClientId, targetBlockIndex, operation, replaceBlocks, getBlock, nearestSide, canInsertBlockType, getGroupingBlockName, insertBlocks]); const moveBlocks = (0,external_wp_element_namespaceObject.useCallback)((sourceClientIds, sourceRootClientId, insertIndex) => { if (operation === 'replace') { const sourceBlocks = getBlocksByClientId(sourceClientIds); const targetBlockClientIds = getBlockOrder(targetRootClientId); const targetBlockClientId = targetBlockClientIds[targetBlockIndex]; registry.batch(() => { // Remove the source blocks. removeBlocks(sourceClientIds, false); // Replace the target block with the source blocks. replaceBlocks(targetBlockClientId, sourceBlocks, undefined, 0); }); } else { moveBlocksToPosition(sourceClientIds, sourceRootClientId, targetRootClientId, insertIndex); } }, [operation, getBlockOrder, getBlocksByClientId, moveBlocksToPosition, registry, removeBlocks, replaceBlocks, targetBlockIndex, targetRootClientId]); const _onDrop = onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocks, insertOrReplaceBlocks, clearSelectedBlock, operation, getBlock); const _onFilesDrop = onFilesDrop(targetRootClientId, getSettings, updateBlockAttributes, canInsertBlockType, insertOrReplaceBlocks); const _onHTMLDrop = onHTMLDrop(insertOrReplaceBlocks); return event => { const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer); const html = event.dataTransfer.getData('text/html'); /** * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML. * The order of the checks is important to recognise the HTML drop. */ if (html) { _onHTMLDrop(html); } else if (files.length) { _onFilesDrop(files); } else { _onDrop(event); } }; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/math.js /** * A string representing the name of an edge. * * @typedef {'top'|'right'|'bottom'|'left'} WPEdgeName */ /** * @typedef {Object} WPPoint * @property {number} x The horizontal position. * @property {number} y The vertical position. */ /** * Given a point, a DOMRect and the name of an edge, returns the distance to * that edge of the rect. * * This function works for edges that are horizontal or vertical (e.g. not * rotated), the following terms are used so that the function works in both * orientations: * * - Forward, meaning the axis running horizontally when an edge is vertical * and vertically when an edge is horizontal. * - Lateral, meaning the axis running vertically when an edge is vertical * and horizontally when an edge is horizontal. * * @param {WPPoint} point The point to measure distance from. * @param {DOMRect} rect A DOM Rect containing edge positions. * @param {WPEdgeName} edge The edge to measure to. */ function getDistanceFromPointToEdge(point, rect, edge) { const isHorizontal = edge === 'top' || edge === 'bottom'; const { x, y } = point; const pointLateralPosition = isHorizontal ? x : y; const pointForwardPosition = isHorizontal ? y : x; const edgeStart = isHorizontal ? rect.left : rect.top; const edgeEnd = isHorizontal ? rect.right : rect.bottom; const edgeForwardPosition = rect[edge]; // Measure the straight line distance to the edge of the rect, when the // point is adjacent to the edge. // Else, if the point is positioned diagonally to the edge of the rect, // measure diagonally to the nearest corner that the edge meets. let edgeLateralPosition; if (pointLateralPosition >= edgeStart && pointLateralPosition <= edgeEnd) { edgeLateralPosition = pointLateralPosition; } else if (pointLateralPosition < edgeEnd) { edgeLateralPosition = edgeStart; } else { edgeLateralPosition = edgeEnd; } return Math.sqrt((pointLateralPosition - edgeLateralPosition) ** 2 + (pointForwardPosition - edgeForwardPosition) ** 2); } /** * Given a point, a DOMRect and a list of allowed edges returns the name of and * distance to the nearest edge. * * @param {WPPoint} point The point to measure distance from. * @param {DOMRect} rect A DOM Rect containing edge positions. * @param {WPEdgeName[]} allowedEdges A list of the edges included in the * calculation. Defaults to all edges. * * @return {[number, string]} An array where the first value is the distance * and a second is the edge name. */ function getDistanceToNearestEdge(point, rect, allowedEdges = ['top', 'bottom', 'left', 'right']) { let candidateDistance; let candidateEdge; allowedEdges.forEach(edge => { const distance = getDistanceFromPointToEdge(point, rect, edge); if (candidateDistance === undefined || distance < candidateDistance) { candidateDistance = distance; candidateEdge = edge; } }); return [candidateDistance, candidateEdge]; } /** * Is the point contained by the rectangle. * * @param {WPPoint} point The point. * @param {DOMRect} rect The rectangle. * * @return {boolean} True if the point is contained by the rectangle, false otherwise. */ function isPointContainedByRect(point, rect) { return rect.left <= point.x && rect.right >= point.x && rect.top <= point.y && rect.bottom >= point.y; } /** * Is the point within the top and bottom boundaries of the rectangle. * * @param {WPPoint} point The point. * @param {DOMRect} rect The rectangle. * * @return {boolean} True if the point is within top and bottom of rectangle, false otherwise. */ function isPointWithinTopAndBottomBoundariesOfRect(point, rect) { return rect.top <= point.y && rect.bottom >= point.y; } ;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-drop-zone/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const THRESHOLD_DISTANCE = 30; const MINIMUM_HEIGHT_FOR_THRESHOLD = 120; const MINIMUM_WIDTH_FOR_THRESHOLD = 120; /** @typedef {import('../../utils/math').WPPoint} WPPoint */ /** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */ /** * The orientation of a block list. * * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation */ /** * The insert position when dropping a block. * * @typedef {'before'|'after'} WPInsertPosition */ /** * @typedef {Object} WPBlockData * @property {boolean} isUnmodifiedDefaultBlock Is the block unmodified default block. * @property {() => DOMRect} getBoundingClientRect Get the bounding client rect of the block. * @property {number} blockIndex The index of the block. */ /** * Get the drop target position from a given drop point and the orientation. * * @param {WPBlockData[]} blocksData The block data list. * @param {WPPoint} position The position of the item being dragged. * @param {WPBlockListOrientation} orientation The orientation of the block list. * @param {Object} options Additional options. * @return {[number, WPDropOperation]} The drop target position. */ function getDropTargetPosition(blocksData, position, orientation = 'vertical', options = {}) { const allowedEdges = orientation === 'horizontal' ? ['left', 'right'] : ['top', 'bottom']; let nearestIndex = 0; let insertPosition = 'before'; let minDistance = Infinity; let targetBlockIndex = null; let nearestSide = 'right'; const { dropZoneElement, parentBlockOrientation, rootBlockIndex = 0 } = options; // Allow before/after when dragging over the top/bottom edges of the drop zone. if (dropZoneElement && parentBlockOrientation !== 'horizontal') { const rect = dropZoneElement.getBoundingClientRect(); const [distance, edge] = getDistanceToNearestEdge(position, rect, ['top', 'bottom']); // If dragging over the top or bottom of the drop zone, insert the block // before or after the parent block. This only applies to blocks that use // a drop zone element, typically container blocks such as Group or Cover. if (rect.height > MINIMUM_HEIGHT_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) { if (edge === 'top') { return [rootBlockIndex, 'before']; } if (edge === 'bottom') { return [rootBlockIndex + 1, 'after']; } } } const isRightToLeft = (0,external_wp_i18n_namespaceObject.isRTL)(); // Allow before/after when dragging over the left/right edges of the drop zone. if (dropZoneElement && parentBlockOrientation === 'horizontal') { const rect = dropZoneElement.getBoundingClientRect(); const [distance, edge] = getDistanceToNearestEdge(position, rect, ['left', 'right']); // If dragging over the left or right of the drop zone, insert the block // before or after the parent block. This only applies to blocks that use // a drop zone element, typically container blocks such as Group. if (rect.width > MINIMUM_WIDTH_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) { if (isRightToLeft && edge === 'right' || !isRightToLeft && edge === 'left') { return [rootBlockIndex, 'before']; } if (isRightToLeft && edge === 'left' || !isRightToLeft && edge === 'right') { return [rootBlockIndex + 1, 'after']; } } } blocksData.forEach(({ isUnmodifiedDefaultBlock, getBoundingClientRect, blockIndex, blockOrientation }) => { const rect = getBoundingClientRect(); let [distance, edge] = getDistanceToNearestEdge(position, rect, allowedEdges); // If the the point is close to a side, prioritize that side. const [sideDistance, sideEdge] = getDistanceToNearestEdge(position, rect, ['left', 'right']); const isPointInsideRect = isPointContainedByRect(position, rect); // Prioritize the element if the point is inside of an unmodified default block. if (isUnmodifiedDefaultBlock && isPointInsideRect) { distance = 0; } else if (orientation === 'vertical' && blockOrientation !== 'horizontal' && (isPointInsideRect && sideDistance < THRESHOLD_DISTANCE || !isPointInsideRect && isPointWithinTopAndBottomBoundariesOfRect(position, rect))) { /** * This condition should only apply when the layout is vertical (otherwise there's * no need to create a Row) and dropzones should only activate when the block is * either within and close to the sides of the target block or on its outer sides. */ targetBlockIndex = blockIndex; nearestSide = sideEdge; } if (distance < minDistance) { // Where the dropped block will be inserted on the nearest block. insertPosition = edge === 'bottom' || !isRightToLeft && edge === 'right' || isRightToLeft && edge === 'left' ? 'after' : 'before'; // Update the currently known best candidate. minDistance = distance; nearestIndex = blockIndex; } }); const adjacentIndex = nearestIndex + (insertPosition === 'after' ? 1 : -1); const isNearestBlockUnmodifiedDefaultBlock = !!blocksData[nearestIndex]?.isUnmodifiedDefaultBlock; const isAdjacentBlockUnmodifiedDefaultBlock = !!blocksData[adjacentIndex]?.isUnmodifiedDefaultBlock; // If the target index is set then group with the block at that index. if (targetBlockIndex !== null) { return [targetBlockIndex, 'group', nearestSide]; } // If both blocks are not unmodified default blocks then just insert between them. if (!isNearestBlockUnmodifiedDefaultBlock && !isAdjacentBlockUnmodifiedDefaultBlock) { // If the user is dropping to the trailing edge of the block // add 1 to the index to represent dragging after. const insertionIndex = insertPosition === 'after' ? nearestIndex + 1 : nearestIndex; return [insertionIndex, 'insert']; } // Otherwise, replace the nearest unmodified default block. return [isNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex, 'replace']; } /** * Check if the dragged blocks can be dropped on the target. * @param {Function} getBlockType * @param {Object[]} allowedBlocks * @param {string[]} draggedBlockNames * @param {string} targetBlockName * @return {boolean} Whether the dragged blocks can be dropped on the target. */ function isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName) { // At root level allowedBlocks is undefined and all blocks are allowed. // Otherwise, check if all dragged blocks are allowed. let areBlocksAllowed = true; if (allowedBlocks) { const allowedBlockNames = allowedBlocks?.map(({ name }) => name); areBlocksAllowed = draggedBlockNames.every(name => allowedBlockNames?.includes(name)); } // Work out if dragged blocks have an allowed parent and if so // check target block matches the allowed parent. const draggedBlockTypes = draggedBlockNames.map(name => getBlockType(name)); const targetMatchesDraggedBlockParents = draggedBlockTypes.every(block => { const [allowedParentName] = block?.parent || []; if (!allowedParentName) { return true; } return allowedParentName === targetBlockName; }); return areBlocksAllowed && targetMatchesDraggedBlockParents; } /** * Checks if the given element is an insertion point. * * @param {EventTarget|null} targetToCheck - The element to check. * @param {Document} ownerDocument - The owner document of the element. * @return {boolean} True if the element is a insertion point, false otherwise. */ function isInsertionPoint(targetToCheck, ownerDocument) { const { defaultView } = ownerDocument; return !!(defaultView && targetToCheck instanceof defaultView.HTMLElement && targetToCheck.closest('[data-is-insertion-point]')); } /** * @typedef {Object} WPBlockDropZoneConfig * @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone. * @property {string} rootClientId The root client id for the block list. */ /** * A React hook that can be used to make a block list handle drag and drop. * * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone. */ function useBlockDropZone({ dropZoneElement, // An undefined value represents a top-level block. Default to an empty // string for this so that `targetRootClientId` can be easily compared to // values returned by the `getRootBlockClientId` selector, which also uses // an empty string to represent top-level blocks. rootClientId: targetRootClientId = '', parentClientId: parentBlockClientId = '', isDisabled = false } = {}) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [dropTarget, setDropTarget] = (0,external_wp_element_namespaceObject.useState)({ index: null, operation: 'insert' }); const { getBlockType, getBlockVariations, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const { canInsertBlockType, getBlockListSettings, getBlocks, getBlockIndex, getDraggedBlockClientIds, getBlockNamesByClientId, getAllowedBlocks, isDragging, isGroupable, isZoomOut, getSectionRootClientId, getBlockParents } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { showInsertionPoint, hideInsertionPoint, startDragging, stopDragging } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const onBlockDrop = useOnBlockDrop(dropTarget.operation === 'before' || dropTarget.operation === 'after' ? parentBlockClientId : targetRootClientId, dropTarget.index, { operation: dropTarget.operation, nearestSide: dropTarget.nearestSide }); const throttled = (0,external_wp_compose_namespaceObject.useThrottle)((0,external_wp_element_namespaceObject.useCallback)((event, ownerDocument) => { if (!isDragging()) { // When dragging from the desktop, no drag start event is fired. // So, ensure that the drag state is set when the user drags over a drop zone. startDragging(); } const draggedBlockClientIds = getDraggedBlockClientIds(); const targetParents = [targetRootClientId, ...getBlockParents(targetRootClientId, true)]; // Check if the target is within any of the dragged blocks. const isTargetWithinDraggedBlocks = draggedBlockClientIds.some(clientId => targetParents.includes(clientId)); if (isTargetWithinDraggedBlocks) { return; } const allowedBlocks = getAllowedBlocks(targetRootClientId); const targetBlockName = getBlockNamesByClientId([targetRootClientId])[0]; const draggedBlockNames = getBlockNamesByClientId(draggedBlockClientIds); const isBlockDroppingAllowed = isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName); if (!isBlockDroppingAllowed) { return; } const sectionRootClientId = getSectionRootClientId(); // In Zoom Out mode, if the target is not the section root provided by settings then // do not allow dropping as the drop target is not within the root (that which is // treated as "the content" by Zoom Out Mode). if (isZoomOut() && sectionRootClientId !== targetRootClientId) { return; } const blocks = getBlocks(targetRootClientId); // The block list is empty, don't show the insertion point but still allow dropping. if (blocks.length === 0) { registry.batch(() => { setDropTarget({ index: 0, operation: 'insert' }); showInsertionPoint(targetRootClientId, 0, { operation: 'insert' }); }); return; } const blocksData = blocks.map(block => { const clientId = block.clientId; return { isUnmodifiedDefaultBlock: (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block), getBoundingClientRect: () => ownerDocument.getElementById(`block-${clientId}`).getBoundingClientRect(), blockIndex: getBlockIndex(clientId), blockOrientation: getBlockListSettings(clientId)?.orientation }; }); const dropTargetPosition = getDropTargetPosition(blocksData, { x: event.clientX, y: event.clientY }, getBlockListSettings(targetRootClientId)?.orientation, { dropZoneElement, parentBlockClientId, parentBlockOrientation: parentBlockClientId ? getBlockListSettings(parentBlockClientId)?.orientation : undefined, rootBlockIndex: getBlockIndex(targetRootClientId) }); const [targetIndex, operation, nearestSide] = dropTargetPosition; const isTargetIndexEmptyDefaultBlock = blocksData[targetIndex]?.isUnmodifiedDefaultBlock; if (isZoomOut() && !isTargetIndexEmptyDefaultBlock && operation !== 'insert') { return; } if (operation === 'group') { const targetBlock = blocks[targetIndex]; const areAllImages = [targetBlock.name, ...draggedBlockNames].every(name => name === 'core/image'); const canInsertGalleryBlock = canInsertBlockType('core/gallery', targetRootClientId); const areGroupableBlocks = isGroupable([targetBlock.clientId, getDraggedBlockClientIds()]); const groupBlockVariations = getBlockVariations(getGroupingBlockName(), 'block'); const canInsertRow = groupBlockVariations && groupBlockVariations.find(({ name }) => name === 'group-row'); // If the dragged blocks and the target block are all images, // check if it is creatable either a Row variation or a Gallery block. if (areAllImages && !canInsertGalleryBlock && (!areGroupableBlocks || !canInsertRow)) { return; } // If the dragged blocks and the target block are not all images, // check if it is creatable a Row variation. if (!areAllImages && (!areGroupableBlocks || !canInsertRow)) { return; } } registry.batch(() => { setDropTarget({ index: targetIndex, operation, nearestSide }); const insertionPointClientId = ['before', 'after'].includes(operation) ? parentBlockClientId : targetRootClientId; showInsertionPoint(insertionPointClientId, targetIndex, { operation, nearestSide }); }); }, [isDragging, getAllowedBlocks, targetRootClientId, getBlockNamesByClientId, getDraggedBlockClientIds, getBlockType, getSectionRootClientId, isZoomOut, getBlocks, getBlockListSettings, dropZoneElement, parentBlockClientId, getBlockIndex, registry, startDragging, showInsertionPoint, canInsertBlockType, isGroupable, getBlockVariations, getGroupingBlockName]), 200); return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ dropZoneElement, isDisabled, onDrop: onBlockDrop, onDragOver(event) { // `currentTarget` is only available while the event is being // handled, so get it now and pass it to the thottled function. // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget throttled(event, event.currentTarget.ownerDocument); }, onDragLeave(event) { const { ownerDocument } = event.currentTarget; // If the drag event is leaving the drop zone and entering an insertion point, // do not hide the insertion point as it is conceptually within the dropzone. if (isInsertionPoint(event.relatedTarget, ownerDocument) || isInsertionPoint(event.target, ownerDocument)) { return; } throttled.cancel(); hideInsertionPoint(); }, onDragEnd() { throttled.cancel(); stopDragging(); hideInsertionPoint(); } }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const EMPTY_OBJECT = {}; function BlockContext({ children, clientId }) { const context = useBlockContext(clientId); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContextProvider, { value: context, children: children }); } const BlockListItemsMemo = (0,external_wp_element_namespaceObject.memo)(BlockListItems); /** * InnerBlocks is a component which allows a single block to have multiple blocks * as children. The UncontrolledInnerBlocks component is used whenever the inner * blocks are not controlled by another entity. In other words, it is normally * used for inner blocks in the post editor * * @param {Object} props The component props. */ function UncontrolledInnerBlocks(props) { const { clientId, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, template, templateLock, wrapperRef, templateInsertUpdatesSelection, __experimentalCaptureToolbars: captureToolbars, __experimentalAppenderTagName, renderAppender, orientation, placeholder, layout, name, blockType, parentLock, defaultLayout } = props; useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout); useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection); const defaultLayoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, 'layout') || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, '__experimentalLayout') || EMPTY_OBJECT; const { allowSizingOnChildren = false } = defaultLayoutBlockSupport; const usedLayout = layout || defaultLayoutBlockSupport; const memoedLayout = (0,external_wp_element_namespaceObject.useMemo)(() => ({ // Default layout will know about any content/wide size defined by the theme. ...defaultLayout, ...usedLayout, ...(allowSizingOnChildren && { allowSizingOnChildren: true }) }), [defaultLayout, usedLayout, allowSizingOnChildren]); // For controlled inner blocks, we don't want a change in blocks to // re-render the blocks list. const items = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItemsMemo, { rootClientId: clientId, renderAppender: renderAppender, __experimentalAppenderTagName: __experimentalAppenderTagName, layout: memoedLayout, wrapperRef: wrapperRef, placeholder: placeholder }); if (!blockType?.providesContext || Object.keys(blockType.providesContext).length === 0) { return items; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContext, { clientId: clientId, children: items }); } /** * The controlled inner blocks component wraps the uncontrolled inner blocks * component with the blockSync hook. This keeps the innerBlocks of the block in * the block-editor store in sync with the blocks of the controlling entity. An * example of an inner block controller is a template part block, which provides * its own blocks from the template part entity data source. * * @param {Object} props The component props. */ function ControlledInnerBlocks(props) { useBlockSync(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UncontrolledInnerBlocks, { ...props }); } const ForwardedInnerBlocks = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { const innerBlocksProps = useInnerBlocksProps({ ref }, props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inner-blocks", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }) }); }); /** * This hook is used to lightly mark an element as an inner blocks wrapper * element. Call this hook and pass the returned props to the element to mark as * an inner blocks wrapper, automatically rendering inner blocks as children. If * you define a ref for the element, it is important to pass the ref to this * hook, which the hook in turn will pass to the component through the props it * returns. Optionally, you can also pass any other props through this hook, and * they will be merged and returned. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md * * @param {Object} props Optional. Props to pass to the element. Must contain * the ref if one is defined. * @param {Object} options Optional. Inner blocks options. */ function useInnerBlocksProps(props = {}, options = {}) { const { __unstableDisableLayoutClassNames, __unstableDisableDropZone, dropZoneElement } = options; const { clientId, layout = null, __unstableLayoutClassNames: layoutClassNames = '' } = useBlockEditContext(); const selected = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockName, isZoomOut, getTemplateLock, getBlockRootClientId, getBlockEditingMode, getBlockSettings, getSectionRootClientId } = unlock(select(store)); if (!clientId) { const sectionRootClientId = getSectionRootClientId(); // Disable the root drop zone when zoomed out and the section root client id // is not the root block list (represented by an empty string). // This avoids drag handling bugs caused by having two block lists acting as // drop zones - the actual 'root' block list and the section root. return { isDropZoneDisabled: isZoomOut() && sectionRootClientId !== '' }; } const { hasBlockSupport, getBlockType } = select(external_wp_blocks_namespaceObject.store); const blockName = getBlockName(clientId); const blockEditingMode = getBlockEditingMode(clientId); const parentClientId = getBlockRootClientId(clientId); const [defaultLayout] = getBlockSettings(clientId, 'layout'); let _isDropZoneDisabled = blockEditingMode === 'disabled'; if (isZoomOut()) { // In zoom out mode, we want to disable the drop zone for the sections. // The inner blocks belonging to the section drop zone is // already disabled by the blocks themselves being disabled. const sectionRootClientId = getSectionRootClientId(); _isDropZoneDisabled = clientId !== sectionRootClientId; } return { __experimentalCaptureToolbars: hasBlockSupport(blockName, '__experimentalExposeControlsToChildren', false), name: blockName, blockType: getBlockType(blockName), parentLock: getTemplateLock(parentClientId), parentClientId, isDropZoneDisabled: _isDropZoneDisabled, defaultLayout }; }, [clientId]); const { __experimentalCaptureToolbars, name, blockType, parentLock, parentClientId, isDropZoneDisabled, defaultLayout } = selected; const blockDropZoneRef = useBlockDropZone({ dropZoneElement, rootClientId: clientId, parentClientId }); const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, __unstableDisableDropZone || isDropZoneDisabled || layout?.isManualPlacement && window.__experimentalEnableGridInteractivity ? null : blockDropZoneRef]); const innerBlocksProps = { __experimentalCaptureToolbars, layout, name, blockType, parentLock, defaultLayout, ...options }; const InnerBlocks = innerBlocksProps.value && innerBlocksProps.onChange ? ControlledInnerBlocks : UncontrolledInnerBlocks; return { ...props, ref, className: dist_clsx(props.className, 'block-editor-block-list__layout', __unstableDisableLayoutClassNames ? '' : layoutClassNames), children: clientId ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InnerBlocks, { ...innerBlocksProps, clientId: clientId }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { ...options }) }; } useInnerBlocksProps.save = external_wp_blocks_namespaceObject.__unstableGetInnerBlocksProps; // Expose default appender placeholders as components. ForwardedInnerBlocks.DefaultBlockAppender = default_block_appender_DefaultBlockAppender; ForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender; ForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md */ /* harmony default export */ const inner_blocks = (ForwardedInnerBlocks); ;// ./node_modules/@wordpress/block-editor/build-module/components/observe-typing/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Set of key codes upon which typing is to be initiated on a keydown event. * * @type {Set<number>} */ const KEY_DOWN_ELIGIBLE_KEY_CODES = new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.RIGHT, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.ENTER, external_wp_keycodes_namespaceObject.BACKSPACE]); /** * Returns true if a given keydown event can be inferred as intent to start * typing, or false otherwise. A keydown is considered eligible if it is a * text navigation without shift active. * * @param {KeyboardEvent} event Keydown event to test. * * @return {boolean} Whether event is eligible to start typing. */ function isKeyDownEligibleForStartTyping(event) { const { keyCode, shiftKey } = event; return !shiftKey && KEY_DOWN_ELIGIBLE_KEY_CODES.has(keyCode); } /** * Removes the `isTyping` flag when the mouse moves in the document of the given * element. */ function useMouseMoveTypingReset() { const isTyping = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isTyping(), []); const { stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!isTyping) { return; } const { ownerDocument } = node; let lastClientX; let lastClientY; /** * On mouse move, unset typing flag if user has moved cursor. * * @param {MouseEvent} event Mousemove event. */ function stopTypingOnMouseMove(event) { const { clientX, clientY } = event; // We need to check that the mouse really moved because Safari // triggers mousemove events when shift or ctrl are pressed. if (lastClientX && lastClientY && (lastClientX !== clientX || lastClientY !== clientY)) { stopTyping(); } lastClientX = clientX; lastClientY = clientY; } ownerDocument.addEventListener('mousemove', stopTypingOnMouseMove); return () => { ownerDocument.removeEventListener('mousemove', stopTypingOnMouseMove); }; }, [isTyping, stopTyping]); } /** * Sets and removes the `isTyping` flag based on user actions: * * - Sets the flag if the user types within the given element. * - Removes the flag when the user selects some text, focuses a non-text * field, presses ESC or TAB, or moves the mouse in the document. */ function useTypingObserver() { const { isTyping } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isTyping: _isTyping } = select(store); return { isTyping: _isTyping() }; }, []); const { startTyping, stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); const ref1 = useMouseMoveTypingReset(); const ref2 = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { const { ownerDocument } = node; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); // Listeners to stop typing should only be added when typing. // Listeners to start typing should only be added when not typing. if (isTyping) { let timerId; /** * Stops typing when focus transitions to a non-text field element. * * @param {FocusEvent} event Focus event. */ function stopTypingOnNonTextField(event) { const { target } = event; // Since focus to a non-text field via arrow key will trigger // before the keydown event, wait until after current stack // before evaluating whether typing is to be stopped. Otherwise, // typing will re-start. timerId = defaultView.setTimeout(() => { if (!(0,external_wp_dom_namespaceObject.isTextField)(target)) { stopTyping(); } }); } /** * Unsets typing flag if user presses Escape while typing flag is * active. * * @param {KeyboardEvent} event Keypress or keydown event to * interpret. */ function stopTypingOnEscapeKey(event) { const { keyCode } = event; if (keyCode === external_wp_keycodes_namespaceObject.ESCAPE || keyCode === external_wp_keycodes_namespaceObject.TAB) { stopTyping(); } } /** * On selection change, unset typing flag if user has made an * uncollapsed (shift) selection. */ function stopTypingOnSelectionUncollapse() { if (!selection.isCollapsed) { stopTyping(); } } node.addEventListener('focus', stopTypingOnNonTextField); node.addEventListener('keydown', stopTypingOnEscapeKey); ownerDocument.addEventListener('selectionchange', stopTypingOnSelectionUncollapse); return () => { defaultView.clearTimeout(timerId); node.removeEventListener('focus', stopTypingOnNonTextField); node.removeEventListener('keydown', stopTypingOnEscapeKey); ownerDocument.removeEventListener('selectionchange', stopTypingOnSelectionUncollapse); }; } /** * Handles a keypress or keydown event to infer intention to start * typing. * * @param {KeyboardEvent} event Keypress or keydown event to interpret. */ function startTypingInTextField(event) { const { type, target } = event; // Abort early if already typing, or key press is incurred outside a // text field (e.g. arrow-ing through toolbar buttons). // Ignore typing if outside the current DOM container if (!(0,external_wp_dom_namespaceObject.isTextField)(target) || !node.contains(target)) { return; } // Special-case keydown because certain keys do not emit a keypress // event. Conversely avoid keydown as the canonical event since // there are many keydown which are explicitly not targeted for // typing. if (type === 'keydown' && !isKeyDownEligibleForStartTyping(event)) { return; } startTyping(); } node.addEventListener('keypress', startTypingInTextField); node.addEventListener('keydown', startTypingInTextField); return () => { node.removeEventListener('keypress', startTypingInTextField); node.removeEventListener('keydown', startTypingInTextField); }; }, [isTyping, startTyping, stopTyping]); return (0,external_wp_compose_namespaceObject.useMergeRefs)([ref1, ref2]); } function ObserveTyping({ children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useTypingObserver(), children: children }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/observe-typing/README.md */ /* harmony default export */ const observe_typing = (ObserveTyping); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/zoom-out-separator.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ZoomOutSeparator({ clientId, rootClientId = '', position = 'top' }) { const [isDraggedOver, setIsDraggedOver] = (0,external_wp_element_namespaceObject.useState)(false); const { sectionRootClientId, sectionClientIds, insertionPoint, blockInsertionPointVisible, blockInsertionPoint, blocksBeingDragged } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getInsertionPoint, getBlockOrder, getSectionRootClientId, isBlockInsertionPointVisible, getBlockInsertionPoint, getDraggedBlockClientIds } = unlock(select(store)); const root = getSectionRootClientId(); const sectionRootClientIds = getBlockOrder(root); return { sectionRootClientId: root, sectionClientIds: sectionRootClientIds, blockOrder: getBlockOrder(root), insertionPoint: getInsertionPoint(), blockInsertionPoint: getBlockInsertionPoint(), blockInsertionPointVisible: isBlockInsertionPointVisible(), blocksBeingDragged: getDraggedBlockClientIds() }; }, []); const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); if (!clientId) { return; } let isVisible = false; const isSectionBlock = rootClientId === sectionRootClientId && sectionClientIds && sectionClientIds.includes(clientId); if (!isSectionBlock) { return null; } const hasTopInsertionPoint = insertionPoint?.index === 0 && clientId === sectionClientIds[insertionPoint.index]; const hasBottomInsertionPoint = insertionPoint && insertionPoint.hasOwnProperty('index') && clientId === sectionClientIds[insertionPoint.index - 1]; // We want to show the zoom out separator in either of these conditions: // 1. If the inserter has an insertion index set // 2. We are dragging a pattern over an insertion point if (position === 'top') { isVisible = hasTopInsertionPoint || blockInsertionPointVisible && blockInsertionPoint.index === 0 && clientId === sectionClientIds[blockInsertionPoint.index]; } if (position === 'bottom') { isVisible = hasBottomInsertionPoint || blockInsertionPointVisible && clientId === sectionClientIds[blockInsertionPoint.index - 1]; } const blockBeingDraggedClientId = blocksBeingDragged[0]; const isCurrentBlockBeingDragged = blocksBeingDragged.includes(clientId); const blockBeingDraggedIndex = sectionClientIds.indexOf(blockBeingDraggedClientId); const blockBeingDraggedPreviousSiblingClientId = blockBeingDraggedIndex > 0 ? sectionClientIds[blockBeingDraggedIndex - 1] : null; const isCurrentBlockPreviousSiblingOfBlockBeingDragged = blockBeingDraggedPreviousSiblingClientId === clientId; // The separators are visually top/bottom of the block, but in actual fact // the "top" separator is the "bottom" separator of the previous block. // Therefore, this logic hides the separator if the current block is being dragged // or if the current block is the previous sibling of the block being dragged. if (isCurrentBlockBeingDragged || isCurrentBlockPreviousSiblingOfBlockBeingDragged) { isVisible = false; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { initial: { height: 0 }, animate: { // Use a height equal to that of the zoom out frame size. height: 'calc(1 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)' }, exit: { height: 0 }, transition: { type: 'tween', duration: isReducedMotion ? 0 : 0.2, ease: [0.6, 0, 0.4, 1] }, className: dist_clsx('block-editor-block-list__zoom-out-separator', { 'is-dragged-over': isDraggedOver }), "data-is-insertion-point": "true", onDragOver: () => setIsDraggedOver(true), onDragLeave: () => setIsDraggedOver(false), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0, transition: { delay: -0.125 } }, transition: { ease: 'linear', duration: 0.1, delay: 0.125 }, children: (0,external_wp_i18n_namespaceObject.__)('Drop pattern.') }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const block_list_IntersectionObserver = (0,external_wp_element_namespaceObject.createContext)(); const pendingBlockVisibilityUpdatesPerRegistry = new WeakMap(); function Root({ className, ...settings }) { const { isOutlineMode, isFocusMode, temporarilyEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings, getTemporarilyEditingAsBlocks, isTyping } = unlock(select(store)); const { outlineMode, focusMode } = getSettings(); return { isOutlineMode: outlineMode && !isTyping(), isFocusMode: focusMode, temporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks() }; }, []); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { setBlockVisibility } = (0,external_wp_data_namespaceObject.useDispatch)(store); const delayedBlockVisibilityUpdates = (0,external_wp_compose_namespaceObject.useDebounce)((0,external_wp_element_namespaceObject.useCallback)(() => { const updates = {}; pendingBlockVisibilityUpdatesPerRegistry.get(registry).forEach(([id, isIntersecting]) => { updates[id] = isIntersecting; }); setBlockVisibility(updates); }, [registry]), 300, { trailing: true }); const intersectionObserver = (0,external_wp_element_namespaceObject.useMemo)(() => { const { IntersectionObserver: Observer } = window; if (!Observer) { return; } return new Observer(entries => { if (!pendingBlockVisibilityUpdatesPerRegistry.get(registry)) { pendingBlockVisibilityUpdatesPerRegistry.set(registry, []); } for (const entry of entries) { const clientId = entry.target.getAttribute('data-block'); pendingBlockVisibilityUpdatesPerRegistry.get(registry).push([clientId, entry.isIntersecting]); } delayedBlockVisibilityUpdates(); }); }, []); const innerBlocksProps = useInnerBlocksProps({ ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([useBlockSelectionClearer(), useInBetweenInserter(), useTypingObserver()]), className: dist_clsx('is-root-container', className, { 'is-outline-mode': isOutlineMode, 'is-focus-mode': isFocusMode }) }, settings); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_list_IntersectionObserver.Provider, { value: intersectionObserver, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }), !!temporarilyEditingAsBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StopEditingAsBlocksOnOutsideSelect, { clientId: temporarilyEditingAsBlocks })] }); } function StopEditingAsBlocksOnOutsideSelect({ clientId }) { const { stopEditingAsBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const isBlockOrDescendantSelected = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isBlockSelected, hasSelectedInnerBlock } = select(store); return isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, true); }, [clientId]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isBlockOrDescendantSelected) { stopEditingAsBlocks(clientId); } }, [isBlockOrDescendantSelected, clientId, stopEditingAsBlocks]); return null; } function BlockList(settings) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { value: DEFAULT_BLOCK_EDIT_CONTEXT, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Root, { ...settings }) }); } const block_list_EMPTY_ARRAY = []; const block_list_EMPTY_SET = new Set(); function Items({ placeholder, rootClientId, renderAppender: CustomAppender, __experimentalAppenderTagName, layout = defaultLayout }) { // Avoid passing CustomAppender to useSelect because it could be a new // function on every render. const hasAppender = CustomAppender !== false; const hasCustomAppender = !!CustomAppender; const { order, isZoomOut, selectedBlocks, visibleBlocks, shouldRenderAppender } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings, getBlockOrder, getSelectedBlockClientIds, __unstableGetVisibleBlocks, getTemplateLock, getBlockEditingMode, isSectionBlock, isZoomOut: _isZoomOut, canInsertBlockType } = unlock(select(store)); const _order = getBlockOrder(rootClientId); if (getSettings().isPreviewMode) { return { order: _order, selectedBlocks: block_list_EMPTY_ARRAY, visibleBlocks: block_list_EMPTY_SET }; } const selectedBlockClientIds = getSelectedBlockClientIds(); const selectedBlockClientId = selectedBlockClientIds[0]; const showRootAppender = !rootClientId && !selectedBlockClientId && (!_order.length || !canInsertBlockType((0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), rootClientId)); const hasSelectedRoot = !!(rootClientId && selectedBlockClientId && rootClientId === selectedBlockClientId); return { order: _order, selectedBlocks: selectedBlockClientIds, visibleBlocks: __unstableGetVisibleBlocks(), isZoomOut: _isZoomOut(), shouldRenderAppender: !isSectionBlock(rootClientId) && getBlockEditingMode(rootClientId) !== 'disabled' && !getTemplateLock(rootClientId) && hasAppender && !_isZoomOut() && (hasCustomAppender || hasSelectedRoot || showRootAppender) }; }, [rootClientId, hasAppender, hasCustomAppender]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(LayoutProvider, { value: layout, children: [order.map(clientId => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { value: // Only provide data asynchronously if the block is // not visible and not selected. !visibleBlocks.has(clientId) && !selectedBlocks.includes(clientId), children: [isZoomOut && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ZoomOutSeparator, { clientId: clientId, rootClientId: rootClientId, position: "top" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block, { rootClientId: rootClientId, clientId: clientId }), isZoomOut && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ZoomOutSeparator, { clientId: clientId, rootClientId: rootClientId, position: "bottom" })] }, clientId)), order.length < 1 && placeholder, shouldRenderAppender && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListAppender, { tagName: __experimentalAppenderTagName, rootClientId: rootClientId, CustomAppender: CustomAppender })] }); } function BlockListItems(props) { // This component needs to always be synchronous as it's the one changing // the async mode depending on the block selection. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.AsyncModeProvider, { value: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Items, { ...props }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-multi-selection.js /** * WordPress dependencies */ /** * Internal dependencies */ function selector(select) { const { isMultiSelecting, getMultiSelectedBlockClientIds, hasMultiSelection, getSelectedBlockClientId, getSelectedBlocksInitialCaretPosition, __unstableIsFullySelected } = select(store); return { isMultiSelecting: isMultiSelecting(), multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(), hasMultiSelection: hasMultiSelection(), selectedBlockClientId: getSelectedBlockClientId(), initialPosition: getSelectedBlocksInitialCaretPosition(), isFullSelection: __unstableIsFullySelected() }; } function useMultiSelection() { const { initialPosition, isMultiSelecting, multiSelectedBlockClientIds, hasMultiSelection, selectedBlockClientId, isFullSelection } = (0,external_wp_data_namespaceObject.useSelect)(selector, []); /** * When the component updates, and there is multi selection, we need to * select the entire block contents. */ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { const { ownerDocument } = node; const { defaultView } = ownerDocument; // Allow initialPosition to bypass focus behavior. This is useful // for the list view or other areas where we don't want to transfer // focus to the editor canvas. if (initialPosition === undefined || initialPosition === null) { return; } if (!hasMultiSelection || isMultiSelecting) { return; } const { length } = multiSelectedBlockClientIds; if (length < 2) { return; } if (!isFullSelection) { return; } // Allow cross contentEditable selection by temporarily making // all content editable. We can't rely on using the store and // React because re-rending happens too slowly. We need to be // able to select across instances immediately. node.contentEditable = true; // For some browsers, like Safari, it is important that focus // happens BEFORE selection removal. node.focus(); defaultView.getSelection().removeAllRanges(); }, [hasMultiSelection, isMultiSelecting, multiSelectedBlockClientIds, selectedBlockClientId, initialPosition, isFullSelection]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-tab-nav.js /** * WordPress dependencies */ /** * Internal dependencies */ function useTabNav() { const containerRef = /** @type {typeof useRef<HTMLElement>} */(0,external_wp_element_namespaceObject.useRef)(); const focusCaptureBeforeRef = (0,external_wp_element_namespaceObject.useRef)(); const focusCaptureAfterRef = (0,external_wp_element_namespaceObject.useRef)(); const { hasMultiSelection, getSelectedBlockClientId, getBlockCount, getBlockOrder, getLastFocus, getSectionRootClientId, isZoomOut } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { setLastFocus } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); // Reference that holds the a flag for enabling or disabling // capturing on the focus capture elements. const noCaptureRef = (0,external_wp_element_namespaceObject.useRef)(); function onFocusCapture(event) { const canvasElement = containerRef.current.ownerDocument === event.target.ownerDocument ? containerRef.current : containerRef.current.ownerDocument.defaultView.frameElement; // Do not capture incoming focus if set by us in WritingFlow. if (noCaptureRef.current) { noCaptureRef.current = null; } else if (hasMultiSelection()) { containerRef.current.focus(); } else if (getSelectedBlockClientId()) { if (getLastFocus()?.current) { getLastFocus().current.focus(); } else { // Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter. containerRef.current.querySelector(`[data-block="${getSelectedBlockClientId()}"]`).focus(); } } // In "compose" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas. else if (isZoomOut()) { const sectionRootClientId = getSectionRootClientId(); const sectionBlocks = getBlockOrder(sectionRootClientId); // If we have section within the section root, focus the first one. if (sectionBlocks.length) { containerRef.current.querySelector(`[data-block="${sectionBlocks[0]}"]`).focus(); } // If we don't have any section blocks, focus the section root. else if (sectionRootClientId) { containerRef.current.querySelector(`[data-block="${sectionRootClientId}"]`).focus(); } else { // If we don't have any section root, focus the canvas. canvasElement.focus(); } } else { const isBefore = // eslint-disable-next-line no-bitwise event.target.compareDocumentPosition(canvasElement) & event.target.DOCUMENT_POSITION_FOLLOWING; const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(containerRef.current); if (tabbables.length) { const next = isBefore ? tabbables[0] : tabbables[tabbables.length - 1]; next.focus(); } } } const before = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: focusCaptureBeforeRef, tabIndex: "0", onFocus: onFocusCapture }); const after = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: focusCaptureAfterRef, tabIndex: "0", onFocus: onFocusCapture }); const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onKeyDown(event) { if (event.defaultPrevented) { return; } // In Edit mode, Tab should focus the first tabbable element after // the content, which is normally the sidebar (with block controls) // and Shift+Tab should focus the first tabbable element before the // content, which is normally the block toolbar. // Arrow keys can be used, and Tab and arrow keys can be used in // Navigation mode (press Esc), to navigate through blocks. if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) { return; } if ( // Bails in case the focus capture elements aren’t present. They // may be omitted to avoid silent tab stops in preview mode. // See: https://github.com/WordPress/gutenberg/pull/59317 !focusCaptureAfterRef.current || !focusCaptureBeforeRef.current) { return; } const { target, shiftKey: isShift } = event; const direction = isShift ? 'findPrevious' : 'findNext'; const nextTabbable = external_wp_dom_namespaceObject.focus.tabbable[direction](target); // We want to constrain the tabbing to the block and its child blocks. // If the preceding form element is within a different block, // such as two sibling image blocks in the placeholder state, // we want shift + tab from the first form element to move to the image // block toolbar and not the previous image block's form element. const currentBlock = target.closest('[data-block]'); const isElementPartOfSelectedBlock = currentBlock && nextTabbable && (isInSameBlock(currentBlock, nextTabbable) || isInsideRootBlock(currentBlock, nextTabbable)); // Allow tabbing from the block wrapper to a form element, // and between form elements rendered in a block and its child blocks, // such as inside a placeholder. Form elements are generally // meant to be UI rather than part of the content. Ideally // these are not rendered in the content and perhaps in the // future they can be rendered in an iframe or shadow DOM. if ((0,external_wp_dom_namespaceObject.isFormElement)(nextTabbable) && isElementPartOfSelectedBlock) { return; } const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef; // Disable focus capturing on the focus capture element, so it // doesn't refocus this block and so it allows default behaviour // (moving focus to the next tabbable element). noCaptureRef.current = true; // Focusing the focus capture element, which is located above and // below the editor, should not scroll the page all the way up or // down. next.current.focus({ preventScroll: true }); } function onFocusOut(event) { setLastFocus({ ...getLastFocus(), current: event.target }); const { ownerDocument } = node; // If focus disappears due to there being no blocks, move focus to // the writing flow wrapper. if (!event.relatedTarget && event.target.hasAttribute('data-block') && ownerDocument.activeElement === ownerDocument.body && getBlockCount() === 0) { node.focus(); } } // When tabbing back to an element in block list, this event handler prevents scrolling if the // focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph // when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the // top or bottom of the document. // // Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this // earlier in the keypress handler, and call focus( { preventScroll: true } ) instead. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters function preventScrollOnTab(event) { if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) { return; } if (event.target?.getAttribute('role') === 'region') { return; } if (containerRef.current === event.target) { return; } const isShift = event.shiftKey; const direction = isShift ? 'findPrevious' : 'findNext'; const target = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target); // Only do something when the next tabbable is a focus capture div (before/after) if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) { event.preventDefault(); target.focus({ preventScroll: true }); } } const { ownerDocument } = node; const { defaultView } = ownerDocument; defaultView.addEventListener('keydown', preventScrollOnTab); node.addEventListener('keydown', onKeyDown); node.addEventListener('focusout', onFocusOut); return () => { defaultView.removeEventListener('keydown', preventScrollOnTab); node.removeEventListener('keydown', onKeyDown); node.removeEventListener('focusout', onFocusOut); }; }, []); const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, ref]); return [before, mergedRefs, after]; } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-arrow-nav.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns true if the element should consider edge navigation upon a keyboard * event of the given directional key code, or false otherwise. * * @param {Element} element HTML element to test. * @param {number} keyCode KeyboardEvent keyCode to test. * @param {boolean} hasModifier Whether a modifier is pressed. * * @return {boolean} Whether element should consider edge navigation. */ function isNavigationCandidate(element, keyCode, hasModifier) { const isVertical = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.DOWN; const { tagName } = element; const elementType = element.getAttribute('type'); // Native inputs should not navigate vertically, unless they are simple types that don't need up/down arrow keys. if (isVertical && !hasModifier) { if (tagName === 'INPUT') { const verticalInputTypes = ['date', 'datetime-local', 'month', 'number', 'range', 'time', 'week']; return !verticalInputTypes.includes(elementType); } return true; } // Native inputs should not navigate horizontally, unless they are simple types that don't need left/right arrow keys. if (tagName === 'INPUT') { const simpleInputTypes = ['button', 'checkbox', 'number', 'color', 'file', 'image', 'radio', 'reset', 'submit']; return simpleInputTypes.includes(elementType); } // Native textareas should not navigate horizontally. return tagName !== 'TEXTAREA'; } /** * Returns the optimal tab target from the given focused element in the desired * direction. A preference is made toward text fields, falling back to the block * focus stop if no other candidates exist for the block. * * @param {Element} target Currently focused text field. * @param {boolean} isReverse True if considering as the first field. * @param {Element} containerElement Element containing all blocks. * @param {boolean} onlyVertical Whether to only consider tabbable elements * that are visually above or under the * target. * * @return {?Element} Optimal tab target, if one exists. */ function getClosestTabbable(target, isReverse, containerElement, onlyVertical) { // Since the current focus target is not guaranteed to be a text field, find // all focusables. Tabbability is considered later. let focusableNodes = external_wp_dom_namespaceObject.focus.focusable.find(containerElement); if (isReverse) { focusableNodes.reverse(); } // Consider as candidates those focusables after the current target. It's // assumed this can only be reached if the target is focusable (on its // keydown event), so no need to verify it exists in the set. focusableNodes = focusableNodes.slice(focusableNodes.indexOf(target) + 1); let targetRect; if (onlyVertical) { targetRect = target.getBoundingClientRect(); } function isTabCandidate(node) { if (node.closest('[inert]')) { return; } // Skip if there's only one child that is content editable (and thus a // better candidate). if (node.children.length === 1 && isInSameBlock(node, node.firstElementChild) && node.firstElementChild.getAttribute('contenteditable') === 'true') { return; } // Not a candidate if the node is not tabbable. if (!external_wp_dom_namespaceObject.focus.tabbable.isTabbableIndex(node)) { return false; } // Skip focusable elements such as links within content editable nodes. if (node.isContentEditable && node.contentEditable !== 'true') { return false; } if (onlyVertical) { const nodeRect = node.getBoundingClientRect(); if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) { return false; } } return true; } return focusableNodes.find(isTabCandidate); } function useArrowNav() { const { getMultiSelectedBlocksStartClientId, getMultiSelectedBlocksEndClientId, getSettings, hasMultiSelection, __unstableIsFullySelected } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { // Here a DOMRect is stored while moving the caret vertically so // vertical position of the start position can be restored. This is to // recreate browser behaviour across blocks. let verticalRect; function onMouseDown() { verticalRect = null; } function isClosestTabbableABlock(target, isReverse) { const closestTabbable = getClosestTabbable(target, isReverse, node); return closestTabbable && getBlockClientId(closestTabbable); } function onKeyDown(event) { // Abort if navigation has already been handled (e.g. RichText // inline boundaries). if (event.defaultPrevented) { return; } const { keyCode, target, shiftKey, ctrlKey, altKey, metaKey } = event; const isUp = keyCode === external_wp_keycodes_namespaceObject.UP; const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN; const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT; const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT; const isReverse = isUp || isLeft; const isHorizontal = isLeft || isRight; const isVertical = isUp || isDown; const isNav = isHorizontal || isVertical; const hasModifier = shiftKey || ctrlKey || altKey || metaKey; const isNavEdge = isVertical ? external_wp_dom_namespaceObject.isVerticalEdge : external_wp_dom_namespaceObject.isHorizontalEdge; const { ownerDocument } = node; const { defaultView } = ownerDocument; if (!isNav) { return; } // If there is a multi-selection, the arrow keys should collapse the // selection to the start or end of the selection. if (hasMultiSelection()) { if (shiftKey) { return; } // Only handle if we have a full selection (not a native partial // selection). if (!__unstableIsFullySelected()) { return; } event.preventDefault(); if (isReverse) { selectBlock(getMultiSelectedBlocksStartClientId()); } else { selectBlock(getMultiSelectedBlocksEndClientId(), -1); } return; } // Abort if our current target is not a candidate for navigation // (e.g. preserve native input behaviors). if (!isNavigationCandidate(target, keyCode, hasModifier)) { return; } // When presing any key other than up or down, the initial vertical // position must ALWAYS be reset. The vertical position is saved so // it can be restored as well as possible on sebsequent vertical // arrow key presses. It may not always be possible to restore the // exact same position (such as at an empty line), so it wouldn't be // good to compute the position right before any vertical arrow key // press. if (!isVertical) { verticalRect = null; } else if (!verticalRect) { verticalRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); } // In the case of RTL scripts, right means previous and left means // next, which is the exact reverse of LTR. const isReverseDir = (0,external_wp_dom_namespaceObject.isRTL)(target) ? !isReverse : isReverse; const { keepCaretInsideBlock } = getSettings(); if (shiftKey) { if (isClosestTabbableABlock(target, isReverse) && isNavEdge(target, isReverse)) { node.contentEditable = true; // Firefox doesn't automatically move focus. node.focus(); } } else if (isVertical && (0,external_wp_dom_namespaceObject.isVerticalEdge)(target, isReverse) && ( // When Alt is pressed, only intercept if the caret is also at // the horizontal edge. altKey ? (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) : true) && !keepCaretInsideBlock) { const closestTabbable = getClosestTabbable(target, isReverse, node, true); if (closestTabbable) { (0,external_wp_dom_namespaceObject.placeCaretAtVerticalEdge)(closestTabbable, // When Alt is pressed, place the caret at the furthest // horizontal edge and the furthest vertical edge. altKey ? !isReverse : isReverse, altKey ? undefined : verticalRect); event.preventDefault(); } } else if (isHorizontal && defaultView.getSelection().isCollapsed && (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) && !keepCaretInsideBlock) { const closestTabbable = getClosestTabbable(target, isReverseDir, node); (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(closestTabbable, isReverse); event.preventDefault(); } } node.addEventListener('mousedown', onMouseDown); node.addEventListener('keydown', onKeyDown); return () => { node.removeEventListener('mousedown', onMouseDown); node.removeEventListener('keydown', onKeyDown); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-select-all.js /** * WordPress dependencies */ /** * Internal dependencies */ function useSelectAll() { const { getBlockOrder, getSelectedBlockClientIds, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { multiSelect, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onKeyDown(event) { if (!isMatch('core/block-editor/select-all', event)) { return; } const selectedClientIds = getSelectedBlockClientIds(); if (selectedClientIds.length < 2 && !(0,external_wp_dom_namespaceObject.isEntirelySelected)(event.target)) { return; } event.preventDefault(); const [firstSelectedClientId] = selectedClientIds; const rootClientId = getBlockRootClientId(firstSelectedClientId); const blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a // level. See: https://github.com/WordPress/gutenberg/pull/31859/ if (selectedClientIds.length === blockClientIds.length) { if (rootClientId) { node.ownerDocument.defaultView.getSelection().removeAllRanges(); selectBlock(rootClientId); } return; } multiSelect(blockClientIds[0], blockClientIds[blockClientIds.length - 1]); } node.addEventListener('keydown', onKeyDown); return () => { node.removeEventListener('keydown', onKeyDown); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-drag-selection.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Sets the `contenteditable` wrapper element to `value`. * * @param {HTMLElement} node Block element. * @param {boolean} value `contentEditable` value (true or false) */ function setContentEditableWrapper(node, value) { node.contentEditable = value; // Firefox doesn't automatically move focus. if (value) { node.focus(); } } /** * Sets a multi-selection based on the native selection across blocks. */ function useDragSelection() { const { startMultiSelect, stopMultiSelect } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { isSelectionEnabled, hasSelectedBlock, isDraggingBlocks, isMultiSelecting } = (0,external_wp_data_namespaceObject.useSelect)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { const { ownerDocument } = node; const { defaultView } = ownerDocument; let anchorElement; let rafId; function onMouseUp() { stopMultiSelect(); // Equivalent to attaching the listener once. defaultView.removeEventListener('mouseup', onMouseUp); // The browser selection won't have updated yet at this point, // so wait until the next animation frame to get the browser // selection. rafId = defaultView.requestAnimationFrame(() => { if (!hasSelectedBlock()) { return; } // If the selection is complete (on mouse up), and no // multiple blocks have been selected, set focus back to the // anchor element. if the anchor element contains the // selection. Additionally, the contentEditable wrapper can // now be disabled again. setContentEditableWrapper(node, false); const selection = defaultView.getSelection(); if (selection.rangeCount) { const range = selection.getRangeAt(0); const { commonAncestorContainer } = range; const clonedRange = range.cloneRange(); if (anchorElement.contains(commonAncestorContainer)) { anchorElement.focus(); selection.removeAllRanges(); selection.addRange(clonedRange); } } }); } let lastMouseDownTarget; function onMouseDown({ target }) { lastMouseDownTarget = target; } function onMouseLeave({ buttons, target, relatedTarget }) { if (!target.contains(lastMouseDownTarget)) { return; } // If we're moving into a child element, ignore. We're tracking // the mouse leaving the element to a parent, no a child. if (target.contains(relatedTarget)) { return; } // Avoid triggering a multi-selection if the user is already // dragging blocks. if (isDraggingBlocks()) { return; } // The primary button must be pressed to initiate selection. // See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons if (buttons !== 1) { return; } // Abort if we are already multi-selecting. if (isMultiSelecting()) { return; } // Abort if selection is leaving writing flow. if (node === target) { return; } // Check the attribute, not the contentEditable attribute. All // child elements of the content editable wrapper are editable // and return true for this property. We only want to start // multi selecting when the mouse leaves the wrapper. if (target.getAttribute('contenteditable') !== 'true') { return; } if (!isSelectionEnabled()) { return; } // Do not rely on the active element because it may change after // the mouse leaves for the first time. See // https://github.com/WordPress/gutenberg/issues/48747. anchorElement = target; startMultiSelect(); // `onSelectionStart` is called after `mousedown` and // `mouseleave` (from a block). The selection ends when // `mouseup` happens anywhere in the window. defaultView.addEventListener('mouseup', onMouseUp); // Allow cross contentEditable selection by temporarily making // all content editable. We can't rely on using the store and // React because re-rending happens too slowly. We need to be // able to select across instances immediately. setContentEditableWrapper(node, true); } node.addEventListener('mouseout', onMouseLeave); node.addEventListener('mousedown', onMouseDown); return () => { node.removeEventListener('mouseout', onMouseLeave); defaultView.removeEventListener('mouseup', onMouseUp); defaultView.cancelAnimationFrame(rafId); }; }, [startMultiSelect, stopMultiSelect, isSelectionEnabled, hasSelectedBlock]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-selection-observer.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Extract the selection start node from the selection. When the anchor node is * not a text node, the selection offset is the index of a child node. * * @param {Selection} selection The selection. * * @return {Element} The selection start node. */ function extractSelectionStartNode(selection) { const { anchorNode, anchorOffset } = selection; if (anchorNode.nodeType === anchorNode.TEXT_NODE) { return anchorNode; } if (anchorOffset === 0) { return anchorNode; } return anchorNode.childNodes[anchorOffset - 1]; } /** * Extract the selection end node from the selection. When the focus node is not * a text node, the selection offset is the index of a child node. The selection * reaches up to but excluding that child node. * * @param {Selection} selection The selection. * * @return {Element} The selection start node. */ function extractSelectionEndNode(selection) { const { focusNode, focusOffset } = selection; if (focusNode.nodeType === focusNode.TEXT_NODE) { return focusNode; } if (focusOffset === focusNode.childNodes.length) { return focusNode; } // When the selection is forward (the selection ends with the focus node), // the selection may extend into the next element with an offset of 0. This // may trigger multi selection even though the selection does not visually // end in the next block. if (focusOffset === 0 && (0,external_wp_dom_namespaceObject.isSelectionForward)(selection)) { var _focusNode$previousSi; return (_focusNode$previousSi = focusNode.previousSibling) !== null && _focusNode$previousSi !== void 0 ? _focusNode$previousSi : focusNode.parentElement; } return focusNode.childNodes[focusOffset]; } function findDepth(a, b) { let depth = 0; while (a[depth] === b[depth]) { depth++; } return depth; } /** * Sets the `contenteditable` wrapper element to `value`. * * @param {HTMLElement} node Block element. * @param {boolean} value `contentEditable` value (true or false) */ function use_selection_observer_setContentEditableWrapper(node, value) { // Since we are calling this on every selection change, check if the value // needs to be updated first because it trigger the browser to recalculate // style. if (node.contentEditable !== String(value)) { node.contentEditable = value; // Firefox doesn't automatically move focus. if (value) { node.focus(); } } } function getRichTextElement(node) { const element = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement; return element?.closest('[data-wp-block-attribute-key]'); } /** * Sets a multi-selection based on the native selection across blocks. */ function useSelectionObserver() { const { multiSelect, selectBlock, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getBlockParents, getBlockSelectionStart, isMultiSelecting } = (0,external_wp_data_namespaceObject.useSelect)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { const { ownerDocument } = node; const { defaultView } = ownerDocument; function onSelectionChange(event) { const selection = defaultView.getSelection(); if (!selection.rangeCount) { return; } const startNode = extractSelectionStartNode(selection); const endNode = extractSelectionEndNode(selection); if (!node.contains(startNode) || !node.contains(endNode)) { return; } // If selection is collapsed and we haven't used `shift+click`, // end multi selection and disable the contentEditable wrapper. // We have to check about `shift+click` case because elements // that don't support text selection might be involved, and we might // update the clientIds to multi-select blocks. // For now we check if the event is a `mouse` event. const isClickShift = event.shiftKey && event.type === 'mouseup'; if (selection.isCollapsed && !isClickShift) { if (node.contentEditable === 'true' && !isMultiSelecting()) { use_selection_observer_setContentEditableWrapper(node, false); let element = startNode.nodeType === startNode.ELEMENT_NODE ? startNode : startNode.parentElement; element = element?.closest('[contenteditable]'); element?.focus(); } return; } let startClientId = getBlockClientId(startNode); let endClientId = getBlockClientId(endNode); // If the selection has changed and we had pressed `shift+click`, // we need to check if in an element that doesn't support // text selection has been clicked. if (isClickShift) { const selectedClientId = getBlockSelectionStart(); const clickedClientId = getBlockClientId(event.target); // `endClientId` is not defined if we end the selection by clicking a non-selectable block. // We need to check if there was already a selection with a non-selectable focusNode. const focusNodeIsNonSelectable = clickedClientId !== endClientId; if (startClientId === endClientId && selection.isCollapsed || !endClientId || focusNodeIsNonSelectable) { endClientId = clickedClientId; } // Handle the case when we have a non-selectable block // selected and click another one. if (startClientId !== selectedClientId) { startClientId = selectedClientId; } } // If the selection did not involve a block, return. if (startClientId === undefined && endClientId === undefined) { use_selection_observer_setContentEditableWrapper(node, false); return; } const isSingularSelection = startClientId === endClientId; if (isSingularSelection) { if (!isMultiSelecting()) { selectBlock(startClientId); } else { multiSelect(startClientId, startClientId); } } else { const startPath = [...getBlockParents(startClientId), startClientId]; const endPath = [...getBlockParents(endClientId), endClientId]; const depth = findDepth(startPath, endPath); if (startPath[depth] !== startClientId || endPath[depth] !== endClientId) { multiSelect(startPath[depth], endPath[depth]); return; } const richTextElementStart = getRichTextElement(startNode); const richTextElementEnd = getRichTextElement(endNode); if (richTextElementStart && richTextElementEnd) { var _richTextDataStart$st, _richTextDataEnd$star; const range = selection.getRangeAt(0); const richTextDataStart = (0,external_wp_richText_namespaceObject.create)({ element: richTextElementStart, range, __unstableIsEditableTree: true }); const richTextDataEnd = (0,external_wp_richText_namespaceObject.create)({ element: richTextElementEnd, range, __unstableIsEditableTree: true }); const startOffset = (_richTextDataStart$st = richTextDataStart.start) !== null && _richTextDataStart$st !== void 0 ? _richTextDataStart$st : richTextDataStart.end; const endOffset = (_richTextDataEnd$star = richTextDataEnd.start) !== null && _richTextDataEnd$star !== void 0 ? _richTextDataEnd$star : richTextDataEnd.end; selectionChange({ start: { clientId: startClientId, attributeKey: richTextElementStart.dataset.wpBlockAttributeKey, offset: startOffset }, end: { clientId: endClientId, attributeKey: richTextElementEnd.dataset.wpBlockAttributeKey, offset: endOffset } }); } else { multiSelect(startClientId, endClientId); } } } ownerDocument.addEventListener('selectionchange', onSelectionChange); defaultView.addEventListener('mouseup', onSelectionChange); return () => { ownerDocument.removeEventListener('selectionchange', onSelectionChange); defaultView.removeEventListener('mouseup', onSelectionChange); }; }, [multiSelect, selectBlock, selectionChange, getBlockParents]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-click-selection.js /** * WordPress dependencies */ /** * Internal dependencies */ function useClickSelection() { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { isSelectionEnabled, getBlockSelectionStart, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onMouseDown(event) { // The main button. // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button if (!isSelectionEnabled() || event.button !== 0) { return; } const startClientId = getBlockSelectionStart(); const clickedClientId = getBlockClientId(event.target); if (event.shiftKey) { if (startClientId !== clickedClientId) { node.contentEditable = true; // Firefox doesn't automatically move focus. node.focus(); } } else if (hasMultiSelection()) { // Allow user to escape out of a multi-selection to a // singular selection of a block via click. This is handled // here since focus handling excludes blocks when there is // multiselection, as focus can be incurred by starting a // multiselection (focus moved to first block's multi- // controls). selectBlock(clickedClientId); } } node.addEventListener('mousedown', onMouseDown); return () => { node.removeEventListener('mousedown', onMouseDown); }; }, [selectBlock, isSelectionEnabled, getBlockSelectionStart, hasMultiSelection]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-input.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Handles input for selections across blocks. */ function useInput() { const { __unstableIsFullySelected, getSelectedBlockClientIds, getSelectedBlockClientId, __unstableIsSelectionMergeable, hasMultiSelection, getBlockName, canInsertBlockType, getBlockRootClientId, getSelectionStart, getSelectionEnd, getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(store); const { replaceBlocks, __unstableSplitSelection, removeBlocks, __unstableDeleteSelection, __unstableExpandSelection, __unstableMarkAutomaticChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onBeforeInput(event) { // If writing flow is editable, NEVER allow the browser to alter the // DOM. This will cause React errors (and the DOM should only be // altered in a controlled fashion). if (node.contentEditable === 'true') { event.preventDefault(); } } function onKeyDown(event) { if (event.defaultPrevented) { return; } if (!hasMultiSelection()) { if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { if (event.shiftKey || __unstableIsFullySelected()) { return; } const clientId = getSelectedBlockClientId(); const blockName = getBlockName(clientId); const selectionStart = getSelectionStart(); const selectionEnd = getSelectionEnd(); if (selectionStart.attributeKey === selectionEnd.attributeKey) { const selectedAttributeValue = getBlockAttributes(clientId)[selectionStart.attributeKey]; const transforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from').filter(({ type }) => type === 'enter'); const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(transforms, item => { return item.regExp.test(selectedAttributeValue); }); if (transformation) { replaceBlocks(clientId, transformation.transform({ content: selectedAttributeValue })); __unstableMarkAutomaticChange(); return; } } if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'splitting', false) && !event.__deprecatedOnSplit) { return; } // Ensure template is not locked. if (canInsertBlockType(blockName, getBlockRootClientId(clientId))) { __unstableSplitSelection(); event.preventDefault(); } } return; } if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { node.contentEditable = false; event.preventDefault(); if (__unstableIsFullySelected()) { replaceBlocks(getSelectedBlockClientIds(), (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())); } else { __unstableSplitSelection(); } } else if (event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || event.keyCode === external_wp_keycodes_namespaceObject.DELETE) { node.contentEditable = false; event.preventDefault(); if (__unstableIsFullySelected()) { removeBlocks(getSelectedBlockClientIds()); } else if (__unstableIsSelectionMergeable()) { __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE); } else { __unstableExpandSelection(); } } else if ( // If key.length is longer than 1, it's a control key that doesn't // input anything. event.key.length === 1 && !(event.metaKey || event.ctrlKey)) { node.contentEditable = false; if (__unstableIsSelectionMergeable()) { __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE); } else { event.preventDefault(); // Safari does not stop default behaviour with either // event.preventDefault() or node.contentEditable = false, so // remove the selection to stop browser manipulation. node.ownerDocument.defaultView.getSelection().removeAllRanges(); } } } function onCompositionStart(event) { if (!hasMultiSelection()) { return; } node.contentEditable = false; if (__unstableIsSelectionMergeable()) { __unstableDeleteSelection(); } else { event.preventDefault(); // Safari does not stop default behaviour with either // event.preventDefault() or node.contentEditable = false, so // remove the selection to stop browser manipulation. node.ownerDocument.defaultView.getSelection().removeAllRanges(); } } node.addEventListener('beforeinput', onBeforeInput); node.addEventListener('keydown', onKeyDown); node.addEventListener('compositionstart', onCompositionStart); return () => { node.removeEventListener('beforeinput', onBeforeInput); node.removeEventListener('keydown', onKeyDown); node.removeEventListener('compositionstart', onCompositionStart); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/utils/use-notify-copy.js /** * WordPress dependencies */ /** * Internal dependencies */ function useNotifyCopy() { const { getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); return (0,external_wp_element_namespaceObject.useCallback)((eventType, selectedBlockClientIds) => { let notice = ''; if (eventType === 'copyStyles') { notice = (0,external_wp_i18n_namespaceObject.__)('Styles copied to clipboard.'); } else if (selectedBlockClientIds.length === 1) { const clientId = selectedBlockClientIds[0]; const title = getBlockType(getBlockName(clientId))?.title; if (eventType === 'copy') { notice = (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: Name of the block being copied, e.g. "Paragraph". (0,external_wp_i18n_namespaceObject.__)('Copied "%s" to clipboard.'), title); } else { notice = (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: Name of the block being cut, e.g. "Paragraph". (0,external_wp_i18n_namespaceObject.__)('Moved "%s" to clipboard.'), title); } } else if (eventType === 'copy') { notice = (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of blocks being copied. (0,external_wp_i18n_namespaceObject._n)('Copied %d block to clipboard.', 'Copied %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length); } else { notice = (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of blocks being moved. (0,external_wp_i18n_namespaceObject._n)('Moved %d block to clipboard.', 'Moved %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length); } createSuccessNotice(notice, { type: 'snackbar' }); }, [createSuccessNotice, getBlockName, getBlockType]); } ;// ./node_modules/@wordpress/block-editor/build-module/utils/pasting.js /** * WordPress dependencies */ /** * Normalizes a given string of HTML to remove the Windows-specific "Fragment" * comments and any preceding and trailing content. * * @param {string} html the html to be normalized * @return {string} the normalized html */ function removeWindowsFragments(html) { const startStr = '<!--StartFragment-->'; const startIdx = html.indexOf(startStr); if (startIdx > -1) { html = html.substring(startIdx + startStr.length); } else { // No point looking for EndFragment return html; } const endStr = '<!--EndFragment-->'; const endIdx = html.indexOf(endStr); if (endIdx > -1) { html = html.substring(0, endIdx); } return html; } /** * Removes the charset meta tag inserted by Chromium. * See: * - https://github.com/WordPress/gutenberg/issues/33585 * - https://bugs.chromium.org/p/chromium/issues/detail?id=1264616#c4 * * @param {string} html the html to be stripped of the meta tag. * @return {string} the cleaned html */ function removeCharsetMetaTag(html) { const metaTag = `<meta charset='utf-8'>`; if (html.startsWith(metaTag)) { return html.slice(metaTag.length); } return html; } function getPasteEventData({ clipboardData }) { let plainText = ''; let html = ''; try { plainText = clipboardData.getData('text/plain'); html = clipboardData.getData('text/html'); } catch (error) { // Some browsers like UC Browser paste plain text by default and // don't support clipboardData at all, so allow default // behaviour. return; } // Remove Windows-specific metadata appended within copied HTML text. html = removeWindowsFragments(html); // Strip meta tag. html = removeCharsetMetaTag(html); const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(clipboardData); if (files.length && !shouldDismissPastedFiles(files, html)) { return { files }; } return { html, plainText, files: [] }; } /** * Given a collection of DataTransfer files and HTML and plain text strings, * determine whether the files are to be dismissed in favor of the HTML. * * Certain office-type programs, like Microsoft Word or Apple Numbers, * will, upon copy, generate a screenshot of the content being copied and * attach it to the clipboard alongside the actual rich text that the user * sought to copy. In those cases, we should let Gutenberg handle the rich text * content and not the screenshot, since this allows Gutenberg to insert * meaningful blocks, like paragraphs, lists or even tables. * * @param {File[]} files File objects obtained from a paste event * @param {string} html HTML content obtained from a paste event * @return {boolean} True if the files should be dismissed */ function shouldDismissPastedFiles(files, html /*, plainText */) { // The question is only relevant when there is actual HTML content and when // there is exactly one image file. if (html && files?.length === 1 && files[0].type.indexOf('image/') === 0) { // A single <img> tag found in the HTML source suggests that the // content being pasted revolves around an image. Sometimes there are // other elements found, like <figure>, but we assume that the user's // intention is to paste the actual image file. const IMAGE_TAG = /<\s*img\b/gi; if (html.match(IMAGE_TAG)?.length !== 1) { return true; } // Even when there is exactly one <img> tag in the HTML payload, we // choose to weed out local images, i.e. those whose source starts with // "file://". These payloads occur in specific configurations, such as // when copying an entire document from Microsoft Word, that contains // text and exactly one image, and pasting that content using Google // Chrome. const IMG_WITH_LOCAL_SRC = /<\s*img\b[^>]*\bsrc="file:\/\//i; if (html.match(IMG_WITH_LOCAL_SRC)) { return true; } } return false; } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ const requiresWrapperOnCopy = Symbol('requiresWrapperOnCopy'); /** * Sets the clipboard data for the provided blocks, with both HTML and plain * text representations. * * @param {ClipboardEvent} event Clipboard event. * @param {WPBlock[]} blocks Blocks to set as clipboard data. * @param {Object} registry The registry to select from. */ function setClipboardBlocks(event, blocks, registry) { let _blocks = blocks; const [firstBlock] = blocks; if (firstBlock) { const firstBlockType = registry.select(external_wp_blocks_namespaceObject.store).getBlockType(firstBlock.name); if (firstBlockType[requiresWrapperOnCopy]) { const { getBlockRootClientId, getBlockName, getBlockAttributes } = registry.select(store); const wrapperBlockClientId = getBlockRootClientId(firstBlock.clientId); const wrapperBlockName = getBlockName(wrapperBlockClientId); if (wrapperBlockName) { _blocks = (0,external_wp_blocks_namespaceObject.createBlock)(wrapperBlockName, getBlockAttributes(wrapperBlockClientId), _blocks); } } } const serialized = (0,external_wp_blocks_namespaceObject.serialize)(_blocks); event.clipboardData.setData('text/plain', toPlainText(serialized)); event.clipboardData.setData('text/html', serialized); } /** * Returns the blocks to be pasted from the clipboard event. * * @param {ClipboardEvent} event The clipboard event. * @param {boolean} canUserUseUnfilteredHTML Whether the user can or can't post unfiltered HTML. * @return {Array|string} A list of blocks or a string, depending on `handlerMode`. */ function getPasteBlocks(event, canUserUseUnfilteredHTML) { const { plainText, html, files } = getPasteEventData(event); let blocks = []; if (files.length) { const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from'); blocks = files.reduce((accumulator, file) => { const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(fromTransforms, transform => transform.type === 'files' && transform.isMatch([file])); if (transformation) { accumulator.push(transformation.transform([file])); } return accumulator; }, []).flat(); } else { blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML: html, plainText, mode: 'BLOCKS', canUserUseUnfilteredHTML }); } return blocks; } /** * Given a string of HTML representing serialized blocks, returns the plain * text extracted after stripping the HTML of any tags and fixing line breaks. * * @param {string} html Serialized blocks. * @return {string} The plain-text content with any html removed. */ function toPlainText(html) { // Manually handle BR tags as line breaks prior to `stripHTML` call html = html.replace(/<br>/g, '\n'); const plainText = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(html).trim(); // Merge any consecutive line breaks return plainText.replace(/\n\n+/g, '\n\n'); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-clipboard-handler.js /** * WordPress dependencies */ /** * Internal dependencies */ function useClipboardHandler() { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { getBlocksByClientId, getSelectedBlockClientIds, hasMultiSelection, getSettings, getBlockName, __unstableIsFullySelected, __unstableIsSelectionCollapsed, __unstableIsSelectionMergeable, __unstableGetSelectedBlocksWithPartialSelection, canInsertBlockType, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { flashBlock, removeBlocks, replaceBlocks, __unstableDeleteSelection, __unstableExpandSelection, __unstableSplitSelection } = (0,external_wp_data_namespaceObject.useDispatch)(store); const notifyCopy = useNotifyCopy(); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function handler(event) { if (event.defaultPrevented) { // This was likely already handled in rich-text/use-paste-handler.js. return; } const selectedBlockClientIds = getSelectedBlockClientIds(); if (selectedBlockClientIds.length === 0) { return; } // Let native copy/paste behaviour take over in input fields. // But always handle multiple selected blocks. if (!hasMultiSelection()) { const { target } = event; const { ownerDocument } = target; // If copying, only consider actual text selection as selection. // Otherwise, any focus on an input field is considered. const hasSelection = event.type === 'copy' || event.type === 'cut' ? (0,external_wp_dom_namespaceObject.documentHasUncollapsedSelection)(ownerDocument) : (0,external_wp_dom_namespaceObject.documentHasSelection)(ownerDocument) && !ownerDocument.activeElement.isContentEditable; // Let native copy behaviour take over in input fields. if (hasSelection) { return; } } const { activeElement } = event.target.ownerDocument; if (!node.contains(activeElement)) { return; } const isSelectionMergeable = __unstableIsSelectionMergeable(); const shouldHandleWholeBlocks = __unstableIsSelectionCollapsed() || __unstableIsFullySelected(); const expandSelectionIsNeeded = !shouldHandleWholeBlocks && !isSelectionMergeable; if (event.type === 'copy' || event.type === 'cut') { event.preventDefault(); if (selectedBlockClientIds.length === 1) { flashBlock(selectedBlockClientIds[0]); } // If we have a partial selection that is not mergeable, just // expand the selection to the whole blocks. if (expandSelectionIsNeeded) { __unstableExpandSelection(); } else { notifyCopy(event.type, selectedBlockClientIds); let blocks; // Check if we have partial selection. if (shouldHandleWholeBlocks) { blocks = getBlocksByClientId(selectedBlockClientIds); } else { const [head, tail] = __unstableGetSelectedBlocksWithPartialSelection(); const inBetweenBlocks = getBlocksByClientId(selectedBlockClientIds.slice(1, selectedBlockClientIds.length - 1)); blocks = [head, ...inBetweenBlocks, tail]; } setClipboardBlocks(event, blocks, registry); } } if (event.type === 'cut') { // We need to also check if at the start we needed to // expand the selection, as in this point we might have // programmatically fully selected the blocks above. if (shouldHandleWholeBlocks && !expandSelectionIsNeeded) { removeBlocks(selectedBlockClientIds); } else { event.target.ownerDocument.activeElement.contentEditable = false; __unstableDeleteSelection(); } } else if (event.type === 'paste') { const { __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML } = getSettings(); const isInternal = event.clipboardData.getData('rich-text') === 'true'; if (isInternal) { return; } const { plainText, html, files } = getPasteEventData(event); const isFullySelected = __unstableIsFullySelected(); let blocks = []; if (files.length) { const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from'); blocks = files.reduce((accumulator, file) => { const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(fromTransforms, transform => transform.type === 'files' && transform.isMatch([file])); if (transformation) { accumulator.push(transformation.transform([file])); } return accumulator; }, []).flat(); } else { blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML: html, plainText, mode: isFullySelected ? 'BLOCKS' : 'AUTO', canUserUseUnfilteredHTML }); } // Inline paste: let rich text handle it. if (typeof blocks === 'string') { return; } if (isFullySelected) { replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1); event.preventDefault(); return; } // If a block doesn't support splitting, let rich text paste // inline. if (!hasMultiSelection() && !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(getBlockName(selectedBlockClientIds[0]), 'splitting', false) && !event.__deprecatedOnSplit) { return; } const [firstSelectedClientId] = selectedBlockClientIds; const rootClientId = getBlockRootClientId(firstSelectedClientId); const newBlocks = []; for (const block of blocks) { if (canInsertBlockType(block.name, rootClientId)) { newBlocks.push(block); } else { // If a block cannot be inserted in a root block, try // converting it to that root block type and insert the // inner blocks. // Example: paragraphs cannot be inserted into a list, // so convert the paragraphs to a list for list items. const rootBlockName = getBlockName(rootClientId); const switchedBlocks = block.name !== rootBlockName ? (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, rootBlockName) : [block]; if (!switchedBlocks) { return; } for (const switchedBlock of switchedBlocks) { for (const innerBlock of switchedBlock.innerBlocks) { newBlocks.push(innerBlock); } } } } __unstableSplitSelection(newBlocks); event.preventDefault(); } } node.ownerDocument.addEventListener('copy', handler); node.ownerDocument.addEventListener('cut', handler); node.ownerDocument.addEventListener('paste', handler); return () => { node.ownerDocument.removeEventListener('copy', handler); node.ownerDocument.removeEventListener('cut', handler); node.ownerDocument.removeEventListener('paste', handler); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function useWritingFlow() { const [before, ref, after] = useTabNav(); const hasMultiSelection = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasMultiSelection(), []); return [before, (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, useClipboardHandler(), useInput(), useDragSelection(), useSelectionObserver(), useClickSelection(), useMultiSelection(), useSelectAll(), useArrowNav(), (0,external_wp_compose_namespaceObject.useRefEffect)(node => { node.tabIndex = 0; node.dataset.hasMultiSelection = hasMultiSelection; if (!hasMultiSelection) { return () => { delete node.dataset.hasMultiSelection; }; } node.setAttribute('aria-label', (0,external_wp_i18n_namespaceObject.__)('Multiple selected blocks')); return () => { delete node.dataset.hasMultiSelection; node.removeAttribute('aria-label'); }; }, [hasMultiSelection])]), after]; } function WritingFlow({ children, ...props }, forwardedRef) { const [before, ref, after] = useWritingFlow(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [before, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]), className: dist_clsx(props.className, 'block-editor-writing-flow'), children: children }), after] }); } /** * Handles selection and navigation across blocks. This component should be * wrapped around BlockList. * * @param {Object} props Component properties. * @param {Element} props.children Children to be rendered. */ /* harmony default export */ const writing_flow = ((0,external_wp_element_namespaceObject.forwardRef)(WritingFlow)); ;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/get-compatibility-styles.js let compatibilityStyles = null; /** * Returns a list of stylesheets that target the editor canvas. A stylesheet is * considered targeting the editor a canvas if it contains the * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors. * * Ideally, this hook should be removed in the future and styles should be added * explicitly as editor styles. */ function getCompatibilityStyles() { if (compatibilityStyles) { return compatibilityStyles; } // Only memoize the result once on load, since these stylesheets should not // change. compatibilityStyles = Array.from(document.styleSheets).reduce((accumulator, styleSheet) => { try { // May fail for external styles. // eslint-disable-next-line no-unused-expressions styleSheet.cssRules; } catch (e) { return accumulator; } const { ownerNode, cssRules } = styleSheet; // Stylesheet is added by another stylesheet. See // https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/ownerNode#notes. if (ownerNode === null) { return accumulator; } if (!cssRules) { return accumulator; } // Don't try to add core WP styles. We are responsible for adding // them. This compatibility layer is only meant to add styles added // by plugins or themes. if (ownerNode.id.startsWith('wp-')) { return accumulator; } // Don't try to add styles without ID. Styles enqueued via the WP dependency system will always have IDs. if (!ownerNode.id) { return accumulator; } function matchFromRules(_cssRules) { return Array.from(_cssRules).find(({ selectorText, conditionText, cssRules: __cssRules }) => { // If the rule is conditional then it will not have selector text. // Recurse into child CSS ruleset to determine selector eligibility. if (conditionText) { return matchFromRules(__cssRules); } return selectorText && (selectorText.includes('.editor-styles-wrapper') || selectorText.includes('.wp-block')); }); } if (matchFromRules(cssRules)) { const isInline = ownerNode.tagName === 'STYLE'; if (isInline) { // If the current target is inline, // it could be a dependency of an existing stylesheet. // Look for that dependency and add it BEFORE the current target. const mainStylesCssId = ownerNode.id.replace('-inline-css', '-css'); const mainStylesElement = document.getElementById(mainStylesCssId); if (mainStylesElement) { accumulator.push(mainStylesElement.cloneNode(true)); } } accumulator.push(ownerNode.cloneNode(true)); if (!isInline) { // If the current target is not inline, // we still look for inline styles that could be relevant for the current target. // If they exist, add them AFTER the current target. const inlineStylesCssId = ownerNode.id.replace('-css', '-inline-css'); const inlineStylesElement = document.getElementById(inlineStylesCssId); if (inlineStylesElement) { accumulator.push(inlineStylesElement.cloneNode(true)); } } } return accumulator; }, []); return compatibilityStyles; } ;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/use-scale-canvas.js /** * WordPress dependencies */ /** * @typedef {Object} TransitionState * @property {number} scaleValue Scale of the canvas. * @property {number} frameSize Size of the frame/offset around the canvas. * @property {number} containerHeight containerHeight of the iframe. * @property {number} scrollTop ScrollTop of the iframe. * @property {number} scrollHeight ScrollHeight of the iframe. */ /** * Calculate the scale of the canvas. * * @param {Object} options Object of options * @param {number} options.frameSize Size of the frame/offset around the canvas * @param {number} options.containerWidth Actual width of the canvas container * @param {number} options.maxContainerWidth Maximum width of the container to use for the scale calculation. This locks the canvas to a maximum width when zooming out. * @param {number} options.scaleContainerWidth Width the of the container wrapping the canvas container * @return {number} Scale value between 0 and/or equal to 1 */ function calculateScale({ frameSize, containerWidth, maxContainerWidth, scaleContainerWidth }) { return (Math.min(containerWidth, maxContainerWidth) - frameSize * 2) / scaleContainerWidth; } /** * Compute the next scrollHeight based on the transition states. * * @param {TransitionState} transitionFrom Starting point of the transition * @param {TransitionState} transitionTo Ending state of the transition * @return {number} Next scrollHeight based on scale and frame value changes. */ function computeScrollHeightNext(transitionFrom, transitionTo) { const { scaleValue: prevScale, scrollHeight: prevScrollHeight } = transitionFrom; const { frameSize, scaleValue } = transitionTo; return prevScrollHeight * (scaleValue / prevScale) + frameSize * 2; } /** * Compute the next scrollTop position after scaling the iframe content. * * @param {TransitionState} transitionFrom Starting point of the transition * @param {TransitionState} transitionTo Ending state of the transition * @return {number} Next scrollTop position after scaling the iframe content. */ function computeScrollTopNext(transitionFrom, transitionTo) { const { containerHeight: prevContainerHeight, frameSize: prevFrameSize, scaleValue: prevScale, scrollTop: prevScrollTop } = transitionFrom; const { containerHeight, frameSize, scaleValue, scrollHeight } = transitionTo; // Step 0: Start with the current scrollTop. let scrollTopNext = prevScrollTop; // Step 1: Undo the effects of the previous scale and frame around the // midpoint of the visible area. scrollTopNext = (scrollTopNext + prevContainerHeight / 2 - prevFrameSize) / prevScale - prevContainerHeight / 2; // Step 2: Apply the new scale and frame around the midpoint of the // visible area. scrollTopNext = (scrollTopNext + containerHeight / 2) * scaleValue + frameSize - containerHeight / 2; // Step 3: Handle an edge case so that you scroll to the top of the // iframe if the top of the iframe content is visible in the container. // The same edge case for the bottom is skipped because changing content // makes calculating it impossible. scrollTopNext = prevScrollTop <= prevFrameSize ? 0 : scrollTopNext; // This is the scrollTop value if you are scrolled to the bottom of the // iframe. We can't just let the browser handle it because we need to // animate the scaling. const maxScrollTop = scrollHeight - containerHeight; // Step 4: Clamp the scrollTopNext between the minimum and maximum // possible scrollTop positions. Round the value to avoid subpixel // truncation by the browser which sometimes causes a 1px error. return Math.round(Math.min(Math.max(0, scrollTopNext), Math.max(0, maxScrollTop))); } /** * Generate the keyframes to use for the zoom out animation. * * @param {TransitionState} transitionFrom Starting transition state. * @param {TransitionState} transitionTo Ending transition state. * @return {Object[]} An array of keyframes to use for the animation. */ function getAnimationKeyframes(transitionFrom, transitionTo) { const { scaleValue: prevScale, frameSize: prevFrameSize, scrollTop } = transitionFrom; const { scaleValue, frameSize, scrollTop: scrollTopNext } = transitionTo; return [{ translate: `0 0`, scale: prevScale, paddingTop: `${prevFrameSize / prevScale}px`, paddingBottom: `${prevFrameSize / prevScale}px` }, { translate: `0 ${scrollTop - scrollTopNext}px`, scale: scaleValue, paddingTop: `${frameSize / scaleValue}px`, paddingBottom: `${frameSize / scaleValue}px` }]; } /** * @typedef {Object} ScaleCanvasResult * @property {boolean} isZoomedOut A boolean indicating if the canvas is zoomed out. * @property {number} scaleContainerWidth The width of the container used to calculate the scale. * @property {Object} contentResizeListener A resize observer for the content. * @property {Object} containerResizeListener A resize observer for the container. */ /** * Handles scaling the canvas for the zoom out mode and animating between * the states. * * @param {Object} options Object of options. * @param {number} options.frameSize Size of the frame around the content. * @param {Document} options.iframeDocument Document of the iframe. * @param {number} options.maxContainerWidth Max width of the canvas to use as the starting scale point. Defaults to 750. * @param {number|string} options.scale Scale of the canvas. Can be an decimal between 0 and 1, 1, or 'auto-scaled'. * @return {ScaleCanvasResult} Properties of the result. */ function useScaleCanvas({ frameSize, iframeDocument, maxContainerWidth = 750, scale }) { const [contentResizeListener, { height: contentHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const [containerResizeListener, { width: containerWidth, height: containerHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const initialContainerWidthRef = (0,external_wp_element_namespaceObject.useRef)(0); const isZoomedOut = scale !== 1; const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const isAutoScaled = scale === 'auto-scaled'; // Track if the animation should start when the useEffect runs. const startAnimationRef = (0,external_wp_element_namespaceObject.useRef)(false); // Track the animation so we know if we have an animation running, // and can cancel it, reverse it, call a finish event, etc. const animationRef = (0,external_wp_element_namespaceObject.useRef)(null); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isZoomedOut) { initialContainerWidthRef.current = containerWidth; } }, [containerWidth, isZoomedOut]); const scaleContainerWidth = Math.max(initialContainerWidthRef.current, containerWidth); const scaleValue = isAutoScaled ? calculateScale({ frameSize, containerWidth, maxContainerWidth, scaleContainerWidth }) : scale; /** * The starting transition state for the zoom out animation. * @type {import('react').RefObject<TransitionState>} */ const transitionFromRef = (0,external_wp_element_namespaceObject.useRef)({ scaleValue, frameSize, containerHeight: 0, scrollTop: 0, scrollHeight: 0 }); /** * The ending transition state for the zoom out animation. * @type {import('react').RefObject<TransitionState>} */ const transitionToRef = (0,external_wp_element_namespaceObject.useRef)({ scaleValue, frameSize, containerHeight: 0, scrollTop: 0, scrollHeight: 0 }); /** * Start the zoom out animation. This sets the necessary CSS variables * for animating the canvas and returns the Animation object. * * @return {Animation} The animation object for the zoom out animation. */ const startZoomOutAnimation = (0,external_wp_element_namespaceObject.useCallback)(() => { const { scrollTop } = transitionFromRef.current; const { scrollTop: scrollTopNext } = transitionToRef.current; iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scroll-top', `${scrollTop}px`); iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scroll-top-next', `${scrollTopNext}px`); // If the container has a scrolllbar, force a scrollbar to prevent the content from shifting while animating. iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-overflow-behavior', transitionFromRef.current.scrollHeight === transitionFromRef.current.containerHeight ? 'auto' : 'scroll'); iframeDocument.documentElement.classList.add('zoom-out-animation'); return iframeDocument.documentElement.animate(getAnimationKeyframes(transitionFromRef.current, transitionToRef.current), { easing: 'cubic-bezier(0.46, 0.03, 0.52, 0.96)', duration: 400 }); }, [iframeDocument]); /** * Callback when the zoom out animation is finished. * - Cleans up animations refs. * - Adds final CSS vars for scale and frame size to preserve the state. * - Removes the 'zoom-out-animation' class (which has the fixed positioning). * - Sets the final scroll position after the canvas is no longer in fixed position. * - Removes CSS vars related to the animation. * - Sets the transitionFrom to the transitionTo state to be ready for the next animation. */ const finishZoomOutAnimation = (0,external_wp_element_namespaceObject.useCallback)(() => { startAnimationRef.current = false; animationRef.current = null; // Add our final scale and frame size now that the animation is done. iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', transitionToRef.current.scaleValue); iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-frame-size', `${transitionToRef.current.frameSize}px`); iframeDocument.documentElement.classList.remove('zoom-out-animation'); // Set the final scroll position that was just animated to. // Disable reason: Eslint isn't smart enough to know that this is a // DOM element. https://github.com/facebook/react/issues/31483 // eslint-disable-next-line react-compiler/react-compiler iframeDocument.documentElement.scrollTop = transitionToRef.current.scrollTop; iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-scroll-top'); iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-scroll-top-next'); iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-overflow-behavior'); // Update previous values. transitionFromRef.current = transitionToRef.current; }, [iframeDocument]); const previousIsZoomedOut = (0,external_wp_element_namespaceObject.useRef)(false); /** * Runs when zoom out mode is toggled, and sets the startAnimation flag * so the animation will start when the next useEffect runs. We _only_ * want to animate when the zoom out mode is toggled, not when the scale * changes due to the container resizing. */ (0,external_wp_element_namespaceObject.useEffect)(() => { const trigger = iframeDocument && previousIsZoomedOut.current !== isZoomedOut; previousIsZoomedOut.current = isZoomedOut; if (!trigger) { return; } startAnimationRef.current = true; if (!isZoomedOut) { return; } iframeDocument.documentElement.classList.add('is-zoomed-out'); return () => { iframeDocument.documentElement.classList.remove('is-zoomed-out'); }; }, [iframeDocument, isZoomedOut]); /** * This handles: * 1. Setting the correct scale and vars of the canvas when zoomed out * 2. If zoom out mode has been toggled, runs the animation of zooming in/out */ (0,external_wp_element_namespaceObject.useEffect)(() => { if (!iframeDocument) { return; } // We need to update the appropriate scale to exit from. If sidebars have been opened since setting the // original scale, we will snap to a much smaller scale due to the scale container immediately changing sizes when exiting. if (isAutoScaled && transitionFromRef.current.scaleValue !== 1) { // We use containerWidth as the divisor, as scaleContainerWidth will always match the containerWidth when // exiting. transitionFromRef.current.scaleValue = calculateScale({ frameSize: transitionFromRef.current.frameSize, containerWidth, maxContainerWidth, scaleContainerWidth: containerWidth }); } if (scaleValue < 1) { // If we are not going to animate the transition, set the scale and frame size directly. // If we are animating, these values will be set when the animation is finished. // Example: Opening sidebars that reduce the scale of the canvas, but we don't want to // animate the transition. if (!startAnimationRef.current) { iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scaleValue); iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-frame-size', `${frameSize}px`); } iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-content-height', `${contentHeight}px`); iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-inner-height', `${containerHeight}px`); iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-container-width', `${containerWidth}px`); iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale-container-width', `${scaleContainerWidth}px`); } /** * Handle the zoom out animation: * * - Get the current scrollTop position. * - Calculate where the same scroll position is after scaling. * - Apply fixed positioning to the canvas with a transform offset * to keep the canvas centered. * - Animate the scale and padding to the new scale and frame size. * - After the animation is complete, remove the fixed positioning * and set the scroll position that keeps everything centered. */ if (startAnimationRef.current) { // Don't allow a new transition to start again unless it was started by the zoom out mode changing. startAnimationRef.current = false; /** * If we already have an animation running, reverse it. */ if (animationRef.current) { animationRef.current.reverse(); // Swap the transition to/from refs so that we set the correct values when // finishZoomOutAnimation runs. const tempTransitionFrom = transitionFromRef.current; const tempTransitionTo = transitionToRef.current; transitionFromRef.current = tempTransitionTo; transitionToRef.current = tempTransitionFrom; } else { /** * Start a new zoom animation. */ // We can't trust the set value from contentHeight, as it was measured // before the zoom out mode was changed. After zoom out mode is changed, // appenders may appear or disappear, so we need to get the height from // the iframe at this point when we're about to animate the zoom out. // The iframe scrollTop, scrollHeight, and clientHeight will all be // the most accurate. transitionFromRef.current.scrollTop = iframeDocument.documentElement.scrollTop; transitionFromRef.current.scrollHeight = iframeDocument.documentElement.scrollHeight; // Use containerHeight, as it's the previous container height before the zoom out animation starts. transitionFromRef.current.containerHeight = containerHeight; transitionToRef.current = { scaleValue, frameSize, containerHeight: iframeDocument.documentElement.clientHeight // use clientHeight to get the actual height of the new container after zoom state changes have rendered, as it will be the most up-to-date. }; transitionToRef.current.scrollHeight = computeScrollHeightNext(transitionFromRef.current, transitionToRef.current); transitionToRef.current.scrollTop = computeScrollTopNext(transitionFromRef.current, transitionToRef.current); animationRef.current = startZoomOutAnimation(); // If the user prefers reduced motion, finish the animation immediately and set the final state. if (prefersReducedMotion) { finishZoomOutAnimation(); } else { animationRef.current.onfinish = finishZoomOutAnimation; } } } }, [startZoomOutAnimation, finishZoomOutAnimation, prefersReducedMotion, isAutoScaled, scaleValue, frameSize, iframeDocument, contentHeight, containerWidth, containerHeight, maxContainerWidth, scaleContainerWidth]); return { isZoomedOut, scaleContainerWidth, contentResizeListener, containerResizeListener }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/index.js /* wp:polyfill */ /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function bubbleEvent(event, Constructor, frame) { const init = {}; for (const key in event) { init[key] = event[key]; } // Check if the event is a MouseEvent generated within the iframe. // If so, adjust the coordinates to be relative to the position of // the iframe. This ensures that components such as Draggable // receive coordinates relative to the window, instead of relative // to the iframe. Without this, the Draggable event handler would // result in components "jumping" position as soon as the user // drags over the iframe. if (event instanceof frame.contentDocument.defaultView.MouseEvent) { const rect = frame.getBoundingClientRect(); init.clientX += rect.left; init.clientY += rect.top; } const newEvent = new Constructor(event.type, init); if (init.defaultPrevented) { newEvent.preventDefault(); } const cancelled = !frame.dispatchEvent(newEvent); if (cancelled) { event.preventDefault(); } } /** * Bubbles some event types (keydown, keypress, and dragover) to parent document * document to ensure that the keyboard shortcuts and drag and drop work. * * Ideally, we should remove event bubbling in the future. Keyboard shortcuts * should be context dependent, e.g. actions on blocks like Cmd+A should not * work globally outside the block editor. * * @param {Document} iframeDocument Document to attach listeners to. */ function useBubbleEvents(iframeDocument) { return (0,external_wp_compose_namespaceObject.useRefEffect)(() => { const { defaultView } = iframeDocument; if (!defaultView) { return; } const { frameElement } = defaultView; const html = iframeDocument.documentElement; const eventTypes = ['dragover', 'mousemove']; const handlers = {}; for (const name of eventTypes) { handlers[name] = event => { const prototype = Object.getPrototypeOf(event); const constructorName = prototype.constructor.name; const Constructor = window[constructorName]; bubbleEvent(event, Constructor, frameElement); }; html.addEventListener(name, handlers[name]); } return () => { for (const name of eventTypes) { html.removeEventListener(name, handlers[name]); } }; }); } function Iframe({ contentRef, children, tabIndex = 0, scale = 1, frameSize = 0, readonly, forwardedRef: ref, title = (0,external_wp_i18n_namespaceObject.__)('Editor canvas'), ...props }) { const { resolvedAssets, isPreviewMode } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(store); const settings = getSettings(); return { resolvedAssets: settings.__unstableResolvedAssets, isPreviewMode: settings.isPreviewMode }; }, []); const { styles = '', scripts = '' } = resolvedAssets; /** @type {[Document, import('react').Dispatch<Document>]} */ const [iframeDocument, setIframeDocument] = (0,external_wp_element_namespaceObject.useState)(); const [bodyClasses, setBodyClasses] = (0,external_wp_element_namespaceObject.useState)([]); const clearerRef = useBlockSelectionClearer(); const [before, writingFlowRef, after] = useWritingFlow(); const setRef = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { node._load = () => { setIframeDocument(node.contentDocument); }; let iFrameDocument; // Prevent the default browser action for files dropped outside of dropzones. function preventFileDropDefault(event) { event.preventDefault(); } const { ownerDocument } = node; // Ideally ALL classes that are added through get_body_class should // be added in the editor too, which we'll somehow have to get from // the server in the future (which will run the PHP filters). setBodyClasses(Array.from(ownerDocument.body.classList).filter(name => name.startsWith('admin-color-') || name.startsWith('post-type-') || name === 'wp-embed-responsive')); function onLoad() { const { contentDocument } = node; const { documentElement } = contentDocument; iFrameDocument = contentDocument; documentElement.classList.add('block-editor-iframe__html'); clearerRef(documentElement); contentDocument.dir = ownerDocument.dir; for (const compatStyle of getCompatibilityStyles()) { if (contentDocument.getElementById(compatStyle.id)) { continue; } contentDocument.head.appendChild(compatStyle.cloneNode(true)); if (!isPreviewMode) { // eslint-disable-next-line no-console console.warn(`${compatStyle.id} was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`, compatStyle); } } iFrameDocument.addEventListener('dragover', preventFileDropDefault, false); iFrameDocument.addEventListener('drop', preventFileDropDefault, false); // Prevent clicks on links from navigating away. Note that links // inside `contenteditable` are already disabled by the browser, so // this is for links in blocks outside of `contenteditable`. iFrameDocument.addEventListener('click', event => { if (event.target.tagName === 'A') { event.preventDefault(); // Appending a hash to the current URL will not reload the // page. This is useful for e.g. footnotes. const href = event.target.getAttribute('href'); if (href?.startsWith('#')) { iFrameDocument.defaultView.location.hash = href.slice(1); } } }); } node.addEventListener('load', onLoad); return () => { delete node._load; node.removeEventListener('load', onLoad); iFrameDocument?.removeEventListener('dragover', preventFileDropDefault); iFrameDocument?.removeEventListener('drop', preventFileDropDefault); }; }, []); const { contentResizeListener, containerResizeListener, isZoomedOut, scaleContainerWidth } = useScaleCanvas({ scale, frameSize: parseInt(frameSize), iframeDocument }); const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)({ isDisabled: !readonly }); const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([useBubbleEvents(iframeDocument), contentRef, clearerRef, writingFlowRef, disabledRef]); // Correct doctype is required to enable rendering in standards // mode. Also preload the styles to avoid a flash of unstyled // content. const html = `<!doctype html> <html> <head> <meta charset="utf-8"> <base href="${window.location.origin}"> <script>window.frameElement._load()</script> <style> html{ height: auto !important; min-height: 100%; } /* Lowest specificity to not override global styles */ :where(body) { margin: 0; /* Default background color in case zoom out mode background colors the html element */ background-color: white; } </style> ${styles} ${scripts} </head> <body> <script>document.currentScript.parentElement.remove()</script> </body> </html>`; const [src, cleanup] = (0,external_wp_element_namespaceObject.useMemo)(() => { const _src = URL.createObjectURL(new window.Blob([html], { type: 'text/html' })); return [_src, () => URL.revokeObjectURL(_src)]; }, [html]); (0,external_wp_element_namespaceObject.useEffect)(() => cleanup, [cleanup]); // Make sure to not render the before and after focusable div elements in view // mode. They're only needed to capture focus in edit mode. const shouldRenderFocusCaptureElements = tabIndex >= 0 && !isPreviewMode; const iframe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [shouldRenderFocusCaptureElements && before, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { ...props, style: { ...props.style, height: props.style?.height, border: 0 }, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]), tabIndex: tabIndex // Correct doctype is required to enable rendering in standards // mode. Also preload the styles to avoid a flash of unstyled // content. , src: src, title: title, onKeyDown: event => { if (props.onKeyDown) { props.onKeyDown(event); } // If the event originates from inside the iframe, it means // it bubbled through the portal, but only with React // events. We need to to bubble native events as well, // though by doing so we also trigger another React event, // so we need to stop the propagation of this event to avoid // duplication. if (event.currentTarget.ownerDocument !== event.target.ownerDocument) { // We should only stop propagation of the React event, // the native event should further bubble inside the // iframe to the document and window. // Alternatively, we could consider redispatching the // native event in the iframe. const { stopPropagation } = event.nativeEvent; event.nativeEvent.stopPropagation = () => {}; event.stopPropagation(); event.nativeEvent.stopPropagation = stopPropagation; bubbleEvent(event, window.KeyboardEvent, event.currentTarget); } }, children: iframeDocument && (0,external_wp_element_namespaceObject.createPortal)( /*#__PURE__*/ // We want to prevent React events from bubbling through the iframe // we bubble these manually. /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("body", { ref: bodyRef, className: dist_clsx('block-editor-iframe__body', 'editor-styles-wrapper', ...bodyClasses), children: [contentResizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document: iframeDocument, children: children })] }), iframeDocument.documentElement) }), shouldRenderFocusCaptureElements && after] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-iframe__container", children: [containerResizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('block-editor-iframe__scale-container', isZoomedOut && 'is-zoomed-out'), style: { '--wp-block-editor-iframe-zoom-out-scale-container-width': isZoomedOut && `${scaleContainerWidth}px` }, children: iframe })] }); } function IframeIfReady(props, ref) { const isInitialised = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().__internalIsInitialized, []); // We shouldn't render the iframe until the editor settings are initialised. // The initial settings are needed to get the styles for the srcDoc, which // cannot be changed after the iframe is mounted. srcDoc is used to to set // the initial iframe HTML, which is required to avoid a flash of unstyled // content. if (!isInitialised) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Iframe, { ...props, forwardedRef: ref }); } /* harmony default export */ const iframe = ((0,external_wp_element_namespaceObject.forwardRef)(IframeIfReady)); ;// ./node_modules/parsel-js/dist/parsel.js const TOKENS = { attribute: /\[\s*(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)\s*(?:(?<operator>\W?=)\s*(?<value>.+?)\s*(\s(?<caseSensitive>[iIsS]))?\s*)?\]/gu, id: /#(?<name>[-\w\P{ASCII}]+)/gu, class: /\.(?<name>[-\w\P{ASCII}]+)/gu, comma: /\s*,\s*/g, combinator: /\s*[\s>+~]\s*/g, 'pseudo-element': /::(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu, 'pseudo-class': /:(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu, universal: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?\*/gu, type: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)/gu, // this must be last }; const TRIM_TOKENS = new Set(['combinator', 'comma']); const RECURSIVE_PSEUDO_CLASSES = new Set([ 'not', 'is', 'where', 'has', 'matches', '-moz-any', '-webkit-any', 'nth-child', 'nth-last-child', ]); const nthChildRegExp = /(?<index>[\dn+-]+)\s+of\s+(?<subtree>.+)/; const RECURSIVE_PSEUDO_CLASSES_ARGS = { 'nth-child': nthChildRegExp, 'nth-last-child': nthChildRegExp, }; const getArgumentPatternByType = (type) => { switch (type) { case 'pseudo-element': case 'pseudo-class': return new RegExp(TOKENS[type].source.replace('(?<argument>¶*)', '(?<argument>.*)'), 'gu'); default: return TOKENS[type]; } }; function gobbleParens(text, offset) { let nesting = 0; let result = ''; for (; offset < text.length; offset++) { const char = text[offset]; switch (char) { case '(': ++nesting; break; case ')': --nesting; break; } result += char; if (nesting === 0) { return result; } } return result; } function tokenizeBy(text, grammar = TOKENS) { if (!text) { return []; } const tokens = [text]; for (const [type, pattern] of Object.entries(grammar)) { for (let i = 0; i < tokens.length; i++) { const token = tokens[i]; if (typeof token !== 'string') { continue; } pattern.lastIndex = 0; const match = pattern.exec(token); if (!match) { continue; } const from = match.index - 1; const args = []; const content = match[0]; const before = token.slice(0, from + 1); if (before) { args.push(before); } args.push({ ...match.groups, type, content, }); const after = token.slice(from + content.length + 1); if (after) { args.push(after); } tokens.splice(i, 1, ...args); } } let offset = 0; for (const token of tokens) { switch (typeof token) { case 'string': throw new Error(`Unexpected sequence ${token} found at index ${offset}`); case 'object': offset += token.content.length; token.pos = [offset - token.content.length, offset]; if (TRIM_TOKENS.has(token.type)) { token.content = token.content.trim() || ' '; } break; } } return tokens; } const STRING_PATTERN = /(['"])([^\\\n]+?)\1/g; const ESCAPE_PATTERN = /\\./g; function parsel_tokenize(selector, grammar = TOKENS) { // Prevent leading/trailing whitespaces from being interpreted as combinators selector = selector.trim(); if (selector === '') { return []; } const replacements = []; // Replace escapes with placeholders. selector = selector.replace(ESCAPE_PATTERN, (value, offset) => { replacements.push({ value, offset }); return '\uE000'.repeat(value.length); }); // Replace strings with placeholders. selector = selector.replace(STRING_PATTERN, (value, quote, content, offset) => { replacements.push({ value, offset }); return `${quote}${'\uE001'.repeat(content.length)}${quote}`; }); // Replace parentheses with placeholders. { let pos = 0; let offset; while ((offset = selector.indexOf('(', pos)) > -1) { const value = gobbleParens(selector, offset); replacements.push({ value, offset }); selector = `${selector.substring(0, offset)}(${'¶'.repeat(value.length - 2)})${selector.substring(offset + value.length)}`; pos = offset + value.length; } } // Now we have no nested structures and we can parse with regexes const tokens = tokenizeBy(selector, grammar); // Replace placeholders in reverse order. const changedTokens = new Set(); for (const replacement of replacements.reverse()) { for (const token of tokens) { const { offset, value } = replacement; if (!(token.pos[0] <= offset && offset + value.length <= token.pos[1])) { continue; } const { content } = token; const tokenOffset = offset - token.pos[0]; token.content = content.slice(0, tokenOffset) + value + content.slice(tokenOffset + value.length); if (token.content !== content) { changedTokens.add(token); } } } // Update changed tokens. for (const token of changedTokens) { const pattern = getArgumentPatternByType(token.type); if (!pattern) { throw new Error(`Unknown token type: ${token.type}`); } pattern.lastIndex = 0; const match = pattern.exec(token.content); if (!match) { throw new Error(`Unable to parse content for ${token.type}: ${token.content}`); } Object.assign(token, match.groups); } return tokens; } /** * Convert a flat list of tokens into a tree of complex & compound selectors */ function nestTokens(tokens, { list = true } = {}) { if (list && tokens.find((t) => t.type === 'comma')) { const selectors = []; const temp = []; for (let i = 0; i < tokens.length; i++) { if (tokens[i].type === 'comma') { if (temp.length === 0) { throw new Error('Incorrect comma at ' + i); } selectors.push(nestTokens(temp, { list: false })); temp.length = 0; } else { temp.push(tokens[i]); } } if (temp.length === 0) { throw new Error('Trailing comma'); } else { selectors.push(nestTokens(temp, { list: false })); } return { type: 'list', list: selectors }; } for (let i = tokens.length - 1; i >= 0; i--) { let token = tokens[i]; if (token.type === 'combinator') { let left = tokens.slice(0, i); let right = tokens.slice(i + 1); return { type: 'complex', combinator: token.content, left: nestTokens(left), right: nestTokens(right), }; } } switch (tokens.length) { case 0: throw new Error('Could not build AST.'); case 1: // If we're here, there are no combinators, so it's just a list. return tokens[0]; default: return { type: 'compound', list: [...tokens], // clone to avoid pointers messing up the AST }; } } /** * Traverse an AST in depth-first order */ function* flatten(node, /** * @internal */ parent) { switch (node.type) { case 'list': for (let child of node.list) { yield* flatten(child, node); } break; case 'complex': yield* flatten(node.left, node); yield* flatten(node.right, node); break; case 'compound': yield* node.list.map((token) => [token, node]); break; default: yield [node, parent]; } } /** * Traverse an AST (or part thereof), in depth-first order */ function walk(node, visit, /** * @internal */ parent) { if (!node) { return; } for (const [token, ast] of flatten(node, parent)) { visit(token, ast); } } /** * Parse a CSS selector * * @param selector - The selector to parse * @param options.recursive - Whether to parse the arguments of pseudo-classes like :is(), :has() etc. Defaults to true. * @param options.list - Whether this can be a selector list (A, B, C etc). Defaults to true. */ function parse(selector, { recursive = true, list = true } = {}) { const tokens = parsel_tokenize(selector); if (!tokens) { return; } const ast = nestTokens(tokens, { list }); if (!recursive) { return ast; } for (const [token] of flatten(ast)) { if (token.type !== 'pseudo-class' || !token.argument) { continue; } if (!RECURSIVE_PSEUDO_CLASSES.has(token.name)) { continue; } let argument = token.argument; const childArg = RECURSIVE_PSEUDO_CLASSES_ARGS[token.name]; if (childArg) { const match = childArg.exec(argument); if (!match) { continue; } Object.assign(token, match.groups); argument = match.groups['subtree']; } if (!argument) { continue; } Object.assign(token, { subtree: parse(argument, { recursive: true, list: true, }), }); } return ast; } /** * Converts the given list or (sub)tree to a string. */ function parsel_stringify(listOrNode) { let tokens; if (Array.isArray(listOrNode)) { tokens = listOrNode; } else { tokens = [...flatten(listOrNode)].map(([token]) => token); } return tokens.map(token => token.content).join(''); } /** * To convert the specificity array to a number */ function specificityToNumber(specificity, base) { base = base || Math.max(...specificity) + 1; return (specificity[0] * (base << 1) + specificity[1] * base + specificity[2]); } /** * Calculate specificity of a selector. * * If the selector is a list, the max specificity is returned. */ function specificity(selector) { let ast = selector; if (typeof ast === 'string') { ast = parse(ast, { recursive: true }); } if (!ast) { return []; } if (ast.type === 'list' && 'list' in ast) { let base = 10; const specificities = ast.list.map((ast) => { const sp = specificity(ast); base = Math.max(base, ...specificity(ast)); return sp; }); const numbers = specificities.map((ast) => specificityToNumber(ast, base)); return specificities[numbers.indexOf(Math.max(...numbers))]; } const ret = [0, 0, 0]; for (const [token] of flatten(ast)) { switch (token.type) { case 'id': ret[0]++; break; case 'class': case 'attribute': ret[1]++; break; case 'pseudo-element': case 'type': ret[2]++; break; case 'pseudo-class': if (token.name === 'where') { break; } if (!RECURSIVE_PSEUDO_CLASSES.has(token.name) || !token.subtree) { ret[1]++; break; } const sub = specificity(token.subtree); sub.forEach((s, i) => (ret[i] += s)); // :nth-child() & :nth-last-child() add (0, 1, 0) to the specificity of their most complex selector if (token.name === 'nth-child' || token.name === 'nth-last-child') { ret[1]++; } } } return ret; } // EXTERNAL MODULE: ./node_modules/postcss/lib/processor.js var processor = __webpack_require__(9656); var processor_default = /*#__PURE__*/__webpack_require__.n(processor); // EXTERNAL MODULE: ./node_modules/postcss/lib/css-syntax-error.js var css_syntax_error = __webpack_require__(356); var css_syntax_error_default = /*#__PURE__*/__webpack_require__.n(css_syntax_error); // EXTERNAL MODULE: ./node_modules/postcss-prefix-selector/index.js var postcss_prefix_selector = __webpack_require__(1443); var postcss_prefix_selector_default = /*#__PURE__*/__webpack_require__.n(postcss_prefix_selector); // EXTERNAL MODULE: ./node_modules/postcss-urlrebase/index.js var postcss_urlrebase = __webpack_require__(5404); var postcss_urlrebase_default = /*#__PURE__*/__webpack_require__.n(postcss_urlrebase); ;// ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/index.js /** * External dependencies */ const cacheByWrapperSelector = new Map(); const ROOT_SELECTOR_TOKENS = [{ type: 'type', content: 'body' }, { type: 'type', content: 'html' }, { type: 'pseudo-class', content: ':root' }, { type: 'pseudo-class', content: ':where(body)' }, { type: 'pseudo-class', content: ':where(:root)' }, { type: 'pseudo-class', content: ':where(html)' }]; /** * Prefixes root selectors in a way that ensures consistent specificity. * This requires special handling, since prefixing a classname before * html, body, or :root will generally result in an invalid selector. * * Some libraries will simply replace the root selector with the prefix * instead, but this results in inconsistent specificity. * * This function instead inserts the prefix after the root tags but before * any other part of the selector. This results in consistent specificity: * - If a `:where()` selector is used for the prefix, all selectors output * by `transformStyles` will have no specificity increase. * - If a classname, id, or something else is used as the prefix, all selectors * will have the same specificity bump when transformed. * * @param {string} prefix The prefix. * @param {string} selector The selector. * * @return {string} The prefixed root selector. */ function prefixRootSelector(prefix, selector) { // Use a tokenizer, since regular expressions are unreliable. const tokenized = parsel_tokenize(selector); // Find the last token that contains a root selector by walking back // through the tokens. const lastRootIndex = tokenized.findLastIndex(({ content, type }) => { return ROOT_SELECTOR_TOKENS.some(rootSelector => content === rootSelector.content && type === rootSelector.type); }); // Walk forwards to find the combinator after the last root. // This is where the root ends and the rest of the selector begins, // and the index to insert before. // Doing it this way takes into account that a root selector like // 'body' may have additional id/class/pseudo-class/attribute-selector // parts chained to it, which is difficult to quantify using a regex. let insertionPoint = -1; for (let i = lastRootIndex + 1; i < tokenized.length; i++) { if (tokenized[i].type === 'combinator') { insertionPoint = i; break; } } // Tokenize and insert the prefix with a ' ' combinator before it. const tokenizedPrefix = parsel_tokenize(prefix); tokenized.splice( // Insert at the insertion point, or the end. insertionPoint === -1 ? tokenized.length : insertionPoint, 0, { type: 'combinator', content: ' ' }, ...tokenizedPrefix); return parsel_stringify(tokenized); } function transformStyle({ css, ignoredSelectors = [], baseURL }, wrapperSelector = '', transformOptions) { // When there is no wrapper selector and no base URL, there is no need // to transform the CSS. This is most cases because in the default // iframed editor, no wrapping is needed, and not many styles // provide a base URL. if (!wrapperSelector && !baseURL) { return css; } try { var _transformOptions$ign; const excludedSelectors = [...ignoredSelectors, ...((_transformOptions$ign = transformOptions?.ignoredSelectors) !== null && _transformOptions$ign !== void 0 ? _transformOptions$ign : []), wrapperSelector]; return new (processor_default())([wrapperSelector && postcss_prefix_selector_default()({ prefix: wrapperSelector, transform(prefix, selector, prefixedSelector) { // For backwards compatibility, don't use the `exclude` option // of postcss-prefix-selector, instead handle it here to match // the behavior of the old library (postcss-prefix-wrap) that // `transformStyle` previously used. if (excludedSelectors.some(excludedSelector => excludedSelector instanceof RegExp ? selector.match(excludedSelector) : selector.includes(excludedSelector))) { return selector; } const hasRootSelector = ROOT_SELECTOR_TOKENS.some(rootSelector => selector.startsWith(rootSelector.content)); // Reorganize root selectors such that the root part comes before the prefix, // but the prefix still comes before the remaining part of the selector. if (hasRootSelector) { return prefixRootSelector(prefix, selector); } return prefixedSelector; } }), baseURL && postcss_urlrebase_default()({ rootUrl: baseURL })].filter(Boolean)).process(css, {}).css; // use sync PostCSS API } catch (error) { if (error instanceof (css_syntax_error_default())) { // eslint-disable-next-line no-console console.warn('wp.blockEditor.transformStyles Failed to transform CSS.', error.message + '\n' + error.showSourceCode(false)); } else { // eslint-disable-next-line no-console console.warn('wp.blockEditor.transformStyles Failed to transform CSS.', error); } return null; } } /** * @typedef {Object} EditorStyle * @property {string} css the CSS block(s), as a single string. * @property {?string} baseURL the base URL to be used as the reference when rewriting urls. * @property {?string[]} ignoredSelectors the selectors not to wrap. */ /** * @typedef {Object} TransformOptions * @property {?string[]} ignoredSelectors the selectors not to wrap. */ /** * Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed. * * @param {EditorStyle[]} styles CSS rules. * @param {string} wrapperSelector Wrapper selector. * @param {TransformOptions} transformOptions Additional options for style transformation. * @return {Array} converted rules. */ const transform_styles_transformStyles = (styles, wrapperSelector = '', transformOptions) => { let cache = cacheByWrapperSelector.get(wrapperSelector); if (!cache) { cache = new WeakMap(); cacheByWrapperSelector.set(wrapperSelector, cache); } return styles.map(style => { let css = cache.get(style); if (!css) { css = transformStyle(style, wrapperSelector, transformOptions); cache.set(style, css); } return css; }); }; /* harmony default export */ const transform_styles = (transform_styles_transformStyles); ;// ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ k([names, a11y]); function useDarkThemeBodyClassName(styles, scope) { return (0,external_wp_element_namespaceObject.useCallback)(node => { if (!node) { return; } const { ownerDocument } = node; const { defaultView, body } = ownerDocument; const canvas = scope ? ownerDocument.querySelector(scope) : body; let backgroundColor; if (!canvas) { // The real .editor-styles-wrapper element might not exist in the // DOM, so calculate the background color by creating a fake // wrapper. const tempCanvas = ownerDocument.createElement('div'); tempCanvas.classList.add('editor-styles-wrapper'); body.appendChild(tempCanvas); backgroundColor = defaultView?.getComputedStyle(tempCanvas, null).getPropertyValue('background-color'); body.removeChild(tempCanvas); } else { backgroundColor = defaultView?.getComputedStyle(canvas, null).getPropertyValue('background-color'); } const colordBackgroundColor = w(backgroundColor); // If background is transparent, it should be treated as light color. if (colordBackgroundColor.luminance() > 0.5 || colordBackgroundColor.alpha() === 0) { body.classList.remove('is-dark-theme'); } else { body.classList.add('is-dark-theme'); } }, [styles, scope]); } function EditorStyles({ styles, scope, transformOptions }) { const overrides = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getStyleOverrides(), []); const [transformedStyles, transformedSvgs] = (0,external_wp_element_namespaceObject.useMemo)(() => { const _styles = Object.values(styles !== null && styles !== void 0 ? styles : []); for (const [id, override] of overrides) { const index = _styles.findIndex(({ id: _id }) => id === _id); const overrideWithId = { ...override, id }; if (index === -1) { _styles.push(overrideWithId); } else { _styles[index] = overrideWithId; } } return [transform_styles(_styles.filter(style => style?.css), scope, transformOptions), _styles.filter(style => style.__unstableType === 'svgs').map(style => style.assets).join('')]; }, [styles, overrides, scope, transformOptions]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { ref: useDarkThemeBodyClassName(transformedStyles, scope) }), transformedStyles.map((css, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: css }, index)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 0 0", width: "0", height: "0", role: "none", style: { visibility: 'hidden', position: 'absolute', left: '-9999px', overflow: 'hidden' }, dangerouslySetInnerHTML: { __html: transformedSvgs } })] }); } /* harmony default export */ const editor_styles = ((0,external_wp_element_namespaceObject.memo)(EditorStyles)); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/auto.js /** * WordPress dependencies */ /** * Internal dependencies */ // This is used to avoid rendering the block list if the sizes change. const MemoizedBlockList = (0,external_wp_element_namespaceObject.memo)(BlockList); const MAX_HEIGHT = 2000; const EMPTY_ADDITIONAL_STYLES = []; function ScaledBlockPreview({ viewportWidth, containerWidth, minHeight, additionalStyles = EMPTY_ADDITIONAL_STYLES }) { if (!viewportWidth) { viewportWidth = containerWidth; } const [contentResizeListener, { height: contentHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const { styles } = (0,external_wp_data_namespaceObject.useSelect)(select => { const settings = select(store).getSettings(); return { styles: settings.styles }; }, []); // Avoid scrollbars for pattern previews. const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { if (styles) { return [...styles, { css: 'body{height:auto;overflow:hidden;border:none;padding:0;}', __unstableType: 'presets' }, ...additionalStyles]; } return styles; }, [styles, additionalStyles]); const scale = containerWidth / viewportWidth; const aspectRatio = contentHeight ? containerWidth / (contentHeight * scale) : 0; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "block-editor-block-preview__content", style: { transform: `scale(${scale})`, // Using width + aspect-ratio instead of height here triggers browsers' native // handling of scrollbar's visibility. It prevents the flickering issue seen // in https://github.com/WordPress/gutenberg/issues/52027. // See https://github.com/WordPress/gutenberg/pull/52921 for more info. aspectRatio, maxHeight: contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined, minHeight }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(iframe, { contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)(bodyElement => { const { ownerDocument: { documentElement } } = bodyElement; documentElement.classList.add('block-editor-block-preview__content-iframe'); documentElement.style.position = 'absolute'; documentElement.style.width = '100%'; // Necessary for contentResizeListener to work. bodyElement.style.boxSizing = 'border-box'; bodyElement.style.position = 'absolute'; bodyElement.style.width = '100%'; }, []), "aria-hidden": true, tabIndex: -1, style: { position: 'absolute', width: viewportWidth, height: contentHeight, pointerEvents: 'none', // This is a catch-all max-height for patterns. // See: https://github.com/WordPress/gutenberg/pull/38175. maxHeight: MAX_HEIGHT, minHeight: scale !== 0 && scale < 1 && minHeight ? minHeight / scale : minHeight }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles, { styles: editorStyles }), contentResizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { renderAppender: false })] }) }); } function AutoBlockPreview(props) { const [containerResizeListener, { width: containerWidth }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { position: 'relative', width: '100%', height: 0 }, children: containerResizeListener }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-preview__container", children: !!containerWidth && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScaledBlockPreview, { ...props, containerWidth: containerWidth }) })] }); } ;// external ["wp","priorityQueue"] const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/async.js /** * WordPress dependencies */ const blockPreviewQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)(); /** * Renders a component at the next idle time. * @param {*} props */ function Async({ children, placeholder }) { const [shouldRender, setShouldRender] = (0,external_wp_element_namespaceObject.useState)(false); // In the future, we could try to use startTransition here, but currently // react will batch all transitions, which means all previews will be // rendered at the same time. // https://react.dev/reference/react/startTransition#caveats // > If there are multiple ongoing Transitions, React currently batches them // > together. This is a limitation that will likely be removed in a future // > release. (0,external_wp_element_namespaceObject.useEffect)(() => { const context = {}; blockPreviewQueue.add(context, () => { // Synchronously run all renders so it consumes timeRemaining. // See https://github.com/WordPress/gutenberg/pull/48238 (0,external_wp_element_namespaceObject.flushSync)(() => { setShouldRender(true); }); }); return () => { blockPreviewQueue.cancel(context); }; }, []); if (!shouldRender) { return placeholder; } return children; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const block_preview_EMPTY_ADDITIONAL_STYLES = []; function BlockPreview({ blocks, viewportWidth = 1200, minHeight, additionalStyles = block_preview_EMPTY_ADDITIONAL_STYLES, // Deprecated props: __experimentalMinHeight, __experimentalPadding }) { if (__experimentalMinHeight) { minHeight = __experimentalMinHeight; external_wp_deprecated_default()('The __experimentalMinHeight prop', { since: '6.2', version: '6.4', alternative: 'minHeight' }); } if (__experimentalPadding) { additionalStyles = [...additionalStyles, { css: `body { padding: ${__experimentalPadding}px; }` }]; external_wp_deprecated_default()('The __experimentalPadding prop of BlockPreview', { since: '6.2', version: '6.4', alternative: 'additionalStyles' }); } const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...originalSettings, focusMode: false, // Disable "Spotlight mode". isPreviewMode: true }), [originalSettings]); const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); if (!blocks || blocks.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { value: renderedBlocks, settings: settings, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AutoBlockPreview, { viewportWidth: viewportWidth, minHeight: minHeight, additionalStyles: additionalStyles }) }); } const MemoizedBlockPreview = (0,external_wp_element_namespaceObject.memo)(BlockPreview); MemoizedBlockPreview.Async = Async; /** * BlockPreview renders a preview of a block or array of blocks. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md * * @param {Object} preview options for how the preview should be shown * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed. * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700. * * @return {Component} The component to be rendered. */ /* harmony default export */ const block_preview = (MemoizedBlockPreview); /** * This hook is used to lightly mark an element as a block preview wrapper * element. Call this hook and pass the returned props to the element to mark as * a block preview wrapper, automatically rendering inner blocks as children. If * you define a ref for the element, it is important to pass the ref to this * hook, which the hook in turn will pass to the component through the props it * returns. Optionally, you can also pass any other props through this hook, and * they will be merged and returned. * * @param {Object} options Preview options. * @param {WPBlock[]} options.blocks Block objects. * @param {Object} options.props Optional. Props to pass to the element. Must contain * the ref if one is defined. * @param {Object} options.layout Layout settings to be used in the preview. */ function useBlockPreview({ blocks, props = {}, layout }) { const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...originalSettings, styles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles. focusMode: false, // Disable "Spotlight mode". isPreviewMode: true }), [originalSettings]); const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)(); const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, disabledRef]); const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); const children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalBlockEditorProvider, { value: renderedBlocks, settings: settings, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { renderAppender: false, layout: layout })] }); return { ...props, ref, className: dist_clsx(props.className, 'block-editor-block-preview__live-content', 'components-disabled'), children: blocks?.length ? children : null }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/preview-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function InserterPreviewPanel({ item }) { var _example$viewportWidt; const { name, title, icon, description, initialAttributes, example } = item; const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item); const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!example) { return (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes); } return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, { attributes: { ...example.attributes, ...initialAttributes }, innerBlocks: example.innerBlocks }); }, [name, example, initialAttributes]); // Same as height of BlockPreviewPanel. const previewHeight = 144; const sidebarWidth = 280; const viewportWidth = (_example$viewportWidt = example?.viewportWidth) !== null && _example$viewportWidt !== void 0 ? _example$viewportWidt : 500; const scale = sidebarWidth / viewportWidth; const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__preview-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview", children: isReusable || example ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { blocks: blocks, viewportWidth: viewportWidth, minHeight: previewHeight, additionalStyles: //We want this CSS to be in sync with the one in BlockPreviewPanel. [{ css: ` body { padding: 24px; min-height:${Math.round(minHeight)}px; display:flex; align-items:center; } .is-root-container { width: 100%; } ` }] }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview-content-missing", children: (0,external_wp_i18n_namespaceObject.__)('No preview available.') }) }), !isReusable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_card, { title: title, icon: icon, description: description })] }); } /* harmony default export */ const preview_panel = (InserterPreviewPanel); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/item.js /** * WordPress dependencies */ function InserterListboxItem({ isFirst, as: Component, children, ...props }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { ref: ref, role: "option" // Use the Composite.Item `accessibleWhenDisabled` prop // over Button's `isFocusable`. The latter was shown to // cause an issue with tab order in the inserter list. , accessibleWhenDisabled: true, ...props, render: htmlProps => { const propsWithTabIndex = { ...htmlProps, tabIndex: isFirst ? 0 : htmlProps.tabIndex }; if (Component) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...propsWithTabIndex, children: children }); } if (typeof children === 'function') { return children(propsWithTabIndex); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...propsWithTabIndex, children: children }); } }); } /* harmony default export */ const inserter_listbox_item = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxItem)); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-draggable-blocks/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const InserterDraggableBlocks = ({ isEnabled, blocks, icon, children, pattern }) => { const blockTypeIcon = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockType } = select(external_wp_blocks_namespaceObject.store); return blocks.length === 1 && getBlockType(blocks[0].name)?.icon; }, [blocks]); const { startDragging, stopDragging } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const patternBlock = (0,external_wp_element_namespaceObject.useMemo)(() => { return pattern?.type === INSERTER_PATTERN_TYPES.user && pattern?.syncStatus !== 'unsynced' ? [(0,external_wp_blocks_namespaceObject.createBlock)('core/block', { ref: pattern.id })] : undefined; }, [pattern?.type, pattern?.syncStatus, pattern?.id]); if (!isEnabled) { return children({ draggable: false, onDragStart: undefined, onDragEnd: undefined }); } const draggableBlocks = patternBlock !== null && patternBlock !== void 0 ? patternBlock : blocks; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Draggable, { __experimentalTransferDataType: "wp-blocks", transferData: { type: 'inserter', blocks: draggableBlocks }, onDragStart: event => { startDragging(); for (const block of draggableBlocks) { const type = `wp-block:${block.name}`; // This will fill in the dataTransfer.types array so that // the drop zone can check if the draggable is eligible. // Unfortuantely, on drag start, we don't have access to the // actual data, only the data keys/types. event.dataTransfer.items.add('', type); } }, onDragEnd: () => { stopDragging(); }, __experimentalDragComponent: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockDraggableChip, { count: blocks.length, icon: icon || !pattern && blockTypeIcon, isPattern: !!pattern }), children: ({ onDraggableStart, onDraggableEnd }) => { return children({ draggable: true, onDragStart: onDraggableStart, onDragEnd: onDraggableEnd }); } }); }; /* harmony default export */ const inserter_draggable_blocks = (InserterDraggableBlocks); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-list-item/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function InserterListItem({ className, isFirst, item, onSelect, onHover, isDraggable, ...props }) { const isDraggingRef = (0,external_wp_element_namespaceObject.useRef)(false); const itemIconStyle = item.icon ? { backgroundColor: item.icon.background, color: item.icon.foreground } : {}; const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => [(0,external_wp_blocks_namespaceObject.createBlock)(item.name, item.initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(item.innerBlocks))], [item.name, item.initialAttributes, item.innerBlocks]); const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item) && item.syncStatus !== 'unsynced' || (0,external_wp_blocks_namespaceObject.isTemplatePart)(item); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks, { isEnabled: isDraggable && !item.isDisabled, blocks: blocks, icon: item.icon, children: ({ draggable, onDragStart, onDragEnd }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('block-editor-block-types-list__list-item', { 'is-synced': isSynced }), draggable: draggable, onDragStart: event => { isDraggingRef.current = true; if (onDragStart) { onHover(null); onDragStart(event); } }, onDragEnd: event => { isDraggingRef.current = false; if (onDragEnd) { onDragEnd(event); } }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(inserter_listbox_item, { isFirst: isFirst, className: dist_clsx('block-editor-block-types-list__item', className), disabled: item.isDisabled, onClick: event => { event.preventDefault(); onSelect(item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey); onHover(null); }, onKeyDown: event => { const { keyCode } = event; if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { event.preventDefault(); onSelect(item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey); onHover(null); } }, onMouseEnter: () => { if (isDraggingRef.current) { return; } onHover(item); }, onMouseLeave: () => onHover(null), ...props, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-types-list__item-icon", style: itemIconStyle, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: item.icon, showColors: true }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-types-list__item-title", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 3, children: item.title }) })] }) }) }); } /* harmony default export */ const inserter_list_item = ((0,external_wp_element_namespaceObject.memo)(InserterListItem)); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/group.js /** * WordPress dependencies */ function InserterListboxGroup(props, ref) { const [shouldSpeak, setShouldSpeak] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (shouldSpeak) { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to move through blocks')); } }, [shouldSpeak]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, role: "listbox", "aria-orientation": "horizontal", onFocus: () => { setShouldSpeak(true); }, onBlur: event => { const focusingOutsideGroup = !event.currentTarget.contains(event.relatedTarget); if (focusingOutsideGroup) { setShouldSpeak(false); } }, ...props }); } /* harmony default export */ const group = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxGroup)); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/row.js /** * WordPress dependencies */ function InserterListboxRow(props, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Group, { role: "presentation", ref: ref, ...props }); } /* harmony default export */ const inserter_listbox_row = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxRow)); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-types-list/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function chunk(array, size) { const chunks = []; for (let i = 0, j = array.length; i < j; i += size) { chunks.push(array.slice(i, i + size)); } return chunks; } function BlockTypesList({ items = [], onSelect, onHover = () => {}, children, label, isDraggable = true }) { const className = 'block-editor-block-types-list'; const listId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockTypesList, className); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(group, { className: className, "aria-label": label, children: [chunk(items, 3).map((row, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox_row, { children: row.map((item, j) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_list_item, { item: item, className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(item.id), onSelect: onSelect, onHover: onHover, isDraggable: isDraggable && !item.isDisabled, isFirst: i === 0 && j === 0, rowId: `${listId}-${i}` }, item.id)) }, i)), children] }); } /* harmony default export */ const block_types_list = (BlockTypesList); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/panel.js /** * WordPress dependencies */ function InserterPanel({ title, icon, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__panel-header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "block-editor-inserter__panel-title", children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__panel-content", children: children })] }); } /* harmony default export */ const panel = (InserterPanel); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-block-types-state.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Retrieves the block types inserter state. * * @param {string=} rootClientId Insertion's root client ID. * @param {Function} onInsert function called when inserter a list of blocks. * @param {boolean} isQuick * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler) */ const useBlockTypesState = (rootClientId, onInsert, isQuick) => { const options = (0,external_wp_element_namespaceObject.useMemo)(() => ({ [isFiltered]: !!isQuick }), [isQuick]); const [items] = (0,external_wp_data_namespaceObject.useSelect)(select => [select(store).getInserterItems(rootClientId, options)], [rootClientId, options]); const { getClosestAllowedInsertionPoint } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const [categories, collections] = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCategories, getCollections } = select(external_wp_blocks_namespaceObject.store); return [getCategories(), getCollections()]; }, []); const onSelectItem = (0,external_wp_element_namespaceObject.useCallback)(({ name, initialAttributes, innerBlocks, syncStatus, content }, shouldFocusBlock) => { const destinationClientId = getClosestAllowedInsertionPoint(name, rootClientId); if (destinationClientId === null) { var _getBlockType$title; const title = (_getBlockType$title = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.title) !== null && _getBlockType$title !== void 0 ? _getBlockType$title : name; createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block pattern title. */ (0,external_wp_i18n_namespaceObject.__)('Block "%s" can\'t be inserted.'), title), { type: 'snackbar', id: 'inserter-notice' }); return; } const insertedBlock = syncStatus === 'unsynced' ? (0,external_wp_blocks_namespaceObject.parse)(content, { __unstableSkipMigrationLogs: true }) : (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks)); onInsert(insertedBlock, undefined, shouldFocusBlock, destinationClientId); }, [getClosestAllowedInsertionPoint, rootClientId, onInsert, createErrorNotice]); return [items, categories, collections, onSelectItem]; }; /* harmony default export */ const use_block_types_state = (useBlockTypesState); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function InserterListbox({ children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { focusShift: true, focusWrap: "horizontal", render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {}), children: children }); } /* harmony default export */ const inserter_listbox = (InserterListbox); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js /** * WordPress dependencies */ function InserterNoResults() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__no-results", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('No results found.') }) }); } /* harmony default export */ const no_results = (InserterNoResults); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js /** * WordPress dependencies */ /** * Internal dependencies */ const getBlockNamespace = item => item.name.split('/')[0]; const MAX_SUGGESTED_ITEMS = 6; /** * Shared reference to an empty array for cases where it is important to avoid * returning a new array reference on every invocation and rerendering the component. * * @type {Array} */ const block_types_tab_EMPTY_ARRAY = []; function BlockTypesTabPanel({ items, collections, categories, onSelectItem, onHover, showMostUsedBlocks, className }) { const suggestedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return orderBy(items, 'frecency', 'desc').slice(0, MAX_SUGGESTED_ITEMS); }, [items]); const uncategorizedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return items.filter(item => !item.category); }, [items]); const itemsPerCollection = (0,external_wp_element_namespaceObject.useMemo)(() => { // Create a new Object to avoid mutating collection. const result = { ...collections }; Object.keys(collections).forEach(namespace => { result[namespace] = items.filter(item => getBlockNamespace(item) === namespace); if (result[namespace].length === 0) { delete result[namespace]; } }); return result; }, [items, collections]); // Hide block preview on unmount. (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []); /** * The inserter contains a big number of blocks and opening it is a costful operation. * The rendering is the most costful part of it, in order to improve the responsiveness * of the "opening" action, these lazy lists allow us to render the inserter category per category, * once all the categories are rendered, we start rendering the collections and the uncategorized block types. */ const currentlyRenderedCategories = (0,external_wp_compose_namespaceObject.useAsyncList)(categories); const didRenderAllCategories = categories.length === currentlyRenderedCategories.length; // Async List requires an array. const collectionEntries = (0,external_wp_element_namespaceObject.useMemo)(() => { return Object.entries(collections); }, [collections]); const currentlyRenderedCollections = (0,external_wp_compose_namespaceObject.useAsyncList)(didRenderAllCategories ? collectionEntries : block_types_tab_EMPTY_ARRAY); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, children: [showMostUsedBlocks && // Only show the most used blocks if the total amount of block // is larger than 1 row, otherwise it is not so useful. items.length > 3 && !!suggestedItems.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { title: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { items: suggestedItems, onSelect: onSelectItem, onHover: onHover, label: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks') }) }), currentlyRenderedCategories.map(category => { const categoryItems = items.filter(item => item.category === category.slug); if (!categoryItems || !categoryItems.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { title: category.title, icon: category.icon, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { items: categoryItems, onSelect: onSelectItem, onHover: onHover, label: category.title }) }, category.slug); }), didRenderAllCategories && uncategorizedItems.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { className: "block-editor-inserter__uncategorized-blocks-panel", title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { items: uncategorizedItems, onSelect: onSelectItem, onHover: onHover, label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') }) }), currentlyRenderedCollections.map(([namespace, collection]) => { const collectionItems = itemsPerCollection[namespace]; if (!collectionItems || !collectionItems.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { title: collection.title, icon: collection.icon, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { items: collectionItems, onSelect: onSelectItem, onHover: onHover, label: collection.title }) }, namespace); })] }); } function BlockTypesTab({ rootClientId, onInsert, onHover, showMostUsedBlocks }, ref) { const [items, categories, collections, onSelectItem] = use_block_types_state(rootClientId, onInsert); if (!items.length) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); } const itemsForCurrentRoot = []; const itemsRemaining = []; for (const item of items) { // Skip reusable blocks, they moved to the patterns tab. if (item.category === 'reusable') { continue; } if (item.isAllowedInCurrentRoot) { itemsForCurrentRoot.push(item); } else { itemsRemaining.push(item); } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: ref, children: [!!itemsForCurrentRoot.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTypesTabPanel, { items: itemsForCurrentRoot, categories: categories, collections: collections, onSelectItem: onSelectItem, onHover: onHover, showMostUsedBlocks: showMostUsedBlocks, className: "block-editor-inserter__insertable-blocks-at-selection" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTypesTabPanel, { items: itemsRemaining, categories: categories, collections: collections, onSelectItem: onSelectItem, onHover: onHover, showMostUsedBlocks: showMostUsedBlocks, className: "block-editor-inserter__all-blocks" })] }) }); } /* harmony default export */ const block_types_tab = ((0,external_wp_element_namespaceObject.forwardRef)(BlockTypesTab)); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js /** * WordPress dependencies */ function PatternCategoriesList({ selectedCategory, patternCategories, onClickCategory }) { const baseClassName = 'block-editor-block-patterns-explorer__sidebar'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}__categories-list`, children: patternCategories.map(({ name, label }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, label: label, className: `${baseClassName}__categories-list__item`, isPressed: selectedCategory === name, onClick: () => { onClickCategory(name); }, children: label }, name); }) }); } function PatternsExplorerSearch({ searchValue, setSearchValue }) { const baseClassName = 'block-editor-block-patterns-explorer__search'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: baseClassName, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, onChange: setSearchValue, value: searchValue, label: (0,external_wp_i18n_namespaceObject.__)('Search'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') }) }); } function PatternExplorerSidebar({ selectedCategory, patternCategories, onClickCategory, searchValue, setSearchValue }) { const baseClassName = 'block-editor-block-patterns-explorer__sidebar'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: baseClassName, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsExplorerSearch, { searchValue: searchValue, setSearchValue: setSearchValue }), !searchValue && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoriesList, { selectedCategory: selectedCategory, patternCategories: patternCategories, onClickCategory: onClickCategory })] }); } /* harmony default export */ const pattern_explorer_sidebar = (PatternExplorerSidebar); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-paging/index.js /** * WordPress dependencies */ function Pagination({ currentPage, numPages, changePage, totalItems }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-patterns__grid-pagination-wrapper", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Total number of patterns. (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems) }), numPages > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 3, justify: "flex-start", className: "block-editor-patterns__grid-pagination", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, className: "block-editor-patterns__grid-pagination-previous", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: () => changePage(1), disabled: currentPage === 1, "aria-label": (0,external_wp_i18n_namespaceObject.__)('First page'), size: "compact", accessibleWhenDisabled: true, className: "block-editor-patterns__grid-pagination-button", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\xAB" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: () => changePage(currentPage - 1), disabled: currentPage === 1, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Previous page'), size: "compact", accessibleWhenDisabled: true, className: "block-editor-patterns__grid-pagination-button", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\u2039" }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Current page number. 2: Total number of pages. (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, className: "block-editor-patterns__grid-pagination-next", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: () => changePage(currentPage + 1), disabled: currentPage === numPages, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Next page'), size: "compact", accessibleWhenDisabled: true, className: "block-editor-patterns__grid-pagination-button", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\u203A" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: () => changePage(numPages), disabled: currentPage === numPages, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Last page'), size: "compact", accessibleWhenDisabled: true, className: "block-editor-patterns__grid-pagination-button", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\xBB" }) })] })] })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const WithToolTip = ({ showTooltip, title, children }) => { if (showTooltip) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: title, children: children }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: children }); }; function BlockPattern({ id, isDraggable, pattern, onClick, onHover, showTitlesAsTooltip, category, isSelected }) { const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false); const { blocks, viewportWidth } = pattern; const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern); const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`; const isUserPattern = pattern.type === INSERTER_PATTERN_TYPES.user; // When we have a selected category and the pattern is draggable, we need to update the // pattern's categories in metadata to only contain the selected category, and pass this to // InserterDraggableBlocks component. We do that because we use this information for pattern // shuffling and it makes more sense to show only the ones from the initially selected category during insertion. const patternBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!category || !isDraggable) { return blocks; } return (blocks !== null && blocks !== void 0 ? blocks : []).map(block => { const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block); if (clonedBlock.attributes.metadata?.categories?.includes(category)) { clonedBlock.attributes.metadata.categories = [category]; } return clonedBlock; }); }, [blocks, isDraggable, category]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks, { isEnabled: isDraggable, blocks: patternBlocks, pattern: pattern, children: ({ draggable, onDragStart, onDragEnd }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__list-item", draggable: draggable, onDragStart: event => { setIsDragging(true); if (onDragStart) { onHover?.(null); onDragStart(event); } }, onDragEnd: event => { setIsDragging(false); if (onDragEnd) { onDragEnd(event); } }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WithToolTip, { showTooltip: showTitlesAsTooltip && !isUserPattern, title: pattern.title, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "option", "aria-label": pattern.title, "aria-describedby": pattern.description ? descriptionId : undefined, className: dist_clsx('block-editor-block-patterns-list__item', { 'block-editor-block-patterns-list__list-item-synced': pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus, 'is-selected': isSelected }) }), id: id, onClick: () => { onClick(pattern, blocks); onHover?.(null); }, onMouseEnter: () => { if (isDragging) { return; } onHover?.(pattern); }, onMouseLeave: () => onHover?.(null), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview.Async, { placeholder: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPatternPlaceholder, {}), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { blocks: blocks, viewportWidth: viewportWidth }) }), (!showTitlesAsTooltip || isUserPattern) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "block-editor-patterns__pattern-details", spacing: 2, children: [isUserPattern && !pattern.syncStatus && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-patterns__pattern-icon-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { className: "block-editor-patterns__pattern-icon", icon: library_symbol }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__item-title", children: pattern.title })] }), !!pattern.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: pattern.description })] }) }) }) }); } function BlockPatternPlaceholder() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__item is-placeholder" }); } function BlockPatternsList({ isDraggable, blockPatterns, onHover, onClickPattern, orientation, label = (0,external_wp_i18n_namespaceObject.__)('Block patterns'), category, showTitlesAsTooltip, pagingProps }, ref) { const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)(undefined); const [activePattern, setActivePattern] = (0,external_wp_element_namespaceObject.useState)(null); // State to track active pattern (0,external_wp_element_namespaceObject.useEffect)(() => { // Reset the active composite item whenever the available patterns change, // to make sure that Composite widget can receive focus correctly when its // composite items change. The first composite item will receive focus. const firstCompositeItemId = blockPatterns[0]?.name; setActiveCompositeId(firstCompositeItemId); }, [blockPatterns]); const handleClickPattern = (pattern, blocks) => { setActivePattern(pattern.name); onClickPattern(pattern, blocks); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite, { orientation: orientation, activeId: activeCompositeId, setActiveId: setActiveCompositeId, role: "listbox", className: "block-editor-block-patterns-list", "aria-label": label, ref: ref, children: [blockPatterns.map(pattern => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPattern, { id: pattern.name, pattern: pattern, onClick: handleClickPattern, onHover: onHover, isDraggable: isDraggable, showTitlesAsTooltip: showTitlesAsTooltip, category: category, isSelected: !!activePattern && activePattern === pattern.name }, pattern.name)), pagingProps && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { ...pagingProps })] }); } /* harmony default export */ const block_patterns_list = ((0,external_wp_element_namespaceObject.forwardRef)(BlockPatternsList)); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-insertion-point.js /** * WordPress dependencies */ /** * Internal dependencies */ function getIndex({ destinationRootClientId, destinationIndex, rootClientId, registry }) { if (rootClientId === destinationRootClientId) { return destinationIndex; } const parents = ['', ...registry.select(store).getBlockParents(destinationRootClientId), destinationRootClientId]; const parentIndex = parents.indexOf(rootClientId); if (parentIndex !== -1) { return registry.select(store).getBlockIndex(parents[parentIndex + 1]) + 1; } return registry.select(store).getBlockOrder(rootClientId).length; } /** * @typedef WPInserterConfig * * @property {string=} rootClientId If set, insertion will be into the * block with this ID. * @property {number=} insertionIndex If set, insertion will be into this * explicit position. * @property {string=} clientId If set, insertion will be after the * block with this ID. * @property {boolean=} isAppender Whether the inserter is an appender * or not. * @property {Function=} onSelect Called after insertion. */ /** * Returns the insertion point state given the inserter config. * * @param {WPInserterConfig} config Inserter Config. * @return {Array} Insertion Point State (rootClientID, onInsertBlocks and onToggle). */ function useInsertionPoint({ rootClientId = '', insertionIndex, clientId, isAppender, onSelect, shouldFocusBlock = true, selectBlockOnInsert = true }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { getSelectedBlock, getClosestAllowedInsertionPoint, isBlockInsertionPointVisible } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { destinationRootClientId, destinationIndex } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlockClientId, getBlockRootClientId, getBlockIndex, getBlockOrder, getInsertionPoint } = unlock(select(store)); const selectedBlockClientId = getSelectedBlockClientId(); let _destinationRootClientId = rootClientId; let _destinationIndex; const insertionPoint = getInsertionPoint(); if (insertionIndex !== undefined) { // Insert into a specific index. _destinationIndex = insertionIndex; } else if (insertionPoint && insertionPoint.hasOwnProperty('index')) { _destinationRootClientId = insertionPoint?.rootClientId ? insertionPoint.rootClientId : rootClientId; _destinationIndex = insertionPoint.index; } else if (clientId) { // Insert after a specific client ID. _destinationIndex = getBlockIndex(clientId); } else if (!isAppender && selectedBlockClientId) { _destinationRootClientId = getBlockRootClientId(selectedBlockClientId); _destinationIndex = getBlockIndex(selectedBlockClientId) + 1; } else { // Insert at the end of the list. _destinationIndex = getBlockOrder(_destinationRootClientId).length; } return { destinationRootClientId: _destinationRootClientId, destinationIndex: _destinationIndex }; }, [rootClientId, insertionIndex, clientId, isAppender]); const { replaceBlocks, insertBlocks, showInsertionPoint, hideInsertionPoint, setLastFocus } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock = false, _rootClientId) => { // When we are trying to move focus or select a new block on insert, we also // need to clear the last focus to avoid the focus being set to the wrong block // when tabbing back into the canvas if the block was added from outside the // editor canvas. if (shouldForceFocusBlock || shouldFocusBlock || selectBlockOnInsert) { setLastFocus(null); } const selectedBlock = getSelectedBlock(); if (!isAppender && selectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(selectedBlock)) { replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); } else { insertBlocks(blocks, isAppender || _rootClientId === undefined ? destinationIndex : getIndex({ destinationRootClientId, destinationIndex, rootClientId: _rootClientId, registry }), isAppender || _rootClientId === undefined ? destinationRootClientId : _rootClientId, selectBlockOnInsert, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); } const blockLength = Array.isArray(blocks) ? blocks.length : 1; const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: the name of the block that has been added (0,external_wp_i18n_namespaceObject._n)('%d block added.', '%d blocks added.', blockLength), blockLength); (0,external_wp_a11y_namespaceObject.speak)(message); if (onSelect) { onSelect(blocks); } }, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock, selectBlockOnInsert]); const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)(item => { if (item && !isBlockInsertionPointVisible()) { const allowedDestinationRootClientId = getClosestAllowedInsertionPoint(item.name, destinationRootClientId); if (allowedDestinationRootClientId !== null) { showInsertionPoint(allowedDestinationRootClientId, getIndex({ destinationRootClientId, destinationIndex, rootClientId: allowedDestinationRootClientId, registry })); } } else { hideInsertionPoint(); } }, [getClosestAllowedInsertionPoint, isBlockInsertionPointVisible, showInsertionPoint, hideInsertionPoint, destinationRootClientId, destinationIndex]); return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint]; } /* harmony default export */ const use_insertion_point = (useInsertionPoint); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-state.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Retrieves the block patterns inserter state. * * @param {Function} onInsert function called when inserter a list of blocks. * @param {string=} rootClientId Insertion's root client ID. * @param {string} selectedCategory The selected pattern category. * @param {boolean} isQuick For the quick inserter render only allowed patterns. * * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler) */ const usePatternsState = (onInsert, rootClientId, selectedCategory, isQuick) => { const options = (0,external_wp_element_namespaceObject.useMemo)(() => ({ [isFiltered]: !!isQuick }), [isQuick]); const { patternCategories, patterns, userPatternCategories } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings, __experimentalGetAllowedPatterns } = unlock(select(store)); const { __experimentalUserPatternCategories, __experimentalBlockPatternCategories } = getSettings(); return { patterns: __experimentalGetAllowedPatterns(rootClientId, options), userPatternCategories: __experimentalUserPatternCategories, patternCategories: __experimentalBlockPatternCategories }; }, [rootClientId, options]); const { getClosestAllowedInsertionPointForPattern } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const allCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { const categories = [...patternCategories]; userPatternCategories?.forEach(userCategory => { if (!categories.find(existingCategory => existingCategory.name === userCategory.name)) { categories.push(userCategory); } }); return categories; }, [patternCategories, userPatternCategories]); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const onClickPattern = (0,external_wp_element_namespaceObject.useCallback)((pattern, blocks) => { const destinationRootClientId = isQuick ? rootClientId : getClosestAllowedInsertionPointForPattern(pattern, rootClientId); if (destinationRootClientId === null) { return; } const patternBlocks = pattern.type === INSERTER_PATTERN_TYPES.user && pattern.syncStatus !== 'unsynced' ? [(0,external_wp_blocks_namespaceObject.createBlock)('core/block', { ref: pattern.id })] : blocks; onInsert((patternBlocks !== null && patternBlocks !== void 0 ? patternBlocks : []).map(block => { const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block); if (clonedBlock.attributes.metadata?.categories?.includes(selectedCategory)) { clonedBlock.attributes.metadata.categories = [selectedCategory]; } return clonedBlock; }), pattern.name, false, destinationRootClientId); createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block pattern title. */ (0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'), pattern.title), { type: 'snackbar', id: 'inserter-notice' }); }, [createSuccessNotice, onInsert, selectedCategory, rootClientId, getClosestAllowedInsertionPointForPattern, isQuick]); return [patterns, allCategories, onClickPattern]; }; /* harmony default export */ const use_patterns_state = (usePatternsState); // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; var result = dist_es2015_replace(dist_es2015_replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function dist_es2015_replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-items.js /** * External dependencies */ // Default search helpers. const defaultGetName = item => item.name || ''; const defaultGetTitle = item => item.title; const defaultGetDescription = item => item.description || ''; const defaultGetKeywords = item => item.keywords || []; const defaultGetCategory = item => item.category; const defaultGetCollection = () => null; // Normalization regexes const splitRegexp = [/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase. /([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu // One uppercase followed by one uppercase and one lowercase. ]; const stripRegexp = /(\p{C}|\p{P}|\p{S})+/giu; // Anything that's not a punctuation, symbol or control/format character. // Normalization cache const extractedWords = new Map(); const normalizedStrings = new Map(); /** * Extracts words from an input string. * * @param {string} input The input string. * * @return {Array} Words, extracted from the input string. */ function extractWords(input = '') { if (extractedWords.has(input)) { return extractedWords.get(input); } const result = noCase(input, { splitRegexp, stripRegexp }).split(' ').filter(Boolean); extractedWords.set(input, result); return result; } /** * Sanitizes the search input string. * * @param {string} input The search input to normalize. * * @return {string} The normalized search input. */ function normalizeString(input = '') { if (normalizedStrings.has(input)) { return normalizedStrings.get(input); } // Disregard diacritics. // Input: "média" let result = remove_accents_default()(input); // Accommodate leading slash, matching autocomplete expectations. // Input: "/media" result = result.replace(/^\//, ''); // Lowercase. // Input: "MEDIA" result = result.toLowerCase(); normalizedStrings.set(input, result); return result; } /** * Converts the search term into a list of normalized terms. * * @param {string} input The search term to normalize. * * @return {string[]} The normalized list of search terms. */ const getNormalizedSearchTerms = (input = '') => { return extractWords(normalizeString(input)); }; const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term))); }; const searchBlockItems = (items, categories, collections, searchInput) => { const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); if (normalizedSearchTerms.length === 0) { return items; } const config = { getCategory: item => categories.find(({ slug }) => slug === item.category)?.title, getCollection: item => collections[item.name.split('/')[0]]?.title }; return searchItems(items, searchInput, config); }; /** * Filters an item list given a search term. * * @param {Array} items Item list * @param {string} searchInput Search input. * @param {Object} config Search Config. * * @return {Array} Filtered item list. */ const searchItems = (items = [], searchInput = '', config = {}) => { const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); if (normalizedSearchTerms.length === 0) { return items; } const rankedItems = items.map(item => { return [item, getItemSearchRank(item, searchInput, config)]; }).filter(([, rank]) => rank > 0); rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); return rankedItems.map(([item]) => item); }; /** * Get the search rank for a given item and a specific search term. * The better the match, the higher the rank. * If the rank equals 0, it should be excluded from the results. * * @param {Object} item Item to filter. * @param {string} searchTerm Search term. * @param {Object} config Search Config. * * @return {number} Search Rank. */ function getItemSearchRank(item, searchTerm, config = {}) { const { getName = defaultGetName, getTitle = defaultGetTitle, getDescription = defaultGetDescription, getKeywords = defaultGetKeywords, getCategory = defaultGetCategory, getCollection = defaultGetCollection } = config; const name = getName(item); const title = getTitle(item); const description = getDescription(item); const keywords = getKeywords(item); const category = getCategory(item); const collection = getCollection(item); const normalizedSearchInput = normalizeString(searchTerm); const normalizedTitle = normalizeString(title); let rank = 0; // Prefers exact matches // Then prefers if the beginning of the title matches the search term // name, keywords, categories, collection, variations match come later. if (normalizedSearchInput === normalizedTitle) { rank += 30; } else if (normalizedTitle.startsWith(normalizedSearchInput)) { rank += 20; } else { const terms = [name, title, description, ...keywords, category, collection].join(' '); const normalizedSearchTerms = extractWords(normalizedSearchInput); const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms); if (unmatchedTerms.length === 0) { rank += 10; } } // Give a better rank to "core" namespaced items. if (rank !== 0 && name.startsWith('core/')) { const isCoreBlockVariation = name !== item.id; // Give a bit better rank to "core" blocks over "core" block variations. rank += isCoreBlockVariation ? 1 : 2; } return rank; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-paging.js /** * WordPress dependencies */ const PAGE_SIZE = 20; /** * Supplies values needed to page the patterns list client side. * * @param {Array} currentCategoryPatterns An array of the current patterns to display. * @param {string} currentCategory The currently selected category. * @param {Object} scrollContainerRef Ref of container to to find scroll container for when moving between pages. * @param {string} currentFilter The currently search filter. * * @return {Object} Returns the relevant paging values. (totalItems, categoryPatternsList, numPages, changePage, currentPage) */ function usePatternsPaging(currentCategoryPatterns, currentCategory, scrollContainerRef, currentFilter = '') { const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1); const previousCategory = (0,external_wp_compose_namespaceObject.usePrevious)(currentCategory); const previousFilter = (0,external_wp_compose_namespaceObject.usePrevious)(currentFilter); if ((previousCategory !== currentCategory || previousFilter !== currentFilter) && currentPage !== 1) { setCurrentPage(1); } const totalItems = currentCategoryPatterns.length; const pageIndex = currentPage - 1; const categoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { return currentCategoryPatterns.slice(pageIndex * PAGE_SIZE, pageIndex * PAGE_SIZE + PAGE_SIZE); }, [pageIndex, currentCategoryPatterns]); const numPages = Math.ceil(currentCategoryPatterns.length / PAGE_SIZE); const changePage = page => { const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(scrollContainerRef?.current); scrollContainer?.scrollTo(0, 0); setCurrentPage(page); }; (0,external_wp_element_namespaceObject.useEffect)(function scrollToTopOnCategoryChange() { const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(scrollContainerRef?.current); scrollContainer?.scrollTo(0, 0); }, [currentCategory, scrollContainerRef]); return { totalItems, categoryPatterns, numPages, changePage, currentPage }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-list.js /** * WordPress dependencies */ /** * Internal dependencies */ function PatternsListHeader({ filterValue, filteredBlockPatternsLength }) { if (!filterValue) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, lineHeight: "48px", className: "block-editor-block-patterns-explorer__search-results-count", children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of patterns. */ (0,external_wp_i18n_namespaceObject._n)('%d pattern found', '%d patterns found', filteredBlockPatternsLength), filteredBlockPatternsLength) }); } function PatternList({ searchValue, selectedCategory, patternCategories, rootClientId, onModalClose }) { const container = (0,external_wp_element_namespaceObject.useRef)(); const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ rootClientId, shouldFocusBlock: true }); const [patterns,, onClickPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId, selectedCategory); const registeredPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => patternCategories.map(patternCategory => patternCategory.name), [patternCategories]); const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { const filteredPatterns = patterns.filter(pattern => { if (selectedCategory === allPatternsCategory.name) { return true; } if (selectedCategory === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) { return true; } if (selectedCategory === starterPatternsCategory.name && pattern.blockTypes?.includes('core/post-content')) { return true; } if (selectedCategory === 'uncategorized') { var _pattern$categories$s; const hasKnownCategory = (_pattern$categories$s = pattern.categories?.some(category => registeredPatternCategories.includes(category))) !== null && _pattern$categories$s !== void 0 ? _pattern$categories$s : false; return !pattern.categories?.length || !hasKnownCategory; } return pattern.categories?.includes(selectedCategory); }); if (!searchValue) { return filteredPatterns; } return searchItems(filteredPatterns, searchValue); }, [searchValue, patterns, selectedCategory, registeredPatternCategories]); // Announce search results on change. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!searchValue) { return; } const count = filteredBlockPatterns.length; const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); debouncedSpeak(resultsFoundMessage); }, [searchValue, debouncedSpeak, filteredBlockPatterns.length]); const pagingProps = usePatternsPaging(filteredBlockPatterns, selectedCategory, container); // Reset page when search value changes. const [previousSearchValue, setPreviousSearchValue] = (0,external_wp_element_namespaceObject.useState)(searchValue); if (searchValue !== previousSearchValue) { setPreviousSearchValue(searchValue); pagingProps.changePage(1); } const hasItems = !!filteredBlockPatterns?.length; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-patterns-explorer__list", ref: container, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsListHeader, { filterValue: searchValue, filteredBlockPatternsLength: filteredBlockPatterns.length }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox, { children: hasItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_list, { blockPatterns: pagingProps.categoryPatterns, onClickPattern: (pattern, blocks) => { onClickPattern(pattern, blocks); onModalClose(); }, isDraggable: false }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { ...pagingProps })] }) })] }); } /* harmony default export */ const pattern_list = (PatternList); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js /** * WordPress dependencies */ /** * Internal dependencies */ function hasRegisteredCategory(pattern, allCategories) { if (!pattern.categories || !pattern.categories.length) { return false; } return pattern.categories.some(cat => allCategories.some(category => category.name === cat)); } function usePatternCategories(rootClientId, sourceFilter = 'all') { const [patterns, allCategories] = use_patterns_state(undefined, rootClientId); const filteredPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => sourceFilter === 'all' ? patterns : patterns.filter(pattern => !isPatternFiltered(pattern, sourceFilter)), [sourceFilter, patterns]); // Remove any empty categories. const populatedCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { const categories = allCategories.filter(category => filteredPatterns.some(pattern => pattern.categories?.includes(category.name))).sort((a, b) => a.label.localeCompare(b.label)); if (filteredPatterns.some(pattern => !hasRegisteredCategory(pattern, allCategories)) && !categories.find(category => category.name === 'uncategorized')) { categories.push({ name: 'uncategorized', label: (0,external_wp_i18n_namespaceObject._x)('Uncategorized') }); } if (filteredPatterns.some(pattern => pattern.blockTypes?.includes('core/post-content'))) { categories.unshift(starterPatternsCategory); } if (filteredPatterns.some(pattern => pattern.type === INSERTER_PATTERN_TYPES.user)) { categories.unshift(myPatternsCategory); } if (filteredPatterns.length > 0) { categories.unshift({ name: allPatternsCategory.name, label: allPatternsCategory.label }); } (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of categories . */ (0,external_wp_i18n_namespaceObject._n)('%d category button displayed.', '%d category buttons displayed.', categories.length), categories.length)); return categories; }, [allCategories, filteredPatterns]); return populatedCategories; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function PatternsExplorer({ initialCategory, rootClientId, onModalClose }) { const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(''); const [selectedCategory, setSelectedCategory] = (0,external_wp_element_namespaceObject.useState)(initialCategory?.name); const patternCategories = usePatternCategories(rootClientId); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-patterns-explorer", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_explorer_sidebar, { selectedCategory: selectedCategory, patternCategories: patternCategories, onClickCategory: setSelectedCategory, searchValue: searchValue, setSearchValue: setSearchValue }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_list, { searchValue: searchValue, selectedCategory: selectedCategory, patternCategories: patternCategories, rootClientId: rootClientId, onModalClose: onModalClose })] }); } function PatternsExplorerModal({ onModalClose, ...restProps }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Patterns'), onRequestClose: onModalClose, isFullScreen: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsExplorer, { onModalClose: onModalClose, ...restProps }) }); } /* harmony default export */ const block_patterns_explorer = (PatternsExplorerModal); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/mobile-tab-navigation.js /** * WordPress dependencies */ function ScreenHeader({ title }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 0, paddingX: 4, paddingY: 3, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { style: // TODO: This style override is also used in ToolsPanelHeader. // It should be supported out-of-the-box by Button. { minWidth: 24, padding: 0 }, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, size: "small", label: (0,external_wp_i18n_namespaceObject.__)('Back') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 5, children: title }) })] }) }) }) }); } function MobileTabNavigation({ categories, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { initialPath: "/", className: "block-editor-inserter__mobile-tab-navigation", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Button, { path: `/category/${category.name}`, as: external_wp_components_namespaceObject.__experimentalItem, isAction: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: category.label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right })] }) }, category.name)) }) }), categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: `/category/${category.name}`, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Back') }), children(category)] }, category.name))] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/patterns-filter.js /** * WordPress dependencies */ /** * Internal dependencies */ const getShouldDisableSyncFilter = sourceFilter => sourceFilter !== 'all' && sourceFilter !== 'user'; const getShouldHideSourcesFilter = category => { return category.name === myPatternsCategory.name; }; const PATTERN_SOURCE_MENU_OPTIONS = [{ value: 'all', label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns') }, { value: INSERTER_PATTERN_TYPES.directory, label: (0,external_wp_i18n_namespaceObject.__)('Pattern Directory') }, { value: INSERTER_PATTERN_TYPES.theme, label: (0,external_wp_i18n_namespaceObject.__)('Theme & Plugins') }, { value: INSERTER_PATTERN_TYPES.user, label: (0,external_wp_i18n_namespaceObject.__)('User') }]; function PatternsFilter({ setPatternSyncFilter, setPatternSourceFilter, patternSyncFilter, patternSourceFilter, scrollContainerRef, category }) { // If the category is `myPatterns` then we need to set the source filter to `user`, but // we do this by deriving from props rather than calling setPatternSourceFilter otherwise // the user may be confused when switching to another category if the haven't explicitly set // this filter themselves. const currentPatternSourceFilter = category.name === myPatternsCategory.name ? INSERTER_PATTERN_TYPES.user : patternSourceFilter; // We need to disable the sync filter option if the source filter is not 'all' or 'user' // otherwise applying them will just result in no patterns being shown. const shouldDisableSyncFilter = getShouldDisableSyncFilter(currentPatternSourceFilter); // We also hide the directory and theme source filter if the category is `myPatterns` // otherwise there will only be one option available. const shouldHideSourcesFilter = getShouldHideSourcesFilter(category); const patternSyncMenuOptions = (0,external_wp_element_namespaceObject.useMemo)(() => [{ value: 'all', label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns') }, { value: INSERTER_SYNC_TYPES.full, label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'patterns'), disabled: shouldDisableSyncFilter }, { value: INSERTER_SYNC_TYPES.unsynced, label: (0,external_wp_i18n_namespaceObject._x)('Not synced', 'patterns'), disabled: shouldDisableSyncFilter }], [shouldDisableSyncFilter]); function handleSetSourceFilterChange(newSourceFilter) { setPatternSourceFilter(newSourceFilter); if (getShouldDisableSyncFilter(newSourceFilter)) { setPatternSyncFilter('all'); } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { popoverProps: { placement: 'right-end' }, label: (0,external_wp_i18n_namespaceObject.__)('Filter patterns'), toggleProps: { size: 'compact' }, icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z", fill: "currentColor" }) }) }), children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!shouldHideSourcesFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Source'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { choices: PATTERN_SOURCE_MENU_OPTIONS, onSelect: value => { handleSetSourceFilterChange(value); scrollContainerRef.current?.scrollTo(0, 0); }, value: currentPatternSourceFilter }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Type'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { choices: patternSyncMenuOptions, onSelect: value => { setPatternSyncFilter(value); scrollContainerRef.current?.scrollTo(0, 0); }, value: patternSyncFilter }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__patterns-filter-help", children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced.'), { Link: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/patterns/') }) }) })] }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js /** * WordPress dependencies */ /** * Internal dependencies */ const pattern_category_previews_noop = () => {}; function PatternCategoryPreviews({ rootClientId, onInsert, onHover = pattern_category_previews_noop, category, showTitlesAsTooltip }) { const [allPatterns,, onClickPattern] = use_patterns_state(onInsert, rootClientId, category?.name); const [patternSyncFilter, setPatternSyncFilter] = (0,external_wp_element_namespaceObject.useState)('all'); const [patternSourceFilter, setPatternSourceFilter] = (0,external_wp_element_namespaceObject.useState)('all'); const availableCategories = usePatternCategories(rootClientId, patternSourceFilter); const scrollContainerRef = (0,external_wp_element_namespaceObject.useRef)(); const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => allPatterns.filter(pattern => { if (isPatternFiltered(pattern, patternSourceFilter, patternSyncFilter)) { return false; } if (category.name === allPatternsCategory.name) { return true; } if (category.name === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) { return true; } if (category.name === starterPatternsCategory.name && pattern.blockTypes?.includes('core/post-content')) { return true; } if (category.name === 'uncategorized') { // The uncategorized category should show all the patterns without any category... if (!pattern.categories) { return true; } // ...or with no available category. return !pattern.categories.some(catName => availableCategories.some(c => c.name === catName)); } return pattern.categories?.includes(category.name); }), [allPatterns, availableCategories, category.name, patternSourceFilter, patternSyncFilter]); const pagingProps = usePatternsPaging(currentCategoryPatterns, category, scrollContainerRef); const { changePage } = pagingProps; // Hide block pattern preview on unmount. (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []); const onSetPatternSyncFilter = (0,external_wp_element_namespaceObject.useCallback)(value => { setPatternSyncFilter(value); changePage(1); }, [setPatternSyncFilter, changePage]); const onSetPatternSourceFilter = (0,external_wp_element_namespaceObject.useCallback)(value => { setPatternSourceFilter(value); changePage(1); }, [setPatternSourceFilter, changePage]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, className: "block-editor-inserter__patterns-category-panel-header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { className: "block-editor-inserter__patterns-category-panel-title", size: 13, level: 4, as: "div", children: category.label }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsFilter, { patternSyncFilter: patternSyncFilter, patternSourceFilter: patternSourceFilter, setPatternSyncFilter: onSetPatternSyncFilter, setPatternSourceFilter: onSetPatternSourceFilter, scrollContainerRef: scrollContainerRef, category: category })] }), !currentCategoryPatterns.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", className: "block-editor-inserter__patterns-category-no-results", children: (0,external_wp_i18n_namespaceObject.__)('No results found') })] }), currentCategoryPatterns.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { size: "12", as: "p", className: "block-editor-inserter__help-text", children: (0,external_wp_i18n_namespaceObject.__)('Drag and drop patterns into the canvas.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_list, { ref: scrollContainerRef, blockPatterns: pagingProps.categoryPatterns, onClickPattern: onClickPattern, onHover: onHover, label: category.label, orientation: "vertical", category: category.name, isDraggable: true, showTitlesAsTooltip: showTitlesAsTooltip, patternFilter: patternSourceFilter, pagingProps: pagingProps })] })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/category-tabs/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Tabs: category_tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function CategoryTabs({ categories, selectedCategory, onSelectCategory, children }) { // Copied from InterfaceSkeleton. const ANIMATION_DURATION = 0.25; const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const defaultTransition = { type: 'tween', duration: disableMotion ? 0 : ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; const previousSelectedCategory = (0,external_wp_compose_namespaceObject.usePrevious)(selectedCategory); const selectedTabId = selectedCategory ? selectedCategory.name : null; const [activeTabId, setActiveId] = (0,external_wp_element_namespaceObject.useState)(); const firstTabId = categories?.[0]?.name; // If there is no active tab, make the first tab the active tab, so that // when focus is moved to the tablist, the first tab will be focused // despite not being selected if (selectedTabId === null && !activeTabId && firstTabId) { setActiveId(firstTabId); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(category_tabs_Tabs, { selectOnMove: false, selectedTabId: selectedTabId, orientation: "vertical", onSelect: categoryId => { // Pass the full category object onSelectCategory(categories.find(category => category.name === categoryId)); }, activeTabId: activeTabId, onActiveTabIdChange: setActiveId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.TabList, { className: "block-editor-inserter__category-tablist", children: categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.Tab, { tabId: category.name, "aria-current": category === selectedCategory ? 'true' : undefined, children: category.label }, category.name)) }), categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.TabPanel, { tabId: category.name, focusable: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { className: "block-editor-inserter__category-panel", initial: !previousSelectedCategory ? 'closed' : 'open', animate: "open", variants: { open: { transform: 'translateX( 0 )', transitionEnd: { zIndex: '1' } }, closed: { transform: 'translateX( -100% )', zIndex: '-1' } }, transition: defaultTransition, children: children }) }, category.name))] }); } /* harmony default export */ const category_tabs = (CategoryTabs); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockPatternsTab({ onSelectCategory, selectedCategory, onInsert, rootClientId, children }) { const [showPatternsExplorer, setShowPatternsExplorer] = (0,external_wp_element_namespaceObject.useState)(false); const categories = usePatternCategories(rootClientId); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); if (!categories.length) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__block-patterns-tabs-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs, { categories: categories, selectedCategory: selectedCategory, onSelectCategory: onSelectCategory, children: children }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-inserter__patterns-explore-button", onClick: () => setShowPatternsExplorer(true), variant: "secondary", children: (0,external_wp_i18n_namespaceObject.__)('Explore all patterns') })] }), isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, { categories: categories, children: category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__category-panel", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviews, { onInsert: onInsert, rootClientId: rootClientId, category: category }, category.name) }) }), showPatternsExplorer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_explorer, { initialCategory: selectedCategory || categories[0], patternCategories: categories, onModalClose: () => setShowPatternsExplorer(false), rootClientId: rootClientId })] }); } /* harmony default export */ const block_patterns_tab = (BlockPatternsTab); ;// ./node_modules/@wordpress/icons/build-module/library/external.js /** * WordPress dependencies */ const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); /* harmony default export */ const library_external = (external); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/utils.js /** * WordPress dependencies */ const mediaTypeTag = { image: 'img', video: 'video', audio: 'audio' }; /** @typedef {import('./hooks').InserterMediaItem} InserterMediaItem */ /** * Creates a block and a preview element from a media object. * * @param {InserterMediaItem} media The media object to create the block from. * @param {('image'|'audio'|'video')} mediaType The media type to create the block for. * @return {[WPBlock, JSX.Element]} An array containing the block and the preview element. */ function getBlockAndPreviewFromMedia(media, mediaType) { // Add the common attributes between the different media types. const attributes = { id: media.id || undefined, caption: media.caption || undefined }; const mediaSrc = media.url; const alt = media.alt || undefined; if (mediaType === 'image') { attributes.url = mediaSrc; attributes.alt = alt; } else if (['video', 'audio'].includes(mediaType)) { attributes.src = mediaSrc; } const PreviewTag = mediaTypeTag[mediaType]; const preview = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTag, { src: media.previewUrl || mediaSrc, alt: alt, controls: mediaType === 'audio' ? true : undefined, inert: "true", onError: ({ currentTarget }) => { // Fall back to the media source if the preview cannot be loaded. if (currentTarget.src === media.previewUrl) { currentTarget.src = mediaSrc; } } }); return [(0,external_wp_blocks_namespaceObject.createBlock)(`core/${mediaType}`, attributes), preview]; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-preview.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ALLOWED_MEDIA_TYPES = ['image']; const MEDIA_OPTIONS_POPOVER_PROPS = { position: 'bottom left', className: 'block-editor-inserter__media-list__item-preview-options__popover' }; function MediaPreviewOptions({ category, media }) { if (!category.getReportUrl) { return null; } const reportUrl = category.getReportUrl(media); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { className: "block-editor-inserter__media-list__item-preview-options", label: (0,external_wp_i18n_namespaceObject.__)('Options'), popoverProps: MEDIA_OPTIONS_POPOVER_PROPS, icon: more_vertical, children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => window.open(reportUrl, '_blank').focus(), icon: library_external, children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The media type to report e.g: "image", "video", "audio" */ (0,external_wp_i18n_namespaceObject.__)('Report %s'), category.mediaType) }) }) }); } function InsertExternalImageModal({ onClose, onSubmit }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Insert external image'), onRequestClose: onClose, className: "block-editor-inserter-media-tab-media-preview-inserter-external-image-modal", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation.') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { className: "block-editor-block-lock-modal__actions", justify: "flex-end", expanded: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: onSubmit, children: (0,external_wp_i18n_namespaceObject.__)('Insert') }) })] })] }); } function MediaPreview({ media, onClick, category }) { const [showExternalUploadModal, setShowExternalUploadModal] = (0,external_wp_element_namespaceObject.useState)(false); const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); const [isInserting, setIsInserting] = (0,external_wp_element_namespaceObject.useState)(false); const [block, preview] = (0,external_wp_element_namespaceObject.useMemo)(() => getBlockAndPreviewFromMedia(media, category.mediaType), [media, category.mediaType]); const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { getSettings, getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onMediaInsert = (0,external_wp_element_namespaceObject.useCallback)(previewBlock => { // Prevent multiple uploads when we're in the process of inserting. if (isInserting) { return; } const settings = getSettings(); const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(previewBlock); const { id, url, caption } = clonedBlock.attributes; // User has no permission to upload media. if (!id && !settings.mediaUpload) { setShowExternalUploadModal(true); return; } // Media item already exists in library, so just insert it. if (!!id) { onClick(clonedBlock); return; } setIsInserting(true); // Media item does not exist in library, so try to upload it. // Fist fetch the image data. This may fail if the image host // doesn't allow CORS with the domain. // If this happens, we insert the image block using the external // URL and let the user know about the possible implications. window.fetch(url).then(response => response.blob()).then(blob => { const fileName = (0,external_wp_url_namespaceObject.getFilename)(url) || 'image.jpg'; const file = new File([blob], fileName, { type: blob.type }); settings.mediaUpload({ filesList: [file], additionalData: { caption }, onFileChange([img]) { if ((0,external_wp_blob_namespaceObject.isBlobURL)(img.url)) { return; } if (!getBlock(clonedBlock.clientId)) { // Ensure the block is only inserted once. onClick({ ...clonedBlock, attributes: { ...clonedBlock.attributes, id: img.id, url: img.url } }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Image uploaded and inserted.'), { type: 'snackbar', id: 'inserter-notice' }); } else { // For subsequent calls, update the existing block. updateBlockAttributes(clonedBlock.clientId, { ...clonedBlock.attributes, id: img.id, url: img.url }); } setIsInserting(false); }, allowedTypes: ALLOWED_MEDIA_TYPES, onError(message) { createErrorNotice(message, { type: 'snackbar', id: 'inserter-notice' }); setIsInserting(false); } }); }).catch(() => { setShowExternalUploadModal(true); setIsInserting(false); }); }, [isInserting, getSettings, onClick, createSuccessNotice, updateBlockAttributes, createErrorNotice, getBlock]); const title = typeof media.title === 'string' ? media.title : media.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('no title'); const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(true), []); const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(false), []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks, { isEnabled: true, blocks: [block], children: ({ draggable, onDragStart, onDragEnd }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('block-editor-inserter__media-list__list-item', { 'is-hovered': isHovered }), draggable: draggable, onDragStart: onDragStart, onDragEnd: onDragEnd, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: title, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-label": title, role: "option", className: "block-editor-inserter__media-list__item" }), onClick: () => onMediaInsert(block), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__media-list__item-preview", children: [preview, isInserting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__media-list__item-preview-spinner", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })] }) }) }), !isInserting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaPreviewOptions, { category: category, media: media })] }) }) }), showExternalUploadModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InsertExternalImageModal, { onClose: () => setShowExternalUploadModal(false), onSubmit: () => { onClick((0,external_wp_blocks_namespaceObject.cloneBlock)(block)); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Image inserted.'), { type: 'snackbar', id: 'inserter-notice' }); setShowExternalUploadModal(false); } })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-list.js /** * WordPress dependencies */ /** * Internal dependencies */ function MediaList({ mediaList, category, onClick, label = (0,external_wp_i18n_namespaceObject.__)('Media List') }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { role: "listbox", className: "block-editor-inserter__media-list", "aria-label": label, children: mediaList.map((media, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaPreview, { media: media, category: category, onClick: onClick }, media.id || media.sourceId || index)) }); } /* harmony default export */ const media_list = (MediaList); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/hooks.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('../../../store/actions').InserterMediaRequest} InserterMediaRequest */ /** @typedef {import('../../../store/actions').InserterMediaItem} InserterMediaItem */ /** * Fetches media items based on the provided category. * Each media category is responsible for providing a `fetch` function. * * @param {Object} category The media category to fetch results for. * @param {InserterMediaRequest} query The query args to use for the request. * @return {InserterMediaItem[]} The media results. */ function useMediaResults(category, query = {}) { const [mediaList, setMediaList] = (0,external_wp_element_namespaceObject.useState)(); const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); // We need to keep track of the last request made because // multiple request can be fired without knowing the order // of resolution, and we need to ensure we are showing // the results of the last request. // In the future we could use AbortController to cancel previous // requests, but we don't for now as it involves adding support // for this to `core-data` package. const lastRequestRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { (async () => { const key = JSON.stringify({ category: category.name, ...query }); lastRequestRef.current = key; setIsLoading(true); setMediaList([]); // Empty the previous results. const _media = await category.fetch?.(query); if (key === lastRequestRef.current) { setMediaList(_media); setIsLoading(false); } })(); }, [category.name, ...Object.values(query)]); return { mediaList, isLoading }; } function useMediaCategories(rootClientId) { const [categories, setCategories] = (0,external_wp_element_namespaceObject.useState)([]); const inserterMediaCategories = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getInserterMediaCategories(), []); const { canInsertImage, canInsertVideo, canInsertAudio } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canInsertBlockType } = select(store); return { canInsertImage: canInsertBlockType('core/image', rootClientId), canInsertVideo: canInsertBlockType('core/video', rootClientId), canInsertAudio: canInsertBlockType('core/audio', rootClientId) }; }, [rootClientId]); (0,external_wp_element_namespaceObject.useEffect)(() => { (async () => { const _categories = []; // If `inserterMediaCategories` is not defined in // block editor settings, do not show any media categories. if (!inserterMediaCategories) { return; } // Loop through categories to check if they have at least one media item. const categoriesHaveMedia = new Map(await Promise.all(inserterMediaCategories.map(async category => { // Some sources are external and we don't need to make a request. if (category.isExternalResource) { return [category.name, true]; } let results = []; try { results = await category.fetch({ per_page: 1 }); } catch (e) { // If the request fails, we shallow the error and just don't show // the category, in order to not break the media tab. } return [category.name, !!results.length]; }))); // We need to filter out categories that don't have any media items or // whose corresponding block type is not allowed to be inserted, based // on the category's `mediaType`. const canInsertMediaType = { image: canInsertImage, video: canInsertVideo, audio: canInsertAudio }; inserterMediaCategories.forEach(category => { if (canInsertMediaType[category.mediaType] && categoriesHaveMedia.get(category.name)) { _categories.push(category); } }); if (!!_categories.length) { setCategories(_categories); } })(); }, [canInsertImage, canInsertVideo, canInsertAudio, inserterMediaCategories]); return categories; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const INITIAL_MEDIA_ITEMS_PER_PAGE = 10; function MediaCategoryPanel({ rootClientId, onInsert, category }) { const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(); const { mediaList, isLoading } = useMediaResults(category, { per_page: !!debouncedSearch ? 20 : INITIAL_MEDIA_ITEMS_PER_PAGE, search: debouncedSearch }); const baseCssClass = 'block-editor-inserter__media-panel'; const searchLabel = category.labels.search_items || (0,external_wp_i18n_namespaceObject.__)('Search'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: baseCssClass, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, className: `${baseCssClass}-search`, onChange: setSearch, value: search, label: searchLabel, placeholder: searchLabel }), isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseCssClass}-spinner`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }), !isLoading && !mediaList?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}), !isLoading && !!mediaList?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_list, { rootClientId: rootClientId, onClick: onInsert, mediaList: mediaList, category: category })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-tab.js /** * WordPress dependencies */ /** * Internal dependencies */ const media_tab_ALLOWED_MEDIA_TYPES = ['image', 'video', 'audio']; function MediaTab({ rootClientId, selectedCategory, onSelectCategory, onInsert, children }) { const mediaCategories = useMediaCategories(rootClientId); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const baseCssClass = 'block-editor-inserter__media-tabs'; const onSelectMedia = (0,external_wp_element_namespaceObject.useCallback)(media => { if (!media?.url) { return; } const [block] = getBlockAndPreviewFromMedia(media, media.type); onInsert(block); }, [onInsert]); const categories = (0,external_wp_element_namespaceObject.useMemo)(() => mediaCategories.map(mediaCategory => ({ ...mediaCategory, label: mediaCategory.labels.name })), [mediaCategories]); if (!categories.length) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: `${baseCssClass}-container`, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs, { categories: categories, selectedCategory: selectedCategory, onSelectCategory: onSelectCategory, children: children }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(check, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_upload, { multiple: false, onSelect: onSelectMedia, allowedTypes: media_tab_ALLOWED_MEDIA_TYPES, render: ({ open }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: event => { // Safari doesn't emit a focus event on button elements when // clicked and we need to manually focus the button here. // The reason is that core's Media Library modal explicitly triggers a // focus event and therefore a `blur` event is triggered on a different // element, which doesn't contain the `data-unstable-ignore-focus-outside-for-relatedtarget` // attribute making the Inserter dialog to close. event.target.focus(); open(); }, className: "block-editor-inserter__media-library-button", variant: "secondary", "data-unstable-ignore-focus-outside-for-relatedtarget": ".media-modal", children: (0,external_wp_i18n_namespaceObject.__)('Open Media Library') }) }) })] }), isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, { categories: categories, children: category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaCategoryPanel, { onInsert: onInsert, rootClientId: rootClientId, category: category }) })] }); } /* harmony default export */ const media_tab = (MediaTab); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-menu-extension/index.js /** * WordPress dependencies */ const { Fill: __unstableInserterMenuExtension, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableInserterMenuExtension'); __unstableInserterMenuExtension.Slot = Slot; /* harmony default export */ const inserter_menu_extension = (__unstableInserterMenuExtension); ;// ./node_modules/@wordpress/block-editor/build-module/utils/order-inserter-block-items.js /** @typedef {import('../store/selectors').WPEditorInserterItem} WPEditorInserterItem */ /** * Helper function to order inserter block items according to a provided array of prioritized blocks. * * @param {WPEditorInserterItem[]} items The array of editor inserter block items to be sorted. * @param {string[]} priority The array of block names to be prioritized. * @return {WPEditorInserterItem[]} The sorted array of editor inserter block items. */ const orderInserterBlockItems = (items, priority) => { if (!priority) { return items; } items.sort(({ id: aName }, { id: bName }) => { // Sort block items according to `priority`. let aIndex = priority.indexOf(aName); let bIndex = priority.indexOf(bName); // All other block items should come after that. if (aIndex < 0) { aIndex = priority.length; } if (bIndex < 0) { bIndex = priority.length; } return aIndex - bIndex; }); return items; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-results.js /** * WordPress dependencies */ /** * Internal dependencies */ const INITIAL_INSERTER_RESULTS = 9; /** * Shared reference to an empty array for cases where it is important to avoid * returning a new array reference on every invocation and rerendering the component. * * @type {Array} */ const search_results_EMPTY_ARRAY = []; function InserterSearchResults({ filterValue, onSelect, onHover, onHoverPattern, rootClientId, clientId, isAppender, __experimentalInsertionIndex, maxBlockPatterns, maxBlockTypes, showBlockDirectory = false, isDraggable = true, shouldFocusBlock = true, prioritizePatterns, selectBlockOnInsert, isQuick }) { const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const { prioritizedBlocks } = (0,external_wp_data_namespaceObject.useSelect)(select => { const blockListSettings = select(store).getBlockListSettings(rootClientId); return { prioritizedBlocks: blockListSettings?.prioritizedInserterBlocks || search_results_EMPTY_ARRAY }; }, [rootClientId]); const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ onSelect, rootClientId, clientId, isAppender, insertionIndex: __experimentalInsertionIndex, shouldFocusBlock, selectBlockOnInsert }); const [blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType] = use_block_types_state(destinationRootClientId, onInsertBlocks, isQuick); const [patterns,, onClickPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId, undefined, isQuick); const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { if (maxBlockPatterns === 0) { return []; } const results = searchItems(patterns, filterValue); return maxBlockPatterns !== undefined ? results.slice(0, maxBlockPatterns) : results; }, [filterValue, patterns, maxBlockPatterns]); let maxBlockTypesToShow = maxBlockTypes; if (prioritizePatterns && filteredBlockPatterns.length > 2) { maxBlockTypesToShow = 0; } const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { if (maxBlockTypesToShow === 0) { return []; } const nonPatternBlockTypes = blockTypes.filter(blockType => blockType.name !== 'core/block'); let orderedItems = orderBy(nonPatternBlockTypes, 'frecency', 'desc'); if (!filterValue && prioritizedBlocks.length) { orderedItems = orderInserterBlockItems(orderedItems, prioritizedBlocks); } const results = searchBlockItems(orderedItems, blockTypeCategories, blockTypeCollections, filterValue); return maxBlockTypesToShow !== undefined ? results.slice(0, maxBlockTypesToShow) : results; }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypesToShow, prioritizedBlocks]); // Announce search results on change. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!filterValue) { return; } const count = filteredBlockTypes.length + filteredBlockPatterns.length; const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); debouncedSpeak(resultsFoundMessage); }, [filterValue, debouncedSpeak, filteredBlockTypes, filteredBlockPatterns]); const currentShownBlockTypes = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockTypes, { step: INITIAL_INSERTER_RESULTS }); const hasItems = filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0; const blocksUI = !!filteredBlockTypes.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { title: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)('Blocks') }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { items: currentShownBlockTypes, onSelect: onSelectBlockType, onHover: onHover, label: (0,external_wp_i18n_namespaceObject.__)('Blocks'), isDraggable: isDraggable }) }); const patternsUI = !!filteredBlockPatterns.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { title: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)('Block patterns') }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-patterns", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_list, { blockPatterns: filteredBlockPatterns, onClickPattern: onClickPattern, onHover: onHoverPattern, isDraggable: isDraggable }) }) }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(inserter_listbox, { children: [!showBlockDirectory && !hasItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}), prioritizePatterns ? patternsUI : blocksUI, !!filteredBlockTypes.length && !!filteredBlockPatterns.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }), prioritizePatterns ? blocksUI : patternsUI, showBlockDirectory && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_menu_extension.Slot, { fillProps: { onSelect: onSelectBlockType, onHover, filterValue, hasItems, rootClientId: destinationRootClientId }, children: fills => { if (fills.length) { return fills; } if (!hasItems) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); } return null; } })] }); } /* harmony default export */ const inserter_search_results = (InserterSearchResults); ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js /** * WordPress dependencies */ const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); /* harmony default export */ const close_small = (closeSmall); ;// ./node_modules/@wordpress/block-editor/build-module/components/tabbed-sidebar/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Tabs: tabbed_sidebar_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); /** * A component that creates a tabbed sidebar with a close button. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/tabbed-sidebar/README.md * * @example * ```jsx * function MyTabbedSidebar() { * return ( * <TabbedSidebar * tabs={ [ * { * name: 'tab1', * title: 'Settings', * panel: <PanelContents />, * } * ] } * onClose={ () => {} } * onSelect={ () => {} } * defaultTabId="tab1" * selectedTab="tab1" * closeButtonLabel="Close sidebar" * /> * ); * } * ``` * * @param {Object} props Component props. * @param {string} [props.defaultTabId] The ID of the tab to be selected by default when the component renders. * @param {Function} props.onClose Function called when the close button is clicked. * @param {Function} props.onSelect Function called when a tab is selected. Receives the selected tab's ID as an argument. * @param {string} props.selectedTab The ID of the currently selected tab. * @param {Array} props.tabs Array of tab objects. Each tab should have: name (string), title (string), * panel (React.Node), and optionally panelRef (React.Ref). * @param {string} props.closeButtonLabel Accessibility label for the close button. * @param {Object} ref Forward ref to the tabs list element. * @return {Element} The tabbed sidebar component. */ function TabbedSidebar({ defaultTabId, onClose, onSelect, selectedTab, tabs, closeButtonLabel }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-tabbed-sidebar", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(tabbed_sidebar_Tabs, { selectOnMove: false, defaultTabId: defaultTabId, onSelect: onSelect, selectedTabId: selectedTab, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-tabbed-sidebar__tablist-and-close-button", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "block-editor-tabbed-sidebar__close-button", icon: close_small, label: closeButtonLabel, onClick: () => onClose(), size: "compact" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tabbed_sidebar_Tabs.TabList, { className: "block-editor-tabbed-sidebar__tablist", ref: ref, children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tabbed_sidebar_Tabs.Tab, { tabId: tab.name, className: "block-editor-tabbed-sidebar__tab", children: tab.title }, tab.name)) })] }), tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tabbed_sidebar_Tabs.TabPanel, { tabId: tab.name, focusable: false, className: "block-editor-tabbed-sidebar__tabpanel", ref: tab.panelRef, children: tab.panel }, tab.name))] }) }); } /* harmony default export */ const tabbed_sidebar = ((0,external_wp_element_namespaceObject.forwardRef)(TabbedSidebar)); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-zoom-out.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode. * Concepts: * - If we most recently changed the zoom level for them (in or out), we always resetZoomLevel() level when unmounting. * - If the user most recently changed the zoom level (manually toggling), we do nothing when unmounting. * * @param {boolean} enabled If we should enter into zoomOut mode or not */ function useZoomOut(enabled = true) { const { setZoomLevel, resetZoomLevel } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); /** * We need access to both the value and the function. The value is to trigger a useEffect hook * and the function is to check zoom out within another hook without triggering a re-render. */ const { isZoomedOut, isZoomOut } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isZoomOut: _isZoomOut } = unlock(select(store)); return { isZoomedOut: _isZoomOut(), isZoomOut: _isZoomOut }; }, []); const controlZoomLevelRef = (0,external_wp_element_namespaceObject.useRef)(false); const isEnabledRef = (0,external_wp_element_namespaceObject.useRef)(enabled); /** * This hook tracks if the zoom state was changed manually by the user via clicking * the zoom out button. We only want this to run when isZoomedOut changes, so we use * a ref to track the enabled state. */ (0,external_wp_element_namespaceObject.useEffect)(() => { // If the zoom state changed (isZoomOut) and it does not match the requested zoom // state (zoomOut), then it means the user manually changed the zoom state while // this hook was mounted, and we should no longer control the zoom state. if (isZoomedOut !== isEnabledRef.current) { controlZoomLevelRef.current = false; } }, [isZoomedOut]); (0,external_wp_element_namespaceObject.useEffect)(() => { isEnabledRef.current = enabled; if (enabled !== isZoomOut()) { controlZoomLevelRef.current = true; if (enabled) { setZoomLevel('auto-scaled'); } else { resetZoomLevel(); } } return () => { // If we are controlling zoom level and are zoomed out, reset the zoom level. if (controlZoomLevelRef.current && isZoomOut()) { resetZoomLevel(); } }; }, [enabled, isZoomOut, resetZoomLevel, setZoomLevel]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/menu.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const NOOP = () => {}; function InserterMenu({ rootClientId, clientId, isAppender, __experimentalInsertionIndex, onSelect, showInserterHelpPanel, showMostUsedBlocks, __experimentalFilterValue = '', shouldFocusBlock = true, onPatternCategorySelection, onClose, __experimentalInitialTab, __experimentalInitialCategory }, ref) { const { isZoomOutMode, hasSectionRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isZoomOut, getSectionRootClientId } = unlock(select(store)); return { isZoomOutMode: isZoomOut(), hasSectionRootClientId: !!getSectionRootClientId() }; }, []); const [filterValue, setFilterValue, delayedFilterValue] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(__experimentalFilterValue); const [hoveredItem, setHoveredItem] = (0,external_wp_element_namespaceObject.useState)(null); const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)(__experimentalInitialCategory); const [patternFilter, setPatternFilter] = (0,external_wp_element_namespaceObject.useState)('all'); const [selectedMediaCategory, setSelectedMediaCategory] = (0,external_wp_element_namespaceObject.useState)(null); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); function getInitialTab() { if (__experimentalInitialTab) { return __experimentalInitialTab; } if (isZoomOutMode) { return 'patterns'; } return 'blocks'; } const [selectedTab, setSelectedTab] = (0,external_wp_element_namespaceObject.useState)(getInitialTab()); const shouldUseZoomOut = hasSectionRootClientId && (selectedTab === 'patterns' || selectedTab === 'media'); useZoomOut(shouldUseZoomOut && isLargeViewport); const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point({ rootClientId, clientId, isAppender, insertionIndex: __experimentalInsertionIndex, shouldFocusBlock }); const blockTypesTabRef = (0,external_wp_element_namespaceObject.useRef)(); const onInsert = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock, _rootClientId) => { onInsertBlocks(blocks, meta, shouldForceFocusBlock, _rootClientId); onSelect(blocks); // Check for focus loss due to filtering blocks by selected block type window.requestAnimationFrame(() => { if (!shouldFocusBlock && !blockTypesTabRef.current?.contains(ref.current.ownerDocument.activeElement)) { // There has been a focus loss, so focus the first button in the block types tab blockTypesTabRef.current?.querySelector('button').focus(); } }); }, [onInsertBlocks, onSelect, shouldFocusBlock]); const onInsertPattern = (0,external_wp_element_namespaceObject.useCallback)((blocks, patternName, ...args) => { onToggleInsertionPoint(false); onInsertBlocks(blocks, { patternName }, ...args); onSelect(); }, [onInsertBlocks, onSelect]); const onHover = (0,external_wp_element_namespaceObject.useCallback)(item => { onToggleInsertionPoint(item); setHoveredItem(item); }, [onToggleInsertionPoint, setHoveredItem]); const onClickPatternCategory = (0,external_wp_element_namespaceObject.useCallback)((patternCategory, filter) => { setSelectedPatternCategory(patternCategory); setPatternFilter(filter); onPatternCategorySelection?.(); }, [setSelectedPatternCategory, onPatternCategorySelection]); const showPatternPanel = selectedTab === 'patterns' && !delayedFilterValue && !!selectedPatternCategory; const showMediaPanel = selectedTab === 'media' && !!selectedMediaCategory; const inserterSearch = (0,external_wp_element_namespaceObject.useMemo)(() => { if (selectedTab === 'media') { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, className: "block-editor-inserter__search", onChange: value => { if (hoveredItem) { setHoveredItem(null); } setFilterValue(value); }, value: filterValue, label: (0,external_wp_i18n_namespaceObject.__)('Search'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') }), !!delayedFilterValue && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_search_results, { filterValue: delayedFilterValue, onSelect: onSelect, onHover: onHover, rootClientId: rootClientId, clientId: clientId, isAppender: isAppender, __experimentalInsertionIndex: __experimentalInsertionIndex, showBlockDirectory: true, shouldFocusBlock: shouldFocusBlock, prioritizePatterns: selectedTab === 'patterns' })] }); }, [selectedTab, hoveredItem, setHoveredItem, setFilterValue, filterValue, delayedFilterValue, onSelect, onHover, shouldFocusBlock, clientId, rootClientId, __experimentalInsertionIndex, isAppender]); const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__block-list", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_tab, { ref: blockTypesTabRef, rootClientId: destinationRootClientId, onInsert: onInsert, onHover: onHover, showMostUsedBlocks: showMostUsedBlocks }) }), showInserterHelpPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__tips", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "h2", children: (0,external_wp_i18n_namespaceObject.__)('A tip for using the block editor') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tips, {})] })] }); }, [destinationRootClientId, onInsert, onHover, showMostUsedBlocks, showInserterHelpPanel]); const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_tab, { rootClientId: destinationRootClientId, onInsert: onInsertPattern, onSelectCategory: onClickPatternCategory, selectedCategory: selectedPatternCategory, children: showPatternPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviews, { rootClientId: destinationRootClientId, onInsert: onInsertPattern, category: selectedPatternCategory, patternFilter: patternFilter, showTitlesAsTooltip: true }) }); }, [destinationRootClientId, onInsertPattern, onClickPatternCategory, patternFilter, selectedPatternCategory, showPatternPanel]); const mediaTab = (0,external_wp_element_namespaceObject.useMemo)(() => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_tab, { rootClientId: destinationRootClientId, selectedCategory: selectedMediaCategory, onSelectCategory: setSelectedMediaCategory, onInsert: onInsert, children: showMediaPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaCategoryPanel, { rootClientId: destinationRootClientId, onInsert: onInsert, category: selectedMediaCategory }) }); }, [destinationRootClientId, onInsert, selectedMediaCategory, setSelectedMediaCategory, showMediaPanel]); const handleSetSelectedTab = value => { // If no longer on patterns tab remove the category setting. if (value !== 'patterns') { setSelectedPatternCategory(null); } setSelectedTab(value); }; // Focus first active tab, if any const tabsRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (tabsRef.current) { window.requestAnimationFrame(() => { tabsRef.current.querySelector('[role="tab"][aria-selected="true"]')?.focus(); }); } }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('block-editor-inserter__menu', { 'show-panel': showPatternPanel || showMediaPanel, 'is-zoom-out': isZoomOutMode }), ref: ref, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__main-area", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tabbed_sidebar, { ref: tabsRef, onSelect: handleSetSelectedTab, onClose: onClose, selectedTab: selectedTab, closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close Block Inserter'), tabs: [{ name: 'blocks', title: (0,external_wp_i18n_namespaceObject.__)('Blocks'), panel: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [inserterSearch, selectedTab === 'blocks' && !delayedFilterValue && blocksTab] }) }, { name: 'patterns', title: (0,external_wp_i18n_namespaceObject.__)('Patterns'), panel: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [inserterSearch, selectedTab === 'patterns' && !delayedFilterValue && patternsTab] }) }, { name: 'media', title: (0,external_wp_i18n_namespaceObject.__)('Media'), panel: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [inserterSearch, mediaTab] }) }] }) }), showInserterHelpPanel && hoveredItem && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { className: "block-editor-inserter__preview-container__popover", placement: "right-start", offset: 16, focusOnMount: false, animate: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel, { item: hoveredItem }) })] }); } const PrivateInserterMenu = (0,external_wp_element_namespaceObject.forwardRef)(InserterMenu); function PublicInserterMenu(props, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterMenu, { ...props, onPatternCategorySelection: NOOP, ref: ref }); } /* harmony default export */ const menu = ((0,external_wp_element_namespaceObject.forwardRef)(PublicInserterMenu)); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/quick-inserter.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const SEARCH_THRESHOLD = 6; const SHOWN_BLOCK_TYPES = 6; const SHOWN_BLOCK_PATTERNS = 2; function QuickInserter({ onSelect, rootClientId, clientId, isAppender, selectBlockOnInsert, hasSearch = true }) { const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ onSelect, rootClientId, clientId, isAppender, selectBlockOnInsert }); const [blockTypes] = use_block_types_state(destinationRootClientId, onInsertBlocks, true); const { setInserterIsOpened, insertionIndex } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings, getBlockIndex, getBlockCount } = select(store); const settings = getSettings(); const index = getBlockIndex(clientId); const blockCount = getBlockCount(); return { setInserterIsOpened: settings.__experimentalSetIsInserterOpened, insertionIndex: index === -1 ? blockCount : index }; }, [clientId]); const showSearch = hasSearch && blockTypes.length > SEARCH_THRESHOLD; (0,external_wp_element_namespaceObject.useEffect)(() => { if (setInserterIsOpened) { setInserterIsOpened(false); } }, [setInserterIsOpened]); // When clicking Browse All select the appropriate block so as // the insertion point can work as expected. const onBrowseAll = () => { setInserterIsOpened({ filterValue, onSelect, rootClientId, insertionIndex }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('block-editor-inserter__quick-inserter', { 'has-search': showSearch, 'has-expand': setInserterIsOpened }), children: [showSearch && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, className: "block-editor-inserter__search", value: filterValue, onChange: value => { setFilterValue(value); }, label: (0,external_wp_i18n_namespaceObject.__)('Search'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-results", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_search_results, { filterValue: filterValue, onSelect: onSelect, rootClientId: rootClientId, clientId: clientId, isAppender: isAppender, maxBlockPatterns: !!filterValue ? SHOWN_BLOCK_PATTERNS : 0, maxBlockTypes: SHOWN_BLOCK_TYPES, isDraggable: false, selectBlockOnInsert: selectBlockOnInsert, isQuick: true }) }), setInserterIsOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-inserter__quick-inserter-expand", onClick: onBrowseAll, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse all. This will open the main inserter panel in the editor toolbar.'), children: (0,external_wp_i18n_namespaceObject.__)('Browse all') })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const defaultRenderToggle = ({ onToggle, disabled, isOpen, blockTitle, hasSingleBlockType, toggleProps = {} }) => { const { as: Wrapper = external_wp_components_namespaceObject.Button, label: labelProp, onClick, ...rest } = toggleProps; let label = labelProp; if (!label && hasSingleBlockType) { label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one (0,external_wp_i18n_namespaceObject._x)('Add %s', 'directly add the only allowed block'), blockTitle); } else if (!label) { label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button'); } // Handle both onClick functions from the toggle and the parent component. function handleClick(event) { if (onToggle) { onToggle(event); } if (onClick) { onClick(event); } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { __next40pxDefaultSize: toggleProps.as ? undefined : true, icon: library_plus, label: label, tooltipPosition: "bottom", onClick: handleClick, className: "block-editor-inserter__toggle", "aria-haspopup": !hasSingleBlockType ? 'true' : false, "aria-expanded": !hasSingleBlockType ? isOpen : false, disabled: disabled, ...rest }); }; class Inserter extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.onToggle = this.onToggle.bind(this); this.renderToggle = this.renderToggle.bind(this); this.renderContent = this.renderContent.bind(this); } onToggle(isOpen) { const { onToggle } = this.props; // Surface toggle callback to parent component. if (onToggle) { onToggle(isOpen); } } /** * Render callback to display Dropdown toggle element. * * @param {Object} options * @param {Function} options.onToggle Callback to invoke when toggle is * pressed. * @param {boolean} options.isOpen Whether dropdown is currently open. * * @return {Element} Dropdown toggle element. */ renderToggle({ onToggle, isOpen }) { const { disabled, blockTitle, hasSingleBlockType, directInsertBlock, toggleProps, hasItems, renderToggle = defaultRenderToggle } = this.props; return renderToggle({ onToggle, isOpen, disabled: disabled || !hasItems, blockTitle, hasSingleBlockType, directInsertBlock, toggleProps }); } /** * Render callback to display Dropdown content element. * * @param {Object} options * @param {Function} options.onClose Callback to invoke when dropdown is * closed. * * @return {Element} Dropdown content element. */ renderContent({ onClose }) { const { rootClientId, clientId, isAppender, showInserterHelpPanel, // This prop is experimental to give some time for the quick inserter to mature // Feel free to make them stable after a few releases. __experimentalIsQuick: isQuick, onSelectOrClose, selectBlockOnInsert } = this.props; if (isQuick) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(QuickInserter, { onSelect: blocks => { const firstBlock = Array.isArray(blocks) && blocks?.length ? blocks[0] : blocks; if (onSelectOrClose && typeof onSelectOrClose === 'function') { onSelectOrClose(firstBlock); } onClose(); }, rootClientId: rootClientId, clientId: clientId, isAppender: isAppender, selectBlockOnInsert: selectBlockOnInsert }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu, { onSelect: () => { onClose(); }, rootClientId: rootClientId, clientId: clientId, isAppender: isAppender, showInserterHelpPanel: showInserterHelpPanel }); } render() { const { position, hasSingleBlockType, directInsertBlock, insertOnlyAllowedBlock, __experimentalIsQuick: isQuick, onSelectOrClose } = this.props; if (hasSingleBlockType || directInsertBlock) { return this.renderToggle({ onToggle: insertOnlyAllowedBlock }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { className: "block-editor-inserter", contentClassName: dist_clsx('block-editor-inserter__popover', { 'is-quick': isQuick }), popoverProps: { position, shift: true }, onToggle: this.onToggle, expandOnMobile: true, headerTitle: (0,external_wp_i18n_namespaceObject.__)('Add a block'), renderToggle: this.renderToggle, renderContent: this.renderContent, onClose: onSelectOrClose }); } } /* harmony default export */ const inserter = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, { clientId, rootClientId, shouldDirectInsert = true }) => { const { getBlockRootClientId, hasInserterItems, getAllowedBlocks, getDirectInsertBlock } = select(store); const { getBlockVariations } = select(external_wp_blocks_namespaceObject.store); rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined; const allowedBlocks = getAllowedBlocks(rootClientId); const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(rootClientId); const hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, 'inserter')?.length === 0; let allowedBlockType = false; if (hasSingleBlockType) { allowedBlockType = allowedBlocks[0]; } return { hasItems: hasInserterItems(rootClientId), hasSingleBlockType, blockTitle: allowedBlockType ? allowedBlockType.title : '', allowedBlockType, directInsertBlock, rootClientId }; }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, { select }) => { return { insertOnlyAllowedBlock() { const { rootClientId, clientId, isAppender, hasSingleBlockType, allowedBlockType, directInsertBlock, onSelectOrClose, selectBlockOnInsert } = ownProps; if (!hasSingleBlockType && !directInsertBlock) { return; } function getAdjacentBlockAttributes(attributesToCopy) { const { getBlock, getPreviousBlockClientId } = select(store); if (!attributesToCopy || !clientId && !rootClientId) { return {}; } const result = {}; let adjacentAttributes = {}; // If there is no clientId, then attempt to get attributes // from the last block within innerBlocks of the root block. if (!clientId) { const parentBlock = getBlock(rootClientId); if (parentBlock?.innerBlocks?.length) { const lastInnerBlock = parentBlock.innerBlocks[parentBlock.innerBlocks.length - 1]; if (directInsertBlock && directInsertBlock?.name === lastInnerBlock.name) { adjacentAttributes = lastInnerBlock.attributes; } } } else { // Otherwise, attempt to get attributes from the // previous block relative to the current clientId. const currentBlock = getBlock(clientId); const previousBlock = getBlock(getPreviousBlockClientId(clientId)); if (currentBlock?.name === previousBlock?.name) { adjacentAttributes = previousBlock?.attributes || {}; } } // Copy over only those attributes flagged to be copied. attributesToCopy.forEach(attribute => { if (adjacentAttributes.hasOwnProperty(attribute)) { result[attribute] = adjacentAttributes[attribute]; } }); return result; } function getInsertionIndex() { const { getBlockIndex, getBlockSelectionEnd, getBlockOrder, getBlockRootClientId } = select(store); // If the clientId is defined, we insert at the position of the block. if (clientId) { return getBlockIndex(clientId); } // If there a selected block, we insert after the selected block. const end = getBlockSelectionEnd(); if (!isAppender && end && getBlockRootClientId(end) === rootClientId) { return getBlockIndex(end) + 1; } // Otherwise, we insert at the end of the current rootClientId. return getBlockOrder(rootClientId).length; } const { insertBlock } = dispatch(store); let blockToInsert; // Attempt to augment the directInsertBlock with attributes from an adjacent block. // This ensures styling from nearby blocks is preserved in the newly inserted block. // See: https://github.com/WordPress/gutenberg/issues/37904 if (directInsertBlock) { const newAttributes = getAdjacentBlockAttributes(directInsertBlock.attributesToCopy); blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { ...(directInsertBlock.attributes || {}), ...newAttributes }); } else { blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name); } insertBlock(blockToInsert, getInsertionIndex(), rootClientId, selectBlockOnInsert); if (onSelectOrClose) { onSelectOrClose({ clientId: blockToInsert?.clientId }); } const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block that has been added (0,external_wp_i18n_namespaceObject.__)('%s block added'), allowedBlockType.title); (0,external_wp_a11y_namespaceObject.speak)(message); } }; }), // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as // a way to detect the global Inserter. (0,external_wp_compose_namespaceObject.ifCondition)(({ hasItems, isAppender, rootClientId, clientId }) => hasItems || !isAppender && !rootClientId && !clientId)])(Inserter)); ;// ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function button_block_appender_ButtonBlockAppender({ rootClientId, className, onFocus, tabIndex, onSelect }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { position: "bottom center", rootClientId: rootClientId, __experimentalIsQuick: true, onSelectOrClose: (...args) => { if (onSelect && typeof onSelect === 'function') { onSelect(...args); } }, renderToggle: ({ onToggle, disabled, isOpen, blockTitle, hasSingleBlockType }) => { const isToggleButton = !hasSingleBlockType; const label = hasSingleBlockType ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one (0,external_wp_i18n_namespaceObject._x)('Add %s', 'directly add the only allowed block'), blockTitle) : (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref: ref, onFocus: onFocus, tabIndex: tabIndex, className: dist_clsx(className, 'block-editor-button-block-appender'), onClick: onToggle, "aria-haspopup": isToggleButton ? 'true' : undefined, "aria-expanded": isToggleButton ? isOpen : undefined // Disable reason: There shouldn't be a case where this button is disabled but not visually hidden. // eslint-disable-next-line no-restricted-syntax , disabled: disabled, label: label, showTooltip: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_plus }) }); }, isAppender: true }); } /** * Use `ButtonBlockAppender` instead. * * @deprecated */ const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, { alternative: 'wp.blockEditor.ButtonBlockAppender', since: '5.9' }); return button_block_appender_ButtonBlockAppender(props, ref); }); /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md */ /* harmony default export */ const button_block_appender = ((0,external_wp_element_namespaceObject.forwardRef)(button_block_appender_ButtonBlockAppender)); ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-visualizer.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function GridVisualizer({ clientId, contentRef, parentLayout }) { const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().isDistractionFree, []); const gridElement = useBlockElement(clientId); if (isDistractionFree || !gridElement) { return null; } const isManualGrid = parentLayout?.isManualPlacement && window.__experimentalEnableGridInteractivity; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizerGrid, { gridClientId: clientId, gridElement: gridElement, isManualGrid: isManualGrid, ref: contentRef }); } const GridVisualizerGrid = (0,external_wp_element_namespaceObject.forwardRef)(({ gridClientId, gridElement, isManualGrid }, ref) => { const [gridInfo, setGridInfo] = (0,external_wp_element_namespaceObject.useState)(() => getGridInfo(gridElement)); const [isDroppingAllowed, setIsDroppingAllowed] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const resizeCallback = () => setGridInfo(getGridInfo(gridElement)); // Both border-box and content-box are observed as they may change // independently. This requires two observers because a single one // can’t be made to monitor both on the same element. const borderBoxSpy = new window.ResizeObserver(resizeCallback); borderBoxSpy.observe(gridElement, { box: 'border-box' }); const contentBoxSpy = new window.ResizeObserver(resizeCallback); contentBoxSpy.observe(gridElement); return () => { borderBoxSpy.disconnect(); contentBoxSpy.disconnect(); }; }, [gridElement]); (0,external_wp_element_namespaceObject.useEffect)(() => { function onGlobalDrag() { setIsDroppingAllowed(true); } function onGlobalDragEnd() { setIsDroppingAllowed(false); } document.addEventListener('drag', onGlobalDrag); document.addEventListener('dragend', onGlobalDragEnd); return () => { document.removeEventListener('drag', onGlobalDrag); document.removeEventListener('dragend', onGlobalDragEnd); }; }, []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { className: dist_clsx('block-editor-grid-visualizer', { 'is-dropping-allowed': isDroppingAllowed }), clientId: gridClientId, __unstablePopoverSlot: "__unstable-block-tools-after", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, className: "block-editor-grid-visualizer__grid", style: gridInfo.style, children: isManualGrid ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ManualGridVisualizer, { gridClientId: gridClientId, gridInfo: gridInfo }) : Array.from({ length: gridInfo.numItems }, (_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizerCell, { color: gridInfo.currentColor }, i)) }) }); }); function ManualGridVisualizer({ gridClientId, gridInfo }) { const [highlightedRect, setHighlightedRect] = (0,external_wp_element_namespaceObject.useState)(null); const gridItemStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockOrder, getBlockStyles } = unlock(select(store)); const blockOrder = getBlockOrder(gridClientId); return getBlockStyles(blockOrder); }, [gridClientId]); const occupiedRects = (0,external_wp_element_namespaceObject.useMemo)(() => { const rects = []; for (const style of Object.values(gridItemStyles)) { var _style$layout; const { columnStart, rowStart, columnSpan = 1, rowSpan = 1 } = (_style$layout = style?.layout) !== null && _style$layout !== void 0 ? _style$layout : {}; if (!columnStart || !rowStart) { continue; } rects.push(new GridRect({ columnStart, rowStart, columnSpan, rowSpan })); } return rects; }, [gridItemStyles]); return range(1, gridInfo.numRows).map(row => range(1, gridInfo.numColumns).map(column => { var _highlightedRect$cont; const isCellOccupied = occupiedRects.some(rect => rect.contains(column, row)); const isHighlighted = (_highlightedRect$cont = highlightedRect?.contains(column, row)) !== null && _highlightedRect$cont !== void 0 ? _highlightedRect$cont : false; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizerCell, { color: gridInfo.currentColor, className: isHighlighted && 'is-highlighted', children: isCellOccupied ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizerDropZone, { column: column, row: row, gridClientId: gridClientId, gridInfo: gridInfo, setHighlightedRect: setHighlightedRect }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizerAppender, { column: column, row: row, gridClientId: gridClientId, gridInfo: gridInfo, setHighlightedRect: setHighlightedRect }) }, `${row}-${column}`); })); } function GridVisualizerCell({ color, children, className }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx('block-editor-grid-visualizer__cell', className), style: { boxShadow: `inset 0 0 0 1px color-mix(in srgb, ${color} 20%, #0000)`, color }, children: children }); } function useGridVisualizerDropZone(column, row, gridClientId, gridInfo, setHighlightedRect) { const { getBlockAttributes, getBlockRootClientId, canInsertBlockType, getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); const { updateBlockAttributes, moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(gridClientId, gridInfo.numColumns); return useDropZoneWithValidation({ validateDrag(srcClientId) { const blockName = getBlockName(srcClientId); if (!canInsertBlockType(blockName, gridClientId)) { return false; } const attributes = getBlockAttributes(srcClientId); const rect = new GridRect({ columnStart: column, rowStart: row, columnSpan: attributes.style?.layout?.columnSpan, rowSpan: attributes.style?.layout?.rowSpan }); const isInBounds = new GridRect({ columnSpan: gridInfo.numColumns, rowSpan: gridInfo.numRows }).containsRect(rect); return isInBounds; }, onDragEnter(srcClientId) { const attributes = getBlockAttributes(srcClientId); setHighlightedRect(new GridRect({ columnStart: column, rowStart: row, columnSpan: attributes.style?.layout?.columnSpan, rowSpan: attributes.style?.layout?.rowSpan })); }, onDragLeave() { // onDragEnter can be called before onDragLeave if the user moves // their mouse quickly, so only clear the highlight if it was set // by this cell. setHighlightedRect(prevHighlightedRect => prevHighlightedRect?.columnStart === column && prevHighlightedRect?.rowStart === row ? null : prevHighlightedRect); }, onDrop(srcClientId) { setHighlightedRect(null); const attributes = getBlockAttributes(srcClientId); updateBlockAttributes(srcClientId, { style: { ...attributes.style, layout: { ...attributes.style?.layout, columnStart: column, rowStart: row } } }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition([srcClientId], getBlockRootClientId(srcClientId), gridClientId, getNumberOfBlocksBeforeCell(column, row)); } }); } function GridVisualizerDropZone({ column, row, gridClientId, gridInfo, setHighlightedRect }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-grid-visualizer__drop-zone", ref: useGridVisualizerDropZone(column, row, gridClientId, gridInfo, setHighlightedRect) }); } function GridVisualizerAppender({ column, row, gridClientId, gridInfo, setHighlightedRect }) { const { updateBlockAttributes, moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(gridClientId, gridInfo.numColumns); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(button_block_appender, { rootClientId: gridClientId, className: "block-editor-grid-visualizer__appender", ref: useGridVisualizerDropZone(column, row, gridClientId, gridInfo, setHighlightedRect), style: { color: gridInfo.currentColor }, onSelect: block => { if (!block) { return; } updateBlockAttributes(block.clientId, { style: { layout: { columnStart: column, rowStart: row } } }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition([block.clientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(column, row)); } }); } function useDropZoneWithValidation({ validateDrag, onDragEnter, onDragLeave, onDrop }) { const { getDraggedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ onDragEnter() { const [srcClientId] = getDraggedBlockClientIds(); if (srcClientId && validateDrag(srcClientId)) { onDragEnter(srcClientId); } }, onDragLeave() { onDragLeave(); }, onDrop() { const [srcClientId] = getDraggedBlockClientIds(); if (srcClientId && validateDrag(srcClientId)) { onDrop(srcClientId); } } }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-item-resizer.js /** * WordPress dependencies */ /** * Internal dependencies */ function GridItemResizer({ clientId, bounds, onChange, parentLayout }) { const blockElement = useBlockElement(clientId); const rootBlockElement = blockElement?.parentElement; const { isManualPlacement } = parentLayout; if (!blockElement || !rootBlockElement) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItemResizerInner, { clientId: clientId, bounds: bounds, blockElement: blockElement, rootBlockElement: rootBlockElement, onChange: onChange, isManualGrid: isManualPlacement && window.__experimentalEnableGridInteractivity }); } function GridItemResizerInner({ clientId, bounds, blockElement, rootBlockElement, onChange, isManualGrid }) { const [resizeDirection, setResizeDirection] = (0,external_wp_element_namespaceObject.useState)(null); const [enableSide, setEnableSide] = (0,external_wp_element_namespaceObject.useState)({ top: false, bottom: false, left: false, right: false }); (0,external_wp_element_namespaceObject.useEffect)(() => { const observer = new window.ResizeObserver(() => { const blockClientRect = blockElement.getBoundingClientRect(); const rootBlockClientRect = rootBlockElement.getBoundingClientRect(); setEnableSide({ top: blockClientRect.top > rootBlockClientRect.top, bottom: blockClientRect.bottom < rootBlockClientRect.bottom, left: blockClientRect.left > rootBlockClientRect.left, right: blockClientRect.right < rootBlockClientRect.right }); }); observer.observe(blockElement); return () => observer.disconnect(); }, [blockElement, rootBlockElement]); const justification = { right: 'left', left: 'right' }; const alignment = { top: 'flex-end', bottom: 'flex-start' }; const styles = { display: 'flex', justifyContent: 'center', alignItems: 'center', ...(justification[resizeDirection] && { justifyContent: justification[resizeDirection] }), ...(alignment[resizeDirection] && { alignItems: alignment[resizeDirection] }) }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { className: "block-editor-grid-item-resizer", clientId: clientId, __unstablePopoverSlot: "__unstable-block-tools-after", additionalStyles: styles, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { className: "block-editor-grid-item-resizer__box", size: { width: '100%', height: '100%' }, enable: { bottom: enableSide.bottom, bottomLeft: false, bottomRight: false, left: enableSide.left, right: enableSide.right, top: enableSide.top, topLeft: false, topRight: false }, bounds: bounds, boundsByDirection: true, onPointerDown: ({ target, pointerId }) => { /* * Captures the pointer to avoid hiccups while dragging over objects * like iframes and ensures that the event to end the drag is * captured by the target (resize handle) whether or not it’s under * the pointer. */ target.setPointerCapture(pointerId); }, onResizeStart: (event, direction) => { /* * The container justification and alignment need to be set * according to the direction the resizer is being dragged in, * so that it resizes in the right direction. */ setResizeDirection(direction); }, onResizeStop: (event, direction, boxElement) => { const columnGap = parseFloat(utils_getComputedCSS(rootBlockElement, 'column-gap')); const rowGap = parseFloat(utils_getComputedCSS(rootBlockElement, 'row-gap')); const gridColumnTracks = getGridTracks(utils_getComputedCSS(rootBlockElement, 'grid-template-columns'), columnGap); const gridRowTracks = getGridTracks(utils_getComputedCSS(rootBlockElement, 'grid-template-rows'), rowGap); const rect = new window.DOMRect(blockElement.offsetLeft + boxElement.offsetLeft, blockElement.offsetTop + boxElement.offsetTop, boxElement.offsetWidth, boxElement.offsetHeight); const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1; const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1; const columnEnd = getClosestTrack(gridColumnTracks, rect.right, 'end') + 1; const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, 'end') + 1; onChange({ columnSpan: columnEnd - columnStart + 1, rowSpan: rowEnd - rowStart + 1, columnStart: isManualGrid ? columnStart : undefined, rowStart: isManualGrid ? rowStart : undefined }); } }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js /** * WordPress dependencies */ const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); /* harmony default export */ const chevron_up = (chevronUp); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js /** * WordPress dependencies */ const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); /* harmony default export */ const chevron_down = (chevronDown); ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-item-movers.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function GridItemMovers({ layout, parentLayout, onChange, gridClientId, blockClientId }) { var _layout$columnStart, _layout$rowStart, _layout$columnSpan, _layout$rowSpan; const { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const columnStart = (_layout$columnStart = layout?.columnStart) !== null && _layout$columnStart !== void 0 ? _layout$columnStart : 1; const rowStart = (_layout$rowStart = layout?.rowStart) !== null && _layout$rowStart !== void 0 ? _layout$rowStart : 1; const columnSpan = (_layout$columnSpan = layout?.columnSpan) !== null && _layout$columnSpan !== void 0 ? _layout$columnSpan : 1; const rowSpan = (_layout$rowSpan = layout?.rowSpan) !== null && _layout$rowSpan !== void 0 ? _layout$rowSpan : 1; const columnEnd = columnStart + columnSpan - 1; const rowEnd = rowStart + rowSpan - 1; const columnCount = parentLayout?.columnCount; const rowCount = parentLayout?.rowCount; const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(gridClientId, columnCount); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { group: "parent", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-grid-item-mover__move-button-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-grid-item-mover__move-horizontal-button-container is-left", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItemMover, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, label: (0,external_wp_i18n_namespaceObject.__)('Move left'), description: (0,external_wp_i18n_namespaceObject.__)('Move left'), isDisabled: columnStart <= 1, onClick: () => { onChange({ columnStart: columnStart - 1 }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition([blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(columnStart - 1, rowStart)); } }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-grid-item-mover__move-vertical-button-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItemMover, { className: "is-up-button", icon: chevron_up, label: (0,external_wp_i18n_namespaceObject.__)('Move up'), description: (0,external_wp_i18n_namespaceObject.__)('Move up'), isDisabled: rowStart <= 1, onClick: () => { onChange({ rowStart: rowStart - 1 }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition([blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(columnStart, rowStart - 1)); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItemMover, { className: "is-down-button", icon: chevron_down, label: (0,external_wp_i18n_namespaceObject.__)('Move down'), description: (0,external_wp_i18n_namespaceObject.__)('Move down'), isDisabled: rowCount && rowEnd >= rowCount, onClick: () => { onChange({ rowStart: rowStart + 1 }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition([blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(columnStart, rowStart + 1)); } })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-grid-item-mover__move-horizontal-button-container is-right", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItemMover, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right, label: (0,external_wp_i18n_namespaceObject.__)('Move right'), description: (0,external_wp_i18n_namespaceObject.__)('Move right'), isDisabled: columnCount && columnEnd >= columnCount, onClick: () => { onChange({ columnStart: columnStart + 1 }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition([blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(columnStart + 1, rowStart)); } }) })] }) }); } function GridItemMover({ className, icon, label, isDisabled, onClick, description }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItemMover); const descriptionId = `block-editor-grid-item-mover-button__description-${instanceId}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { className: dist_clsx('block-editor-grid-item-mover-button', className), icon: icon, label: label, "aria-describedby": descriptionId, onClick: isDisabled ? null : onClick, disabled: isDisabled, accessibleWhenDisabled: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/layout-child.js /** * WordPress dependencies */ /** * Internal dependencies */ // Used for generating the instance ID const LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {}; function useBlockPropsChildLayoutStyles({ style }) { var _style$layout; const shouldRenderChildLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { return !select(store).getSettings().disableLayoutStyles; }); const layout = (_style$layout = style?.layout) !== null && _style$layout !== void 0 ? _style$layout : {}; const { selfStretch, flexSize, columnStart, rowStart, columnSpan, rowSpan } = layout; const parentLayout = useLayout() || {}; const { columnCount, minimumColumnWidth } = parentLayout; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LAYOUT_CHILD_BLOCK_PROPS_REFERENCE); const selector = `.wp-container-content-${id}`; // Check that the grid layout attributes are of the correct type, so that we don't accidentally // write code that stores a string attribute instead of a number. if (false) {} let css = ''; if (shouldRenderChildLayoutStyles) { if (selfStretch === 'fixed' && flexSize) { css = `${selector} { flex-basis: ${flexSize}; box-sizing: border-box; }`; } else if (selfStretch === 'fill') { css = `${selector} { flex-grow: 1; }`; } else if (columnStart && columnSpan) { css = `${selector} { grid-column: ${columnStart} / span ${columnSpan}; }`; } else if (columnStart) { css = `${selector} { grid-column: ${columnStart}; }`; } else if (columnSpan) { css = `${selector} { grid-column: span ${columnSpan}; }`; } if (rowStart && rowSpan) { css += `${selector} { grid-row: ${rowStart} / span ${rowSpan}; }`; } else if (rowStart) { css += `${selector} { grid-row: ${rowStart}; }`; } else if (rowSpan) { css += `${selector} { grid-row: span ${rowSpan}; }`; } /** * If minimumColumnWidth is set on the parent, or if no * columnCount is set, the grid is responsive so a * container query is needed for the span to resize. */ if ((columnSpan || columnStart) && (minimumColumnWidth || !columnCount)) { let parentColumnValue = parseFloat(minimumColumnWidth); /** * 12rem is the default minimumColumnWidth value. * If parentColumnValue is not a number, default to 12. */ if (isNaN(parentColumnValue)) { parentColumnValue = 12; } let parentColumnUnit = minimumColumnWidth?.replace(parentColumnValue, ''); /** * Check that parent column unit is either 'px', 'rem' or 'em'. * If not, default to 'rem'. */ if (!['px', 'rem', 'em'].includes(parentColumnUnit)) { parentColumnUnit = 'rem'; } let numColsToBreakAt = 2; if (columnSpan && columnStart) { numColsToBreakAt = columnSpan + columnStart - 1; } else if (columnSpan) { numColsToBreakAt = columnSpan; } else { numColsToBreakAt = columnStart; } const defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5; const containerQueryValue = numColsToBreakAt * parentColumnValue + (numColsToBreakAt - 1) * defaultGapValue; // For blocks that only span one column, we want to remove any rowStart values as // the container reduces in size, so that blocks are still arranged in markup order. const minimumContainerQueryValue = parentColumnValue * 2 + defaultGapValue - 1; // If a span is set we want to preserve it as long as possible, otherwise we just reset the value. const gridColumnValue = columnSpan && columnSpan > 1 ? '1/-1' : 'auto'; css += `@container (max-width: ${Math.max(containerQueryValue, minimumContainerQueryValue)}${parentColumnUnit}) { ${selector} { grid-column: ${gridColumnValue}; grid-row: auto; } }`; } } useStyleOverride({ css }); // Only attach a container class if there is generated CSS to be attached. if (!css) { return; } // Attach a `wp-container-content` id-based classname. return { className: `wp-container-content-${id}` }; } function ChildLayoutControlsPure({ clientId, style, setAttributes }) { const parentLayout = useLayout() || {}; const { type: parentLayoutType = 'default', allowSizingOnChildren = false, isManualPlacement } = parentLayout; if (parentLayoutType !== 'grid') { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridTools, { clientId: clientId, style: style, setAttributes: setAttributes, allowSizingOnChildren: allowSizingOnChildren, isManualPlacement: isManualPlacement, parentLayout: parentLayout }); } function GridTools({ clientId, style, setAttributes, allowSizingOnChildren, isManualPlacement, parentLayout }) { const { rootClientId, isVisible } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId, getBlockEditingMode, getTemplateLock } = select(store); const _rootClientId = getBlockRootClientId(clientId); if (getTemplateLock(_rootClientId) || getBlockEditingMode(_rootClientId) !== 'default') { return { rootClientId: _rootClientId, isVisible: false }; } return { rootClientId: _rootClientId, isVisible: true }; }, [clientId]); // Use useState() instead of useRef() so that GridItemResizer updates when ref is set. const [resizerBounds, setResizerBounds] = (0,external_wp_element_namespaceObject.useState)(); if (!isVisible) { return null; } function updateLayout(layout) { setAttributes({ style: { ...style, layout: { ...style?.layout, ...layout } } }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizer, { clientId: rootClientId, contentRef: setResizerBounds, parentLayout: parentLayout }), allowSizingOnChildren && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItemResizer, { clientId: clientId // Don't allow resizing beyond the grid visualizer. , bounds: resizerBounds, onChange: updateLayout, parentLayout: parentLayout }), isManualPlacement && window.__experimentalEnableGridInteractivity && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItemMovers, { layout: style?.layout, parentLayout: parentLayout, onChange: updateLayout, gridClientId: rootClientId, blockClientId: clientId })] }); } /* harmony default export */ const layout_child = ({ useBlockProps: useBlockPropsChildLayoutStyles, edit: ChildLayoutControlsPure, attributeKeys: ['style'], hasSupport() { return true; } }); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/content-lock-ui.js /** * WordPress dependencies */ /** * Internal dependencies */ // The implementation of content locking is mainly in this file, although the mechanism // to stop temporarily editing as blocks when an outside block is selected is on component StopEditingAsBlocksOnOutsideSelect // at block-editor/src/components/block-list/index.js. // Besides the components on this file and the file referenced above the implementation // also includes artifacts on the store (actions, reducers, and selector). function ContentLockControlsPure({ clientId }) { const { templateLock, isLockedByParent, isEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getContentLockingParent, getTemplateLock, getTemporarilyEditingAsBlocks } = unlock(select(store)); return { templateLock: getTemplateLock(clientId), isLockedByParent: !!getContentLockingParent(clientId), isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId }; }, [clientId]); const { stopEditingAsBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const isContentLocked = !isLockedByParent && templateLock === 'contentOnly'; const stopEditingAsBlockCallback = (0,external_wp_element_namespaceObject.useCallback)(() => { stopEditingAsBlocks(clientId); }, [clientId, stopEditingAsBlocks]); if (!isContentLocked && !isEditingAsBlocks) { return null; } const showStopEditingAsBlocks = isEditingAsBlocks && !isContentLocked; return showStopEditingAsBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { group: "other", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: stopEditingAsBlockCallback, children: (0,external_wp_i18n_namespaceObject.__)('Done') }) }); } /* harmony default export */ const content_lock_ui = ({ edit: ContentLockControlsPure, hasSupport() { return true; } }); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/metadata.js /** * WordPress dependencies */ const META_ATTRIBUTE_NAME = 'metadata'; /** * Filters registered block settings, extending attributes to include `metadata`. * * see: https://github.com/WordPress/gutenberg/pull/40393/files#r864632012 * * @param {Object} blockTypeSettings Original block settings. * @return {Object} Filtered block settings. */ function addMetaAttribute(blockTypeSettings) { // Allow blocks to specify their own attribute definition with default values if needed. if (blockTypeSettings?.attributes?.[META_ATTRIBUTE_NAME]?.type) { return blockTypeSettings; } blockTypeSettings.attributes = { ...blockTypeSettings.attributes, [META_ATTRIBUTE_NAME]: { type: 'object' } }; return blockTypeSettings; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/metadata/addMetaAttribute', addMetaAttribute); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-hooks.js /** * WordPress dependencies */ /** * Internal dependencies */ const block_hooks_EMPTY_OBJECT = {}; function BlockHooksControlPure({ name, clientId, metadata: { ignoredHookedBlocks = [] } = {} }) { const blockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []); // A hooked block added via a filter will not be exposed through a block // type's `blockHooks` property; however, if the containing layout has been // modified, it will be present in the anchor block's `ignoredHookedBlocks` // metadata. const hookedBlocksForCurrentBlock = (0,external_wp_element_namespaceObject.useMemo)(() => blockTypes?.filter(({ name: blockName, blockHooks }) => blockHooks && name in blockHooks || ignoredHookedBlocks.includes(blockName)), [blockTypes, name, ignoredHookedBlocks]); const hookedBlockClientIds = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlocks, getBlockRootClientId, getGlobalBlockCount } = select(store); const rootClientId = getBlockRootClientId(clientId); const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce((clientIds, block) => { // If the block doesn't exist anywhere in the block tree, // we know that we have to set the toggle to disabled. if (getGlobalBlockCount(block.name) === 0) { return clientIds; } const relativePosition = block?.blockHooks?.[name]; let candidates; switch (relativePosition) { case 'before': case 'after': // Any of the current block's siblings (with the right block type) qualifies // as a hooked block (inserted `before` or `after` the current one), as the block // might've been automatically inserted and then moved around a bit by the user. candidates = getBlocks(rootClientId); break; case 'first_child': case 'last_child': // Any of the current block's child blocks (with the right block type) qualifies // as a hooked first or last child block, as the block might've been automatically // inserted and then moved around a bit by the user. candidates = getBlocks(clientId); break; case undefined: // If we haven't found a blockHooks field with a relative position for the hooked // block, it means that it was added by a filter. In this case, we look for the block // both among the current block's siblings and its children. candidates = [...getBlocks(rootClientId), ...getBlocks(clientId)]; break; } const hookedBlock = candidates?.find(candidate => candidate.name === block.name); // If the block exists in the designated location, we consider it hooked // and show the toggle as enabled. if (hookedBlock) { return { ...clientIds, [block.name]: hookedBlock.clientId }; } // If no hooked block was found in any of its designated locations, // we set the toggle to disabled. return clientIds; }, {}); if (Object.values(_hookedBlockClientIds).length > 0) { return _hookedBlockClientIds; } return block_hooks_EMPTY_OBJECT; }, [hookedBlocksForCurrentBlock, name, clientId]); const { getBlockIndex, getBlockCount, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { insertBlock, removeBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!hookedBlocksForCurrentBlock.length) { return null; } // Group by block namespace (i.e. prefix before the slash). const groupedHookedBlocks = hookedBlocksForCurrentBlock.reduce((groups, block) => { const [namespace] = block.name.split('/'); if (!groups[namespace]) { groups[namespace] = []; } groups[namespace].push(block); return groups; }, {}); const insertBlockIntoDesignatedLocation = (block, relativePosition) => { const blockIndex = getBlockIndex(clientId); const innerBlocksLength = getBlockCount(clientId); const rootClientId = getBlockRootClientId(clientId); switch (relativePosition) { case 'before': case 'after': insertBlock(block, relativePosition === 'after' ? blockIndex + 1 : blockIndex, rootClientId, // Insert as a child of the current block's parent false); break; case 'first_child': case 'last_child': insertBlock(block, // TODO: It'd be great if insertBlock() would accept negative indices for insertion. relativePosition === 'first_child' ? 0 : innerBlocksLength, clientId, // Insert as a child of the current block. false); break; case undefined: // If we do not know the relative position, it is because the block was // added via a filter. In this case, we default to inserting it after the // current block. insertBlock(block, blockIndex + 1, rootClientId, // Insert as a child of the current block's parent false); break; } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { className: "block-editor-hooks__block-hooks", title: (0,external_wp_i18n_namespaceObject.__)('Plugins'), initialOpen: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-hooks__block-hooks-helptext", children: (0,external_wp_i18n_namespaceObject.__)('Manage the inclusion of blocks added automatically by plugins.') }), Object.keys(groupedHookedBlocks).map(vendor => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { children: vendor }), groupedHookedBlocks[vendor].map(block => { const checked = block.name in hookedBlockClientIds; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, checked: checked, label: block.title, onChange: () => { if (!checked) { // Create and insert block. const relativePosition = block.blockHooks[name]; insertBlockIntoDesignatedLocation((0,external_wp_blocks_namespaceObject.createBlock)(block.name), relativePosition); return; } // Remove block. removeBlock(hookedBlockClientIds[block.name], false); } }, block.title); })] }, vendor); })] }) }); } /* harmony default export */ const block_hooks = ({ edit: BlockHooksControlPure, attributeKeys: ['metadata'], hasSupport() { return true; } }); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-bindings.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Menu } = unlock(external_wp_components_namespaceObject.privateApis); const block_bindings_EMPTY_OBJECT = {}; const block_bindings_useToolsPanelDropdownMenuProps = () => { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); return !isMobile ? { popoverProps: { placement: 'left-start', // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) offset: 259 } } : {}; }; function BlockBindingsPanelMenuContent({ fieldsList, attribute, binding }) { const { clientId } = useBlockEditContext(); const registeredSources = (0,external_wp_blocks_namespaceObject.getBlockBindingsSources)(); const { updateBlockBindings } = useBlockBindingsUtils(); const currentKey = binding?.args?.key; const attributeType = (0,external_wp_data_namespaceObject.useSelect)(select => { const { name: blockName } = select(store).getBlock(clientId); const _attributeType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName).attributes?.[attribute]?.type; return _attributeType === 'rich-text' ? 'string' : _attributeType; }, [clientId, attribute]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: Object.entries(fieldsList).map(([name, fields], i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu.Group, { children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.GroupLabel, { children: registeredSources[name].label }), Object.entries(fields).filter(([, args]) => args?.type === attributeType).map(([key, args]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu.RadioItem, { onChange: () => updateBlockBindings({ [attribute]: { source: name, args: { key } } }), name: attribute + '-binding', value: key, checked: key === currentKey, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: args?.label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemHelpText, { children: args?.value })] }, key))] }), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Separator, {})] }, name)) }); } function BlockBindingsAttribute({ attribute, binding, fieldsList }) { const { source: sourceName, args } = binding || {}; const sourceProps = (0,external_wp_blocks_namespaceObject.getBlockBindingsSource)(sourceName); const isSourceInvalid = !sourceProps; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-bindings__item", spacing: 0, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { truncate: true, children: attribute }), !!binding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { truncate: true, variant: !isSourceInvalid && 'muted', isDestructive: isSourceInvalid, children: isSourceInvalid ? (0,external_wp_i18n_namespaceObject.__)('Invalid source') : fieldsList?.[sourceName]?.[args?.key]?.label || sourceProps?.label || sourceName })] }); } function ReadOnlyBlockBindingsPanelItems({ bindings, fieldsList }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: Object.entries(bindings).map(([attribute, binding]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockBindingsAttribute, { attribute: attribute, binding: binding, fieldsList: fieldsList }) }, attribute)) }); } function EditableBlockBindingsPanelItems({ attributes, bindings, fieldsList }) { const { updateBlockBindings } = useBlockBindingsUtils(); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: attributes.map(attribute => { const binding = bindings[attribute]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => !!binding, label: attribute, onDeselect: () => { updateBlockBindings({ [attribute]: undefined }); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { placement: isMobile ? 'bottom-start' : 'left-start', children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, {}), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockBindingsAttribute, { attribute: attribute, binding: binding, fieldsList: fieldsList }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { gutter: isMobile ? 8 : 36, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockBindingsPanelMenuContent, { fieldsList: fieldsList, attribute: attribute, binding: binding }) })] }) }, attribute); }) }); } const BlockBindingsPanel = ({ name: blockName, metadata }) => { const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context); const { removeAllBlockBindings } = useBlockBindingsUtils(); const bindableAttributes = getBindableAttributes(blockName); const dropdownMenuProps = block_bindings_useToolsPanelDropdownMenuProps(); // `useSelect` is used purposely here to ensure `getFieldsList` // is updated whenever there are updates in block context. // `source.getFieldsList` may also call a selector via `select`. const _fieldsList = {}; const { fieldsList, canUpdateBlockBindings } = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!bindableAttributes || bindableAttributes.length === 0) { return block_bindings_EMPTY_OBJECT; } const registeredSources = (0,external_wp_blocks_namespaceObject.getBlockBindingsSources)(); Object.entries(registeredSources).forEach(([sourceName, { getFieldsList, usesContext }]) => { if (getFieldsList) { // Populate context. const context = {}; if (usesContext?.length) { for (const key of usesContext) { context[key] = blockContext[key]; } } const sourceList = getFieldsList({ select, context }); // Only add source if the list is not empty. if (Object.keys(sourceList || {}).length) { _fieldsList[sourceName] = { ...sourceList }; } } }); return { fieldsList: Object.values(_fieldsList).length > 0 ? _fieldsList : block_bindings_EMPTY_OBJECT, canUpdateBlockBindings: select(store).getSettings().canUpdateBlockBindings }; }, [blockContext, bindableAttributes]); // Return early if there are no bindable attributes. if (!bindableAttributes || bindableAttributes.length === 0) { return null; } // Filter bindings to only show bindable attributes and remove pattern overrides. const { bindings } = metadata || {}; const filteredBindings = { ...bindings }; Object.keys(filteredBindings).forEach(key => { if (!canBindAttribute(blockName, key) || filteredBindings[key].source === 'core/pattern-overrides') { delete filteredBindings[key]; } }); // Lock the UI when the user can't update bindings or there are no fields to connect to. const readOnly = !canUpdateBlockBindings || !Object.keys(fieldsList).length; if (readOnly && Object.keys(filteredBindings).length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "bindings", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)('Attributes'), resetAll: () => { removeAllBlockBindings(); }, dropdownMenuProps: dropdownMenuProps, className: "block-editor-bindings__panel", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: readOnly ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ReadOnlyBlockBindingsPanelItems, { bindings: filteredBindings, fieldsList: fieldsList }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditableBlockBindingsPanelItems, { attributes: bindableAttributes, bindings: filteredBindings, fieldsList: fieldsList }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "div", variant: "muted", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Attributes connected to custom fields or other dynamic data.') }) })] }) }); }; /* harmony default export */ const block_bindings = ({ edit: BlockBindingsPanel, attributeKeys: ['metadata'], hasSupport() { return true; } }); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-renaming.js /** * WordPress dependencies */ /** * Filters registered block settings, adding an `__experimentalLabel` callback if one does not already exist. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function addLabelCallback(settings) { // If blocks provide their own label callback, do not override it. if (settings.__experimentalLabel) { return settings; } const supportsBlockNaming = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'renaming', true // default value ); // Check whether block metadata is supported before using it. if (supportsBlockNaming) { settings.__experimentalLabel = (attributes, { context }) => { const { metadata } = attributes; // In the list view, use the block's name attribute as the label. if (context === 'list-view' && metadata?.name) { return metadata.name; } }; } return settings; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/metadata/addLabelCallback', addLabelCallback); ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/use-grid-layout-sync.js /** * WordPress dependencies */ /** * Internal dependencies */ function useGridLayoutSync({ clientId: gridClientId }) { const { gridLayout, blockOrder, selectedBlockLayout } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getBlockAttributes$l; const { getBlockAttributes, getBlockOrder } = select(store); const selectedBlock = select(store).getSelectedBlock(); return { gridLayout: (_getBlockAttributes$l = getBlockAttributes(gridClientId).layout) !== null && _getBlockAttributes$l !== void 0 ? _getBlockAttributes$l : {}, blockOrder: getBlockOrder(gridClientId), selectedBlockLayout: selectedBlock?.attributes.style?.layout }; }, [gridClientId]); const { getBlockAttributes, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const selectedBlockRect = (0,external_wp_element_namespaceObject.useMemo)(() => selectedBlockLayout ? new GridRect(selectedBlockLayout) : null, [selectedBlockLayout]); const previouslySelectedBlockRect = (0,external_wp_compose_namespaceObject.usePrevious)(selectedBlockRect); const previousIsManualPlacement = (0,external_wp_compose_namespaceObject.usePrevious)(gridLayout.isManualPlacement); const previousBlockOrder = (0,external_wp_compose_namespaceObject.usePrevious)(blockOrder); (0,external_wp_element_namespaceObject.useEffect)(() => { const updates = {}; if (gridLayout.isManualPlacement) { const occupiedRects = []; // Respect the position of blocks that already have a columnStart and rowStart value. for (const clientId of blockOrder) { var _getBlockAttributes$s; const { columnStart, rowStart, columnSpan = 1, rowSpan = 1 } = (_getBlockAttributes$s = getBlockAttributes(clientId).style?.layout) !== null && _getBlockAttributes$s !== void 0 ? _getBlockAttributes$s : {}; if (!columnStart || !rowStart) { continue; } occupiedRects.push(new GridRect({ columnStart, rowStart, columnSpan, rowSpan })); } // When in manual mode, ensure that every block has a columnStart and rowStart value. for (const clientId of blockOrder) { var _attributes$style$lay; const attributes = getBlockAttributes(clientId); const { columnStart, rowStart, columnSpan = 1, rowSpan = 1 } = (_attributes$style$lay = attributes.style?.layout) !== null && _attributes$style$lay !== void 0 ? _attributes$style$lay : {}; if (columnStart && rowStart) { continue; } const [newColumnStart, newRowStart] = placeBlock(occupiedRects, gridLayout.columnCount, columnSpan, rowSpan, previouslySelectedBlockRect?.columnEnd, previouslySelectedBlockRect?.rowEnd); occupiedRects.push(new GridRect({ columnStart: newColumnStart, rowStart: newRowStart, columnSpan, rowSpan })); updates[clientId] = { style: { ...attributes.style, layout: { ...attributes.style?.layout, columnStart: newColumnStart, rowStart: newRowStart } } }; } // Ensure there's enough rows to fit all blocks. const bottomMostRow = Math.max(...occupiedRects.map(r => r.rowEnd)); if (!gridLayout.rowCount || gridLayout.rowCount < bottomMostRow) { updates[gridClientId] = { layout: { ...gridLayout, rowCount: bottomMostRow } }; } // Unset grid layout attributes for blocks removed from the grid. for (const clientId of previousBlockOrder !== null && previousBlockOrder !== void 0 ? previousBlockOrder : []) { if (!blockOrder.includes(clientId)) { var _attributes$style$lay2; const rootClientId = getBlockRootClientId(clientId); // Block was removed from the editor, so nothing to do. if (rootClientId === null) { continue; } // Check if the block is being moved to another grid. // If so, do nothing and let the new grid parent handle // the attributes. const rootAttributes = getBlockAttributes(rootClientId); if (rootAttributes?.layout?.type === 'grid') { continue; } const attributes = getBlockAttributes(clientId); const { columnStart, rowStart, columnSpan, rowSpan, ...layout } = (_attributes$style$lay2 = attributes.style?.layout) !== null && _attributes$style$lay2 !== void 0 ? _attributes$style$lay2 : {}; if (columnStart || rowStart || columnSpan || rowSpan) { const hasEmptyLayoutAttribute = Object.keys(layout).length === 0; updates[clientId] = setImmutably(attributes, ['style', 'layout'], hasEmptyLayoutAttribute ? undefined : layout); } } } } else { // Remove all of the columnStart and rowStart values // when switching from manual to auto mode, if (previousIsManualPlacement === true) { for (const clientId of blockOrder) { var _attributes$style$lay3; const attributes = getBlockAttributes(clientId); const { columnStart, rowStart, ...layout } = (_attributes$style$lay3 = attributes.style?.layout) !== null && _attributes$style$lay3 !== void 0 ? _attributes$style$lay3 : {}; // Only update attributes if columnStart or rowStart are set. if (columnStart || rowStart) { const hasEmptyLayoutAttribute = Object.keys(layout).length === 0; updates[clientId] = setImmutably(attributes, ['style', 'layout'], hasEmptyLayoutAttribute ? undefined : layout); } } } // Remove row styles in auto mode if (gridLayout.rowCount) { updates[gridClientId] = { layout: { ...gridLayout, rowCount: undefined } }; } } if (Object.keys(updates).length) { __unstableMarkNextChangeAsNotPersistent(); updateBlockAttributes(Object.keys(updates), updates, /* uniqueByBlock: */true); } }, [ // Actual deps to sync: gridClientId, gridLayout, previousBlockOrder, blockOrder, previouslySelectedBlockRect, previousIsManualPlacement, // These won't change, but the linter thinks they might: __unstableMarkNextChangeAsNotPersistent, getBlockAttributes, getBlockRootClientId, updateBlockAttributes]); } /** * @param {GridRect[]} occupiedRects * @param {number} gridColumnCount * @param {number} blockColumnSpan * @param {number} blockRowSpan * @param {number?} startColumn * @param {number?} startRow */ function placeBlock(occupiedRects, gridColumnCount, blockColumnSpan, blockRowSpan, startColumn = 1, startRow = 1) { for (let row = startRow;; row++) { for (let column = row === startRow ? startColumn : 1; column <= gridColumnCount; column++) { const candidateRect = new GridRect({ columnStart: column, rowStart: row, columnSpan: blockColumnSpan, rowSpan: blockRowSpan }); if (!occupiedRects.some(r => r.intersectsRect(candidateRect))) { return [column, row]; } } } } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/grid-visualizer.js /** * WordPress dependencies */ /** * Internal dependencies */ function GridLayoutSync(props) { useGridLayoutSync(props); } function grid_visualizer_GridTools({ clientId, layout }) { const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isBlockSelected, isDraggingBlocks, getTemplateLock, getBlockEditingMode } = select(store); // These calls are purposely ordered from least expensive to most expensive. // Hides the visualizer in cases where the user is not or cannot interact with it. if (!isDraggingBlocks() && !isBlockSelected(clientId) || getTemplateLock(clientId) || getBlockEditingMode(clientId) !== 'default') { return false; } return true; }, [clientId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutSync, { clientId: clientId }), isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizer, { clientId: clientId, parentLayout: layout })] }); } const addGridVisualizerToBlockEdit = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { if (props.attributes.layout?.type !== 'grid') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(grid_visualizer_GridTools, { clientId: props.clientId, layout: props.attributes.layout }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit")] }); }, 'addGridVisualizerToBlockEdit'); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/grid-visualizer', addGridVisualizerToBlockEdit); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js /** * Internal dependencies */ // This utility is intended to assist where the serialization of the border // block support is being skipped for a block but the border related CSS classes // & styles still need to be generated so they can be applied to inner elements. /** * Provides the CSS class names and inline styles for a block's border support * attributes. * * @param {Object} attributes Block attributes. * @return {Object} Border block support derived CSS classes & styles. */ function getBorderClassesAndStyles(attributes) { const border = attributes.style?.border || {}; const className = getBorderClasses(attributes); return { className: className || undefined, style: getInlineStyles({ border }) }; } /** * Derives the border related props for a block from its border block support * attributes. * * Inline styles are forced for named colors to ensure these selections are * reflected when themes do not load their color stylesheets in the editor. * * @param {Object} attributes Block attributes. * * @return {Object} ClassName & style props from border block support. */ function useBorderProps(attributes) { const { colors } = useMultipleOriginColorsAndGradients(); const borderProps = getBorderClassesAndStyles(attributes); const { borderColor } = attributes; // Force inline styles to apply named border colors when themes do not load // their color stylesheets in the editor. if (borderColor) { const borderColorObject = getMultiOriginColor({ colors, namedColor: borderColor }); borderProps.style.borderColor = borderColorObject.color; } return borderProps; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-shadow-props.js /** * Internal dependencies */ // This utility is intended to assist where the serialization of the shadow // block support is being skipped for a block but the shadow related CSS classes // & styles still need to be generated so they can be applied to inner elements. /** * Provides the CSS class names and inline styles for a block's shadow support * attributes. * * @param {Object} attributes Block attributes. * @return {Object} Shadow block support derived CSS classes & styles. */ function getShadowClassesAndStyles(attributes) { const shadow = attributes.style?.shadow || ''; return { style: getInlineStyles({ shadow }) }; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-color-props.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ // The code in this file has largely been lifted from the color block support // hook. // // This utility is intended to assist where the serialization of the colors // block support is being skipped for a block but the color related CSS classes // & styles still need to be generated so they can be applied to inner elements. /** * Provides the CSS class names and inline styles for a block's color support * attributes. * * @param {Object} attributes Block attributes. * * @return {Object} Color block support derived CSS classes & styles. */ function getColorClassesAndStyles(attributes) { const { backgroundColor, textColor, gradient, style } = attributes; // Collect color CSS classes. const backgroundClass = getColorClassName('background-color', backgroundColor); const textClass = getColorClassName('color', textColor); const gradientClass = __experimentalGetGradientClass(gradient); const hasGradient = gradientClass || style?.color?.gradient; // Determine color CSS class name list. const className = dist_clsx(textClass, gradientClass, { // Don't apply the background class if there's a gradient. [backgroundClass]: !hasGradient && !!backgroundClass, 'has-text-color': textColor || style?.color?.text, 'has-background': backgroundColor || style?.color?.background || gradient || style?.color?.gradient, 'has-link-color': style?.elements?.link?.color }); // Collect inline styles for colors. const colorStyles = style?.color || {}; const styleProp = getInlineStyles({ color: colorStyles }); return { className: className || undefined, style: styleProp }; } /** * Determines the color related props for a block derived from its color block * support attributes. * * Inline styles are forced for named colors to ensure these selections are * reflected when themes do not load their color stylesheets in the editor. * * @param {Object} attributes Block attributes. * * @return {Object} ClassName & style props from colors block support. */ function useColorProps(attributes) { const { backgroundColor, textColor, gradient } = attributes; const [userPalette, themePalette, defaultPalette, userGradients, themeGradients, defaultGradients] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', 'color.palette.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default'); const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]); const gradients = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userGradients || []), ...(themeGradients || []), ...(defaultGradients || [])], [userGradients, themeGradients, defaultGradients]); const colorProps = getColorClassesAndStyles(attributes); // Force inline styles to apply colors when themes do not load their color // stylesheets in the editor. if (backgroundColor) { const backgroundColorObject = getColorObjectByAttributeValues(colors, backgroundColor); colorProps.style.backgroundColor = backgroundColorObject.color; } if (gradient) { colorProps.style.background = getGradientValueBySlug(gradients, gradient); } if (textColor) { const textColorObject = getColorObjectByAttributeValues(colors, textColor); colorProps.style.color = textColorObject.color; } return colorProps; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-spacing-props.js /** * Internal dependencies */ // This utility is intended to assist where the serialization of the spacing // block support is being skipped for a block but the spacing related CSS // styles still need to be generated so they can be applied to inner elements. /** * Provides the CSS class names and inline styles for a block's spacing support * attributes. * * @param {Object} attributes Block attributes. * * @return {Object} Spacing block support derived CSS classes & styles. */ function getSpacingClassesAndStyles(attributes) { const { style } = attributes; // Collect inline styles for spacing. const spacingStyles = style?.spacing || {}; const styleProp = getInlineStyles({ spacing: spacingStyles }); return { style: styleProp }; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-typography-props.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { kebabCase: use_typography_props_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); /* * This utility is intended to assist where the serialization of the typography * block support is being skipped for a block but the typography related CSS * styles still need to be generated so they can be applied to inner elements. */ /** * Provides the CSS class names and inline styles for a block's typography support * attributes. * * @param {Object} attributes Block attributes. * @param {Object|boolean} settings Merged theme.json settings * * @return {Object} Typography block support derived CSS classes & styles. */ function getTypographyClassesAndStyles(attributes, settings) { let typographyStyles = attributes?.style?.typography || {}; typographyStyles = { ...typographyStyles, fontSize: getTypographyFontSizeValue({ size: attributes?.style?.typography?.fontSize }, settings) }; const style = getInlineStyles({ typography: typographyStyles }); const fontFamilyClassName = !!attributes?.fontFamily ? `has-${use_typography_props_kebabCase(attributes.fontFamily)}-font-family` : ''; const textAlignClassName = !!attributes?.style?.typography?.textAlign ? `has-text-align-${attributes?.style?.typography?.textAlign}` : ''; const className = dist_clsx(fontFamilyClassName, textAlignClassName, getFontSizeClass(attributes?.fontSize)); return { className, style }; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-cached-truthy.js /** * WordPress dependencies */ /** * Keeps an up-to-date copy of the passed value and returns it. If value becomes falsy, it will return the last truthy copy. * * @param {any} value * @return {any} value */ function useCachedTruthy(value) { const [cachedValue, setCachedValue] = (0,external_wp_element_namespaceObject.useState)(value); (0,external_wp_element_namespaceObject.useEffect)(() => { if (value) { setCachedValue(value); } }, [value]); return cachedValue; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/index.js /** * Internal dependencies */ createBlockEditFilter([align, text_align, hooks_anchor, custom_class_name, style, duotone, position, layout, content_lock_ui, block_hooks, block_bindings, layout_child].filter(Boolean)); createBlockListBlockFilter([align, text_align, background, style, color, dimensions, duotone, font_family, font_size, border, position, block_style_variation, layout_child]); createBlockSaveFilter([align, text_align, hooks_anchor, aria_label, custom_class_name, border, color, style, font_family, font_size]); ;// ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js /** * WordPress dependencies */ /** * Internal dependencies */ const { kebabCase: with_colors_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); /** * Capitalizes the first letter in a string. * * @param {string} str The string whose first letter the function will capitalize. * * @return {string} Capitalized string. */ const upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join(''); /** * Higher order component factory for injecting the `colorsArray` argument as * the colors prop in the `withCustomColors` HOC. * * @param {Array} colorsArray An array of color objects. * * @return {Function} The higher order component. */ const withCustomColorPalette = colorsArray => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: colorsArray }), 'withCustomColorPalette'); /** * Higher order component factory for injecting the editor colors as the * `colors` prop in the `withColors` HOC. * * @return {Function} The higher order component. */ const withEditorColorPalette = () => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => { const [userPalette, themePalette, defaultPalette] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', 'color.palette.default'); const allColors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: allColors }); }, 'withEditorColorPalette'); /** * Helper function used with `createHigherOrderComponent` to create * higher order components for managing color logic. * * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor). * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent. * * @return {Component} The component that can be used as a HOC. */ function createColorHOC(colorTypes, withColorPalette) { const colorMap = colorTypes.reduce((colorObject, colorType) => { return { ...colorObject, ...(typeof colorType === 'string' ? { [colorType]: with_colors_kebabCase(colorType) } : colorType) }; }, {}); return (0,external_wp_compose_namespaceObject.compose)([withColorPalette, WrappedComponent => { return class extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.setters = this.createSetters(); this.colorUtils = { getMostReadableColor: this.getMostReadableColor.bind(this) }; this.state = {}; } getMostReadableColor(colorValue) { const { colors } = this.props; return getMostReadableColor(colors, colorValue); } createSetters() { return Object.keys(colorMap).reduce((settersAccumulator, colorAttributeName) => { const upperFirstColorAttributeName = upperFirst(colorAttributeName); const customColorAttributeName = `custom${upperFirstColorAttributeName}`; settersAccumulator[`set${upperFirstColorAttributeName}`] = this.createSetColor(colorAttributeName, customColorAttributeName); return settersAccumulator; }, {}); } createSetColor(colorAttributeName, customColorAttributeName) { return colorValue => { const colorObject = getColorObjectByColorValue(this.props.colors, colorValue); this.props.setAttributes({ [colorAttributeName]: colorObject && colorObject.slug ? colorObject.slug : undefined, [customColorAttributeName]: colorObject && colorObject.slug ? undefined : colorValue }); }; } static getDerivedStateFromProps({ attributes, colors }, previousState) { return Object.entries(colorMap).reduce((newState, [colorAttributeName, colorContext]) => { const colorObject = getColorObjectByAttributeValues(colors, attributes[colorAttributeName], attributes[`custom${upperFirst(colorAttributeName)}`]); const previousColorObject = previousState[colorAttributeName]; const previousColor = previousColorObject?.color; /** * The "and previousColorObject" condition checks that a previous color object was already computed. * At the start previousColorObject and colorValue are both equal to undefined * bus as previousColorObject does not exist we should compute the object. */ if (previousColor === colorObject.color && previousColorObject) { newState[colorAttributeName] = previousColorObject; } else { newState[colorAttributeName] = { ...colorObject, class: getColorClassName(colorContext, colorObject.slug) }; } return newState; }, {}); } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...this.props, colors: undefined, ...this.state, ...this.setters, colorUtils: this.colorUtils }); } }; }]); } /** * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic * for class generation color value, retrieval and color attribute setting. * * Use this higher-order component to work with a custom set of colors. * * @example * * ```jsx * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ]; * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS ); * // ... * export default compose( * withCustomColors( 'backgroundColor', 'borderColor' ), * MyColorfulComponent, * ); * ``` * * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ). * * @return {Function} Higher-order component. */ function createCustomColorsHOC(colorsArray) { return (...colorTypes) => { const withColorPalette = withCustomColorPalette(colorsArray); return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(createColorHOC(colorTypes, withColorPalette), 'withCustomColors'); }; } /** * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting. * * For use with the default editor/theme color palette. * * @example * * ```jsx * export default compose( * withColors( 'backgroundColor', { textColor: 'color' } ), * MyColorfulComponent, * ); * ``` * * @param {...(Object|string)} colorTypes The arguments can be strings or objects. If the argument is an object, * it should contain the color attribute name as key and the color context as value. * If the argument is a string the value should be the color attribute name, * the color context is computed by applying a kebab case transform to the value. * Color context represents the context/place where the color is going to be used. * The class name of the color is generated using 'has' followed by the color name * and ending with the color context all in kebab case e.g: has-green-background-color. * * @return {Function} Higher-order component. */ function withColors(...colorTypes) { const withColorPalette = withEditorColorPalette(); return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(createColorHOC(colorTypes, withColorPalette), 'withColors'); } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors/index.js ;// ./node_modules/@wordpress/block-editor/build-module/components/gradients/index.js ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/font-size-picker.js /** * WordPress dependencies */ /** * Internal dependencies */ function font_size_picker_FontSizePicker(props) { const [fontSizes, customFontSize] = use_settings_useSettings('typography.fontSizes', 'typography.customFontSize'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FontSizePicker, { ...props, fontSizes: fontSizes, disableCustomFontSizes: !customFontSize }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/font-sizes/README.md */ /* harmony default export */ const font_size_picker = (font_size_picker_FontSizePicker); ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/with-font-sizes.js /** * WordPress dependencies */ /** * Internal dependencies */ const DEFAULT_FONT_SIZES = []; /** * Capitalizes the first letter in a string. * * @param {string} str The string whose first letter the function will capitalize. * * @return {string} Capitalized string. */ const with_font_sizes_upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join(''); /** * Higher-order component, which handles font size logic for class generation, * font size value retrieval, and font size change handling. * * @param {...(Object|string)} fontSizeNames The arguments should all be strings. * Each string contains the font size * attribute name e.g: 'fontSize'. * * @return {Function} Higher-order component. */ /* harmony default export */ const with_font_sizes = ((...fontSizeNames) => { /* * Computes an object whose key is the font size attribute name as passed in the array, * and the value is the custom font size attribute name. * Custom font size is automatically compted by appending custom followed by the font size attribute name in with the first letter capitalized. */ const fontSizeAttributeNames = fontSizeNames.reduce((fontSizeAttributeNamesAccumulator, fontSizeAttributeName) => { fontSizeAttributeNamesAccumulator[fontSizeAttributeName] = `custom${with_font_sizes_upperFirst(fontSizeAttributeName)}`; return fontSizeAttributeNamesAccumulator; }, {}); return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => { const [fontSizes] = use_settings_useSettings('typography.fontSizes'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, fontSizes: fontSizes || DEFAULT_FONT_SIZES }); }, 'withFontSizes'), WrappedComponent => { return class extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.setters = this.createSetters(); this.state = {}; } createSetters() { return Object.entries(fontSizeAttributeNames).reduce((settersAccumulator, [fontSizeAttributeName, customFontSizeAttributeName]) => { const upperFirstFontSizeAttributeName = with_font_sizes_upperFirst(fontSizeAttributeName); settersAccumulator[`set${upperFirstFontSizeAttributeName}`] = this.createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName); return settersAccumulator; }, {}); } createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName) { return fontSizeValue => { const fontSizeObject = this.props.fontSizes?.find(({ size }) => size === Number(fontSizeValue)); this.props.setAttributes({ [fontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? fontSizeObject.slug : undefined, [customFontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? undefined : fontSizeValue }); }; } static getDerivedStateFromProps({ attributes, fontSizes }, previousState) { const didAttributesChange = (customFontSizeAttributeName, fontSizeAttributeName) => { if (previousState[fontSizeAttributeName]) { // If new font size is name compare with the previous slug. if (attributes[fontSizeAttributeName]) { return attributes[fontSizeAttributeName] !== previousState[fontSizeAttributeName].slug; } // If font size is not named, update when the font size value changes. return previousState[fontSizeAttributeName].size !== attributes[customFontSizeAttributeName]; } // In this case we need to build the font size object. return true; }; if (!Object.values(fontSizeAttributeNames).some(didAttributesChange)) { return null; } const newState = Object.entries(fontSizeAttributeNames).filter(([key, value]) => didAttributesChange(value, key)).reduce((newStateAccumulator, [fontSizeAttributeName, customFontSizeAttributeName]) => { const fontSizeAttributeValue = attributes[fontSizeAttributeName]; const fontSizeObject = utils_getFontSize(fontSizes, fontSizeAttributeValue, attributes[customFontSizeAttributeName]); newStateAccumulator[fontSizeAttributeName] = { ...fontSizeObject, class: getFontSizeClass(fontSizeAttributeValue) }; return newStateAccumulator; }, {}); return { ...previousState, ...newState }; } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...this.props, fontSizes: undefined, ...this.state, ...this.setters }); } }; }]), 'withFontSizes'); }); ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/index.js ;// ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js /** * WordPress dependencies */ /** * Internal dependencies */ const block_noop = () => {}; const block_SHOWN_BLOCK_TYPES = 9; /** * Creates a blocks repeater for replacing the current block with a selected block type. * * @return {Object} A blocks completer. */ function createBlockCompleter() { return { name: 'blocks', className: 'block-editor-autocompleters__block', triggerPrefix: '/', useItems(filterValue) { const { rootClientId, selectedBlockId, prioritizedBlocks } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlockClientId, getBlock, getBlockListSettings, getBlockRootClientId } = select(store); const { getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const selectedBlockClientId = getSelectedBlockClientId(); const { name: blockName, attributes } = getBlock(selectedBlockClientId); const activeBlockVariation = getActiveBlockVariation(blockName, attributes); const _rootClientId = getBlockRootClientId(selectedBlockClientId); return { selectedBlockId: activeBlockVariation ? `${blockName}/${activeBlockVariation.name}` : blockName, rootClientId: _rootClientId, prioritizedBlocks: getBlockListSettings(_rootClientId)?.prioritizedInserterBlocks }; }, []); const [items, categories, collections] = use_block_types_state(rootClientId, block_noop, true); const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => { const initialFilteredItems = !!filterValue.trim() ? searchBlockItems(items, categories, collections, filterValue) : orderInserterBlockItems(orderBy(items, 'frecency', 'desc'), prioritizedBlocks); return initialFilteredItems.filter(item => item.id !== selectedBlockId).slice(0, block_SHOWN_BLOCK_TYPES); }, [filterValue, selectedBlockId, items, categories, collections, prioritizedBlocks]); const options = (0,external_wp_element_namespaceObject.useMemo)(() => filteredItems.map(blockItem => { const { title, icon, isDisabled } = blockItem; return { key: `block-${blockItem.id}`, value: blockItem, label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: icon, showColors: true }, "icon"), title] }), isDisabled }; }), [filteredItems]); return [options]; }, allowContext(before, after) { return !(/\S/.test(before) || /\S/.test(after)); }, getOptionCompletion(inserterItem) { const { name, initialAttributes, innerBlocks, syncStatus, content } = inserterItem; return { action: 'replace', value: syncStatus === 'unsynced' ? (0,external_wp_blocks_namespaceObject.parse)(content, { __unstableSkipMigrationLogs: true }) : (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks)) }; } }; } /** * Creates a blocks repeater for replacing the current block with a selected block type. * * @return {Object} A blocks completer. */ /* harmony default export */ const autocompleters_block = (createBlockCompleter()); ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// ./node_modules/@wordpress/icons/build-module/library/post.js /** * WordPress dependencies */ const post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" }) }); /* harmony default export */ const library_post = (post); ;// ./node_modules/@wordpress/block-editor/build-module/autocompleters/link.js /** * WordPress dependencies */ // Disable Reason: Needs to be refactored. // eslint-disable-next-line no-restricted-imports const SHOWN_SUGGESTIONS = 10; /** * Creates a suggestion list for links to posts or pages. * * @return {Object} A links completer. */ function createLinkCompleter() { return { name: 'links', className: 'block-editor-autocompleters__link', triggerPrefix: '[[', options: async letters => { let options = await external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/search', { per_page: SHOWN_SUGGESTIONS, search: letters, type: 'post', order_by: 'menu_order' }) }); options = options.filter(option => option.title !== ''); return options; }, getOptionKeywords(item) { const expansionWords = item.title.split(/\s+/); return [...expansionWords]; }, getOptionLabel(item) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: item.subtype === 'page' ? library_page : library_post }, "icon"), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title)] }); }, getOptionCompletion(item) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: item.url, children: item.title }); } }; } /** * Creates a suggestion list for links to posts or pages.. * * @return {Object} A link completer. */ /* harmony default export */ const autocompleters_link = (createLinkCompleter()); ;// ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Shared reference to an empty array for cases where it is important to avoid * returning a new array reference on every invocation. * * @type {Array} */ const autocomplete_EMPTY_ARRAY = []; function useCompleters({ completers = autocomplete_EMPTY_ARRAY }) { const { name } = useBlockEditContext(); return (0,external_wp_element_namespaceObject.useMemo)(() => { let filteredCompleters = [...completers, autocompleters_link]; if (name === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, '__experimentalSlashInserter', false)) { filteredCompleters = [...filteredCompleters, autocompleters_block]; } if ((0,external_wp_hooks_namespaceObject.hasFilter)('editor.Autocomplete.completers')) { // Provide copies so filters may directly modify them. if (filteredCompleters === completers) { filteredCompleters = filteredCompleters.map(completer => ({ ...completer })); } filteredCompleters = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.Autocomplete.completers', filteredCompleters, name); } return filteredCompleters; }, [completers, name]); } function useBlockEditorAutocompleteProps(props) { return (0,external_wp_components_namespaceObject.__unstableUseAutocompleteProps)({ ...props, completers: useCompleters(props) }); } /** * Wrap the default Autocomplete component with one that supports a filter hook * for customizing its list of autocompleters. * * @type {import('react').FC} */ function BlockEditorAutocomplete(props) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Autocomplete, { ...props, completers: useCompleters(props) }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/autocomplete/README.md */ /* harmony default export */ const autocomplete = (BlockEditorAutocomplete); ;// ./node_modules/@wordpress/icons/build-module/library/fullscreen.js /** * WordPress dependencies */ const fullscreen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" }) }); /* harmony default export */ const library_fullscreen = (fullscreen); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-full-height-alignment-control/index.js /** * WordPress dependencies */ function BlockFullHeightAlignmentControl({ isActive, label = (0,external_wp_i18n_namespaceObject.__)('Full height'), onToggle, isDisabled }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { isActive: isActive, icon: library_fullscreen, label: label, onClick: () => onToggle(!isActive), disabled: isDisabled }); } /* harmony default export */ const block_full_height_alignment_control = (BlockFullHeightAlignmentControl); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js /** * WordPress dependencies */ const block_alignment_matrix_control_noop = () => {}; /** * The alignment matrix control allows users to quickly adjust inner block alignment. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-alignment-matrix-control/README.md * * @example * ```jsx * function Example() { * return ( * <BlockControls> * <BlockAlignmentMatrixControl * label={ __( 'Change content position' ) } * value="center" * onChange={ ( nextPosition ) => * setAttributes( { contentPosition: nextPosition } ) * } * /> * </BlockControls> * ); * } * ``` * * @param {Object} props Component props. * @param {string} props.label Label for the control. Defaults to 'Change matrix alignment'. * @param {Function} props.onChange Function to execute upon change of matrix state. * @param {string} props.value Content alignment location. One of: 'center', 'center center', * 'center left', 'center right', 'top center', 'top left', * 'top right', 'bottom center', 'bottom left', 'bottom right'. * @param {boolean} props.isDisabled Whether the control should be disabled. * @return {Element} The BlockAlignmentMatrixControl component. */ function BlockAlignmentMatrixControl(props) { const { label = (0,external_wp_i18n_namespaceObject.__)('Change matrix alignment'), onChange = block_alignment_matrix_control_noop, value = 'center', isDisabled } = props; const icon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.AlignmentMatrixControl.Icon, { value: value }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: 'bottom-start' }, renderToggle: ({ onToggle, isOpen }) => { const openOnArrowDown = event => { if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); onToggle(); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: onToggle, "aria-haspopup": "true", "aria-expanded": isOpen, onKeyDown: openOnArrowDown, label: label, icon: icon, showTooltip: true, disabled: isDisabled }); }, renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.AlignmentMatrixControl, { hasFocusBorder: false, onChange: onChange, value: value }) }); } /* harmony default export */ const block_alignment_matrix_control = (BlockAlignmentMatrixControl); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-title/use-block-display-title.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns the block's configured title as a string, or empty if the title * cannot be determined. * * @example * * ```js * useBlockDisplayTitle( { clientId: 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', maximumLength: 17 } ); * ``` * * @param {Object} props * @param {string} props.clientId Client ID of block. * @param {number|undefined} props.maximumLength The maximum length that the block title string may be before truncated. * @param {string|undefined} props.context The context to pass to `getBlockLabel`. * @return {?string} Block title. */ function useBlockDisplayTitle({ clientId, maximumLength, context }) { const blockTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!clientId) { return null; } const { getBlockName, getBlockAttributes } = select(store); const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const blockName = getBlockName(clientId); const blockType = getBlockType(blockName); if (!blockType) { return null; } const attributes = getBlockAttributes(clientId); const label = (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes, context); // If the label is defined we prioritize it over a possible block variation title match. if (label !== blockType.title) { return label; } const match = getActiveBlockVariation(blockName, attributes); // Label will fallback to the title if no label is defined for the current label context. return match?.title || blockType.title; }, [clientId, context]); if (!blockTitle) { return null; } if (maximumLength && maximumLength > 0 && blockTitle.length > maximumLength) { const omission = '...'; return blockTitle.slice(0, maximumLength - omission.length) + omission; } return blockTitle; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-title/index.js /** * Internal dependencies */ /** * Renders the block's configured title as a string, or empty if the title * cannot be determined. * * @example * * ```jsx * <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" maximumLength={ 17 }/> * ``` * * @param {Object} props * @param {string} props.clientId Client ID of block. * @param {number|undefined} props.maximumLength The maximum length that the block title string may be before truncated. * @param {string|undefined} props.context The context to pass to `getBlockLabel`. * * @return {JSX.Element} Block title. */ function BlockTitle({ clientId, maximumLength, context }) { return useBlockDisplayTitle({ clientId, maximumLength, context }); } ;// ./node_modules/@wordpress/block-editor/build-module/utils/get-editor-region.js /** * Gets the editor region for a given editor canvas element or * returns the passed element if no region is found * * @param { Object } editor The editor canvas element. * @return { Object } The editor region or given editor element */ function getEditorRegion(editor) { var _Array$from$find, _editorCanvas$closest; if (!editor) { return null; } // If there are multiple editors, we need to find the iframe that contains our contentRef to make sure // we're focusing the region that contains this editor. const editorCanvas = (_Array$from$find = Array.from(document.querySelectorAll('iframe[name="editor-canvas"]').values()).find(iframe => { // Find the iframe that contains our contentRef const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; return iframeDocument === editor.ownerDocument; })) !== null && _Array$from$find !== void 0 ? _Array$from$find : editor; // The region is provided by the editor, not the block-editor. // We should send focus to the region if one is available to reuse the // same interface for navigating landmarks. If no region is available, // use the canvas instead. return (_editorCanvas$closest = editorCanvas?.closest('[role="region"]')) !== null && _editorCanvas$closest !== void 0 ? _editorCanvas$closest : editorCanvas; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-breadcrumb/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block breadcrumb component, displaying the hierarchy of the current block selection as a breadcrumb. * * @param {Object} props Component props. * @param {string} props.rootLabelText Translated label for the root element of the breadcrumb trail. * @return {Element} Block Breadcrumb. */ function BlockBreadcrumb({ rootLabelText }) { const { selectBlock, clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { clientId, parents, hasSelection } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectionStart, getSelectedBlockClientId, getEnabledBlockParents } = unlock(select(store)); const selectedBlockClientId = getSelectedBlockClientId(); return { parents: getEnabledBlockParents(selectedBlockClientId), clientId: selectedBlockClientId, hasSelection: !!getSelectionStart().clientId }; }, []); const rootLabel = rootLabelText || (0,external_wp_i18n_namespaceObject.__)('Document'); // We don't care about this specific ref, but this is a way // to get a ref within the editor canvas so we can focus it later. const blockRef = (0,external_wp_element_namespaceObject.useRef)(); useBlockElementRef(clientId, blockRef); /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { className: "block-editor-block-breadcrumb", role: "list", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block breadcrumb'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: !hasSelection ? 'block-editor-block-breadcrumb__current' : undefined, "aria-current": !hasSelection ? 'true' : undefined, children: [hasSelection && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", className: "block-editor-block-breadcrumb__button", onClick: () => { // Find the block editor wrapper for the selected block const blockEditor = blockRef.current?.closest('.editor-styles-wrapper'); clearSelectedBlock(); getEditorRegion(blockEditor)?.focus(); }, children: rootLabel }), !hasSelection && rootLabel, !!clientId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: chevron_right_small, className: "block-editor-block-breadcrumb__separator" })] }), parents.map(parentClientId => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", className: "block-editor-block-breadcrumb__button", onClick: () => selectBlock(parentClientId), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTitle, { clientId: parentClientId, maximumLength: 35 }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: chevron_right_small, className: "block-editor-block-breadcrumb__separator" })] }, parentClientId)), !!clientId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "block-editor-block-breadcrumb__current", "aria-current": "true", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTitle, { clientId: clientId, maximumLength: 35 }) })] }) /* eslint-enable jsx-a11y/no-redundant-roles */; } /* harmony default export */ const block_breadcrumb = (BlockBreadcrumb); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-content-overlay/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBlockOverlayActive(clientId) { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { __unstableHasActiveBlockOverlayActive } = select(store); return __unstableHasActiveBlockOverlayActive(clientId); }, [clientId]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-block-toolbar-popover-props.js /** * WordPress dependencies */ /** * Internal dependencies */ const COMMON_PROPS = { placement: 'top-start' }; // By default the toolbar sets the `shift` prop. If the user scrolls the page // down the toolbar will stay on screen by adopting a sticky position at the // top of the viewport. const DEFAULT_PROPS = { ...COMMON_PROPS, flip: false, shift: true }; // When there isn't enough height between the top of the block and the editor // canvas, the `shift` prop is set to `false`, as it will cause the block to be // obscured. The `flip` behavior is enabled, which positions the toolbar below // the block. This only happens if the block is smaller than the viewport, as // otherwise the toolbar will be off-screen. const RESTRICTED_HEIGHT_PROPS = { ...COMMON_PROPS, flip: true, shift: false }; /** * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height. * * @param {Element} contentElement The DOM element that represents the editor content or canvas. * @param {Element} selectedBlockElement The outer DOM element of the first selected block. * @param {Element} scrollContainer The scrollable container for the contentElement. * @param {number} toolbarHeight The height of the toolbar in pixels. * @param {boolean} isSticky Whether or not the selected block is sticky or fixed. * * @return {Object} The popover props used to determine the position of the toolbar. */ function getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky) { if (!contentElement || !selectedBlockElement) { return DEFAULT_PROPS; } // Get how far the content area has been scrolled. const scrollTop = scrollContainer?.scrollTop || 0; const blockRect = getElementBounds(selectedBlockElement); const contentRect = contentElement.getBoundingClientRect(); // Get the vertical position of top of the visible content area. const topOfContentElementInViewport = scrollTop + contentRect.top; // The document element's clientHeight represents the viewport height. const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight; // The restricted height area is calculated as the sum of the // vertical position of the visible content area, plus the height // of the block toolbar. const restrictedTopArea = topOfContentElementInViewport + toolbarHeight; const hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea; const isBlockTallerThanViewport = blockRect.height > viewportHeight - toolbarHeight; // Sticky blocks are treated as if they will never have enough space for the toolbar above. if (!isSticky && (hasSpaceForToolbarAbove || isBlockTallerThanViewport)) { return DEFAULT_PROPS; } return RESTRICTED_HEIGHT_PROPS; } /** * Determines the desired popover positioning behavior, returning a set of appropriate props. * * @param {Object} elements * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas. * @param {string} elements.clientId The clientId of the first selected block. * * @return {Object} The popover props used to determine the position of the toolbar. */ function useBlockToolbarPopoverProps({ contentElement, clientId }) { const selectedBlockElement = useBlockElement(clientId); const [toolbarHeight, setToolbarHeight] = (0,external_wp_element_namespaceObject.useState)(0); const { blockIndex, isSticky } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockIndex, getBlockAttributes } = select(store); return { blockIndex: getBlockIndex(clientId), isSticky: hasStickyOrFixedPositionValue(getBlockAttributes(clientId)) }; }, [clientId]); const scrollContainer = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!contentElement) { return; } return (0,external_wp_dom_namespaceObject.getScrollContainer)(contentElement); }, [contentElement]); const [props, setProps] = (0,external_wp_element_namespaceObject.useState)(() => getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky)); const popoverRef = (0,external_wp_compose_namespaceObject.useRefEffect)(popoverNode => { setToolbarHeight(popoverNode.offsetHeight); }, []); const updateProps = (0,external_wp_element_namespaceObject.useCallback)(() => setProps(getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky)), [contentElement, selectedBlockElement, scrollContainer, toolbarHeight]); // Update props when the block is moved. This also ensures the props are // correct on initial mount, and when the selected block or content element // changes (since the callback ref will update). (0,external_wp_element_namespaceObject.useLayoutEffect)(updateProps, [blockIndex, updateProps]); // Update props when the viewport is resized or the block is resized. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!contentElement || !selectedBlockElement) { return; } // Update the toolbar props on viewport resize. const contentView = contentElement?.ownerDocument?.defaultView; contentView?.addEventHandler?.('resize', updateProps); // Update the toolbar props on block resize. let resizeObserver; const blockView = selectedBlockElement?.ownerDocument?.defaultView; if (blockView.ResizeObserver) { resizeObserver = new blockView.ResizeObserver(updateProps); resizeObserver.observe(selectedBlockElement); } return () => { contentView?.removeEventHandler?.('resize', updateProps); if (resizeObserver) { resizeObserver.disconnect(); } }; }, [updateProps, contentElement, selectedBlockElement]); return { ...props, ref: popoverRef }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-selected-block-tool-props.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns props for the selected block tools and empty block inserter. * * @param {string} clientId Selected block client ID. */ function useSelectedBlockToolProps(clientId) { const selectedBlockProps = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId, getBlockParents, __experimentalGetBlockListSettingsForBlocks, isBlockInsertionPointVisible, getBlockInsertionPoint, getBlockOrder, hasMultiSelection, getLastMultiSelectedBlockClientId } = select(store); const blockParentsClientIds = getBlockParents(clientId); // Get Block List Settings for all ancestors of the current Block clientId. const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds); // Get the clientId of the topmost parent with the capture toolbars setting. const capturingClientId = blockParentsClientIds.find(parentClientId => parentBlockListSettings[parentClientId]?.__experimentalCaptureToolbars); let isInsertionPointVisible = false; if (isBlockInsertionPointVisible()) { const insertionPoint = getBlockInsertionPoint(); const order = getBlockOrder(insertionPoint.rootClientId); isInsertionPointVisible = order[insertionPoint.index] === clientId; } return { capturingClientId, isInsertionPointVisible, lastClientId: hasMultiSelection() ? getLastMultiSelectedBlockClientId() : null, rootClientId: getBlockRootClientId(clientId) }; }, [clientId]); return selectedBlockProps; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/empty-block-inserter.js /** * External dependencies */ /** * Internal dependencies */ function EmptyBlockInserter({ clientId, __unstableContentRef }) { const { capturingClientId, isInsertionPointVisible, lastClientId, rootClientId } = useSelectedBlockToolProps(clientId); const popoverProps = useBlockToolbarPopoverProps({ contentElement: __unstableContentRef?.current, clientId }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { clientId: capturingClientId || clientId, bottomClientId: lastClientId, className: dist_clsx('block-editor-block-list__block-side-inserter-popover', { 'is-insertion-point-visible': isInsertionPointVisible }), __unstableContentRef: __unstableContentRef, ...popoverProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-list__empty-block-inserter", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { position: "bottom right", rootClientId: rootClientId, clientId: clientId, __experimentalIsQuick: true }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js /** * WordPress dependencies */ const SCROLL_INACTIVE_DISTANCE_PX = 50; const SCROLL_INTERVAL_MS = 25; const PIXELS_PER_SECOND_PER_PERCENTAGE = 1000; const VELOCITY_MULTIPLIER = PIXELS_PER_SECOND_PER_PERCENTAGE * (SCROLL_INTERVAL_MS / 1000); /** * React hook that scrolls the scroll container when a block is being dragged. * * @return {Function[]} `startScrolling`, `scrollOnDragOver`, `stopScrolling` * functions to be called in `onDragStart`, `onDragOver` * and `onDragEnd` events respectively. */ function useScrollWhenDragging() { const dragStartYRef = (0,external_wp_element_namespaceObject.useRef)(null); const velocityYRef = (0,external_wp_element_namespaceObject.useRef)(null); const scrollParentYRef = (0,external_wp_element_namespaceObject.useRef)(null); const scrollEditorIntervalRef = (0,external_wp_element_namespaceObject.useRef)(null); // Clear interval when unmounting. (0,external_wp_element_namespaceObject.useEffect)(() => () => { if (scrollEditorIntervalRef.current) { clearInterval(scrollEditorIntervalRef.current); scrollEditorIntervalRef.current = null; } }, []); const startScrolling = (0,external_wp_element_namespaceObject.useCallback)(event => { dragStartYRef.current = event.clientY; // Find nearest parent(s) to scroll. scrollParentYRef.current = (0,external_wp_dom_namespaceObject.getScrollContainer)(event.target); scrollEditorIntervalRef.current = setInterval(() => { if (scrollParentYRef.current && velocityYRef.current) { const newTop = scrollParentYRef.current.scrollTop + velocityYRef.current; // Setting `behavior: 'smooth'` as a scroll property seems to hurt performance. // Better to use a small scroll interval. scrollParentYRef.current.scroll({ top: newTop }); } }, SCROLL_INTERVAL_MS); }, []); const scrollOnDragOver = (0,external_wp_element_namespaceObject.useCallback)(event => { if (!scrollParentYRef.current) { return; } const scrollParentHeight = scrollParentYRef.current.offsetHeight; const offsetDragStartPosition = dragStartYRef.current - scrollParentYRef.current.offsetTop; const offsetDragPosition = event.clientY - scrollParentYRef.current.offsetTop; if (event.clientY > offsetDragStartPosition) { // User is dragging downwards. const moveableDistance = Math.max(scrollParentHeight - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); const dragDistance = Math.max(offsetDragPosition - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); const distancePercentage = moveableDistance === 0 || dragDistance === 0 ? 0 : dragDistance / moveableDistance; velocityYRef.current = VELOCITY_MULTIPLIER * distancePercentage; } else if (event.clientY < offsetDragStartPosition) { // User is dragging upwards. const moveableDistance = Math.max(offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); const dragDistance = Math.max(offsetDragStartPosition - offsetDragPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); const distancePercentage = moveableDistance === 0 || dragDistance === 0 ? 0 : dragDistance / moveableDistance; velocityYRef.current = -VELOCITY_MULTIPLIER * distancePercentage; } else { velocityYRef.current = 0; } }, []); const stopScrolling = () => { dragStartYRef.current = null; scrollParentYRef.current = null; if (scrollEditorIntervalRef.current) { clearInterval(scrollEditorIntervalRef.current); scrollEditorIntervalRef.current = null; } }; return [startScrolling, scrollOnDragOver, stopScrolling]; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const BlockDraggable = ({ appendToOwnerDocument, children, clientIds, cloneClassname, elementId, onDragStart, onDragEnd, fadeWhenDisabled = false, dragComponent }) => { const { srcRootClientId, isDraggable, icon, visibleInserter, getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canMoveBlocks, getBlockRootClientId, getBlockName, getBlockAttributes, isBlockInsertionPointVisible } = select(store); const { getBlockType: _getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const rootClientId = getBlockRootClientId(clientIds[0]); const blockName = getBlockName(clientIds[0]); const variation = getActiveBlockVariation(blockName, getBlockAttributes(clientIds[0])); return { srcRootClientId: rootClientId, isDraggable: canMoveBlocks(clientIds), icon: variation?.icon || _getBlockType(blockName)?.icon, visibleInserter: isBlockInsertionPointVisible(), getBlockType: _getBlockType }; }, [clientIds]); const isDraggingRef = (0,external_wp_element_namespaceObject.useRef)(false); const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging(); const { getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { startDraggingBlocks, stopDraggingBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); // Stop dragging blocks if the block draggable is unmounted. (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { if (isDraggingRef.current) { stopDraggingBlocks(); } }; }, []); // Find the root of the editor iframe. const blockEl = useBlockElement(clientIds[0]); const editorRoot = blockEl?.closest('body'); /* * Add a dragover event listener to the editor root to track the blocks being dragged over. * The listener has to be inside the editor iframe otherwise the target isn't accessible. */ (0,external_wp_element_namespaceObject.useEffect)(() => { if (!editorRoot || !fadeWhenDisabled) { return; } const onDragOver = event => { if (!event.target.closest('[data-block]')) { return; } const draggedBlockNames = getBlockNamesByClientId(clientIds); const targetClientId = event.target.closest('[data-block]').getAttribute('data-block'); const allowedBlocks = getAllowedBlocks(targetClientId); const targetBlockName = getBlockNamesByClientId([targetClientId])[0]; /* * Check if the target is valid to drop in. * If the target's allowedBlocks is an empty array, * it isn't a container block, in which case we check * its parent's validity instead. */ let dropTargetValid; if (allowedBlocks?.length === 0) { const targetRootClientId = getBlockRootClientId(targetClientId); const targetRootBlockName = getBlockNamesByClientId([targetRootClientId])[0]; const rootAllowedBlocks = getAllowedBlocks(targetRootClientId); dropTargetValid = isDropTargetValid(getBlockType, rootAllowedBlocks, draggedBlockNames, targetRootBlockName); } else { dropTargetValid = isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName); } /* * Update the body class to reflect if drop target is valid. * This has to be done on the document body because the draggable * chip is rendered outside of the editor iframe. */ if (!dropTargetValid && !visibleInserter) { window?.document?.body?.classList?.add('block-draggable-invalid-drag-token'); } else { window?.document?.body?.classList?.remove('block-draggable-invalid-drag-token'); } }; const throttledOnDragOver = (0,external_wp_compose_namespaceObject.throttle)(onDragOver, 200); editorRoot.addEventListener('dragover', throttledOnDragOver); return () => { editorRoot.removeEventListener('dragover', throttledOnDragOver); }; }, [clientIds, editorRoot, fadeWhenDisabled, getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId, getBlockType, visibleInserter]); if (!isDraggable) { return children({ draggable: false }); } const transferData = { type: 'block', srcClientIds: clientIds, srcRootClientId }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Draggable, { appendToOwnerDocument: appendToOwnerDocument, cloneClassname: cloneClassname, __experimentalTransferDataType: "wp-blocks", transferData: transferData, onDragStart: event => { // Defer hiding the dragged source element to the next // frame to enable dragging. window.requestAnimationFrame(() => { startDraggingBlocks(clientIds); isDraggingRef.current = true; startScrolling(event); if (onDragStart) { onDragStart(); } }); }, onDragOver: scrollOnDragOver, onDragEnd: () => { stopDraggingBlocks(); isDraggingRef.current = false; stopScrolling(); if (onDragEnd) { onDragEnd(); } }, __experimentalDragComponent: // Check against `undefined` so that `null` can be used to disable // the default drag component. dragComponent !== undefined ? dragComponent : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockDraggableChip, { count: clientIds.length, icon: icon, fadeWhenDisabled: true }), elementId: elementId, children: ({ onDraggableStart, onDraggableEnd }) => { return children({ draggable: true, onDragStart: onDraggableStart, onDragEnd: onDraggableEnd }); } }); }; /* harmony default export */ const block_draggable = (BlockDraggable); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/mover-description.js /** * WordPress dependencies */ const getMovementDirection = (moveDirection, orientation) => { if (moveDirection === 'up') { if (orientation === 'horizontal') { return (0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left'; } return 'up'; } else if (moveDirection === 'down') { if (orientation === 'horizontal') { return (0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right'; } return 'down'; } return null; }; /** * Return a label for the block movement controls depending on block position. * * @param {number} selectedCount Number of blocks selected. * @param {string} type Block type - in the case of a single block, should * define its 'type'. I.e. 'Text', 'Heading', 'Image' etc. * @param {number} firstIndex The index (position - 1) of the first block selected. * @param {boolean} isFirst This is the first block. * @param {boolean} isLast This is the last block. * @param {number} dir Direction of movement (> 0 is considered to be going * down, < 0 is up). * @param {string} orientation The orientation of the block movers, vertical or * horizontal. * * @return {string | undefined} Label for the block movement controls. */ function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) { const position = firstIndex + 1; if (selectedCount > 1) { return getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation); } if (isFirst && isLast) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)('Block %s is the only block, and cannot be moved'), type); } if (dir > 0 && !isLast) { // Moving down. const movementDirection = getMovementDirection('down', orientation); if (movementDirection === 'down') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d down to position %3$d'), type, position, position + 1); } if (movementDirection === 'left') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d left to position %3$d'), type, position, position + 1); } if (movementDirection === 'right') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d right to position %3$d'), type, position, position + 1); } } if (dir > 0 && isLast) { // Moving down, and is the last item. const movementDirection = getMovementDirection('down', orientation); if (movementDirection === 'down') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved down'), type); } if (movementDirection === 'left') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved left'), type); } if (movementDirection === 'right') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved right'), type); } } if (dir < 0 && !isFirst) { // Moving up. const movementDirection = getMovementDirection('up', orientation); if (movementDirection === 'up') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d up to position %3$d'), type, position, position - 1); } if (movementDirection === 'left') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d left to position %3$d'), type, position, position - 1); } if (movementDirection === 'right') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d right to position %3$d'), type, position, position - 1); } } if (dir < 0 && isFirst) { // Moving up, and is the first item. const movementDirection = getMovementDirection('up', orientation); if (movementDirection === 'up') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved up'), type); } if (movementDirection === 'left') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved left'), type); } if (movementDirection === 'right') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved right'), type); } } } /** * Return a label for the block movement controls depending on block position. * * @param {number} selectedCount Number of blocks selected. * @param {number} firstIndex The index (position - 1) of the first block selected. * @param {boolean} isFirst This is the first block. * @param {boolean} isLast This is the last block. * @param {number} dir Direction of movement (> 0 is considered to be going * down, < 0 is up). * @param {string} orientation The orientation of the block movers, vertical or * horizontal. * * @return {string | undefined} Label for the block movement controls. */ function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation) { const position = firstIndex + 1; if (isFirst && isLast) { // All blocks are selected return (0,external_wp_i18n_namespaceObject.__)('All blocks are selected, and cannot be moved'); } if (dir > 0 && !isLast) { // moving down const movementDirection = getMovementDirection('down', orientation); if (movementDirection === 'down') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d down by one place'), selectedCount, position); } if (movementDirection === 'left') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d left by one place'), selectedCount, position); } if (movementDirection === 'right') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d right by one place'), selectedCount, position); } } if (dir > 0 && isLast) { // moving down, and the selected blocks are the last item const movementDirection = getMovementDirection('down', orientation); if (movementDirection === 'down') { return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved down as they are already at the bottom'); } if (movementDirection === 'left') { return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved left as they are already are at the leftmost position'); } if (movementDirection === 'right') { return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved right as they are already are at the rightmost position'); } } if (dir < 0 && !isFirst) { // moving up const movementDirection = getMovementDirection('up', orientation); if (movementDirection === 'up') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d up by one place'), selectedCount, position); } if (movementDirection === 'left') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d left by one place'), selectedCount, position); } if (movementDirection === 'right') { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d right by one place'), selectedCount, position); } } if (dir < 0 && isFirst) { // moving up, and the selected blocks are the first item const movementDirection = getMovementDirection('up', orientation); if (movementDirection === 'up') { return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved up as they are already at the top'); } if (movementDirection === 'left') { return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved left as they are already are at the leftmost position'); } if (movementDirection === 'right') { return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved right as they are already are at the rightmost position'); } } } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/button.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const getArrowIcon = (direction, orientation) => { if (direction === 'up') { if (orientation === 'horizontal') { return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left; } return chevron_up; } else if (direction === 'down') { if (orientation === 'horizontal') { return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right; } return chevron_down; } return null; }; const getMovementDirectionLabel = (moveDirection, orientation) => { if (moveDirection === 'up') { if (orientation === 'horizontal') { return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)('Move right') : (0,external_wp_i18n_namespaceObject.__)('Move left'); } return (0,external_wp_i18n_namespaceObject.__)('Move up'); } else if (moveDirection === 'down') { if (orientation === 'horizontal') { return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)('Move left') : (0,external_wp_i18n_namespaceObject.__)('Move right'); } return (0,external_wp_i18n_namespaceObject.__)('Move down'); } return null; }; const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)(({ clientIds, direction, orientation: moverOrientation, ...props }, ref) => { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockMoverButton); const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds]; const blocksCount = normalizedClientIds.length; const { disabled } = props; const { blockType, isDisabled, rootClientId, isFirst, isLast, firstIndex, orientation = 'vertical' } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockIndex, getBlockRootClientId, getBlockOrder, getBlock, getBlockListSettings } = select(store); const firstClientId = normalizedClientIds[0]; const blockRootClientId = getBlockRootClientId(firstClientId); const firstBlockIndex = getBlockIndex(firstClientId); const lastBlockIndex = getBlockIndex(normalizedClientIds[normalizedClientIds.length - 1]); const blockOrder = getBlockOrder(blockRootClientId); const block = getBlock(firstClientId); const isFirstBlock = firstBlockIndex === 0; const isLastBlock = lastBlockIndex === blockOrder.length - 1; const { orientation: blockListOrientation } = getBlockListSettings(blockRootClientId) || {}; return { blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, isDisabled: disabled || (direction === 'up' ? isFirstBlock : isLastBlock), rootClientId: blockRootClientId, firstIndex: firstBlockIndex, isFirst: isFirstBlock, isLast: isLastBlock, orientation: moverOrientation || blockListOrientation }; }, [clientIds, direction]); const { moveBlocksDown, moveBlocksUp } = (0,external_wp_data_namespaceObject.useDispatch)(store); const moverFunction = direction === 'up' ? moveBlocksUp : moveBlocksDown; const onClick = event => { moverFunction(clientIds, rootClientId); if (props.onClick) { props.onClick(event); } }; const descriptionId = `block-editor-block-mover-button__description-${instanceId}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref: ref, className: dist_clsx('block-editor-block-mover-button', `is-${direction}-button`), icon: getArrowIcon(direction, orientation), label: getMovementDirectionLabel(direction, orientation), "aria-describedby": descriptionId, ...props, onClick: isDisabled ? null : onClick, disabled: isDisabled, accessibleWhenDisabled: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation) })] }); }); const BlockMoverUpButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "up", ref: ref, ...props }); }); const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "down", ref: ref, ...props }); }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockMover({ clientIds, hideDragHandle, isBlockMoverUpButtonDisabled, isBlockMoverDownButtonDisabled }) { const { canMove, rootClientId, isFirst, isLast, orientation, isManualGrid } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getBlockAttributes; const { getBlockIndex, getBlockListSettings, canMoveBlocks, getBlockOrder, getBlockRootClientId, getBlockAttributes } = select(store); const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds]; const firstClientId = normalizedClientIds[0]; const _rootClientId = getBlockRootClientId(firstClientId); const firstIndex = getBlockIndex(firstClientId); const lastIndex = getBlockIndex(normalizedClientIds[normalizedClientIds.length - 1]); const blockOrder = getBlockOrder(_rootClientId); const { layout = {} } = (_getBlockAttributes = getBlockAttributes(_rootClientId)) !== null && _getBlockAttributes !== void 0 ? _getBlockAttributes : {}; return { canMove: canMoveBlocks(clientIds), rootClientId: _rootClientId, isFirst: firstIndex === 0, isLast: lastIndex === blockOrder.length - 1, orientation: getBlockListSettings(_rootClientId)?.orientation, isManualGrid: layout.type === 'grid' && layout.isManualPlacement && window.__experimentalEnableGridInteractivity }; }, [clientIds]); if (!canMove || isFirst && isLast && !rootClientId || hideDragHandle && isManualGrid) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { className: dist_clsx('block-editor-block-mover', { 'is-horizontal': orientation === 'horizontal' }), children: [!hideDragHandle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_draggable, { clientIds: clientIds, fadeWhenDisabled: true, children: draggableProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, icon: drag_handle, className: "block-editor-block-mover__drag-handle", label: (0,external_wp_i18n_namespaceObject.__)('Drag') // Should not be able to tab to drag handle as this // button can only be used with a pointer device. , tabIndex: "-1", ...draggableProps }) }), !isManualGrid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-mover__move-button-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: itemProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverUpButton, { disabled: isBlockMoverUpButtonDisabled, clientIds: clientIds, ...itemProps }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: itemProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverDownButton, { disabled: isBlockMoverDownButtonDisabled, clientIds: clientIds, ...itemProps }) })] })] }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-mover/README.md */ /* harmony default export */ const block_mover = (BlockMover); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ const { clearTimeout: utils_clearTimeout, setTimeout: utils_setTimeout } = window; const DEBOUNCE_TIMEOUT = 200; /** * Hook that creates debounced callbacks when the node is hovered or focused. * * @param {Object} props Component props. * @param {Object} props.ref Element reference. * @param {boolean} props.isFocused Whether the component has current focus. * @param {number} props.highlightParent Whether to highlight the parent block. It defaults in highlighting the selected block. * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. */ function useDebouncedShowGestures({ ref, isFocused, highlightParent, debounceTimeout = DEBOUNCE_TIMEOUT }) { const { getSelectedBlockClientId, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { toggleBlockHighlight } = (0,external_wp_data_namespaceObject.useDispatch)(store); const timeoutRef = (0,external_wp_element_namespaceObject.useRef)(); const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().isDistractionFree, []); const handleOnChange = nextIsFocused => { if (nextIsFocused && isDistractionFree) { return; } const selectedBlockClientId = getSelectedBlockClientId(); const clientId = highlightParent ? getBlockRootClientId(selectedBlockClientId) : selectedBlockClientId; toggleBlockHighlight(clientId, nextIsFocused); }; const getIsHovered = () => { return ref?.current && ref.current.matches(':hover'); }; const shouldHideGestures = () => { const isHovered = getIsHovered(); return !isFocused && !isHovered; }; const clearTimeoutRef = () => { const timeout = timeoutRef.current; if (timeout && utils_clearTimeout) { utils_clearTimeout(timeout); } }; const debouncedShowGestures = event => { if (event) { event.stopPropagation(); } clearTimeoutRef(); handleOnChange(true); }; const debouncedHideGestures = event => { if (event) { event.stopPropagation(); } clearTimeoutRef(); timeoutRef.current = utils_setTimeout(() => { if (shouldHideGestures()) { handleOnChange(false); } }, debounceTimeout); }; (0,external_wp_element_namespaceObject.useEffect)(() => () => { /** * We need to call the change handler with `isFocused` * set to false on unmount because we also clear the * timeout that would handle that. */ handleOnChange(false); clearTimeoutRef(); }, []); return { debouncedShowGestures, debouncedHideGestures }; } /** * Hook that provides gesture events for DOM elements * that interact with the isFocused state. * * @param {Object} props Component props. * @param {Object} props.ref Element reference. * @param {number} [props.highlightParent=false] Whether to highlight the parent block. It defaults to highlighting the selected block. * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. */ function useShowHoveredOrFocusedGestures({ ref, highlightParent = false, debounceTimeout = DEBOUNCE_TIMEOUT }) { const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); const { debouncedShowGestures, debouncedHideGestures } = useDebouncedShowGestures({ ref, debounceTimeout, isFocused, highlightParent }); const registerRef = (0,external_wp_element_namespaceObject.useRef)(false); const isFocusedWithin = () => { return ref?.current && ref.current.contains(ref.current.ownerDocument.activeElement); }; (0,external_wp_element_namespaceObject.useEffect)(() => { const node = ref.current; const handleOnFocus = () => { if (isFocusedWithin()) { setIsFocused(true); debouncedShowGestures(); } }; const handleOnBlur = () => { if (!isFocusedWithin()) { setIsFocused(false); debouncedHideGestures(); } }; /** * Events are added via DOM events (vs. React synthetic events), * as the child React components swallow mouse events. */ if (node && !registerRef.current) { node.addEventListener('focus', handleOnFocus, true); node.addEventListener('blur', handleOnBlur, true); registerRef.current = true; } return () => { if (node) { node.removeEventListener('focus', handleOnFocus); node.removeEventListener('blur', handleOnBlur); } }; }, [ref, registerRef, setIsFocused, debouncedShowGestures, debouncedHideGestures]); return { onMouseMove: debouncedShowGestures, onMouseLeave: debouncedHideGestures }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block parent selector component, displaying the hierarchy of the * current block selection as a single icon to "go up" a level. * * @return {Component} Parent block selector. */ function BlockParentSelector() { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { parentClientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockParents, getSelectedBlockClientId, getParentSectionBlock } = unlock(select(store)); const selectedBlockClientId = getSelectedBlockClientId(); const parentSection = getParentSectionBlock(selectedBlockClientId); const parents = getBlockParents(selectedBlockClientId); const _parentClientId = parentSection !== null && parentSection !== void 0 ? parentSection : parents[parents.length - 1]; return { parentClientId: _parentClientId }; }, []); const blockInformation = useBlockDisplayInformation(parentClientId); // Allows highlighting the parent block outline when focusing or hovering // the parent block selector within the child. const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({ ref: nodeRef, highlightParent: true }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-parent-selector", ref: nodeRef, ...showHoveredOrFocusedGestures, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { className: "block-editor-block-parent-selector__button", onClick: () => selectBlock(parentClientId), label: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the block's parent. */ (0,external_wp_i18n_namespaceObject.__)('Select parent block: %s'), blockInformation?.title), showTooltip: true, icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: blockInformation?.icon }) }) }, parentClientId); } ;// ./node_modules/@wordpress/icons/build-module/library/copy.js /** * WordPress dependencies */ const copy_copy = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z" }) }); /* harmony default export */ const library_copy = (copy_copy); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js /** * WordPress dependencies */ /** * Internal dependencies */ function PreviewBlockPopover({ blocks }) { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); if (isMobile) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__popover-preview-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { className: "block-editor-block-switcher__popover-preview", placement: "right-start", focusOnMount: false, offset: 16, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-switcher__preview", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__preview-title", children: (0,external_wp_i18n_namespaceObject.__)('Preview') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { viewportWidth: 500, blocks: blocks })] }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-variation-transformations.js /** * WordPress dependencies */ /** * Internal dependencies */ const block_variation_transformations_EMPTY_OBJECT = {}; function useBlockVariationTransforms({ clientIds, blocks }) { const { activeBlockVariation, blockVariationTransformations } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockAttributes, canRemoveBlocks } = select(store); const { getActiveBlockVariation, getBlockVariations } = select(external_wp_blocks_namespaceObject.store); const canRemove = canRemoveBlocks(clientIds); // Only handle single selected blocks for now. if (blocks.length !== 1 || !canRemove) { return block_variation_transformations_EMPTY_OBJECT; } const [firstBlock] = blocks; return { blockVariationTransformations: getBlockVariations(firstBlock.name, 'transform'), activeBlockVariation: getActiveBlockVariation(firstBlock.name, getBlockAttributes(firstBlock.clientId)) }; }, [clientIds, blocks]); const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => { return blockVariationTransformations?.filter(({ name }) => name !== activeBlockVariation?.name); }, [blockVariationTransformations, activeBlockVariation]); return transformations; } const BlockVariationTransformations = ({ transformations, onSelect, blocks }) => { const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [hoveredTransformItemName && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewBlockPopover, { blocks: (0,external_wp_blocks_namespaceObject.cloneBlock)(blocks[0], transformations.find(({ name }) => name === hoveredTransformItemName).attributes) }), transformations?.map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockVariationTransformationItem, { item: item, onSelect: onSelect, setHoveredTransformItemName: setHoveredTransformItemName }, item.name))] }); }; function BlockVariationTransformationItem({ item, onSelect, setHoveredTransformItemName }) { const { name, icon, title } = item; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name), onClick: event => { event.preventDefault(); onSelect(name); }, onMouseLeave: () => setHoveredTransformItemName(null), onMouseEnter: () => setHoveredTransformItemName(name), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: icon, showColors: true }), title] }); } /* harmony default export */ const block_variation_transformations = (BlockVariationTransformations); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Helper hook to group transformations to display them in a specific order in the UI. * For now we group only priority content driven transformations(ex. paragraph -> heading). * * Later on we could also group 'layout' transformations(ex. paragraph -> group) and * display them in different sections. * * @param {Object[]} possibleBlockTransformations The available block transformations. * @return {Record<string, Object[]>} The grouped block transformations. */ function useGroupedTransforms(possibleBlockTransformations) { const priorityContentTransformationBlocks = { 'core/paragraph': 1, 'core/heading': 2, 'core/list': 3, 'core/quote': 4 }; const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => { const priorityTextTransformsNames = Object.keys(priorityContentTransformationBlocks); const groupedPossibleTransforms = possibleBlockTransformations.reduce((accumulator, item) => { const { name } = item; if (priorityTextTransformsNames.includes(name)) { accumulator.priorityTextTransformations.push(item); } else { accumulator.restTransformations.push(item); } return accumulator; }, { priorityTextTransformations: [], restTransformations: [] }); /** * If there is only one priority text transformation and it's a Quote, * is should move to the rest transformations. This is because Quote can * be a container for any block type, so in multi-block selection it will * always be suggested, even for non-text blocks. */ if (groupedPossibleTransforms.priorityTextTransformations.length === 1 && groupedPossibleTransforms.priorityTextTransformations[0].name === 'core/quote') { const singleQuote = groupedPossibleTransforms.priorityTextTransformations.pop(); groupedPossibleTransforms.restTransformations.push(singleQuote); } return groupedPossibleTransforms; }, [possibleBlockTransformations]); // Order the priority text transformations. transformations.priorityTextTransformations.sort(({ name: currentName }, { name: nextName }) => { return priorityContentTransformationBlocks[currentName] < priorityContentTransformationBlocks[nextName] ? -1 : 1; }); return transformations; } const BlockTransformationsMenu = ({ className, possibleBlockTransformations, possibleBlockVariationTransformations, onSelect, onSelectVariation, blocks }) => { const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)(); const { priorityTextTransformations, restTransformations } = useGroupedTransforms(possibleBlockTransformations); // We have to check if both content transformations(priority and rest) are set // in order to create a separate MenuGroup for them. const hasBothContentTransformations = priorityTextTransformations.length && restTransformations.length; const restTransformItems = !!restTransformations.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RestTransformationItems, { restTransformations: restTransformations, onSelect: onSelect, setHoveredTransformItemName: setHoveredTransformItemName }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Transform to'), className: className, children: [hoveredTransformItemName && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewBlockPopover, { blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, hoveredTransformItemName) }), !!possibleBlockVariationTransformations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_variation_transformations, { transformations: possibleBlockVariationTransformations, blocks: blocks, onSelect: onSelectVariation }), priorityTextTransformations.map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTransformationItem, { item: item, onSelect: onSelect, setHoveredTransformItemName: setHoveredTransformItemName }, item.name)), !hasBothContentTransformations && restTransformItems] }), !!hasBothContentTransformations && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { className: className, children: restTransformItems })] }); }; function RestTransformationItems({ restTransformations, onSelect, setHoveredTransformItemName }) { return restTransformations.map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTransformationItem, { item: item, onSelect: onSelect, setHoveredTransformItemName: setHoveredTransformItemName }, item.name)); } function BlockTransformationItem({ item, onSelect, setHoveredTransformItemName }) { const { name, icon, title, isDisabled } = item; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name), onClick: event => { event.preventDefault(); onSelect(name); }, disabled: isDisabled, onMouseLeave: () => setHoveredTransformItemName(null), onMouseEnter: () => setHoveredTransformItemName(name), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: icon, showColors: true }), title] }); } /* harmony default export */ const block_transformations_menu = (BlockTransformationsMenu); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/utils.js /** * WordPress dependencies */ /** * Returns the active style from the given className. * * @param {Array} styles Block styles. * @param {string} className Class name * * @return {?Object} The active style. */ function getActiveStyle(styles, className) { for (const style of new (external_wp_tokenList_default())(className).values()) { if (style.indexOf('is-style-') === -1) { continue; } const potentialStyleName = style.substring(9); const activeStyle = styles?.find(({ name }) => name === potentialStyleName); if (activeStyle) { return activeStyle; } } return getDefaultStyle(styles); } /** * Replaces the active style in the block's className. * * @param {string} className Class name. * @param {?Object} activeStyle The replaced style. * @param {Object} newStyle The replacing style. * * @return {string} The updated className. */ function replaceActiveStyle(className, activeStyle, newStyle) { const list = new (external_wp_tokenList_default())(className); if (activeStyle) { list.remove('is-style-' + activeStyle.name); } list.add('is-style-' + newStyle.name); return list.value; } /** * Returns a collection of styles that can be represented on the frontend. * The function checks a style collection for a default style. If none is found, it adds one to * act as a fallback for when there is no active style applied to a block. The default item also serves * as a switch on the frontend to deactivate non-default styles. * * @param {Array} styles Block styles. * * @return {Array<Object?>} The style collection. */ function getRenderedStyles(styles) { if (!styles || styles.length === 0) { return []; } return getDefaultStyle(styles) ? styles : [{ name: 'default', label: (0,external_wp_i18n_namespaceObject._x)('Default', 'block style'), isDefault: true }, ...styles]; } /** * Returns a style object from a collection of styles where that style object is the default block style. * * @param {Array} styles Block styles. * * @return {?Object} The default style object, if found. */ function getDefaultStyle(styles) { return styles?.find(style => style.isDefault); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/use-styles-for-block.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * * @param {WPBlock} block Block object. * @param {WPBlockType} type Block type settings. * @return {WPBlock} A generic block ready for styles preview. */ function useGenericPreviewBlock(block, type) { return (0,external_wp_element_namespaceObject.useMemo)(() => { const example = type?.example; const blockName = type?.name; if (example && blockName) { return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, { attributes: example.attributes, innerBlocks: example.innerBlocks }); } if (block) { return (0,external_wp_blocks_namespaceObject.cloneBlock)(block); } }, [type?.example ? block?.name : block, type]); } /** * @typedef useStylesForBlocksArguments * @property {string} clientId Block client ID. * @property {() => void} onSwitch Block style switch callback function. */ /** * * @param {useStylesForBlocksArguments} useStylesForBlocks arguments. * @return {Object} Results of the select methods. */ function useStylesForBlocks({ clientId, onSwitch }) { const selector = select => { const { getBlock } = select(store); const block = getBlock(clientId); if (!block) { return {}; } const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); return { block, blockType, styles: getBlockStyles(block.name), className: block.attributes.className || '' }; }; const { styles, block, blockType, className } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const stylesToRender = getRenderedStyles(styles); const activeStyle = getActiveStyle(stylesToRender, className); const genericPreviewBlock = useGenericPreviewBlock(block, blockType); const onSelect = style => { const styleClassName = replaceActiveStyle(className, activeStyle, style); updateBlockAttributes(clientId, { className: styleClassName }); onSwitch(); }; return { onSelect, stylesToRender, activeStyle, genericPreviewBlock, className }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/menu-items.js /** * WordPress dependencies */ /** * Internal dependencies */ const menu_items_noop = () => {}; function BlockStylesMenuItems({ clientId, onSwitch = menu_items_noop }) { const { onSelect, stylesToRender, activeStyle } = useStylesForBlocks({ clientId, onSwitch }); if (!stylesToRender || stylesToRender.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: stylesToRender.map(style => { const menuItemText = style.label || style.name; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: activeStyle.name === style.name ? library_check : null, onClick: () => onSelect(style), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "span", limit: 18, ellipsizeMode: "tail", truncate: true, children: menuItemText }) }, style.name); }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-styles-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockStylesMenu({ hoveredBlock, onSwitch }) { const { clientId } = hoveredBlock; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Styles'), className: "block-editor-block-switcher__styles__menugroup", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesMenuItems, { clientId: clientId, onSwitch: onSwitch }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/utils.js /** * WordPress dependencies */ /** * Try to find a matching block by a block's name in a provided * block. We recurse through InnerBlocks and return the reference * of the matched block (it could be an InnerBlock). * If no match is found return nothing. * * @param {WPBlock} block The block to try to find a match. * @param {string} selectedBlockName The block's name to use for matching condition. * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks. * * @return {WPBlock | undefined} The matched block if found or nothing(`undefined`). */ const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = new Set()) => { const { clientId, name, innerBlocks = [] } = block; // Check if block has been consumed already. if (consumedBlocks.has(clientId)) { return; } if (name === selectedBlockName) { return block; } // Try to find a matching block from InnerBlocks recursively. for (const innerBlock of innerBlocks) { const match = getMatchingBlockByName(innerBlock, selectedBlockName, consumedBlocks); if (match) { return match; } } }; /** * Find and return the block attributes to retain through * the transformation, based on Block Type's `role:content` * attributes. If no `role:content` attributes exist, * return selected block's attributes. * * @param {string} name Block type's namespaced name. * @param {Object} attributes Selected block's attributes. * @return {Object} The block's attributes to retain. */ const getRetainedBlockAttributes = (name, attributes) => { const contentAttributes = (0,external_wp_blocks_namespaceObject.getBlockAttributesNamesByRole)(name, 'content'); if (!contentAttributes?.length) { return attributes; } return contentAttributes.reduce((_accumulator, attribute) => { if (attributes[attribute]) { _accumulator[attribute] = attributes[attribute]; } return _accumulator; }, {}); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/use-transformed-patterns.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Mutate the matched block's attributes by getting * which block type's attributes to retain and prioritize * them in the merging of the attributes. * * @param {WPBlock} match The matched block. * @param {WPBlock} selectedBlock The selected block. * @return {void} */ const transformMatchingBlock = (match, selectedBlock) => { // Get the block attributes to retain through the transformation. const retainedBlockAttributes = getRetainedBlockAttributes(selectedBlock.name, selectedBlock.attributes); match.attributes = { ...match.attributes, ...retainedBlockAttributes }; }; /** * By providing the selected blocks and pattern's blocks * find the matching blocks, transform them and return them. * If not all selected blocks are matched, return nothing. * * @param {WPBlock[]} selectedBlocks The selected blocks. * @param {WPBlock[]} patternBlocks The pattern's blocks. * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched. */ const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => { // Clone Pattern's blocks to produce new clientIds and be able to mutate the matches. const _patternBlocks = patternBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); /** * Keep track of the consumed pattern blocks. * This is needed because we loop the selected blocks * and for example we may have selected two paragraphs and * the pattern's blocks could have more `paragraphs`. */ const consumedBlocks = new Set(); for (const selectedBlock of selectedBlocks) { let isMatch = false; for (const patternBlock of _patternBlocks) { const match = getMatchingBlockByName(patternBlock, selectedBlock.name, consumedBlocks); if (!match) { continue; } isMatch = true; consumedBlocks.add(match.clientId); // We update (mutate) the matching pattern block. transformMatchingBlock(match, selectedBlock); // No need to loop through other pattern's blocks. break; } // Bail early if a selected block has not been matched. if (!isMatch) { return; } } return _patternBlocks; }; /** * @typedef {WPBlockPattern & {transformedBlocks: WPBlock[]}} TransformedBlockPattern */ /** * Custom hook that accepts patterns from state and the selected * blocks and tries to match these with the pattern's blocks. * If all selected blocks are matched with a Pattern's block, * we transform them by retaining block's attributes with `role:content`. * The transformed pattern's blocks are set to a new pattern * property `transformedBlocks`. * * @param {WPBlockPattern[]} patterns Patterns from state. * @param {WPBlock[]} selectedBlocks The currently selected blocks. * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks. */ const useTransformedPatterns = (patterns, selectedBlocks) => { return (0,external_wp_element_namespaceObject.useMemo)(() => patterns.reduce((accumulator, _pattern) => { const transformedBlocks = getPatternTransformedBlocks(selectedBlocks, _pattern.blocks); if (transformedBlocks) { accumulator.push({ ..._pattern, transformedBlocks }); } return accumulator; }, []), [patterns, selectedBlocks]); }; /* harmony default export */ const use_transformed_patterns = (useTransformedPatterns); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ function PatternTransformationsMenu({ blocks, patterns: statePatterns, onSelect }) { const [showTransforms, setShowTransforms] = (0,external_wp_element_namespaceObject.useState)(false); const patterns = use_transformed_patterns(statePatterns, blocks); if (!patterns.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { className: "block-editor-block-switcher__pattern__transforms__menugroup", children: [showTransforms && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewPatternsPopover, { patterns: patterns, onSelect: onSelect }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: event => { event.preventDefault(); setShowTransforms(!showTransforms); }, icon: chevron_right, children: (0,external_wp_i18n_namespaceObject.__)('Patterns') })] }); } function PreviewPatternsPopover({ patterns, onSelect }) { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__popover-preview-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { className: "block-editor-block-switcher__popover-preview", placement: isMobile ? 'bottom' : 'right-start', offset: 16, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__preview is-pattern-list-preview", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_transformations_menu_BlockPatternsList, { patterns: patterns, onSelect: onSelect }) }) }) }); } function pattern_transformations_menu_BlockPatternsList({ patterns, onSelect }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { role: "listbox", className: "block-editor-block-switcher__preview-patterns-container", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list'), children: patterns.map(pattern => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_transformations_menu_BlockPattern, { pattern: pattern, onSelect: onSelect }, pattern.name)) }); } function pattern_transformations_menu_BlockPattern({ pattern, onSelect }) { // TODO check pattern/preview width... const baseClassName = 'block-editor-block-switcher__preview-patterns-container'; const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(pattern_transformations_menu_BlockPattern, `${baseClassName}-list__item-description`); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: `${baseClassName}-list__list-item`, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "option", "aria-label": pattern.title, "aria-describedby": pattern.description ? descriptionId : undefined, className: `${baseClassName}-list__item` }), onClick: () => onSelect(pattern.transformedBlocks), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { blocks: pattern.transformedBlocks, viewportWidth: pattern.viewportWidth || 500 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}-list__item-title`, children: pattern.title })] }), !!pattern.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: pattern.description })] }); } /* harmony default export */ const pattern_transformations_menu = (PatternTransformationsMenu); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockSwitcherDropdownMenuContents({ onClose, clientIds, hasBlockStyles, canRemove }) { const { replaceBlocks, multiSelect, updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { possibleBlockTransformations, patterns, blocks, isUsingBindings } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockAttributes, getBlocksByClientId, getBlockRootClientId, getBlockTransformItems, __experimentalGetPatternTransformItems } = select(store); const rootClientId = getBlockRootClientId(clientIds[0]); const _blocks = getBlocksByClientId(clientIds); return { blocks: _blocks, possibleBlockTransformations: getBlockTransformItems(_blocks, rootClientId), patterns: __experimentalGetPatternTransformItems(_blocks, rootClientId), isUsingBindings: clientIds.every(clientId => !!getBlockAttributes(clientId)?.metadata?.bindings) }; }, [clientIds]); const blockVariationTransformations = useBlockVariationTransforms({ clientIds, blocks }); function selectForMultipleBlocks(insertedBlocks) { if (insertedBlocks.length > 1) { multiSelect(insertedBlocks[0].clientId, insertedBlocks[insertedBlocks.length - 1].clientId); } } // Simple block transformation based on the `Block Transforms` API. function onBlockTransform(name) { const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name); replaceBlocks(clientIds, newBlocks); selectForMultipleBlocks(newBlocks); } function onBlockVariationTransform(name) { updateBlockAttributes(blocks[0].clientId, { ...blockVariationTransformations.find(({ name: variationName }) => variationName === name).attributes }); } // Pattern transformation through the `Patterns` API. function onPatternTransform(transformedBlocks) { replaceBlocks(clientIds, transformedBlocks); selectForMultipleBlocks(transformedBlocks); } /** * The `isTemplate` check is a stopgap solution here. * Ideally, the Transforms API should handle this * by allowing to exclude blocks from wildcard transformations. */ const isSingleBlock = blocks.length === 1; const isTemplate = isSingleBlock && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]); const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate; const hasPossibleBlockVariationTransformations = !!blockVariationTransformations?.length; const hasPatternTransformation = !!patterns?.length && canRemove; const hasBlockOrBlockVariationTransforms = hasPossibleBlockTransformations || hasPossibleBlockVariationTransformations; const hasContents = hasBlockStyles || hasBlockOrBlockVariationTransforms || hasPatternTransformation; if (!hasContents) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-switcher__no-transforms", children: (0,external_wp_i18n_namespaceObject.__)('No transforms.') }); } const connectedBlockDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject._x)('This block is connected.', 'block toolbar button label and description') : (0,external_wp_i18n_namespaceObject._x)('These blocks are connected.', 'block toolbar button label and description'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-switcher__container", children: [hasPatternTransformation && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_transformations_menu, { blocks: blocks, patterns: patterns, onSelect: transformedBlocks => { onPatternTransform(transformedBlocks); onClose(); } }), hasBlockOrBlockVariationTransforms && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_transformations_menu, { className: "block-editor-block-switcher__transforms__menugroup", possibleBlockTransformations: possibleBlockTransformations, possibleBlockVariationTransformations: blockVariationTransformations, blocks: blocks, onSelect: name => { onBlockTransform(name); onClose(); }, onSelectVariation: name => { onBlockVariationTransform(name); onClose(); } }), hasBlockStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesMenu, { hoveredBlock: blocks[0], onSwitch: onClose }), isUsingBindings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "block-editor-block-switcher__binding-indicator", children: connectedBlockDescription }) })] }); } const BlockSwitcher = ({ clientIds }) => { const { hasContentOnlyLocking, canRemove, hasBlockStyles, icon, invalidBlocks, isReusable, isTemplate, isDisabled } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getTemplateLock, getBlocksByClientId, getBlockAttributes, canRemoveBlocks, getBlockEditingMode } = select(store); const { getBlockStyles, getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const _blocks = getBlocksByClientId(clientIds); if (!_blocks.length || _blocks.some(block => !block)) { return { invalidBlocks: true }; } const [{ name: firstBlockName }] = _blocks; const _isSingleBlockSelected = _blocks.length === 1; const blockType = getBlockType(firstBlockName); const editingMode = getBlockEditingMode(clientIds[0]); let _icon; let _hasTemplateLock; if (_isSingleBlockSelected) { const match = getActiveBlockVariation(firstBlockName, getBlockAttributes(clientIds[0])); // Take into account active block variations. _icon = match?.icon || blockType.icon; _hasTemplateLock = getTemplateLock(clientIds[0]) === 'contentOnly'; } else { const isSelectionOfSameType = new Set(_blocks.map(({ name }) => name)).size === 1; _hasTemplateLock = clientIds.some(id => getTemplateLock(id) === 'contentOnly'); // When selection consists of blocks of multiple types, display an // appropriate icon to communicate the non-uniformity. _icon = isSelectionOfSameType ? blockType.icon : library_copy; } return { canRemove: canRemoveBlocks(clientIds), hasBlockStyles: _isSingleBlockSelected && !!getBlockStyles(firstBlockName)?.length, icon: _icon, isReusable: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isReusableBlock)(_blocks[0]), isTemplate: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isTemplatePart)(_blocks[0]), hasContentOnlyLocking: _hasTemplateLock, isDisabled: editingMode !== 'default' }; }, [clientIds]); const blockTitle = useBlockDisplayTitle({ clientId: clientIds?.[0], maximumLength: 35 }); const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'), []); if (invalidBlocks) { return null; } const isSingleBlock = clientIds.length === 1; const blockSwitcherLabel = isSingleBlock ? blockTitle : (0,external_wp_i18n_namespaceObject.__)('Multiple blocks selected'); const blockIndicatorText = (isReusable || isTemplate) && !showIconLabels && blockTitle ? blockTitle : undefined; const hideDropdown = isDisabled || !hasBlockStyles && !canRemove || hasContentOnlyLocking; if (hideDropdown) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { disabled: true, className: "block-editor-block-switcher__no-switcher-icon", title: blockSwitcherLabel, icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { className: "block-editor-block-switcher__toggle", icon: icon, showColors: true }), text: blockIndicatorText }) }); } const blockSwitcherDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject.__)('Change block type or style') : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of blocks. */ (0,external_wp_i18n_namespaceObject._n)('Change type of %d block', 'Change type of %d blocks', clientIds.length), clientIds.length); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { className: "block-editor-block-switcher", label: blockSwitcherLabel, popoverProps: { placement: 'bottom-start', className: 'block-editor-block-switcher__popover' }, icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { className: "block-editor-block-switcher__toggle", icon: icon, showColors: true }), text: blockIndicatorText, toggleProps: { description: blockSwitcherDescription, ...toggleProps }, menuProps: { orientation: 'both' }, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSwitcherDropdownMenuContents, { onClose: onClose, clientIds: clientIds, hasBlockStyles: hasBlockStyles, canRemove: canRemove }) }) }) }); }; /* harmony default export */ const block_switcher = (BlockSwitcher); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-toolbar-last-item.js /** * WordPress dependencies */ const { Fill: __unstableBlockToolbarLastItem, Slot: block_toolbar_last_item_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableBlockToolbarLastItem'); __unstableBlockToolbarLastItem.Slot = block_toolbar_last_item_Slot; /* harmony default export */ const block_toolbar_last_item = (__unstableBlockToolbarLastItem); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/supports.js /** * WordPress dependencies */ const ALIGN_SUPPORT_KEY = 'align'; const ALIGN_WIDE_SUPPORT_KEY = 'alignWide'; const supports_BORDER_SUPPORT_KEY = '__experimentalBorder'; const supports_COLOR_SUPPORT_KEY = 'color'; const CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName'; const supports_FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily'; const supports_FONT_SIZE_SUPPORT_KEY = 'typography.fontSize'; const supports_LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight'; /** * Key within block settings' support array indicating support for font style. */ const supports_FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle'; /** * Key within block settings' support array indicating support for font weight. */ const supports_FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight'; /** * Key within block settings' supports array indicating support for text * align e.g. settings found in `block.json`. */ const supports_TEXT_ALIGN_SUPPORT_KEY = 'typography.textAlign'; /** * Key within block settings' supports array indicating support for text * columns e.g. settings found in `block.json`. */ const supports_TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns'; /** * Key within block settings' supports array indicating support for text * decorations e.g. settings found in `block.json`. */ const supports_TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration'; /** * Key within block settings' supports array indicating support for writing mode * e.g. settings found in `block.json`. */ const supports_WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode'; /** * Key within block settings' supports array indicating support for text * transforms e.g. settings found in `block.json`. */ const supports_TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform'; /** * Key within block settings' supports array indicating support for letter-spacing * e.g. settings found in `block.json`. */ const supports_LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing'; const LAYOUT_SUPPORT_KEY = 'layout'; const supports_TYPOGRAPHY_SUPPORT_KEYS = [supports_LINE_HEIGHT_SUPPORT_KEY, supports_FONT_SIZE_SUPPORT_KEY, supports_FONT_STYLE_SUPPORT_KEY, supports_FONT_WEIGHT_SUPPORT_KEY, supports_FONT_FAMILY_SUPPORT_KEY, supports_TEXT_ALIGN_SUPPORT_KEY, supports_TEXT_COLUMNS_SUPPORT_KEY, supports_TEXT_DECORATION_SUPPORT_KEY, supports_TEXT_TRANSFORM_SUPPORT_KEY, supports_WRITING_MODE_SUPPORT_KEY, supports_LETTER_SPACING_SUPPORT_KEY]; const EFFECTS_SUPPORT_KEYS = ['shadow']; const supports_SPACING_SUPPORT_KEY = 'spacing'; const supports_styleSupportKeys = [...EFFECTS_SUPPORT_KEYS, ...supports_TYPOGRAPHY_SUPPORT_KEYS, supports_BORDER_SUPPORT_KEY, supports_COLOR_SUPPORT_KEY, supports_SPACING_SUPPORT_KEY]; /** * Returns true if the block defines support for align. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const hasAlignSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, ALIGN_SUPPORT_KEY); /** * Returns the block support value for align, if defined. * * @param {string|Object} nameOrType Block name or type object. * @return {unknown} The block support value. */ const getAlignSupport = nameOrType => getBlockSupport(nameOrType, ALIGN_SUPPORT_KEY); /** * Returns true if the block defines support for align wide. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const hasAlignWideSupport = nameOrType => hasBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY); /** * Returns the block support value for align wide, if defined. * * @param {string|Object} nameOrType Block name or type object. * @return {unknown} The block support value. */ const getAlignWideSupport = nameOrType => getBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY); /** * Determine whether there is block support for border properties. * * @param {string|Object} nameOrType Block name or type object. * @param {string} feature Border feature to check support for. * * @return {boolean} Whether there is support. */ function supports_hasBorderSupport(nameOrType, feature = 'any') { if (external_wp_element_namespaceObject.Platform.OS !== 'web') { return false; } const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_BORDER_SUPPORT_KEY); if (support === true) { return true; } if (feature === 'any') { return !!(support?.color || support?.radius || support?.width || support?.style); } return !!support?.[feature]; } /** * Get block support for border properties. * * @param {string|Object} nameOrType Block name or type object. * @param {string} feature Border feature to get. * * @return {unknown} The block support. */ const getBorderSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_BORDER_SUPPORT_KEY, feature]); /** * Returns true if the block defines support for color. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const supports_hasColorSupport = nameOrType => { const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false); }; /** * Returns true if the block defines support for link color. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const supports_hasLinkColorSupport = nameOrType => { if (Platform.OS !== 'web') { return false; } const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.link; }; /** * Returns true if the block defines support for gradient color. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const supports_hasGradientSupport = nameOrType => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.gradients; }; /** * Returns true if the block defines support for background color. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const supports_hasBackgroundColorSupport = nameOrType => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport && colorSupport.background !== false; }; /** * Returns true if the block defines support for text-align. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const hasTextAlignSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY); /** * Returns the block support value for text-align, if defined. * * @param {string|Object} nameOrType Block name or type object. * @return {unknown} The block support value. */ const getTextAlignSupport = nameOrType => getBlockSupport(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY); /** * Returns true if the block defines support for background color. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const supports_hasTextColorSupport = nameOrType => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport && colorSupport.text !== false; }; /** * Get block support for color properties. * * @param {string|Object} nameOrType Block name or type object. * @param {string} feature Color feature to get. * * @return {unknown} The block support. */ const getColorSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_COLOR_SUPPORT_KEY, feature]); /** * Returns true if the block defines support for custom class name. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const hasCustomClassNameSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true); /** * Returns the block support value for custom class name, if defined. * * @param {string|Object} nameOrType Block name or type object. * @return {unknown} The block support value. */ const getCustomClassNameSupport = nameOrType => getBlockSupport(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true); /** * Returns true if the block defines support for font family. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const hasFontFamilySupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY); /** * Returns the block support value for font family, if defined. * * @param {string|Object} nameOrType Block name or type object. * @return {unknown} The block support value. */ const getFontFamilySupport = nameOrType => getBlockSupport(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY); /** * Returns true if the block defines support for font size. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const hasFontSizeSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_SIZE_SUPPORT_KEY); /** * Returns the block support value for font size, if defined. * * @param {string|Object} nameOrType Block name or type object. * @return {unknown} The block support value. */ const getFontSizeSupport = nameOrType => getBlockSupport(nameOrType, supports_FONT_SIZE_SUPPORT_KEY); /** * Returns true if the block defines support for layout. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const hasLayoutSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, LAYOUT_SUPPORT_KEY); /** * Returns the block support value for layout, if defined. * * @param {string|Object} nameOrType Block name or type object. * @return {unknown} The block support value. */ const getLayoutSupport = nameOrType => getBlockSupport(nameOrType, LAYOUT_SUPPORT_KEY); /** * Returns true if the block defines support for style. * * @param {string|Object} nameOrType Block name or type object. * @return {boolean} Whether the block supports the feature. */ const supports_hasStyleSupport = nameOrType => supports_styleSupportKeys.some(key => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key)); ;// ./node_modules/@wordpress/block-editor/build-module/components/use-paste-styles/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Determine if the copied text looks like serialized blocks or not. * Since plain text will always get parsed into a freeform block, * we check that if the parsed blocks is anything other than that. * * @param {string} text The copied text. * @return {boolean} True if the text looks like serialized blocks, false otherwise. */ function hasSerializedBlocks(text) { try { const blocks = (0,external_wp_blocks_namespaceObject.parse)(text, { __unstableSkipMigrationLogs: true, __unstableSkipAutop: true }); if (blocks.length === 1 && blocks[0].name === 'core/freeform') { // It's likely that the text is just plain text and not serialized blocks. return false; } return true; } catch (err) { // Parsing error, the text is not serialized blocks. // (Even though that it technically won't happen) return false; } } /** * Style attributes are attributes being added in `block-editor/src/hooks/*`. * (Except for some unrelated to style like `anchor` or `settings`.) * They generally represent the default block supports. */ const STYLE_ATTRIBUTES = { align: hasAlignSupport, borderColor: nameOrType => supports_hasBorderSupport(nameOrType, 'color'), backgroundColor: supports_hasBackgroundColorSupport, textAlign: hasTextAlignSupport, textColor: supports_hasTextColorSupport, gradient: supports_hasGradientSupport, className: hasCustomClassNameSupport, fontFamily: hasFontFamilySupport, fontSize: hasFontSizeSupport, layout: hasLayoutSupport, style: supports_hasStyleSupport }; /** * Get the "style attributes" from a given block to a target block. * * @param {WPBlock} sourceBlock The source block. * @param {WPBlock} targetBlock The target block. * @return {Object} the filtered attributes object. */ function getStyleAttributes(sourceBlock, targetBlock) { return Object.entries(STYLE_ATTRIBUTES).reduce((attributes, [attributeKey, hasSupport]) => { // Only apply the attribute if both blocks support it. if (hasSupport(sourceBlock.name) && hasSupport(targetBlock.name)) { // Override attributes that are not present in the block to their defaults. attributes[attributeKey] = sourceBlock.attributes[attributeKey]; } return attributes; }, {}); } /** * Update the target blocks with style attributes recursively. * * @param {WPBlock[]} targetBlocks The target blocks to be updated. * @param {WPBlock[]} sourceBlocks The source blocks to get th style attributes from. * @param {Function} updateBlockAttributes The function to update the attributes. */ function recursivelyUpdateBlockAttributes(targetBlocks, sourceBlocks, updateBlockAttributes) { for (let index = 0; index < Math.min(sourceBlocks.length, targetBlocks.length); index += 1) { updateBlockAttributes(targetBlocks[index].clientId, getStyleAttributes(sourceBlocks[index], targetBlocks[index])); recursivelyUpdateBlockAttributes(targetBlocks[index].innerBlocks, sourceBlocks[index].innerBlocks, updateBlockAttributes); } } /** * A hook to return a pasteStyles event function for handling pasting styles to blocks. * * @return {Function} A function to update the styles to the blocks. */ function usePasteStyles() { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { createSuccessNotice, createWarningNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); return (0,external_wp_element_namespaceObject.useCallback)(async targetBlocks => { let html = ''; try { // `http:` sites won't have the clipboard property on navigator. // (with the exception of localhost.) if (!window.navigator.clipboard) { createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Unable to paste styles. This feature is only available on secure (https) sites in supporting browsers.'), { type: 'snackbar' }); return; } html = await window.navigator.clipboard.readText(); } catch (error) { // Possibly the permission is denied. createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Unable to paste styles. Please allow browser clipboard permissions before continuing.'), { type: 'snackbar' }); return; } // Abort if the copied text is empty or doesn't look like serialized blocks. if (!html || !hasSerializedBlocks(html)) { createWarningNotice((0,external_wp_i18n_namespaceObject.__)("Unable to paste styles. Block styles couldn't be found within the copied content."), { type: 'snackbar' }); return; } const copiedBlocks = (0,external_wp_blocks_namespaceObject.parse)(html); if (copiedBlocks.length === 1) { // Apply styles of the block to all the target blocks. registry.batch(() => { recursivelyUpdateBlockAttributes(targetBlocks, targetBlocks.map(() => copiedBlocks[0]), updateBlockAttributes); }); } else { registry.batch(() => { recursivelyUpdateBlockAttributes(targetBlocks, copiedBlocks, updateBlockAttributes); }); } if (targetBlocks.length === 1) { const title = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlocks[0].name)?.title; createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // Translators: Name of the block being pasted, e.g. "Paragraph". (0,external_wp_i18n_namespaceObject.__)('Pasted styles to %s.'), title), { type: 'snackbar' }); } else { createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // Translators: The number of the blocks. (0,external_wp_i18n_namespaceObject.__)('Pasted styles to %d blocks.'), targetBlocks.length), { type: 'snackbar' }); } }, [registry.batch, updateBlockAttributes, createSuccessNotice, createWarningNotice, createErrorNotice]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-actions/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockActions({ clientIds, children, __experimentalUpdateSelection: updateSelection }) { const { getDefaultBlockName, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const selected = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canInsertBlockType, getBlockRootClientId, getBlocksByClientId, getDirectInsertBlock, canRemoveBlocks } = select(store); const blocks = getBlocksByClientId(clientIds); const rootClientId = getBlockRootClientId(clientIds[0]); const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId); const directInsertBlock = rootClientId ? getDirectInsertBlock(rootClientId) : null; return { canRemove: canRemoveBlocks(clientIds), canInsertBlock: canInsertDefaultBlock || !!directInsertBlock, canCopyStyles: blocks.every(block => { return !!block && ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'color') || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'typography')); }), canDuplicate: blocks.every(block => { return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId); }) }; }, [clientIds, getDefaultBlockName]); const { getBlocksByClientId, getBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); const { canRemove, canInsertBlock, canCopyStyles, canDuplicate } = selected; const { removeBlocks, replaceBlocks, duplicateBlocks, insertAfterBlock, insertBeforeBlock, flashBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const pasteStyles = usePasteStyles(); return children({ canCopyStyles, canDuplicate, canInsertBlock, canRemove, onDuplicate() { return duplicateBlocks(clientIds, updateSelection); }, onRemove() { return removeBlocks(clientIds, updateSelection); }, onInsertBefore() { insertBeforeBlock(clientIds[0]); }, onInsertAfter() { insertAfterBlock(clientIds[clientIds.length - 1]); }, onGroup() { if (!clientIds.length) { return; } const groupingBlockName = getGroupingBlockName(); // Activate the `transform` on `core/group` which does the conversion. const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(getBlocksByClientId(clientIds), groupingBlockName); if (!newBlocks) { return; } replaceBlocks(clientIds, newBlocks); }, onUngroup() { if (!clientIds.length) { return; } const innerBlocks = getBlocks(clientIds[0]); if (!innerBlocks.length) { return; } replaceBlocks(clientIds, innerBlocks); }, onCopy() { if (clientIds.length === 1) { flashBlock(clientIds[0]); } }, async onPasteStyles() { await pasteStyles(getBlocksByClientId(clientIds)); } }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/collab/block-comment-icon-slot.js /** * WordPress dependencies */ const CommentIconSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)(Symbol('CommentIconSlotFill')); /* harmony default export */ const block_comment_icon_slot = (CommentIconSlotFill); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-html-convert-button.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockHTMLConvertButton({ clientId }) { const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlock(clientId), [clientId]); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!block || block.name !== 'core/html') { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => replaceBlocks(clientId, (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: (0,external_wp_blocks_namespaceObject.getBlockContent)(block) })), children: (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks') }); } /* harmony default export */ const block_html_convert_button = (BlockHTMLConvertButton); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-menu-first-item.js /** * WordPress dependencies */ const { Fill: __unstableBlockSettingsMenuFirstItem, Slot: block_settings_menu_first_item_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableBlockSettingsMenuFirstItem'); __unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; /* harmony default export */ const block_settings_menu_first_item = (__unstableBlockSettingsMenuFirstItem); ;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Contains the properties `ConvertToGroupButton` component needs. * * @typedef {Object} ConvertToGroupButtonProps * @property {string[]} clientIds An array of the selected client ids. * @property {boolean} isGroupable Indicates if the selected blocks can be grouped. * @property {boolean} isUngroupable Indicates if the selected blocks can be ungrouped. * @property {WPBlock[]} blocksSelection An array of the selected blocks. * @property {string} groupingBlockName The name of block used for handling grouping interactions. */ /** * Returns the properties `ConvertToGroupButton` component needs to work properly. * It is used in `BlockSettingsMenuControls` to know if `ConvertToGroupButton` * should be rendered, to avoid ending up with an empty MenuGroup. * * @param {?string[]} selectedClientIds An optional array of clientIds to group. The selected blocks * from the block editor store are used if this is not provided. * * @return {ConvertToGroupButtonProps} Returns the properties needed by `ConvertToGroupButton`. */ function useConvertToGroupButtonProps(selectedClientIds) { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlocksByClientId, getSelectedBlockClientIds, isUngroupable, isGroupable } = select(store); const { getGroupingBlockName, getBlockType } = select(external_wp_blocks_namespaceObject.store); const clientIds = selectedClientIds?.length ? selectedClientIds : getSelectedBlockClientIds(); const blocksSelection = getBlocksByClientId(clientIds); const [firstSelectedBlock] = blocksSelection; const _isUngroupable = clientIds.length === 1 && isUngroupable(clientIds[0]); return { clientIds, isGroupable: isGroupable(clientIds), isUngroupable: _isUngroupable, blocksSelection, groupingBlockName: getGroupingBlockName(), onUngroup: _isUngroupable && getBlockType(firstSelectedBlock.name)?.transforms?.ungroup }; }, [selectedClientIds]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function ConvertToGroupButton({ clientIds, isGroupable, isUngroupable, onUngroup, blocksSelection, groupingBlockName, onClose = () => {} }) { const { getSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onConvertToGroup = () => { // Activate the `transform` on the Grouping Block which does the conversion. const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocksSelection, groupingBlockName); if (newBlocks) { replaceBlocks(clientIds, newBlocks); } }; const onConvertFromGroup = () => { let innerBlocks = blocksSelection[0].innerBlocks; if (!innerBlocks.length) { return; } if (onUngroup) { innerBlocks = onUngroup(blocksSelection[0].attributes, blocksSelection[0].innerBlocks); } replaceBlocks(clientIds, innerBlocks); }; if (!isGroupable && !isUngroupable) { return null; } const selectedBlockClientIds = getSelectedBlockClientIds(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isGroupable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { shortcut: selectedBlockClientIds.length > 1 ? external_wp_keycodes_namespaceObject.displayShortcut.primary('g') : undefined, onClick: () => { onConvertToGroup(); onClose(); }, children: (0,external_wp_i18n_namespaceObject._x)('Group', 'verb') }), isUngroupable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { onConvertFromGroup(); onClose(); }, children: (0,external_wp_i18n_namespaceObject._x)('Ungroup', 'Ungrouping blocks from within a grouping block back into individual blocks within the Editor') })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/use-block-lock.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Return details about the block lock status. * * @param {string} clientId The block client Id. * * @return {Object} Block lock status */ function useBlockLock(clientId) { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { canEditBlock, canMoveBlock, canRemoveBlock, canLockBlockType, getBlockName, getTemplateLock } = select(store); const canEdit = canEditBlock(clientId); const canMove = canMoveBlock(clientId); const canRemove = canRemoveBlock(clientId); return { canEdit, canMove, canRemove, canLock: canLockBlockType(getBlockName(clientId)), isContentLocked: getTemplateLock(clientId) === 'contentOnly', isLocked: !canEdit || !canMove || !canRemove }; }, [clientId]); } ;// ./node_modules/@wordpress/icons/build-module/library/unlock.js /** * WordPress dependencies */ const unlock_unlock = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8h1.5c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z" }) }); /* harmony default export */ const library_unlock = (unlock_unlock); ;// ./node_modules/@wordpress/icons/build-module/library/lock-outline.js /** * WordPress dependencies */ const lockOutline = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zM9.8 7c0-1.2 1-2.2 2.2-2.2 1.2 0 2.2 1 2.2 2.2v3H9.8V7zm6.7 11.5h-9v-7h9v7z" }) }); /* harmony default export */ const lock_outline = (lockOutline); ;// ./node_modules/@wordpress/icons/build-module/library/lock.js /** * WordPress dependencies */ const lock_lock = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" }) }); /* harmony default export */ const library_lock = (lock_lock); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/modal.js /** * WordPress dependencies */ /** * Internal dependencies */ // Entity based blocks which allow edit locking const ALLOWS_EDIT_LOCKING = ['core/navigation']; function getTemplateLockValue(lock) { // Prevents all operations. if (lock.remove && lock.move) { return 'all'; } // Prevents inserting or removing blocks, but allows moving existing blocks. if (lock.remove && !lock.move) { return 'insert'; } return false; } function BlockLockModal({ clientId, onClose }) { const [lock, setLock] = (0,external_wp_element_namespaceObject.useState)({ move: false, remove: false }); const { canEdit, canMove, canRemove } = useBlockLock(clientId); const { allowsEditLocking, templateLock, hasTemplateLock } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockName, getBlockAttributes } = select(store); const blockName = getBlockName(clientId); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); return { allowsEditLocking: ALLOWS_EDIT_LOCKING.includes(blockName), templateLock: getBlockAttributes(clientId)?.templateLock, hasTemplateLock: !!blockType?.attributes?.templateLock }; }, [clientId]); const [applyTemplateLock, setApplyTemplateLock] = (0,external_wp_element_namespaceObject.useState)(!!templateLock); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const blockInformation = useBlockDisplayInformation(clientId); (0,external_wp_element_namespaceObject.useEffect)(() => { setLock({ move: !canMove, remove: !canRemove, ...(allowsEditLocking ? { edit: !canEdit } : {}) }); }, [canEdit, canMove, canRemove, allowsEditLocking]); const isAllChecked = Object.values(lock).every(Boolean); const isMixed = Object.values(lock).some(Boolean) && !isAllChecked; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the block. */ (0,external_wp_i18n_namespaceObject.__)('Lock %s'), blockInformation.title), overlayClassName: "block-editor-block-lock-modal", onRequestClose: onClose, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { onSubmit: event => { event.preventDefault(); updateBlockAttributes([clientId], { lock, templateLock: applyTemplateLock ? getTemplateLockValue(lock) : undefined }); onClose(); }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-block-lock-modal__options", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { children: (0,external_wp_i18n_namespaceObject.__)('Select the features you want to lock') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { role: "list", className: "block-editor-block-lock-modal__checklist", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, className: "block-editor-block-lock-modal__options-all", label: (0,external_wp_i18n_namespaceObject.__)('Lock all'), checked: isAllChecked, indeterminate: isMixed, onChange: newValue => setLock({ move: newValue, remove: newValue, ...(allowsEditLocking ? { edit: newValue } : {}) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { role: "list", className: "block-editor-block-lock-modal__checklist", children: [allowsEditLocking && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Lock editing'), checked: !!lock.edit, onChange: edit => setLock(prevLock => ({ ...prevLock, edit })) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "block-editor-block-lock-modal__lock-icon", icon: lock.edit ? library_lock : library_unlock })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Lock movement'), checked: lock.move, onChange: move => setLock(prevLock => ({ ...prevLock, move })) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "block-editor-block-lock-modal__lock-icon", icon: lock.move ? library_lock : library_unlock })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Lock removal'), checked: lock.remove, onChange: remove => setLock(prevLock => ({ ...prevLock, remove })) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "block-editor-block-lock-modal__lock-icon", icon: lock.remove ? library_lock : library_unlock })] })] })] }) }), hasTemplateLock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, className: "block-editor-block-lock-modal__template-lock", label: (0,external_wp_i18n_namespaceObject.__)('Apply to all blocks inside'), checked: applyTemplateLock, disabled: lock.move && !lock.remove, onChange: () => setApplyTemplateLock(!applyTemplateLock) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { className: "block-editor-block-lock-modal__actions", justify: "flex-end", expanded: false, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: onClose, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", type: "submit", __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Apply') }) })] })] }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/menu-item.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockLockMenuItem({ clientId }) { const { canLock, isLocked } = useBlockLock(clientId); const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false); if (!canLock) { return null; } const label = isLocked ? (0,external_wp_i18n_namespaceObject.__)('Unlock') : (0,external_wp_i18n_namespaceObject.__)('Lock'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: isLocked ? library_unlock : lock_outline, onClick: toggleModal, "aria-expanded": isModalOpen, "aria-haspopup": "dialog", children: label }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { clientId: clientId, onClose: toggleModal })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js /** * WordPress dependencies */ /** * Internal dependencies */ const block_mode_toggle_noop = () => {}; function BlockModeToggle({ clientId, onToggle = block_mode_toggle_noop }) { const { blockType, mode, isCodeEditingEnabled } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlock, getBlockMode, getSettings } = select(store); const block = getBlock(clientId); return { mode: getBlockMode(clientId), blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, isCodeEditingEnabled: getSettings().codeEditingEnabled }; }, [clientId]); const { toggleBlockMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!blockType || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'html', true) || !isCodeEditingEnabled) { return null; } const label = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Edit as HTML') : (0,external_wp_i18n_namespaceObject.__)('Edit visually'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { toggleBlockMode(clientId); onToggle(); }, children: label }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/content-lock/modify-content-lock-menu-item.js /** * WordPress dependencies */ /** * Internal dependencies */ // The implementation of content locking is mainly in this file, although the mechanism // to stop temporarily editing as blocks when an outside block is selected is on component StopEditingAsBlocksOnOutsideSelect // at block-editor/src/components/block-list/index.js. // Besides the components on this file and the file referenced above the implementation // also includes artifacts on the store (actions, reducers, and selector). function ModifyContentLockMenuItem({ clientId, onClose }) { const { templateLock, isLockedByParent, isEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getContentLockingParent, getTemplateLock, getTemporarilyEditingAsBlocks } = unlock(select(store)); return { templateLock: getTemplateLock(clientId), isLockedByParent: !!getContentLockingParent(clientId), isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId }; }, [clientId]); const blockEditorActions = (0,external_wp_data_namespaceObject.useDispatch)(store); const isContentLocked = !isLockedByParent && templateLock === 'contentOnly'; if (!isContentLocked && !isEditingAsBlocks) { return null; } const { modifyContentLockBlock } = unlock(blockEditorActions); const showStartEditingAsBlocks = !isEditingAsBlocks && isContentLocked; return showStartEditingAsBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { modifyContentLockBlock(clientId); onClose(); }, children: (0,external_wp_i18n_namespaceObject._x)('Modify', 'Unlock content locked blocks') }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/use-block-rename.js /** * WordPress dependencies */ function useBlockRename(name) { return { canRename: (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, 'renaming', true) }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/is-empty-string.js function isEmptyString(testString) { return testString?.trim()?.length === 0; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/modal.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockRenameModal({ clientId, onClose }) { const [editedBlockName, setEditedBlockName] = (0,external_wp_element_namespaceObject.useState)(); const blockInformation = useBlockDisplayInformation(clientId); const { metadata } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockAttributes } = select(store); return { metadata: getBlockAttributes(clientId)?.metadata }; }, [clientId]); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const blockName = metadata?.name || ''; const originalBlockName = blockInformation?.title; // Pattern Overrides is a WordPress-only feature but it also uses the Block Binding API. // Ideally this should not be inside the block editor package, but we keep it here for simplicity. const hasOverridesWarning = !!blockName && !!metadata?.bindings && Object.values(metadata.bindings).some(binding => binding.source === 'core/pattern-overrides'); const nameHasChanged = editedBlockName !== undefined && editedBlockName !== blockName; const nameIsOriginal = editedBlockName === originalBlockName; const nameIsEmpty = isEmptyString(editedBlockName); const isNameValid = nameHasChanged || nameIsOriginal; const autoSelectInputText = event => event.target.select(); const handleSubmit = () => { const newName = nameIsOriginal || nameIsEmpty ? undefined : editedBlockName; const message = nameIsOriginal || nameIsEmpty ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: new name/label for the block */ (0,external_wp_i18n_namespaceObject.__)('Block name reset to: "%s".'), editedBlockName) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: new name/label for the block */ (0,external_wp_i18n_namespaceObject.__)('Block name changed to: "%s".'), editedBlockName); // Must be assertive to immediately announce change. (0,external_wp_a11y_namespaceObject.speak)(message, 'assertive'); updateBlockAttributes([clientId], { metadata: { ...metadata, name: newName } }); // Immediate close avoids ability to hit save multiple times. onClose(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Rename'), onRequestClose: onClose, overlayClassName: "block-editor-block-rename-modal", focusOnMount: "firstContentElement", size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: e => { e.preventDefault(); if (!isNameValid) { return; } handleSubmit(); }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: editedBlockName !== null && editedBlockName !== void 0 ? editedBlockName : blockName, label: (0,external_wp_i18n_namespaceObject.__)('Name'), help: hasOverridesWarning ? (0,external_wp_i18n_namespaceObject.__)('This block allows overrides. Changing the name can cause problems with content entered into instances of this pattern.') : undefined, placeholder: originalBlockName, onChange: setEditedBlockName, onFocus: autoSelectInputText }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, accessibleWhenDisabled: true, disabled: !isNameValid, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)('Save') })] })] }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/rename-control.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockRenameControl({ clientId }) { const [renamingBlock, setRenamingBlock] = (0,external_wp_element_namespaceObject.useState)(false); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { setRenamingBlock(true); }, "aria-expanded": renamingBlock, "aria-haspopup": "dialog", children: (0,external_wp_i18n_namespaceObject.__)('Rename') }), renamingBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRenameModal, { clientId: clientId, onClose: () => setRenamingBlock(false) })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Fill, Slot: block_settings_menu_controls_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('BlockSettingsMenuControls'); const BlockSettingsMenuControlsSlot = ({ fillProps, clientIds = null }) => { const { selectedBlocks, selectedClientIds, isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockNamesByClientId, getSelectedBlockClientIds, getBlockEditingMode } = select(store); const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds(); return { selectedBlocks: getBlockNamesByClientId(ids), selectedClientIds: ids, isContentOnly: getBlockEditingMode(ids[0]) === 'contentOnly' }; }, [clientIds]); const { canLock } = useBlockLock(selectedClientIds[0]); const { canRename } = useBlockRename(selectedBlocks[0]); const showLockButton = selectedClientIds.length === 1 && canLock && !isContentOnly; const showRenameButton = selectedClientIds.length === 1 && canRename && !isContentOnly; // Check if current selection of blocks is Groupable or Ungroupable // and pass this props down to ConvertToGroupButton. const convertToGroupButtonProps = useConvertToGroupButtonProps(selectedClientIds); const { isGroupable, isUngroupable } = convertToGroupButtonProps; const showConvertToGroupButton = (isGroupable || isUngroupable) && !isContentOnly; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_controls_Slot, { fillProps: { ...fillProps, selectedBlocks, selectedClientIds }, children: fills => { if (!fills?.length > 0 && !showConvertToGroupButton && !showLockButton) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [showConvertToGroupButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToGroupButton, { ...convertToGroupButtonProps, onClose: fillProps?.onClose }), showLockButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockMenuItem, { clientId: selectedClientIds[0] }), showRenameButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRenameControl, { clientId: selectedClientIds[0] }), fills, selectedClientIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModifyContentLockMenuItem, { clientId: selectedClientIds[0], onClose: fillProps?.onClose }), fillProps?.count === 1 && !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockModeToggle, { clientId: fillProps?.firstBlockClientId, onToggle: fillProps?.onClose })] }); } }); }; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-settings-menu-controls/README.md * * @param {Object} props Fill props. * @return {Element} Element. */ function BlockSettingsMenuControls({ ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document: document, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { ...props }) }); } BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot; /* harmony default export */ const block_settings_menu_controls = (BlockSettingsMenuControls); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-parent-selector-menu-item.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockParentSelectorMenuItem({ parentClientId, parentBlockType }) { const isSmallViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); // Allows highlighting the parent block outline when focusing or hovering // the parent block selector within the child. const menuItemRef = (0,external_wp_element_namespaceObject.useRef)(); const gesturesProps = useShowHoveredOrFocusedGestures({ ref: menuItemRef, highlightParent: true }); if (!isSmallViewport) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...gesturesProps, ref: menuItemRef, icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: parentBlockType.icon }), onClick: () => selectBlock(parentClientId), children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the block's parent. */ (0,external_wp_i18n_namespaceObject.__)('Select parent block (%s)'), parentBlockType.title) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js /** * WordPress dependencies */ /** * Internal dependencies */ const block_settings_dropdown_POPOVER_PROPS = { className: 'block-editor-block-settings-menu__popover', placement: 'bottom-start' }; function CopyMenuItem({ clientIds, onCopy, label, shortcut, eventType = 'copy', __experimentalUpdateSelection: updateSelection = false }) { const { getBlocksByClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { removeBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const notifyCopy = useNotifyCopy(); const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => (0,external_wp_blocks_namespaceObject.serialize)(getBlocksByClientId(clientIds)), () => { switch (eventType) { case 'copy': case 'copyStyles': onCopy(); notifyCopy(eventType, clientIds); break; case 'cut': notifyCopy(eventType, clientIds); removeBlocks(clientIds, updateSelection); break; default: break; } }); const copyMenuItemLabel = label ? label : (0,external_wp_i18n_namespaceObject.__)('Copy'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ref: ref, shortcut: shortcut, children: copyMenuItemLabel }); } function BlockSettingsDropdown({ block, clientIds, children, __experimentalSelectBlock, ...props }) { // Get the client id of the current block for this menu, if one is set. const currentClientId = block?.clientId; const count = clientIds.length; const firstBlockClientId = clientIds[0]; const { firstParentClientId, parentBlockType, previousBlockClientId, selectedBlockClientIds, openedBlockSettingsMenu, isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockName, getBlockRootClientId, getPreviousBlockClientId, getSelectedBlockClientIds, getBlockAttributes, getOpenedBlockSettingsMenu, getBlockEditingMode } = unlock(select(store)); const { getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const _firstParentClientId = getBlockRootClientId(firstBlockClientId); const parentBlockName = _firstParentClientId && getBlockName(_firstParentClientId); return { firstParentClientId: _firstParentClientId, parentBlockType: _firstParentClientId && (getActiveBlockVariation(parentBlockName, getBlockAttributes(_firstParentClientId)) || (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName)), previousBlockClientId: getPreviousBlockClientId(firstBlockClientId), selectedBlockClientIds: getSelectedBlockClientIds(), openedBlockSettingsMenu: getOpenedBlockSettingsMenu(), isContentOnly: getBlockEditingMode(firstBlockClientId) === 'contentOnly' }; }, [firstBlockClientId]); const { getBlockOrder, getSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); const { setOpenedBlockSettingsMenu } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const shortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { copy: getShortcutRepresentation('core/block-editor/copy'), cut: getShortcutRepresentation('core/block-editor/cut'), duplicate: getShortcutRepresentation('core/block-editor/duplicate'), remove: getShortcutRepresentation('core/block-editor/remove'), insertAfter: getShortcutRepresentation('core/block-editor/insert-after'), insertBefore: getShortcutRepresentation('core/block-editor/insert-before') }; }, []); const hasSelectedBlocks = selectedBlockClientIds.length > 0; async function updateSelectionAfterDuplicate(clientIdsPromise) { if (!__experimentalSelectBlock) { return; } const ids = await clientIdsPromise; if (ids && ids[0]) { __experimentalSelectBlock(ids[0], false); } } function updateSelectionAfterRemove() { if (!__experimentalSelectBlock) { return; } let blockToFocus = previousBlockClientId || firstParentClientId; // Focus the first block if there's no previous block nor parent block. if (!blockToFocus) { blockToFocus = getBlockOrder()[0]; } // Only update the selection if the original selection is removed. const shouldUpdateSelection = hasSelectedBlocks && getSelectedBlockClientIds().length === 0; __experimentalSelectBlock(blockToFocus, shouldUpdateSelection); } // This can occur when the selected block (the parent) // displays child blocks within a List View. const parentBlockIsSelected = selectedBlockClientIds?.includes(firstParentClientId); // When a currentClientId is in use, treat the menu as a controlled component. // This ensures that only one block settings menu is open at a time. // This is a temporary solution to work around an issue with `onFocusOutside` // where it does not allow a dropdown to be closed if focus was never within // the dropdown to begin with. Examples include a user either CMD+Clicking or // right clicking into an inactive window. // See: https://github.com/WordPress/gutenberg/pull/54083 const open = !currentClientId ? undefined : openedBlockSettingsMenu === currentClientId || false; function onToggle(localOpen) { if (localOpen && openedBlockSettingsMenu !== currentClientId) { setOpenedBlockSettingsMenu(currentClientId); } else if (!localOpen && openedBlockSettingsMenu && openedBlockSettingsMenu === currentClientId) { setOpenedBlockSettingsMenu(undefined); } } const shouldShowBlockParentMenuItem = !parentBlockIsSelected && !!firstParentClientId; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockActions, { clientIds: clientIds, __experimentalUpdateSelection: !__experimentalSelectBlock, children: ({ canCopyStyles, canDuplicate, canInsertBlock, canRemove, onDuplicate, onInsertAfter, onInsertBefore, onRemove, onCopy, onPasteStyles }) => { // It is possible that some plugins register fills for this menu // even if Core doesn't render anything in the block settings menu. // in which case, we may want to render the menu anyway. // That said for now, we can start more conservative. const isEmpty = !canRemove && !canDuplicate && !canInsertBlock && isContentOnly; if (isEmpty) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Options'), className: "block-editor-block-settings-menu", popoverProps: block_settings_dropdown_POPOVER_PROPS, open: open, onToggle: onToggle, noIcons: true, ...props, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_first_item.Slot, { fillProps: { onClose } }), shouldShowBlockParentMenuItem && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockParentSelectorMenuItem, { parentClientId: firstParentClientId, parentBlockType: parentBlockType }), count === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_html_convert_button, { clientId: firstBlockClientId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyMenuItem, { clientIds: clientIds, onCopy: onCopy, shortcut: shortcuts.copy }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyMenuItem, { clientIds: clientIds, label: (0,external_wp_i18n_namespaceObject.__)('Cut'), eventType: "cut", shortcut: shortcuts.cut, __experimentalUpdateSelection: !__experimentalSelectBlock }), canDuplicate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onDuplicate, updateSelectionAfterDuplicate), shortcut: shortcuts.duplicate, children: (0,external_wp_i18n_namespaceObject.__)('Duplicate') }), canInsertBlock && !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onInsertBefore), shortcut: shortcuts.insertBefore, children: (0,external_wp_i18n_namespaceObject.__)('Add before') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onInsertAfter), shortcut: shortcuts.insertAfter, children: (0,external_wp_i18n_namespaceObject.__)('Add after') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_comment_icon_slot.Slot, { fillProps: { onClose } })] }), canCopyStyles && !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyMenuItem, { clientIds: clientIds, onCopy: onCopy, label: (0,external_wp_i18n_namespaceObject.__)('Copy styles'), eventType: "copyStyles" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: onPasteStyles, children: (0,external_wp_i18n_namespaceObject.__)('Paste styles') })] }), !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_controls.Slot, { fillProps: { onClose, count, firstBlockClientId }, clientIds: clientIds }), typeof children === 'function' ? children({ onClose }) : external_wp_element_namespaceObject.Children.map(child => (0,external_wp_element_namespaceObject.cloneElement)(child, { onClose })), canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onRemove, updateSelectionAfterRemove), shortcut: shortcuts.remove, children: (0,external_wp_i18n_namespaceObject.__)('Delete') }) })] }) }); } }); } /* harmony default export */ const block_settings_dropdown = (BlockSettingsDropdown); ;// ./node_modules/@wordpress/block-editor/build-module/components/collab/block-comment-icon-toolbar-slot.js /** * WordPress dependencies */ const CommentIconToolbarSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)(Symbol('CommentIconToolbarSlotFill')); /* harmony default export */ const block_comment_icon_toolbar_slot = (CommentIconToolbarSlotFill); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockSettingsMenu({ clientIds, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_comment_icon_toolbar_slot.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_dropdown, { clientIds: clientIds, toggleProps: toggleProps, ...props }) })] }); } /* harmony default export */ const block_settings_menu = (BlockSettingsMenu); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/toolbar.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockLockToolbar({ clientId }) { const { canLock, isLocked } = useBlockLock(clientId); const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false); const hasLockButtonShownRef = (0,external_wp_element_namespaceObject.useRef)(false); // If the block lock button has been shown, we don't want to remove it // from the toolbar until the toolbar is rendered again without it. // Removing it beforehand can cause focus loss issues, such as when // unlocking the block from the modal. It needs to return focus from // whence it came, and to do that, we need to leave the button in the toolbar. (0,external_wp_element_namespaceObject.useEffect)(() => { if (isLocked) { hasLockButtonShownRef.current = true; } }, [isLocked]); if (!isLocked && !hasLockButtonShownRef.current) { return null; } let label = isLocked ? (0,external_wp_i18n_namespaceObject.__)('Unlock') : (0,external_wp_i18n_namespaceObject.__)('Lock'); if (!canLock && isLocked) { label = (0,external_wp_i18n_namespaceObject.__)('Locked'); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-lock-toolbar", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { disabled: !canLock, icon: isLocked ? library_lock : library_unlock, label: label, onClick: toggleModal, "aria-expanded": isModalOpen, "aria-haspopup": "dialog" }) }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { clientId: clientId, onClose: toggleModal })] }); } ;// ./node_modules/@wordpress/icons/build-module/library/group.js /** * WordPress dependencies */ const group_group = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" }) }); /* harmony default export */ const library_group = (group_group); ;// ./node_modules/@wordpress/icons/build-module/library/row.js /** * WordPress dependencies */ const row = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z" }) }); /* harmony default export */ const library_row = (row); ;// ./node_modules/@wordpress/icons/build-module/library/stack.js /** * WordPress dependencies */ const stack = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z" }) }); /* harmony default export */ const library_stack = (stack); ;// ./node_modules/@wordpress/icons/build-module/library/grid.js /** * WordPress dependencies */ const grid_grid = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z", fillRule: "evenodd", clipRule: "evenodd" }) }); /* harmony default export */ const library_grid = (grid_grid); ;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/toolbar.js /** * WordPress dependencies */ /** * Internal dependencies */ const layouts = { group: { type: 'constrained' }, row: { type: 'flex', flexWrap: 'nowrap' }, stack: { type: 'flex', orientation: 'vertical' }, grid: { type: 'grid' } }; function BlockGroupToolbar() { const { blocksSelection, clientIds, groupingBlockName, isGroupable } = useConvertToGroupButtonProps(); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { canRemove, variations } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canRemoveBlocks } = select(store); const { getBlockVariations } = select(external_wp_blocks_namespaceObject.store); return { canRemove: canRemoveBlocks(clientIds), variations: getBlockVariations(groupingBlockName, 'transform') }; }, [clientIds, groupingBlockName]); const onConvertToGroup = layout => { const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocksSelection, groupingBlockName); if (typeof layout !== 'string') { layout = 'group'; } if (newBlocks && newBlocks.length > 0) { // Because the block is not in the store yet we can't use // updateBlockAttributes so need to manually update attributes. newBlocks[0].attributes.layout = layouts[layout]; replaceBlocks(clientIds, newBlocks); } }; const onConvertToRow = () => onConvertToGroup('row'); const onConvertToStack = () => onConvertToGroup('stack'); const onConvertToGrid = () => onConvertToGroup('grid'); // Don't render the button if the current selection cannot be grouped. // A good example is selecting multiple button blocks within a Buttons block: // The group block is not a valid child of Buttons, so we should not show the button. // Any blocks that are locked against removal also cannot be grouped. if (!isGroupable || !canRemove) { return null; } const canInsertRow = !!variations.find(({ name }) => name === 'group-row'); const canInsertStack = !!variations.find(({ name }) => name === 'group-stack'); const canInsertGrid = !!variations.find(({ name }) => name === 'group-grid'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: library_group, label: (0,external_wp_i18n_namespaceObject._x)('Group', 'action: convert blocks to group'), onClick: onConvertToGroup }), canInsertRow && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: library_row, label: (0,external_wp_i18n_namespaceObject._x)('Row', 'action: convert blocks to row'), onClick: onConvertToRow }), canInsertStack && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: library_stack, label: (0,external_wp_i18n_namespaceObject._x)('Stack', 'action: convert blocks to stack'), onClick: onConvertToStack }), canInsertGrid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: library_grid, label: (0,external_wp_i18n_namespaceObject._x)('Grid', 'action: convert blocks to grid'), onClick: onConvertToGrid })] }); } /* harmony default export */ const toolbar = (BlockGroupToolbar); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit-visually-button/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockEditVisuallyButton({ clientIds }) { // Edit visually only works for single block selection. const clientId = clientIds.length === 1 ? clientIds[0] : undefined; const canEditVisually = (0,external_wp_data_namespaceObject.useSelect)(select => !!clientId && select(store).getBlockMode(clientId) === 'html', [clientId]); const { toggleBlockMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!canEditVisually) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: () => { toggleBlockMode(clientId); }, children: (0,external_wp_i18n_namespaceObject.__)('Edit visually') }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-name-context.js /** * WordPress dependencies */ const __unstableBlockNameContext = (0,external_wp_element_namespaceObject.createContext)(''); /* harmony default export */ const block_name_context = (__unstableBlockNameContext); ;// ./node_modules/@wordpress/block-editor/build-module/components/navigable-toolbar/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function hasOnlyToolbarItem(elements) { const dataProp = 'toolbarItem'; return !elements.some(element => !(dataProp in element.dataset)); } function getAllFocusableToolbarItemsIn(container) { return Array.from(container.querySelectorAll('[data-toolbar-item]:not([disabled])')); } function hasFocusWithin(container) { return container.contains(container.ownerDocument.activeElement); } function focusFirstTabbableIn(container) { const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container); if (firstTabbable) { firstTabbable.focus({ // When focusing newly mounted toolbars, // the position of the popover is often not right on the first render // This prevents the layout shifts when focusing the dialogs. preventScroll: true }); } } function useIsAccessibleToolbar(toolbarRef) { /* * By default, we'll assume the starting accessible state of the Toolbar * is true, as it seems to be the most common case. * * Transitioning from an (initial) false to true state causes the * <Toolbar /> component to mount twice, which is causing undesired * side-effects. These side-effects appear to only affect certain * E2E tests. * * This was initial discovered in this pull-request: * https://github.com/WordPress/gutenberg/pull/23425 */ const initialAccessibleToolbarState = true; // By default, it's gonna render NavigableMenu. If all the tabbable elements // inside the toolbar are ToolbarItem components (or derived components like // ToolbarButton), then we can wrap them with the accessible Toolbar // component. const [isAccessibleToolbar, setIsAccessibleToolbar] = (0,external_wp_element_namespaceObject.useState)(initialAccessibleToolbarState); const determineIsAccessibleToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => { const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(toolbarRef.current); const onlyToolbarItem = hasOnlyToolbarItem(tabbables); if (!onlyToolbarItem) { external_wp_deprecated_default()('Using custom components as toolbar controls', { since: '5.6', alternative: 'ToolbarItem, ToolbarButton or ToolbarDropdownMenu components', link: 'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols' }); } setIsAccessibleToolbar(onlyToolbarItem); }, [toolbarRef]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { // Toolbar buttons may be rendered asynchronously, so we use // MutationObserver to check if the toolbar subtree has been modified. const observer = new window.MutationObserver(determineIsAccessibleToolbar); observer.observe(toolbarRef.current, { childList: true, subtree: true }); return () => observer.disconnect(); }, [determineIsAccessibleToolbar, isAccessibleToolbar, toolbarRef]); return isAccessibleToolbar; } function useToolbarFocus({ toolbarRef, focusOnMount, isAccessibleToolbar, defaultIndex, onIndexChange, shouldUseKeyboardFocusShortcut, focusEditorOnEscape }) { // Make sure we don't use modified versions of this prop. const [initialFocusOnMount] = (0,external_wp_element_namespaceObject.useState)(focusOnMount); const [initialIndex] = (0,external_wp_element_namespaceObject.useState)(defaultIndex); const focusToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => { focusFirstTabbableIn(toolbarRef.current); }, [toolbarRef]); const focusToolbarViaShortcut = () => { if (shouldUseKeyboardFocusShortcut) { focusToolbar(); } }; // Focus on toolbar when pressing alt+F10 when the toolbar is visible. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/block-editor/focus-toolbar', focusToolbarViaShortcut); (0,external_wp_element_namespaceObject.useEffect)(() => { if (initialFocusOnMount) { focusToolbar(); } }, [isAccessibleToolbar, initialFocusOnMount, focusToolbar]); (0,external_wp_element_namespaceObject.useEffect)(() => { // Store ref so we have access on useEffect cleanup: https://legacy.reactjs.org/blog/2020/08/10/react-v17-rc.html#effect-cleanup-timing const navigableToolbarRef = toolbarRef.current; // If initialIndex is passed, we focus on that toolbar item when the // toolbar gets mounted and initial focus is not forced. // We have to wait for the next browser paint because block controls aren't // rendered right away when the toolbar gets mounted. let raf = 0; // If the toolbar already had focus before the render, we don't want to move it. // https://github.com/WordPress/gutenberg/issues/58511 if (!initialFocusOnMount && !hasFocusWithin(navigableToolbarRef)) { raf = window.requestAnimationFrame(() => { const items = getAllFocusableToolbarItemsIn(navigableToolbarRef); const index = initialIndex || 0; if (items[index] && hasFocusWithin(navigableToolbarRef)) { items[index].focus({ // When focusing newly mounted toolbars, // the position of the popover is often not right on the first render // This prevents the layout shifts when focusing the dialogs. preventScroll: true }); } }); } return () => { window.cancelAnimationFrame(raf); if (!onIndexChange || !navigableToolbarRef) { return; } // When the toolbar element is unmounted and onIndexChange is passed, we // pass the focused toolbar item index so it can be hydrated later. const items = getAllFocusableToolbarItemsIn(navigableToolbarRef); const index = items.findIndex(item => item.tabIndex === 0); onIndexChange(index); }; }, [initialIndex, initialFocusOnMount, onIndexChange, toolbarRef]); const { getLastFocus } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); /** * Handles returning focus to the block editor canvas when pressing escape. */ (0,external_wp_element_namespaceObject.useEffect)(() => { const navigableToolbarRef = toolbarRef.current; if (focusEditorOnEscape) { const handleKeyDown = event => { const lastFocus = getLastFocus(); if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && lastFocus?.current) { // Focus the last focused element when pressing escape. event.preventDefault(); lastFocus.current.focus(); } }; navigableToolbarRef.addEventListener('keydown', handleKeyDown); return () => { navigableToolbarRef.removeEventListener('keydown', handleKeyDown); }; } }, [focusEditorOnEscape, getLastFocus, toolbarRef]); } function NavigableToolbar({ children, focusOnMount, focusEditorOnEscape = false, shouldUseKeyboardFocusShortcut = true, __experimentalInitialIndex: initialIndex, __experimentalOnIndexChange: onIndexChange, orientation = 'horizontal', ...props }) { const toolbarRef = (0,external_wp_element_namespaceObject.useRef)(); const isAccessibleToolbar = useIsAccessibleToolbar(toolbarRef); useToolbarFocus({ toolbarRef, focusOnMount, defaultIndex: initialIndex, onIndexChange, isAccessibleToolbar, shouldUseKeyboardFocusShortcut, focusEditorOnEscape }); if (isAccessibleToolbar) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Toolbar, { label: props['aria-label'], ref: toolbarRef, orientation: orientation, ...props, children: children }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NavigableMenu, { orientation: orientation, role: "toolbar", ref: toolbarRef, ...props, children: children }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/use-has-block-toolbar.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns true if the block toolbar should be shown. * * @return {boolean} Whether the block toolbar component will be rendered. */ function useHasBlockToolbar() { const { isToolbarEnabled, isBlockDisabled } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockEditingMode, getBlockName, getBlockSelectionStart } = select(store); // we only care about the 1st selected block // for the toolbar, so we use getBlockSelectionStart // instead of getSelectedBlockClientIds const selectedBlockClientId = getBlockSelectionStart(); const blockType = selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(selectedBlockClientId)); return { isToolbarEnabled: blockType && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalToolbar', true), isBlockDisabled: getBlockEditingMode(selectedBlockClientId) === 'disabled' }; }, []); if (!isToolbarEnabled || isBlockDisabled) { return false; } return true; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/change-design.js /** * WordPress dependencies */ /** * Internal dependencies */ const change_design_EMPTY_ARRAY = []; const MAX_PATTERNS_TO_SHOW = 6; const change_design_POPOVER_PROPS = { placement: 'bottom-start' }; function ChangeDesign({ clientId }) { const { categories, currentPatternName, patterns } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockAttributes, getBlockRootClientId, __experimentalGetAllowedPatterns } = select(store); const attributes = getBlockAttributes(clientId); const _categories = attributes?.metadata?.categories || change_design_EMPTY_ARRAY; const rootBlock = getBlockRootClientId(clientId); // Calling `__experimentalGetAllowedPatterns` is expensive. // Checking if the block can be changed prevents unnecessary selector calls. // See: https://github.com/WordPress/gutenberg/pull/64736. const _patterns = _categories.length > 0 ? __experimentalGetAllowedPatterns(rootBlock) : change_design_EMPTY_ARRAY; return { categories: _categories, currentPatternName: attributes?.metadata?.patternName, patterns: _patterns }; }, [clientId]); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const sameCategoryPatternsWithSingleWrapper = (0,external_wp_element_namespaceObject.useMemo)(() => { if (categories.length === 0 || !patterns || patterns.length === 0) { return change_design_EMPTY_ARRAY; } return patterns.filter(pattern => { const isCorePattern = pattern.source === 'core' || pattern.source?.startsWith('pattern-directory') && pattern.source !== 'pattern-directory/theme'; return ( // Check if the pattern has only one top level block, // otherwise we may switch to a pattern that doesn't have replacement suggestions. pattern.blocks.length === 1 && // We exclude the core patterns and pattern directory patterns that are not theme patterns. !isCorePattern && // Exclude current pattern. currentPatternName !== pattern.name && pattern.categories?.some(category => { return categories.includes(category); }) && ( // Check if the pattern is not a synced pattern. pattern.syncStatus === 'unsynced' || !pattern.id) ); }).slice(0, MAX_PATTERNS_TO_SHOW); }, [categories, currentPatternName, patterns]); if (sameCategoryPatternsWithSingleWrapper.length < 2) { return null; } const onClickPattern = pattern => { var _pattern$blocks; const newBlocks = ((_pattern$blocks = pattern.blocks) !== null && _pattern$blocks !== void 0 ? _pattern$blocks : []).map(block => { return (0,external_wp_blocks_namespaceObject.cloneBlock)(block); }); newBlocks[0].attributes.metadata = { ...newBlocks[0].attributes.metadata, categories }; replaceBlocks(clientId, newBlocks); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: change_design_POPOVER_PROPS, renderToggle: ({ onToggle, isOpen }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: () => onToggle(!isOpen), "aria-expanded": isOpen, children: (0,external_wp_i18n_namespaceObject.__)('Change design') }) }); }, renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { className: "block-editor-block-toolbar-change-design-content-wrapper", paddingSize: "none", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_list, { blockPatterns: sameCategoryPatternsWithSingleWrapper, onClickPattern: onClickPattern, showTitlesAsTooltip: true }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/switch-section-style.js /** * WordPress dependencies */ /** * Internal dependencies */ const styleIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", "aria-hidden": "true", focusable: "false", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { stroke: "currentColor", strokeWidth: "1.5", d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3z" })] }); function SwitchSectionStyle({ clientId }) { var _mergedConfig$setting, _mergedConfig$styles; const { stylesToRender, activeStyle, className } = useStylesForBlocks({ clientId }); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); // Get global styles data const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const { globalSettings, globalStyles, blockName } = (0,external_wp_data_namespaceObject.useSelect)(select => { const settings = select(store).getSettings(); return { globalSettings: settings.__experimentalFeatures, globalStyles: settings[globalStylesDataKey], blockName: select(store).getBlockName(clientId) }; }, [clientId]); // Get the background color for the active style const activeStyleBackground = activeStyle?.name ? getVariationStylesWithRefValues({ settings: (_mergedConfig$setting = mergedConfig?.settings) !== null && _mergedConfig$setting !== void 0 ? _mergedConfig$setting : globalSettings, styles: (_mergedConfig$styles = mergedConfig?.styles) !== null && _mergedConfig$styles !== void 0 ? _mergedConfig$styles : globalStyles }, blockName, activeStyle.name)?.color?.background : undefined; if (!stylesToRender || stylesToRender.length === 0) { return null; } const handleStyleSwitch = () => { const currentIndex = stylesToRender.findIndex(style => style.name === activeStyle.name); const nextIndex = (currentIndex + 1) % stylesToRender.length; const nextStyle = stylesToRender[nextIndex]; const styleClassName = replaceActiveStyle(className, activeStyle, nextStyle); updateBlockAttributes(clientId, { className: styleClassName }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: handleStyleSwitch, label: (0,external_wp_i18n_namespaceObject.__)('Shuffle styles'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: styleIcon, style: { fill: activeStyleBackground || 'transparent' } }) }) }); } /* harmony default export */ const switch_section_style = (SwitchSectionStyle); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders the block toolbar. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md * * @param {Object} props Components props. * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality. * @param {boolean} props.focusOnMount Focus the toolbar when mounted. * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus. * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes. * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons. */ function PrivateBlockToolbar({ hideDragHandle, focusOnMount, __experimentalInitialIndex, __experimentalOnIndexChange, variant = 'unstyled' }) { const { blockClientId, blockClientIds, isDefaultEditingMode, blockType, toolbarKey, shouldShowVisualToolbar, showParentSelector, isUsingBindings, hasParentPattern, hasContentOnlyLocking, showShuffleButton, showSlots, showGroupButtons, showLockButtons, showSwitchSectionStyleButton, hasFixedToolbar, isNavigationMode } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockName, getBlockMode, getBlockParents, getSelectedBlockClientIds, isBlockValid, getBlockEditingMode, getBlockAttributes, getBlockParentsByBlockName, getTemplateLock, getSettings, getParentSectionBlock, isZoomOut, isNavigationMode: _isNavigationMode } = unlock(select(store)); const selectedBlockClientIds = getSelectedBlockClientIds(); const selectedBlockClientId = selectedBlockClientIds[0]; const parents = getBlockParents(selectedBlockClientId); const parentSection = getParentSectionBlock(selectedBlockClientId); const parentClientId = parentSection !== null && parentSection !== void 0 ? parentSection : parents[parents.length - 1]; const parentBlockName = getBlockName(parentClientId); const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName); const editingMode = getBlockEditingMode(selectedBlockClientId); const _isDefaultEditingMode = editingMode === 'default'; const _blockName = getBlockName(selectedBlockClientId); const isValid = selectedBlockClientIds.every(id => isBlockValid(id)); const isVisual = selectedBlockClientIds.every(id => getBlockMode(id) === 'visual'); const _isUsingBindings = selectedBlockClientIds.every(clientId => !!getBlockAttributes(clientId)?.metadata?.bindings); const _hasParentPattern = selectedBlockClientIds.every(clientId => getBlockParentsByBlockName(clientId, 'core/block', true).length > 0); // If one or more selected blocks are locked, do not show the BlockGroupToolbar. const _hasTemplateLock = selectedBlockClientIds.some(id => getTemplateLock(id) === 'contentOnly'); const _isZoomOut = isZoomOut(); return { blockClientId: selectedBlockClientId, blockClientIds: selectedBlockClientIds, isDefaultEditingMode: _isDefaultEditingMode, blockType: selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(_blockName), shouldShowVisualToolbar: isValid && isVisual, toolbarKey: `${selectedBlockClientId}${parentClientId}`, showParentSelector: !_isZoomOut && parentBlockType && editingMode !== 'contentOnly' && getBlockEditingMode(parentClientId) !== 'disabled' && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(parentBlockType, '__experimentalParentSelector', true) && selectedBlockClientIds.length === 1, isUsingBindings: _isUsingBindings, hasParentPattern: _hasParentPattern, hasContentOnlyLocking: _hasTemplateLock, showShuffleButton: _isZoomOut, showSlots: !_isZoomOut, showGroupButtons: !_isZoomOut, showLockButtons: !_isZoomOut, showSwitchSectionStyleButton: _isZoomOut, hasFixedToolbar: getSettings().hasFixedToolbar, isNavigationMode: _isNavigationMode() }; }, []); const toolbarWrapperRef = (0,external_wp_element_namespaceObject.useRef)(null); // Handles highlighting the current block outline on hover or focus of the // block type toolbar area. const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({ ref: nodeRef }); const isLargeViewport = !(0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const hasBlockToolbar = useHasBlockToolbar(); if (!hasBlockToolbar) { return null; } const isMultiToolbar = blockClientIds.length > 1; const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType); // Shifts the toolbar to make room for the parent block selector. const classes = dist_clsx('block-editor-block-contextual-toolbar', { 'has-parent': showParentSelector, 'is-inverted-toolbar': isNavigationMode && !hasFixedToolbar }); const innerClasses = dist_clsx('block-editor-block-toolbar', { 'is-synced': isSynced, 'is-connected': isUsingBindings }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableToolbar, { focusEditorOnEscape: true, className: classes /* translators: accessibility text for the block toolbar */, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block tools') // The variant is applied as "toolbar" when undefined, which is the black border style of the dropdown from the toolbar popover. , variant: variant === 'toolbar' ? undefined : variant, focusOnMount: focusOnMount, __experimentalInitialIndex: __experimentalInitialIndex, __experimentalOnIndexChange: __experimentalOnIndexChange // Resets the index whenever the active block changes so // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169 , children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: toolbarWrapperRef, className: innerClasses, children: [showParentSelector && !isMultiToolbar && isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockParentSelector, {}), (shouldShowVisualToolbar || isMultiToolbar) && !hasParentPattern && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: nodeRef, ...showHoveredOrFocusedGestures, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-toolbar__block-controls", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_switcher, { clientIds: blockClientIds }), !isMultiToolbar && isDefaultEditingMode && showLockButtons && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockToolbar, { clientId: blockClientId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_mover, { clientIds: blockClientIds, hideDragHandle: hideDragHandle })] }) }), !hasContentOnlyLocking && shouldShowVisualToolbar && isMultiToolbar && showGroupButtons && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar, {}), showShuffleButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangeDesign, { clientId: blockClientIds[0] }), showSwitchSectionStyleButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(switch_section_style, { clientId: blockClientIds[0] }), shouldShowVisualToolbar && showSlots && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { group: "parent", className: "block-editor-block-toolbar__slot" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { group: "block", className: "block-editor-block-toolbar__slot" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { className: "block-editor-block-toolbar__slot" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { group: "inline", className: "block-editor-block-toolbar__slot" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { group: "other", className: "block-editor-block-toolbar__slot" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_name_context.Provider, { value: blockType?.name, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_toolbar_last_item.Slot, {}) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEditVisuallyButton, { clientIds: blockClientIds }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu, { clientIds: blockClientIds })] }) }, toolbarKey); } /** * Renders the block toolbar. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md * * @param {Object} props Components props. * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality. * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons. */ function BlockToolbar({ hideDragHandle, variant }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockToolbar, { hideDragHandle: hideDragHandle, variant: variant, focusOnMount: undefined, __experimentalInitialIndex: undefined, __experimentalOnIndexChange: undefined }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-toolbar-popover.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockToolbarPopover({ clientId, isTyping, __unstableContentRef }) { const { capturingClientId, isInsertionPointVisible, lastClientId } = useSelectedBlockToolProps(clientId); // Stores the active toolbar item index so the block toolbar can return focus // to it when re-mounting. const initialToolbarItemIndexRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { // Resets the index whenever the active block changes so this is not // persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169 initialToolbarItemIndexRef.current = undefined; }, [clientId]); const { stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isToolbarForcedRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/block-editor/focus-toolbar', () => { isToolbarForcedRef.current = true; stopTyping(true); }); (0,external_wp_element_namespaceObject.useEffect)(() => { isToolbarForcedRef.current = false; }); // If the block has a parent with __experimentalCaptureToolbars enabled, // the toolbar should be positioned over the topmost capturing parent. const clientIdToPositionOver = capturingClientId || clientId; const popoverProps = useBlockToolbarPopoverProps({ contentElement: __unstableContentRef?.current, clientId: clientIdToPositionOver }); return !isTyping && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockPopover, { clientId: clientIdToPositionOver, bottomClientId: lastClientId, className: dist_clsx('block-editor-block-list__block-popover', { 'is-insertion-point-visible': isInsertionPointVisible }), resize: false, ...popoverProps, __unstableContentRef: __unstableContentRef, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockToolbar // If the toolbar is being shown because of being forced // it should focus the toolbar right after the mount. , { focusOnMount: isToolbarForcedRef.current, __experimentalInitialIndex: initialToolbarItemIndexRef.current, __experimentalOnIndexChange: index => { initialToolbarItemIndexRef.current = index; }, variant: "toolbar" }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserter-button.js /** * External dependencies */ /** * WordPress dependencies */ function ZoomOutModeInserterButton({ onClick }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", icon: library_plus, size: "compact", className: dist_clsx('block-editor-button-pattern-inserter__button', 'block-editor-block-tools__zoom-out-mode-inserter-button'), onClick: onClick, label: (0,external_wp_i18n_namespaceObject._x)('Add pattern', 'Generic label for pattern inserter button') }); } /* harmony default export */ const zoom_out_mode_inserter_button = (ZoomOutModeInserterButton); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserters.js /** * WordPress dependencies */ /** * Internal dependencies */ function ZoomOutModeInserters() { const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); const { hasSelection, blockOrder, setInserterIsOpened, sectionRootClientId, selectedBlockClientId, blockInsertionPoint, insertionPointVisible } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings, getBlockOrder, getSelectionStart, getSelectedBlockClientId, getSectionRootClientId, getBlockInsertionPoint, isBlockInsertionPointVisible } = unlock(select(store)); const root = getSectionRootClientId(); return { hasSelection: !!getSelectionStart().clientId, blockOrder: getBlockOrder(root), sectionRootClientId: root, setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened, selectedBlockClientId: getSelectedBlockClientId(), blockInsertionPoint: getBlockInsertionPoint(), insertionPointVisible: isBlockInsertionPointVisible() }; }, []); // eslint-disable-next-line @wordpress/no-unused-vars-before-return const { showInsertionPoint } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); // Defer the initial rendering to avoid the jumps due to the animation. (0,external_wp_element_namespaceObject.useEffect)(() => { const timeout = setTimeout(() => { setIsReady(true); }, 500); return () => { clearTimeout(timeout); }; }, []); if (!isReady || !hasSelection) { return null; } const previousClientId = selectedBlockClientId; const index = blockOrder.findIndex(clientId => selectedBlockClientId === clientId); const insertionIndex = index + 1; const nextClientId = blockOrder[insertionIndex]; // If the block insertion point is visible, and the insertion // Indices match then we don't need to render the inserter. if (insertionPointVisible && blockInsertionPoint?.index === insertionIndex) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inbetween, { previousClientId: previousClientId, nextClientId: nextClientId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(zoom_out_mode_inserter_button, { onClick: () => { setInserterIsOpened({ rootClientId: sectionRootClientId, insertionIndex, tab: 'patterns', category: 'all' }); showInsertionPoint(sectionRootClientId, insertionIndex, { operation: 'insert' }); } }) }); } /* harmony default export */ const zoom_out_mode_inserters = (ZoomOutModeInserters); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-show-block-tools.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Source of truth for which block tools are showing in the block editor. * * @return {Object} Object of which block tools will be shown. */ function useShowBlockTools() { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlockClientId, getFirstMultiSelectedBlockClientId, getBlock, getBlockMode, getSettings, __unstableGetEditorMode, isTyping } = unlock(select(store)); const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); const block = getBlock(clientId); const editorMode = __unstableGetEditorMode(); const hasSelectedBlock = !!clientId && !!block; const isEmptyDefaultBlock = hasSelectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block) && getBlockMode(clientId) !== 'html'; const _showEmptyBlockSideInserter = clientId && !isTyping() && // Hide the block inserter on the navigation mode. // See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483. editorMode !== 'navigation' && isEmptyDefaultBlock; const _showBlockToolbarPopover = !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock; return { showEmptyBlockSideInserter: _showEmptyBlockSideInserter, showBlockToolbarPopover: _showBlockToolbarPopover }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function block_tools_selector(select) { const { getSelectedBlockClientId, getFirstMultiSelectedBlockClientId, getSettings, isTyping, isDragging, isZoomOut } = unlock(select(store)); const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); return { clientId, hasFixedToolbar: getSettings().hasFixedToolbar, isTyping: isTyping(), isZoomOutMode: isZoomOut(), isDragging: isDragging() }; } /** * Renders block tools (the block toolbar, select/navigation mode toolbar, the * insertion point and a slot for the inline rich text toolbar). Must be wrapped * around the block content and editor styles wrapper or iframe. * * @param {Object} $0 Props. * @param {Object} $0.children The block content and style container. * @param {Object} $0.__unstableContentRef Ref holding the content scroll container. */ function BlockTools({ children, __unstableContentRef, ...props }) { const { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } = (0,external_wp_data_namespaceObject.useSelect)(block_tools_selector, []); const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); const { getBlocksByClientId, getSelectedBlockClientIds, getBlockRootClientId, isGroupable } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const { showEmptyBlockSideInserter, showBlockToolbarPopover } = useShowBlockTools(); const { duplicateBlocks, removeBlocks, replaceBlocks, insertAfterBlock, insertBeforeBlock, selectBlock, moveBlocksUp, moveBlocksDown, expandBlock } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); function onKeyDown(event) { if (event.defaultPrevented) { return; } if (isMatch('core/block-editor/move-up', event) || isMatch('core/block-editor/move-down', event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); const rootClientId = getBlockRootClientId(clientIds[0]); const direction = isMatch('core/block-editor/move-up', event) ? 'up' : 'down'; if (direction === 'up') { moveBlocksUp(clientIds, rootClientId); } else { moveBlocksDown(clientIds, rootClientId); } const blockLength = Array.isArray(clientIds) ? clientIds.length : 1; const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: the name of the block that has been moved (0,external_wp_i18n_namespaceObject._n)('%d block moved.', '%d blocks moved.', clientIds.length), blockLength); (0,external_wp_a11y_namespaceObject.speak)(message); } } else if (isMatch('core/block-editor/duplicate', event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); duplicateBlocks(clientIds); } } else if (isMatch('core/block-editor/remove', event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); removeBlocks(clientIds); } } else if (isMatch('core/block-editor/insert-after', event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); insertAfterBlock(clientIds[clientIds.length - 1]); } } else if (isMatch('core/block-editor/insert-before', event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); insertBeforeBlock(clientIds[0]); } } else if (isMatch('core/block-editor/unselect', event)) { if (event.target.closest('[role=toolbar]')) { // This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where: // - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar // - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element. // - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it. // An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though. return; } const clientIds = getSelectedBlockClientIds(); if (clientIds.length > 1) { event.preventDefault(); // If there is more than one block selected, select the first // block so that focus is directed back to the beginning of the selection. // In effect, to the user this feels like deselecting the multi-selection. selectBlock(clientIds[0]); } } else if (isMatch('core/block-editor/collapse-list-view', event)) { // If focus is currently within a text field, such as a rich text block or other editable field, // skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field. // This condition checks for both the active element and the active element within an iframed editor. if ((0,external_wp_dom_namespaceObject.isTextField)(event.target) || (0,external_wp_dom_namespaceObject.isTextField)(event.target?.contentWindow?.document?.activeElement)) { return; } event.preventDefault(); expandBlock(clientId); } else if (isMatch('core/block-editor/group', event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length > 1 && isGroupable(clientIds)) { event.preventDefault(); const blocks = getBlocksByClientId(clientIds); const groupingBlockName = getGroupingBlockName(); const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); replaceBlocks(clientIds, newBlocks); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Selected blocks are grouped.')); } } } const blockToolbarRef = use_popover_scroll(__unstableContentRef); const blockToolbarAfterRef = use_popover_scroll(__unstableContentRef); return ( /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/no-static-element-interactions (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, onKeyDown: onKeyDown, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(insertion_point_InsertionPointOpenRef.Provider, { value: (0,external_wp_element_namespaceObject.useRef)(false), children: [!isTyping && !isZoomOutMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InsertionPoint, { __unstableContentRef: __unstableContentRef }), showEmptyBlockSideInserter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyBlockInserter, { __unstableContentRef: __unstableContentRef, clientId: clientId }), showBlockToolbarPopover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockToolbarPopover, { __unstableContentRef: __unstableContentRef, clientId: clientId, isTyping: isTyping }), !isZoomOutMode && !hasFixedToolbar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { name: "block-toolbar", ref: blockToolbarRef }), children, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { name: "__unstable-block-tools-after", ref: blockToolbarAfterRef }), isZoomOutMode && !isDragging && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(zoom_out_mode_inserters, { __unstableContentRef: __unstableContentRef })] }) }) ); } ;// external ["wp","commands"] const external_wp_commands_namespaceObject = window["wp"]["commands"]; ;// ./node_modules/@wordpress/icons/build-module/library/ungroup.js /** * WordPress dependencies */ const ungroup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 4h-7c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7zm-5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h1V9H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-1h-1.5v1z" }) }); /* harmony default export */ const library_ungroup = (ungroup); ;// ./node_modules/@wordpress/icons/build-module/library/trash.js /** * WordPress dependencies */ const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" }) }); /* harmony default export */ const library_trash = (trash); ;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-commands/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const getTransformCommands = () => function useTransformCommands() { const { replaceBlocks, multiSelect } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { blocks, clientIds, canRemove, possibleBlockTransformations, invalidSelection } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId, getBlockTransformItems, getSelectedBlockClientIds, getBlocksByClientId, canRemoveBlocks } = select(store); const selectedBlockClientIds = getSelectedBlockClientIds(); const selectedBlocks = getBlocksByClientId(selectedBlockClientIds); // selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId. // These nulls will cause fatal errors down the line. // In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid. // @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536 if (selectedBlocks.filter(block => !block).length > 0) { return { invalidSelection: true }; } const rootClientId = getBlockRootClientId(selectedBlockClientIds[0]); return { blocks: selectedBlocks, clientIds: selectedBlockClientIds, possibleBlockTransformations: getBlockTransformItems(selectedBlocks, rootClientId), canRemove: canRemoveBlocks(selectedBlockClientIds), invalidSelection: false }; }, []); if (invalidSelection) { return { isLoading: false, commands: [] }; } const isTemplate = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]); function selectForMultipleBlocks(insertedBlocks) { if (insertedBlocks.length > 1) { multiSelect(insertedBlocks[0].clientId, insertedBlocks[insertedBlocks.length - 1].clientId); } } // Simple block transformation based on the `Block Transforms` API. function onBlockTransform(name) { const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name); replaceBlocks(clientIds, newBlocks); selectForMultipleBlocks(newBlocks); } /** * The `isTemplate` check is a stopgap solution here. * Ideally, the Transforms API should handle this * by allowing to exclude blocks from wildcard transformations. */ const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate; if (!clientIds || clientIds.length < 1 || !hasPossibleBlockTransformations) { return { isLoading: false, commands: [] }; } const commands = possibleBlockTransformations.map(transformation => { const { name, title, icon } = transformation; return { name: 'core/block-editor/transform-to-' + name.replace('/', '-'), /* translators: %s: Block or block variation name. */ label: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Transform to %s'), title), icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: icon }), callback: ({ close }) => { onBlockTransform(name); close(); } }; }); return { isLoading: false, commands }; }; const getQuickActionsCommands = () => function useQuickActionsCommands() { const { clientIds, isUngroupable, isGroupable } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlockClientIds, isUngroupable: _isUngroupable, isGroupable: _isGroupable } = select(store); const selectedBlockClientIds = getSelectedBlockClientIds(); return { clientIds: selectedBlockClientIds, isUngroupable: _isUngroupable(), isGroupable: _isGroupable() }; }, []); const { canInsertBlockType, getBlockRootClientId, getBlocksByClientId, canRemoveBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getDefaultBlockName, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const blocks = getBlocksByClientId(clientIds); const { removeBlocks, replaceBlocks, duplicateBlocks, insertAfterBlock, insertBeforeBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onGroup = () => { if (!blocks.length) { return; } const groupingBlockName = getGroupingBlockName(); // Activate the `transform` on `core/group` which does the conversion. const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); if (!newBlocks) { return; } replaceBlocks(clientIds, newBlocks); }; const onUngroup = () => { if (!blocks.length) { return; } const innerBlocks = blocks[0].innerBlocks; if (!innerBlocks.length) { return; } replaceBlocks(clientIds, innerBlocks); }; if (!clientIds || clientIds.length < 1) { return { isLoading: false, commands: [] }; } const rootClientId = getBlockRootClientId(clientIds[0]); const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId); const canDuplicate = blocks.every(block => { return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId); }); const canRemove = canRemoveBlocks(clientIds); const commands = []; if (canDuplicate) { commands.push({ name: 'duplicate', label: (0,external_wp_i18n_namespaceObject.__)('Duplicate'), callback: () => duplicateBlocks(clientIds, true), icon: library_copy }); } if (canInsertDefaultBlock) { commands.push({ name: 'add-before', label: (0,external_wp_i18n_namespaceObject.__)('Add before'), callback: () => { const clientId = Array.isArray(clientIds) ? clientIds[0] : clientId; insertBeforeBlock(clientId); }, icon: library_plus }, { name: 'add-after', label: (0,external_wp_i18n_namespaceObject.__)('Add after'), callback: () => { const clientId = Array.isArray(clientIds) ? clientIds[clientIds.length - 1] : clientId; insertAfterBlock(clientId); }, icon: library_plus }); } if (isGroupable) { commands.push({ name: 'Group', label: (0,external_wp_i18n_namespaceObject.__)('Group'), callback: onGroup, icon: library_group }); } if (isUngroupable) { commands.push({ name: 'ungroup', label: (0,external_wp_i18n_namespaceObject.__)('Ungroup'), callback: onUngroup, icon: library_ungroup }); } if (canRemove) { commands.push({ name: 'remove', label: (0,external_wp_i18n_namespaceObject.__)('Delete'), callback: () => removeBlocks(clientIds, true), icon: library_trash }); } return { isLoading: false, commands: commands.map(command => ({ ...command, name: 'core/block-editor/action-' + command.name, callback: ({ close }) => { command.callback(); close(); } })) }; }; const useBlockCommands = () => { (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/block-editor/blockTransforms', hook: getTransformCommands() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/block-editor/blockQuickActions', hook: getQuickActionsCommands(), context: 'block-selection-edit' }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-canvas/index.js /** * WordPress dependencies */ /** * Internal dependencies */ // EditorStyles is a memoized component, so avoid passing a new // object reference on each render. const EDITOR_STYLE_TRANSFORM_OPTIONS = { // Don't transform selectors that already specify `.editor-styles-wrapper`. ignoredSelectors: [/\.editor-styles-wrapper/gi] }; function ExperimentalBlockCanvas({ shouldIframe = true, height = '300px', children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockList, {}), styles, contentRef: contentRefProp, iframeProps }) { useBlockCommands(); const isTabletViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const resetTypingRef = useMouseMoveTypingReset(); const clearerRef = useBlockSelectionClearer(); const localRef = (0,external_wp_element_namespaceObject.useRef)(); const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRefProp, clearerRef, localRef]); const zoomLevel = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getZoomLevel(), []); const zoomOutIframeProps = zoomLevel !== 100 && !isTabletViewport ? { scale: zoomLevel, frameSize: '40px' } : {}; if (!shouldIframe) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockTools, { __unstableContentRef: localRef, style: { height, display: 'flex' }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles, { styles: styles, scope: ":where(.editor-styles-wrapper)", transformOptions: EDITOR_STYLE_TRANSFORM_OPTIONS }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(writing_flow, { ref: contentRef, className: "editor-styles-wrapper", tabIndex: -1, style: { height: '100%', width: '100%' }, children: children })] }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTools, { __unstableContentRef: localRef, style: { height, display: 'flex' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(iframe, { ...iframeProps, ...zoomOutIframeProps, ref: resetTypingRef, contentRef: contentRef, style: { ...iframeProps?.style }, name: "editor-canvas", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles, { styles: styles }), children] }) }); } /** * BlockCanvas component is a component used to display the canvas of the block editor. * What we call the canvas is an iframe containing the block list that you can manipulate. * The component is also responsible of wiring up all the necessary hooks to enable * the keyboard navigation across blocks in the editor and inject content styles into the iframe. * * @example * * ```jsx * function MyBlockEditor() { * const [ blocks, updateBlocks ] = useState([]); * return ( * <BlockEditorProvider * value={ blocks } * onInput={ updateBlocks } * onChange={ persistBlocks } * > * <BlockCanvas height="400px" /> * </BlockEditorProvider> * ); * } * ``` * * @param {Object} props Component props. * @param {string} props.height Canvas height, defaults to 300px. * @param {Array} props.styles Content styles to inject into the iframe. * @param {Element} props.children Content of the canvas, defaults to the BlockList component. * @return {Element} Block Breadcrumb. */ function BlockCanvas({ children, height, styles }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockCanvas, { height: height, styles: styles, children: children }); } /* harmony default export */ const block_canvas = (BlockCanvas); ;// ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js /** * WordPress dependencies */ const ColorSelectorSVGIcon = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z" }) }); /** * Color Selector Icon component. * * @param {Object} props Component properties. * @param {Object} props.style Style object. * @param {string} props.className Class name for component. * * @return {*} React Icon component. */ const ColorSelectorIcon = ({ style, className }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-library-colors-selector__icon-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${className} block-library-colors-selector__state-selection`, style: style, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorSVGIcon, {}) }) }); }; /** * Renders the Colors Selector Toolbar with the icon button. * * @param {Object} props Component properties. * @param {Object} props.TextColor Text color component that wraps icon. * @param {Object} props.BackgroundColor Background color component that wraps icon. * * @return {*} React toggle button component. */ const renderToggleComponent = ({ TextColor, BackgroundColor }) => ({ onToggle, isOpen }) => { const openOnArrowDown = event => { if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); onToggle(); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { className: "components-toolbar__control block-library-colors-selector__toggle", label: (0,external_wp_i18n_namespaceObject.__)('Open Colors Selector'), onClick: onToggle, onKeyDown: openOnArrowDown, icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundColor, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextColor, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorIcon, {}) }) }) }) }); }; const BlockColorsStyleSelector = ({ children, ...other }) => { external_wp_deprecated_default()(`wp.blockEditor.BlockColorsStyleSelector`, { alternative: 'block supports API', since: '6.1', version: '6.3' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: 'bottom-start' }, className: "block-library-colors-selector", contentClassName: "block-library-colors-selector__popover", renderToggle: renderToggleComponent(other), renderContent: () => children }); }; /* harmony default export */ const color_style_selector = (BlockColorsStyleSelector); ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js /** * WordPress dependencies */ const listView = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); /* harmony default export */ const list_view = (listView); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/context.js /** * WordPress dependencies */ const ListViewContext = (0,external_wp_element_namespaceObject.createContext)({}); const useListViewContext = () => (0,external_wp_element_namespaceObject.useContext)(ListViewContext); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/aria-referenced-text.js /** * WordPress dependencies */ /** * A component specifically designed to be used as an element referenced * by ARIA attributes such as `aria-labelledby` or `aria-describedby`. * * @param {Object} props Props. * @param {import('react').ReactNode} props.children */ function AriaReferencedText({ children, ...props }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (ref.current) { // This seems like a no-op, but it fixes a bug in Firefox where // it fails to recompute the text when only the text node changes. // @see https://github.com/WordPress/gutenberg/pull/51035 ref.current.textContent = ref.current.textContent; } }, [children]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, ...props, ref: ref, children: children }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/appender.js /** * WordPress dependencies */ /** * Internal dependencies */ const Appender = (0,external_wp_element_namespaceObject.forwardRef)(({ nestingLevel, blockCount, clientId, ...props }, ref) => { const { insertedBlock, setInsertedBlock } = useListViewContext(); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Appender); const hideInserter = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getTemplateLock, isZoomOut } = unlock(select(store)); return !!getTemplateLock(clientId) || isZoomOut(); }, [clientId]); const blockTitle = useBlockDisplayTitle({ clientId, context: 'list-view' }); const insertedBlockTitle = useBlockDisplayTitle({ clientId: insertedBlock?.clientId, context: 'list-view' }); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!insertedBlockTitle?.length) { return; } (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc) (0,external_wp_i18n_namespaceObject.__)('%s block inserted'), insertedBlockTitle), 'assertive'); }, [insertedBlockTitle]); if (hideInserter) { return null; } const descriptionId = `list-view-appender__${instanceId}`; const description = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */ (0,external_wp_i18n_namespaceObject.__)('Append to %1$s block at position %2$d, Level %3$d'), blockTitle, blockCount + 1, nestingLevel); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "list-view-appender", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { ref: ref, rootClientId: clientId, position: "bottom right", isAppender: true, selectBlockOnInsert: false, shouldDirectInsert: false, __experimentalIsQuick: true, ...props, toggleProps: { 'aria-describedby': descriptionId }, onSelectOrClose: maybeInsertedBlock => { if (maybeInsertedBlock?.clientId) { setInsertedBlock(maybeInsertedBlock); } } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { id: descriptionId, children: description })] }); }); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/leaf.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const AnimatedTreeGridRow = dist_esm_it(external_wp_components_namespaceObject.__experimentalTreeGridRow); const ListViewLeaf = (0,external_wp_element_namespaceObject.forwardRef)(({ isDragged, isSelected, position, level, rowCount, children, className, path, ...props }, ref) => { const animationRef = use_moving_animation({ clientId: props['data-block'], enableAnimation: true, triggerAnimationOnChange: path }); const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, animationRef]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AnimatedTreeGridRow, { ref: mergedRef, className: dist_clsx('block-editor-list-view-leaf', className), level: level, positionInSet: position, setSize: rowCount, isExpanded: undefined, ...props, children: children }); }); /* harmony default export */ const leaf = (ListViewLeaf); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-scroll-into-view.js /** * WordPress dependencies */ function useListViewScrollIntoView({ isSelected, selectedClientIds, rowItemRef }) { const isSingleSelection = selectedClientIds.length === 1; (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { // Skip scrolling into view if this particular block isn't selected, // or if more than one block is selected overall. This is to avoid // scrolling the view in a multi selection where the user has intentionally // selected multiple blocks within the list view, but the initially // selected block may be out of view. if (!isSelected || !isSingleSelection || !rowItemRef.current) { return; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(rowItemRef.current); const { ownerDocument } = rowItemRef.current; const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; // If the there is no scroll container, of if the scroll container is the window, // do not scroll into view, as the block is already in view. if (windowScroll || !scrollContainer) { return; } const rowRect = rowItemRef.current.getBoundingClientRect(); const scrollContainerRect = scrollContainer.getBoundingClientRect(); // If the selected block is not currently visible, scroll to it. if (rowRect.top < scrollContainerRect.top || rowRect.bottom > scrollContainerRect.bottom) { rowItemRef.current.scrollIntoView(); } }, [isSelected, isSingleSelection, rowItemRef]); } ;// ./node_modules/@wordpress/icons/build-module/library/pin-small.js /** * WordPress dependencies */ const pinSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.97 10.159a3.382 3.382 0 0 0-2.857.955l1.724 1.723-2.836 2.913L7 17h1.25l2.913-2.837 1.723 1.723a3.38 3.38 0 0 0 .606-.825c.33-.63.446-1.343.35-2.032L17 10.695 13.305 7l-2.334 3.159Z" }) }); /* harmony default export */ const pin_small = (pinSmall); ;// ./node_modules/@wordpress/icons/build-module/library/lock-small.js /** * WordPress dependencies */ const lockSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" }) }); /* harmony default export */ const lock_small = (lockSmall); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/expander.js /** * WordPress dependencies */ function ListViewExpander({ onClick }) { return ( /*#__PURE__*/ // Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js // // The expander component is implemented as a pseudo element in the w3 example // https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html // // We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree. // For the current tree grid implementation, please do not try to make this a button. // // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view__expander", onClick: event => onClick(event, { forceToggle: true }), "aria-hidden": "true", "data-testid": "list-view-expander", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small }) }) ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-images.js /** * WordPress dependencies */ /** * Internal dependencies */ // Maximum number of images to display in a list view row. const MAX_IMAGES = 3; function getImage(block) { if (block.name !== 'core/image') { return; } if (block.attributes?.url) { return { url: block.attributes.url, alt: block.attributes.alt, clientId: block.clientId }; } } function getImagesFromGallery(block) { if (block.name !== 'core/gallery' || !block.innerBlocks) { return []; } const images = []; for (const innerBlock of block.innerBlocks) { const img = getImage(innerBlock); if (img) { images.push(img); } if (images.length >= MAX_IMAGES) { return images; } } return images; } function getImagesFromBlock(block, isExpanded) { const img = getImage(block); if (img) { return [img]; } return isExpanded ? [] : getImagesFromGallery(block); } /** * Get a block's preview images for display within a list view row. * * TODO: Currently only supports images from the core/image and core/gallery * blocks. This should be expanded to support other blocks that have images, * potentially via an API that blocks can opt into / provide their own logic. * * @param {Object} props Hook properties. * @param {string} props.clientId The block's clientId. * @param {boolean} props.isExpanded Whether or not the block is expanded in the list view. * @return {Array} Images. */ function useListViewImages({ clientId, isExpanded }) { const { block } = (0,external_wp_data_namespaceObject.useSelect)(select => { const _block = select(store).getBlock(clientId); return { block: _block }; }, [clientId]); const images = (0,external_wp_element_namespaceObject.useMemo)(() => { return getImagesFromBlock(block, isExpanded); }, [block, isExpanded]); return images; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-select-button.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { Badge: block_select_button_Badge } = unlock(external_wp_components_namespaceObject.privateApis); function ListViewBlockSelectButton({ className, block: { clientId }, onClick, onContextMenu, onMouseDown, onToggleExpanded, tabIndex, onFocus, onDragStart, onDragEnd, draggable, isExpanded, ariaDescribedBy }, ref) { const blockInformation = useBlockDisplayInformation(clientId); const blockTitle = useBlockDisplayTitle({ clientId, context: 'list-view' }); const { isLocked } = useBlockLock(clientId); const { isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ isContentOnly: select(store).getBlockEditingMode(clientId) === 'contentOnly' }), [clientId]); const shouldShowLockIcon = isLocked && !isContentOnly; const isSticky = blockInformation?.positionType === 'sticky'; const images = useListViewImages({ clientId, isExpanded }); // The `href` attribute triggers the browser's native HTML drag operations. // When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html. // We need to clear any HTML drag data to prevent `pasteHandler` from firing // inside the `useOnBlockDrop` hook. const onDragStartHandler = event => { event.dataTransfer.clearData(); onDragStart?.(event); }; /** * @param {KeyboardEvent} event */ function onKeyDown(event) { if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER || event.keyCode === external_wp_keycodes_namespaceObject.SPACE) { onClick(event); } } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("a", { className: dist_clsx('block-editor-list-view-block-select-button', className), onClick: onClick, onContextMenu: onContextMenu, onKeyDown: onKeyDown, onMouseDown: onMouseDown, ref: ref, tabIndex: tabIndex, onFocus: onFocus, onDragStart: onDragStartHandler, onDragEnd: onDragEnd, draggable: draggable, href: `#block-${clientId}`, "aria-describedby": ariaDescribedBy, "aria-expanded": isExpanded, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { onClick: onToggleExpanded }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: blockInformation?.icon, showColors: true, context: "list-view" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", className: "block-editor-list-view-block-select-button__label-wrapper", justify: "flex-start", spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__title", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { ellipsizeMode: "auto", children: blockTitle }) }), blockInformation?.anchor && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__anchor-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_select_button_Badge, { className: "block-editor-list-view-block-select-button__anchor", children: blockInformation.anchor }) }), isSticky && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__sticky", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: pin_small }) }), images.length ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__images", "aria-hidden": true, children: images.map((image, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__image", style: { backgroundImage: `url(${image.url})`, zIndex: images.length - index // Ensure the first image is on top, and subsequent images are behind. } }, image.clientId)) }) : null, shouldShowLockIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__lock", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: lock_small }) })] })] }); } /* harmony default export */ const block_select_button = ((0,external_wp_element_namespaceObject.forwardRef)(ListViewBlockSelectButton)); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-contents.js /** * WordPress dependencies */ /** * Internal dependencies */ const ListViewBlockContents = (0,external_wp_element_namespaceObject.forwardRef)(({ onClick, onToggleExpanded, block, isSelected, position, siblingBlockCount, level, isExpanded, selectedClientIds, ...props }, ref) => { const { clientId } = block; const { AdditionalBlockContent, insertedBlock, setInsertedBlock } = useListViewContext(); // Only include all selected blocks if the currently clicked on block // is one of the selected blocks. This ensures that if a user attempts // to drag a block that isn't part of the selection, they're still able // to drag it and rearrange its position. const draggableClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [AdditionalBlockContent && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AdditionalBlockContent, { block: block, insertedBlock: insertedBlock, setInsertedBlock: setInsertedBlock }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_draggable, { appendToOwnerDocument: true, clientIds: draggableClientIds, cloneClassname: "block-editor-list-view-draggable-chip", children: ({ draggable, onDragStart, onDragEnd }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_select_button, { ref: ref, className: "block-editor-list-view-block-contents", block: block, onClick: onClick, onToggleExpanded: onToggleExpanded, isSelected: isSelected, position: position, siblingBlockCount: siblingBlockCount, level: level, draggable: draggable, onDragStart: onDragStart, onDragEnd: onDragEnd, isExpanded: isExpanded, ...props }) })] }); }); /* harmony default export */ const block_contents = (ListViewBlockContents); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/utils.js /** * WordPress dependencies */ const getBlockPositionDescription = (position, siblingCount, level) => (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */ (0,external_wp_i18n_namespaceObject.__)('Block %1$d of %2$d, Level %3$d.'), position, siblingCount, level); const getBlockPropertiesDescription = (blockInformation, isLocked) => [blockInformation?.positionLabel ? `${(0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Position of selected block, e.g. "Sticky" or "Fixed". (0,external_wp_i18n_namespaceObject.__)('Position: %s'), blockInformation.positionLabel)}.` : undefined, isLocked ? (0,external_wp_i18n_namespaceObject.__)('This block is locked.') : undefined].filter(Boolean).join(' '); /** * Returns true if the client ID occurs within the block selection or multi-selection, * or false otherwise. * * @param {string} clientId Block client ID. * @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs. * * @return {boolean} Whether the block is in multi-selection set. */ const isClientIdSelected = (clientId, selectedBlockClientIds) => Array.isArray(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId; /** * From a start and end clientId of potentially different nesting levels, * return the nearest-depth ids that have a common level of depth in the * nesting hierarchy. For multiple block selection, this ensure that the * selection is always at the same nesting level, and not split across * separate levels. * * @param {string} startId The first id of a selection. * @param {string} endId The end id of a selection, usually one that has been clicked on. * @param {string[]} startParents An array of ancestor ids for the start id, in descending order. * @param {string[]} endParents An array of ancestor ids for the end id, in descending order. * @return {Object} An object containing the start and end ids. */ function getCommonDepthClientIds(startId, endId, startParents, endParents) { const startPath = [...startParents, startId]; const endPath = [...endParents, endId]; const depth = Math.min(startPath.length, endPath.length) - 1; const start = startPath[depth]; const end = endPath[depth]; return { start, end }; } /** * Shift focus to the list view item associated with a particular clientId. * * @typedef {import('@wordpress/element').RefObject} RefObject * * @param {string} focusClientId The client ID of the block to focus. * @param {?HTMLElement} treeGridElement The container element to search within. */ function focusListItem(focusClientId, treeGridElement) { const getFocusElement = () => { const row = treeGridElement?.querySelector(`[role=row][data-block="${focusClientId}"]`); if (!row) { return null; } // Focus the first focusable in the row, which is the ListViewBlockSelectButton. return external_wp_dom_namespaceObject.focus.focusable.find(row)[0]; }; let focusElement = getFocusElement(); if (focusElement) { focusElement.focus(); } else { // The element hasn't been painted yet. Defer focusing on the next frame. // This could happen when all blocks have been deleted and the default block // hasn't been added to the editor yet. window.requestAnimationFrame(() => { focusElement = getFocusElement(); // Ignore if the element still doesn't exist. if (focusElement) { focusElement.focus(); } }); } } /** * Get values for the block that flag whether the block should be displaced up or down, * whether the block is being nested, and whether the block appears after the dragged * blocks. These values are used to determine the class names to apply to the block. * The list view rows are displaced visually via CSS rules. Displacement rules: * - `normal`: no displacement — used to apply a translateY of `0` so that the block * appears in its original position, and moves to that position smoothly when dragging * outside of the list view area. * - `up`: the block should be displaced up, creating room beneath the block for the drop indicator. * - `down`: the block should be displaced down, creating room above the block for the drop indicator. * * @param {Object} props * @param {Object} props.blockIndexes The indexes of all the blocks in the list view, keyed by clientId. * @param {number|null|undefined} props.blockDropTargetIndex The index of the block that the user is dropping to. * @param {?string} props.blockDropPosition The position relative to the block that the user is dropping to. * @param {string} props.clientId The client id for the current block. * @param {?number} props.firstDraggedBlockIndex The index of the first dragged block. * @param {?boolean} props.isDragged Whether the current block is being dragged. Dragged blocks skip displacement. * @return {Object} An object containing the `displacement`, `isAfterDraggedBlocks` and `isNesting` values. */ function getDragDisplacementValues({ blockIndexes, blockDropTargetIndex, blockDropPosition, clientId, firstDraggedBlockIndex, isDragged }) { let displacement; let isNesting; let isAfterDraggedBlocks; if (!isDragged) { isNesting = false; const thisBlockIndex = blockIndexes[clientId]; isAfterDraggedBlocks = thisBlockIndex > firstDraggedBlockIndex; // Determine where to displace the position of the current block, relative // to the blocks being dragged (in their original position) and the drop target // (the position where a user is currently dragging the blocks to). if (blockDropTargetIndex !== undefined && blockDropTargetIndex !== null && firstDraggedBlockIndex !== undefined) { // If the block is being dragged and there is a valid drop target, // determine if the block being rendered should be displaced up or down. if (thisBlockIndex !== undefined) { if (thisBlockIndex >= firstDraggedBlockIndex && thisBlockIndex < blockDropTargetIndex) { // If the current block appears after the set of dragged blocks // (in their original position), but is before the drop target, // then the current block should be displaced up. displacement = 'up'; } else if (thisBlockIndex < firstDraggedBlockIndex && thisBlockIndex >= blockDropTargetIndex) { // If the current block appears before the set of dragged blocks // (in their original position), but is after the drop target, // then the current block should be displaced down. displacement = 'down'; } else { displacement = 'normal'; } isNesting = typeof blockDropTargetIndex === 'number' && blockDropTargetIndex - 1 === thisBlockIndex && blockDropPosition === 'inside'; } } else if (blockDropTargetIndex === null && firstDraggedBlockIndex !== undefined) { // A `null` value for `blockDropTargetIndex` indicates that the // drop target is outside of the valid areas within the list view. // In this case, the drag is still active, but as there is no // valid drop target, we should remove the gap indicating where // the block would be inserted. if (thisBlockIndex !== undefined && thisBlockIndex >= firstDraggedBlockIndex) { displacement = 'up'; } else { displacement = 'normal'; } } else if (blockDropTargetIndex !== undefined && blockDropTargetIndex !== null && firstDraggedBlockIndex === undefined) { // If the blockdrop target is defined, but there are no dragged blocks, // then the block should be displaced relative to the drop target. if (thisBlockIndex !== undefined) { if (thisBlockIndex < blockDropTargetIndex) { displacement = 'normal'; } else { displacement = 'down'; } } } else if (blockDropTargetIndex === null) { displacement = 'normal'; } } return { displacement, isNesting, isAfterDraggedBlocks }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ListViewBlock({ block: { clientId }, displacement, isAfterDraggedBlocks, isDragged, isNesting, isSelected, isBranchSelected, selectBlock, position, level, rowCount, siblingBlockCount, showBlockMovers, path, isExpanded, selectedClientIds, isSyncedBranch }) { const cellRef = (0,external_wp_element_namespaceObject.useRef)(null); const rowRef = (0,external_wp_element_namespaceObject.useRef)(null); const settingsRef = (0,external_wp_element_namespaceObject.useRef)(null); const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); const [settingsAnchorRect, setSettingsAnchorRect] = (0,external_wp_element_namespaceObject.useState)(); const { isLocked, canEdit, canMove } = useBlockLock(clientId); const isFirstSelectedBlock = isSelected && selectedClientIds[0] === clientId; const isLastSelectedBlock = isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId; const { toggleBlockHighlight, duplicateBlocks, multiSelect, replaceBlocks, removeBlocks, insertAfterBlock, insertBeforeBlock, setOpenedBlockSettingsMenu } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const { canInsertBlockType, getSelectedBlockClientIds, getPreviousBlockClientId, getBlockRootClientId, getBlockOrder, getBlockParents, getBlocksByClientId, canRemoveBlocks, isGroupable } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const blockInformation = useBlockDisplayInformation(clientId); const { block, blockName, allowRightClickOverrides } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlock, getBlockName, getSettings } = select(store); return { block: getBlock(clientId), blockName: getBlockName(clientId), allowRightClickOverrides: getSettings().allowRightClickOverrides }; }, [clientId]); const showBlockActions = // When a block hides its toolbar it also hides the block settings menu, // since that menu is part of the toolbar in the editor canvas. // List View respects this by also hiding the block settings menu. (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, '__experimentalToolbar', true); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewBlock); const descriptionId = `list-view-block-select-button__description-${instanceId}`; const { expand, collapse, collapseAll, BlockSettingsMenu, listViewInstanceId, expandedState, setInsertedBlock, treeGridElementRef, rootClientId } = useListViewContext(); const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); // Determine which blocks to update: // If the current (focused) block is part of the block selection, use the whole selection. // If the focused block is not part of the block selection, only update the focused block. function getBlocksToUpdate() { const selectedBlockClientIds = getSelectedBlockClientIds(); const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId); const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId; const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId); const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId]; return { blocksToUpdate, firstBlockClientId, firstBlockRootClientId, selectedBlockClientIds }; } /** * @param {KeyboardEvent} event */ async function onKeyDown(event) { if (event.defaultPrevented) { return; } // Do not handle events if it comes from modals; // retain the default behavior for these keys. if (event.target.closest('[role=dialog]')) { return; } const isDeleteKey = [external_wp_keycodes_namespaceObject.BACKSPACE, external_wp_keycodes_namespaceObject.DELETE].includes(event.keyCode); // If multiple blocks are selected, deselect all blocks when the user // presses the escape key. if (isMatch('core/block-editor/unselect', event) && selectedClientIds.length > 0) { event.stopPropagation(); event.preventDefault(); selectBlock(event, undefined); } else if (isDeleteKey || isMatch('core/block-editor/remove', event)) { var _getPreviousBlockClie; const { blocksToUpdate: blocksToDelete, firstBlockClientId, firstBlockRootClientId, selectedBlockClientIds } = getBlocksToUpdate(); // Don't update the selection if the blocks cannot be deleted. if (!canRemoveBlocks(blocksToDelete)) { return; } let blockToFocus = (_getPreviousBlockClie = getPreviousBlockClientId(firstBlockClientId)) !== null && _getPreviousBlockClie !== void 0 ? _getPreviousBlockClie : // If the previous block is not found (when the first block is deleted), // fallback to focus the parent block. firstBlockRootClientId; removeBlocks(blocksToDelete, false); // Update the selection if the original selection has been removed. const shouldUpdateSelection = selectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0; // If there's no previous block nor parent block, focus the first block. if (!blockToFocus) { blockToFocus = getBlockOrder()[0]; } updateFocusAndSelection(blockToFocus, shouldUpdateSelection); } else if (isMatch('core/block-editor/duplicate', event)) { event.preventDefault(); const { blocksToUpdate, firstBlockRootClientId } = getBlocksToUpdate(); const canDuplicate = getBlocksByClientId(blocksToUpdate).every(blockToUpdate => { return !!blockToUpdate && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockToUpdate.name, 'multiple', true) && canInsertBlockType(blockToUpdate.name, firstBlockRootClientId); }); if (canDuplicate) { const updatedBlocks = await duplicateBlocks(blocksToUpdate, false); if (updatedBlocks?.length) { // If blocks have been duplicated, focus the first duplicated block. updateFocusAndSelection(updatedBlocks[0], false); } } } else if (isMatch('core/block-editor/insert-before', event)) { event.preventDefault(); const { blocksToUpdate } = getBlocksToUpdate(); await insertBeforeBlock(blocksToUpdate[0]); const newlySelectedBlocks = getSelectedBlockClientIds(); // Focus the first block of the newly inserted blocks, to keep focus within the list view. setOpenedBlockSettingsMenu(undefined); updateFocusAndSelection(newlySelectedBlocks[0], false); } else if (isMatch('core/block-editor/insert-after', event)) { event.preventDefault(); const { blocksToUpdate } = getBlocksToUpdate(); await insertAfterBlock(blocksToUpdate.at(-1)); const newlySelectedBlocks = getSelectedBlockClientIds(); // Focus the first block of the newly inserted blocks, to keep focus within the list view. setOpenedBlockSettingsMenu(undefined); updateFocusAndSelection(newlySelectedBlocks[0], false); } else if (isMatch('core/block-editor/select-all', event)) { event.preventDefault(); const { firstBlockRootClientId, selectedBlockClientIds } = getBlocksToUpdate(); const blockClientIds = getBlockOrder(firstBlockRootClientId); if (!blockClientIds.length) { return; } // If we have selected all sibling nested blocks, try selecting up a level. // This is a similar implementation to that used by `useSelectAll`. // `isShallowEqual` is used for the list view instead of a length check, // as the array of siblings of the currently focused block may be a different // set of blocks from the current block selection if the user is focused // on a different part of the list view from the block selection. if (external_wp_isShallowEqual_default()(selectedBlockClientIds, blockClientIds)) { // Only select up a level if the first block is not the root block. // This ensures that the block selection can't break out of the root block // used by the list view, if the list view is only showing a partial hierarchy. if (firstBlockRootClientId && firstBlockRootClientId !== rootClientId) { updateFocusAndSelection(firstBlockRootClientId, true); return; } } // Select all while passing `null` to skip focusing to the editor canvas, // and retain focus within the list view. multiSelect(blockClientIds[0], blockClientIds[blockClientIds.length - 1], null); } else if (isMatch('core/block-editor/collapse-list-view', event)) { event.preventDefault(); const { firstBlockClientId } = getBlocksToUpdate(); const blockParents = getBlockParents(firstBlockClientId, false); // Collapse all blocks. collapseAll(); // Expand all parents of the current block. expand(blockParents); } else if (isMatch('core/block-editor/group', event)) { const { blocksToUpdate } = getBlocksToUpdate(); if (blocksToUpdate.length > 1 && isGroupable(blocksToUpdate)) { event.preventDefault(); const blocks = getBlocksByClientId(blocksToUpdate); const groupingBlockName = getGroupingBlockName(); const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); replaceBlocks(blocksToUpdate, newBlocks); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Selected blocks are grouped.')); const newlySelectedBlocks = getSelectedBlockClientIds(); // Focus the first block of the newly inserted blocks, to keep focus within the list view. setOpenedBlockSettingsMenu(undefined); updateFocusAndSelection(newlySelectedBlocks[0], false); } } } const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsHovered(true); toggleBlockHighlight(clientId, true); }, [clientId, setIsHovered, toggleBlockHighlight]); const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsHovered(false); toggleBlockHighlight(clientId, false); }, [clientId, setIsHovered, toggleBlockHighlight]); const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)(event => { selectBlock(event, clientId); event.preventDefault(); }, [clientId, selectBlock]); const updateFocusAndSelection = (0,external_wp_element_namespaceObject.useCallback)((focusClientId, shouldSelectBlock) => { if (shouldSelectBlock) { selectBlock(undefined, focusClientId, null, null); } focusListItem(focusClientId, treeGridElementRef?.current); }, [selectBlock, treeGridElementRef]); const toggleExpanded = (0,external_wp_element_namespaceObject.useCallback)(event => { // Prevent shift+click from opening link in a new window when toggling. event.preventDefault(); event.stopPropagation(); if (isExpanded === true) { collapse(clientId); } else if (isExpanded === false) { expand(clientId); } }, [clientId, expand, collapse, isExpanded]); // Allow right-clicking an item in the List View to open up the block settings dropdown. const onContextMenu = (0,external_wp_element_namespaceObject.useCallback)(event => { if (showBlockActions && allowRightClickOverrides) { settingsRef.current?.click(); // Ensure the position of the settings dropdown is at the cursor. setSettingsAnchorRect(new window.DOMRect(event.clientX, event.clientY, 0, 0)); event.preventDefault(); } }, [allowRightClickOverrides, settingsRef, showBlockActions]); const onMouseDown = (0,external_wp_element_namespaceObject.useCallback)(event => { // Prevent right-click from focusing the block, // because focus will be handled when opening the block settings dropdown. if (allowRightClickOverrides && event.button === 2) { event.preventDefault(); } }, [allowRightClickOverrides]); const settingsPopoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { const { ownerDocument } = rowRef?.current || {}; // If no custom position is set, the settings dropdown will be anchored to the // DropdownMenu toggle button. if (!settingsAnchorRect || !ownerDocument) { return undefined; } // Position the settings dropdown at the cursor when right-clicking a block. return { ownerDocument, getBoundingClientRect() { return settingsAnchorRect; } }; }, [settingsAnchorRect]); const clearSettingsAnchorRect = (0,external_wp_element_namespaceObject.useCallback)(() => { // Clear the custom position for the settings dropdown so that it is restored back // to being anchored to the DropdownMenu toggle button. setSettingsAnchorRect(undefined); }, [setSettingsAnchorRect]); // Pass in a ref to the row, so that it can be scrolled // into view when selected. For long lists, the placeholder for the // selected block is also observed, within ListViewLeafPlaceholder. useListViewScrollIntoView({ isSelected, rowItemRef: rowRef, selectedClientIds }); // When switching between rendering modes (such as template preview and content only), // it is possible for a block to temporarily be unavailable. In this case, we should not // render the leaf, to avoid errors further down the tree. if (!block) { return null; } const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level); const blockPropertiesDescription = getBlockPropertiesDescription(blockInformation, isLocked); const hasSiblings = siblingBlockCount > 0; const hasRenderedMovers = showBlockMovers && hasSiblings; const moverCellClassName = dist_clsx('block-editor-list-view-block__mover-cell', { 'is-visible': isHovered || isSelected }); const listViewBlockSettingsClassName = dist_clsx('block-editor-list-view-block__menu-cell', { 'is-visible': isHovered || isFirstSelectedBlock }); let colSpan; if (hasRenderedMovers) { colSpan = 2; } else if (!showBlockActions) { colSpan = 3; } const classes = dist_clsx({ 'is-selected': isSelected, 'is-first-selected': isFirstSelectedBlock, 'is-last-selected': isLastSelectedBlock, 'is-branch-selected': isBranchSelected, 'is-synced-branch': isSyncedBranch, 'is-dragging': isDragged, 'has-single-cell': !showBlockActions, 'is-synced': blockInformation?.isSynced, 'is-draggable': canMove, 'is-displacement-normal': displacement === 'normal', 'is-displacement-up': displacement === 'up', 'is-displacement-down': displacement === 'down', 'is-after-dragged-blocks': isAfterDraggedBlocks, 'is-nesting': isNesting }); // Only include all selected blocks if the currently clicked on block // is one of the selected blocks. This ensures that if a user attempts // to alter a block that isn't part of the selection, they're still able // to do so. const dropdownClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; // Detect if there is a block in the canvas currently being edited and multi-selection is not happening. const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(leaf, { className: classes, isDragged: isDragged, onKeyDown: onKeyDown, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onMouseEnter, onBlur: onMouseLeave, level: level, position: position, rowCount: rowCount, path: path, id: `list-view-${listViewInstanceId}-block-${clientId}`, "data-block": clientId, "data-expanded": canEdit ? isExpanded : undefined, ref: rowRef, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { className: "block-editor-list-view-block__contents-cell", colSpan: colSpan, ref: cellRef, "aria-selected": !!isSelected, children: ({ ref, tabIndex, onFocus }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-list-view-block__contents-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_contents, { block: block, onClick: selectEditorBlock, onContextMenu: onContextMenu, onMouseDown: onMouseDown, onToggleExpanded: toggleExpanded, isSelected: isSelected, position: position, siblingBlockCount: siblingBlockCount, level: level, ref: ref, tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex, onFocus: onFocus, isExpanded: canEdit ? isExpanded : undefined, selectedClientIds: selectedClientIds, ariaDescribedBy: descriptionId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { id: descriptionId, children: [blockPositionDescription, blockPropertiesDescription].filter(Boolean).join(' ') })] }) }), hasRenderedMovers && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { className: moverCellClassName, withoutGridItem: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { children: ({ ref, tabIndex, onFocus }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverUpButton, { orientation: "vertical", clientIds: [clientId], ref: ref, tabIndex: tabIndex, onFocus: onFocus }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { children: ({ ref, tabIndex, onFocus }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverDownButton, { orientation: "vertical", clientIds: [clientId], ref: ref, tabIndex: tabIndex, onFocus: onFocus }) })] }) }), showBlockActions && BlockSettingsMenu && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { className: listViewBlockSettingsClassName, "aria-selected": !!isSelected, ref: settingsRef, children: ({ ref, tabIndex, onFocus }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSettingsMenu, { clientIds: dropdownClientIds, block: block, icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Options'), popoverProps: { anchor: settingsPopoverAnchor // Used to position the settings at the cursor on right-click. }, toggleProps: { ref, className: 'block-editor-list-view-block__menu', tabIndex, onClick: clearSettingsAnchorRect, onFocus }, disableOpenOnArrowDown: true, expand: expand, expandedState: expandedState, setInsertedBlock: setInsertedBlock, __experimentalSelectBlock: updateFocusAndSelection }) })] }); } /* harmony default export */ const list_view_block = ((0,external_wp_element_namespaceObject.memo)(ListViewBlock)); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/branch.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Given a block, returns the total number of blocks in that subtree. This is used to help determine * the list position of a block. * * When a block is collapsed, we do not count their children as part of that total. In the current drag * implementation dragged blocks and their children are not counted. * * @param {Object} block block tree * @param {Object} expandedState state that notes which branches are collapsed * @param {Array} draggedClientIds a list of dragged client ids * @param {boolean} isExpandedByDefault flag to determine the default fallback expanded state. * @return {number} block count */ function countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault) { var _expandedState$block$; const isDragged = draggedClientIds?.includes(block.clientId); if (isDragged) { return 0; } const isExpanded = (_expandedState$block$ = expandedState[block.clientId]) !== null && _expandedState$block$ !== void 0 ? _expandedState$block$ : isExpandedByDefault; if (isExpanded) { return 1 + block.innerBlocks.reduce(countReducer(expandedState, draggedClientIds, isExpandedByDefault), 0); } return 1; } const countReducer = (expandedState, draggedClientIds, isExpandedByDefault) => (count, block) => { var _expandedState$block$2; const isDragged = draggedClientIds?.includes(block.clientId); if (isDragged) { return count; } const isExpanded = (_expandedState$block$2 = expandedState[block.clientId]) !== null && _expandedState$block$2 !== void 0 ? _expandedState$block$2 : isExpandedByDefault; if (isExpanded && block.innerBlocks.length > 0) { return count + countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault); } return count + 1; }; const branch_noop = () => {}; function ListViewBranch(props) { const { blocks, selectBlock = branch_noop, showBlockMovers, selectedClientIds, level = 1, path = '', isBranchSelected = false, listPosition = 0, fixedListWindow, isExpanded, parentId, shouldShowInnerBlocks = true, isSyncedBranch = false, showAppender: showAppenderProp = true } = props; const parentBlockInformation = useBlockDisplayInformation(parentId); const syncedBranch = isSyncedBranch || !!parentBlockInformation?.isSynced; const canParentExpand = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!parentId) { return true; } return select(store).canEditBlock(parentId); }, [parentId]); const { blockDropPosition, blockDropTargetIndex, firstDraggedBlockIndex, blockIndexes, expandedState, draggedClientIds } = useListViewContext(); const nextPositionRef = (0,external_wp_element_namespaceObject.useRef)(); if (!canParentExpand) { return null; } // Only show the appender at the first level. const showAppender = showAppenderProp && level === 1; const filteredBlocks = blocks.filter(Boolean); const blockCount = filteredBlocks.length; // The appender means an extra row in List View, so add 1 to the row count. const rowCount = showAppender ? blockCount + 1 : blockCount; nextPositionRef.current = listPosition; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [filteredBlocks.map((block, index) => { var _expandedState$client; const { clientId, innerBlocks } = block; if (index > 0) { nextPositionRef.current += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds, isExpanded); } const isDragged = !!draggedClientIds?.includes(clientId); // Determine the displacement of the block while dragging. This // works out whether the current block should be displaced up or // down, relative to the dragged blocks and the drop target. const { displacement, isAfterDraggedBlocks, isNesting } = getDragDisplacementValues({ blockIndexes, blockDropTargetIndex, blockDropPosition, clientId, firstDraggedBlockIndex, isDragged }); const { itemInView } = fixedListWindow; const blockInView = itemInView(nextPositionRef.current); const position = index + 1; const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`; const hasNestedBlocks = !!innerBlocks?.length; const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : isExpanded : undefined; // Make updates to the selected or dragged blocks synchronous, // but asynchronous for any other block. const isSelected = isClientIdSelected(clientId, selectedClientIds); const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks; // To avoid performance issues, we only render blocks that are in view, // or blocks that are selected or dragged. If a block is selected, // it is only counted if it is the first of the block selection. // This prevents the entire tree from being rendered when a branch is // selected, or a user selects all blocks, while still enabling scroll // into view behavior when selecting a block or opening the list view. // The first and last blocks of the list are always rendered, to ensure // that Home and End keys work as expected. const showBlock = isDragged || blockInView || isSelected && clientId === selectedClientIds[0] || index === 0 || index === blockCount - 1; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { value: !isSelected, children: [showBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(list_view_block, { block: block, selectBlock: selectBlock, isSelected: isSelected, isBranchSelected: isSelectedBranch, isDragged: isDragged, level: level, position: position, rowCount: rowCount, siblingBlockCount: blockCount, showBlockMovers: showBlockMovers, path: updatedPath, isExpanded: isDragged ? false : shouldExpand, listPosition: nextPositionRef.current, selectedClientIds: selectedClientIds, isSyncedBranch: syncedBranch, displacement: displacement, isAfterDraggedBlocks: isAfterDraggedBlocks, isNesting: isNesting }), !showBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { className: "block-editor-list-view-placeholder" }) }), hasNestedBlocks && shouldExpand && !isDragged && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewBranch, { parentId: clientId, blocks: innerBlocks, selectBlock: selectBlock, showBlockMovers: showBlockMovers, level: level + 1, path: updatedPath, listPosition: nextPositionRef.current + 1, fixedListWindow: fixedListWindow, isBranchSelected: isSelectedBranch, selectedClientIds: selectedClientIds, isExpanded: isExpanded, isSyncedBranch: syncedBranch })] }, clientId); }), showAppender && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridRow, { level: level, setSize: rowCount, positionInSet: rowCount, isExpanded: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { children: treeGridCellProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Appender, { clientId: parentId, nestingLevel: level, blockCount: blockCount, ...treeGridCellProps }) }) })] }); } /* harmony default export */ const branch = ((0,external_wp_element_namespaceObject.memo)(ListViewBranch)); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/drop-indicator.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ListViewDropIndicatorPreview({ draggedBlockClientId, listViewRef, blockDropTarget }) { const blockInformation = useBlockDisplayInformation(draggedBlockClientId); const blockTitle = useBlockDisplayTitle({ clientId: draggedBlockClientId, context: 'list-view' }); const { rootClientId, clientId, dropPosition } = blockDropTarget || {}; const [rootBlockElement, blockElement] = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!listViewRef.current) { return []; } // The rootClientId will be defined whenever dropping into inner // block lists, but is undefined when dropping at the root level. const _rootBlockElement = rootClientId ? listViewRef.current.querySelector(`[data-block="${rootClientId}"]`) : undefined; // The clientId represents the sibling block, the dragged block will // usually be inserted adjacent to it. It will be undefined when // dropping a block into an empty block list. const _blockElement = clientId ? listViewRef.current.querySelector(`[data-block="${clientId}"]`) : undefined; return [_rootBlockElement, _blockElement]; }, [listViewRef, rootClientId, clientId]); // The targetElement is the element that the drop indicator will appear // before or after. When dropping into an empty block list, blockElement // is undefined, so the indicator will appear after the rootBlockElement. const targetElement = blockElement || rootBlockElement; const rtl = (0,external_wp_i18n_namespaceObject.isRTL)(); const getDropIndicatorWidth = (0,external_wp_element_namespaceObject.useCallback)((targetElementRect, indent) => { if (!targetElement) { return 0; } // Default to assuming that the width of the drop indicator // should be the same as the target element. let width = targetElement.offsetWidth; // In deeply nested lists, where a scrollbar is present, // the width of the drop indicator should be the width of // the scroll container, minus the distance from the left // edge of the scroll container to the left edge of the // target element. const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(targetElement, 'horizontal'); const ownerDocument = targetElement.ownerDocument; const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; if (scrollContainer && !windowScroll) { const scrollContainerRect = scrollContainer.getBoundingClientRect(); const distanceBetweenContainerAndTarget = (0,external_wp_i18n_namespaceObject.isRTL)() ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left; const scrollContainerWidth = scrollContainer.clientWidth; if (scrollContainerWidth < width + distanceBetweenContainerAndTarget) { width = scrollContainerWidth - distanceBetweenContainerAndTarget; } // LTR logic for ensuring the drop indicator does not extend // beyond the right edge of the scroll container. if (!rtl && targetElementRect.left + indent < scrollContainerRect.left) { width -= scrollContainerRect.left - targetElementRect.left; return width; } // RTL logic for ensuring the drop indicator does not extend // beyond the right edge of the scroll container. if (rtl && targetElementRect.right - indent > scrollContainerRect.right) { width -= targetElementRect.right - scrollContainerRect.right; return width; } } // Subtract the indent from the final width of the indicator. return width - indent; }, [rtl, targetElement]); const style = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!targetElement) { return {}; } const targetElementRect = targetElement.getBoundingClientRect(); return { width: getDropIndicatorWidth(targetElementRect, 0) }; }, [getDropIndicatorWidth, targetElement]); const horizontalScrollOffsetStyle = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!targetElement) { return {}; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(targetElement); const ownerDocument = targetElement.ownerDocument; const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; if (scrollContainer && !windowScroll) { const scrollContainerRect = scrollContainer.getBoundingClientRect(); const targetElementRect = targetElement.getBoundingClientRect(); const distanceBetweenContainerAndTarget = rtl ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left; if (!rtl && scrollContainerRect.left > targetElementRect.left) { return { transform: `translateX( ${distanceBetweenContainerAndTarget}px )` }; } if (rtl && scrollContainerRect.right < targetElementRect.right) { return { transform: `translateX( ${distanceBetweenContainerAndTarget * -1}px )` }; } } return {}; }, [rtl, targetElement]); const ariaLevel = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!rootBlockElement) { return 1; } const _ariaLevel = parseInt(rootBlockElement.getAttribute('aria-level'), 10); return _ariaLevel ? _ariaLevel + 1 : 1; }, [rootBlockElement]); const hasAdjacentSelectedBranch = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!targetElement) { return false; } return targetElement.classList.contains('is-branch-selected'); }, [targetElement]); const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { const isValidDropPosition = dropPosition === 'top' || dropPosition === 'bottom' || dropPosition === 'inside'; if (!targetElement || !isValidDropPosition) { return undefined; } return { contextElement: targetElement, getBoundingClientRect() { const rect = targetElement.getBoundingClientRect(); // In RTL languages, the drop indicator should be positioned // to the left of the target element, with the width of the // indicator determining the indent at the right edge of the // target element. In LTR languages, the drop indicator should // end at the right edge of the target element, with the indent // added to the position of the left edge of the target element. // let left = rtl ? rect.left : rect.left + indent; let left = rect.left; let top = 0; // In deeply nested lists, where a scrollbar is present, // the width of the drop indicator should be the width of // the visible area of the scroll container. Additionally, // the left edge of the drop indicator line needs to be // offset by the distance the left edge of the target element // and the left edge of the scroll container. The ensures // that the drop indicator position never breaks out of the // visible area of the scroll container. const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(targetElement, 'horizontal'); const doc = targetElement.ownerDocument; const windowScroll = scrollContainer === doc.body || scrollContainer === doc.documentElement; // If the scroll container is not the window, offset the left position, if need be. if (scrollContainer && !windowScroll) { const scrollContainerRect = scrollContainer.getBoundingClientRect(); // In RTL languages, a vertical scrollbar is present on the // left edge of the scroll container. The width of the // scrollbar needs to be accounted for when positioning the // drop indicator. const scrollbarWidth = rtl ? scrollContainer.offsetWidth - scrollContainer.clientWidth : 0; if (left < scrollContainerRect.left + scrollbarWidth) { left = scrollContainerRect.left + scrollbarWidth; } } if (dropPosition === 'top') { top = rect.top - rect.height * 2; } else { // `dropPosition` is either `bottom` or `inside` top = rect.top; } const width = getDropIndicatorWidth(rect, 0); const height = rect.height; return new window.DOMRect(left, top, width, height); } }; }, [targetElement, dropPosition, getDropIndicatorWidth, rtl]); if (!targetElement) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { animate: false, anchor: popoverAnchor, focusOnMount: false, className: "block-editor-list-view-drop-indicator--preview", variant: "unstyled", flip: false, resize: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: style, className: dist_clsx('block-editor-list-view-drop-indicator__line', { 'block-editor-list-view-drop-indicator__line--darker': hasAdjacentSelectedBranch }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-list-view-leaf", "aria-level": ariaLevel, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('block-editor-list-view-block-select-button', 'block-editor-list-view-block-contents'), style: horizontalScrollOffsetStyle, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { onClick: () => {} }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: blockInformation?.icon, showColors: true, context: "list-view" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", className: "block-editor-list-view-block-select-button__label-wrapper", justify: "flex-start", spacing: 1, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__title", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { ellipsizeMode: "auto", children: blockTitle }) }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-list-view-block__menu-cell" })] }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-block-selection.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBlockSelection() { const { clearSelectedBlock, multiSelect, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getBlockName, getBlockParents, getBlockSelectionStart, getSelectedBlockClientIds, hasMultiSelection, hasSelectedBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const updateBlockSelection = (0,external_wp_element_namespaceObject.useCallback)(async (event, clientId, destinationClientId, focusPosition) => { if (!event?.shiftKey && event?.keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) { selectBlock(clientId, focusPosition); return; } // To handle multiple block selection via the `SHIFT` key, prevent // the browser default behavior of opening the link in a new window. event.preventDefault(); const isOnlyDeselection = event.type === 'keydown' && event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE; const isKeyPress = event.type === 'keydown' && (event.keyCode === external_wp_keycodes_namespaceObject.UP || event.keyCode === external_wp_keycodes_namespaceObject.DOWN || event.keyCode === external_wp_keycodes_namespaceObject.HOME || event.keyCode === external_wp_keycodes_namespaceObject.END); // Handle clicking on a block when no blocks are selected, and return early. if (!isKeyPress && !hasSelectedBlock() && !hasMultiSelection()) { selectBlock(clientId, null); return; } const selectedBlocks = getSelectedBlockClientIds(); const clientIdWithParents = [...getBlockParents(clientId), clientId]; if (isOnlyDeselection || isKeyPress && !selectedBlocks.some(blockId => clientIdWithParents.includes(blockId))) { // Ensure that shift-selecting blocks via the keyboard only // expands the current selection if focusing over already // selected blocks. Otherwise, clear the selection so that // a user can create a new selection entirely by keyboard. await clearSelectedBlock(); } // Update selection, if not only clearing the selection. if (!isOnlyDeselection) { let startTarget = getBlockSelectionStart(); let endTarget = clientId; // Handle keyboard behavior for selecting multiple blocks. if (isKeyPress) { if (!hasSelectedBlock() && !hasMultiSelection()) { // Set the starting point of the selection to the currently // focused block, if there are no blocks currently selected. // This ensures that as the selection is expanded or contracted, // the starting point of the selection is anchored to that block. startTarget = clientId; } if (destinationClientId) { // If the user presses UP or DOWN, we want to ensure that the block they're // moving to is the target for selection, and not the currently focused one. endTarget = destinationClientId; } } const startParents = getBlockParents(startTarget); const endParents = getBlockParents(endTarget); const { start, end } = getCommonDepthClientIds(startTarget, endTarget, startParents, endParents); await multiSelect(start, end, null); } // Announce deselected block, or number of deselected blocks if // the total number of blocks deselected is greater than one. const updatedSelectedBlocks = getSelectedBlockClientIds(); // If the selection is greater than 1 and the Home or End keys // were used to generate the selection, then skip announcing the // deselected blocks. if ((event.keyCode === external_wp_keycodes_namespaceObject.HOME || event.keyCode === external_wp_keycodes_namespaceObject.END) && updatedSelectedBlocks.length > 1) { return; } const selectionDiff = selectedBlocks.filter(blockId => !updatedSelectedBlocks.includes(blockId)); let label; if (selectionDiff.length === 1) { const title = getBlockType(getBlockName(selectionDiff[0]))?.title; if (title) { label = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('%s deselected.'), title); } } else if (selectionDiff.length > 1) { label = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: number of deselected blocks */ (0,external_wp_i18n_namespaceObject.__)('%s blocks deselected.'), selectionDiff.length); } if (label) { (0,external_wp_a11y_namespaceObject.speak)(label, 'assertive'); } }, [clearSelectedBlock, getBlockName, getBlockType, getBlockParents, getBlockSelectionStart, getSelectedBlockClientIds, hasMultiSelection, hasSelectedBlock, multiSelect, selectBlock]); return { updateBlockSelection }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-block-indexes.js /** * WordPress dependencies */ function useListViewBlockIndexes(blocks) { const blockIndexes = (0,external_wp_element_namespaceObject.useMemo)(() => { const indexes = {}; let currentGlobalIndex = 0; const traverseBlocks = blockList => { blockList.forEach(block => { indexes[block.clientId] = currentGlobalIndex; currentGlobalIndex++; if (block.innerBlocks.length > 0) { traverseBlocks(block.innerBlocks); } }); }; traverseBlocks(blocks); return indexes; }, [blocks]); return blockIndexes; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-client-ids.js /** * WordPress dependencies */ /** * Internal dependencies */ function useListViewClientIds({ blocks, rootClientId }) { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getDraggedBlockClientIds, getSelectedBlockClientIds, getEnabledClientIdsTree } = unlock(select(store)); return { selectedClientIds: getSelectedBlockClientIds(), draggedClientIds: getDraggedBlockClientIds(), clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getEnabledClientIdsTree(rootClientId) }; }, [blocks, rootClientId]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-collapse-items.js /** * WordPress dependencies */ /** * Internal dependencies */ function useListViewCollapseItems({ collapseAll, expand }) { const { expandedBlock, getBlockParents } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockParents: _getBlockParents, getExpandedBlock } = unlock(select(store)); return { expandedBlock: getExpandedBlock(), getBlockParents: _getBlockParents }; }, []); // Collapse all but the specified block when the expanded block client Id changes. (0,external_wp_element_namespaceObject.useEffect)(() => { if (expandedBlock) { const blockParents = getBlockParents(expandedBlock, false); // Collapse all blocks and expand the block's parents. collapseAll(); expand(blockParents); } }, [collapseAll, expand, expandedBlock, getBlockParents]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-drop-zone.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('../../utils/math').WPPoint} WPPoint */ /** * The type of a drag event. * * @typedef {'default'|'file'|'html'} WPDragEventType */ /** * An object representing data for blocks in the DOM used by drag and drop. * * @typedef {Object} WPListViewDropZoneBlock * @property {string} clientId The client id for the block. * @property {string} rootClientId The root client id for the block. * @property {number} blockIndex The block's index. * @property {Element} element The DOM element representing the block. * @property {number} innerBlockCount The number of inner blocks the block has. * @property {boolean} isDraggedBlock Whether the block is currently being dragged. * @property {boolean} isExpanded Whether the block is expanded in the UI. * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block. * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block. */ /** * An array representing data for blocks in the DOM used by drag and drop. * * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks */ /** * An object containing details of a drop target. * * @typedef {Object} WPListViewDropZoneTarget * @property {string} blockIndex The insertion index. * @property {string} rootClientId The root client id for the block. * @property {string|undefined} clientId The client id for the block. * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to. * 'inside' refers to nesting as an inner block. */ // When the indentation level, the corresponding left margin in `style.scss` // must be updated as well to ensure the drop zone is aligned with the indentation. const NESTING_LEVEL_INDENTATION = 24; /** * Determines whether the user is positioning the dragged block to be * moved up to a parent level. * * Determined based on nesting level indentation of the current block. * * @param {WPPoint} point The point representing the cursor position when dragging. * @param {DOMRect} rect The rectangle. * @param {number} nestingLevel The nesting level of the block. * @param {boolean} rtl Whether the editor is in RTL mode. * @return {boolean} Whether the gesture is an upward gesture. */ function isUpGesture(point, rect, nestingLevel = 1, rtl = false) { // If the block is nested, and the user is dragging to the bottom // left of the block (or bottom right in RTL languages), then it is an upward gesture. const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION; return rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition; } /** * Returns how many nesting levels up the user is attempting to drag to. * * The relative parent level is calculated based on how far * the cursor is from the provided nesting level (e.g. of a candidate block * that the user is hovering over). The nesting level is considered "desired" * because it is not guaranteed that the user will be able to drag to the desired level. * * The returned integer can be used to access an ascending array * of parent blocks, where the first item is the block the user * is hovering over, and the last item is the root block. * * @param {WPPoint} point The point representing the cursor position when dragging. * @param {DOMRect} rect The rectangle. * @param {number} nestingLevel The nesting level of the block. * @param {boolean} rtl Whether the editor is in RTL mode. * @return {number} The desired relative parent level. */ function getDesiredRelativeParentLevel(point, rect, nestingLevel = 1, rtl = false) { // In RTL languages, the block indent position is from the right edge of the block. // In LTR languages, the block indent position is from the left edge of the block. const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION; const distanceBetweenPointAndBlockIndentPosition = rtl ? blockIndentPosition - point.x : point.x - blockIndentPosition; const desiredParentLevel = Math.round(distanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION); return Math.abs(desiredParentLevel); } /** * Returns an array of the parent blocks of the block the user is dropping to. * * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to. * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view. * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to. */ function getCandidateBlockParents(candidateBlockData, blocksData) { const candidateBlockParents = []; let currentBlockData = candidateBlockData; while (currentBlockData) { candidateBlockParents.push({ ...currentBlockData }); currentBlockData = blocksData.find(blockData => blockData.clientId === currentBlockData.rootClientId); } return candidateBlockParents; } /** * Given a list of blocks data and a block index, return the next non-dragged * block. This is used to determine the block that the user is dropping to, * while ignoring the dragged block. * * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view. * @param {number} index The index to begin searching from. * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block. */ function getNextNonDraggedBlock(blocksData, index) { const nextBlockData = blocksData[index + 1]; if (nextBlockData && nextBlockData.isDraggedBlock) { return getNextNonDraggedBlock(blocksData, index + 1); } return nextBlockData; } /** * Determines whether the user positioning the dragged block to nest as an * inner block. * * Determined based on nesting level indentation of the current block, plus * the indentation of the next level of nesting. The vertical position of the * cursor must also be within the block. * * @param {WPPoint} point The point representing the cursor position when dragging. * @param {DOMRect} rect The rectangle. * @param {number} nestingLevel The nesting level of the block. * @param {boolean} rtl Whether the editor is in RTL mode. */ function isNestingGesture(point, rect, nestingLevel = 1, rtl = false) { const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION; const isNestingHorizontalGesture = rtl ? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION : point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION; return isNestingHorizontalGesture && point.y < rect.bottom; } // Block navigation is always a vertical list, so only allow dropping // to the above or below a block. const ALLOWED_DROP_EDGES = ['top', 'bottom']; /** * Given blocks data and the cursor position, compute the drop target. * * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view. * @param {WPPoint} position The point representing the cursor position when dragging. * @param {boolean} rtl Whether the editor is in RTL mode. * * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target. */ function getListViewDropTarget(blocksData, position, rtl = false) { let candidateEdge; let candidateBlockData; let candidateDistance; let candidateRect; let candidateBlockIndex; for (let i = 0; i < blocksData.length; i++) { const blockData = blocksData[i]; if (blockData.isDraggedBlock) { continue; } const rect = blockData.element.getBoundingClientRect(); const [distance, edge] = getDistanceToNearestEdge(position, rect, ALLOWED_DROP_EDGES); const isCursorWithinBlock = isPointContainedByRect(position, rect); if (candidateDistance === undefined || distance < candidateDistance || isCursorWithinBlock) { candidateDistance = distance; const index = blocksData.indexOf(blockData); const previousBlockData = blocksData[index - 1]; // If dragging near the top of a block and the preceding block // is at the same level, use the preceding block as the candidate // instead, as later it makes determining a nesting drop easier. if (edge === 'top' && previousBlockData && previousBlockData.rootClientId === blockData.rootClientId && !previousBlockData.isDraggedBlock) { candidateBlockData = previousBlockData; candidateEdge = 'bottom'; candidateRect = previousBlockData.element.getBoundingClientRect(); candidateBlockIndex = index - 1; } else { candidateBlockData = blockData; candidateEdge = edge; candidateRect = rect; candidateBlockIndex = index; } // If the mouse position is within the block, break early // as the user would intend to drop either before or after // this block. // // This solves an issue where some rows in the list view // tree overlap slightly due to sub-pixel rendering. if (isCursorWithinBlock) { break; } } } if (!candidateBlockData) { return; } const candidateBlockParents = getCandidateBlockParents(candidateBlockData, blocksData); const isDraggingBelow = candidateEdge === 'bottom'; // If the user is dragging towards the bottom of the block check whether // they might be trying to nest the block as a child. // If the block already has inner blocks, and is expanded, this should be treated // as nesting since the next block in the tree will be the first child. // However, if the block is collapsed, dragging beneath the block should // still be allowed, as the next visible block in the tree will be a sibling. if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 && candidateBlockData.isExpanded || isNestingGesture(position, candidateRect, candidateBlockParents.length, rtl))) { // If the block is expanded, insert the block as the first child. // Otherwise, for collapsed blocks, insert the block as the last child. const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0; return { rootClientId: candidateBlockData.clientId, clientId: candidateBlockData.clientId, blockIndex: newBlockIndex, dropPosition: 'inside' }; } // If the user is dragging towards the bottom of the block check whether // they might be trying to move the block to be at a parent level. if (isDraggingBelow && candidateBlockData.rootClientId && isUpGesture(position, candidateRect, candidateBlockParents.length, rtl)) { const nextBlock = getNextNonDraggedBlock(blocksData, candidateBlockIndex); const currentLevel = candidateBlockData.nestingLevel; const nextLevel = nextBlock ? nextBlock.nestingLevel : 1; if (currentLevel && nextLevel) { // Determine the desired relative level of the block to be dropped. const desiredRelativeLevel = getDesiredRelativeParentLevel(position, candidateRect, candidateBlockParents.length, rtl); const targetParentIndex = Math.max(Math.min(desiredRelativeLevel, currentLevel - nextLevel), 0); if (candidateBlockParents[targetParentIndex]) { // Default to the block index of the candidate block. let newBlockIndex = candidateBlockData.blockIndex; // If the next block is at the same level, use that as the default // block index. This ensures that the block is dropped in the correct // position when dragging to the bottom of a block. if (candidateBlockParents[targetParentIndex].nestingLevel === nextBlock?.nestingLevel) { newBlockIndex = nextBlock?.blockIndex; } else { // Otherwise, search from the current block index back // to find the last block index within the same target parent. for (let i = candidateBlockIndex; i >= 0; i--) { const blockData = blocksData[i]; if (blockData.rootClientId === candidateBlockParents[targetParentIndex].rootClientId) { newBlockIndex = blockData.blockIndex + 1; break; } } } return { rootClientId: candidateBlockParents[targetParentIndex].rootClientId, clientId: candidateBlockData.clientId, blockIndex: newBlockIndex, dropPosition: candidateEdge }; } } } // If dropping as a sibling, but block cannot be inserted in // this context, return early. if (!candidateBlockData.canInsertDraggedBlocksAsSibling) { return; } const offset = isDraggingBelow ? 1 : 0; return { rootClientId: candidateBlockData.rootClientId, clientId: candidateBlockData.clientId, blockIndex: candidateBlockData.blockIndex + offset, dropPosition: candidateEdge }; } // Throttle options need to be defined outside of the hook to avoid // re-creating the object on every render. This is due to a limitation // of the `useThrottle` hook, where the options object is included // in the dependency array for memoization. const EXPAND_THROTTLE_OPTIONS = { leading: false, // Don't call the function immediately on the first call. trailing: true // Do call the function on the last call. }; /** * A react hook for implementing a drop zone in list view. * * @param {Object} props Named parameters. * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone. * @param {Object} [props.expandedState] The expanded state of the blocks in the list view. * @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds. * * @return {WPListViewDropZoneTarget} The drop target. */ function useListViewDropZone({ dropZoneElement, expandedState, setExpandedState }) { const { getBlockRootClientId, getBlockIndex, getBlockCount, getDraggedBlockClientIds, canInsertBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); const [target, setTarget] = (0,external_wp_element_namespaceObject.useState)(); const { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } = target || {}; const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex); const rtl = (0,external_wp_i18n_namespaceObject.isRTL)(); const previousRootClientId = (0,external_wp_compose_namespaceObject.usePrevious)(targetRootClientId); const maybeExpandBlock = (0,external_wp_element_namespaceObject.useCallback)((_expandedState, _target) => { // If the user is attempting to drop a block inside a collapsed block, // that is, using a nesting gesture flagged by 'inside' dropPosition, // expand the block within the list view, if it isn't already. const { rootClientId } = _target || {}; if (!rootClientId) { return; } if (_target?.dropPosition === 'inside' && !_expandedState[rootClientId]) { setExpandedState({ type: 'expand', clientIds: [rootClientId] }); } }, [setExpandedState]); // Throttle the maybeExpandBlock function to avoid expanding the block // too quickly when the user is dragging over the block. This is to // avoid expanding the block when the user is just passing over it. const throttledMaybeExpandBlock = (0,external_wp_compose_namespaceObject.useThrottle)(maybeExpandBlock, 500, EXPAND_THROTTLE_OPTIONS); (0,external_wp_element_namespaceObject.useEffect)(() => { if (target?.dropPosition !== 'inside' || previousRootClientId !== target?.rootClientId) { throttledMaybeExpandBlock.cancel(); return; } throttledMaybeExpandBlock(expandedState, target); }, [expandedState, previousRootClientId, target, throttledMaybeExpandBlock]); const draggedBlockClientIds = getDraggedBlockClientIds(); const throttled = (0,external_wp_compose_namespaceObject.useThrottle)((0,external_wp_element_namespaceObject.useCallback)((event, currentTarget) => { const position = { x: event.clientX, y: event.clientY }; const isBlockDrag = !!draggedBlockClientIds?.length; const blockElements = Array.from(currentTarget.querySelectorAll('[data-block]')); const blocksData = blockElements.map(blockElement => { const clientId = blockElement.dataset.block; const isExpanded = blockElement.dataset.expanded === 'true'; const isDraggedBlock = blockElement.classList.contains('is-dragging'); // Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`. const nestingLevel = parseInt(blockElement.getAttribute('aria-level'), 10); const rootClientId = getBlockRootClientId(clientId); return { clientId, isExpanded, rootClientId, blockIndex: getBlockIndex(clientId), element: blockElement, nestingLevel: nestingLevel || undefined, isDraggedBlock: isBlockDrag ? isDraggedBlock : false, innerBlockCount: getBlockCount(clientId), canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, rootClientId) : true, canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true }; }); const newTarget = getListViewDropTarget(blocksData, position, rtl); if (newTarget) { setTarget(newTarget); } }, [canInsertBlocks, draggedBlockClientIds, getBlockCount, getBlockIndex, getBlockRootClientId, rtl]), 50); const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ dropZoneElement, onDrop(event) { throttled.cancel(); if (target) { onBlockDrop(event); } // Use `undefined` value to indicate that the drag has concluded. // This allows styling rules that are active only when a user is // dragging to be removed. setTarget(undefined); }, onDragLeave() { throttled.cancel(); // Use `null` value to indicate that the drop target is not valid, // but that the drag is still active. This allows for styling rules // that are active only when a user drags outside of the list view. setTarget(null); }, onDragOver(event) { // `currentTarget` is only available while the event is being // handled, so get it now and pass it to the thottled function. // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget throttled(event, event.currentTarget); }, onDragEnd() { throttled.cancel(); // Use `undefined` value to indicate that the drag has concluded. // This allows styling rules that are active only when a user is // dragging to be removed. setTarget(undefined); } }); return { ref, target }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-expand-selected-item.js /** * WordPress dependencies */ /** * Internal dependencies */ function useListViewExpandSelectedItem({ firstSelectedBlockClientId, setExpandedState }) { const [selectedTreeId, setSelectedTreeId] = (0,external_wp_element_namespaceObject.useState)(null); const { selectedBlockParentClientIds } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockParents } = select(store); return { selectedBlockParentClientIds: getBlockParents(firstSelectedBlockClientId, false) }; }, [firstSelectedBlockClientId]); // Expand tree when a block is selected. (0,external_wp_element_namespaceObject.useEffect)(() => { // If the selectedTreeId is the same as the selected block, // it means that the block was selected using the block list tree. if (selectedTreeId === firstSelectedBlockClientId) { return; } // If the selected block has parents, get the top-level parent. if (selectedBlockParentClientIds?.length) { // If the selected block has parents, // expand the tree branch. setExpandedState({ type: 'expand', clientIds: selectedBlockParentClientIds }); } }, [firstSelectedBlockClientId, selectedBlockParentClientIds, selectedTreeId, setExpandedState]); return { setSelectedTreeId }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-clipboard-handler.js /** * WordPress dependencies */ /** * Internal dependencies */ // This hook borrows from useClipboardHandler in ../writing-flow/use-clipboard-handler.js // and adds behaviour for the list view, while skipping partial selection. function use_clipboard_handler_useClipboardHandler({ selectBlock }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { getBlockOrder, getBlockRootClientId, getBlocksByClientId, getPreviousBlockClientId, getSelectedBlockClientIds, getSettings, canInsertBlockType, canRemoveBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); const { flashBlock, removeBlocks, replaceBlocks, insertBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const notifyCopy = useNotifyCopy(); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function updateFocusAndSelection(focusClientId, shouldSelectBlock) { if (shouldSelectBlock) { selectBlock(undefined, focusClientId, null, null); } focusListItem(focusClientId, node); } // Determine which blocks to update: // If the current (focused) block is part of the block selection, use the whole selection. // If the focused block is not part of the block selection, only update the focused block. function getBlocksToUpdate(clientId) { const selectedBlockClientIds = getSelectedBlockClientIds(); const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId); const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId; const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId); const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId]; return { blocksToUpdate, firstBlockClientId, firstBlockRootClientId, originallySelectedBlockClientIds: selectedBlockClientIds }; } function handler(event) { if (event.defaultPrevented) { // This was possibly already handled in rich-text/use-paste-handler.js. return; } // Only handle events that occur within the list view. if (!node.contains(event.target.ownerDocument.activeElement)) { return; } // Retrieve the block clientId associated with the focused list view row. // This enables applying copy / cut / paste behavior to the focused block, // rather than just the blocks that are currently selected. const listViewRow = event.target.ownerDocument.activeElement?.closest('[role=row]'); const clientId = listViewRow?.dataset?.block; if (!clientId) { return; } const { blocksToUpdate: selectedBlockClientIds, firstBlockClientId, firstBlockRootClientId, originallySelectedBlockClientIds } = getBlocksToUpdate(clientId); if (selectedBlockClientIds.length === 0) { return; } event.preventDefault(); if (event.type === 'copy' || event.type === 'cut') { if (selectedBlockClientIds.length === 1) { flashBlock(selectedBlockClientIds[0]); } notifyCopy(event.type, selectedBlockClientIds); const blocks = getBlocksByClientId(selectedBlockClientIds); setClipboardBlocks(event, blocks, registry); } if (event.type === 'cut') { var _getPreviousBlockClie; // Don't update the selection if the blocks cannot be deleted. if (!canRemoveBlocks(selectedBlockClientIds)) { return; } let blockToFocus = (_getPreviousBlockClie = getPreviousBlockClientId(firstBlockClientId)) !== null && _getPreviousBlockClie !== void 0 ? _getPreviousBlockClie : // If the previous block is not found (when the first block is deleted), // fallback to focus the parent block. firstBlockRootClientId; // Remove blocks, but don't update selection, and it will be handled below. removeBlocks(selectedBlockClientIds, false); // Update the selection if the original selection has been removed. const shouldUpdateSelection = originallySelectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0; // If there's no previous block nor parent block, focus the first block. if (!blockToFocus) { blockToFocus = getBlockOrder()[0]; } updateFocusAndSelection(blockToFocus, shouldUpdateSelection); } else if (event.type === 'paste') { const { __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML } = getSettings(); const blocks = getPasteBlocks(event, canUserUseUnfilteredHTML); if (selectedBlockClientIds.length === 1) { const [selectedBlockClientId] = selectedBlockClientIds; // If a single block is focused, and the blocks to be posted can // be inserted within the block, then append the pasted blocks // within the focused block. For example, if you have copied a paragraph // block and paste it within a single Group block, this will append // the paragraph block within the Group block. if (blocks.every(block => canInsertBlockType(block.name, selectedBlockClientId))) { insertBlocks(blocks, undefined, selectedBlockClientId); updateFocusAndSelection(blocks[0]?.clientId, false); return; } } replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1); updateFocusAndSelection(blocks[0]?.clientId, false); } } node.ownerDocument.addEventListener('copy', handler); node.ownerDocument.addEventListener('cut', handler); node.ownerDocument.addEventListener('paste', handler); return () => { node.ownerDocument.removeEventListener('copy', handler); node.ownerDocument.removeEventListener('cut', handler); node.ownerDocument.removeEventListener('paste', handler); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const expanded = (state, action) => { if (action.type === 'clear') { return {}; } if (Array.isArray(action.clientIds)) { return { ...state, ...action.clientIds.reduce((newState, id) => ({ ...newState, [id]: action.type === 'expand' }), {}) }; } return state; }; const BLOCK_LIST_ITEM_HEIGHT = 32; /** @typedef {import('react').ComponentType} ComponentType */ /** @typedef {import('react').Ref<HTMLElement>} Ref */ /** * Show a hierarchical list of blocks. * * @param {Object} props Components props. * @param {string} props.id An HTML element id for the root element of ListView. * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy. * @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone. * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`. * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`. * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`. * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component. * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list. * @param {string} props.description Optional accessible description for the tree grid component. * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected. * @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI. * @param {Ref} ref Forwarded ref */ function ListViewComponent({ id, blocks, dropZoneElement, showBlockMovers = false, isExpanded = false, showAppender = false, blockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown, rootClientId, description, onSelect, additionalBlockContent: AdditionalBlockContent }, ref) { // This can be removed once we no longer need to support the blocks prop. if (blocks) { external_wp_deprecated_default()('`blocks` property in `wp.blockEditor.__experimentalListView`', { since: '6.3', alternative: '`rootClientId` property' }); } const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewComponent); const { clientIdsTree, draggedClientIds, selectedClientIds } = useListViewClientIds({ blocks, rootClientId }); const blockIndexes = useListViewBlockIndexes(clientIdsTree); const { getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); const { visibleBlockCount } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getGlobalBlockCount, getClientIdsOfDescendants } = select(store); const draggedBlockCount = draggedClientIds?.length > 0 ? getClientIdsOfDescendants(draggedClientIds).length + 1 : 0; return { visibleBlockCount: getGlobalBlockCount() - draggedBlockCount }; }, [draggedClientIds]); const { updateBlockSelection } = useBlockSelection(); const [expandedState, setExpandedState] = (0,external_wp_element_namespaceObject.useReducer)(expanded, {}); const [insertedBlock, setInsertedBlock] = (0,external_wp_element_namespaceObject.useState)(null); const { setSelectedTreeId } = useListViewExpandSelectedItem({ firstSelectedBlockClientId: selectedClientIds[0], setExpandedState }); const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)( /** * @param {MouseEvent | KeyboardEvent | undefined} event * @param {string} blockClientId * @param {null | undefined | -1 | 1} focusPosition */ (event, blockClientId, focusPosition) => { updateBlockSelection(event, blockClientId, null, focusPosition); setSelectedTreeId(blockClientId); if (onSelect) { onSelect(getBlock(blockClientId)); } }, [setSelectedTreeId, updateBlockSelection, onSelect, getBlock]); const { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone({ dropZoneElement, expandedState, setExpandedState }); const elementRef = (0,external_wp_element_namespaceObject.useRef)(); // Allow handling of copy, cut, and paste events. const clipBoardRef = use_clipboard_handler_useClipboardHandler({ selectBlock: selectEditorBlock }); const treeGridRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([clipBoardRef, elementRef, dropZoneRef, ref]); (0,external_wp_element_namespaceObject.useEffect)(() => { // If a blocks are already selected when the list view is initially // mounted, shift focus to the first selected block. if (selectedClientIds?.length) { focusListItem(selectedClientIds[0], elementRef?.current); } // Only focus on the selected item when the list view is mounted. }, []); const expand = (0,external_wp_element_namespaceObject.useCallback)(clientId => { if (!clientId) { return; } const clientIds = Array.isArray(clientId) ? clientId : [clientId]; setExpandedState({ type: 'expand', clientIds }); }, [setExpandedState]); const collapse = (0,external_wp_element_namespaceObject.useCallback)(clientId => { if (!clientId) { return; } setExpandedState({ type: 'collapse', clientIds: [clientId] }); }, [setExpandedState]); const collapseAll = (0,external_wp_element_namespaceObject.useCallback)(() => { setExpandedState({ type: 'clear' }); }, [setExpandedState]); const expandRow = (0,external_wp_element_namespaceObject.useCallback)(row => { expand(row?.dataset?.block); }, [expand]); const collapseRow = (0,external_wp_element_namespaceObject.useCallback)(row => { collapse(row?.dataset?.block); }, [collapse]); const focusRow = (0,external_wp_element_namespaceObject.useCallback)((event, startRow, endRow) => { if (event.shiftKey) { updateBlockSelection(event, startRow?.dataset?.block, endRow?.dataset?.block); } }, [updateBlockSelection]); useListViewCollapseItems({ collapseAll, expand }); const firstDraggedBlockClientId = draggedClientIds?.[0]; // Convert a blockDropTarget into indexes relative to the blocks in the list view. // These values are used to determine which blocks should be displaced to make room // for the drop indicator. See `ListViewBranch` and `getDragDisplacementValues`. const { blockDropTargetIndex, blockDropPosition, firstDraggedBlockIndex } = (0,external_wp_element_namespaceObject.useMemo)(() => { let _blockDropTargetIndex, _firstDraggedBlockIndex; if (blockDropTarget?.clientId) { const foundBlockIndex = blockIndexes[blockDropTarget.clientId]; // If dragging below or inside the block, treat the drop target as the next block. _blockDropTargetIndex = foundBlockIndex === undefined || blockDropTarget?.dropPosition === 'top' ? foundBlockIndex : foundBlockIndex + 1; } else if (blockDropTarget === null) { // A `null` value is used to indicate that the user is dragging outside of the list view. _blockDropTargetIndex = null; } if (firstDraggedBlockClientId) { const foundBlockIndex = blockIndexes[firstDraggedBlockClientId]; _firstDraggedBlockIndex = foundBlockIndex === undefined || blockDropTarget?.dropPosition === 'top' ? foundBlockIndex : foundBlockIndex + 1; } return { blockDropTargetIndex: _blockDropTargetIndex, blockDropPosition: blockDropTarget?.dropPosition, firstDraggedBlockIndex: _firstDraggedBlockIndex }; }, [blockDropTarget, blockIndexes, firstDraggedBlockClientId]); const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ blockDropPosition, blockDropTargetIndex, blockIndexes, draggedClientIds, expandedState, expand, firstDraggedBlockIndex, collapse, collapseAll, BlockSettingsMenu, listViewInstanceId: instanceId, AdditionalBlockContent, insertedBlock, setInsertedBlock, treeGridElementRef: elementRef, rootClientId }), [blockDropPosition, blockDropTargetIndex, blockIndexes, draggedClientIds, expandedState, expand, firstDraggedBlockIndex, collapse, collapseAll, BlockSettingsMenu, instanceId, AdditionalBlockContent, insertedBlock, setInsertedBlock, rootClientId]); // List View renders a fixed number of items and relies on each having a fixed item height of 36px. // If this value changes, we should also change the itemHeight value set in useFixedWindowList. // See: https://github.com/WordPress/gutenberg/pull/35230 for additional context. const [fixedListWindow] = (0,external_wp_compose_namespaceObject.__experimentalUseFixedWindowList)(elementRef, BLOCK_LIST_ITEM_HEIGHT, visibleBlockCount, { // Ensure that the windowing logic is recalculated when the expanded state changes. // This is necessary because expanding a collapsed block in a short list view can // switch the list view to a tall list view with a scrollbar, and vice versa. // When this happens, the windowing logic needs to be recalculated to ensure that // the correct number of blocks are rendered, by rechecking for a scroll container. expandedState, useWindowing: true, windowOverscan: 40 }); // If there are no blocks to show and we're not showing the appender, do not render the list view. if (!clientIdsTree.length && !showAppender) { return null; } const describedById = description && `block-editor-list-view-description-${instanceId}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { value: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewDropIndicatorPreview, { draggedBlockClientId: firstDraggedBlockClientId, listViewRef: elementRef, blockDropTarget: blockDropTarget }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: describedById, children: description }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGrid, { id: id, className: dist_clsx('block-editor-list-view-tree', { 'is-dragging': draggedClientIds?.length > 0 && blockDropTargetIndex !== undefined }), "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block navigation structure'), ref: treeGridRef, onCollapseRow: collapseRow, onExpandRow: expandRow, onFocusRow: focusRow, applicationAriaLabel: (0,external_wp_i18n_namespaceObject.__)('Block navigation structure'), "aria-describedby": describedById, style: { '--wp-admin--list-view-dragged-items-height': draggedClientIds?.length ? `${BLOCK_LIST_ITEM_HEIGHT * (draggedClientIds.length - 1)}px` : null }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewContext.Provider, { value: contextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(branch, { blocks: clientIdsTree, parentId: rootClientId, selectBlock: selectEditorBlock, showBlockMovers: showBlockMovers, fixedListWindow: fixedListWindow, selectedClientIds: selectedClientIds, isExpanded: isExpanded, showAppender: showAppender }) }) })] }); } // This is the private API for the ListView component. // It allows access to all props, not just the public ones. const PrivateListView = (0,external_wp_element_namespaceObject.forwardRef)(ListViewComponent); // This is the public API for the ListView component. // We wrap the PrivateListView component to hide some props from the public API. /* harmony default export */ const components_list_view = ((0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateListView, { ref: ref, ...props, showAppender: false, rootClientId: null, onSelect: null, additionalBlockContent: null, blockSettingsMenu: undefined }); })); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js /** * WordPress dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockNavigationDropdownToggle({ isEnabled, onToggle, isOpen, innerRef, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...props, ref: innerRef, icon: list_view, "aria-expanded": isOpen, "aria-haspopup": "true", onClick: isEnabled ? onToggle : undefined /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('List view'), className: "block-editor-block-navigation", "aria-disabled": !isEnabled }); } function BlockNavigationDropdown({ isDisabled, ...props }, ref) { external_wp_deprecated_default()('wp.blockEditor.BlockNavigationDropdown', { since: '6.1', alternative: 'wp.components.Dropdown and wp.blockEditor.ListView' }); const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).getBlockCount(), []); const isEnabled = hasBlocks && !isDisabled; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { contentClassName: "block-editor-block-navigation__popover", popoverProps: { placement: 'bottom-start' }, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockNavigationDropdownToggle, { ...props, innerRef: ref, isOpen: isOpen, onToggle: onToggle, isEnabled: isEnabled }), renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-navigation__container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-navigation__label", children: (0,external_wp_i18n_namespaceObject.__)('List view') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_list_view, {})] }) }); } /* harmony default export */ const dropdown = ((0,external_wp_element_namespaceObject.forwardRef)(BlockNavigationDropdown)); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/preview-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockStylesPreviewPanel({ genericPreviewBlock, style, className, activeStyle }) { const example = (0,external_wp_blocks_namespaceObject.getBlockType)(genericPreviewBlock.name)?.example; const styleClassName = replaceActiveStyle(className, activeStyle, style); const previewBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { return { ...genericPreviewBlock, title: style.label || style.name, description: style.description, initialAttributes: { ...genericPreviewBlock.attributes, className: styleClassName + ' block-editor-block-styles__block-preview-container' }, example }; }, [genericPreviewBlock, styleClassName]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel, { item: previewBlocks }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const block_styles_noop = () => {}; // Block Styles component for the Settings Sidebar. function BlockStyles({ clientId, onSwitch = block_styles_noop, onHoverClassName = block_styles_noop }) { const { onSelect, stylesToRender, activeStyle, genericPreviewBlock, className: previewClassName } = useStylesForBlocks({ clientId, onSwitch }); const [hoveredStyle, setHoveredStyle] = (0,external_wp_element_namespaceObject.useState)(null); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); if (!stylesToRender || stylesToRender.length === 0) { return null; } const debouncedSetHoveredStyle = (0,external_wp_compose_namespaceObject.debounce)(setHoveredStyle, 250); const onSelectStylePreview = style => { onSelect(style); onHoverClassName(null); setHoveredStyle(null); debouncedSetHoveredStyle.cancel(); }; const styleItemHandler = item => { var _item$name; if (hoveredStyle === item) { debouncedSetHoveredStyle.cancel(); return; } debouncedSetHoveredStyle(item); onHoverClassName((_item$name = item?.name) !== null && _item$name !== void 0 ? _item$name : null); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-styles", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-styles__variants", children: stylesToRender.map(style => { const buttonText = style.label || style.name; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: dist_clsx('block-editor-block-styles__item', { 'is-active': activeStyle.name === style.name }), variant: "secondary", label: buttonText, onMouseEnter: () => styleItemHandler(style), onFocus: () => styleItemHandler(style), onMouseLeave: () => styleItemHandler(null), onBlur: () => styleItemHandler(null), onClick: () => onSelectStylePreview(style), "aria-current": activeStyle.name === style.name, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, className: "block-editor-block-styles__item-text", children: buttonText }) }, style.name); }) }), hoveredStyle && !isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { placement: "left-start", offset: 34, focusOnMount: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-styles__preview-panel", onMouseLeave: () => styleItemHandler(null), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesPreviewPanel, { activeStyle: activeStyle, className: previewClassName, genericPreviewBlock: genericPreviewBlock, style: hoveredStyle }) }) })] }); } /* harmony default export */ const block_styles = (BlockStyles); ;// ./node_modules/@wordpress/icons/build-module/library/paragraph.js /** * WordPress dependencies */ const paragraph = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z" }) }); /* harmony default export */ const library_paragraph = (paragraph); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-1.js /** * WordPress dependencies */ const headingLevel1 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.6 7c-.6.9-1.5 1.7-2.6 2v1h2v7h2V7h-1.4zM11 11H7V7H5v10h2v-4h4v4h2V7h-2v4z" }) }); /* harmony default export */ const heading_level_1 = (headingLevel1); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-2.js /** * WordPress dependencies */ const headingLevel2 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 11.1H5v-4H3v10h2v-4h4v4h2v-10H9v4zm8 4c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6v1.5h8v-2H17z" }) }); /* harmony default export */ const heading_level_2 = (headingLevel2); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-3.js /** * WordPress dependencies */ const headingLevel3 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z" }) }); /* harmony default export */ const heading_level_3 = (headingLevel3); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-4.js /** * WordPress dependencies */ const headingLevel4 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z" }) }); /* harmony default export */ const heading_level_4 = (headingLevel4); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-5.js /** * WordPress dependencies */ const headingLevel5 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z" }) }); /* harmony default export */ const heading_level_5 = (headingLevel5); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-6.js /** * WordPress dependencies */ const headingLevel6 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.7 12.4c-.2-.3-.4-.6-.7-.9s-.6-.5-1-.6c-.4-.2-.8-.2-1.2-.2-.5 0-.9.1-1.3.3s-.8.5-1.2.8c0-.5 0-.9.2-1.4l.6-.9c.2-.2.5-.4.8-.5.6-.2 1.3-.2 1.9 0 .3.1.6.3.8.5 0 0 1.3-1.3 1.3-1.4-.4-.3-.9-.6-1.4-.8-.6-.2-1.3-.3-2-.3-.6 0-1.1.1-1.7.4-.5.2-1 .5-1.4.9-.4.4-.8 1-1 1.6-.3.7-.4 1.5-.4 2.3s.1 1.5.3 2.1c.2.6.6 1.1 1 1.5.4.4.9.7 1.4.9 1 .3 2 .3 3 0 .4-.1.8-.3 1.2-.6.3-.3.6-.6.8-1 .2-.5.3-.9.3-1.4s-.1-.9-.3-1.3zm-2 2.1c-.1.2-.3.4-.4.5-.1.1-.3.2-.5.2-.2.1-.4.1-.6.1-.2.1-.5 0-.7-.1-.2 0-.3-.2-.5-.3-.1-.2-.3-.4-.4-.6-.2-.3-.3-.7-.3-1 .3-.3.6-.5 1-.7.3-.1.7-.2 1-.2.4 0 .8.1 1.1.3.3.3.4.7.4 1.1 0 .2 0 .5-.1.7zM9 11H5V7H3v10h2v-4h4v4h2V7H9v4z" }) }); /* harmony default export */ const heading_level_6 = (headingLevel6); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/heading-level-icon.js /** * WordPress dependencies */ /** @typedef {import('react').ComponentType} ComponentType */ /** * HeadingLevelIcon props. * * @typedef WPHeadingLevelIconProps * * @property {number} level The heading level to show an icon for. */ const LEVEL_TO_PATH = { 0: library_paragraph, 1: heading_level_1, 2: heading_level_2, 3: heading_level_3, 4: heading_level_4, 5: heading_level_5, 6: heading_level_6 }; /** * Heading level icon. * * @param {WPHeadingLevelIconProps} props Component props. * * @return {?ComponentType} The icon. */ function HeadingLevelIcon({ level }) { if (LEVEL_TO_PATH[level]) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: LEVEL_TO_PATH[level] }); } return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const HEADING_LEVELS = [1, 2, 3, 4, 5, 6]; const block_heading_level_dropdown_POPOVER_PROPS = { className: 'block-library-heading-level-dropdown' }; /** @typedef {import('react').ComponentType} ComponentType */ /** * HeadingLevelDropdown props. * * @typedef WPHeadingLevelDropdownProps * * @property {number} value The chosen heading level. * @property {number[]} options An array of supported heading levels. * @property {()=>number} onChange Function called with * the selected value changes. */ /** * Dropdown for selecting a heading level (1 through 6) or paragraph (0). * * @param {WPHeadingLevelDropdownProps} props Component props. * * @return {ComponentType} The toolbar. */ function HeadingLevelDropdown({ options = HEADING_LEVELS, value, onChange }) { const validOptions = options.filter(option => option === 0 || HEADING_LEVELS.includes(option)).sort((a, b) => a - b); // Sorts numerically in ascending order; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarDropdownMenu, { popoverProps: block_heading_level_dropdown_POPOVER_PROPS, icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { level: value }), label: (0,external_wp_i18n_namespaceObject.__)('Change level'), controls: validOptions.map(targetLevel => { const isActive = targetLevel === value; return { icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { level: targetLevel }), title: targetLevel === 0 ? (0,external_wp_i18n_namespaceObject.__)('Paragraph') : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: heading level e.g: "1", "2", "3" (0,external_wp_i18n_namespaceObject.__)('Heading %d'), targetLevel), isActive, onClick() { onChange(targetLevel); }, role: 'menuitemradio' }; }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/layout.js /** * WordPress dependencies */ const layout_layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); /* harmony default export */ const library_layout = (layout_layout); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js /** * External dependencies */ /** * WordPress dependencies */ function BlockVariationPicker({ icon = library_layout, label = (0,external_wp_i18n_namespaceObject.__)('Choose variation'), instructions = (0,external_wp_i18n_namespaceObject.__)('Select a variation to start with:'), variations, onSelect, allowSkip }) { const classes = dist_clsx('block-editor-block-variation-picker', { 'has-many-variations': variations.length > 4 }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Placeholder, { icon: icon, label: label, instructions: instructions, className: classes, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "block-editor-block-variation-picker__variations", role: "list", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block variations'), children: variations.map(variation => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", icon: variation.icon && variation.icon.src ? variation.icon.src : variation.icon, iconSize: 48, onClick: () => onSelect(variation), className: "block-editor-block-variation-picker__variation", label: variation.description || variation.title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-variation-picker__variation-label", children: variation.title })] }, variation.name)) }), allowSkip && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-variation-picker__skip", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => onSelect(), children: (0,external_wp_i18n_namespaceObject.__)('Skip') }) })] }); } /* harmony default export */ const block_variation_picker = (BlockVariationPicker); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/constants.js const VIEWMODES = { carousel: 'carousel', grid: 'grid' }; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/setup-toolbar.js /** * WordPress dependencies */ /** * Internal dependencies */ const Actions = ({ onBlockPatternSelect }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__actions", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: onBlockPatternSelect, children: (0,external_wp_i18n_namespaceObject.__)('Choose') }) }); const CarouselNavigation = ({ handlePrevious, handleNext, activeSlide, totalSlides }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__navigation", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, label: (0,external_wp_i18n_namespaceObject.__)('Previous pattern'), onClick: handlePrevious, disabled: activeSlide === 0, accessibleWhenDisabled: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right, label: (0,external_wp_i18n_namespaceObject.__)('Next pattern'), onClick: handleNext, disabled: activeSlide === totalSlides - 1, accessibleWhenDisabled: true })] }); const SetupToolbar = ({ viewMode, setViewMode, handlePrevious, handleNext, activeSlide, totalSlides, onBlockPatternSelect }) => { const isCarouselView = viewMode === VIEWMODES.carousel; const displayControls = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__display-controls", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", icon: stretch_full_width, label: (0,external_wp_i18n_namespaceObject.__)('Carousel view'), onClick: () => setViewMode(VIEWMODES.carousel), isPressed: isCarouselView }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", icon: library_grid, label: (0,external_wp_i18n_namespaceObject.__)('Grid view'), onClick: () => setViewMode(VIEWMODES.grid), isPressed: viewMode === VIEWMODES.grid })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__toolbar", children: [isCarouselView && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CarouselNavigation, { handlePrevious: handlePrevious, handleNext: handleNext, activeSlide: activeSlide, totalSlides: totalSlides }), displayControls, isCarouselView && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Actions, { onBlockPatternSelect: onBlockPatternSelect })] }); }; /* harmony default export */ const setup_toolbar = (SetupToolbar); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/use-patterns-setup.js /** * WordPress dependencies */ /** * Internal dependencies */ function usePatternsSetup(clientId, blockName, filterPatternsFn) { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId, getPatternsByBlockTypes, __experimentalGetAllowedPatterns } = select(store); const rootClientId = getBlockRootClientId(clientId); if (filterPatternsFn) { return __experimentalGetAllowedPatterns(rootClientId).filter(filterPatternsFn); } return getPatternsByBlockTypes(blockName, rootClientId); }, [clientId, blockName, filterPatternsFn]); } /* harmony default export */ const use_patterns_setup = (usePatternsSetup); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const SetupContent = ({ viewMode, activeSlide, patterns, onBlockPatternSelect, showTitles }) => { const containerClass = 'block-editor-block-pattern-setup__container'; if (viewMode === VIEWMODES.carousel) { const slideClass = new Map([[activeSlide, 'active-slide'], [activeSlide - 1, 'previous-slide'], [activeSlide + 1, 'next-slide']]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__carousel", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: containerClass, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "carousel-container", children: patterns.map((pattern, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPatternSlide, { active: index === activeSlide, className: slideClass.get(index) || '', pattern: pattern }, pattern.name)) }) }) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__grid", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { role: "listbox", className: containerClass, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list'), children: patterns.map(pattern => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_pattern_setup_BlockPattern, { pattern: pattern, onSelect: onBlockPatternSelect, showTitles: showTitles }, pattern.name)) }) }); }; function block_pattern_setup_BlockPattern({ pattern, onSelect, showTitles }) { const baseClassName = 'block-editor-block-pattern-setup-list'; const { blocks, description, viewportWidth = 700 } = pattern; const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(block_pattern_setup_BlockPattern, `${baseClassName}__item-description`); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}__list-item`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-describedby": description ? descriptionId : undefined, "aria-label": pattern.title, className: `${baseClassName}__item` }), id: `${baseClassName}__pattern__${pattern.name}`, role: "option", onClick: () => onSelect(blocks), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { blocks: blocks, viewportWidth: viewportWidth }), showTitles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}__item-title`, children: pattern.title }), !!description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description })] }) }); } function BlockPatternSlide({ active, className, pattern, minHeight }) { const { blocks, title, description } = pattern; const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPatternSlide, 'block-editor-block-pattern-setup-list__item-description'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { "aria-hidden": !active, role: "img", className: `pattern-slide ${className}`, "aria-label": title, "aria-describedby": description ? descriptionId : undefined, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { blocks: blocks, minHeight: minHeight }), !!description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description })] }); } const BlockPatternSetup = ({ clientId, blockName, filterPatternsFn, onBlockPatternSelect, initialViewMode = VIEWMODES.carousel, showTitles = false }) => { const [viewMode, setViewMode] = (0,external_wp_element_namespaceObject.useState)(initialViewMode); const [activeSlide, setActiveSlide] = (0,external_wp_element_namespaceObject.useState)(0); const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const patterns = use_patterns_setup(clientId, blockName, filterPatternsFn); if (!patterns?.length) { return null; } const onBlockPatternSelectDefault = blocks => { const clonedBlocks = blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); replaceBlock(clientId, clonedBlocks); }; const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: `block-editor-block-pattern-setup view-mode-${viewMode}`, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SetupContent, { viewMode: viewMode, activeSlide: activeSlide, patterns: patterns, onBlockPatternSelect: onPatternSelectCallback, showTitles: showTitles }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(setup_toolbar, { viewMode: viewMode, setViewMode: setViewMode, activeSlide: activeSlide, totalSlides: patterns.length, handleNext: () => { setActiveSlide(active => Math.min(active + 1, patterns.length - 1)); }, handlePrevious: () => { setActiveSlide(active => Math.max(active - 1, 0)); }, onBlockPatternSelect: () => { onPatternSelectCallback(patterns[activeSlide].blocks); } })] }) }); }; /* harmony default export */ const block_pattern_setup = (BlockPatternSetup); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-variation-transforms/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function VariationsButtons({ className, onSelectVariation, selectedValue, variations }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: className, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Transform to variation') }), variations.map(variation => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, size: "compact", icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: variation.icon, showColors: true }), isPressed: selectedValue === variation.name, label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Block or block variation name. */ (0,external_wp_i18n_namespaceObject.__)('Transform to %s'), variation.title), onClick: () => onSelectVariation(variation.name), "aria-label": variation.title, showTooltip: true }, variation.name))] }); } function VariationsDropdown({ className, onSelectVariation, selectedValue, variations }) { const selectOptions = variations.map(({ name, title, description }) => ({ value: name, label: title, info: description })); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { className: className, label: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'), text: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'), popoverProps: { position: 'bottom center', className: `${className}__popover` }, icon: chevron_down, toggleProps: { iconPosition: 'right' }, children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${className}__container`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { choices: selectOptions, value: selectedValue, onSelect: onSelectVariation }) }) }) }); } function VariationsToggleGroupControl({ className, onSelectVariation, selectedValue, variations }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: className, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { label: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'), value: selectedValue, hideLabelFromVision: true, onChange: onSelectVariation, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, children: variations.map(variation => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: variation.icon, showColors: true }), value: variation.name, label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Block or block variation name. */ (0,external_wp_i18n_namespaceObject.__)('Transform to %s'), variation.title) }, variation.name)) }) }); } function __experimentalBlockVariationTransforms({ blockClientId }) { const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { activeBlockVariation, variations, isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getActiveBlockVariation, getBlockVariations } = select(external_wp_blocks_namespaceObject.store); const { getBlockName, getBlockAttributes, getBlockEditingMode } = select(store); const name = blockClientId && getBlockName(blockClientId); const { hasContentRoleAttribute } = unlock(select(external_wp_blocks_namespaceObject.store)); const isContentBlock = hasContentRoleAttribute(name); return { activeBlockVariation: getActiveBlockVariation(name, getBlockAttributes(blockClientId)), variations: name && getBlockVariations(name, 'transform'), isContentOnly: getBlockEditingMode(blockClientId) === 'contentOnly' && !isContentBlock }; }, [blockClientId]); const selectedValue = activeBlockVariation?.name; // Check if each variation has a unique icon. const hasUniqueIcons = (0,external_wp_element_namespaceObject.useMemo)(() => { const variationIcons = new Set(); if (!variations) { return false; } variations.forEach(variation => { if (variation.icon) { variationIcons.add(variation.icon?.src || variation.icon); } }); return variationIcons.size === variations.length; }, [variations]); const onSelectVariation = variationName => { updateBlockAttributes(blockClientId, { ...variations.find(({ name }) => name === variationName).attributes }); }; if (!variations?.length || isContentOnly) { return null; } const baseClass = 'block-editor-block-variation-transforms'; // Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap const showButtons = variations.length > 5; const ButtonComponent = showButtons ? VariationsButtons : VariationsToggleGroupControl; const Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { className: baseClass, onSelectVariation: onSelectVariation, selectedValue: selectedValue, variations: variations }); } /* harmony default export */ const block_variation_transforms = (__experimentalBlockVariationTransforms); ;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ const with_color_context = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => { return props => { // Get the default colors, theme colors, and custom colors const [defaultColors, themeColors, customColors, enableCustomColors, enableDefaultColors] = use_settings_useSettings('color.palette.default', 'color.palette.theme', 'color.palette.custom', 'color.custom', 'color.defaultPalette'); const _colors = enableDefaultColors ? [...(themeColors || []), ...(defaultColors || []), ...(customColors || [])] : [...(themeColors || []), ...(customColors || [])]; const { colors = _colors, disableCustomColors = !enableCustomColors } = props; const hasColorsToChoose = colors && colors.length > 0 || !disableCustomColors; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors, disableCustomColors, hasColorsToChoose }); }; }, 'withColorContext')); ;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ const color_palette = (with_color_context(external_wp_components_namespaceObject.ColorPalette)); ;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/control.js /** * Internal dependencies */ function ColorPaletteControl({ onChange, value, ...otherProps }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(control, { ...otherProps, onColorChange: onChange, colorValue: value, gradients: [], disableCustomGradients: true }); } ;// external ["wp","date"] const external_wp_date_namespaceObject = window["wp"]["date"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/date-format-picker/index.js /** * WordPress dependencies */ // So that we illustrate the different formats in the dropdown properly, show a date that is // somewhat recent, has a day greater than 12, and a month with more than three letters. const exampleDate = new Date(); exampleDate.setDate(20); exampleDate.setMonth(exampleDate.getMonth() - 3); if (exampleDate.getMonth() === 4) { // May has three letters, so use March. exampleDate.setMonth(3); } /** * The `DateFormatPicker` component renders controls that let the user choose a * _date format_. That is, how they want their dates to be formatted. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md * * @param {Object} props * @param {string|null} props.format The selected date format. If `null`, _Default_ is selected. * @param {string} props.defaultFormat The date format that will be used if the user selects 'Default'. * @param {Function} props.onChange Called when a selection is made. If `null`, _Default_ is selected. */ function DateFormatPicker({ format, defaultFormat, onChange }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { as: "fieldset", spacing: 4, className: "block-editor-date-format-picker", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)('Date format') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Default format'), help: `${(0,external_wp_i18n_namespaceObject.__)('Example:')} ${(0,external_wp_date_namespaceObject.dateI18n)(defaultFormat, exampleDate)}`, checked: !format, onChange: checked => onChange(checked ? null : defaultFormat) }), format && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NonDefaultControls, { format: format, onChange: onChange })] }); } function NonDefaultControls({ format, onChange }) { var _suggestedOptions$fin; // Suggest a short format, medium format, long format, and a standardised // (YYYY-MM-DD) format. The short, medium, and long formats are localised as // different languages have different ways of writing these. For example, 'F // j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April // 2022) in German (de). The resultant array is de-duplicated as some // languages will use the same format string for short, medium, and long // formats. const suggestedFormats = [...new Set([/* translators: See https://www.php.net/manual/datetime.format.php */ 'Y-m-d', /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)('n/j/Y', 'short date format'), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)('n/j/Y g:i A', 'short date format with time'), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)('M j, Y', 'medium date format'), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)('M j, Y g:i A', 'medium date format with time'), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)('F j, Y', 'long date format'), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)('M j', 'short date format without the year')])]; const suggestedOptions = [...suggestedFormats.map((suggestedFormat, index) => ({ key: `suggested-${index}`, name: (0,external_wp_date_namespaceObject.dateI18n)(suggestedFormat, exampleDate), format: suggestedFormat })), { key: 'human-diff', name: (0,external_wp_date_namespaceObject.humanTimeDiff)(exampleDate), format: 'human-diff' }]; const customOption = { key: 'custom', name: (0,external_wp_i18n_namespaceObject.__)('Custom'), className: 'block-editor-date-format-picker__custom-format-select-control__custom-option', hint: (0,external_wp_i18n_namespaceObject.__)('Enter your own date format') }; const [isCustom, setIsCustom] = (0,external_wp_element_namespaceObject.useState)(() => !!format && !suggestedOptions.some(option => option.format === format)); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CustomSelectControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Choose a format'), options: [...suggestedOptions, customOption], value: isCustom ? customOption : (_suggestedOptions$fin = suggestedOptions.find(option => option.format === format)) !== null && _suggestedOptions$fin !== void 0 ? _suggestedOptions$fin : customOption, onChange: ({ selectedItem }) => { if (selectedItem === customOption) { setIsCustom(true); } else { setIsCustom(false); onChange(selectedItem.format); } } }), isCustom && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Custom format'), hideLabelFromVision: true, help: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Enter a date or time <Link>format string</Link>.'), { Link: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/customize-date-and-time-format/') }) }), value: format, onChange: value => onChange(value) })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/dropdown.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Internal dependencies */ // When the `ColorGradientSettingsDropdown` controls are being rendered to a // `ToolsPanel` they must be wrapped in a `ToolsPanelItem`. const WithToolsPanelItem = ({ setting, children, panelId, ...props }) => { const clearValue = () => { if (setting.colorValue) { setting.onColorChange(); } else if (setting.gradientValue) { setting.onGradientChange(); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => { return !!setting.colorValue || !!setting.gradientValue; }, label: setting.label, onDeselect: clearValue, isShownByDefault: setting.isShownByDefault !== undefined ? setting.isShownByDefault : true, ...props, className: "block-editor-tools-panel-color-gradient-settings__item", panelId: panelId // Pass resetAllFilter if supplied due to rendering via SlotFill // into parent ToolsPanel. , resetAllFilter: setting.resetAllFilter, children: children }); }; const dropdown_LabeledColorIndicator = ({ colorValue, label }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-panel-color-gradient-settings__color-indicator", colorValue: colorValue }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "block-editor-panel-color-gradient-settings__color-name", title: label, children: label })] }); // Renders a color dropdown's toggle as an `Item` if it is within an `ItemGroup` // or as a `Button` if it isn't e.g. the controls are being rendered in // a `ToolsPanel`. const dropdown_renderToggle = settings => ({ onToggle, isOpen }) => { const { clearable, colorValue, gradientValue, onColorChange, onGradientChange, label } = settings; const colorButtonRef = (0,external_wp_element_namespaceObject.useRef)(undefined); const toggleProps = { onClick: onToggle, className: dist_clsx('block-editor-panel-color-gradient-settings__dropdown', { 'is-open': isOpen }), 'aria-expanded': isOpen, ref: colorButtonRef }; const clearValue = () => { if (colorValue) { onColorChange(); } else if (gradientValue) { onGradientChange(); } }; const value = colorValue !== null && colorValue !== void 0 ? colorValue : gradientValue; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_LabeledColorIndicator, { colorValue: value, label: label }) }), clearable && value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Reset'), className: "block-editor-panel-color-gradient-settings__reset", size: "small", icon: library_reset, onClick: () => { clearValue(); if (isOpen) { onToggle(); } // Return focus to parent button colorButtonRef.current?.focus(); } })] }); }; // Renders a collection of color controls as dropdowns. Depending upon the // context in which these dropdowns are being rendered, they may be wrapped // in an `ItemGroup` with each dropdown's toggle as an `Item`, or alternatively, // the may be individually wrapped in a `ToolsPanelItem` with the toggle as // a regular `Button`. // // For more context see: https://github.com/WordPress/gutenberg/pull/40084 function ColorGradientSettingsDropdown({ colors, disableCustomColors, disableCustomGradients, enableAlpha, gradients, settings, __experimentalIsRenderedInSidebar, ...props }) { let popoverProps; if (__experimentalIsRenderedInSidebar) { popoverProps = { placement: 'left-start', offset: 36, shift: true }; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: settings.map((setting, index) => { const controlProps = { clearable: false, colorValue: setting.colorValue, colors, disableCustomColors, disableCustomGradients, enableAlpha, gradientValue: setting.gradientValue, gradients, label: setting.label, onColorChange: setting.onColorChange, onGradientChange: setting.onGradientChange, showTitle: false, __experimentalIsRenderedInSidebar, ...setting }; const toggleSettings = { clearable: setting.clearable, label: setting.label, colorValue: setting.colorValue, gradientValue: setting.gradientValue, onColorChange: setting.onColorChange, onGradientChange: setting.onGradientChange }; return setting && /*#__PURE__*/ // If not in an `ItemGroup` wrap the dropdown in a // `ToolsPanelItem` (0,external_ReactJSXRuntime_namespaceObject.jsx)(WithToolsPanelItem, { setting: setting, ...props, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, className: "block-editor-tools-panel-color-gradient-settings__dropdown", renderToggle: dropdown_renderToggle(toggleSettings), renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-panel-color-gradient-settings__dropdown-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(control, { ...controlProps }) }) }) }) }, index); }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; const PanelColorGradientSettingsInner = ({ className, colors, gradients, disableCustomColors, disableCustomGradients, children, settings, title, showTitle = true, __experimentalIsRenderedInSidebar, enableAlpha }) => { const panelId = (0,external_wp_compose_namespaceObject.useInstanceId)(PanelColorGradientSettingsInner); const { batch } = (0,external_wp_data_namespaceObject.useRegistry)(); if ((!colors || colors.length === 0) && (!gradients || gradients.length === 0) && disableCustomColors && disableCustomGradients && settings?.every(setting => (!setting.colors || setting.colors.length === 0) && (!setting.gradients || setting.gradients.length === 0) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanel, { className: dist_clsx('block-editor-panel-color-gradient-settings', className), label: showTitle ? title : undefined, resetAll: () => { batch(() => { settings.forEach(({ colorValue, gradientValue, onColorChange, onGradientChange }) => { if (colorValue) { onColorChange(); } else if (gradientValue) { onGradientChange(); } }); }); }, panelId: panelId, __experimentalFirstVisibleItemClass: "first", __experimentalLastVisibleItemClass: "last", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientSettingsDropdown, { settings: settings, panelId: panelId, colors, gradients, disableCustomColors, disableCustomGradients, __experimentalIsRenderedInSidebar, enableAlpha }), !!children && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginY: 4 }), " ", children] })] }); }; const PanelColorGradientSettingsSelect = props => { const colorGradientSettings = useMultipleOriginColorsAndGradients(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsInner, { ...colorGradientSettings, ...props }); }; const PanelColorGradientSettings = props => { if (panel_color_gradient_settings_colorsAndGradientKeys.every(key => props.hasOwnProperty(key))) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsInner, { ...props }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsSelect, { ...props }); }; /* harmony default export */ const panel_color_gradient_settings = (PanelColorGradientSettings); ;// ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js /** * WordPress dependencies */ const aspectRatio = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 5.5h-13c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2v-9c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5h-13c-.3 0-.5-.2-.5-.5v-9c0-.3.2-.5.5-.5h13c.3 0 .5.2.5.5v9zM6.5 12H8v-2h2V8.5H6.5V12zm9.5 2h-2v1.5h3.5V12H16v2z" }) }); /* harmony default export */ const aspect_ratio = (aspectRatio); ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/constants.js const MIN_ZOOM = 100; const MAX_ZOOM = 300; const constants_POPOVER_PROPS = { placement: 'bottom-start' }; ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-save-image.js /** * WordPress dependencies */ // Disable Reason: Needs to be refactored. // eslint-disable-next-line no-restricted-imports const messages = { crop: (0,external_wp_i18n_namespaceObject.__)('Image cropped.'), rotate: (0,external_wp_i18n_namespaceObject.__)('Image rotated.'), cropAndRotate: (0,external_wp_i18n_namespaceObject.__)('Image cropped and rotated.') }; function useSaveImage({ crop, rotation, url, id, onSaveImage, onFinishEditing }) { const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const [isInProgress, setIsInProgress] = (0,external_wp_element_namespaceObject.useState)(false); const cancel = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsInProgress(false); onFinishEditing(); }, [onFinishEditing]); const apply = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsInProgress(true); const modifiers = []; if (rotation > 0) { modifiers.push({ type: 'rotate', args: { angle: rotation } }); } // The crop script may return some very small, sub-pixel values when the image was not cropped. // Crop only when the new size has changed by more than 0.1%. if (crop.width < 99.9 || crop.height < 99.9) { modifiers.push({ type: 'crop', args: { left: crop.x, top: crop.y, width: crop.width, height: crop.height } }); } if (modifiers.length === 0) { // No changes to apply. setIsInProgress(false); onFinishEditing(); return; } const modifierType = modifiers.length === 1 ? modifiers[0].type : 'cropAndRotate'; external_wp_apiFetch_default()({ path: `/wp/v2/media/${id}/edit`, method: 'POST', data: { src: url, modifiers } }).then(response => { onSaveImage({ id: response.id, url: response.source_url }); createSuccessNotice(messages[modifierType], { type: 'snackbar', actions: [{ label: (0,external_wp_i18n_namespaceObject.__)('Undo'), onClick: () => { onSaveImage({ id, url }); } }] }); }).catch(error => { createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Error message. */ (0,external_wp_i18n_namespaceObject.__)('Could not edit image. %s'), (0,external_wp_dom_namespaceObject.__unstableStripHTML)(error.message)), { id: 'image-editing-error', type: 'snackbar' }); }).finally(() => { setIsInProgress(false); onFinishEditing(); }); }, [crop, rotation, id, url, onSaveImage, createErrorNotice, createSuccessNotice, onFinishEditing]); return (0,external_wp_element_namespaceObject.useMemo)(() => ({ isInProgress, apply, cancel }), [isInProgress, apply, cancel]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-transform-image.js /* wp:polyfill */ /** * WordPress dependencies */ function useTransformImage({ url, naturalWidth, naturalHeight }) { const [editedUrl, setEditedUrl] = (0,external_wp_element_namespaceObject.useState)(); const [crop, setCrop] = (0,external_wp_element_namespaceObject.useState)(); const [position, setPosition] = (0,external_wp_element_namespaceObject.useState)({ x: 0, y: 0 }); const [zoom, setZoom] = (0,external_wp_element_namespaceObject.useState)(100); const [rotation, setRotation] = (0,external_wp_element_namespaceObject.useState)(0); const defaultAspect = naturalWidth / naturalHeight; const [aspect, setAspect] = (0,external_wp_element_namespaceObject.useState)(defaultAspect); const rotateClockwise = (0,external_wp_element_namespaceObject.useCallback)(() => { const angle = (rotation + 90) % 360; let naturalAspectRatio = defaultAspect; if (rotation % 180 === 90) { naturalAspectRatio = 1 / defaultAspect; } if (angle === 0) { setEditedUrl(); setRotation(angle); setAspect(defaultAspect); setPosition(prevPosition => ({ x: -(prevPosition.y * naturalAspectRatio), y: prevPosition.x * naturalAspectRatio })); return; } function editImage(event) { const canvas = document.createElement('canvas'); let translateX = 0; let translateY = 0; if (angle % 180) { canvas.width = event.target.height; canvas.height = event.target.width; } else { canvas.width = event.target.width; canvas.height = event.target.height; } if (angle === 90 || angle === 180) { translateX = canvas.width; } if (angle === 270 || angle === 180) { translateY = canvas.height; } const context = canvas.getContext('2d'); context.translate(translateX, translateY); context.rotate(angle * Math.PI / 180); context.drawImage(event.target, 0, 0); canvas.toBlob(blob => { setEditedUrl(URL.createObjectURL(blob)); setRotation(angle); setAspect(canvas.width / canvas.height); setPosition(prevPosition => ({ x: -(prevPosition.y * naturalAspectRatio), y: prevPosition.x * naturalAspectRatio })); }); } const el = new window.Image(); el.src = url; el.onload = editImage; const imgCrossOrigin = (0,external_wp_hooks_namespaceObject.applyFilters)('media.crossOrigin', undefined, url); if (typeof imgCrossOrigin === 'string') { el.crossOrigin = imgCrossOrigin; } }, [rotation, defaultAspect, url]); return (0,external_wp_element_namespaceObject.useMemo)(() => ({ editedUrl, setEditedUrl, crop, setCrop, position, setPosition, zoom, setZoom, rotation, setRotation, rotateClockwise, aspect, setAspect, defaultAspect }), [editedUrl, crop, position, zoom, rotation, rotateClockwise, aspect, defaultAspect]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const ImageEditingContext = (0,external_wp_element_namespaceObject.createContext)({}); const useImageEditingContext = () => (0,external_wp_element_namespaceObject.useContext)(ImageEditingContext); function ImageEditingProvider({ id, url, naturalWidth, naturalHeight, onFinishEditing, onSaveImage, children }) { const transformImage = useTransformImage({ url, naturalWidth, naturalHeight }); const saveImage = useSaveImage({ id, url, onSaveImage, onFinishEditing, ...transformImage }); const providerValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...transformImage, ...saveImage }), [transformImage, saveImage]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageEditingContext.Provider, { value: providerValue, children: children }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/aspect-ratio-dropdown.js /** * WordPress dependencies */ /** * Internal dependencies */ function AspectRatioGroup({ aspectRatios, isDisabled, label, onClick, value }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: label, children: aspectRatios.map(({ name, slug, ratio }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { disabled: isDisabled, onClick: () => { onClick(ratio); }, role: "menuitemradio", isSelected: ratio === value, icon: ratio === value ? library_check : undefined, children: name }, slug)) }); } function ratioToNumber(str) { // TODO: support two-value aspect ratio? // https://css-tricks.com/almanac/properties/a/aspect-ratio/#aa-it-can-take-two-values const [a, b, ...rest] = str.split('/').map(Number); if (a <= 0 || b <= 0 || Number.isNaN(a) || Number.isNaN(b) || rest.length) { return NaN; } return b ? a / b : a; } function presetRatioAsNumber({ ratio, ...rest }) { return { ratio: ratioToNumber(ratio), ...rest }; } function AspectRatioDropdown({ toggleProps }) { const { isInProgress, aspect, setAspect, defaultAspect } = useImageEditingContext(); const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings('dimensions.aspectRatios.default', 'dimensions.aspectRatios.theme', 'dimensions.defaultAspectRatios'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: aspect_ratio, label: (0,external_wp_i18n_namespaceObject.__)('Aspect Ratio'), popoverProps: constants_POPOVER_PROPS, toggleProps: toggleProps, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioGroup, { isDisabled: isInProgress, onClick: newAspect => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: [ // All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor. { slug: 'original', name: (0,external_wp_i18n_namespaceObject.__)('Original'), ratio: defaultAspect }, ...(showDefaultRatios ? defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio === 1) : [])] }), themeRatios?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Theme'), isDisabled: isInProgress, onClick: newAspect => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: themeRatios }), showDefaultRatios && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Landscape'), isDisabled: isInProgress, onClick: newAspect => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio > 1) }), showDefaultRatios && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Portrait'), isDisabled: isInProgress, onClick: newAspect => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio < 1) })] }) }); } ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); // EXTERNAL MODULE: ./node_modules/normalize-wheel/index.js var normalize_wheel = __webpack_require__(7520); var normalize_wheel_default = /*#__PURE__*/__webpack_require__.n(normalize_wheel); ;// ./node_modules/react-easy-crop/index.module.js /** * Compute the dimension of the crop area based on media size, * aspect ratio and optionally rotation */ function getCropSize(mediaWidth, mediaHeight, containerWidth, containerHeight, aspect, rotation) { if (rotation === void 0) { rotation = 0; } var _a = rotateSize(mediaWidth, mediaHeight, rotation), width = _a.width, height = _a.height; var fittingWidth = Math.min(width, containerWidth); var fittingHeight = Math.min(height, containerHeight); if (fittingWidth > fittingHeight * aspect) { return { width: fittingHeight * aspect, height: fittingHeight }; } return { width: fittingWidth, height: fittingWidth / aspect }; } /** * Compute media zoom. * We fit the media into the container with "max-width: 100%; max-height: 100%;" */ function getMediaZoom(mediaSize) { // Take the axis with more pixels to improve accuracy return mediaSize.width > mediaSize.height ? mediaSize.width / mediaSize.naturalWidth : mediaSize.height / mediaSize.naturalHeight; } /** * Ensure a new media position stays in the crop area. */ function restrictPosition(position, mediaSize, cropSize, zoom, rotation) { if (rotation === void 0) { rotation = 0; } var _a = rotateSize(mediaSize.width, mediaSize.height, rotation), width = _a.width, height = _a.height; return { x: restrictPositionCoord(position.x, width, cropSize.width, zoom), y: restrictPositionCoord(position.y, height, cropSize.height, zoom) }; } function restrictPositionCoord(position, mediaSize, cropSize, zoom) { var maxPosition = mediaSize * zoom / 2 - cropSize / 2; return clamp(position, -maxPosition, maxPosition); } function getDistanceBetweenPoints(pointA, pointB) { return Math.sqrt(Math.pow(pointA.y - pointB.y, 2) + Math.pow(pointA.x - pointB.x, 2)); } function getRotationBetweenPoints(pointA, pointB) { return Math.atan2(pointB.y - pointA.y, pointB.x - pointA.x) * 180 / Math.PI; } /** * Compute the output cropped area of the media in percentages and pixels. * x/y are the top-left coordinates on the src media */ function computeCroppedArea(crop, mediaSize, cropSize, aspect, zoom, rotation, restrictPosition) { if (rotation === void 0) { rotation = 0; } if (restrictPosition === void 0) { restrictPosition = true; } // if the media is rotated by the user, we cannot limit the position anymore // as it might need to be negative. var limitAreaFn = restrictPosition ? limitArea : noOp; var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation); var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation); // calculate the crop area in percentages // in the rotated space var croppedAreaPercentages = { x: limitAreaFn(100, ((mediaBBoxSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaBBoxSize.width * 100), y: limitAreaFn(100, ((mediaBBoxSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaBBoxSize.height * 100), width: limitAreaFn(100, cropSize.width / mediaBBoxSize.width * 100 / zoom), height: limitAreaFn(100, cropSize.height / mediaBBoxSize.height * 100 / zoom) }; // we compute the pixels size naively var widthInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.width, croppedAreaPercentages.width * mediaNaturalBBoxSize.width / 100)); var heightInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.height, croppedAreaPercentages.height * mediaNaturalBBoxSize.height / 100)); var isImgWiderThanHigh = mediaNaturalBBoxSize.width >= mediaNaturalBBoxSize.height * aspect; // then we ensure the width and height exactly match the aspect (to avoid rounding approximations) // if the media is wider than high, when zoom is 0, the crop height will be equals to image height // thus we want to compute the width from the height and aspect for accuracy. // Otherwise, we compute the height from width and aspect. var sizePixels = isImgWiderThanHigh ? { width: Math.round(heightInPixels * aspect), height: heightInPixels } : { width: widthInPixels, height: Math.round(widthInPixels / aspect) }; var croppedAreaPixels = __assign(__assign({}, sizePixels), { x: Math.round(limitAreaFn(mediaNaturalBBoxSize.width - sizePixels.width, croppedAreaPercentages.x * mediaNaturalBBoxSize.width / 100)), y: Math.round(limitAreaFn(mediaNaturalBBoxSize.height - sizePixels.height, croppedAreaPercentages.y * mediaNaturalBBoxSize.height / 100)) }); return { croppedAreaPercentages: croppedAreaPercentages, croppedAreaPixels: croppedAreaPixels }; } /** * Ensure the returned value is between 0 and max */ function limitArea(max, value) { return Math.min(max, Math.max(0, value)); } function noOp(_max, value) { return value; } /** * Compute crop and zoom from the croppedAreaPercentages. */ function getInitialCropFromCroppedAreaPercentages(croppedAreaPercentages, mediaSize, rotation, cropSize, minZoom, maxZoom) { var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation); // This is the inverse process of computeCroppedArea var zoom = clamp(cropSize.width / mediaBBoxSize.width * (100 / croppedAreaPercentages.width), minZoom, maxZoom); var crop = { x: zoom * mediaBBoxSize.width / 2 - cropSize.width / 2 - mediaBBoxSize.width * zoom * (croppedAreaPercentages.x / 100), y: zoom * mediaBBoxSize.height / 2 - cropSize.height / 2 - mediaBBoxSize.height * zoom * (croppedAreaPercentages.y / 100) }; return { crop: crop, zoom: zoom }; } /** * Compute zoom from the croppedAreaPixels */ function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) { var mediaZoom = getMediaZoom(mediaSize); return cropSize.height > cropSize.width ? cropSize.height / (croppedAreaPixels.height * mediaZoom) : cropSize.width / (croppedAreaPixels.width * mediaZoom); } /** * Compute crop and zoom from the croppedAreaPixels */ function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, rotation, cropSize, minZoom, maxZoom) { if (rotation === void 0) { rotation = 0; } var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation); var zoom = clamp(getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize), minZoom, maxZoom); var cropZoom = cropSize.height > cropSize.width ? cropSize.height / croppedAreaPixels.height : cropSize.width / croppedAreaPixels.width; var crop = { x: ((mediaNaturalBBoxSize.width - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom, y: ((mediaNaturalBBoxSize.height - croppedAreaPixels.height) / 2 - croppedAreaPixels.y) * cropZoom }; return { crop: crop, zoom: zoom }; } /** * Return the point that is the center of point a and b */ function getCenter(a, b) { return { x: (b.x + a.x) / 2, y: (b.y + a.y) / 2 }; } function getRadianAngle(degreeValue) { return degreeValue * Math.PI / 180; } /** * Returns the new bounding area of a rotated rectangle. */ function rotateSize(width, height, rotation) { var rotRad = getRadianAngle(rotation); return { width: Math.abs(Math.cos(rotRad) * width) + Math.abs(Math.sin(rotRad) * height), height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height) }; } /** * Clamp value between min and max */ function clamp(value, min, max) { return Math.min(Math.max(value, min), max); } /** * Combine multiple class names into a single string. */ function classNames() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return args.filter(function (value) { if (typeof value === 'string' && value.length > 0) { return true; } return false; }).join(' ').trim(); } var css_248z = ".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n"; var index_module_MIN_ZOOM = 1; var index_module_MAX_ZOOM = 3; var Cropper = /** @class */function (_super) { __extends(Cropper, _super); function Cropper() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.imageRef = external_React_.createRef(); _this.videoRef = external_React_.createRef(); _this.containerPosition = { x: 0, y: 0 }; _this.containerRef = null; _this.styleRef = null; _this.containerRect = null; _this.mediaSize = { width: 0, height: 0, naturalWidth: 0, naturalHeight: 0 }; _this.dragStartPosition = { x: 0, y: 0 }; _this.dragStartCrop = { x: 0, y: 0 }; _this.gestureZoomStart = 0; _this.gestureRotationStart = 0; _this.isTouching = false; _this.lastPinchDistance = 0; _this.lastPinchRotation = 0; _this.rafDragTimeout = null; _this.rafPinchTimeout = null; _this.wheelTimer = null; _this.currentDoc = typeof document !== 'undefined' ? document : null; _this.currentWindow = typeof window !== 'undefined' ? window : null; _this.resizeObserver = null; _this.state = { cropSize: null, hasWheelJustStarted: false, mediaObjectFit: undefined }; _this.initResizeObserver = function () { if (typeof window.ResizeObserver === 'undefined' || !_this.containerRef) { return; } var isFirstResize = true; _this.resizeObserver = new window.ResizeObserver(function (entries) { if (isFirstResize) { isFirstResize = false; // observe() is called on mount, we don't want to trigger a recompute on mount return; } _this.computeSizes(); }); _this.resizeObserver.observe(_this.containerRef); }; // this is to prevent Safari on iOS >= 10 to zoom the page _this.preventZoomSafari = function (e) { return e.preventDefault(); }; _this.cleanEvents = function () { if (!_this.currentDoc) return; _this.currentDoc.removeEventListener('mousemove', _this.onMouseMove); _this.currentDoc.removeEventListener('mouseup', _this.onDragStopped); _this.currentDoc.removeEventListener('touchmove', _this.onTouchMove); _this.currentDoc.removeEventListener('touchend', _this.onDragStopped); _this.currentDoc.removeEventListener('gesturemove', _this.onGestureMove); _this.currentDoc.removeEventListener('gestureend', _this.onGestureEnd); _this.currentDoc.removeEventListener('scroll', _this.onScroll); }; _this.clearScrollEvent = function () { if (_this.containerRef) _this.containerRef.removeEventListener('wheel', _this.onWheel); if (_this.wheelTimer) { clearTimeout(_this.wheelTimer); } }; _this.onMediaLoad = function () { var cropSize = _this.computeSizes(); if (cropSize) { _this.emitCropData(); _this.setInitialCrop(cropSize); } if (_this.props.onMediaLoaded) { _this.props.onMediaLoaded(_this.mediaSize); } }; _this.setInitialCrop = function (cropSize) { if (_this.props.initialCroppedAreaPercentages) { var _a = getInitialCropFromCroppedAreaPercentages(_this.props.initialCroppedAreaPercentages, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom), crop = _a.crop, zoom = _a.zoom; _this.props.onCropChange(crop); _this.props.onZoomChange && _this.props.onZoomChange(zoom); } else if (_this.props.initialCroppedAreaPixels) { var _b = getInitialCropFromCroppedAreaPixels(_this.props.initialCroppedAreaPixels, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom), crop = _b.crop, zoom = _b.zoom; _this.props.onCropChange(crop); _this.props.onZoomChange && _this.props.onZoomChange(zoom); } }; _this.computeSizes = function () { var _a, _b, _c, _d, _e, _f; var mediaRef = _this.imageRef.current || _this.videoRef.current; if (mediaRef && _this.containerRef) { _this.containerRect = _this.containerRef.getBoundingClientRect(); _this.saveContainerPosition(); var containerAspect = _this.containerRect.width / _this.containerRect.height; var naturalWidth = ((_a = _this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0; var naturalHeight = ((_c = _this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0; var isMediaScaledDown = mediaRef.offsetWidth < naturalWidth || mediaRef.offsetHeight < naturalHeight; var mediaAspect = naturalWidth / naturalHeight; // We do not rely on the offsetWidth/offsetHeight if the media is scaled down // as the values they report are rounded. That will result in precision losses // when calculating zoom. We use the fact that the media is positionned relative // to the container. That allows us to use the container's dimensions // and natural aspect ratio of the media to calculate accurate media size. // However, for this to work, the container should not be rotated var renderedMediaSize = void 0; if (isMediaScaledDown) { switch (_this.state.mediaObjectFit) { default: case 'contain': renderedMediaSize = containerAspect > mediaAspect ? { width: _this.containerRect.height * mediaAspect, height: _this.containerRect.height } : { width: _this.containerRect.width, height: _this.containerRect.width / mediaAspect }; break; case 'horizontal-cover': renderedMediaSize = { width: _this.containerRect.width, height: _this.containerRect.width / mediaAspect }; break; case 'vertical-cover': renderedMediaSize = { width: _this.containerRect.height * mediaAspect, height: _this.containerRect.height }; break; } } else { renderedMediaSize = { width: mediaRef.offsetWidth, height: mediaRef.offsetHeight }; } _this.mediaSize = __assign(__assign({}, renderedMediaSize), { naturalWidth: naturalWidth, naturalHeight: naturalHeight }); // set media size in the parent if (_this.props.setMediaSize) { _this.props.setMediaSize(_this.mediaSize); } var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(_this.mediaSize.width, _this.mediaSize.height, _this.containerRect.width, _this.containerRect.height, _this.props.aspect, _this.props.rotation); if (((_e = _this.state.cropSize) === null || _e === void 0 ? void 0 : _e.height) !== cropSize.height || ((_f = _this.state.cropSize) === null || _f === void 0 ? void 0 : _f.width) !== cropSize.width) { _this.props.onCropSizeChange && _this.props.onCropSizeChange(cropSize); } _this.setState({ cropSize: cropSize }, _this.recomputeCropPosition); // pass crop size to parent if (_this.props.setCropSize) { _this.props.setCropSize(cropSize); } return cropSize; } }; _this.saveContainerPosition = function () { if (_this.containerRef) { var bounds = _this.containerRef.getBoundingClientRect(); _this.containerPosition = { x: bounds.left, y: bounds.top }; } }; _this.onMouseDown = function (e) { if (!_this.currentDoc) return; e.preventDefault(); _this.currentDoc.addEventListener('mousemove', _this.onMouseMove); _this.currentDoc.addEventListener('mouseup', _this.onDragStopped); _this.saveContainerPosition(); _this.onDragStart(Cropper.getMousePoint(e)); }; _this.onMouseMove = function (e) { return _this.onDrag(Cropper.getMousePoint(e)); }; _this.onScroll = function (e) { if (!_this.currentDoc) return; e.preventDefault(); _this.saveContainerPosition(); }; _this.onTouchStart = function (e) { if (!_this.currentDoc) return; _this.isTouching = true; if (_this.props.onTouchRequest && !_this.props.onTouchRequest(e)) { return; } _this.currentDoc.addEventListener('touchmove', _this.onTouchMove, { passive: false }); // iOS 11 now defaults to passive: true _this.currentDoc.addEventListener('touchend', _this.onDragStopped); _this.saveContainerPosition(); if (e.touches.length === 2) { _this.onPinchStart(e); } else if (e.touches.length === 1) { _this.onDragStart(Cropper.getTouchPoint(e.touches[0])); } }; _this.onTouchMove = function (e) { // Prevent whole page from scrolling on iOS. e.preventDefault(); if (e.touches.length === 2) { _this.onPinchMove(e); } else if (e.touches.length === 1) { _this.onDrag(Cropper.getTouchPoint(e.touches[0])); } }; _this.onGestureStart = function (e) { if (!_this.currentDoc) return; e.preventDefault(); _this.currentDoc.addEventListener('gesturechange', _this.onGestureMove); _this.currentDoc.addEventListener('gestureend', _this.onGestureEnd); _this.gestureZoomStart = _this.props.zoom; _this.gestureRotationStart = _this.props.rotation; }; _this.onGestureMove = function (e) { e.preventDefault(); if (_this.isTouching) { // this is to avoid conflict between gesture and touch events return; } var point = Cropper.getMousePoint(e); var newZoom = _this.gestureZoomStart - 1 + e.scale; _this.setNewZoom(newZoom, point, { shouldUpdatePosition: true }); if (_this.props.onRotationChange) { var newRotation = _this.gestureRotationStart + e.rotation; _this.props.onRotationChange(newRotation); } }; _this.onGestureEnd = function (e) { _this.cleanEvents(); }; _this.onDragStart = function (_a) { var _b, _c; var x = _a.x, y = _a.y; _this.dragStartPosition = { x: x, y: y }; _this.dragStartCrop = __assign({}, _this.props.crop); (_c = (_b = _this.props).onInteractionStart) === null || _c === void 0 ? void 0 : _c.call(_b); }; _this.onDrag = function (_a) { var x = _a.x, y = _a.y; if (!_this.currentWindow) return; if (_this.rafDragTimeout) _this.currentWindow.cancelAnimationFrame(_this.rafDragTimeout); _this.rafDragTimeout = _this.currentWindow.requestAnimationFrame(function () { if (!_this.state.cropSize) return; if (x === undefined || y === undefined) return; var offsetX = x - _this.dragStartPosition.x; var offsetY = y - _this.dragStartPosition.y; var requestedPosition = { x: _this.dragStartCrop.x + offsetX, y: _this.dragStartCrop.y + offsetY }; var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : requestedPosition; _this.props.onCropChange(newPosition); }); }; _this.onDragStopped = function () { var _a, _b; _this.isTouching = false; _this.cleanEvents(); _this.emitCropData(); (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); }; _this.onWheel = function (e) { if (!_this.currentWindow) return; if (_this.props.onWheelRequest && !_this.props.onWheelRequest(e)) { return; } e.preventDefault(); var point = Cropper.getMousePoint(e); var pixelY = normalize_wheel_default()(e).pixelY; var newZoom = _this.props.zoom - pixelY * _this.props.zoomSpeed / 200; _this.setNewZoom(newZoom, point, { shouldUpdatePosition: true }); if (!_this.state.hasWheelJustStarted) { _this.setState({ hasWheelJustStarted: true }, function () { var _a, _b; return (_b = (_a = _this.props).onInteractionStart) === null || _b === void 0 ? void 0 : _b.call(_a); }); } if (_this.wheelTimer) { clearTimeout(_this.wheelTimer); } _this.wheelTimer = _this.currentWindow.setTimeout(function () { return _this.setState({ hasWheelJustStarted: false }, function () { var _a, _b; return (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); }); }, 250); }; _this.getPointOnContainer = function (_a, containerTopLeft) { var x = _a.x, y = _a.y; if (!_this.containerRect) { throw new Error('The Cropper is not mounted'); } return { x: _this.containerRect.width / 2 - (x - containerTopLeft.x), y: _this.containerRect.height / 2 - (y - containerTopLeft.y) }; }; _this.getPointOnMedia = function (_a) { var x = _a.x, y = _a.y; var _b = _this.props, crop = _b.crop, zoom = _b.zoom; return { x: (x + crop.x) / zoom, y: (y + crop.y) / zoom }; }; _this.setNewZoom = function (zoom, point, _a) { var _b = _a === void 0 ? {} : _a, _c = _b.shouldUpdatePosition, shouldUpdatePosition = _c === void 0 ? true : _c; if (!_this.state.cropSize || !_this.props.onZoomChange) return; var newZoom = clamp(zoom, _this.props.minZoom, _this.props.maxZoom); if (shouldUpdatePosition) { var zoomPoint = _this.getPointOnContainer(point, _this.containerPosition); var zoomTarget = _this.getPointOnMedia(zoomPoint); var requestedPosition = { x: zoomTarget.x * newZoom - zoomPoint.x, y: zoomTarget.y * newZoom - zoomPoint.y }; var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, newZoom, _this.props.rotation) : requestedPosition; _this.props.onCropChange(newPosition); } _this.props.onZoomChange(newZoom); }; _this.getCropData = function () { if (!_this.state.cropSize) { return null; } // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ValentinH/react-easy-crop/issues/6) var restrictedPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; return computeCroppedArea(restrictedPosition, _this.mediaSize, _this.state.cropSize, _this.getAspect(), _this.props.zoom, _this.props.rotation, _this.props.restrictPosition); }; _this.emitCropData = function () { var cropData = _this.getCropData(); if (!cropData) return; var croppedAreaPercentages = cropData.croppedAreaPercentages, croppedAreaPixels = cropData.croppedAreaPixels; if (_this.props.onCropComplete) { _this.props.onCropComplete(croppedAreaPercentages, croppedAreaPixels); } if (_this.props.onCropAreaChange) { _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); } }; _this.emitCropAreaChange = function () { var cropData = _this.getCropData(); if (!cropData) return; var croppedAreaPercentages = cropData.croppedAreaPercentages, croppedAreaPixels = cropData.croppedAreaPixels; if (_this.props.onCropAreaChange) { _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); } }; _this.recomputeCropPosition = function () { if (!_this.state.cropSize) return; var newPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; _this.props.onCropChange(newPosition); _this.emitCropData(); }; return _this; } Cropper.prototype.componentDidMount = function () { if (!this.currentDoc || !this.currentWindow) return; if (this.containerRef) { if (this.containerRef.ownerDocument) { this.currentDoc = this.containerRef.ownerDocument; } if (this.currentDoc.defaultView) { this.currentWindow = this.currentDoc.defaultView; } this.initResizeObserver(); // only add window resize listener if ResizeObserver is not supported. Otherwise, it would be redundant if (typeof window.ResizeObserver === 'undefined') { this.currentWindow.addEventListener('resize', this.computeSizes); } this.props.zoomWithScroll && this.containerRef.addEventListener('wheel', this.onWheel, { passive: false }); this.containerRef.addEventListener('gesturestart', this.onGestureStart); } this.currentDoc.addEventListener('scroll', this.onScroll); if (!this.props.disableAutomaticStylesInjection) { this.styleRef = this.currentDoc.createElement('style'); this.styleRef.setAttribute('type', 'text/css'); if (this.props.nonce) { this.styleRef.setAttribute('nonce', this.props.nonce); } this.styleRef.innerHTML = css_248z; this.currentDoc.head.appendChild(this.styleRef); } // when rendered via SSR, the image can already be loaded and its onLoad callback will never be called if (this.imageRef.current && this.imageRef.current.complete) { this.onMediaLoad(); } // set image and video refs in the parent if the callbacks exist if (this.props.setImageRef) { this.props.setImageRef(this.imageRef); } if (this.props.setVideoRef) { this.props.setVideoRef(this.videoRef); } }; Cropper.prototype.componentWillUnmount = function () { var _a, _b; if (!this.currentDoc || !this.currentWindow) return; if (typeof window.ResizeObserver === 'undefined') { this.currentWindow.removeEventListener('resize', this.computeSizes); } (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect(); if (this.containerRef) { this.containerRef.removeEventListener('gesturestart', this.preventZoomSafari); } if (this.styleRef) { (_b = this.styleRef.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.styleRef); } this.cleanEvents(); this.props.zoomWithScroll && this.clearScrollEvent(); }; Cropper.prototype.componentDidUpdate = function (prevProps) { var _a, _b, _c, _d, _e, _f, _g, _h, _j; if (prevProps.rotation !== this.props.rotation) { this.computeSizes(); this.recomputeCropPosition(); } else if (prevProps.aspect !== this.props.aspect) { this.computeSizes(); } else if (prevProps.objectFit !== this.props.objectFit) { this.computeSizes(); } else if (prevProps.zoom !== this.props.zoom) { this.recomputeCropPosition(); } else if (((_a = prevProps.cropSize) === null || _a === void 0 ? void 0 : _a.height) !== ((_b = this.props.cropSize) === null || _b === void 0 ? void 0 : _b.height) || ((_c = prevProps.cropSize) === null || _c === void 0 ? void 0 : _c.width) !== ((_d = this.props.cropSize) === null || _d === void 0 ? void 0 : _d.width)) { this.computeSizes(); } else if (((_e = prevProps.crop) === null || _e === void 0 ? void 0 : _e.x) !== ((_f = this.props.crop) === null || _f === void 0 ? void 0 : _f.x) || ((_g = prevProps.crop) === null || _g === void 0 ? void 0 : _g.y) !== ((_h = this.props.crop) === null || _h === void 0 ? void 0 : _h.y)) { this.emitCropAreaChange(); } if (prevProps.zoomWithScroll !== this.props.zoomWithScroll && this.containerRef) { this.props.zoomWithScroll ? this.containerRef.addEventListener('wheel', this.onWheel, { passive: false }) : this.clearScrollEvent(); } if (prevProps.video !== this.props.video) { (_j = this.videoRef.current) === null || _j === void 0 ? void 0 : _j.load(); } var objectFit = this.getObjectFit(); if (objectFit !== this.state.mediaObjectFit) { this.setState({ mediaObjectFit: objectFit }, this.computeSizes); } }; Cropper.prototype.getAspect = function () { var _a = this.props, cropSize = _a.cropSize, aspect = _a.aspect; if (cropSize) { return cropSize.width / cropSize.height; } return aspect; }; Cropper.prototype.getObjectFit = function () { var _a, _b, _c, _d; if (this.props.objectFit === 'cover') { var mediaRef = this.imageRef.current || this.videoRef.current; if (mediaRef && this.containerRef) { this.containerRect = this.containerRef.getBoundingClientRect(); var containerAspect = this.containerRect.width / this.containerRect.height; var naturalWidth = ((_a = this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0; var naturalHeight = ((_c = this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0; var mediaAspect = naturalWidth / naturalHeight; return mediaAspect < containerAspect ? 'horizontal-cover' : 'vertical-cover'; } return 'horizontal-cover'; } return this.props.objectFit; }; Cropper.prototype.onPinchStart = function (e) { var pointA = Cropper.getTouchPoint(e.touches[0]); var pointB = Cropper.getTouchPoint(e.touches[1]); this.lastPinchDistance = getDistanceBetweenPoints(pointA, pointB); this.lastPinchRotation = getRotationBetweenPoints(pointA, pointB); this.onDragStart(getCenter(pointA, pointB)); }; Cropper.prototype.onPinchMove = function (e) { var _this = this; if (!this.currentDoc || !this.currentWindow) return; var pointA = Cropper.getTouchPoint(e.touches[0]); var pointB = Cropper.getTouchPoint(e.touches[1]); var center = getCenter(pointA, pointB); this.onDrag(center); if (this.rafPinchTimeout) this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout); this.rafPinchTimeout = this.currentWindow.requestAnimationFrame(function () { var distance = getDistanceBetweenPoints(pointA, pointB); var newZoom = _this.props.zoom * (distance / _this.lastPinchDistance); _this.setNewZoom(newZoom, center, { shouldUpdatePosition: false }); _this.lastPinchDistance = distance; var rotation = getRotationBetweenPoints(pointA, pointB); var newRotation = _this.props.rotation + (rotation - _this.lastPinchRotation); _this.props.onRotationChange && _this.props.onRotationChange(newRotation); _this.lastPinchRotation = rotation; }); }; Cropper.prototype.render = function () { var _this = this; var _a = this.props, image = _a.image, video = _a.video, mediaProps = _a.mediaProps, transform = _a.transform, _b = _a.crop, x = _b.x, y = _b.y, rotation = _a.rotation, zoom = _a.zoom, cropShape = _a.cropShape, showGrid = _a.showGrid, _c = _a.style, containerStyle = _c.containerStyle, cropAreaStyle = _c.cropAreaStyle, mediaStyle = _c.mediaStyle, _d = _a.classes, containerClassName = _d.containerClassName, cropAreaClassName = _d.cropAreaClassName, mediaClassName = _d.mediaClassName; var objectFit = this.state.mediaObjectFit; return external_React_.createElement("div", { onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart, ref: function ref(el) { return _this.containerRef = el; }, "data-testid": "container", style: containerStyle, className: classNames('reactEasyCrop_Container', containerClassName) }, image ? external_React_.createElement("img", __assign({ alt: "", className: classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) }, mediaProps, { src: image, ref: this.imageRef, style: __assign(__assign({}, mediaStyle), { transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")") }), onLoad: this.onMediaLoad })) : video && external_React_.createElement("video", __assign({ autoPlay: true, loop: true, muted: true, className: classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) }, mediaProps, { ref: this.videoRef, onLoadedMetadata: this.onMediaLoad, style: __assign(__assign({}, mediaStyle), { transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")") }), controls: false }), (Array.isArray(video) ? video : [{ src: video }]).map(function (item) { return external_React_.createElement("source", __assign({ key: item.src }, item)); })), this.state.cropSize && external_React_.createElement("div", { style: __assign(__assign({}, cropAreaStyle), { width: this.state.cropSize.width, height: this.state.cropSize.height }), "data-testid": "cropper", className: classNames('reactEasyCrop_CropArea', cropShape === 'round' && 'reactEasyCrop_CropAreaRound', showGrid && 'reactEasyCrop_CropAreaGrid', cropAreaClassName) })); }; Cropper.defaultProps = { zoom: 1, rotation: 0, aspect: 4 / 3, maxZoom: index_module_MAX_ZOOM, minZoom: index_module_MIN_ZOOM, cropShape: 'rect', objectFit: 'contain', showGrid: true, style: {}, classes: {}, mediaProps: {}, zoomSpeed: 1, restrictPosition: true, zoomWithScroll: true }; Cropper.getMousePoint = function (e) { return { x: Number(e.clientX), y: Number(e.clientY) }; }; Cropper.getTouchPoint = function (touch) { return { x: Number(touch.clientX), y: Number(touch.clientY) }; }; return Cropper; }(external_React_.Component); ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/cropper.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ImageCropper({ url, width, height, naturalHeight, naturalWidth, borderProps }) { const { isInProgress, editedUrl, position, zoom, aspect, setPosition, setCrop, setZoom, rotation } = useImageEditingContext(); const [contentResizeListener, { width: clientWidth }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); let editedHeight = height || clientWidth * naturalHeight / naturalWidth; if (rotation % 180 === 90) { editedHeight = clientWidth * naturalWidth / naturalHeight; } const area = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('wp-block-image__crop-area', borderProps?.className, { 'is-applying': isInProgress }), style: { ...borderProps?.style, width: width || clientWidth, height: editedHeight }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Cropper, { image: editedUrl || url, disabled: isInProgress, minZoom: MIN_ZOOM / 100, maxZoom: MAX_ZOOM / 100, crop: position, zoom: zoom / 100, aspect: aspect, onCropChange: pos => { setPosition(pos); }, onCropComplete: newCropPercent => { setCrop(newCropPercent); }, onZoomChange: newZoom => { setZoom(newZoom * 100); } }), isInProgress && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [contentResizeListener, area] }); } ;// ./node_modules/@wordpress/icons/build-module/library/search.js /** * WordPress dependencies */ const search = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); /* harmony default export */ const library_search = (search); ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/zoom-dropdown.js /** * WordPress dependencies */ /** * Internal dependencies */ function ZoomDropdown() { const { isInProgress, zoom, setZoom } = useImageEditingContext(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { contentClassName: "wp-block-image__zoom", popoverProps: constants_POPOVER_PROPS, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: library_search, label: (0,external_wp_i18n_namespaceObject.__)('Zoom'), onClick: onToggle, "aria-expanded": isOpen, disabled: isInProgress }), renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Zoom'), min: MIN_ZOOM, max: MAX_ZOOM, value: Math.round(zoom), onChange: setZoom }) }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js /** * WordPress dependencies */ const rotateRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) }); /* harmony default export */ const rotate_right = (rotateRight); ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/rotation-button.js /** * WordPress dependencies */ /** * Internal dependencies */ function RotationButton() { const { isInProgress, rotateClockwise } = useImageEditingContext(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: rotate_right, label: (0,external_wp_i18n_namespaceObject.__)('Rotate'), onClick: rotateClockwise, disabled: isInProgress }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/form-controls.js /** * WordPress dependencies */ /** * Internal dependencies */ function FormControls() { const { isInProgress, apply, cancel } = useImageEditingContext(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: apply, disabled: isInProgress, children: (0,external_wp_i18n_namespaceObject.__)('Apply') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: cancel, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function ImageEditor({ id, url, width, height, naturalHeight, naturalWidth, onSaveImage, onFinishEditing, borderProps }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ImageEditingProvider, { id: id, url: url, naturalWidth: naturalWidth, naturalHeight: naturalHeight, onSaveImage: onSaveImage, onFinishEditing: onFinishEditing, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageCropper, { borderProps: borderProps, url: url, width: width, height: height, naturalHeight: naturalHeight, naturalWidth: naturalWidth }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ZoomDropdown, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioDropdown, { toggleProps: toggleProps }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RotationButton, {})] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FormControls, {}) })] })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/use-dimension-handler.js /** * WordPress dependencies */ function useDimensionHandler(customHeight, customWidth, defaultHeight, defaultWidth, onChange) { var _ref, _ref2; const [currentWidth, setCurrentWidth] = (0,external_wp_element_namespaceObject.useState)((_ref = customWidth !== null && customWidth !== void 0 ? customWidth : defaultWidth) !== null && _ref !== void 0 ? _ref : ''); const [currentHeight, setCurrentHeight] = (0,external_wp_element_namespaceObject.useState)((_ref2 = customHeight !== null && customHeight !== void 0 ? customHeight : defaultHeight) !== null && _ref2 !== void 0 ? _ref2 : ''); // When an image is first inserted, the default dimensions are initially // undefined. This effect updates the dimensions when the default values // come through. (0,external_wp_element_namespaceObject.useEffect)(() => { if (customWidth === undefined && defaultWidth !== undefined) { setCurrentWidth(defaultWidth); } if (customHeight === undefined && defaultHeight !== undefined) { setCurrentHeight(defaultHeight); } }, [defaultWidth, defaultHeight]); // If custom values change, it means an outsider has resized the image using some other method (eg resize box) // this keeps track of these values too. We need to parse before comparing; custom values can be strings. (0,external_wp_element_namespaceObject.useEffect)(() => { if (customWidth !== undefined && Number.parseInt(customWidth) !== Number.parseInt(currentWidth)) { setCurrentWidth(customWidth); } if (customHeight !== undefined && Number.parseInt(customHeight) !== Number.parseInt(currentHeight)) { setCurrentHeight(customHeight); } }, [customWidth, customHeight]); const updateDimension = (dimension, value) => { const parsedValue = value === '' ? undefined : parseInt(value, 10); if (dimension === 'width') { setCurrentWidth(parsedValue); } else { setCurrentHeight(parsedValue); } onChange({ [dimension]: parsedValue }); }; const updateDimensions = (nextHeight, nextWidth) => { setCurrentHeight(nextHeight !== null && nextHeight !== void 0 ? nextHeight : defaultHeight); setCurrentWidth(nextWidth !== null && nextWidth !== void 0 ? nextWidth : defaultWidth); onChange({ height: nextHeight, width: nextWidth }); }; return { currentHeight, currentWidth, updateDimension, updateDimensions }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const IMAGE_SIZE_PRESETS = [25, 50, 75, 100]; const image_size_control_noop = () => {}; /** * Get scaled width and height for the given scale. * * @param {number} scale The scale to get the scaled width and height for. * @param {number} imageWidth The image width. * @param {number} imageHeight The image height. * * @return {Object} The scaled width and height. */ function getScaledWidthAndHeight(scale, imageWidth, imageHeight) { const scaledWidth = Math.round(imageWidth * (scale / 100)); const scaledHeight = Math.round(imageHeight * (scale / 100)); return { scaledWidth, scaledHeight }; } function ImageSizeControl({ imageSizeHelp, imageWidth, imageHeight, imageSizeOptions = [], isResizable = true, slug, width, height, onChange, onChangeImage = image_size_control_noop }) { const { currentHeight, currentWidth, updateDimension, updateDimensions } = useDimensionHandler(height, width, imageHeight, imageWidth, onChange); /** * Updates the dimensions for the given scale. * Handler for toggle group control change. * * @param {number} scale The scale to update the dimensions for. */ const handleUpdateDimensions = scale => { if (undefined === scale) { updateDimensions(); return; } const { scaledWidth, scaledHeight } = getScaledWidthAndHeight(scale, imageWidth, imageHeight); updateDimensions(scaledHeight, scaledWidth); }; /** * Add the stored image preset value to toggle group control. */ const selectedValue = IMAGE_SIZE_PRESETS.find(scale => { const { scaledWidth, scaledHeight } = getScaledWidthAndHeight(scale, imageWidth, imageHeight); return currentWidth === scaledWidth && currentHeight === scaledHeight; }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [imageSizeOptions && imageSizeOptions.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), value: slug, options: imageSizeOptions, onChange: onChangeImage, help: imageSizeHelp, size: "__unstable-large" }), isResizable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-image-size-control", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { align: "baseline", spacing: "3", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { className: "block-editor-image-size-control__width", label: (0,external_wp_i18n_namespaceObject.__)('Width'), value: currentWidth, min: 1, onChange: value => updateDimension('width', value), size: "__unstable-large" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { className: "block-editor-image-size-control__height", label: (0,external_wp_i18n_namespaceObject.__)('Height'), value: currentHeight, min: 1, onChange: value => updateDimension('height', value), size: "__unstable-large" })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { label: (0,external_wp_i18n_namespaceObject.__)('Image size presets'), hideLabelFromVision: true, onChange: handleUpdateDimensions, value: selectedValue, isBlock: true, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, children: IMAGE_SIZE_PRESETS.map(scale => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: scale, label: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: Percentage value. */ (0,external_wp_i18n_namespaceObject.__)('%d%%'), scale) }, scale); }) })] })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer-url.js /** * External dependencies */ /** * WordPress dependencies */ function LinkViewerURL({ url, urlLabel, className }) { const linkClassName = dist_clsx(className, 'block-editor-url-popover__link-viewer-url'); if (!url) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: linkClassName }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { className: linkClassName, href: url, children: urlLabel || (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(url)) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function LinkViewer({ className, linkClassName, onEditLinkClick, url, urlLabel, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('block-editor-url-popover__link-viewer', className), ...props, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkViewerURL, { url: url, urlLabel: urlLabel, className: linkClassName }), onEditLinkClick && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: edit, label: (0,external_wp_i18n_namespaceObject.__)('Edit'), onClick: onEditLinkClick, size: "compact" })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-editor.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function LinkEditor({ autocompleteRef, className, onChangeInputValue, value, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { className: dist_clsx('block-editor-url-popover__link-editor', className), ...props, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_input, { value: value, onChange: onChangeInputValue, autocompleteRef: autocompleteRef }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: keyboard_return, label: (0,external_wp_i18n_namespaceObject.__)('Apply'), type: "submit", size: "compact" })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { __experimentalPopoverLegacyPositionToPlacement } = unlock(external_wp_components_namespaceObject.privateApis); const DEFAULT_PLACEMENT = 'bottom'; const URLPopover = (0,external_wp_element_namespaceObject.forwardRef)(({ additionalControls, children, renderSettings, // The DEFAULT_PLACEMENT value is assigned inside the function's body placement, focusOnMount = 'firstElement', // Deprecated position, // Rest ...popoverProps }, ref) => { if (position !== undefined) { external_wp_deprecated_default()('`position` prop in wp.blockEditor.URLPopover', { since: '6.2', alternative: '`placement` prop' }); } // Compute popover's placement: // - give priority to `placement` prop, if defined // - otherwise, compute it from the legacy `position` prop (if defined) // - finally, fallback to the DEFAULT_PLACEMENT. let computedPlacement; if (placement !== undefined) { computedPlacement = placement; } else if (position !== undefined) { computedPlacement = __experimentalPopoverLegacyPositionToPlacement(position); } computedPlacement = computedPlacement || DEFAULT_PLACEMENT; const [isSettingsExpanded, setIsSettingsExpanded] = (0,external_wp_element_namespaceObject.useState)(false); const showSettings = !!renderSettings && isSettingsExpanded; const toggleSettingsVisibility = () => { setIsSettingsExpanded(!isSettingsExpanded); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Popover, { ref: ref, role: "dialog", "aria-modal": "true", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Edit URL'), className: "block-editor-url-popover", focusOnMount: focusOnMount, placement: computedPlacement, shift: true, variant: "toolbar", ...popoverProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__input-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-popover__row", children: [children, !!renderSettings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "block-editor-url-popover__settings-toggle", icon: chevron_down, label: (0,external_wp_i18n_namespaceObject.__)('Link settings'), onClick: toggleSettingsVisibility, "aria-expanded": isSettingsExpanded, size: "compact" })] }) }), showSettings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__settings", children: renderSettings() }), additionalControls && !showSettings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__additional-controls", children: additionalControls })] }); }); URLPopover.LinkEditor = LinkEditor; URLPopover.LinkViewer = LinkViewer; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md */ /* harmony default export */ const url_popover = (URLPopover); ;// ./node_modules/@wordpress/block-editor/build-module/components/media-placeholder/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const media_placeholder_noop = () => {}; const InsertFromURLPopover = ({ src, onChange, onSubmit, onClose, popoverAnchor }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover, { anchor: popoverAnchor, onClose: onClose, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { className: "block-editor-media-placeholder__url-input-form", onSubmit: onSubmit, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('URL'), type: "text" // Use text instead of URL to allow relative paths (e.g., /image/image.jpg) , hideLabelFromVision: true, placeholder: (0,external_wp_i18n_namespaceObject.__)('Paste or type URL'), onChange: onChange, value: src, suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: keyboard_return, label: (0,external_wp_i18n_namespaceObject.__)('Apply'), type: "submit" }) }) }) }) }); const URLSelectionUI = ({ src, onChangeSrc, onSelectURL }) => { // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const [isURLInputVisible, setIsURLInputVisible] = (0,external_wp_element_namespaceObject.useState)(false); const openURLInput = () => { setIsURLInputVisible(true); }; const closeURLInput = () => { setIsURLInputVisible(false); popoverAnchor?.focus(); }; const onSubmitSrc = event => { event.preventDefault(); if (src && onSelectURL) { onSelectURL(src); closeURLInput(); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-media-placeholder__url-input-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-media-placeholder__button", onClick: openURLInput, isPressed: isURLInputVisible, variant: "secondary", "aria-haspopup": "dialog", ref: setPopoverAnchor, children: (0,external_wp_i18n_namespaceObject.__)('Insert from URL') }), isURLInputVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InsertFromURLPopover, { src: src, onChange: onChangeSrc, onSubmit: onSubmitSrc, onClose: closeURLInput, popoverAnchor: popoverAnchor })] }); }; function MediaPlaceholder({ value = {}, allowedTypes, className, icon, labels = {}, mediaPreview, notices, isAppender, accept, addToGallery, multiple = false, handleUpload = true, disableDropZone, disableMediaButtons, onError, onSelect, onCancel, onSelectURL, onToggleFeaturedImage, onDoubleClick, onFilesPreUpload = media_placeholder_noop, onHTMLDrop: deprecatedOnHTMLDrop, children, mediaLibraryButton, placeholder, style }) { if (deprecatedOnHTMLDrop) { external_wp_deprecated_default()('wp.blockEditor.MediaPlaceholder onHTMLDrop prop', { since: '6.2', version: '6.4' }); } const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(store); return getSettings().mediaUpload; }, []); const [src, setSrc] = (0,external_wp_element_namespaceObject.useState)(''); (0,external_wp_element_namespaceObject.useEffect)(() => { var _value$src; setSrc((_value$src = value?.src) !== null && _value$src !== void 0 ? _value$src : ''); }, [value?.src]); const onlyAllowsImages = () => { if (!allowedTypes || allowedTypes.length === 0) { return false; } return allowedTypes.every(allowedType => allowedType === 'image' || allowedType.startsWith('image/')); }; const onFilesUpload = files => { if (!handleUpload || typeof handleUpload === 'function' && !handleUpload(files)) { return onSelect(files); } onFilesPreUpload(files); let setMedia; if (multiple) { if (addToGallery) { // Since the setMedia function runs multiple times per upload group // and is passed newMedia containing every item in its group each time, we must // filter out whatever this upload group had previously returned to the // gallery before adding and returning the image array with replacement newMedia // values. // Define an array to store urls from newMedia between subsequent function calls. let lastMediaPassed = []; setMedia = newMedia => { // Remove any images this upload group is responsible for (lastMediaPassed). // Their replacements are contained in newMedia. const filteredMedia = (value !== null && value !== void 0 ? value : []).filter(item => { // If Item has id, only remove it if lastMediaPassed has an item with that id. if (item.id) { return !lastMediaPassed.some( // Be sure to convert to number for comparison. ({ id }) => Number(id) === Number(item.id)); } // Compare transient images via .includes since gallery may append extra info onto the url. return !lastMediaPassed.some(({ urlSlug }) => item.url.includes(urlSlug)); }); // Return the filtered media array along with newMedia. onSelect(filteredMedia.concat(newMedia)); // Reset lastMediaPassed and set it with ids and urls from newMedia. lastMediaPassed = newMedia.map(media => { // Add everything up to '.fileType' to compare via .includes. const cutOffIndex = media.url.lastIndexOf('.'); const urlSlug = media.url.slice(0, cutOffIndex); return { id: media.id, urlSlug }; }); }; } else { setMedia = onSelect; } } else { setMedia = ([media]) => onSelect(media); } mediaUpload({ allowedTypes, filesList: files, onFileChange: setMedia, onError, multiple }); }; async function handleBlocksDrop(event) { const { blocks } = parseDropEvent(event); if (!blocks?.length) { return; } const uploadedMediaList = await Promise.all(blocks.map(block => { const blockType = block.name.split('/')[1]; if (block.attributes.id) { block.attributes.type = blockType; return block.attributes; } return new Promise((resolve, reject) => { window.fetch(block.attributes.url).then(response => response.blob()).then(blob => mediaUpload({ filesList: [blob], additionalData: { title: block.attributes.title, alt_text: block.attributes.alt, caption: block.attributes.caption, type: blockType }, onFileChange: ([media]) => { if (media.id) { resolve(media); } }, allowedTypes, onError: reject })).catch(() => resolve(block.attributes.url)); }); })).catch(err => onError(err)); if (multiple) { onSelect(uploadedMediaList); } else { onSelect(uploadedMediaList[0]); } } const onUpload = event => { onFilesUpload(event.target.files); }; const defaultRenderPlaceholder = content => { let { instructions, title } = labels; if (!mediaUpload && !onSelectURL) { instructions = (0,external_wp_i18n_namespaceObject.__)('To edit this block, you need permission to upload media.'); } if (instructions === undefined || title === undefined) { const typesAllowed = allowedTypes !== null && allowedTypes !== void 0 ? allowedTypes : []; const [firstAllowedType] = typesAllowed; const isOneType = 1 === typesAllowed.length; const isAudio = isOneType && 'audio' === firstAllowedType; const isImage = isOneType && 'image' === firstAllowedType; const isVideo = isOneType && 'video' === firstAllowedType; if (instructions === undefined && mediaUpload) { instructions = (0,external_wp_i18n_namespaceObject.__)('Drag and drop an image or video, upload, or choose from your library.'); if (isAudio) { instructions = (0,external_wp_i18n_namespaceObject.__)('Drag and drop an audio file, upload, or choose from your library.'); } else if (isImage) { instructions = (0,external_wp_i18n_namespaceObject.__)('Drag and drop an image, upload, or choose from your library.'); } else if (isVideo) { instructions = (0,external_wp_i18n_namespaceObject.__)('Drag and drop a video, upload, or choose from your library.'); } } if (title === undefined) { title = (0,external_wp_i18n_namespaceObject.__)('Media'); if (isAudio) { title = (0,external_wp_i18n_namespaceObject.__)('Audio'); } else if (isImage) { title = (0,external_wp_i18n_namespaceObject.__)('Image'); } else if (isVideo) { title = (0,external_wp_i18n_namespaceObject.__)('Video'); } } } const placeholderClassName = dist_clsx('block-editor-media-placeholder', className, { 'is-appender': isAppender }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Placeholder, { icon: icon, label: title, instructions: instructions, className: placeholderClassName, notices: notices, onDoubleClick: onDoubleClick, preview: mediaPreview, style: style, children: [content, children] }); }; const renderPlaceholder = placeholder !== null && placeholder !== void 0 ? placeholder : defaultRenderPlaceholder; const renderDropZone = () => { if (disableDropZone) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: onFilesUpload, onDrop: handleBlocksDrop, isEligible: dataTransfer => { const prefix = 'wp-block:core/'; const types = []; for (const type of dataTransfer.types) { if (type.startsWith(prefix)) { types.push(type.slice(prefix.length)); } } return types.every(type => allowedTypes.includes(type)) && (multiple ? true : types.length === 1); } }); }; const renderCancelLink = () => { return onCancel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-media-placeholder__cancel-button", title: (0,external_wp_i18n_namespaceObject.__)('Cancel'), variant: "link", onClick: onCancel, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }); }; const renderUrlSelectionUI = () => { return onSelectURL && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(URLSelectionUI, { src: src, onChangeSrc: setSrc, onSelectURL: onSelectURL }); }; const renderFeaturedImageToggle = () => { return onToggleFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-media-placeholder__url-input-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-media-placeholder__button", onClick: onToggleFeaturedImage, variant: "secondary", children: (0,external_wp_i18n_namespaceObject.__)('Use featured image') }) }); }; const renderMediaUploadChecked = () => { const defaultButton = ({ open }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: () => { open(); }, children: (0,external_wp_i18n_namespaceObject.__)('Media Library') }); }; const libraryButton = mediaLibraryButton !== null && mediaLibraryButton !== void 0 ? mediaLibraryButton : defaultButton; const uploadMediaLibraryButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_upload, { addToGallery: addToGallery, gallery: multiple && onlyAllowsImages(), multiple: multiple, onSelect: onSelect, allowedTypes: allowedTypes, mode: "browse", value: Array.isArray(value) ? value.map(({ id }) => id) : value.id, render: libraryButton }); if (mediaUpload && isAppender) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [renderDropZone(), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { onChange: onUpload, accept: accept, multiple: !!multiple, render: ({ openFileDialog }) => { const content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", className: dist_clsx('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), onClick: openFileDialog, children: (0,external_wp_i18n_namespaceObject._x)('Upload', 'verb') }), uploadMediaLibraryButton, renderUrlSelectionUI(), renderFeaturedImageToggle(), renderCancelLink()] }); return renderPlaceholder(content); } })] }); } if (mediaUpload) { const content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [renderDropZone(), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { render: ({ openFileDialog }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: openFileDialog, variant: "primary", className: dist_clsx('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), children: (0,external_wp_i18n_namespaceObject._x)('Upload', 'verb') }), onChange: onUpload, accept: accept, multiple: !!multiple }), uploadMediaLibraryButton, renderUrlSelectionUI(), renderFeaturedImageToggle(), renderCancelLink()] }); return renderPlaceholder(content); } return renderPlaceholder(uploadMediaLibraryButton); }; if (disableMediaButtons) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(check, { children: renderDropZone() }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(check, { fallback: renderPlaceholder(renderUrlSelectionUI()), children: renderMediaUploadChecked() }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md */ /* harmony default export */ const media_placeholder = ((0,external_wp_components_namespaceObject.withFilters)('editor.MediaPlaceholder')(MediaPlaceholder)); ;// ./node_modules/@wordpress/block-editor/build-module/components/panel-color-settings/index.js /** * Internal dependencies */ const PanelColorSettings = ({ colorSettings, ...props }) => { const settings = colorSettings.map(setting => { if (!setting) { return setting; } const { value, onChange, ...otherSettings } = setting; return { ...otherSettings, colorValue: value, onColorChange: onChange }; }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_color_gradient_settings, { settings: settings, gradients: [], disableCustomGradients: true, ...props }); }; /* harmony default export */ const panel_color_settings = (PanelColorSettings); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const format_toolbar_POPOVER_PROPS = { placement: 'bottom-start' }; const FormatToolbar = () => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [['bold', 'italic', 'link', 'unknown'].map(format => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `RichText.ToolbarControls.${format}` }, format)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: "RichText.ToolbarControls", children: fills => { if (!fills.length) { return null; } const allProps = fills.map(([{ props }]) => props); const hasActive = allProps.some(({ isActive }) => isActive); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: chevron_down /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('More'), toggleProps: { ...toggleProps, className: dist_clsx(toggleProps.className, { 'is-pressed': hasActive }), description: (0,external_wp_i18n_namespaceObject.__)('Displays more block tools') }, controls: orderBy(fills.map(([{ props }]) => props), 'title'), popoverProps: format_toolbar_POPOVER_PROPS }) }); } })] }); }; /* harmony default export */ const format_toolbar = (FormatToolbar); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar-container.js /** * WordPress dependencies */ /** * Internal dependencies */ function InlineToolbar({ popoverAnchor }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { placement: "top", focusOnMount: false, anchor: popoverAnchor, className: "block-editor-rich-text__inline-format-toolbar", __unstableSlotName: "block-toolbar", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableToolbar, { className: "block-editor-rich-text__inline-format-toolbar-group" /* translators: accessibility text for the inline format toolbar */, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Format tools'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar, {}) }) }) }); } const FormatToolbarContainer = ({ inline, editableContentElement }) => { if (inline) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineToolbar, { popoverAnchor: editableContentElement }); } // Render regular toolbar. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { group: "inline", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar, {}) }); }; /* harmony default export */ const format_toolbar_container = (FormatToolbarContainer); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-mark-persistent.js /** * WordPress dependencies */ /** * Internal dependencies */ function useMarkPersistent({ html, value }) { const previousTextRef = (0,external_wp_element_namespaceObject.useRef)(); const hasActiveFormats = !!value.activeFormats?.length; const { __unstableMarkLastChangeAsPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); // Must be set synchronously to make sure it applies to the last change. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { // Ignore mount. if (!previousTextRef.current) { previousTextRef.current = value.text; return; } // Text input, so don't create an undo level for every character. // Create an undo level after 1 second of no input. if (previousTextRef.current !== value.text) { const timeout = window.setTimeout(() => { __unstableMarkLastChangeAsPersistent(); }, 1000); previousTextRef.current = value.text; return () => { window.clearTimeout(timeout); }; } __unstableMarkLastChangeAsPersistent(); }, [html, hasActiveFormats]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-format-types.js /** * WordPress dependencies */ function formatTypesSelector(select) { return select(external_wp_richText_namespaceObject.store).getFormatTypes(); } /** * Set of all interactive content tags. * * @see https://html.spec.whatwg.org/multipage/dom.html#interactive-content */ const interactiveContentTags = new Set(['a', 'audio', 'button', 'details', 'embed', 'iframe', 'input', 'label', 'select', 'textarea', 'video']); function prefixSelectKeys(selected, prefix) { if (typeof selected !== 'object') { return { [prefix]: selected }; } return Object.fromEntries(Object.entries(selected).map(([key, value]) => [`${prefix}.${key}`, value])); } function getPrefixedSelectKeys(selected, prefix) { if (selected[prefix]) { return selected[prefix]; } return Object.keys(selected).filter(key => key.startsWith(prefix + '.')).reduce((accumulator, key) => { accumulator[key.slice(prefix.length + 1)] = selected[key]; return accumulator; }, {}); } /** * This hook provides RichText with the `formatTypes` and its derived props from * experimental format type settings. * * @param {Object} $0 Options * @param {string} $0.clientId Block client ID. * @param {string} $0.identifier Block attribute. * @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formatting or not. * @param {Array} $0.allowedFormats Allowed formats */ function useFormatTypes({ clientId, identifier, withoutInteractiveFormatting, allowedFormats }) { const allFormatTypes = (0,external_wp_data_namespaceObject.useSelect)(formatTypesSelector, []); const formatTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { return allFormatTypes.filter(({ name, interactive, tagName }) => { if (allowedFormats && !allowedFormats.includes(name)) { return false; } if (withoutInteractiveFormatting && (interactive || interactiveContentTags.has(tagName))) { return false; } return true; }); }, [allFormatTypes, allowedFormats, withoutInteractiveFormatting]); const keyedSelected = (0,external_wp_data_namespaceObject.useSelect)(select => formatTypes.reduce((accumulator, type) => { if (!type.__experimentalGetPropsForEditableTreePreparation) { return accumulator; } return { ...accumulator, ...prefixSelectKeys(type.__experimentalGetPropsForEditableTreePreparation(select, { richTextIdentifier: identifier, blockClientId: clientId }), type.name) }; }, {}), [formatTypes, clientId, identifier]); const dispatch = (0,external_wp_data_namespaceObject.useDispatch)(); const prepareHandlers = []; const valueHandlers = []; const changeHandlers = []; const dependencies = []; for (const key in keyedSelected) { dependencies.push(keyedSelected[key]); } formatTypes.forEach(type => { if (type.__experimentalCreatePrepareEditableTree) { const handler = type.__experimentalCreatePrepareEditableTree(getPrefixedSelectKeys(keyedSelected, type.name), { richTextIdentifier: identifier, blockClientId: clientId }); if (type.__experimentalCreateOnChangeEditableValue) { valueHandlers.push(handler); } else { prepareHandlers.push(handler); } } if (type.__experimentalCreateOnChangeEditableValue) { let dispatchers = {}; if (type.__experimentalGetPropsForEditableTreeChangeHandler) { dispatchers = type.__experimentalGetPropsForEditableTreeChangeHandler(dispatch, { richTextIdentifier: identifier, blockClientId: clientId }); } const selected = getPrefixedSelectKeys(keyedSelected, type.name); changeHandlers.push(type.__experimentalCreateOnChangeEditableValue({ ...(typeof selected === 'object' ? selected : {}), ...dispatchers }, { richTextIdentifier: identifier, blockClientId: clientId })); } }); return { formatTypes, prepareHandlers, valueHandlers, changeHandlers, dependencies }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/before-input-rules.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * When typing over a selection, the selection will we wrapped by a matching * character pair. The second character is optional, it defaults to the first * character. * * @type {string[]} Array of character pairs. */ const wrapSelectionSettings = ['`', '"', "'", '“”', '‘’']; /* harmony default export */ const before_input_rules = (props => element => { function onInput(event) { const { inputType, data } = event; const { value, onChange, registry } = props.current; // Only run the rules when inserting text. if (inputType !== 'insertText') { return; } if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) { return; } const pair = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.wrapSelectionSettings', wrapSelectionSettings).find(([startChar, endChar]) => startChar === data || endChar === data); if (!pair) { return; } const [startChar, endChar = startChar] = pair; const start = value.start; const end = value.end + startChar.length; let newValue = (0,external_wp_richText_namespaceObject.insert)(value, startChar, start, start); newValue = (0,external_wp_richText_namespaceObject.insert)(newValue, endChar, end, end); const { __unstableMarkLastChangeAsPersistent, __unstableMarkAutomaticChange } = registry.dispatch(store); __unstableMarkLastChangeAsPersistent(); onChange(newValue); __unstableMarkAutomaticChange(); const init = {}; for (const key in event) { init[key] = event[key]; } init.data = endChar; const { ownerDocument } = element; const { defaultView } = ownerDocument; const newEvent = new defaultView.InputEvent('input', init); // Dispatch an `input` event with the new data. This will trigger the // input rules. // Postpone the `input` to the next event loop tick so that the dispatch // doesn't happen synchronously in the middle of `beforeinput` dispatch. // This is closer to how native `input` event would be timed, and also // makes sure that the `input` event is dispatched only after the `onChange` // call few lines above has fully updated the data store state and rerendered // all affected components. window.queueMicrotask(() => { event.target.dispatchEvent(newEvent); }); event.preventDefault(); } element.addEventListener('beforeinput', onInput); return () => { element.removeEventListener('beforeinput', onInput); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/prevent-event-discovery.js /** * WordPress dependencies */ function preventEventDiscovery(value) { const searchText = 'tales of gutenberg'; const addText = ' 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️'; const { start, text } = value; if (start < searchText.length) { return value; } const charactersBefore = text.slice(start - searchText.length, start); if (charactersBefore.toLowerCase() !== searchText) { return value; } return (0,external_wp_richText_namespaceObject.insert)(value, addText); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-rules.js /** * WordPress dependencies */ /** * Internal dependencies */ function findSelection(blocks) { let i = blocks.length; while (i--) { const attributeKey = retrieveSelectedAttribute(blocks[i].attributes); if (attributeKey) { blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey] // To do: refactor this to use rich text's selection instead, so // we no longer have to use on this hack inserting a special // character. .toString().replace(START_OF_SELECTED_AREA, ''); return [blocks[i].clientId, attributeKey, 0, 0]; } const nestedSelection = findSelection(blocks[i].innerBlocks); if (nestedSelection) { return nestedSelection; } } return []; } /* harmony default export */ const input_rules = (props => element => { function inputRule() { const { getValue, onReplace, selectionChange, registry } = props.current; if (!onReplace) { return; } // We must use getValue() here because value may be update // asynchronously. const value = getValue(); const { start, text } = value; const characterBefore = text.slice(start - 1, start); // The character right before the caret must be a plain space. if (characterBefore !== ' ') { return; } const trimmedTextBefore = text.slice(0, start).trim(); const prefixTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from').filter(({ type }) => type === 'prefix'); const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(prefixTransforms, ({ prefix }) => { return trimmedTextBefore === prefix; }); if (!transformation) { return; } const content = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: (0,external_wp_richText_namespaceObject.insert)(value, START_OF_SELECTED_AREA, 0, start) }); const block = transformation.transform(content); selectionChange(...findSelection([block])); onReplace([block]); registry.dispatch(store).__unstableMarkAutomaticChange(); return true; } function onInput(event) { const { inputType, type } = event; const { getValue, onChange, __unstableAllowPrefixTransformations, formatTypes, registry } = props.current; // Only run input rules when inserting text. if (inputType !== 'insertText' && type !== 'compositionend') { return; } if (__unstableAllowPrefixTransformations && inputRule()) { return; } const value = getValue(); const transformed = formatTypes.reduce((accumulator, { __unstableInputRule }) => { if (__unstableInputRule) { accumulator = __unstableInputRule(accumulator); } return accumulator; }, preventEventDiscovery(value)); const { __unstableMarkLastChangeAsPersistent, __unstableMarkAutomaticChange } = registry.dispatch(store); if (transformed !== value) { __unstableMarkLastChangeAsPersistent(); onChange({ ...transformed, activeFormats: value.activeFormats }); __unstableMarkAutomaticChange(); } } element.addEventListener('input', onInput); element.addEventListener('compositionend', onInput); return () => { element.removeEventListener('input', onInput); element.removeEventListener('compositionend', onInput); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/insert-replacement-text.js /** * Internal dependencies */ /** * When the browser is about to auto correct, add an undo level so the user can * revert the change. * * @param {Object} props */ /* harmony default export */ const insert_replacement_text = (props => element => { function onInput(event) { if (event.inputType !== 'insertReplacementText') { return; } const { registry } = props.current; registry.dispatch(store).__unstableMarkLastChangeAsPersistent(); } element.addEventListener('beforeinput', onInput); return () => { element.removeEventListener('beforeinput', onInput); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js /** * WordPress dependencies */ /** * Hook to prevent default behaviors for key combinations otherwise handled * internally by RichText. */ /* harmony default export */ const remove_browser_shortcuts = (() => node => { function onKeydown(event) { if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'z') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'y') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primaryShift(event, 'z')) { event.preventDefault(); } } node.addEventListener('keydown', onKeydown); return () => { node.removeEventListener('keydown', onKeydown); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/shortcuts.js /* harmony default export */ const shortcuts = (props => element => { const { keyboardShortcuts } = props.current; function onKeyDown(event) { for (const keyboardShortcut of keyboardShortcuts.current) { keyboardShortcut(event); } } element.addEventListener('keydown', onKeyDown); return () => { element.removeEventListener('keydown', onKeyDown); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-events.js /* harmony default export */ const input_events = (props => element => { const { inputEvents } = props.current; function onInput(event) { for (const keyboardShortcut of inputEvents.current) { keyboardShortcut(event); } } element.addEventListener('input', onInput); return () => { element.removeEventListener('input', onInput); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/undo-automatic-change.js /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ const undo_automatic_change = (props => element => { function onKeyDown(event) { const { keyCode } = event; if (event.defaultPrevented) { return; } if (keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) { return; } const { registry } = props.current; const { didAutomaticChange, getSettings } = registry.select(store); const { __experimentalUndo } = getSettings(); if (!__experimentalUndo) { return; } if (!didAutomaticChange()) { return; } event.preventDefault(); __experimentalUndo(); } element.addEventListener('keydown', onKeyDown); return () => { element.removeEventListener('keydown', onKeyDown); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js /** * WordPress dependencies */ function addActiveFormats(value, activeFormats) { if (activeFormats?.length) { let index = value.formats.length; while (index--) { value.formats[index] = [...activeFormats, ...(value.formats[index] || [])]; } } } /** * Get the multiline tag based on the multiline prop. * * @param {?(string|boolean)} multiline The multiline prop. * * @return {string | undefined} The multiline tag. */ function getMultilineTag(multiline) { if (multiline !== true && multiline !== 'p' && multiline !== 'li') { return; } return multiline === true ? 'p' : multiline; } function getAllowedFormats({ allowedFormats, disableFormats }) { if (disableFormats) { return getAllowedFormats.EMPTY_ARRAY; } return allowedFormats; } getAllowedFormats.EMPTY_ARRAY = []; /** * Creates a link from pasted URL. * Creates a paragraph block containing a link to the URL, and calls `onReplace`. * * @param {string} url The URL that could not be embedded. * @param {Function} onReplace Function to call with the created fallback block. */ function createLinkInParagraph(url, onReplace) { const link = /*#__PURE__*/_jsx("a", { href: url, children: url }); onReplace(createBlock('core/paragraph', { content: renderToString(link) })); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/paste-handler.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */ /* harmony default export */ const paste_handler = (props => element => { function _onPaste(event) { const { disableFormats, onChange, value, formatTypes, tagName, onReplace, __unstableEmbedURLOnPaste, preserveWhiteSpace, pastePlainText } = props.current; // The event listener is attached to the window, so we need to check if // the target is the element or inside the element. if (!element.contains(event.target)) { return; } if (event.defaultPrevented) { return; } const { plainText, html } = getPasteEventData(event); event.preventDefault(); // Allows us to ask for this information when we get a report. window.console.log('Received HTML:\n\n', html); window.console.log('Received plain text:\n\n', plainText); if (disableFormats) { onChange((0,external_wp_richText_namespaceObject.insert)(value, plainText)); return; } const isInternal = event.clipboardData.getData('rich-text') === 'true'; function pasteInline(content) { const transformed = formatTypes.reduce((accumulator, { __unstablePasteRule }) => { // Only allow one transform. if (__unstablePasteRule && accumulator === value) { accumulator = __unstablePasteRule(value, { html, plainText }); } return accumulator; }, value); if (transformed !== value) { onChange(transformed); } else { const valueToInsert = (0,external_wp_richText_namespaceObject.create)({ html: content }); addActiveFormats(valueToInsert, value.activeFormats); onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert)); } } // If the data comes from a rich text instance, we can directly use it // without filtering the data. The filters are only meant for externally // pasted content and remove inline styles. if (isInternal) { pasteInline(html); return; } if (pastePlainText) { onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ text: plainText }))); return; } let mode = 'INLINE'; const trimmedPlainText = plainText.trim(); if (__unstableEmbedURLOnPaste && (0,external_wp_richText_namespaceObject.isEmpty)(value) && (0,external_wp_url_namespaceObject.isURL)(trimmedPlainText) && // For the link pasting feature, allow only http(s) protocols. /^https?:/.test(trimmedPlainText)) { mode = 'BLOCKS'; } const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML: html, plainText, mode, tagName, preserveWhiteSpace }); if (typeof content === 'string') { pasteInline(content); } else if (content.length > 0) { if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) { onReplace(content, content.length - 1, -1); } } } const { defaultView } = element.ownerDocument; // Attach the listener to the window so parent elements have the chance to // prevent the default behavior. defaultView.addEventListener('paste', _onPaste); return () => { defaultView.removeEventListener('paste', _onPaste); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/delete.js /** * WordPress dependencies */ /* harmony default export */ const event_listeners_delete = (props => element => { function onKeyDown(event) { const { keyCode } = event; if (event.defaultPrevented) { return; } const { value, onMerge, onRemove } = props.current; if (keyCode === external_wp_keycodes_namespaceObject.DELETE || keyCode === external_wp_keycodes_namespaceObject.BACKSPACE) { const { start, end, text } = value; const isReverse = keyCode === external_wp_keycodes_namespaceObject.BACKSPACE; const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; // Only process delete if the key press occurs at an uncollapsed edge. if (!(0,external_wp_richText_namespaceObject.isCollapsed)(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) { return; } if (onMerge) { onMerge(!isReverse); } // Only handle remove on Backspace. This serves dual-purpose of being // an intentional user interaction distinguishing between Backspace and // Delete to remove the empty field, but also to avoid merge & remove // causing destruction of two fields (merge, then removed merged). else if (onRemove && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isReverse) { onRemove(!isReverse); } event.preventDefault(); } } element.addEventListener('keydown', onKeyDown); return () => { element.removeEventListener('keydown', onKeyDown); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/enter.js /** * WordPress dependencies */ /* harmony default export */ const enter = (props => element => { function onKeyDownDeprecated(event) { if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { return; } const { onReplace, onSplit } = props.current; if (onReplace && onSplit) { event.__deprecatedOnSplit = true; } } function onKeyDown(event) { if (event.defaultPrevented) { return; } // The event listener is attached to the window, so we need to check if // the target is the element. if (event.target !== element) { return; } if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { return; } const { value, onChange, disableLineBreaks, onSplitAtEnd, onSplitAtDoubleLineEnd, registry } = props.current; event.preventDefault(); const { text, start, end } = value; if (event.shiftKey) { if (!disableLineBreaks) { onChange((0,external_wp_richText_namespaceObject.insert)(value, '\n')); } } else if (onSplitAtEnd && start === end && end === text.length) { onSplitAtEnd(); } else if ( // For some blocks it's desirable to split at the end of the // block when there are two line breaks at the end of the // block, so triple Enter exits the block. onSplitAtDoubleLineEnd && start === end && end === text.length && text.slice(-2) === '\n\n') { registry.batch(() => { const _value = { ...value }; _value.start = _value.end - 2; onChange((0,external_wp_richText_namespaceObject.remove)(_value)); onSplitAtDoubleLineEnd(); }); } else if (!disableLineBreaks) { onChange((0,external_wp_richText_namespaceObject.insert)(value, '\n')); } } const { defaultView } = element.ownerDocument; // Attach the listener to the window so parent elements have the chance to // prevent the default behavior. defaultView.addEventListener('keydown', onKeyDown); element.addEventListener('keydown', onKeyDownDeprecated); return () => { defaultView.removeEventListener('keydown', onKeyDown); element.removeEventListener('keydown', onKeyDownDeprecated); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/firefox-compat.js /** * Internal dependencies */ /* harmony default export */ const firefox_compat = (props => element => { function onFocus() { const { registry } = props.current; if (!registry.select(store).isMultiSelecting()) { return; } // This is a little hack to work around focus issues with nested // editable elements in Firefox. For some reason the editable child // element sometimes regains focus, while it should not be focusable // and focus should remain on the editable parent element. // To do: try to find the cause of the shifting focus. const parentEditable = element.parentElement.closest('[contenteditable="true"]'); if (parentEditable) { parentEditable.focus(); } } element.addEventListener('focus', onFocus); return () => { element.removeEventListener('focus', onFocus); }; }); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const allEventListeners = [before_input_rules, input_rules, insert_replacement_text, remove_browser_shortcuts, shortcuts, input_events, undo_automatic_change, paste_handler, event_listeners_delete, enter, firefox_compat]; function useEventListeners(props) { const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); (0,external_wp_element_namespaceObject.useInsertionEffect)(() => { propsRef.current = props; }); const refEffects = (0,external_wp_element_namespaceObject.useMemo)(() => allEventListeners.map(refEffect => refEffect(propsRef)), [propsRef]); return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { if (!props.isSelected) { return; } const cleanups = refEffects.map(effect => effect(element)); return () => { cleanups.forEach(cleanup => cleanup()); }; }, [refEffects, props.isSelected]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-edit.js /** * WordPress dependencies */ /** * Internal dependencies */ const format_edit_DEFAULT_BLOCK_CONTEXT = {}; const usesContextKey = Symbol('usesContext'); function format_edit_Edit({ onChange, onFocus, value, forwardedRef, settings }) { const { name, edit: EditFunction, [usesContextKey]: usesContext } = settings; const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context); // Assign context values using the block type's declared context needs. const context = (0,external_wp_element_namespaceObject.useMemo)(() => { return usesContext ? Object.fromEntries(Object.entries(blockContext).filter(([key]) => usesContext.includes(key))) : format_edit_DEFAULT_BLOCK_CONTEXT; }, [usesContext, blockContext]); if (!EditFunction) { return null; } const activeFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name); const isActive = activeFormat !== undefined; const activeObject = (0,external_wp_richText_namespaceObject.getActiveObject)(value); const isObjectActive = activeObject !== undefined && activeObject.type === name; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditFunction, { isActive: isActive, activeAttributes: isActive ? activeFormat.attributes || {} : {}, isObjectActive: isObjectActive, activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {}, value: value, onChange: onChange, onFocus: onFocus, contentRef: forwardedRef, context: context }, name); } function FormatEdit({ formatTypes, ...props }) { return formatTypes.map(settings => /*#__PURE__*/(0,external_React_.createElement)(format_edit_Edit, { settings: settings, ...props, key: settings.name })); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/content.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Internal dependencies */ function valueToHTMLString(value, multiline) { if (rich_text.isEmpty(value)) { const multilineTag = getMultilineTag(multiline); return multilineTag ? `<${multilineTag}></${multilineTag}>` : ''; } if (Array.isArray(value)) { external_wp_deprecated_default()('wp.blockEditor.RichText value prop as children type', { since: '6.1', version: '6.3', alternative: 'value prop as string', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); return external_wp_blocks_namespaceObject.children.toHTML(value); } // To do: deprecate string type. if (typeof value === 'string') { return value; } // To do: create a toReactComponent method on RichTextData, which we // might in the future also use for the editable tree. See // https://github.com/WordPress/gutenberg/pull/41655. return value.toHTMLString(); } function Content({ value, tagName: Tag, multiline, format, ...props }) { value = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: valueToHTMLString(value, multiline) }); return Tag ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...props, children: value }) : value; } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/multiline.js /** * WordPress dependencies */ /** * Internal dependencies */ function RichTextMultiline({ children, identifier, tagName: TagName = 'div', value = '', onChange, multiline, ...props }, forwardedRef) { external_wp_deprecated_default()('wp.blockEditor.RichText multiline prop', { since: '6.1', version: '6.3', alternative: 'nested blocks (InnerBlocks)', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/nested-blocks-inner-blocks/' }); const { clientId } = useBlockEditContext(); const { getSelectionStart, getSelectionEnd } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); const multilineTagName = getMultilineTag(multiline); value = value || `<${multilineTagName}></${multilineTagName}>`; const padded = `</${multilineTagName}>${value}<${multilineTagName}>`; const values = padded.split(`</${multilineTagName}><${multilineTagName}>`); values.shift(); values.pop(); function _onChange(newValues) { onChange(`<${multilineTagName}>${newValues.join(`</${multilineTagName}><${multilineTagName}>`)}</${multilineTagName}>`); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ref: forwardedRef, children: values.map((_value, index) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RichTextWrapper, { identifier: `${identifier}-${index}`, tagName: multilineTagName, value: _value, onChange: newValue => { const newValues = values.slice(); newValues[index] = newValue; _onChange(newValues); }, isSelected: undefined, onKeyDown: event => { if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { return; } event.preventDefault(); const { offset: start } = getSelectionStart(); const { offset: end } = getSelectionEnd(); // Cannot split if there is no selection. if (typeof start !== 'number' || typeof end !== 'number') { return; } const richTextValue = (0,external_wp_richText_namespaceObject.create)({ html: _value }); richTextValue.start = start; richTextValue.end = end; const array = (0,external_wp_richText_namespaceObject.split)(richTextValue).map(v => (0,external_wp_richText_namespaceObject.toHTMLString)({ value: v })); const newValues = values.slice(); newValues.splice(index, 1, ...array); _onChange(newValues); selectionChange(clientId, `${identifier}-${index + 1}`, 0, 0); }, onMerge: forward => { const newValues = values.slice(); let offset = 0; if (forward) { if (!newValues[index + 1]) { return; } newValues.splice(index, 2, newValues[index] + newValues[index + 1]); offset = newValues[index].length - 1; } else { if (!newValues[index - 1]) { return; } newValues.splice(index - 1, 2, newValues[index - 1] + newValues[index]); offset = newValues[index - 1].length - 1; } _onChange(newValues); selectionChange(clientId, `${identifier}-${index - (forward ? 0 : 1)}`, offset, offset); }, ...props }, index); }) }); } /* harmony default export */ const multiline = ((0,external_wp_element_namespaceObject.forwardRef)(RichTextMultiline)); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/with-deprecations.js /** * WordPress dependencies */ /** * Internal dependencies */ function withDeprecations(Component) { return (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { let value = props.value; let onChange = props.onChange; // Handle deprecated format. if (Array.isArray(value)) { external_wp_deprecated_default()('wp.blockEditor.RichText value prop as children type', { since: '6.1', version: '6.3', alternative: 'value prop as string', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); value = external_wp_blocks_namespaceObject.children.toHTML(props.value); onChange = newValue => props.onChange(external_wp_blocks_namespaceObject.children.fromDOM((0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, newValue).childNodes)); } const NewComponent = props.multiline ? multiline : Component; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NewComponent, { ...props, value: value, onChange: onChange, ref: ref }); }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const keyboardShortcutContext = (0,external_wp_element_namespaceObject.createContext)(); const inputEventContext = (0,external_wp_element_namespaceObject.createContext)(); const instanceIdKey = Symbol('instanceId'); /** * Removes props used for the native version of RichText so that they are not * passed to the DOM element and log warnings. * * @param {Object} props Props to filter. * * @return {Object} Filtered props. */ function removeNativeProps(props) { const { __unstableMobileNoFocusOnMount, deleteEnter, placeholderTextColor, textAlign, selectionColor, tagsToEliminate, disableEditingMenu, fontSize, fontFamily, fontWeight, fontStyle, minWidth, maxWidth, disableSuggestions, disableAutocorrection, ...restProps } = props; return restProps; } function RichTextWrapper({ children, tagName = 'div', value: adjustedValue = '', onChange: adjustedOnChange, isSelected: originalIsSelected, multiline, inlineToolbar, wrapperClassName, autocompleters, onReplace, placeholder, allowedFormats, withoutInteractiveFormatting, onRemove, onMerge, onSplit, __unstableOnSplitAtEnd: onSplitAtEnd, __unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd, identifier, preserveWhiteSpace, __unstablePastePlainText: pastePlainText, __unstableEmbedURLOnPaste, __unstableDisableFormats: disableFormats, disableLineBreaks, __unstableAllowPrefixTransformations, readOnly, ...props }, forwardedRef) { props = removeNativeProps(props); if (onSplit) { external_wp_deprecated_default()('wp.blockEditor.RichText onSplit prop', { since: '6.4', alternative: 'block.json support key: "splitting"' }); } const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(RichTextWrapper); const anchorRef = (0,external_wp_element_namespaceObject.useRef)(); const context = useBlockEditContext(); const { clientId, isSelected: isBlockSelected, name: blockName } = context; const blockBindings = context[blockBindingsKey]; const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const selector = select => { // Avoid subscribing to the block editor store if the block is not // selected. if (!isBlockSelected) { return { isSelected: false }; } const { getSelectionStart, getSelectionEnd } = select(store); const selectionStart = getSelectionStart(); const selectionEnd = getSelectionEnd(); let isSelected; if (originalIsSelected === undefined) { isSelected = selectionStart.clientId === clientId && selectionEnd.clientId === clientId && (identifier ? selectionStart.attributeKey === identifier : selectionStart[instanceIdKey] === instanceId); } else if (originalIsSelected) { isSelected = selectionStart.clientId === clientId; } return { selectionStart: isSelected ? selectionStart.offset : undefined, selectionEnd: isSelected ? selectionEnd.offset : undefined, isSelected }; }; const { selectionStart, selectionEnd, isSelected } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId, identifier, instanceId, originalIsSelected, isBlockSelected]); const { disableBoundBlock, bindingsPlaceholder, bindingsLabel } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _fieldsList$relatedBi; if (!blockBindings?.[identifier] || !canBindBlock(blockName)) { return {}; } const relatedBinding = blockBindings[identifier]; const blockBindingsSource = (0,external_wp_blocks_namespaceObject.getBlockBindingsSource)(relatedBinding.source); const blockBindingsContext = {}; if (blockBindingsSource?.usesContext?.length) { for (const key of blockBindingsSource.usesContext) { blockBindingsContext[key] = blockContext[key]; } } const _disableBoundBlock = !blockBindingsSource?.canUserEditValue?.({ select, context: blockBindingsContext, args: relatedBinding.args }); // Don't modify placeholders if value is not empty. if (adjustedValue.length > 0) { return { disableBoundBlock: _disableBoundBlock, // Null values will make them fall back to the default behavior. bindingsPlaceholder: null, bindingsLabel: null }; } const { getBlockAttributes } = select(store); const blockAttributes = getBlockAttributes(clientId); const fieldsList = blockBindingsSource?.getFieldsList?.({ select, context: blockBindingsContext }); const bindingKey = (_fieldsList$relatedBi = fieldsList?.[relatedBinding?.args?.key]?.label) !== null && _fieldsList$relatedBi !== void 0 ? _fieldsList$relatedBi : blockBindingsSource?.label; const _bindingsPlaceholder = _disableBoundBlock ? bindingKey : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: connected field label or source label */ (0,external_wp_i18n_namespaceObject.__)('Add %s'), bindingKey); const _bindingsLabel = _disableBoundBlock ? relatedBinding?.args?.key || blockBindingsSource?.label : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: source label or key */ (0,external_wp_i18n_namespaceObject.__)('Empty %s; start writing to edit its value'), relatedBinding?.args?.key || blockBindingsSource?.label); return { disableBoundBlock: _disableBoundBlock, bindingsPlaceholder: blockAttributes?.placeholder || _bindingsPlaceholder, bindingsLabel: _bindingsLabel }; }, [blockBindings, identifier, blockName, adjustedValue, clientId, blockContext]); const shouldDisableEditing = readOnly || disableBoundBlock; const { getSelectionStart, getSelectionEnd, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); const adjustedAllowedFormats = getAllowedFormats({ allowedFormats, disableFormats }); const hasFormats = !adjustedAllowedFormats || adjustedAllowedFormats.length > 0; const onSelectionChange = (0,external_wp_element_namespaceObject.useCallback)((start, end) => { const selection = {}; const unset = start === undefined && end === undefined; const baseSelection = { clientId, [identifier ? 'attributeKey' : instanceIdKey]: identifier ? identifier : instanceId }; if (typeof start === 'number' || unset) { // If we are only setting the start (or the end below), which // means a partial selection, and we're not updating a selection // with the same client ID, abort. This means the selected block // is a parent block. if (end === undefined && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionEnd().clientId)) { return; } selection.start = { ...baseSelection, offset: start }; } if (typeof end === 'number' || unset) { if (start === undefined && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionStart().clientId)) { return; } selection.end = { ...baseSelection, offset: end }; } selectionChange(selection); }, [clientId, getBlockRootClientId, getSelectionEnd, getSelectionStart, identifier, instanceId, selectionChange]); const { formatTypes, prepareHandlers, valueHandlers, changeHandlers, dependencies } = useFormatTypes({ clientId, identifier, withoutInteractiveFormatting, allowedFormats: adjustedAllowedFormats }); function addEditorOnlyFormats(value) { return valueHandlers.reduce((accumulator, fn) => fn(accumulator, value.text), value.formats); } function removeEditorOnlyFormats(value) { formatTypes.forEach(formatType => { // Remove formats created by prepareEditableTree, because they are editor only. if (formatType.__experimentalCreatePrepareEditableTree) { value = (0,external_wp_richText_namespaceObject.removeFormat)(value, formatType.name, 0, value.text.length); } }); return value.formats; } function addInvisibleFormats(value) { return prepareHandlers.reduce((accumulator, fn) => fn(accumulator, value.text), value.formats); } const { value, getValue, onChange, ref: richTextRef } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ value: adjustedValue, onChange(html, { __unstableFormats, __unstableText }) { adjustedOnChange(html); Object.values(changeHandlers).forEach(changeHandler => { changeHandler(__unstableFormats, __unstableText); }); }, selectionStart, selectionEnd, onSelectionChange, placeholder: bindingsPlaceholder || placeholder, __unstableIsSelected: isSelected, __unstableDisableFormats: disableFormats, preserveWhiteSpace, __unstableDependencies: [...dependencies, tagName], __unstableAfterParse: addEditorOnlyFormats, __unstableBeforeSerialize: removeEditorOnlyFormats, __unstableAddInvisibleFormats: addInvisibleFormats }); const autocompleteProps = useBlockEditorAutocompleteProps({ onReplace, completers: autocompleters, record: value, onChange }); useMarkPersistent({ html: adjustedValue, value }); const keyboardShortcuts = (0,external_wp_element_namespaceObject.useRef)(new Set()); const inputEvents = (0,external_wp_element_namespaceObject.useRef)(new Set()); function onFocus() { anchorRef.current?.focus(); } const TagName = tagName; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboardShortcutContext.Provider, { value: keyboardShortcuts, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inputEventContext.Provider, { value: inputEvents, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Popover.__unstableSlotNameProvider, { value: "__unstable-block-tools-after", children: [children && children({ value, onChange, onFocus }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FormatEdit, { value: value, onChange: onChange, onFocus: onFocus, formatTypes: formatTypes, forwardedRef: anchorRef })] }) }) }), isSelected && hasFormats && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar_container, { inline: inlineToolbar, editableContentElement: anchorRef.current }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName // Overridable props. , { role: "textbox", "aria-multiline": !disableLineBreaks, "aria-readonly": shouldDisableEditing, ...props, // Unset draggable (coming from block props) for contentEditable // elements because it will interfere with multi block selection // when the contentEditable and draggable elements are the same // element. draggable: undefined, "aria-label": bindingsLabel || props['aria-label'] || placeholder, ...autocompleteProps, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ // Rich text ref must be first because its focus listener // must be set up before any other ref calls .focus() on // mount. richTextRef, forwardedRef, autocompleteProps.ref, props.ref, useEventListeners({ registry, getValue, onChange, __unstableAllowPrefixTransformations, formatTypes, onReplace, selectionChange, isSelected, disableFormats, value, tagName, onSplit, __unstableEmbedURLOnPaste, pastePlainText, onMerge, onRemove, removeEditorOnlyFormats, disableLineBreaks, onSplitAtEnd, onSplitAtDoubleLineEnd, keyboardShortcuts, inputEvents }), anchorRef]), contentEditable: !shouldDisableEditing, suppressContentEditableWarning: true, className: dist_clsx('block-editor-rich-text__editable', props.className, 'rich-text') // Setting tabIndex to 0 is unnecessary, the element is already // focusable because it's contentEditable. This also fixes a // Safari bug where it's not possible to Shift+Click multi // select blocks when Shift Clicking into an element with // tabIndex because Safari will focus the element. However, // Safari will correctly ignore nested contentEditable elements. , tabIndex: props.tabIndex === 0 && !shouldDisableEditing ? null : props.tabIndex, "data-wp-block-attribute-key": identifier })] }); } // This is the private API for the RichText component. // It allows access to all props, not just the public ones. const PrivateRichText = withDeprecations((0,external_wp_element_namespaceObject.forwardRef)(RichTextWrapper)); PrivateRichText.Content = Content; PrivateRichText.isEmpty = value => { return !value || value.length === 0; }; // This is the public API for the RichText component. // We wrap the PrivateRichText component to hide some props from the public API. /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md */ const PublicForwardedRichTextContainer = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { const context = useBlockEditContext(); const isPreviewMode = context[isPreviewModeKey]; if (isPreviewMode) { // Remove all non-content props. const { children, tagName: Tag = 'div', value, onChange, isSelected, multiline, inlineToolbar, wrapperClassName, autocompleters, onReplace, placeholder, allowedFormats, withoutInteractiveFormatting, onRemove, onMerge, onSplit, __unstableOnSplitAtEnd, __unstableOnSplitAtDoubleLineEnd, identifier, preserveWhiteSpace, __unstablePastePlainText, __unstableEmbedURLOnPaste, __unstableDisableFormats, disableLineBreaks, __unstableAllowPrefixTransformations, readOnly, ...contentProps } = removeNativeProps(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...contentProps, dangerouslySetInnerHTML: { __html: valueToHTMLString(value, multiline) } }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateRichText, { ref: ref, ...props, readOnly: false }); }); PublicForwardedRichTextContainer.Content = Content; PublicForwardedRichTextContainer.isEmpty = value => { return !value || value.length === 0; }; /* harmony default export */ const rich_text = (PublicForwardedRichTextContainer); ;// ./node_modules/@wordpress/block-editor/build-module/components/editable-text/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const EditableText = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rich_text, { ref: ref, ...props, __unstableDisableFormats: true }); }); EditableText.Content = ({ value = '', tagName: Tag = 'div', ...props }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...props, children: value }); }; /** * Renders an editable text input in which text formatting is not allowed. */ /* harmony default export */ const editable_text = (EditableText); ;// ./node_modules/@wordpress/block-editor/build-module/components/plain-text/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Render an auto-growing textarea allow users to fill any textual content. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/plain-text/README.md * * @example * ```jsx * import { registerBlockType } from '@wordpress/blocks'; * import { PlainText } from '@wordpress/block-editor'; * * registerBlockType( 'my-plugin/example-block', { * // ... * * attributes: { * content: { * type: 'string', * }, * }, * * edit( { className, attributes, setAttributes } ) { * return ( * <PlainText * className={ className } * value={ attributes.content } * onChange={ ( content ) => setAttributes( { content } ) } * /> * ); * }, * } ); * ```` * * @param {Object} props Component props. * @param {string} props.value String value of the textarea. * @param {Function} props.onChange Function called when the text value changes. * @param {Object} [props.ref] The component forwards the `ref` property to the `TextareaAutosize` component. * @return {Element} Plain text component */ const PlainText = (0,external_wp_element_namespaceObject.forwardRef)(({ __experimentalVersion, ...props }, ref) => { if (__experimentalVersion === 2) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editable_text, { ref: ref, ...props }); } const { className, onChange, ...remainingProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(lib/* default */.A, { ref: ref, className: dist_clsx('block-editor-plain-text', className), onChange: event => onChange(event.target.value), ...remainingProps }); }); /* harmony default export */ const plain_text = (PlainText); ;// ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/label.js /** * WordPress dependencies */ function ResponsiveBlockControlLabel({ property, viewport, desc }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResponsiveBlockControlLabel); const accessibleLabel = desc || (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: property name. 2: viewport name. */ (0,external_wp_i18n_namespaceObject._x)('Controls the %1$s property for %2$s viewports.', 'Text labelling a interface as controlling a given layout property (eg: margin) for a given screen size.'), property, viewport.label); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-describedby": `rbc-desc-${instanceId}`, children: viewport.label }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", id: `rbc-desc-${instanceId}`, children: accessibleLabel })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ResponsiveBlockControl(props) { const { title, property, toggleLabel, onIsResponsiveChange, renderDefaultControl, renderResponsiveControls, isResponsive = false, defaultLabel = { id: 'all', label: (0,external_wp_i18n_namespaceObject._x)('All', 'screen sizes') }, viewports = [{ id: 'small', label: (0,external_wp_i18n_namespaceObject.__)('Small screens') }, { id: 'medium', label: (0,external_wp_i18n_namespaceObject.__)('Medium screens') }, { id: 'large', label: (0,external_wp_i18n_namespaceObject.__)('Large screens') }] } = props; if (!title || !property || !renderDefaultControl) { return null; } const toggleControlLabel = toggleLabel || (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Property value for the control (eg: margin, padding, etc.). */ (0,external_wp_i18n_namespaceObject.__)('Use the same %s on all screen sizes.'), property); const toggleHelpText = (0,external_wp_i18n_namespaceObject.__)('Choose whether to use the same value for all screen sizes or a unique value for each screen size.'); const defaultControl = renderDefaultControl(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResponsiveBlockControlLabel, { property: property, viewport: defaultLabel }), defaultLabel); const defaultResponsiveControls = () => { return viewports.map(viewport => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: renderDefaultControl(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResponsiveBlockControlLabel, { property: property, viewport: viewport }), viewport) }, viewport.id)); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-responsive-block-control", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { className: "block-editor-responsive-block-control__title", children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-responsive-block-control__inner", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, className: "block-editor-responsive-block-control__toggle", label: toggleControlLabel, checked: !isResponsive, onChange: onIsResponsiveChange, help: toggleHelpText }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('block-editor-responsive-block-control__group', { 'is-responsive': isResponsive }), children: [!isResponsive && defaultControl, isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls())] })] })] }); } /* harmony default export */ const responsive_block_control = (ResponsiveBlockControl); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/shortcut.js /** * WordPress dependencies */ /** * Internal dependencies */ function RichTextShortcut({ character, type, onUse }) { const keyboardShortcuts = (0,external_wp_element_namespaceObject.useContext)(keyboardShortcutContext); const onUseRef = (0,external_wp_element_namespaceObject.useRef)(); onUseRef.current = onUse; (0,external_wp_element_namespaceObject.useEffect)(() => { function callback(event) { if (external_wp_keycodes_namespaceObject.isKeyboardEvent[type](event, character)) { onUseRef.current(); event.preventDefault(); } } keyboardShortcuts.current.add(callback); return () => { keyboardShortcuts.current.delete(callback); }; }, [character, type]); return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/toolbar-button.js /** * WordPress dependencies */ function RichTextToolbarButton({ name, shortcutType, shortcutCharacter, ...props }) { let shortcut; let fillName = 'RichText.ToolbarControls'; if (name) { fillName += `.${name}`; } if (shortcutType && shortcutCharacter) { shortcut = external_wp_keycodes_namespaceObject.displayShortcut[shortcutType](shortcutCharacter); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: fillName, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { ...props, shortcut: shortcut }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/input-event.js /** * WordPress dependencies */ /** * Internal dependencies */ function __unstableRichTextInputEvent({ inputType, onInput }) { const callbacks = (0,external_wp_element_namespaceObject.useContext)(inputEventContext); const onInputRef = (0,external_wp_element_namespaceObject.useRef)(); onInputRef.current = onInput; (0,external_wp_element_namespaceObject.useEffect)(() => { function callback(event) { if (event.inputType === inputType) { onInputRef.current(); event.preventDefault(); } } callbacks.current.add(callback); return () => { callbacks.current.delete(callback); }; }, [inputType]); return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/tool-selector/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const selectIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z" }) }); function ToolSelector(props, ref) { const mode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__unstableGetEditorMode(), []); const { __unstableSetEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", ...props, ref: ref, icon: mode === 'navigation' ? edit : selectIcon, "aria-expanded": isOpen, "aria-haspopup": "true", onClick: onToggle /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('Tools') }), popoverProps: { placement: 'bottom-start' }, renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NavigableMenu, { className: "block-editor-tool-selector__menu", role: "menu", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Tools'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { value: mode === 'navigation' ? 'navigation' : 'edit', onSelect: newMode => { __unstableSetEditorMode(newMode); }, choices: [{ value: 'navigation', label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: edit }), (0,external_wp_i18n_namespaceObject.__)('Write')] }), info: (0,external_wp_i18n_namespaceObject.__)('Focus on content.'), 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Write') }, { value: 'edit', label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [selectIcon, (0,external_wp_i18n_namespaceObject.__)('Design')] }), info: (0,external_wp_i18n_namespaceObject.__)('Edit layout and styles.'), 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Design') }] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-tool-selector__help", children: (0,external_wp_i18n_namespaceObject.__)('Tools provide different sets of interactions for blocks. Choose between simplified content tools (Write) and advanced visual editing tools (Design).') })] }) }); } /* harmony default export */ const tool_selector = ((0,external_wp_element_namespaceObject.forwardRef)(ToolSelector)); ;// ./node_modules/@wordpress/block-editor/build-module/components/unit-control/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function UnitControl({ units: unitsProp, ...props }) { const [availableUnits] = use_settings_useSettings('spacing.units'); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vw'], units: unitsProp }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { units: units, ...props }); } ;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js /** * WordPress dependencies */ const arrowLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) }); /* harmony default export */ const arrow_left = (arrowLeft); ;// ./node_modules/@wordpress/block-editor/build-module/components/url-input/button.js /** * WordPress dependencies */ /** * Internal dependencies */ class URLInputButton extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.toggle = this.toggle.bind(this); this.submitLink = this.submitLink.bind(this); this.state = { expanded: false }; } toggle() { this.setState({ expanded: !this.state.expanded }); } submitLink(event) { event.preventDefault(); this.toggle(); } render() { const { url, onChange } = this.props; const { expanded } = this.state; const buttonLabel = url ? (0,external_wp_i18n_namespaceObject.__)('Edit link') : (0,external_wp_i18n_namespaceObject.__)('Insert link'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-input__button", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", icon: library_link, label: buttonLabel, onClick: this.toggle, className: "components-toolbar__control", isPressed: !!url }), expanded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { className: "block-editor-url-input__button-modal", onSubmit: this.submitLink, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-input__button-modal-line", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-url-input__back", icon: arrow_left, label: (0,external_wp_i18n_namespaceObject.__)('Close'), onClick: this.toggle }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_input, { value: url || '', onChange: onChange, suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", icon: keyboard_return, label: (0,external_wp_i18n_namespaceObject.__)('Submit'), type: "submit" }) }) })] }) })] }); } } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md */ /* harmony default export */ const url_input_button = (URLInputButton); ;// ./node_modules/@wordpress/icons/build-module/library/image.js /** * WordPress dependencies */ const image_image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" }) }); /* harmony default export */ const library_image = (image_image); ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/image-url-input-ui.js /** * WordPress dependencies */ /** * Internal dependencies */ const LINK_DESTINATION_NONE = 'none'; const LINK_DESTINATION_CUSTOM = 'custom'; const LINK_DESTINATION_MEDIA = 'media'; const LINK_DESTINATION_ATTACHMENT = 'attachment'; const NEW_TAB_REL = ['noreferrer', 'noopener']; const ImageURLInputUI = ({ linkDestination, onChangeUrl, url, mediaType = 'image', mediaUrl, mediaLink, linkTarget, linkClass, rel, showLightboxSetting, lightboxEnabled, onSetLightbox, resetLightbox }) => { const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const openLinkUI = () => { setIsOpen(true); }; const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(false); const [urlInput, setUrlInput] = (0,external_wp_element_namespaceObject.useState)(null); const autocompleteRef = (0,external_wp_element_namespaceObject.useRef)(null); const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!wrapperRef.current) { return; } const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperRef.current)[0] || wrapperRef.current; nextFocusTarget.focus(); }, [isEditingLink, url, lightboxEnabled]); const startEditLink = () => { if (linkDestination === LINK_DESTINATION_MEDIA || linkDestination === LINK_DESTINATION_ATTACHMENT) { setUrlInput(''); } setIsEditingLink(true); }; const stopEditLink = () => { setIsEditingLink(false); }; const closeLinkUI = () => { setUrlInput(null); stopEditLink(); setIsOpen(false); }; const getUpdatedLinkTargetSettings = value => { const newLinkTarget = value ? '_blank' : undefined; let updatedRel; if (newLinkTarget) { const rels = (rel !== null && rel !== void 0 ? rel : '').split(' '); NEW_TAB_REL.forEach(relVal => { if (!rels.includes(relVal)) { rels.push(relVal); } }); updatedRel = rels.join(' '); } else { const rels = (rel !== null && rel !== void 0 ? rel : '').split(' ').filter(relVal => NEW_TAB_REL.includes(relVal) === false); updatedRel = rels.length ? rels.join(' ') : undefined; } return { linkTarget: newLinkTarget, rel: updatedRel }; }; const onFocusOutside = () => { return event => { // The autocomplete suggestions list renders in a separate popover (in a portal), // so onFocusOutside fails to detect that a click on a suggestion occurred in the // LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and // return to avoid the popover being closed. const autocompleteElement = autocompleteRef.current; if (autocompleteElement && autocompleteElement.contains(event.target)) { return; } setIsOpen(false); setUrlInput(null); stopEditLink(); }; }; const onSubmitLinkChange = () => { return event => { if (urlInput) { // It is possible the entered URL actually matches a named link destination. // This check will ensure our link destination is correct. const selectedDestination = getLinkDestinations().find(destination => destination.url === urlInput)?.linkDestination || LINK_DESTINATION_CUSTOM; onChangeUrl({ href: urlInput, linkDestination: selectedDestination, lightbox: { enabled: false } }); } stopEditLink(); setUrlInput(null); event.preventDefault(); }; }; const onLinkRemove = () => { onChangeUrl({ linkDestination: LINK_DESTINATION_NONE, href: '' }); }; const getLinkDestinations = () => { const linkDestinations = [{ linkDestination: LINK_DESTINATION_MEDIA, title: (0,external_wp_i18n_namespaceObject.__)('Link to image file'), url: mediaType === 'image' ? mediaUrl : undefined, icon: library_image }]; if (mediaType === 'image' && mediaLink) { linkDestinations.push({ linkDestination: LINK_DESTINATION_ATTACHMENT, title: (0,external_wp_i18n_namespaceObject.__)('Link to attachment page'), url: mediaType === 'image' ? mediaLink : undefined, icon: library_page }); } return linkDestinations; }; const onSetHref = value => { const linkDestinations = getLinkDestinations(); let linkDestinationInput; if (!value) { linkDestinationInput = LINK_DESTINATION_NONE; } else { linkDestinationInput = (linkDestinations.find(destination => { return destination.url === value; }) || { linkDestination: LINK_DESTINATION_CUSTOM }).linkDestination; } onChangeUrl({ linkDestination: linkDestinationInput, href: value }); }; const onSetNewTab = value => { const updatedLinkTarget = getUpdatedLinkTargetSettings(value); onChangeUrl(updatedLinkTarget); }; const onSetLinkRel = value => { onChangeUrl({ rel: value }); }; const onSetLinkClass = value => { onChangeUrl({ linkClass: value }); }; const advancedOptions = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'), onChange: onSetNewTab, checked: linkTarget === '_blank' }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Link rel'), value: rel !== null && rel !== void 0 ? rel : '', onChange: onSetLinkRel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Link CSS class'), value: linkClass || '', onChange: onSetLinkClass })] }); const linkEditorValue = urlInput !== null ? urlInput : url; const hideLightboxPanel = !lightboxEnabled || lightboxEnabled && !showLightboxSetting; const showLinkEditor = !linkEditorValue && hideLightboxPanel; const urlLabel = (getLinkDestinations().find(destination => destination.linkDestination === linkDestination) || {}).title; const PopoverChildren = () => { if (lightboxEnabled && showLightboxSetting && !url && !isEditingLink) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-popover__expand-on-click", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_fullscreen }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "text", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Enlarge on click') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "description", children: (0,external_wp_i18n_namespaceObject.__)('Scales the image with a lightbox effect') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: link_off, label: (0,external_wp_i18n_namespaceObject.__)('Disable enlarge on click'), onClick: () => { onSetLightbox?.(false); }, size: "compact" })] }); } else if (!url || isEditingLink) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover.LinkEditor, { className: "block-editor-format-toolbar__link-container-content", value: linkEditorValue, onChangeInputValue: setUrlInput, onSubmit: onSubmitLinkChange(), autocompleteRef: autocompleteRef }); } else if (url && !isEditingLink) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover.LinkViewer, { className: "block-editor-format-toolbar__link-container-content", url: url, onEditLinkClick: startEditLink, urlLabel: urlLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: link_off, label: (0,external_wp_i18n_namespaceObject.__)('Remove link'), onClick: () => { onLinkRemove(); resetLightbox?.(); }, size: "compact" })] }); } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: library_link, className: "components-toolbar__control", label: (0,external_wp_i18n_namespaceObject.__)('Link'), "aria-expanded": isOpen, onClick: openLinkUI, ref: setPopoverAnchor, isActive: !!url || lightboxEnabled && showLightboxSetting }), isOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover, { ref: wrapperRef, anchor: popoverAnchor, onFocusOutside: onFocusOutside(), onClose: closeLinkUI, renderSettings: hideLightboxPanel ? () => advancedOptions : null, additionalControls: showLinkEditor && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { children: [getLinkDestinations().map(link => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: link.icon, iconPosition: "left", onClick: () => { setUrlInput(null); onSetHref(link.url); stopEditLink(); }, children: link.title }, link.linkDestination)), showLightboxSetting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { className: "block-editor-url-popover__expand-on-click", icon: library_fullscreen, info: (0,external_wp_i18n_namespaceObject.__)('Scale the image with a lightbox effect.'), iconPosition: "left", onClick: () => { setUrlInput(null); onChangeUrl({ linkDestination: LINK_DESTINATION_NONE, href: '' }); onSetLightbox?.(true); stopEditLink(); }, children: (0,external_wp_i18n_namespaceObject.__)('Enlarge on click') }, "expand-on-click")] }), offset: 13, children: PopoverChildren() })] }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/preview-options/index.js /** * WordPress dependencies */ function PreviewOptions() { external_wp_deprecated_default()('wp.blockEditor.PreviewOptions', { version: '6.5' }); return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/use-resize-canvas/index.js /** * WordPress dependencies */ /** * Function to resize the editor window. * * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile) * * @return {Object} Inline styles to be added to resizable container. */ function useResizeCanvas(deviceType) { const [actualWidth, updateActualWidth] = (0,external_wp_element_namespaceObject.useState)(window.innerWidth); (0,external_wp_element_namespaceObject.useEffect)(() => { if (deviceType === 'Desktop') { return; } const resizeListener = () => updateActualWidth(window.innerWidth); window.addEventListener('resize', resizeListener); return () => { window.removeEventListener('resize', resizeListener); }; }, [deviceType]); const getCanvasWidth = device => { let deviceWidth; switch (device) { case 'Tablet': deviceWidth = 780; break; case 'Mobile': deviceWidth = 360; break; default: return null; } return deviceWidth < actualWidth ? deviceWidth : actualWidth; }; const contentInlineStyles = device => { const height = device === 'Mobile' ? '768px' : '1024px'; const marginVertical = '40px'; const marginHorizontal = 'auto'; switch (device) { case 'Tablet': case 'Mobile': return { width: getCanvasWidth(device), // Keeping margin styles separate to avoid warnings // when those props get overridden in the iframe component marginTop: marginVertical, marginBottom: marginVertical, marginLeft: marginHorizontal, marginRight: marginHorizontal, height, overflowY: 'auto' }; default: return { marginLeft: marginHorizontal, marginRight: marginHorizontal }; } }; return contentInlineStyles(deviceType); } ;// ./node_modules/@wordpress/block-editor/build-module/components/skip-to-selected-block/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/skip-to-selected-block/README.md */ function SkipToSelectedBlock() { const selectedBlockClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlockSelectionStart(), []); const ref = (0,external_wp_element_namespaceObject.useRef)(); useBlockElementRef(selectedBlockClientId, ref); const onClick = () => { ref.current?.focus(); }; return selectedBlockClientId ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", className: "block-editor-skip-to-selected-block", onClick: onClick, children: (0,external_wp_i18n_namespaceObject.__)('Skip to the selected block') }) : null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/multi-selection-inspector/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function MultiSelectionInspector() { const selectedBlockCount = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSelectedBlockCount(), []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: 2, className: "block-editor-multi-selection-inspector__card", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: library_copy, showColors: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-multi-selection-inspector__card-title", children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of blocks */ (0,external_wp_i18n_namespaceObject._n)('%d Block', '%d Blocks', selectedBlockCount), selectedBlockCount) })] }); } ;// ./node_modules/@wordpress/icons/build-module/library/cog.js /** * WordPress dependencies */ const cog = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z", clipRule: "evenodd" }) }); /* harmony default export */ const library_cog = (cog); ;// ./node_modules/@wordpress/icons/build-module/library/styles.js /** * WordPress dependencies */ const styles = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z" }) }); /* harmony default export */ const library_styles = (styles); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/utils.js /** * WordPress dependencies */ const TAB_SETTINGS = { name: 'settings', title: (0,external_wp_i18n_namespaceObject.__)('Settings'), value: 'settings', icon: library_cog }; const TAB_STYLES = { name: 'styles', title: (0,external_wp_i18n_namespaceObject.__)('Styles'), value: 'styles', icon: library_styles }; const TAB_LIST_VIEW = { name: 'list', title: (0,external_wp_i18n_namespaceObject.__)('List View'), value: 'list-view', icon: list_view }; ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/advanced-controls-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const AdvancedControls = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName); const hasFills = Boolean(fills && fills.length); if (!hasFills) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { className: "block-editor-block-inspector__advanced", title: (0,external_wp_i18n_namespaceObject.__)('Advanced'), initialOpen: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "advanced" }) }); }; /* harmony default export */ const advanced_controls_panel = (AdvancedControls); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/position-controls-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ const PositionControlsPanel = () => { const { selectedClientIds, selectedBlocks, hasPositionAttribute } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlocksByClientId, getSelectedBlockClientIds } = select(store); const selectedBlockClientIds = getSelectedBlockClientIds(); const _selectedBlocks = getBlocksByClientId(selectedBlockClientIds); return { selectedClientIds: selectedBlockClientIds, selectedBlocks: _selectedBlocks, hasPositionAttribute: _selectedBlocks?.some(({ attributes }) => !!attributes?.style?.position?.type) }; }, []); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const dropdownMenuProps = useToolsPanelDropdownMenuProps(); function resetPosition() { if (!selectedClientIds?.length || !selectedBlocks?.length) { return; } const attributesByClientId = Object.fromEntries(selectedBlocks?.map(({ clientId, attributes }) => [clientId, { style: utils_cleanEmptyObject({ ...attributes?.style, position: { ...attributes?.style?.position, type: undefined, top: undefined, right: undefined, bottom: undefined, left: undefined } }) }])); updateBlockAttributes(selectedClientIds, attributesByClientId, true); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { className: "block-editor-block-inspector__position", label: (0,external_wp_i18n_namespaceObject.__)('Position'), resetAll: resetPosition, dropdownMenuProps: dropdownMenuProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { isShownByDefault: hasPositionAttribute, label: (0,external_wp_i18n_namespaceObject.__)('Position'), hasValue: () => hasPositionAttribute, onDeselect: resetPosition, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "position" }) }) }); }; const PositionControls = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(inspector_controls_groups.position.name); const hasFills = Boolean(fills && fills.length); if (!hasFills) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionControlsPanel, {}); }; /* harmony default export */ const position_controls_panel = (PositionControls); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/settings-tab.js /** * Internal dependencies */ const SettingsTab = ({ showAdvancedControls = false }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "bindings" }), showAdvancedControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel, {}) })] }); /* harmony default export */ const settings_tab = (SettingsTab); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/styles-tab.js /** * WordPress dependencies */ /** * Internal dependencies */ const StylesTab = ({ blockName, clientId, hasBlockStyles }) => { const borderPanelLabel = useBorderPanelLabel({ blockName }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [hasBlockStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Styles'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_styles, { clientId: clientId }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "color", label: (0,external_wp_i18n_namespaceObject.__)('Color'), className: "color-block-support-panel__inner-wrapper" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "background", label: (0,external_wp_i18n_namespaceObject.__)('Background image') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "filter" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "typography", label: (0,external_wp_i18n_namespaceObject.__)('Typography') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "dimensions", label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "border", label: borderPanelLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "styles" })] }); }; /* harmony default export */ const styles_tab = (StylesTab); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js // List view tab restricts the blocks that may render to it via the // allowlist below. const allowlist = ['core/navigation']; const useIsListViewTabDisabled = blockName => { return !allowlist.includes(blockName); }; /* harmony default export */ const use_is_list_view_tab_disabled = (useIsListViewTabDisabled); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Tabs: inspector_controls_tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function InspectorControlsTabs({ blockName, clientId, hasBlockStyles, tabs }) { const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'); }, []); // The tabs panel will mount before fills are rendered to the list view // slot. This means the list view tab isn't initially included in the // available tabs so the panel defaults selection to the settings tab // which at the time is the first tab. This check allows blocks known to // include the list view tab to set it as the tab selected by default. const initialTabName = !use_is_list_view_tab_disabled(blockName) ? TAB_LIST_VIEW.name : undefined; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-inspector__tabs", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(inspector_controls_tabs_Tabs, { defaultTabId: initialTabName, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabList, { children: tabs.map(tab => showIconLabels ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.Tab, { tabId: tab.name, children: tab.title }, tab.name) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: tab.title, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.Tab, { tabId: tab.name, "aria-label": tab.title, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: tab.icon }) }) }, tab.name)) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_SETTINGS.name, focusable: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(settings_tab, { showAdvancedControls: !!blockName }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_STYLES.name, focusable: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_tab, { blockName: blockName, clientId: clientId, hasBlockStyles: hasBlockStyles }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_LIST_VIEW.name, focusable: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "list" }) })] }, clientId) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js /** * WordPress dependencies */ /** * Internal dependencies */ const use_inspector_controls_tabs_EMPTY_ARRAY = []; function getShowTabs(blockName, tabSettings = {}) { // Block specific setting takes precedence over generic default. if (tabSettings[blockName] !== undefined) { return tabSettings[blockName]; } // Use generic default if set over the Gutenberg experiment option. if (tabSettings.default !== undefined) { return tabSettings.default; } return true; } function useInspectorControlsTabs(blockName) { const tabs = []; const { bindings: bindingsGroup, border: borderGroup, color: colorGroup, default: defaultGroup, dimensions: dimensionsGroup, list: listGroup, position: positionGroup, styles: stylesGroup, typography: typographyGroup, effects: effectsGroup } = inspector_controls_groups; // List View Tab: If there are any fills for the list group add that tab. const listViewDisabled = use_is_list_view_tab_disabled(blockName); const listFills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(listGroup.name); const hasListFills = !listViewDisabled && !!listFills && listFills.length; // Styles Tab: Add this tab if there are any fills for block supports // e.g. border, color, spacing, typography, etc. const styleFills = [...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(borderGroup.name) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(colorGroup.name) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(dimensionsGroup.name) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(stylesGroup.name) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(typographyGroup.name) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(effectsGroup.name) || [])]; const hasStyleFills = styleFills.length; // Settings Tab: If we don't have multiple tabs to display // (i.e. both list view and styles), check only the default and position // InspectorControls slots. If we have multiple tabs, we'll need to check // the advanced controls slot as well to ensure they are rendered. const advancedFills = [...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(bindingsGroup.name) || [])]; const settingsFills = [...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(defaultGroup.name) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(positionGroup.name) || []), ...(hasListFills && hasStyleFills > 1 ? advancedFills : [])]; // Add the tabs in the order that they will default to if available. // List View > Settings > Styles. if (hasListFills) { tabs.push(TAB_LIST_VIEW); } if (settingsFills.length) { tabs.push(TAB_SETTINGS); } if (hasStyleFills) { tabs.push(TAB_STYLES); } const tabSettings = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(store).getSettings().blockInspectorTabs; }, []); const showTabs = getShowTabs(blockName, tabSettings); return showTabs ? tabs : use_inspector_controls_tabs_EMPTY_ARRAY; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBlockInspectorAnimationSettings(blockType) { return (0,external_wp_data_namespaceObject.useSelect)(select => { if (blockType) { const globalBlockInspectorAnimationSettings = select(store).getSettings().blockInspectorAnimation; // Get the name of the block that will allow it's children to be animated. const animationParent = globalBlockInspectorAnimationSettings?.animationParent; // Determine whether the animationParent block is a parent of the selected block. const { getSelectedBlockClientId, getBlockParentsByBlockName } = select(store); const _selectedBlockClientId = getSelectedBlockClientId(); const animationParentBlockClientId = getBlockParentsByBlockName(_selectedBlockClientId, animationParent, true)[0]; // If the selected block is not a child of the animationParent block, // and not an animationParent block itself, don't animate. if (!animationParentBlockClientId && blockType.name !== animationParent) { return null; } return globalBlockInspectorAnimationSettings?.[blockType.name]; } return null; }, [blockType]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-quick-navigation/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockQuickNavigation({ clientIds, onSelect }) { if (!clientIds.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: clientIds.map(clientId => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigationItem, { onSelect: onSelect, clientId: clientId }, clientId)) }); } function BlockQuickNavigationItem({ clientId, onSelect }) { const blockInformation = useBlockDisplayInformation(clientId); const blockTitle = useBlockDisplayTitle({ clientId, context: 'list-view' }); const { isSelected } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isBlockSelected, hasSelectedInnerBlock } = select(store); return { isSelected: isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, /* deep: */true) }; }, [clientId]); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, isPressed: isSelected, onClick: async () => { await selectBlock(clientId); if (onSelect) { onSelect(clientId); } }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: blockInformation?.icon }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { style: { textAlign: 'left' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { children: blockTitle }) })] }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockStylesPanel({ clientId }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Styles'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_styles, { clientId: clientId }) }); } function BlockInspector() { const { count, selectedBlockName, selectedBlockClientId, blockType, isSectionBlock } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlockClientId, getSelectedBlockCount, getBlockName, getParentSectionBlock, isSectionBlock: _isSectionBlock } = unlock(select(store)); const _selectedBlockClientId = getSelectedBlockClientId(); const renderedBlockClientId = getParentSectionBlock(_selectedBlockClientId) || getSelectedBlockClientId(); const _selectedBlockName = renderedBlockClientId && getBlockName(renderedBlockClientId); const _blockType = _selectedBlockName && (0,external_wp_blocks_namespaceObject.getBlockType)(_selectedBlockName); return { count: getSelectedBlockCount(), selectedBlockClientId: renderedBlockClientId, selectedBlockName: _selectedBlockName, blockType: _blockType, isSectionBlock: _isSectionBlock(renderedBlockClientId) }; }, []); const availableTabs = useInspectorControlsTabs(blockType?.name); const showTabs = availableTabs?.length > 1; // The block inspector animation settings will be completely // removed in the future to create an API which allows the block // inspector to transition between what it // displays based on the relationship between the selected block // and its parent, and only enable it if the parent is controlling // its children blocks. const blockInspectorAnimationSettings = useBlockInspectorAnimationSettings(blockType); const borderPanelLabel = useBorderPanelLabel({ blockName: selectedBlockName }); if (count > 1 && !isSectionBlock) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-inspector", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MultiSelectionInspector, {}), showTabs ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsTabs, { tabs: availableTabs }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "color", label: (0,external_wp_i18n_namespaceObject.__)('Color'), className: "color-block-support-panel__inner-wrapper" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "background", label: (0,external_wp_i18n_namespaceObject.__)('Background image') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "typography", label: (0,external_wp_i18n_namespaceObject.__)('Typography') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "dimensions", label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "border", label: borderPanelLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "styles" })] })] }); } const isSelectedBlockUnregistered = selectedBlockName === (0,external_wp_blocks_namespaceObject.getUnregisteredTypeHandlerName)(); /* * If the selected block is of an unregistered type, avoid showing it as an actual selection * because we want the user to focus on the unregistered block warning, not block settings. */ if (!blockType || !selectedBlockClientId || isSelectedBlockUnregistered) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0,external_wp_i18n_namespaceObject.__)('No block selected.') }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInspectorSingleBlockWrapper, { animate: blockInspectorAnimationSettings, wrapper: children => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AnimatedContainer, { blockInspectorAnimationSettings: blockInspectorAnimationSettings, selectedBlockClientId: selectedBlockClientId, children: children }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInspectorSingleBlock, { clientId: selectedBlockClientId, blockName: blockType.name, isSectionBlock: isSectionBlock }) }); } const BlockInspectorSingleBlockWrapper = ({ animate, wrapper, children }) => { return animate ? wrapper(children) : children; }; const AnimatedContainer = ({ blockInspectorAnimationSettings, selectedBlockClientId, children }) => { const animationOrigin = blockInspectorAnimationSettings && blockInspectorAnimationSettings.enterDirection === 'leftToRight' ? -50 : 50; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { animate: { x: 0, opacity: 1, transition: { ease: 'easeInOut', duration: 0.14 } }, initial: { x: animationOrigin, opacity: 0 }, children: children }, selectedBlockClientId); }; const BlockInspectorSingleBlock = ({ clientId, blockName, isSectionBlock }) => { const availableTabs = useInspectorControlsTabs(blockName); const showTabs = !isSectionBlock && availableTabs?.length > 1; const hasBlockStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); const blockStyles = getBlockStyles(blockName); return blockStyles && blockStyles.length > 0; }, [blockName]); const blockInformation = useBlockDisplayInformation(clientId); const borderPanelLabel = useBorderPanelLabel({ blockName }); const contentClientIds = (0,external_wp_data_namespaceObject.useSelect)(select => { // Avoid unnecessary subscription. if (!isSectionBlock) { return; } const { getClientIdsOfDescendants, getBlockName, getBlockEditingMode } = select(store); return getClientIdsOfDescendants(clientId).filter(current => getBlockName(current) !== 'core/list-item' && getBlockEditingMode(current) === 'contentOnly'); }, [isSectionBlock, clientId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-inspector", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_card, { ...blockInformation, className: blockInformation.isSynced && 'is-synced' }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_variation_transforms, { blockClientId: clientId }), showTabs && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsTabs, { hasBlockStyles: hasBlockStyles, clientId: clientId, blockName: blockName, tabs: availableTabs }), !showTabs && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [hasBlockStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesPanel, { clientId: clientId }), contentClientIds && contentClientIds?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Content'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, { clientIds: contentClientIds }) }), !isSectionBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "list" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "color", label: (0,external_wp_i18n_namespaceObject.__)('Color'), className: "color-block-support-panel__inner-wrapper" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "background", label: (0,external_wp_i18n_namespaceObject.__)('Background image') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "typography", label: (0,external_wp_i18n_namespaceObject.__)('Typography') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "dimensions", label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "border", label: borderPanelLabel }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "styles" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { group: "bindings" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel, {}) })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SkipToSelectedBlock, {}, "back")] }); }; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-inspector/README.md */ /* harmony default export */ const block_inspector = (BlockInspector); ;// ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @deprecated */ const __unstableUseClipboardHandler = () => { external_wp_deprecated_default()('__unstableUseClipboardHandler', { alternative: 'BlockCanvas or WritingFlow', since: '6.4', version: '6.7' }); return useClipboardHandler(); }; /** * @deprecated * @param {Object} props */ function CopyHandler(props) { external_wp_deprecated_default()('CopyHandler', { alternative: 'BlockCanvas or WritingFlow', since: '6.4', version: '6.7' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, ref: useClipboardHandler() }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/library.js /** * WordPress dependencies */ /** * Internal dependencies */ const library_noop = () => {}; function InserterLibrary({ rootClientId, clientId, isAppender, showInserterHelpPanel, showMostUsedBlocks = false, __experimentalInsertionIndex, __experimentalInitialTab, __experimentalInitialCategory, __experimentalFilterValue, onPatternCategorySelection, onSelect = library_noop, shouldFocusBlock = false, onClose }, ref) { const { destinationRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId } = select(store); const _rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined; return { destinationRootClientId: _rootClientId }; }, [clientId, rootClientId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterMenu, { onSelect: onSelect, rootClientId: destinationRootClientId, clientId: clientId, isAppender: isAppender, showInserterHelpPanel: showInserterHelpPanel, showMostUsedBlocks: showMostUsedBlocks, __experimentalInsertionIndex: __experimentalInsertionIndex, __experimentalFilterValue: __experimentalFilterValue, onPatternCategorySelection: onPatternCategorySelection, __experimentalInitialTab: __experimentalInitialTab, __experimentalInitialCategory: __experimentalInitialCategory, shouldFocusBlock: shouldFocusBlock, ref: ref, onClose: onClose }); } const PrivateInserterLibrary = (0,external_wp_element_namespaceObject.forwardRef)(InserterLibrary); function PublicInserterLibrary(props, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterLibrary, { ...props, onPatternCategorySelection: undefined, ref: ref }); } /* harmony default export */ const library = ((0,external_wp_element_namespaceObject.forwardRef)(PublicInserterLibrary)); ;// ./node_modules/@wordpress/block-editor/build-module/components/selection-scroll-into-view/index.js /** * WordPress dependencies */ /** * Scrolls the multi block selection end into view if not in view already. This * is important to do after selection by keyboard. * * @deprecated */ function MultiSelectScrollIntoView() { external_wp_deprecated_default()('wp.blockEditor.MultiSelectScrollIntoView', { hint: 'This behaviour is now built-in.', since: '5.8' }); return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/typewriter/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const isIE = window.navigator.userAgent.indexOf('Trident') !== -1; const arrowKeyCodes = new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT]); const initialTriggerPercentage = 0.75; function useTypewriter() { const hasSelectedBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasSelectedBlock(), []); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!hasSelectedBlock) { return; } const { ownerDocument } = node; const { defaultView } = ownerDocument; let scrollResizeRafId; let onKeyDownRafId; let caretRect; function onScrollResize() { if (scrollResizeRafId) { return; } scrollResizeRafId = defaultView.requestAnimationFrame(() => { computeCaretRectangle(); scrollResizeRafId = null; }); } function onKeyDown(event) { // Ensure the any remaining request is cancelled. if (onKeyDownRafId) { defaultView.cancelAnimationFrame(onKeyDownRafId); } // Use an animation frame for a smooth result. onKeyDownRafId = defaultView.requestAnimationFrame(() => { maintainCaretPosition(event); onKeyDownRafId = null; }); } /** * Maintains the scroll position after a selection change caused by a * keyboard event. * * @param {KeyboardEvent} event Keyboard event. */ function maintainCaretPosition({ keyCode }) { if (!isSelectionEligibleForScroll()) { return; } const currentCaretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); if (!currentCaretRect) { return; } // If for some reason there is no position set to be scrolled to, let // this be the position to be scrolled to in the future. if (!caretRect) { caretRect = currentCaretRect; return; } // Even though enabling the typewriter effect for arrow keys results in // a pleasant experience, it may not be the case for everyone, so, for // now, let's disable it. if (arrowKeyCodes.has(keyCode)) { // Reset the caret position to maintain. caretRect = currentCaretRect; return; } const diff = currentCaretRect.top - caretRect.top; if (diff === 0) { return; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(node); // The page must be scrollable. if (!scrollContainer) { return; } const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; const scrollY = windowScroll ? defaultView.scrollY : scrollContainer.scrollTop; const scrollContainerY = windowScroll ? 0 : scrollContainer.getBoundingClientRect().top; const relativeScrollPosition = windowScroll ? caretRect.top / defaultView.innerHeight : (caretRect.top - scrollContainerY) / (defaultView.innerHeight - scrollContainerY); // If the scroll position is at the start, the active editable element // is the last one, and the caret is positioned within the initial // trigger percentage of the page, do not scroll the page. // The typewriter effect should not kick in until an empty page has been // filled with the initial trigger percentage or the user scrolls // intentionally down. if (scrollY === 0 && relativeScrollPosition < initialTriggerPercentage && isLastEditableNode()) { // Reset the caret position to maintain. caretRect = currentCaretRect; return; } const scrollContainerHeight = windowScroll ? defaultView.innerHeight : scrollContainer.clientHeight; // Abort if the target scroll position would scroll the caret out of // view. if ( // The caret is under the lower fold. caretRect.top + caretRect.height > scrollContainerY + scrollContainerHeight || // The caret is above the upper fold. caretRect.top < scrollContainerY) { // Reset the caret position to maintain. caretRect = currentCaretRect; return; } if (windowScroll) { defaultView.scrollBy(0, diff); } else { scrollContainer.scrollTop += diff; } } /** * Adds a `selectionchange` listener to reset the scroll position to be * maintained. */ function addSelectionChangeListener() { ownerDocument.addEventListener('selectionchange', computeCaretRectOnSelectionChange); } /** * Resets the scroll position to be maintained during a `selectionchange` * event. Also removes the listener, so it acts as a one-time listener. */ function computeCaretRectOnSelectionChange() { ownerDocument.removeEventListener('selectionchange', computeCaretRectOnSelectionChange); computeCaretRectangle(); } /** * Resets the scroll position to be maintained. */ function computeCaretRectangle() { if (isSelectionEligibleForScroll()) { caretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); } } /** * Checks if the current situation is eligible for scroll: * - There should be one and only one block selected. * - The component must contain the selection. * - The active element must be contenteditable. */ function isSelectionEligibleForScroll() { return node.contains(ownerDocument.activeElement) && ownerDocument.activeElement.isContentEditable; } function isLastEditableNode() { const editableNodes = node.querySelectorAll('[contenteditable="true"]'); const lastEditableNode = editableNodes[editableNodes.length - 1]; return lastEditableNode === ownerDocument.activeElement; } // When the user scrolls or resizes, the scroll position should be // reset. defaultView.addEventListener('scroll', onScrollResize, true); defaultView.addEventListener('resize', onScrollResize, true); node.addEventListener('keydown', onKeyDown); node.addEventListener('keyup', maintainCaretPosition); node.addEventListener('mousedown', addSelectionChangeListener); node.addEventListener('touchstart', addSelectionChangeListener); return () => { defaultView.removeEventListener('scroll', onScrollResize, true); defaultView.removeEventListener('resize', onScrollResize, true); node.removeEventListener('keydown', onKeyDown); node.removeEventListener('keyup', maintainCaretPosition); node.removeEventListener('mousedown', addSelectionChangeListener); node.removeEventListener('touchstart', addSelectionChangeListener); ownerDocument.removeEventListener('selectionchange', computeCaretRectOnSelectionChange); defaultView.cancelAnimationFrame(scrollResizeRafId); defaultView.cancelAnimationFrame(onKeyDownRafId); }; }, [hasSelectedBlock]); } function Typewriter({ children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useTypewriter(), className: "block-editor__typewriter", children: children }); } /** * The exported component. The implementation of Typewriter faced technical * challenges in Internet Explorer, and is simply skipped, rendering the given * props children instead. * * @type {Component} */ const TypewriterOrIEBypass = isIE ? props => props.children : Typewriter; /** * Ensures that the text selection keeps the same vertical distance from the * viewport during keyboard events within this component. The vertical distance * can vary. It is the last clicked or scrolled to position. */ /* harmony default export */ const typewriter = (TypewriterOrIEBypass); ;// ./node_modules/@wordpress/block-editor/build-module/components/recursion-provider/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const RenderedRefsContext = (0,external_wp_element_namespaceObject.createContext)({}); /** * Immutably adds an unique identifier to a set scoped for a given block type. * * @param {Object} renderedBlocks Rendered blocks grouped by block name * @param {string} blockName Name of the block. * @param {*} uniqueId Any value that acts as a unique identifier for a block instance. * * @return {Object} The list of rendered blocks grouped by block name. */ function addToBlockType(renderedBlocks, blockName, uniqueId) { const result = { ...renderedBlocks, [blockName]: renderedBlocks[blockName] ? new Set(renderedBlocks[blockName]) : new Set() }; result[blockName].add(uniqueId); return result; } /** * A React context provider for use with the `useHasRecursion` hook to prevent recursive * renders. * * Wrap block content with this provider and provide the same `uniqueId` prop as used * with `useHasRecursion`. * * @param {Object} props * @param {*} props.uniqueId Any value that acts as a unique identifier for a block instance. * @param {string} props.blockName Optional block name. * @param {JSX.Element} props.children React children. * * @return {JSX.Element} A React element. */ function RecursionProvider({ children, uniqueId, blockName = '' }) { const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext); const { name } = useBlockEditContext(); blockName = blockName || name; const newRenderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => addToBlockType(previouslyRenderedBlocks, blockName, uniqueId), [previouslyRenderedBlocks, blockName, uniqueId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderedRefsContext.Provider, { value: newRenderedBlocks, children: children }); } /** * A React hook for keeping track of blocks previously rendered up in the block * tree. Blocks susceptible to recursion can use this hook in their `Edit` * function to prevent said recursion. * * Use this with the `RecursionProvider` component, using the same `uniqueId` value * for both the hook and the provider. * * @param {*} uniqueId Any value that acts as a unique identifier for a block instance. * @param {string} blockName Optional block name. * * @return {boolean} A boolean describing whether the provided id has already been rendered. */ function useHasRecursion(uniqueId, blockName = '') { const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext); const { name } = useBlockEditContext(); blockName = blockName || name; return Boolean(previouslyRenderedBlocks[blockName]?.has(uniqueId)); } const DeprecatedExperimentalRecursionProvider = props => { external_wp_deprecated_default()('wp.blockEditor.__experimentalRecursionProvider', { since: '6.5', alternative: 'wp.blockEditor.RecursionProvider' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RecursionProvider, { ...props }); }; const DeprecatedExperimentalUseHasRecursion = (...args) => { external_wp_deprecated_default()('wp.blockEditor.__experimentalUseHasRecursion', { since: '6.5', alternative: 'wp.blockEditor.useHasRecursion' }); return useHasRecursion(...args); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-popover-header/index.js /** * WordPress dependencies */ function InspectorPopoverHeader({ title, help, actions = [], onClose }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-inspector-popover-header", spacing: 4, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { className: "block-editor-inspector-popover-header__heading", level: 2, size: 13, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), actions.map(({ label, icon, onClick }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", className: "block-editor-inspector-popover-header__action", label: label, icon: icon, variant: !icon && 'tertiary', onClick: onClick, children: !icon && label }, label)), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "small", className: "block-editor-inspector-popover-header__action", label: (0,external_wp_i18n_namespaceObject.__)('Close'), icon: close_small, onClick: onClose })] }), help && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: help })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/publish-date-time-picker/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function PublishDateTimePicker({ onClose, onChange, showPopoverHeaderActions, isCompact, currentDate, ...additionalProps }, ref) { const datePickerProps = { startOfWeek: (0,external_wp_date_namespaceObject.getSettings)().l10n.startOfWeek, onChange, currentDate: isCompact ? undefined : currentDate, currentTime: isCompact ? currentDate : undefined, ...additionalProps }; const DatePickerComponent = isCompact ? external_wp_components_namespaceObject.TimePicker : external_wp_components_namespaceObject.DateTimePicker; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: ref, className: "block-editor-publish-date-time-picker", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)('Publish'), actions: showPopoverHeaderActions ? [{ label: (0,external_wp_i18n_namespaceObject.__)('Now'), onClick: () => onChange?.(null) }] : undefined, onClose: onClose }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DatePickerComponent, { ...datePickerProps })] }); } const PrivatePublishDateTimePicker = (0,external_wp_element_namespaceObject.forwardRef)(PublishDateTimePicker); function PublicPublishDateTimePicker(props, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePublishDateTimePicker, { ...props, showPopoverHeaderActions: true, isCompact: false, ref: ref }); } /* harmony default export */ const publish_date_time_picker = ((0,external_wp_element_namespaceObject.forwardRef)(PublicPublishDateTimePicker)); ;// ./node_modules/@wordpress/block-editor/build-module/components/index.js /* * Block Creation Components */ /* * Content Related Components */ /* * State Related Components */ ;// ./node_modules/@wordpress/block-editor/build-module/elements/index.js const elements_ELEMENT_CLASS_NAMES = { button: 'wp-element-button', caption: 'wp-element-caption' }; const __experimentalGetElementClassName = element => { return elements_ELEMENT_CLASS_NAMES[element] ? elements_ELEMENT_CLASS_NAMES[element] : ''; }; ;// ./node_modules/@wordpress/block-editor/build-module/utils/get-px-from-css-unit.js /** * This function was accidentally exposed for mobile/native usage. * * @deprecated * * @return {string} Empty string. */ /* harmony default export */ const get_px_from_css_unit = (() => ''); ;// ./node_modules/@wordpress/block-editor/build-module/utils/index.js ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/image-settings-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function useHasImageSettingsPanel(name, value, inheritedValue) { // Note: If lightbox `value` exists, that means it was // defined via the the Global Styles UI and will NOT // be a boolean value or contain the `allowEditing` property, // so we should show the settings panel in those cases. return name === 'core/image' && inheritedValue?.lightbox?.allowEditing || !!value?.lightbox; } function ImageSettingsPanel({ onChange, value, inheritedValue, panelId }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetLightbox = () => { onChange(undefined); }; const onChangeLightbox = newSetting => { onChange({ enabled: newSetting }); }; let lightboxChecked = false; if (inheritedValue?.lightbox?.enabled) { lightboxChecked = inheritedValue.lightbox.enabled; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject._x)('Settings', 'Image settings'), resetAll: resetLightbox, panelId: panelId, dropdownMenuProps: dropdownMenuProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem // We use the `userSettings` prop instead of `settings`, because `settings` // contains the core/theme values for the lightbox and we want to show the // "RESET" button ONLY when the user has explicitly set a value in the // Global Styles. , { hasValue: () => !!value?.lightbox, label: (0,external_wp_i18n_namespaceObject.__)('Enlarge on click'), onDeselect: resetLightbox, isShownByDefault: true, panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Enlarge on click'), checked: lightboxChecked, onChange: onChangeLightbox }) }) }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/advanced-panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function AdvancedPanel({ value, onChange, inheritedValue = value }) { // Custom CSS const [cssError, setCSSError] = (0,external_wp_element_namespaceObject.useState)(null); const customCSS = inheritedValue?.css; function handleOnChange(newValue) { onChange({ ...value, css: newValue }); if (cssError) { // Check if the new value is valid CSS, and pass a wrapping selector // to ensure that `transformStyles` validates the CSS. Note that the // wrapping selector here is not used in the actual output of any styles. const [transformed] = transform_styles([{ css: newValue }], '.for-validation-only'); if (transformed) { setCSSError(null); } } } function handleOnBlur(event) { if (!event?.target?.value) { setCSSError(null); return; } // Check if the new value is valid CSS, and pass a wrapping selector // to ensure that `transformStyles` validates the CSS. Note that the // wrapping selector here is not used in the actual output of any styles. const [transformed] = transform_styles([{ css: event.target.value }], '.for-validation-only'); setCSSError(transformed === null ? (0,external_wp_i18n_namespaceObject.__)('There is an error with your CSS structure.') : null); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [cssError && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "error", onRemove: () => setCSSError(null), children: cssError }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS'), __nextHasNoMarginBottom: true, value: customCSS, onChange: newValue => handleOnChange(newValue), onBlur: handleOnBlur, className: "block-editor-global-styles-advanced-panel__custom-css-input", spellCheck: false })] }); } ;// ./node_modules/memize/dist/index.js /** * Memize options object. * * @typedef MemizeOptions * * @property {number} [maxSize] Maximum size of the cache. */ /** * Internal cache entry. * * @typedef MemizeCacheNode * * @property {?MemizeCacheNode|undefined} [prev] Previous node. * @property {?MemizeCacheNode|undefined} [next] Next node. * @property {Array<*>} args Function arguments for cache * entry. * @property {*} val Function result. */ /** * Properties of the enhanced function for controlling cache. * * @typedef MemizeMemoizedFunction * * @property {()=>void} clear Clear the cache. */ /** * Accepts a function to be memoized, and returns a new memoized function, with * optional options. * * @template {(...args: any[]) => any} F * * @param {F} fn Function to memoize. * @param {MemizeOptions} [options] Options object. * * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. */ function memize(fn, options) { var size = 0; /** @type {?MemizeCacheNode|undefined} */ var head; /** @type {?MemizeCacheNode|undefined} */ var tail; options = options || {}; function memoized(/* ...args */) { var node = head, len = arguments.length, args, i; searchCache: while (node) { // Perform a shallow equality test to confirm that whether the node // under test is a candidate for the arguments passed. Two arrays // are shallowly equal if their length matches and each entry is // strictly equal between the two sets. Avoid abstracting to a // function which could incur an arguments leaking deoptimization. // Check whether node arguments match arguments length if (node.args.length !== arguments.length) { node = node.next; continue; } // Check whether node arguments match arguments values for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } // At this point we can assume we've found a match // Surface matched node to head if not already if (node !== head) { // As tail, shift to previous. Must only shift if not also // head, since if both head and tail, there is no previous. if (node === tail) { tail = node.prev; } // Adjust siblings to point to each other. If node was tail, // this also handles new tail's empty `next` assignment. /** @type {MemizeCacheNode} */ (node.prev).next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; /** @type {MemizeCacheNode} */ (head).prev = node; head = node; } // Return immediately return node.val; } // No cached value found. Continue to insertion phase: // Create a copy of arguments (avoid leaking deoptimization) args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args: args, // Generate the result from original function val: fn.apply(null, args), }; // Don't need to check whether node is already head, since it would // have been returned above already if it was // Shift existing head down list if (head) { head.prev = node; node.next = head; } else { // If no head, follows that there's no tail (at initial or reset) tail = node; } // Trim tail if we're reached max size and are pending cache insertion if (size === /** @type {MemizeOptions} */ (options).maxSize) { tail = /** @type {MemizeCacheNode} */ (tail).prev; /** @type {MemizeCacheNode} */ (tail).next = null; } else { size++; } head = node; return node.val; } memoized.clear = function () { head = null; tail = null; size = 0; }; // Ignore reason: There's not a clear solution to create an intersection of // the function with additional properties, where the goal is to retain the // function signature of the incoming argument and add control properties // on the return value. // @ts-ignore return memoized; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-global-styles-changes.js /** * External dependencies */ /** * WordPress dependencies */ const globalStylesChangesCache = new Map(); const get_global_styles_changes_EMPTY_ARRAY = []; const translationMap = { caption: (0,external_wp_i18n_namespaceObject.__)('Caption'), link: (0,external_wp_i18n_namespaceObject.__)('Link'), button: (0,external_wp_i18n_namespaceObject.__)('Button'), heading: (0,external_wp_i18n_namespaceObject.__)('Heading'), h1: (0,external_wp_i18n_namespaceObject.__)('H1'), h2: (0,external_wp_i18n_namespaceObject.__)('H2'), h3: (0,external_wp_i18n_namespaceObject.__)('H3'), h4: (0,external_wp_i18n_namespaceObject.__)('H4'), h5: (0,external_wp_i18n_namespaceObject.__)('H5'), h6: (0,external_wp_i18n_namespaceObject.__)('H6'), 'settings.color': (0,external_wp_i18n_namespaceObject.__)('Color'), 'settings.typography': (0,external_wp_i18n_namespaceObject.__)('Typography'), 'styles.color': (0,external_wp_i18n_namespaceObject.__)('Colors'), 'styles.spacing': (0,external_wp_i18n_namespaceObject.__)('Spacing'), 'styles.background': (0,external_wp_i18n_namespaceObject.__)('Background'), 'styles.typography': (0,external_wp_i18n_namespaceObject.__)('Typography') }; const getBlockNames = memize(() => (0,external_wp_blocks_namespaceObject.getBlockTypes)().reduce((accumulator, { name, title }) => { accumulator[name] = title; return accumulator; }, {})); const isObject = obj => obj !== null && typeof obj === 'object'; /** * Get the translation for a given global styles key. * @param {string} key A key representing a path to a global style property or setting. * @return {string|undefined} A translated key or undefined if no translation exists. */ function getTranslation(key) { if (translationMap[key]) { return translationMap[key]; } const keyArray = key.split('.'); if (keyArray?.[0] === 'blocks') { const blockName = getBlockNames()?.[keyArray[1]]; return blockName || keyArray[1]; } if (keyArray?.[0] === 'elements') { return translationMap[keyArray[1]] || keyArray[1]; } return undefined; } /** * A deep comparison of two objects, optimized for comparing global styles. * @param {Object} changedObject The changed object to compare. * @param {Object} originalObject The original object to compare against. * @param {string} parentPath A key/value pair object of block names and their rendered titles. * @return {string[]} An array of paths whose values have changed. */ function deepCompare(changedObject, originalObject, parentPath = '') { // We have two non-object values to compare. if (!isObject(changedObject) && !isObject(originalObject)) { /* * Only return a path if the value has changed. * And then only the path name up to 2 levels deep. */ return changedObject !== originalObject ? parentPath.split('.').slice(0, 2).join('.') : undefined; } // Enable comparison when an object doesn't have a corresponding property to compare. changedObject = isObject(changedObject) ? changedObject : {}; originalObject = isObject(originalObject) ? originalObject : {}; const allKeys = new Set([...Object.keys(changedObject), ...Object.keys(originalObject)]); let diffs = []; for (const key of allKeys) { const path = parentPath ? parentPath + '.' + key : key; const changedPath = deepCompare(changedObject[key], originalObject[key], path); if (changedPath) { diffs = diffs.concat(changedPath); } } return diffs; } /** * Returns an array of translated summarized global styles changes. * Results are cached using a Map() key of `JSON.stringify( { next, previous } )`. * * @param {Object} next The changed object to compare. * @param {Object} previous The original object to compare against. * @return {Array[]} A 2-dimensional array of tuples: [ "group", "translated change" ]. */ function getGlobalStylesChangelist(next, previous) { const cacheKey = JSON.stringify({ next, previous }); if (globalStylesChangesCache.has(cacheKey)) { return globalStylesChangesCache.get(cacheKey); } /* * Compare the two changesets with normalized keys. * The order of these keys determines the order in which * they'll appear in the results. */ const changedValueTree = deepCompare({ styles: { background: next?.styles?.background, color: next?.styles?.color, typography: next?.styles?.typography, spacing: next?.styles?.spacing }, blocks: next?.styles?.blocks, elements: next?.styles?.elements, settings: next?.settings }, { styles: { background: previous?.styles?.background, color: previous?.styles?.color, typography: previous?.styles?.typography, spacing: previous?.styles?.spacing }, blocks: previous?.styles?.blocks, elements: previous?.styles?.elements, settings: previous?.settings }); if (!changedValueTree.length) { globalStylesChangesCache.set(cacheKey, get_global_styles_changes_EMPTY_ARRAY); return get_global_styles_changes_EMPTY_ARRAY; } // Remove duplicate results. const result = [...new Set(changedValueTree)] /* * Translate the keys. * Remove empty translations. */.reduce((acc, curr) => { const translation = getTranslation(curr); if (translation) { acc.push([curr.split('.')[0], translation]); } return acc; }, []); globalStylesChangesCache.set(cacheKey, result); return result; } /** * From a getGlobalStylesChangelist() result, returns an array of translated global styles changes, grouped by type. * The types are 'blocks', 'elements', 'settings', and 'styles'. * * @param {Object} next The changed object to compare. * @param {Object} previous The original object to compare against. * @param {{maxResults:number}} options Options. maxResults: results to return before truncating. * @return {string[]} An array of translated changes. */ function getGlobalStylesChanges(next, previous, options = {}) { let changeList = getGlobalStylesChangelist(next, previous); const changesLength = changeList.length; const { maxResults } = options; if (changesLength) { // Truncate to `n` results if necessary. if (!!maxResults && changesLength > maxResults) { changeList = changeList.slice(0, maxResults); } return Object.entries(changeList.reduce((acc, curr) => { const group = acc[curr[0]] || []; if (!group.includes(curr[1])) { acc[curr[0]] = [...group, curr[1]]; } return acc; }, {})).map(([key, changeValues]) => { const changeValuesLength = changeValues.length; const joinedChangesValue = changeValues.join(/* translators: Used between list items, there is a space after the comma. */ (0,external_wp_i18n_namespaceObject.__)(', ') // eslint-disable-line @wordpress/i18n-no-flanking-whitespace ); switch (key) { case 'blocks': { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of block names separated by a comma. (0,external_wp_i18n_namespaceObject._n)('%s block.', '%s blocks.', changeValuesLength), joinedChangesValue); } case 'elements': { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of element names separated by a comma. (0,external_wp_i18n_namespaceObject._n)('%s element.', '%s elements.', changeValuesLength), joinedChangesValue); } case 'settings': { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of theme.json setting labels separated by a comma. (0,external_wp_i18n_namespaceObject.__)('%s settings.'), joinedChangesValue); } case 'styles': { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of theme.json top-level styles labels separated by a comma. (0,external_wp_i18n_namespaceObject.__)('%s styles.'), joinedChangesValue); } default: { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of global styles changes separated by a comma. (0,external_wp_i18n_namespaceObject.__)('%s.'), joinedChangesValue); } } }); } return get_global_styles_changes_EMPTY_ARRAY; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/get-rich-text-values.js /** * WordPress dependencies */ /** * Internal dependencies */ /* * This function is similar to `@wordpress/element`'s `renderToString` function, * except that it does not render the elements to a string, but instead collects * the values of all rich text `Content` elements. */ function addValuesForElement(element, values, innerBlocks) { if (null === element || undefined === element || false === element) { return; } if (Array.isArray(element)) { return addValuesForElements(element, values, innerBlocks); } switch (typeof element) { case 'string': case 'number': return; } const { type, props } = element; switch (type) { case external_wp_element_namespaceObject.StrictMode: case external_wp_element_namespaceObject.Fragment: return addValuesForElements(props.children, values, innerBlocks); case external_wp_element_namespaceObject.RawHTML: return; case inner_blocks.Content: return addValuesForBlocks(values, innerBlocks); case Content: values.push(props.value); return; } switch (typeof type) { case 'string': if (typeof props.children !== 'undefined') { return addValuesForElements(props.children, values, innerBlocks); } return; case 'function': const el = type.prototype && typeof type.prototype.render === 'function' ? new type(props).render() : type(props); return addValuesForElement(el, values, innerBlocks); } } function addValuesForElements(children, ...args) { children = Array.isArray(children) ? children : [children]; for (let i = 0; i < children.length; i++) { addValuesForElement(children[i], ...args); } } function addValuesForBlocks(values, blocks) { for (let i = 0; i < blocks.length; i++) { const { name, attributes, innerBlocks } = blocks[i]; const saveElement = (0,external_wp_blocks_namespaceObject.getSaveElement)(name, attributes, /*#__PURE__*/ // Instead of letting save elements use `useInnerBlocksProps.save`, // force them to use InnerBlocks.Content instead so we can intercept // a single component. (0,external_ReactJSXRuntime_namespaceObject.jsx)(inner_blocks.Content, {})); addValuesForElement(saveElement, values, innerBlocks); } } function getRichTextValues(blocks = []) { external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = true; const values = []; addValuesForBlocks(values, blocks); external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = false; return values.map(value => value instanceof external_wp_richText_namespaceObject.RichTextData ? value : external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value)); } ;// ./node_modules/@wordpress/block-editor/build-module/components/resizable-box-popover/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function ResizableBoxPopover({ clientId, resizableBoxProps, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { clientId: clientId, __unstablePopoverSlot: "block-toolbar", ...props, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { ...resizableBoxProps }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/checklist.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockTypesChecklist({ blockTypes, value, onItemChange }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "block-editor-block-manager__checklist", children: blockTypes.map(blockType => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-manager__checklist-item", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: blockType.title, checked: value.includes(blockType.name), onChange: (...args) => onItemChange(blockType, ...args) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: blockType.icon })] }, blockType.name)) }); } /* harmony default export */ const checklist = (BlockTypesChecklist); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/category.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockManagerCategory({ title, blockTypes, selectedBlockTypes, onChange }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory); const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)((blockType, nextIsChecked) => { if (nextIsChecked) { onChange([...selectedBlockTypes, blockType]); } else { onChange(selectedBlockTypes.filter(({ name }) => name !== blockType.name)); } }, [selectedBlockTypes, onChange]); const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)(nextIsChecked => { if (nextIsChecked) { onChange([...selectedBlockTypes, ...blockTypes.filter(blockType => !selectedBlockTypes.find(({ name }) => name === blockType.name))]); } else { onChange(selectedBlockTypes.filter(selectedBlockType => !blockTypes.find(({ name }) => name === selectedBlockType.name))); } }, [blockTypes, selectedBlockTypes, onChange]); if (!blockTypes.length) { return null; } const checkedBlockNames = blockTypes.map(({ name }) => name).filter(type => (selectedBlockTypes !== null && selectedBlockTypes !== void 0 ? selectedBlockTypes : []).some(selectedBlockType => selectedBlockType.name === type)); const titleId = 'block-editor-block-manager__category-title-' + instanceId; const isAllChecked = checkedBlockNames.length === blockTypes.length; const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { role: "group", "aria-labelledby": titleId, className: "block-editor-block-manager__category", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, checked: isAllChecked, onChange: toggleAllVisible, className: "block-editor-block-manager__category-title", indeterminate: isIndeterminate, label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: titleId, children: title }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(checklist, { blockTypes: blockTypes, value: checkedBlockNames, onItemChange: toggleVisible })] }); } /* harmony default export */ const block_manager_category = (BlockManagerCategory); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Provides a list of blocks with checkboxes. * * @param {Object} props Props. * @param {Array} props.blockTypes An array of blocks. * @param {Array} props.selectedBlockTypes An array of selected blocks. * @param {Function} props.onChange Function to be called when the selected blocks change. */ function BlockManager({ blockTypes, selectedBlockTypes, onChange }) { const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); const { categories, isMatchingSearchTerm } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { categories: select(external_wp_blocks_namespaceObject.store).getCategories(), isMatchingSearchTerm: select(external_wp_blocks_namespaceObject.store).isMatchingSearchTerm }; }, []); function enableAllBlockTypes() { onChange(blockTypes); } const filteredBlockTypes = blockTypes.filter(blockType => { return !search || isMatchingSearchTerm(blockType, search); }); const numberOfHiddenBlocks = blockTypes.length - selectedBlockTypes.length; // Announce search results on change (0,external_wp_element_namespaceObject.useEffect)(() => { if (!search) { return; } const count = filteredBlockTypes.length; const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); debouncedSpeak(resultsFoundMessage); }, [filteredBlockTypes?.length, search, debouncedSpeak]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-manager__content", children: [!!numberOfHiddenBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-manager__disabled-blocks-count", children: [(0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of blocks. */ (0,external_wp_i18n_namespaceObject._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: enableAllBlockTypes, children: (0,external_wp_i18n_namespaceObject.__)('Reset') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'), value: search, onChange: nextSearch => setSearch(nextSearch), className: "block-editor-block-manager__search" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { tabIndex: "0", role: "region", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'), className: "block-editor-block-manager__results", children: [filteredBlockTypes.length === 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-manager__no-results", children: (0,external_wp_i18n_namespaceObject.__)('No blocks found.') }), categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_manager_category, { title: category.title, blockTypes: filteredBlockTypes.filter(blockType => blockType.category === category.slug), selectedBlockTypes: selectedBlockTypes, onChange: onChange }, category.slug)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_manager_category, { title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'), blockTypes: filteredBlockTypes.filter(({ category }) => !category), selectedBlockTypes: selectedBlockTypes, onChange: onChange })] })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-removal-warning-modal/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockRemovalWarningModal({ rules }) { const { clientIds, selectPrevious, message } = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getRemovalPromptData()); const { clearBlockRemovalPrompt, setBlockRemovalRules, privateRemoveBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); // Load block removal rules, simultaneously signalling that the block // removal prompt is in place. (0,external_wp_element_namespaceObject.useEffect)(() => { setBlockRemovalRules(rules); return () => { setBlockRemovalRules(); }; }, [rules, setBlockRemovalRules]); if (!message) { return; } const onConfirmRemoval = () => { privateRemoveBlocks(clientIds, selectPrevious, /* force */true); clearBlockRemovalPrompt(); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Be careful!'), onRequestClose: clearBlockRemovalPrompt, size: "medium", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: message }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: clearBlockRemovalPrompt, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", onClick: onConfirmRemoval, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)('Delete') })] })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/scale-tool.js /** * WordPress dependencies */ /** * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps */ /** * The descriptions are purposely made generic as object-fit could be used for * any replaced element. Provide your own set of options if you need different * help text or labels. * * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Replaced_element * * @type {SelectControlProps[]} */ const DEFAULT_SCALE_OPTIONS = [{ value: 'fill', label: (0,external_wp_i18n_namespaceObject._x)('Fill', 'Scale option for dimensions control'), help: (0,external_wp_i18n_namespaceObject.__)('Fill the space by stretching the content.') }, { value: 'contain', label: (0,external_wp_i18n_namespaceObject._x)('Contain', 'Scale option for dimensions control'), help: (0,external_wp_i18n_namespaceObject.__)('Fit the content to the space without clipping.') }, { value: 'cover', label: (0,external_wp_i18n_namespaceObject._x)('Cover', 'Scale option for dimensions control'), help: (0,external_wp_i18n_namespaceObject.__)("Fill the space by clipping what doesn't fit.") }, { value: 'none', label: (0,external_wp_i18n_namespaceObject._x)('None', 'Scale option for dimensions control'), help: (0,external_wp_i18n_namespaceObject.__)('Do not adjust the sizing of the content. Content that is too large will be clipped, and content that is too small will have additional padding.') }, { value: 'scale-down', label: (0,external_wp_i18n_namespaceObject._x)('Scale down', 'Scale option for dimensions control'), help: (0,external_wp_i18n_namespaceObject.__)('Scale down the content to fit the space if it is too big. Content that is too small will have additional padding.') }]; /** * @callback ScaleToolPropsOnChange * @param {string} nextValue New scale value. * @return {void} */ /** * @typedef {Object} ScaleToolProps * @property {string} [panelId] ID of the panel that contains the controls. * @property {string} [value] Current scale value. * @property {ScaleToolPropsOnChange} [onChange] Callback to update the scale value. * @property {SelectControlProps[]} [options] Scale options. * @property {string} [defaultValue] Default scale value. * @property {boolean} [showControl=true] Whether to show the control. * @property {boolean} [isShownByDefault=true] Whether the tool panel is shown by default. */ /** * A tool to select the CSS object-fit property for the image. * * @param {ScaleToolProps} props * * @return {import('react').ReactElement} The scale tool. */ function ScaleTool({ panelId, value, onChange, options = DEFAULT_SCALE_OPTIONS, defaultValue = DEFAULT_SCALE_OPTIONS[0].value, isShownByDefault = true }) { // Match the CSS default so if the value is used directly in CSS it will look correct in the control. const displayValue = value !== null && value !== void 0 ? value : 'fill'; const scaleHelp = (0,external_wp_element_namespaceObject.useMemo)(() => { return options.reduce((acc, option) => { acc[option.value] = option.help; return acc; }, {}); }, [options]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Scale'), isShownByDefault: isShownByDefault, hasValue: () => displayValue !== defaultValue, onDeselect: () => onChange(defaultValue), panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Scale'), isBlock: true, help: scaleHelp[displayValue], value: displayValue, onChange: onChange, size: "__unstable-large", children: options.map(option => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { ...option }, option.value)) }) }); } ;// ./node_modules/@babel/runtime/helpers/esm/extends.js function extends_extends() { return extends_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, extends_extends.apply(null, arguments); } ;// ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js function memoize(fn) { var cache = Object.create(null); return function (arg) { if (cache[arg] === undefined) cache[arg] = fn(arg); return cache[arg]; }; } ;// ./node_modules/@emotion/styled/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23 var isPropValid = /* #__PURE__ */memoize(function (prop) { return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 /* o */ && prop.charCodeAt(1) === 110 /* n */ && prop.charCodeAt(2) < 91; } /* Z+1 */ ); ;// ./node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js /* Based off glamor's StyleSheet, thanks Sunil ❤️ high performance StyleSheet for css-in-js systems - uses multiple style tags behind the scenes for millions of rules - uses `insertRule` for appending in production for *much* faster performance // usage import { StyleSheet } from '@emotion/sheet' let styleSheet = new StyleSheet({ key: '', container: document.head }) styleSheet.insert('#box { border: 1px solid red; }') - appends a css rule into the stylesheet styleSheet.flush() - empties the stylesheet of all its contents */ // $FlowFixMe function sheetForTag(tag) { if (tag.sheet) { // $FlowFixMe return tag.sheet; } // this weirdness brought to you by firefox /* istanbul ignore next */ for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { // $FlowFixMe return document.styleSheets[i]; } } } function createStyleElement(options) { var tag = document.createElement('style'); tag.setAttribute('data-emotion', options.key); if (options.nonce !== undefined) { tag.setAttribute('nonce', options.nonce); } tag.appendChild(document.createTextNode('')); tag.setAttribute('data-s', ''); return tag; } var StyleSheet = /*#__PURE__*/function () { // Using Node instead of HTMLElement since container may be a ShadowRoot function StyleSheet(options) { var _this = this; this._insertTag = function (tag) { var before; if (_this.tags.length === 0) { if (_this.insertionPoint) { before = _this.insertionPoint.nextSibling; } else if (_this.prepend) { before = _this.container.firstChild; } else { before = _this.before; } } else { before = _this.tags[_this.tags.length - 1].nextSibling; } _this.container.insertBefore(tag, before); _this.tags.push(tag); }; this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy; this.tags = []; this.ctr = 0; this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets this.key = options.key; this.container = options.container; this.prepend = options.prepend; this.insertionPoint = options.insertionPoint; this.before = null; } var _proto = StyleSheet.prototype; _proto.hydrate = function hydrate(nodes) { nodes.forEach(this._insertTag); }; _proto.insert = function insert(rule) { // the max length is how many rules we have per style tag, it's 65000 in speedy mode // it's 1 in dev because we insert source maps that map a single rule to a location // and you can only have one source map per style tag if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { this._insertTag(createStyleElement(this)); } var tag = this.tags[this.tags.length - 1]; if (false) { var isImportRule; } if (this.isSpeedy) { var sheet = sheetForTag(tag); try { // this is the ultrafast version, works across browsers // the big drawback is that the css won't be editable in devtools sheet.insertRule(rule, sheet.cssRules.length); } catch (e) { if (false) {} } } else { tag.appendChild(document.createTextNode(rule)); } this.ctr++; }; _proto.flush = function flush() { // $FlowFixMe this.tags.forEach(function (tag) { return tag.parentNode && tag.parentNode.removeChild(tag); }); this.tags = []; this.ctr = 0; if (false) {} }; return StyleSheet; }(); ;// ./node_modules/stylis/src/Utility.js /** * @param {number} * @return {number} */ var abs = Math.abs /** * @param {number} * @return {string} */ var Utility_from = String.fromCharCode /** * @param {object} * @return {object} */ var Utility_assign = Object.assign /** * @param {string} value * @param {number} length * @return {number} */ function hash (value, length) { return Utility_charat(value, 0) ^ 45 ? (((((((length << 2) ^ Utility_charat(value, 0)) << 2) ^ Utility_charat(value, 1)) << 2) ^ Utility_charat(value, 2)) << 2) ^ Utility_charat(value, 3) : 0 } /** * @param {string} value * @return {string} */ function trim (value) { return value.trim() } /** * @param {string} value * @param {RegExp} pattern * @return {string?} */ function Utility_match (value, pattern) { return (value = pattern.exec(value)) ? value[0] : value } /** * @param {string} value * @param {(string|RegExp)} pattern * @param {string} replacement * @return {string} */ function Utility_replace (value, pattern, replacement) { return value.replace(pattern, replacement) } /** * @param {string} value * @param {string} search * @return {number} */ function indexof (value, search) { return value.indexOf(search) } /** * @param {string} value * @param {number} index * @return {number} */ function Utility_charat (value, index) { return value.charCodeAt(index) | 0 } /** * @param {string} value * @param {number} begin * @param {number} end * @return {string} */ function Utility_substr (value, begin, end) { return value.slice(begin, end) } /** * @param {string} value * @return {number} */ function Utility_strlen (value) { return value.length } /** * @param {any[]} value * @return {number} */ function Utility_sizeof (value) { return value.length } /** * @param {any} value * @param {any[]} array * @return {any} */ function Utility_append (value, array) { return array.push(value), value } /** * @param {string[]} array * @param {function} callback * @return {string} */ function Utility_combine (array, callback) { return array.map(callback).join('') } ;// ./node_modules/stylis/src/Tokenizer.js var line = 1 var column = 1 var Tokenizer_length = 0 var Tokenizer_position = 0 var Tokenizer_character = 0 var characters = '' /** * @param {string} value * @param {object | null} root * @param {object | null} parent * @param {string} type * @param {string[] | string} props * @param {object[] | string} children * @param {number} length */ function node (value, root, parent, type, props, children, length) { return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''} } /** * @param {object} root * @param {object} props * @return {object} */ function Tokenizer_copy (root, props) { return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props) } /** * @return {number} */ function Tokenizer_char () { return Tokenizer_character } /** * @return {number} */ function prev () { Tokenizer_character = Tokenizer_position > 0 ? Utility_charat(characters, --Tokenizer_position) : 0 if (column--, Tokenizer_character === 10) column = 1, line-- return Tokenizer_character } /** * @return {number} */ function next () { Tokenizer_character = Tokenizer_position < Tokenizer_length ? Utility_charat(characters, Tokenizer_position++) : 0 if (column++, Tokenizer_character === 10) column = 1, line++ return Tokenizer_character } /** * @return {number} */ function peek () { return Utility_charat(characters, Tokenizer_position) } /** * @return {number} */ function caret () { return Tokenizer_position } /** * @param {number} begin * @param {number} end * @return {string} */ function slice (begin, end) { return Utility_substr(characters, begin, end) } /** * @param {number} type * @return {number} */ function token (type) { switch (type) { // \0 \t \n \r \s whitespace token case 0: case 9: case 10: case 13: case 32: return 5 // ! + , / > @ ~ isolate token case 33: case 43: case 44: case 47: case 62: case 64: case 126: // ; { } breakpoint token case 59: case 123: case 125: return 4 // : accompanied token case 58: return 3 // " ' ( [ opening delimit token case 34: case 39: case 40: case 91: return 2 // ) ] closing delimit token case 41: case 93: return 1 } return 0 } /** * @param {string} value * @return {any[]} */ function alloc (value) { return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), Tokenizer_position = 0, [] } /** * @param {any} value * @return {any} */ function dealloc (value) { return characters = '', value } /** * @param {number} type * @return {string} */ function delimit (type) { return trim(slice(Tokenizer_position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) } /** * @param {string} value * @return {string[]} */ function Tokenizer_tokenize (value) { return dealloc(tokenizer(alloc(value))) } /** * @param {number} type * @return {string} */ function whitespace (type) { while (Tokenizer_character = peek()) if (Tokenizer_character < 33) next() else break return token(type) > 2 || token(Tokenizer_character) > 3 ? '' : ' ' } /** * @param {string[]} children * @return {string[]} */ function tokenizer (children) { while (next()) switch (token(Tokenizer_character)) { case 0: append(identifier(Tokenizer_position - 1), children) break case 2: append(delimit(Tokenizer_character), children) break default: append(from(Tokenizer_character), children) } return children } /** * @param {number} index * @param {number} count * @return {string} */ function escaping (index, count) { while (--count && next()) // not 0-9 A-F a-f if (Tokenizer_character < 48 || Tokenizer_character > 102 || (Tokenizer_character > 57 && Tokenizer_character < 65) || (Tokenizer_character > 70 && Tokenizer_character < 97)) break return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) } /** * @param {number} type * @return {number} */ function delimiter (type) { while (next()) switch (Tokenizer_character) { // ] ) " ' case type: return Tokenizer_position // " ' case 34: case 39: if (type !== 34 && type !== 39) delimiter(Tokenizer_character) break // ( case 40: if (type === 41) delimiter(type) break // \ case 92: next() break } return Tokenizer_position } /** * @param {number} type * @param {number} index * @return {number} */ function commenter (type, index) { while (next()) // // if (type + Tokenizer_character === 47 + 10) break // /* else if (type + Tokenizer_character === 42 + 42 && peek() === 47) break return '/*' + slice(index, Tokenizer_position - 1) + '*' + Utility_from(type === 47 ? type : next()) } /** * @param {number} index * @return {string} */ function identifier (index) { while (!token(peek())) next() return slice(index, Tokenizer_position) } ;// ./node_modules/stylis/src/Enum.js var Enum_MS = '-ms-' var Enum_MOZ = '-moz-' var Enum_WEBKIT = '-webkit-' var COMMENT = 'comm' var Enum_RULESET = 'rule' var Enum_DECLARATION = 'decl' var PAGE = '@page' var MEDIA = '@media' var IMPORT = '@import' var CHARSET = '@charset' var VIEWPORT = '@viewport' var SUPPORTS = '@supports' var DOCUMENT = '@document' var NAMESPACE = '@namespace' var Enum_KEYFRAMES = '@keyframes' var FONT_FACE = '@font-face' var COUNTER_STYLE = '@counter-style' var FONT_FEATURE_VALUES = '@font-feature-values' ;// ./node_modules/stylis/src/Serializer.js /** * @param {object[]} children * @param {function} callback * @return {string} */ function Serializer_serialize (children, callback) { var output = '' var length = Utility_sizeof(children) for (var i = 0; i < length; i++) output += callback(children[i], i, children, callback) || '' return output } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback * @return {string} */ function Serializer_stringify (element, index, children, callback) { switch (element.type) { case IMPORT: case Enum_DECLARATION: return element.return = element.return || element.value case COMMENT: return '' case Enum_KEYFRAMES: return element.return = element.value + '{' + Serializer_serialize(element.children, callback) + '}' case Enum_RULESET: element.value = element.props.join(',') } return Utility_strlen(children = Serializer_serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' } ;// ./node_modules/stylis/src/Middleware.js /** * @param {function[]} collection * @return {function} */ function middleware (collection) { var length = Utility_sizeof(collection) return function (element, index, children, callback) { var output = '' for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || '' return output } } /** * @param {function} callback * @return {function} */ function rulesheet (callback) { return function (element) { if (!element.root) if (element = element.return) callback(element) } } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback */ function prefixer (element, index, children, callback) { if (element.length > -1) if (!element.return) switch (element.type) { case DECLARATION: element.return = prefix(element.value, element.length, children) return case KEYFRAMES: return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback) case RULESET: if (element.length) return combine(element.props, function (value) { switch (match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback) // :placeholder case '::placeholder': return serialize([ copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]}) ], callback) } return '' }) } } /** * @param {object} element * @param {number} index * @param {object[]} children */ function namespace (element) { switch (element.type) { case RULESET: element.props = element.props.map(function (value) { return combine(tokenize(value), function (value, index, children) { switch (charat(value, 0)) { // \f case 12: return substr(value, 1, strlen(value)) // \0 ( + > ~ case 0: case 40: case 43: case 62: case 126: return value // : case 58: if (children[++index] === 'global') children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1) // \s case 32: return index === 1 ? '' : value default: switch (index) { case 0: element = value return sizeof(children) > 1 ? '' : value case index = sizeof(children) - 1: case 2: return index === 2 ? value + element + element : value + element default: return value } } }) }) } } ;// ./node_modules/stylis/src/Parser.js /** * @param {string} value * @return {object[]} */ function compile (value) { return dealloc(Parser_parse('', null, null, null, [''], value = alloc(value), 0, [0], value)) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {string[]} rule * @param {string[]} rules * @param {string[]} rulesets * @param {number[]} pseudo * @param {number[]} points * @param {string[]} declarations * @return {object} */ function Parser_parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { var index = 0 var offset = 0 var length = pseudo var atrule = 0 var property = 0 var previous = 0 var variable = 1 var scanning = 1 var ampersand = 1 var character = 0 var type = '' var props = rules var children = rulesets var reference = rule var characters = type while (scanning) switch (previous = character, character = next()) { // ( case 40: if (previous != 108 && Utility_charat(characters, length - 1) == 58) { if (indexof(characters += Utility_replace(delimit(character), '&', '&\f'), '&\f') != -1) ampersand = -1 break } // " ' [ case 34: case 39: case 91: characters += delimit(character) break // \t \n \r \s case 9: case 10: case 13: case 32: characters += whitespace(previous) break // \ case 92: characters += escaping(caret() - 1, 7) continue // / case 47: switch (peek()) { case 42: case 47: Utility_append(comment(commenter(next(), caret()), root, parent), declarations) break default: characters += '/' } break // { case 123 * variable: points[index++] = Utility_strlen(characters) * ampersand // } ; \0 case 125 * variable: case 59: case 0: switch (character) { // \0 } case 0: case 125: scanning = 0 // ; case 59 + offset: if (property > 0 && (Utility_strlen(characters) - length)) Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility_replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations) break // @ ; case 59: characters += ';' // { rule/at-rule default: Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets) if (character === 123) if (offset === 0) Parser_parse(characters, root, reference, reference, props, rulesets, length, points, children) else switch (atrule === 99 && Utility_charat(characters, 3) === 110 ? 100 : atrule) { // d m s case 100: case 109: case 115: Parser_parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children) break default: Parser_parse(characters, reference, reference, reference, [''], children, 0, points, children) } } index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo break // : case 58: length = 1 + Utility_strlen(characters), property = previous default: if (variable < 1) if (character == 123) --variable else if (character == 125 && variable++ == 0 && prev() == 125) continue switch (characters += Utility_from(character), character * variable) { // & case 38: ampersand = offset > 0 ? 1 : (characters += '\f', -1) break // , case 44: points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1 break // @ case 64: // - if (peek() === 45) characters += delimit(next()) atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++ break // - case 45: if (previous === 45 && Utility_strlen(characters) == 2) variable = 0 } } return rulesets } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} index * @param {number} offset * @param {string[]} rules * @param {number[]} points * @param {string} type * @param {string[]} props * @param {string[]} children * @param {number} length * @return {object} */ function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) { var post = offset - 1 var rule = offset === 0 ? rules : [''] var size = Utility_sizeof(rule) for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) if (z = trim(j > 0 ? rule[x] + ' ' + y : Utility_replace(y, /&\f/g, rule[x]))) props[k++] = z return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length) } /** * @param {number} value * @param {object} root * @param {object?} parent * @return {object} */ function comment (value, root, parent) { return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} length * @return {object} */ function declaration (value, root, parent, length) { return node(value, root, parent, Enum_DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length) } ;// ./node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { var previous = 0; var character = 0; while (true) { previous = character; character = peek(); // &\f if (previous === 38 && character === 12) { points[index] = 1; } if (token(character)) { break; } next(); } return slice(begin, Tokenizer_position); }; var toRules = function toRules(parsed, points) { // pretend we've started with a comma var index = -1; var character = 44; do { switch (token(character)) { case 0: // &\f if (character === 38 && peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1; } parsed[index] += identifierWithPointTracking(Tokenizer_position - 1, points, index); break; case 2: parsed[index] += delimit(character); break; case 4: // comma if (character === 44) { // colon parsed[++index] = peek() === 58 ? '&\f' : ''; points[index] = parsed[index].length; break; } // fallthrough default: parsed[index] += Utility_from(character); } } while (character = next()); return parsed; }; var getRules = function getRules(value, points) { return dealloc(toRules(alloc(value), points)); }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 var fixedElements = /* #__PURE__ */new WeakMap(); var compat = function compat(element) { if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1) { return; } var value = element.value, parent = element.parent; var isImplicitRule = element.column === parent.column && element.line === parent.line; while (parent.type !== 'rule') { parent = parent.parent; if (!parent) return; } // short-circuit for the simplest case if (element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent)) { return; } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return; } fixedElements.set(element, true); var points = []; var rules = getRules(value, points); var parentRules = parent.props; for (var i = 0, k = 0; i < rules.length; i++) { for (var j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }; var removeLabel = function removeLabel(element) { if (element.type === 'decl') { var value = element.value; if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98) { // this ignores label element["return"] = ''; element.value = ''; } } }; var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; var isIgnoringComment = function isIgnoringComment(element) { return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; }; var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { return function (element, index, children) { if (element.type !== 'rule' || cache.compat) return; var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); if (unsafePseudoClasses) { var isNested = element.parent === children[0]; // in nested rules comments become children of the "auto-inserted" rule // // considering this input: // .a { // .b /* comm */ {} // color: hotpink; // } // we get output corresponding to this: // .a { // & { // /* comm */ // color: hotpink; // } // .b {} // } var commentContainer = isNested ? children[0].children : // global rule at the root level children; for (var i = commentContainer.length - 1; i >= 0; i--) { var node = commentContainer[i]; if (node.line < element.line) { break; } // it is quite weird but comments are *usually* put at `column: element.column - 1` // so we seek *from the end* for the node that is earlier than the rule's `element` and check that // this will also match inputs like this: // .a { // /* comm */ // .b {} // } // // but that is fine // // it would be the easiest to change the placement of the comment to be the first child of the rule: // .a { // .b { /* comm */ } // } // with such inputs we wouldn't have to search for the comment at all // TODO: consider changing this comment placement in the next major version if (node.column < element.column) { if (isIgnoringComment(node)) { return; } break; } } unsafePseudoClasses.forEach(function (unsafePseudoClass) { console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); }); } }; }; var isImportRule = function isImportRule(element) { return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; }; var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { for (var i = index - 1; i >= 0; i--) { if (!isImportRule(children[i])) { return true; } } return false; }; // use this to remove incorrect elements from further processing // so they don't get handed to the `sheet` (or anything else) // as that could potentially lead to additional logs which in turn could be overhelming to the user var nullifyElement = function nullifyElement(element) { element.type = ''; element.value = ''; element["return"] = ''; element.children = ''; element.props = ''; }; var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { if (!isImportRule(element)) { return; } if (element.parent) { console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); nullifyElement(element); } else if (isPrependedWithRegularRules(index, children)) { console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); nullifyElement(element); } }; /* eslint-disable no-fallthrough */ function emotion_cache_browser_esm_prefix(value, length) { switch (hash(value, length)) { // color-adjust case 5103: return Enum_WEBKIT + 'print-' + value + value; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return Enum_WEBKIT + value + value; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return Enum_WEBKIT + value + Enum_MOZ + value + Enum_MS + value + value; // flex, flex-direction case 6828: case 4268: return Enum_WEBKIT + value + Enum_MS + value + value; // order case 6165: return Enum_WEBKIT + value + Enum_MS + 'flex-' + value + value; // align-items case 5187: return Enum_WEBKIT + value + Utility_replace(value, /(\w+).+(:[^]+)/, Enum_WEBKIT + 'box-$1$2' + Enum_MS + 'flex-$1$2') + value; // align-self case 5443: return Enum_WEBKIT + value + Enum_MS + 'flex-item-' + Utility_replace(value, /flex-|-self/, '') + value; // align-content case 4675: return Enum_WEBKIT + value + Enum_MS + 'flex-line-pack' + Utility_replace(value, /align-content|flex-|-self/, '') + value; // flex-shrink case 5548: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'shrink', 'negative') + value; // flex-basis case 5292: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'basis', 'preferred-size') + value; // flex-grow case 6060: return Enum_WEBKIT + 'box-' + Utility_replace(value, '-grow', '') + Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'grow', 'positive') + value; // transition case 4554: return Enum_WEBKIT + Utility_replace(value, /([^-])(transform)/g, '$1' + Enum_WEBKIT + '$2') + value; // cursor case 6187: return Utility_replace(Utility_replace(Utility_replace(value, /(zoom-|grab)/, Enum_WEBKIT + '$1'), /(image-set)/, Enum_WEBKIT + '$1'), value, '') + value; // background, background-image case 5495: case 3959: return Utility_replace(value, /(image-set\([^]*)/, Enum_WEBKIT + '$1' + '$`$1'); // justify-content case 4968: return Utility_replace(Utility_replace(value, /(.+:)(flex-)?(.*)/, Enum_WEBKIT + 'box-pack:$3' + Enum_MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + Enum_WEBKIT + value + value; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return Utility_replace(value, /(.+)-inline(.+)/, Enum_WEBKIT + '$1$2') + value; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (Utility_strlen(value) - 1 - length > 6) switch (Utility_charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (Utility_charat(value, length + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return Utility_replace(value, /(.+:)(.+)-([^]+)/, '$1' + Enum_WEBKIT + '$2-$3' + '$1' + Enum_MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; // (s)tretch case 115: return ~indexof(value, 'stretch') ? emotion_cache_browser_esm_prefix(Utility_replace(value, 'stretch', 'fill-available'), length) + value : value; } break; // position: sticky case 4949: // (s)ticky? if (Utility_charat(value, length + 1) !== 115) break; // display: (flex|inline-flex) case 6444: switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) { // stic(k)y case 107: return Utility_replace(value, ':', ':' + Enum_WEBKIT) + value; // (inline-)?fl(e)x case 101: return Utility_replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + Enum_WEBKIT + (Utility_charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + Enum_WEBKIT + '$2$3' + '$1' + Enum_MS + '$2box$3') + value; } break; // writing-mode case 5936: switch (Utility_charat(value, length + 11)) { // vertical-l(r) case 114: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; // vertical-r(l) case 108: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; // horizontal(-)tb case 45: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; } return Enum_WEBKIT + value + Enum_MS + value + value; } return value; } var emotion_cache_browser_esm_prefixer = function prefixer(element, index, children, callback) { if (element.length > -1) if (!element["return"]) switch (element.type) { case Enum_DECLARATION: element["return"] = emotion_cache_browser_esm_prefix(element.value, element.length); break; case Enum_KEYFRAMES: return Serializer_serialize([Tokenizer_copy(element, { value: Utility_replace(element.value, '@', '@' + Enum_WEBKIT) })], callback); case Enum_RULESET: if (element.length) return Utility_combine(element.props, function (value) { switch (Utility_match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return Serializer_serialize([Tokenizer_copy(element, { props: [Utility_replace(value, /:(read-\w+)/, ':' + Enum_MOZ + '$1')] })], callback); // :placeholder case '::placeholder': return Serializer_serialize([Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_WEBKIT + 'input-$1')] }), Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_MOZ + '$1')] }), Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, Enum_MS + 'input-$1')] })], callback); } return ''; }); } }; var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer]; var createCache = function createCache(options) { var key = options.key; if (false) {} if ( key === 'css') { var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) // note this very very intentionally targets all style elements regardless of the key to ensure // that creating a cache works inside of render of a React component Array.prototype.forEach.call(ssrStyles, function (node) { // we want to only move elements which have a space in the data-emotion attribute value // because that indicates that it is an Emotion 11 server-side rendered style elements // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles // will not result in the Emotion 10 styles being destroyed var dataEmotionAttribute = node.getAttribute('data-emotion'); if (dataEmotionAttribute.indexOf(' ') === -1) { return; } document.head.appendChild(node); node.setAttribute('data-s', ''); }); } var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; if (false) {} var inserted = {}; var container; var nodesToHydrate = []; { container = options.container || document.head; Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which // means that the style elements we're looking at are only Emotion 11 server-rendered style elements document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe for (var i = 1; i < attrib.length; i++) { inserted[attrib[i]] = true; } nodesToHydrate.push(node); }); } var _insert; var omnipresentPlugins = [compat, removeLabel]; if (false) {} { var currentSheet; var finalizingPlugins = [Serializer_stringify, false ? 0 : rulesheet(function (rule) { currentSheet.insert(rule); })]; var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); var stylis = function stylis(styles) { return Serializer_serialize(compile(styles), serializer); }; _insert = function insert(selector, serialized, sheet, shouldCache) { currentSheet = sheet; if (false) {} stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); if (shouldCache) { cache.inserted[serialized.name] = true; } }; } var cache = { key: key, sheet: new StyleSheet({ key: key, container: container, nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted: inserted, registered: {}, insert: _insert }; cache.sheet.hydrate(nodesToHydrate); return cache; }; /* harmony default export */ const emotion_cache_browser_esm = (createCache); ;// ./node_modules/@emotion/hash/dist/emotion-hash.esm.js /* eslint-disable */ // Inspired by https://github.com/garycourt/murmurhash-js // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 function murmur2(str) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. // const m = 0x5bd1e995; // const r = 24; // Initialize the hash var h = 0; // Mix 4 bytes at a time into the hash var k, i = 0, len = str.length; for (; len >= 4; ++i, len -= 4) { k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; k = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); k ^= /* k >>> r: */ k >>> 24; h = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Handle the last few bytes of the input array switch (len) { case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16; case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8; case 1: h ^= str.charCodeAt(i) & 0xff; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Do a few final mixes of the hash to ensure the last few // bytes are well-incorporated. h ^= h >>> 13; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); return ((h ^ h >>> 15) >>> 0).toString(36); } /* harmony default export */ const emotion_hash_esm = (murmur2); ;// ./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js var unitlessKeys = { animationIterationCount: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1, boxOrdinalGroup: 1, columnCount: 1, columns: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1, gridRow: 1, gridRowEnd: 1, gridRowSpan: 1, gridRowStart: 1, gridColumn: 1, gridColumnEnd: 1, gridColumnSpan: 1, gridColumnStart: 1, msGridRow: 1, msGridRowSpan: 1, msGridColumn: 1, msGridColumnSpan: 1, fontWeight: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1, zIndex: 1, zoom: 1, WebkitLineClamp: 1, // SVG-related properties fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 }; /* harmony default export */ const emotion_unitless_esm = (unitlessKeys); ;// ./node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; var hyphenateRegex = /[A-Z]|^ms/g; var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; var isCustomProperty = function isCustomProperty(property) { return property.charCodeAt(1) === 45; }; var isProcessableValue = function isProcessableValue(value) { return value != null && typeof value !== 'boolean'; }; var processStyleName = /* #__PURE__ */memoize(function (styleName) { return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); }); var processStyleValue = function processStyleValue(key, value) { switch (key) { case 'animation': case 'animationName': { if (typeof value === 'string') { return value.replace(animationRegex, function (match, p1, p2) { cursor = { name: p1, styles: p2, next: cursor }; return p1; }); } } } if (emotion_unitless_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { return value + 'px'; } return value; }; if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; } var noComponentSelectorMessage = (/* unused pure expression or super */ null && ('Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.')); function handleInterpolation(mergedProps, registered, interpolation) { if (interpolation == null) { return ''; } if (interpolation.__emotion_styles !== undefined) { if (false) {} return interpolation; } switch (typeof interpolation) { case 'boolean': { return ''; } case 'object': { if (interpolation.anim === 1) { cursor = { name: interpolation.name, styles: interpolation.styles, next: cursor }; return interpolation.name; } if (interpolation.styles !== undefined) { var next = interpolation.next; if (next !== undefined) { // not the most efficient thing ever but this is a pretty rare case // and there will be very few iterations of this generally while (next !== undefined) { cursor = { name: next.name, styles: next.styles, next: cursor }; next = next.next; } } var styles = interpolation.styles + ";"; if (false) {} return styles; } return createStringFromObject(mergedProps, registered, interpolation); } case 'function': { if (mergedProps !== undefined) { var previousCursor = cursor; var result = interpolation(mergedProps); cursor = previousCursor; return handleInterpolation(mergedProps, registered, result); } else if (false) {} break; } case 'string': if (false) { var replaced, matched; } break; } // finalize string values (regular strings and functions interpolated into css calls) if (registered == null) { return interpolation; } var cached = registered[interpolation]; return cached !== undefined ? cached : interpolation; } function createStringFromObject(mergedProps, registered, obj) { var string = ''; if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; } } else { for (var _key in obj) { var value = obj[_key]; if (typeof value !== 'object') { if (registered != null && registered[value] !== undefined) { string += _key + "{" + registered[value] + "}"; } else if (isProcessableValue(value)) { string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";"; } } else { if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {} if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { for (var _i = 0; _i < value.length; _i++) { if (isProcessableValue(value[_i])) { string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";"; } } } else { var interpolated = handleInterpolation(mergedProps, registered, value); switch (_key) { case 'animation': case 'animationName': { string += processStyleName(_key) + ":" + interpolated + ";"; break; } default: { if (false) {} string += _key + "{" + interpolated + "}"; } } } } } } return string; } var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g; var sourceMapPattern; if (false) {} // this is the cursor for keyframes // keyframes are stored on the SerializedStyles object as a linked list var cursor; var emotion_serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) { if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { return args[0]; } var stringMode = true; var styles = ''; cursor = undefined; var strings = args[0]; if (strings == null || strings.raw === undefined) { stringMode = false; styles += handleInterpolation(mergedProps, registered, strings); } else { if (false) {} styles += strings[0]; } // we start at 1 since we've already handled the first arg for (var i = 1; i < args.length; i++) { styles += handleInterpolation(mergedProps, registered, args[i]); if (stringMode) { if (false) {} styles += strings[i]; } } var sourceMap; if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time labelPattern.lastIndex = 0; var identifierName = ''; var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 while ((match = labelPattern.exec(styles)) !== null) { identifierName += '-' + // $FlowFixMe we know it's not null match[1]; } var name = emotion_hash_esm(styles) + identifierName; if (false) {} return { name: name, styles: styles, next: cursor }; }; ;// ./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js var syncFallback = function syncFallback(create) { return create(); }; var useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : false; var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback; var useInsertionEffectWithLayoutFallback = (/* unused pure expression or super */ null && (useInsertionEffect || useLayoutEffect)); ;// ./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js var emotion_element_6a883da9_browser_esm_hasOwnProperty = {}.hasOwnProperty; var EmotionCacheContext = /* #__PURE__ */(0,external_React_.createContext)( // we're doing this to avoid preconstruct's dead code elimination in this one case // because this module is primarily intended for the browser and node // but it's also required in react native and similar environments sometimes // and we could have a special build just for that // but this is much easier and the native packages // might use a different theme context in the future anyway typeof HTMLElement !== 'undefined' ? /* #__PURE__ */emotion_cache_browser_esm({ key: 'css' }) : null); if (false) {} var CacheProvider = EmotionCacheContext.Provider; var __unsafe_useEmotionCache = function useEmotionCache() { return useContext(EmotionCacheContext); }; var withEmotionCache = function withEmotionCache(func) { // $FlowFixMe return /*#__PURE__*/(0,external_React_.forwardRef)(function (props, ref) { // the cache will never be null in the browser var cache = (0,external_React_.useContext)(EmotionCacheContext); return func(props, cache, ref); }); }; var ThemeContext = /* #__PURE__ */(0,external_React_.createContext)({}); if (false) {} var useTheme = function useTheme() { return useContext(ThemeContext); }; var getTheme = function getTheme(outerTheme, theme) { if (typeof theme === 'function') { var mergedTheme = theme(outerTheme); if (false) {} return mergedTheme; } if (false) {} return _extends({}, outerTheme, theme); }; var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) { return weakMemoize(function (theme) { return getTheme(outerTheme, theme); }); }))); var ThemeProvider = function ThemeProvider(props) { var theme = useContext(ThemeContext); if (props.theme !== theme) { theme = createCacheWithTheme(theme)(props.theme); } return /*#__PURE__*/createElement(ThemeContext.Provider, { value: theme }, props.children); }; function withTheme(Component) { var componentName = Component.displayName || Component.name || 'Component'; var render = function render(props, ref) { var theme = useContext(ThemeContext); return /*#__PURE__*/createElement(Component, _extends({ theme: theme, ref: ref }, props)); }; // $FlowFixMe var WithTheme = /*#__PURE__*/forwardRef(render); WithTheme.displayName = "WithTheme(" + componentName + ")"; return hoistNonReactStatics(WithTheme, Component); } var getLastPart = function getLastPart(functionName) { // The match may be something like 'Object.createEmotionProps' or // 'Loader.prototype.render' var parts = functionName.split('.'); return parts[parts.length - 1]; }; var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) { // V8 var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line); if (match) return getLastPart(match[1]); // Safari / Firefox match = /^([A-Za-z0-9$.]+)@/.exec(line); if (match) return getLastPart(match[1]); return undefined; }; var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS // identifiers, thus we only need to replace what is a valid character for JS, // but not for CSS. var sanitizeIdentifier = function sanitizeIdentifier(identifier) { return identifier.replace(/\$/g, '-'); }; var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) { if (!stackTrace) return undefined; var lines = stackTrace.split('\n'); for (var i = 0; i < lines.length; i++) { var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error" if (!functionName) continue; // If we reach one of these, we have gone too far and should quit if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an // uppercase letter if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName); } return undefined; }; var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__'; var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__'; var createEmotionProps = function createEmotionProps(type, props) { if (false) {} var newProps = {}; for (var key in props) { if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key)) { newProps[key] = props[key]; } } newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when // the label hasn't already been computed if (false) { var label; } return newProps; }; var Insertion = function Insertion(_ref) { var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag; registerStyles(cache, serialized, isStringTag); var rules = useInsertionEffectAlwaysWithSyncFallback(function () { return insertStyles(cache, serialized, isStringTag); }); return null; }; var Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache, ref) { var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works // not passing the registered cache to serializeStyles because it would // make certain babel optimisations not possible if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) { cssProp = cache.registered[cssProp]; } var WrappedComponent = props[typePropName]; var registeredStyles = [cssProp]; var className = ''; if (typeof props.className === 'string') { className = getRegisteredStyles(cache.registered, registeredStyles, props.className); } else if (props.className != null) { className = props.className + " "; } var serialized = serializeStyles(registeredStyles, undefined, useContext(ThemeContext)); if (false) { var labelFromStack; } className += cache.key + "-" + serialized.name; var newProps = {}; for (var key in props) { if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) { newProps[key] = props[key]; } } newProps.ref = ref; newProps.className = className; return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, { cache: cache, serialized: serialized, isStringTag: typeof WrappedComponent === 'string' }), /*#__PURE__*/createElement(WrappedComponent, newProps)); }))); if (false) {} ;// ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js var isBrowser = "object" !== 'undefined'; function emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) { var rawClassName = ''; classNames.split(' ').forEach(function (className) { if (registered[className] !== undefined) { registeredStyles.push(registered[className] + ";"); } else { rawClassName += className + " "; } }); return rawClassName; } var emotion_utils_browser_esm_registerStyles = function registerStyles(cache, serialized, isStringTag) { var className = cache.key + "-" + serialized.name; if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser isBrowser === false ) && cache.registered[className] === undefined) { cache.registered[className] = serialized.styles; } }; var emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) { emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag); var className = cache.key + "-" + serialized.name; if (cache.inserted[serialized.name] === undefined) { var current = serialized; do { var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); current = current.next; } while (current !== undefined); } }; ;// ./node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js var testOmitPropsOnStringTag = isPropValid; var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) { return key !== 'theme'; }; var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) { return typeof tag === 'string' && // 96 is one less than the char code // for "a" so this is checking that // it's a lowercase character tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent; }; var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) { var shouldForwardProp; if (options) { var optionsShouldForwardProp = options.shouldForwardProp; shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) { return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName); } : optionsShouldForwardProp; } if (typeof shouldForwardProp !== 'function' && isReal) { shouldForwardProp = tag.__emotion_forwardProp; } return shouldForwardProp; }; var emotion_styled_base_browser_esm_ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var emotion_styled_base_browser_esm_Insertion = function Insertion(_ref) { var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag; emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag); var rules = emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback(function () { return emotion_utils_browser_esm_insertStyles(cache, serialized, isStringTag); }); return null; }; var createStyled = function createStyled(tag, options) { if (false) {} var isReal = tag.__emotion_real === tag; var baseTag = isReal && tag.__emotion_base || tag; var identifierName; var targetClassName; if (options !== undefined) { identifierName = options.label; targetClassName = options.target; } var shouldForwardProp = composeShouldForwardProps(tag, options, isReal); var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag); var shouldUseAs = !defaultShouldForwardProp('as'); return function () { var args = arguments; var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : []; if (identifierName !== undefined) { styles.push("label:" + identifierName + ";"); } if (args[0] == null || args[0].raw === undefined) { styles.push.apply(styles, args); } else { if (false) {} styles.push(args[0][0]); var len = args.length; var i = 1; for (; i < len; i++) { if (false) {} styles.push(args[i], args[0][i]); } } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class var Styled = withEmotionCache(function (props, cache, ref) { var FinalTag = shouldUseAs && props.as || baseTag; var className = ''; var classInterpolations = []; var mergedProps = props; if (props.theme == null) { mergedProps = {}; for (var key in props) { mergedProps[key] = props[key]; } mergedProps.theme = (0,external_React_.useContext)(ThemeContext); } if (typeof props.className === 'string') { className = emotion_utils_browser_esm_getRegisteredStyles(cache.registered, classInterpolations, props.className); } else if (props.className != null) { className = props.className + " "; } var serialized = emotion_serialize_browser_esm_serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps); className += cache.key + "-" + serialized.name; if (targetClassName !== undefined) { className += " " + targetClassName; } var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp; var newProps = {}; for (var _key in props) { if (shouldUseAs && _key === 'as') continue; if ( // $FlowFixMe finalShouldForwardProp(_key)) { newProps[_key] = props[_key]; } } newProps.className = className; newProps.ref = ref; return /*#__PURE__*/(0,external_React_.createElement)(external_React_.Fragment, null, /*#__PURE__*/(0,external_React_.createElement)(emotion_styled_base_browser_esm_Insertion, { cache: cache, serialized: serialized, isStringTag: typeof FinalTag === 'string' }), /*#__PURE__*/(0,external_React_.createElement)(FinalTag, newProps)); }); Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")"; Styled.defaultProps = tag.defaultProps; Styled.__emotion_real = Styled; Styled.__emotion_base = baseTag; Styled.__emotion_styles = styles; Styled.__emotion_forwardProp = shouldForwardProp; Object.defineProperty(Styled, 'toString', { value: function value() { if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string return "." + targetClassName; } }); Styled.withComponent = function (nextTag, nextOptions) { return createStyled(nextTag, extends_extends({}, options, nextOptions, { shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true) })).apply(void 0, styles); }; return Styled; }; }; /* harmony default export */ const emotion_styled_base_browser_esm = (createStyled); ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/width-height-tool.js function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * WordPress dependencies */ const SingleColumnToolsPanelItem = /*#__PURE__*/emotion_styled_base_browser_esm(external_wp_components_namespaceObject.__experimentalToolsPanelItem, true ? { target: "ef8pe3d0" } : 0)( true ? { name: "957xgf", styles: "grid-column:span 1" } : 0); /** * @typedef {import('@wordpress/components/build-types/unit-control/types').WPUnitControlUnit} WPUnitControlUnit */ /** * @typedef {Object} WidthHeightToolValue * @property {string} [width] Width CSS value. * @property {string} [height] Height CSS value. */ /** * @callback WidthHeightToolOnChange * @param {WidthHeightToolValue} nextValue Next dimensions value. * @return {void} */ /** * @typedef {Object} WidthHeightToolProps * @property {string} [panelId] ID of the panel that contains the controls. * @property {WidthHeightToolValue} [value] Current dimensions values. * @property {WidthHeightToolOnChange} [onChange] Callback to update the dimensions values. * @property {WPUnitControlUnit[]} [units] Units options. * @property {boolean} [isShownByDefault] Whether the panel is shown by default. */ /** * Component that renders controls to edit the dimensions of an image or container. * * @param {WidthHeightToolProps} props The component props. * * @return {import('react').ReactElement} The width and height tool. */ function WidthHeightTool({ panelId, value = {}, onChange = () => {}, units, isShownByDefault = true }) { var _value$width, _value$height; // null, undefined, and 'auto' all represent the default value. const width = value.width === 'auto' ? '' : (_value$width = value.width) !== null && _value$width !== void 0 ? _value$width : ''; const height = value.height === 'auto' ? '' : (_value$height = value.height) !== null && _value$height !== void 0 ? _value$height : ''; const onDimensionChange = dimension => nextDimension => { const nextValue = { ...value }; // Empty strings or undefined may be passed and both represent removing the value. if (!nextDimension) { delete nextValue[dimension]; } else { nextValue[dimension] = nextDimension; } onChange(nextValue); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleColumnToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Width'), isShownByDefault: isShownByDefault, hasValue: () => width !== '', onDeselect: onDimensionChange('width'), panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { label: (0,external_wp_i18n_namespaceObject.__)('Width'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto'), labelPosition: "top", units: units, min: 0, value: width, onChange: onDimensionChange('width'), size: "__unstable-large" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleColumnToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Height'), isShownByDefault: isShownByDefault, hasValue: () => height !== '', onDeselect: onDimensionChange('height'), panelId: panelId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { label: (0,external_wp_i18n_namespaceObject.__)('Height'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto'), labelPosition: "top", units: units, min: 0, value: height, onChange: onDimensionChange('height'), size: "__unstable-large" }) })] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps */ /** * @typedef {import('@wordpress/components/build-types/unit-control/types').WPUnitControlUnit} WPUnitControlUnit */ /** * @typedef {Object} Dimensions * @property {string} [width] CSS width property. * @property {string} [height] CSS height property. * @property {string} [scale] CSS object-fit property. * @property {string} [aspectRatio] CSS aspect-ratio property. */ /** * @callback DimensionsControlsOnChange * @param {Dimensions} nextValue * @return {void} */ /** * @typedef {Object} DimensionsControlsProps * @property {string} [panelId] ID of the panel that contains the controls. * @property {Dimensions} [value] Current dimensions values. * @property {DimensionsControlsOnChange} [onChange] Callback to update the dimensions values. * @property {SelectControlProps[]} [aspectRatioOptions] Aspect ratio options. * @property {SelectControlProps[]} [scaleOptions] Scale options. * @property {WPUnitControlUnit[]} [unitsOptions] Units options. */ /** * Component that renders controls to edit the dimensions of an image or container. * * @param {DimensionsControlsProps} props The component props. * * @return {Element} The dimensions controls. */ function DimensionsTool({ panelId, value = {}, onChange = () => {}, aspectRatioOptions, // Default options handled by AspectRatioTool. defaultAspectRatio = 'auto', // Match CSS default value for aspect-ratio. scaleOptions, // Default options handled by ScaleTool. defaultScale = 'fill', // Match CSS default value for object-fit. unitsOptions, // Default options handled by UnitControl. tools = ['aspectRatio', 'widthHeight', 'scale'] }) { // Coerce undefined and CSS default values to be null. const width = value.width === undefined || value.width === 'auto' ? null : value.width; const height = value.height === undefined || value.height === 'auto' ? null : value.height; const aspectRatio = value.aspectRatio === undefined || value.aspectRatio === 'auto' ? null : value.aspectRatio; const scale = value.scale === undefined || value.scale === 'fill' ? null : value.scale; // Keep track of state internally, so when the value is cleared by means // other than directly editing that field, it's easier to restore the // previous value. const [lastScale, setLastScale] = (0,external_wp_element_namespaceObject.useState)(scale); const [lastAspectRatio, setLastAspectRatio] = (0,external_wp_element_namespaceObject.useState)(aspectRatio); // 'custom' is not a valid value for CSS aspect-ratio, but it is used in the // dropdown to indicate that setting both the width and height is the same // as a custom aspect ratio. const aspectRatioValue = width && height ? 'custom' : lastAspectRatio; const showScaleControl = aspectRatio || width && height; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [tools.includes('aspectRatio') && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioTool, { panelId: panelId, options: aspectRatioOptions, defaultValue: defaultAspectRatio, value: aspectRatioValue, onChange: nextAspectRatio => { const nextValue = { ...value }; // 'auto' is CSS default, so it gets treated as null. nextAspectRatio = nextAspectRatio === 'auto' ? null : nextAspectRatio; setLastAspectRatio(nextAspectRatio); // Update aspectRatio. if (!nextAspectRatio) { delete nextValue.aspectRatio; } else { nextValue.aspectRatio = nextAspectRatio; } // Auto-update scale. if (!nextAspectRatio) { delete nextValue.scale; } else if (lastScale) { nextValue.scale = lastScale; } else { nextValue.scale = defaultScale; setLastScale(defaultScale); } // Auto-update width and height. if ('custom' !== nextAspectRatio && width && height) { delete nextValue.height; } onChange(nextValue); } }), tools.includes('widthHeight') && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WidthHeightTool, { panelId: panelId, units: unitsOptions, value: { width, height }, onChange: ({ width: nextWidth, height: nextHeight }) => { const nextValue = { ...value }; // 'auto' is CSS default, so it gets treated as null. nextWidth = nextWidth === 'auto' ? null : nextWidth; nextHeight = nextHeight === 'auto' ? null : nextHeight; // Update width. if (!nextWidth) { delete nextValue.width; } else { nextValue.width = nextWidth; } // Update height. if (!nextHeight) { delete nextValue.height; } else { nextValue.height = nextHeight; } // Auto-update aspectRatio. if (nextWidth && nextHeight) { delete nextValue.aspectRatio; } else if (lastAspectRatio) { nextValue.aspectRatio = lastAspectRatio; } else { // No setting defaultAspectRatio here, because // aspectRatio is optional in this scenario, // unlike scale. } // Auto-update scale. if (!lastAspectRatio && !!nextWidth !== !!nextHeight) { delete nextValue.scale; } else if (lastScale) { nextValue.scale = lastScale; } else { nextValue.scale = defaultScale; setLastScale(defaultScale); } onChange(nextValue); } }), tools.includes('scale') && showScaleControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScaleTool, { panelId: panelId, options: scaleOptions, defaultValue: defaultScale, value: lastScale, onChange: nextScale => { const nextValue = { ...value }; // 'fill' is CSS default, so it gets treated as null. nextScale = nextScale === 'fill' ? null : nextScale; setLastScale(nextScale); // Update scale. if (!nextScale) { delete nextValue.scale; } else { nextValue.scale = nextScale; } onChange(nextValue); } })] }); } /* harmony default export */ const dimensions_tool = (DimensionsTool); ;// ./node_modules/@wordpress/block-editor/build-module/components/resolution-tool/index.js /** * WordPress dependencies */ const DEFAULT_SIZE_OPTIONS = [{ label: (0,external_wp_i18n_namespaceObject._x)('Thumbnail', 'Image size option for resolution control'), value: 'thumbnail' }, { label: (0,external_wp_i18n_namespaceObject._x)('Medium', 'Image size option for resolution control'), value: 'medium' }, { label: (0,external_wp_i18n_namespaceObject._x)('Large', 'Image size option for resolution control'), value: 'large' }, { label: (0,external_wp_i18n_namespaceObject._x)('Full Size', 'Image size option for resolution control'), value: 'full' }]; function ResolutionTool({ panelId, value, onChange, options = DEFAULT_SIZE_OPTIONS, defaultValue = DEFAULT_SIZE_OPTIONS[0].value, isShownByDefault = true, resetAllFilter }) { const displayValue = value !== null && value !== void 0 ? value : defaultValue; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => displayValue !== defaultValue, label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), onDeselect: () => onChange(defaultValue), isShownByDefault: isShownByDefault, panelId: panelId, resetAllFilter: resetAllFilter, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), value: displayValue, options: options, onChange: onChange, help: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source image.'), size: "__unstable-large" }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/private-apis.js /** * Internal dependencies */ /** * Private @wordpress/block-editor APIs. */ const privateApis = {}; lock(privateApis, { ...global_styles_namespaceObject, ExperimentalBlockCanvas: ExperimentalBlockCanvas, ExperimentalBlockEditorProvider: ExperimentalBlockEditorProvider, getDuotoneFilter: getDuotoneFilter, getRichTextValues: getRichTextValues, PrivateQuickInserter: QuickInserter, extractWords: extractWords, getNormalizedSearchTerms: getNormalizedSearchTerms, normalizeString: normalizeString, PrivateListView: PrivateListView, ResizableBoxPopover: ResizableBoxPopover, useHasBlockToolbar: useHasBlockToolbar, cleanEmptyObject: utils_cleanEmptyObject, BlockQuickNavigation: BlockQuickNavigation, LayoutStyle: LayoutStyle, BlockManager: BlockManager, BlockRemovalWarningModal: BlockRemovalWarningModal, useLayoutClasses: useLayoutClasses, useLayoutStyles: useLayoutStyles, DimensionsTool: dimensions_tool, ResolutionTool: ResolutionTool, TabbedSidebar: tabbed_sidebar, TextAlignmentControl: TextAlignmentControl, usesContextKey: usesContextKey, useFlashEditableBlocks: useFlashEditableBlocks, useZoomOut: useZoomOut, globalStylesDataKey: globalStylesDataKey, globalStylesLinksDataKey: globalStylesLinksDataKey, selectBlockPatternsKey: selectBlockPatternsKey, requiresWrapperOnCopy: requiresWrapperOnCopy, PrivateRichText: PrivateRichText, PrivateInserterLibrary: PrivateInserterLibrary, reusableBlocksSelectKey: reusableBlocksSelectKey, PrivateBlockPopover: PrivateBlockPopover, PrivatePublishDateTimePicker: PrivatePublishDateTimePicker, useSpacingSizes: useSpacingSizes, useBlockDisplayTitle: useBlockDisplayTitle, __unstableBlockStyleVariationOverridesWithConfig: __unstableBlockStyleVariationOverridesWithConfig, setBackgroundStyleDefaults: setBackgroundStyleDefaults, sectionRootClientIdKey: sectionRootClientIdKey, CommentIconSlotFill: block_comment_icon_slot, CommentIconToolbarSlotFill: block_comment_icon_toolbar_slot }); ;// ./node_modules/@wordpress/block-editor/build-module/index.js /** * Internal dependencies */ })(); (window.wp = window.wp || {}).blockEditor = __webpack_exports__; /******/ })() ; dist/dom-ready.min.js 0000644 00000000711 15125140777 0010520 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(t,d)=>{for(var o in d)e.o(d,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:d[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};function d(e){"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",e):e())}e.d(t,{default:()=>d}),(window.wp=window.wp||{}).domReady=t.default})(); dist/editor.min.js 0000644 00001407304 15125140777 0010137 0 ustar 00 /*! This file is auto-generated */ (()=>{var e={66:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===s}(e)}(e)};var s="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((s=e,Array.isArray(s)?[]:{}),e,t):e;var s}function n(e,t,s){return e.concat(t).map((function(e){return o(e,s)}))}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function a(e,t,s){var n={};return s.isMergeableObject(e)&&i(e).forEach((function(t){n[t]=o(e[t],s)})),i(t).forEach((function(i){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(r(e,i)&&s.isMergeableObject(t[i])?n[i]=function(e,t){if(!t.customMerge)return l;var s=t.customMerge(e);return"function"==typeof s?s:l}(i,s)(e[i],t[i],s):n[i]=o(t[i],s))})),n}function l(e,s,i){(i=i||{}).arrayMerge=i.arrayMerge||n,i.isMergeableObject=i.isMergeableObject||t,i.cloneUnlessOtherwiseSpecified=o;var r=Array.isArray(s);return r===Array.isArray(e)?r?i.arrayMerge(e,s,i):a(e,s,i):o(s,i)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,s){return l(e,s,t)}),{})};var c=l;e.exports=c},461:(e,t,s)=>{var o=s(6109);e.exports=function(e){var t=o(e,"line-height"),s=parseFloat(t,10);if(t===s+""){var n=e.style.lineHeight;e.style.lineHeight=t+"em",t=o(e,"line-height"),s=parseFloat(t,10),n?e.style.lineHeight=n:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(s*=4,s/=3):-1!==t.indexOf("mm")?(s*=96,s/=25.4):-1!==t.indexOf("cm")?(s*=96,s/=2.54):-1!==t.indexOf("in")?s*=96:-1!==t.indexOf("pc")&&(s*=16),s=Math.round(s),"normal"===t){var i=e.nodeName,r=document.createElement(i);r.innerHTML=" ","TEXTAREA"===i.toUpperCase()&&r.setAttribute("rows","1");var a=o(e,"font-size");r.style.fontSize=a,r.style.padding="0px",r.style.border="0px";var l=document.body;l.appendChild(r),s=r.offsetHeight,l.removeChild(r)}return s}},628:(e,t,s)=>{"use strict";var o=s(4067);function n(){}function i(){}i.resetWarningCache=n,e.exports=function(){function e(e,t,s,n,i,r){if(r!==o){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:n};return s.PropTypes=s,s}},1609:e=>{"use strict";e.exports=window.React},4067:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4132:(e,t,s)=>{"use strict";var o=s(4462);t.A=o.TextareaAutosize},4306:function(e,t){var s,o,n; /*! autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize */o=[e,t],s=function(e,t){"use strict";var s,o,n="function"==typeof Map?new Map:(s=[],o=[],{has:function(e){return s.indexOf(e)>-1},get:function(e){return o[s.indexOf(e)]},set:function(e,t){-1===s.indexOf(e)&&(s.push(e),o.push(t))},delete:function(e){var t=s.indexOf(e);t>-1&&(s.splice(t,1),o.splice(t,1))}}),i=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){i=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function r(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!n.has(e)){var t=null,s=null,o=null,r=function(){e.clientWidth!==s&&p()},a=function(t){window.removeEventListener("resize",r,!1),e.removeEventListener("input",p,!1),e.removeEventListener("keyup",p,!1),e.removeEventListener("autosize:destroy",a,!1),e.removeEventListener("autosize:update",p,!1),Object.keys(t).forEach((function(s){e.style[s]=t[s]})),n.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",a,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",p,!1),window.addEventListener("resize",r,!1),e.addEventListener("input",p,!1),e.addEventListener("autosize:update",p,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",n.set(e,{destroy:a,update:p}),l()}function l(){var s=window.getComputedStyle(e,null);"vertical"===s.resize?e.style.resize="none":"both"===s.resize&&(e.style.resize="horizontal"),t="content-box"===s.boxSizing?-(parseFloat(s.paddingTop)+parseFloat(s.paddingBottom)):parseFloat(s.borderTopWidth)+parseFloat(s.borderBottomWidth),isNaN(t)&&(t=0),p()}function c(t){var s=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=s,e.style.overflowY=t}function d(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function u(){if(0!==e.scrollHeight){var o=d(e),n=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",s=e.clientWidth,o.forEach((function(e){e.node.scrollTop=e.scrollTop})),n&&(document.documentElement.scrollTop=n)}}function p(){u();var t=Math.round(parseFloat(e.style.height)),s=window.getComputedStyle(e,null),n="content-box"===s.boxSizing?Math.round(parseFloat(s.height)):e.offsetHeight;if(n<t?"hidden"===s.overflowY&&(c("scroll"),u(),n="content-box"===s.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==s.overflowY&&(c("hidden"),u(),n="content-box"===s.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),o!==n){o=n;var r=i("autosize:resized");try{e.dispatchEvent(r)}catch(e){}}}}function a(e){var t=n.get(e);t&&t.destroy()}function l(e){var t=n.get(e);t&&t.update()}var c=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((c=function(e){return e}).destroy=function(e){return e},c.update=function(e){return e}):((c=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return r(e,t)})),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],a),e},c.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],l),e}),t.default=c,e.exports=t.default},void 0===(n="function"==typeof s?s.apply(t,o):s)||(e.exports=n)},4462:function(e,t,s){"use strict";var o,n=this&&this.__extends||(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])},function(e,t){function s(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)}),i=this&&this.__assign||Object.assign||function(e){for(var t,s=1,o=arguments.length;s<o;s++)for(var n in t=arguments[s])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},r=this&&this.__rest||function(e,t){var s={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(s[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&(s[o[n]]=e[o[n]])}return s};t.__esModule=!0;var a=s(1609),l=s(5826),c=s(4306),d=s(461),u="autosize:resized",p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={lineHeight:null},t.textarea=null,t.onResize=function(e){t.props.onResize&&t.props.onResize(e)},t.updateLineHeight=function(){t.textarea&&t.setState({lineHeight:d(t.textarea)})},t.onChange=function(e){var s=t.props.onChange;t.currentValue=e.currentTarget.value,s&&s(e)},t}return n(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props,s=t.maxRows,o=t.async;"number"==typeof s&&this.updateLineHeight(),"number"==typeof s||o?setTimeout((function(){return e.textarea&&c(e.textarea)})):this.textarea&&c(this.textarea),this.textarea&&this.textarea.addEventListener(u,this.onResize)},t.prototype.componentWillUnmount=function(){this.textarea&&(this.textarea.removeEventListener(u,this.onResize),c.destroy(this.textarea))},t.prototype.render=function(){var e=this,t=this.props,s=(t.onResize,t.maxRows),o=(t.onChange,t.style),n=(t.innerRef,t.children),l=r(t,["onResize","maxRows","onChange","style","innerRef","children"]),c=this.state.lineHeight,d=s&&c?c*s:null;return a.createElement("textarea",i({},l,{onChange:this.onChange,style:d?i({},o,{maxHeight:d}):o,ref:function(t){e.textarea=t,"function"==typeof e.props.innerRef?e.props.innerRef(t):e.props.innerRef&&(e.props.innerRef.current=t)}}),n)},t.prototype.componentDidUpdate=function(){this.textarea&&c.update(this.textarea)},t.defaultProps={rows:1,async:!1},t.propTypes={rows:l.number,maxRows:l.number,onResize:l.func,innerRef:l.any,async:l.bool},t}(a.Component);t.TextareaAutosize=a.forwardRef((function(e,t){return a.createElement(p,i({},e,{innerRef:t}))}))},5215:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var o,n,i;if(Array.isArray(t)){if((o=t.length)!=s.length)return!1;for(n=o;0!=n--;)if(!e(t[n],s[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((o=(i=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(s,i[n]))return!1;for(n=o;0!=n--;){var r=i[n];if(!e(t[r],s[r]))return!1}return!0}return t!=t&&s!=s}},5826:(e,t,s)=>{e.exports=s(628)()},6109:e=>{e.exports=function(e,t,s){return((s=window.getComputedStyle)?s(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},s=Object.keys(t).join("|"),o=new RegExp(s,"g"),n=new RegExp(s,"");function i(e){return t[e]}var r=function(e){return e.replace(o,i)};e.exports=r,e.exports.has=function(e){return!!e.match(n)},e.exports.remove=r}},t={};function s(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,s),i.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";s.r(o),s.d(o,{AlignmentToolbar:()=>Qh,Autocomplete:()=>qh,AutosaveMonitor:()=>Wc,BlockAlignmentToolbar:()=>Xh,BlockControls:()=>Jh,BlockEdit:()=>eg,BlockEditorKeyboardShortcuts:()=>tg,BlockFormatControls:()=>sg,BlockIcon:()=>og,BlockInspector:()=>ng,BlockList:()=>ig,BlockMover:()=>rg,BlockNavigationDropdown:()=>ag,BlockSelectionClearer:()=>lg,BlockSettingsMenu:()=>cg,BlockTitle:()=>dg,BlockToolbar:()=>ug,CharacterCount:()=>zh,ColorPalette:()=>pg,ContrastChecker:()=>mg,CopyHandler:()=>hg,DefaultBlockAppender:()=>gg,DocumentBar:()=>Xc,DocumentOutline:()=>ld,DocumentOutlineCheck:()=>cd,EditorHistoryRedo:()=>md,EditorHistoryUndo:()=>hd,EditorKeyboardShortcuts:()=>Fl,EditorKeyboardShortcutsRegister:()=>dd,EditorNotices:()=>_d,EditorProvider:()=>ql,EditorSnackbars:()=>bd,EntitiesSavedStates:()=>jd,ErrorBoundary:()=>Nd,FontSizePicker:()=>_g,InnerBlocks:()=>bg,Inserter:()=>fg,InspectorAdvancedControls:()=>yg,InspectorControls:()=>xg,LocalAutosaveMonitor:()=>Md,MediaPlaceholder:()=>Pg,MediaUpload:()=>jg,MediaUploadCheck:()=>Eg,MultiSelectScrollIntoView:()=>Tg,NavigableToolbar:()=>Bg,ObserveTyping:()=>Ig,PageAttributesCheck:()=>Ld,PageAttributesOrder:()=>Vd,PageAttributesPanel:()=>eu,PageAttributesParent:()=>Qd,PageTemplate:()=>uu,PanelColorSettings:()=>vg,PlainText:()=>Sg,PluginBlockSettingsMenuItem:()=>Su,PluginDocumentSettingPanel:()=>vu,PluginMoreMenuItem:()=>wu,PluginPostPublishPanel:()=>ju,PluginPostStatusInfo:()=>Iu,PluginPrePublishPanel:()=>Ru,PluginPreviewMenuItem:()=>Mu,PluginSidebar:()=>Lu,PluginSidebarMoreMenuItem:()=>Ou,PostAuthor:()=>qu,PostAuthorCheck:()=>Qu,PostAuthorPanel:()=>Ju,PostComments:()=>tp,PostDiscussionPanel:()=>rp,PostExcerpt:()=>ap,PostExcerptCheck:()=>lp,PostExcerptPanel:()=>gp,PostFeaturedImage:()=>Pp,PostFeaturedImageCheck:()=>yp,PostFeaturedImagePanel:()=>Ep,PostFormat:()=>Ip,PostFormatCheck:()=>Tp,PostLastRevision:()=>Rp,PostLastRevisionCheck:()=>Np,PostLastRevisionPanel:()=>Mp,PostLockedModal:()=>Lp,PostPendingStatus:()=>Fp,PostPendingStatusCheck:()=>Op,PostPingbacks:()=>sp,PostPreviewButton:()=>Vp,PostPublishButton:()=>Gp,PostPublishButtonLabel:()=>zp,PostPublishPanel:()=>Qm,PostSavedState:()=>rh,PostSchedule:()=>pm,PostScheduleCheck:()=>ah,PostScheduleLabel:()=>hm,PostSchedulePanel:()=>ch,PostSticky:()=>th,PostStickyCheck:()=>eh,PostSwitchToDraftButton:()=>dh,PostSyncStatus:()=>uh,PostTaxonomies:()=>mh,PostTaxonomiesCheck:()=>hh,PostTaxonomiesFlatTermSelector:()=>jm,PostTaxonomiesHierarchicalTermSelector:()=>Lm,PostTaxonomiesPanel:()=>_h,PostTemplatePanel:()=>Gu,PostTextEditor:()=>bh,PostTitle:()=>kh,PostTitleRaw:()=>Ch,PostTrash:()=>jh,PostTrashCheck:()=>Ph,PostTypeSupportCheck:()=>Od,PostURL:()=>Eh,PostURLCheck:()=>Th,PostURLLabel:()=>Bh,PostURLPanel:()=>Nh,PostVisibility:()=>Zp,PostVisibilityCheck:()=>Rh,PostVisibilityLabel:()=>Kp,RichText:()=>Kh,RichTextShortcut:()=>wg,RichTextToolbarButton:()=>kg,ServerSideRender:()=>Wh(),SkipToSelectedBlock:()=>Ng,TableOfContents:()=>Hh,TextEditorGlobalKeyboardShortcuts:()=>Yg,ThemeSupportCheck:()=>bp,TimeToRead:()=>Vh,URLInput:()=>Dg,URLInputButton:()=>Ag,URLPopover:()=>Rg,UnsavedChangesWarning:()=>Gh,VisualEditorGlobalKeyboardShortcuts:()=>Zg,Warning:()=>Mg,WordCount:()=>Oh,WritingFlow:()=>Lg,__unstableRichTextInputEvent:()=>Cg,cleanForSlug:()=>Kg,createCustomColorsHOC:()=>Og,getColorClassName:()=>Fg,getColorObjectByAttributeValues:()=>Vg,getColorObjectByColorValue:()=>zg,getFontSize:()=>Ug,getFontSizeClass:()=>Hg,getTemplatePartIcon:()=>U,mediaUpload:()=>Mr,privateApis:()=>Nb,registerEntityAction:()=>Db,registerEntityField:()=>Rb,store:()=>Ac,storeConfig:()=>Dc,transformStyles:()=>h.transformStyles,unregisterEntityAction:()=>Ab,unregisterEntityField:()=>Mb,useEntitiesSavedStatesIsDirty:()=>Cd,usePostScheduleLabel:()=>gm,usePostURLLabel:()=>Ih,usePostVisibilityLabel:()=>qp,userAutocompleter:()=>Mc,withColorContext:()=>Gg,withColors:()=>$g,withFontSizes:()=>Wg});var e={};s.r(e),s.d(e,{__experimentalGetDefaultTemplatePartAreas:()=>ls,__experimentalGetDefaultTemplateType:()=>cs,__experimentalGetDefaultTemplateTypes:()=>as,__experimentalGetTemplateInfo:()=>ds,__unstableIsEditorReady:()=>et,canInsertBlockType:()=>os,canUserUseUnfilteredHTML:()=>$e,didPostSaveRequestFail:()=>Ee,didPostSaveRequestSucceed:()=>je,getActivePostLock:()=>Ge,getAdjacentBlockClientId:()=>Et,getAutosaveAttribute:()=>me,getBlock:()=>mt,getBlockAttributes:()=>pt,getBlockCount:()=>yt,getBlockHierarchyRootClientId:()=>jt,getBlockIndex:()=>Ut,getBlockInsertionPoint:()=>Xt,getBlockListSettings:()=>rs,getBlockMode:()=>Kt,getBlockName:()=>dt,getBlockOrder:()=>zt,getBlockRootClientId:()=>Pt,getBlockSelectionEnd:()=>vt,getBlockSelectionStart:()=>xt,getBlocks:()=>ht,getBlocksByClientId:()=>bt,getClientIdsOfDescendants:()=>gt,getClientIdsWithDescendants:()=>_t,getCurrentPost:()=>oe,getCurrentPostAttribute:()=>de,getCurrentPostId:()=>ie,getCurrentPostLastRevisionId:()=>le,getCurrentPostRevisionsCount:()=>ae,getCurrentPostType:()=>ne,getCurrentTemplateId:()=>re,getDeviceType:()=>ot,getEditedPostAttribute:()=>pe,getEditedPostContent:()=>De,getEditedPostPreviewLink:()=>Ie,getEditedPostSlug:()=>Le,getEditedPostVisibility:()=>he,getEditorBlocks:()=>Ze,getEditorMode:()=>rt,getEditorSelection:()=>Je,getEditorSelectionEnd:()=>Xe,getEditorSelectionStart:()=>Qe,getEditorSettings:()=>tt,getFirstMultiSelectedBlockClientId:()=>At,getGlobalBlockCount:()=>ft,getInserterItems:()=>ns,getLastMultiSelectedBlockClientId:()=>Rt,getMultiSelectedBlockClientIds:()=>Nt,getMultiSelectedBlocks:()=>Dt,getMultiSelectedBlocksEndClientId:()=>Vt,getMultiSelectedBlocksStartClientId:()=>Ft,getNextBlockClientId:()=>Bt,getPermalink:()=>Me,getPermalinkParts:()=>Oe,getPostEdits:()=>ce,getPostLockUser:()=>He,getPostTypeLabel:()=>us,getPreviousBlockClientId:()=>Tt,getRenderingMode:()=>st,getSelectedBlock:()=>Ct,getSelectedBlockClientId:()=>kt,getSelectedBlockCount:()=>St,getSelectedBlocksInitialCaretPosition:()=>It,getStateBeforeOptimisticTransaction:()=>at,getSuggestedPostFormat:()=>Ne,getTemplate:()=>ts,getTemplateLock:()=>ss,hasChangedContent:()=>J,hasEditorRedo:()=>Q,hasEditorUndo:()=>q,hasInserterItems:()=>is,hasMultiSelection:()=>Wt,hasNonPostEntityChanges:()=>te,hasSelectedBlock:()=>wt,hasSelectedInnerBlock:()=>Gt,inSomeHistory:()=>